Commit 2d770e9
committed
SCP: Enable C99 standard 'bool'
Teach SIMH to make use of the C standard bool type when supported,
implemented in the support/sim_bool.h header.
- If the compiler claims that __STDC_VERSION__ is C99 and above, or
if the Microsoft C compiler version is at least 1800, include
stdbool.h, typedef t_bool to bool, set TRUE and FALSE to true and
false, respectively.
- If not a standard compliant compiler or older Microsoft compiler,
typedef t_bool to int, TRUE = 1 and FALSE = 0 (i.e., the old SIMH
settings.)
CMake: Use target_compiler_feature() to baseline C99 dialect.
Make a pass through the SIMH code base for t_bool variable declarations
and associated references:
- Ensure boolean expressions are boolean expressions, e.g.,
"(foo & mask) != 0" vs. "foo & mask" to remove any ambiguity.
Overkill, perhaps, but explicitly and unambiguously Boolean.
- Fix expressions, declarations where t_bool was assumed to be the
same as int.
- Fix inconsistent function prototypes.
3B2:
3b2_mau.h: Adjust *_SIGN() macros to produce Boolean expressions.
AltairZ80:
s100_dazzler.c: Change daz_0e, daz_0f and daz_frame's type from t_bool to
uint8, remove assumption that t_bool is type-equivalent to int.
m68k/m68k.h, m68k/m68kcpu.c: Rename TRUE to NMI_TRUE, FALSE to NMI_FALSE
to resolve namespace collision with SIMH TRUE and FALSE.
H316:
h316_hi.c, h316_mi.c: Ensure assignment result is Boolean.
hp2100_defs.h, FLIP_FLOP enum: Alias CLEAR and SET to FALSE and TRUE,
respectively, to avoid any compiler ambiguity with respect to
Boolean values.
hp2100_sys.c: Update assignment to Boolean result.
HP3000:
hp3000_lp.c: Ensure (device_command ^ J2W10_INSTALLED) evaluates to a
Boolean expression. Instantiates a separate boolean variable to
preserve comment formatting.
I1401:
i1401_cpu.c: Initialize clear to FALSE (vice 0), ensure conv_old is
assigned a Boolean value in cpu_set_conv() (t_bool is not int32.)
i1401_iq.c: Assign use_h from a Boolean expression.
i1401_sys.c: Assign use_h from a Boolean expression in dcw() and
fprint_sym().
I7094:
Fix ch6_req_wr() return type: should be t_bool, not t_stat.
Ibm1130:
ibm1130_cr.c: Remove extraneous extern declaraction for cgi.
ibm1130_defs.h: Change cgi and cgiwritable's extern declaration type to
t_bool to be consistent with actual definitions.
ibm1130_disk.c: Assign raw_disk_debug from a Boolean expression.
ibm1139_gui.c: Update update_gui() prototype to be consistent across the
GUI and non-GUI compile paths.
ibm1130_sca.c: Assign any_timer_running from a Boolean expression.
ibm1130_stddev.c: Remove extraneous extern declaraction for cgi.
t_bool for update_gui
Interdata:
id_idc.c: Fix idc_wds() return type (was t_stat, should be t_bool.)
ND100:
nd100_sys.c: Update sim_load()'s flag declaration. Should be int, not
t_bool (flag is an unused parameter.)
PDP10:
pdp10_ksio.c: Return type from build_dib_tab should be t_stat,
not t_bool.
PDP11:
pdp11_cr.c: Assign eof_pending to TRUE (vice 1.)
pdp11_rq.c: Assign dontchangecapac from Boolean expression.
SAGE:
m68k_sys.c: Fix sim_load()'s flag parameter type, should be int, not
t_bool.
VAX:
vax_sysdev.c: Initialize ka_hltenab, tmr_inst[] to TRUE, FALSE to be
consistent with t_bool.
vax_va.c, vax_vc.c, vax4xx_va.c, vax4xx_vc.c: Assign va_input_captured
from Boolean expression.
vax780_fload.c: Update rtfile_read() return type to t_bool (not t_stat.)1 parent c20b391 commit 2d770e9
42 files changed
Lines changed: 111 additions & 69 deletions
File tree
- 3B2
- AltairZ80
- m68k
- example
- softfloat
- H316
- HP2100
- HP3000
- I1401
- I7094
- Ibm1130
- Interdata
- ND100
- PDP10
- PDP11
- SAGE
- VAX
- cmake
- support
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
| 193 | + | |
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1047 | 1047 | | |
1048 | 1048 | | |
1049 | 1049 | | |
1050 | | - | |
| 1050 | + | |
1051 | 1051 | | |
1052 | 1052 | | |
1053 | 1053 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1047 | 1047 | | |
1048 | 1048 | | |
1049 | 1049 | | |
1050 | | - | |
| 1050 | + | |
1051 | 1051 | | |
1052 | 1052 | | |
1053 | 1053 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2136 | 2136 | | |
2137 | 2137 | | |
2138 | 2138 | | |
2139 | | - | |
| 2139 | + | |
2140 | 2140 | | |
2141 | 2141 | | |
2142 | 2142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
| 41 | + | |
| 42 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
| 66 | + | |
| 67 | + | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
784 | 784 | | |
785 | 785 | | |
786 | 786 | | |
787 | | - | |
| 787 | + | |
788 | 788 | | |
789 | 789 | | |
790 | 790 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
694 | 694 | | |
695 | 695 | | |
696 | 696 | | |
697 | | - | |
| 697 | + | |
698 | 698 | | |
699 | 699 | | |
700 | 700 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
740 | 740 | | |
741 | 741 | | |
742 | 742 | | |
743 | | - | |
744 | | - | |
| 743 | + | |
| 744 | + | |
745 | 745 | | |
746 | 746 | | |
747 | 747 | | |
| |||
0 commit comments