Skip to content

Commit 545fdf1

Browse files
authored
Merge pull request #25 from mcayland/fix/c99-stdbool
Update from using internal bool implementation to stdbool
2 parents fd2d8e4 + 3fa70fe commit 545fdf1

28 files changed

+533
-566
lines changed

detok/addfcodes.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static void skip_whitespace(char **string_line_ptr)
171171

172172
static bool get_next_vfc_line(void)
173173
{
174-
bool retval = FALSE; /* TRUE = not at end yet */
174+
bool retval = false; /* TRUE = not at end yet */
175175
while (vfc_remainder < vfc_buf_end) {
176176
current_vfc_line = (char *)vfc_remainder;
177177
vfc_remainder = (u8 *)strchr((const char *)current_vfc_line, '\n');
@@ -185,7 +185,7 @@ static bool get_next_vfc_line(void)
185185
continue; /* Comment */
186186
if (*current_vfc_line == '\\')
187187
continue; /* Comment */
188-
retval = TRUE;
188+
retval = true;
189189
break; /* Found something */
190190
}
191191
return (retval);
@@ -212,7 +212,7 @@ static bool get_next_vfc_line(void)
212212
* "Splash" message...
213213
*
214214
**************************************************************************** */
215-
static bool did_not_splash = TRUE;
215+
static bool did_not_splash = true;
216216
static void vfc_splash(char *vf_file_name)
217217
{
218218
if (did_not_splash) {
@@ -224,7 +224,7 @@ static void vfc_splash(char *vf_file_name)
224224
vf_file_name);
225225
printremark(strbfr);
226226
free(strbfr);
227-
did_not_splash = FALSE;
227+
did_not_splash = false;
228228
}
229229
}
230230

@@ -286,9 +286,9 @@ static void vfc_splash(char *vf_file_name)
286286

287287
bool add_fcodes_from_list(char *vf_file_name)
288288
{
289-
bool retval = FALSE;
289+
bool retval = false;
290290
int added_fc_count = 0;
291-
check_tok_seq = FALSE;
291+
check_tok_seq = false;
292292

293293
if (verbose)
294294
vfc_splash(vf_file_name);
@@ -369,12 +369,12 @@ bool add_fcodes_from_list(char *vf_file_name)
369369

370370
/* Check if the name is on the "Special Functions List" */
371371
{
372-
bool found_spf = FALSE;
372+
bool found_spf = false;
373373
int indx;
374374
for (indx = 0; indx < spcl_func_count; indx++) {
375375
if ( strcmp( vs_fc_name, spcl_func_list[indx].name) == 0 ) {
376376
char strbuf[64];
377-
found_spf = TRUE;
377+
found_spf = true;
378378
spcl_func_list[indx].fcode = vs_fc_number;
379379
link_token( &spcl_func_list[indx]);
380380
added_fc_count++;
@@ -393,7 +393,7 @@ bool add_fcodes_from_list(char *vf_file_name)
393393
fc_name_cpy = strdup(vs_fc_name);
394394
add_token((u16) vs_fc_number, fc_name_cpy);
395395
added_fc_count++;
396-
retval = TRUE;
396+
retval = true;
397397
}
398398

399399
if (verbose) {
@@ -404,6 +404,6 @@ bool add_fcodes_from_list(char *vf_file_name)
404404
}
405405

406406
close_stream();
407-
check_tok_seq = TRUE;
407+
check_tok_seq = true;
408408
return (retval);
409409
}

detok/decode.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ static int indent; /* Current level of indentation */
5454
*
5555
**************************************************************************** */
5656

57-
static bool ended_okay = TRUE; /* FALSE if finished prematurely */
57+
static bool ended_okay = true; /* FALSE if finished prematurely */
5858

59-
bool offs16 = TRUE;
59+
bool offs16 = true;
6060
unsigned int linenum;
61-
bool end_found = FALSE;
61+
bool end_found = false;
6262
unsigned int token_streampos; /* Streampos() of currently-gotten token */
6363
u16 last_defined_token = 0;
6464

@@ -86,7 +86,7 @@ static void pretty_print_string(void)
8686
u8 len;
8787
u8 *strptr;
8888
int indx;
89-
bool in_parens = FALSE; /* Are we already inside parentheses? */
89+
bool in_parens = false; /* Are we already inside parentheses? */
9090

9191
strptr = get_string(&len);
9292

@@ -104,7 +104,7 @@ static void pretty_print_string(void)
104104
if (isprint(c)) {
105105
if (in_parens) {
106106
printf(" )");
107-
in_parens = FALSE;
107+
in_parens = false;
108108
}
109109
printf("%c", c);
110110
/* Quote-mark must escape itself */
@@ -113,7 +113,7 @@ static void pretty_print_string(void)
113113
} else {
114114
if (!in_parens) {
115115
printf("\"(");
116-
in_parens = TRUE;
116+
in_parens = true;
117117
}
118118
printf(" %02x", c);
119119
}
@@ -308,7 +308,7 @@ static s16 decode_offset(void)
308308
* theoretically possible, so we'll treat it as valid.
309309
* An offset of zero is also, of course, invalid.
310310
*/
311-
invalid_dest = BOOLVAL((dest <= 0)
311+
invalid_dest = ((dest <= 0)
312312
|| (dest > stream_max)
313313
|| (offs == 0));
314314

@@ -399,7 +399,7 @@ static void double_length_literal(void)
399399
static void offset16(void)
400400
{
401401
decode_default();
402-
offs16 = TRUE;
402+
offs16 = true;
403403
}
404404

405405
static void decode_branch(void)
@@ -482,7 +482,7 @@ static void decode_start(void)
482482

483483
static void decode_token(u16 token)
484484
{
485-
bool handy_flag = TRUE;
485+
bool handy_flag = true;
486486
switch (token) {
487487
case 0x0b5:
488488
new_token();
@@ -533,7 +533,7 @@ static void decode_token(u16 token)
533533
decode_two();
534534
break;
535535
case 0x0fd: /* version1 */
536-
handy_flag = FALSE;
536+
handy_flag = false;
537537
case 0x0f0: /* start0 */
538538
case 0x0f1: /* start1 */
539539
case 0x0f2: /* start2 */
@@ -545,7 +545,7 @@ static void decode_token(u16 token)
545545
break;
546546
case 0: /* end0 */
547547
case 0xff: /* end1 */
548-
end_found = TRUE;
548+
end_found = true;
549549
decode_default();
550550
break;
551551

@@ -611,15 +611,15 @@ static void decode_fcode_header(void)
611611
{
612612
long err_pos;
613613
u16 token;
614-
bool new_offs16 = TRUE;
614+
bool new_offs16 = true;
615615

616616
err_pos = get_streampos();
617617
indent = 0;
618618
token = next_token();
619619

620620
switch (token) {
621621
case 0x0fd: /* version1 */
622-
new_offs16 = FALSE;
622+
new_offs16 = false;
623623
case 0x0f0: /* start0 */
624624
case 0x0f1: /* start1 */
625625
case 0x0f2: /* start2 */
@@ -685,7 +685,7 @@ static void decode_fcode_block(void)
685685
unsigned int fc_block_start;
686686
unsigned int fc_block_end;
687687

688-
end_found = FALSE;
688+
end_found = false;
689689
fc_block_start = get_streampos();
690690

691691
decode_fcode_header();
@@ -714,7 +714,7 @@ static void decode_fcode_block(void)
714714
"Detokenization finished prematurely after %d of %d bytes.",
715715
get_streampos() - fc_block_start,
716716
fc_block_end - fc_block_start);
717-
ended_okay = FALSE;
717+
ended_okay = false;
718718
}
719719
printremark(temp_bufr);
720720
}
@@ -750,7 +750,7 @@ static void decode_fcode_block(void)
750750

751751
static bool another_fcode_block(void)
752752
{
753-
bool retval = FALSE;
753+
bool retval = false;
754754
u16 token;
755755

756756
token = next_token();
@@ -762,7 +762,7 @@ static bool another_fcode_block(void)
762762
case 0x0f1: /* start1 */
763763
case 0x0f2: /* start2 */
764764
case 0x0f3: /* start4 */
765-
retval = TRUE;
765+
retval = true;
766766
printremark
767767
("Subsequent FCode Block detected. Detokenizing.");
768768
break;
@@ -799,7 +799,7 @@ void detokenize(void)
799799
if (ended_okay) {
800800
init_fcode_block();
801801
}
802-
ended_okay = TRUE;
802+
ended_okay = true;
803803

804804
adjust_for_pci_header();
805805

detok/detok.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@
5151
"(C) Copyright 2006 coresystems GmbH"
5252
#define IBM_COPYR "(C) Copyright 2005 IBM Corporation. All Rights Reserved."
5353

54-
bool verbose = FALSE;
55-
bool decode_all = FALSE;
56-
bool show_linenumbers = FALSE;
57-
bool show_offsets = FALSE;
54+
bool verbose = false;
55+
bool decode_all = false;
56+
bool show_linenumbers = false;
57+
bool show_offsets = false;
5858

5959
/* Param is FALSE when beginning to detokenize,
6060
* TRUE preceding error-exit */
@@ -93,7 +93,7 @@ int main(int argc, char **argv)
9393
int c;
9494
const char *optstring = "vhanof:?";
9595
int linenumbers = 0;
96-
bool add_vfcodes = FALSE;
96+
bool add_vfcodes = false;
9797
char *vfc_filnam = NULL;
9898

9999
while (1) {
@@ -119,46 +119,46 @@ int main(int argc, char **argv)
119119

120120
switch (c) {
121121
case 'v':
122-
verbose = TRUE;
122+
verbose = true;
123123
break;
124124
case 'a':
125-
decode_all = TRUE;
125+
decode_all = true;
126126
break;
127127
case 'n':
128128
linenumbers |= 1;
129-
show_linenumbers = TRUE;
129+
show_linenumbers = true;
130130
break;
131131
case 'o':
132132
linenumbers |= 2;
133-
show_linenumbers = TRUE;
134-
show_offsets = TRUE;
133+
show_linenumbers = true;
134+
show_offsets = true;
135135
break;
136136
case 'f':
137-
add_vfcodes = TRUE;
137+
add_vfcodes = true;
138138
vfc_filnam = optarg;
139139
break;
140140
case 'h':
141141
case '?':
142-
print_copyright(TRUE);
142+
print_copyright(true);
143143
usage(argv[0]);
144144
return 0;
145145
default:
146-
print_copyright(TRUE);
146+
print_copyright(true);
147147
printf("%s: unknown option.\n", argv[0]);
148148
usage(argv[0]);
149149
return 1;
150150
}
151151
}
152152

153153
if (verbose)
154-
print_copyright(FALSE);
154+
print_copyright(false);
155155

156156
if (linenumbers > 2)
157157
printremark
158158
("Line numbers will be disabled in favour of offsets.\n");
159159

160160
if (optind >= argc) {
161-
print_copyright(TRUE);
161+
print_copyright(true);
162162
printf("%s: filename missing.\n", argv[0]);
163163
usage(argv[0]);
164164
return 1;

detok/dictionary.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
#include "detok.h"
3838

39-
bool check_tok_seq = TRUE;
39+
bool check_tok_seq = true;
4040
static token_t *dictionary; /* Initialize dynamically to accommodate AIX */
4141

4242
static char *fcerror = "ferror";

detok/pcihdr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,15 +443,15 @@ void handle_pci_filler(u8 * filler_ptr)
443443
u8 *scan_ptr;
444444
int filler_len;
445445
char temp_buf[80];
446-
bool all_zero = TRUE;
446+
bool all_zero = true;
447447
u8 filler_byte = *filler_ptr;
448448

449449
filler_len = pci_image_end - filler_ptr;
450450

451451
for (scan_ptr = filler_ptr;
452452
scan_ptr < pci_image_end; filler_byte = *(++scan_ptr)) {
453453
if (filler_byte != 0) {
454-
all_zero = FALSE;
454+
all_zero = false;
455455
break;
456456
}
457457
}

detok/stream.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ u8 *max;
7575
**************************************************************************** */
7676
u8 *indata;
7777
static u8 *fc_start;
78-
static bool pci_image_found = FALSE;
78+
static bool pci_image_found = false;
7979

8080

8181
int init_stream(char *name)
@@ -230,10 +230,10 @@ static u8 *get_bytes(int nbytes)
230230
{
231231
u8 *retval = pc;
232232
if (pc == max) {
233-
throw_eof(FALSE);
233+
throw_eof(false);
234234
}
235235
if (pc + nbytes > max) {
236-
throw_eof(TRUE);
236+
throw_eof(true);
237237
}
238238
pc += nbytes;
239239
return retval;
@@ -251,7 +251,7 @@ static u8 *get_bytes(int nbytes)
251251
bool more_to_go(void)
252252
{
253253
bool retval;
254-
retval = INVERSE(pc == max);
254+
retval = !(pc == max);
255255
return retval;
256256
}
257257

@@ -505,7 +505,7 @@ void adjust_for_pci_header(void)
505505
int pci_header_size;
506506

507507
pci_header_size = handle_pci_header(pc);
508-
pci_image_found = pci_header_size > 0 ? TRUE : FALSE;
508+
pci_image_found = pci_header_size > 0 ? true : false;
509509
pc += pci_header_size;
510510
fc_start += pci_header_size;
511511
last_defined_token = 0;
@@ -543,6 +543,6 @@ void adjust_for_pci_filler(void)
543543
pci_filler_len = pci_image_end - pc;
544544
pci_filler_ptr = get_bytes(pci_filler_len);
545545
handle_pci_filler(pci_filler_ptr);
546-
pci_image_found = FALSE;
546+
pci_image_found = false;
547547
}
548548
}

0 commit comments

Comments
 (0)