diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | array.c | 16 | ||||
-rw-r--r-- | awk.h | 53 | ||||
-rw-r--r-- | awkgram.c | 615 | ||||
-rw-r--r-- | awkgram.y | 233 | ||||
-rw-r--r-- | builtin.c | 150 | ||||
-rw-r--r-- | cint_array.c | 12 | ||||
-rw-r--r-- | cmd.h | 8 | ||||
-rw-r--r-- | command.c | 58 | ||||
-rw-r--r-- | command.y | 58 | ||||
-rw-r--r-- | debug.c | 495 | ||||
-rw-r--r-- | eval.c | 54 | ||||
-rw-r--r-- | ext.c | 4 | ||||
-rw-r--r-- | extension/ChangeLog | 4 | ||||
-rw-r--r-- | extension/arrayparm.c | 6 | ||||
-rw-r--r-- | extension/dl.c | 4 | ||||
-rw-r--r-- | extension/filefuncs.c | 6 | ||||
-rw-r--r-- | extension/fork.c | 2 | ||||
-rw-r--r-- | extension/ordchr.c | 4 | ||||
-rw-r--r-- | extension/readfile.c | 2 | ||||
-rw-r--r-- | extension/rwarray.c | 8 | ||||
-rw-r--r-- | extension/testarg.c | 8 | ||||
-rw-r--r-- | field.c | 158 | ||||
-rw-r--r-- | int_array.c | 8 | ||||
-rw-r--r-- | interpret.h | 40 | ||||
-rw-r--r-- | io.c | 146 | ||||
-rw-r--r-- | main.c | 118 | ||||
-rw-r--r-- | mpfr.c | 36 | ||||
-rw-r--r-- | msg.c | 2 | ||||
-rw-r--r-- | node.c | 20 | ||||
-rw-r--r-- | posix/ChangeLog | 4 | ||||
-rw-r--r-- | posix/gawkmisc.c | 8 | ||||
-rw-r--r-- | profile.c | 62 | ||||
-rw-r--r-- | re.c | 83 | ||||
-rw-r--r-- | symbol.c | 4 |
35 files changed, 1246 insertions, 1247 deletions
@@ -1,3 +1,7 @@ +2012-05-11 Arnold D. Robbins <arnold@skeeve.com> + + Sweeping change: Use `bool', `true', and `false' everywhere. + 2012-04-09 Andrew J. Schorr <aschorr@telemetry-investments.com> * eval.c (unset_ERRNO): Fix memory management bug -- need to use @@ -69,13 +69,13 @@ register_array_func(array_ptr *afunc) { if (afunc && num_atypes < MAX_ATYPE) { if (afunc != str_array_func && ! afunc[1]) - return FALSE; + return false; atypes[num_atypes++] = afunc; if (afunc[0]) /* execute init routine if any */ (void) (*afunc[0])(NULL, NULL); - return TRUE; + return true; } - return FALSE; + return false; } @@ -338,14 +338,14 @@ array_vname(const NODE *symbol) */ NODE * -get_array(NODE *symbol, int canfatal) +get_array(NODE *symbol, bool canfatal) { NODE *save_symbol = symbol; - int isparam = FALSE; + bool isparam = false; if (symbol->type == Node_param_list) { save_symbol = symbol = GET_PARAM(symbol->param_cnt); - isparam = TRUE; + isparam = true; if (symbol->type == Node_array_ref) symbol = symbol->orig_array; } @@ -392,9 +392,9 @@ set_SUBSEP() /* concat_exp --- concatenate expression list into a single string */ NODE * -concat_exp(int nargs, int do_subsep) +concat_exp(int nargs, bool do_subsep) { - /* do_subsep is FALSE for Op_concat */ + /* do_subsep is false for Op_concat */ NODE *r; char *str; char *s; @@ -279,12 +279,6 @@ extern double gawk_strtod(); #define AWKNUM double -#ifndef TRUE -/* a bit hackneyed, but what the heck */ -#define TRUE 1 -#define FALSE 0 -#endif - #define INT32_BIT 32 enum defrule { BEGIN = 1, Rule, END, BEGINFILE, ENDFILE, @@ -1021,7 +1015,7 @@ extern long NR; extern long FNR; extern int BINMODE; extern int IGNORECASE; -extern int RS_is_null; +extern bool RS_is_null; extern char *OFS; extern int OFSlen; extern char *ORS; @@ -1057,7 +1051,7 @@ extern NODE *_t; /* used as temporary in macros */ extern NODE *_r; /* used as temporary in macros */ extern BLOCK nextfree[]; -extern int field0_valid; +extern bool field0_valid; extern int do_flags; @@ -1105,7 +1099,7 @@ extern int do_flags; #define do_debug (do_flags & DO_DEBUG) #define do_mpfr (do_flags & DO_MPFR) -extern int do_optimize; +extern bool do_optimize; extern int use_lc_numeric; extern int exit_val; @@ -1137,7 +1131,7 @@ extern mpfr_rnd_t ROUND_MODE; extern mpz_t MNR; extern mpz_t MFNR; extern mpz_t mpzval; -extern int do_ieee_fmt; /* emulate IEEE 754 floating-point format */ +extern bool do_ieee_fmt; /* emulate IEEE 754 floating-point format */ #endif @@ -1194,10 +1188,10 @@ extern STACK_ITEM *stack_top; #if __GNUC__ >= 2 #define POP_ARRAY() ({ NODE *_t = POP(); \ - _t->type == Node_var_array ? _t : get_array(_t, TRUE); }) + _t->type == Node_var_array ? _t : get_array(_t, true); }) #define POP_PARAM() ({ NODE *_t = POP(); \ - _t->type == Node_var_array ? _t : get_array(_t, FALSE); }) + _t->type == Node_var_array ? _t : get_array(_t, false); }) #define POP_SCALAR() ({ NODE *_t = POP(); _t->type != Node_var_array ? _t \ : (fatal(_("attempt to use array `%s' in a scalar context"), array_vname(_t)), _t);}) @@ -1210,10 +1204,10 @@ extern STACK_ITEM *stack_top; #else /* not __GNUC__ */ #define POP_ARRAY() (_t = POP(), \ - _t->type == Node_var_array ? _t : get_array(_t, TRUE)) + _t->type == Node_var_array ? _t : get_array(_t, true)) #define POP_PARAM() (_t = POP(), \ - _t->type == Node_var_array ? _t : get_array(_t, FALSE)) + _t->type == Node_var_array ? _t : get_array(_t, false)) #define POP_SCALAR() (_t = POP(), _t->type != Node_var_array ? _t \ : (fatal(_("attempt to use array `%s' in a scalar context"), array_vname(_t)), _t)) @@ -1341,7 +1335,7 @@ extern NODE *r_force_string(NODE *s); #define fatal set_loc(__FILE__, __LINE__), r_fatal extern jmp_buf fatal_tag; -extern int fatal_tag_valid; +extern bool fatal_tag_valid; #define PUSH_BINDING(stack, tag, val) \ if (val++) \ @@ -1384,13 +1378,13 @@ ADELETE = 0x100, /* need a single index; for use in do_delete_loop */ extern NODE *make_array(void); extern void init_array(NODE *symbol); -extern NODE *get_array(NODE *symbol, int canfatal); +extern NODE *get_array(NODE *symbol, bool canfatal); extern const char *make_aname(const NODE *symbol); extern const char *array_vname(const NODE *symbol); extern void array_init(void); extern int register_array_func(array_ptr *afunc); extern void set_SUBSEP(void); -extern NODE *concat_exp(int nargs, int do_subsep); +extern NODE *concat_exp(int nargs, bool do_subsep); extern NODE *r_in_array(NODE *symbol, NODE *subs); extern NODE *assoc_copy(NODE *symbol, NODE *newsymb); extern void assoc_dump(NODE *symbol, NODE *p); @@ -1411,7 +1405,7 @@ extern void dump_vars(const char *fname); extern const char *getfname(NODE *(*)(int)); extern void shadow_funcs(void); extern int check_special(const char *name); -extern SRCFILE *add_srcfile(int stype, char *src, SRCFILE *curr, int *already_included, int *errcode); +extern SRCFILE *add_srcfile(int stype, char *src, SRCFILE *curr, bool *already_included, int *errcode); extern void register_deferred_variable(const char *name, NODE *(*load_func)(void)); extern int files_are_same(char *path, SRCFILE *src); extern void valinfo(NODE *n, Func_print print_func, FILE *fp); @@ -1490,7 +1484,7 @@ extern void load_casetable(void); extern AWKNUM calc_exp(AWKNUM x1, AWKNUM x2); extern const char *opcode2str(OPCODE type); extern const char *op2str(OPCODE type); -extern NODE **r_get_lhs(NODE *n, int reference); +extern NODE **r_get_lhs(NODE *n, bool reference); extern STACK_ITEM *grow_stack(void); extern void dump_fcall_stack(FILE *fp); extern int register_exec_hook(Func_pre_exec preh, Func_post_exec posth); @@ -1500,9 +1494,9 @@ NODE *load_ext(const char *lib_name, const char *init_func, NODE *obj); #ifdef DYNAMIC void make_builtin(const char *, NODE *(*)(int), int); NODE *get_argument(int); -NODE *get_actual_argument(int, int, int); -#define get_scalar_argument(i, opt) get_actual_argument((i), (opt), FALSE) -#define get_array_argument(i, opt) get_actual_argument((i), (opt), TRUE) +NODE *get_actual_argument(int, bool, bool); +#define get_scalar_argument(i, opt) get_actual_argument((i), (opt), false) +#define get_array_argument(i, opt) get_actual_argument((i), (opt), true) #endif /* field.c */ extern void init_fields(void); @@ -1549,7 +1543,7 @@ extern void set_NR(void); extern struct redirect *redirect(NODE *redir_exp, int redirtype, int *errflg); extern NODE *do_close(int nargs); extern int flush_io(void); -extern int close_io(int *stdio_problem); +extern int close_io(bool *stdio_problem); extern int devopen(const char *name, const char *mode); extern int srcopen(SRCFILE *s); extern char *find_source(const char *src, struct stat *stb, int *errcode, int is_extlib); @@ -1557,9 +1551,9 @@ extern NODE *do_getline_redir(int intovar, enum redirval redirtype); extern NODE *do_getline(int intovar, IOBUF *iop); extern struct redirect *getredirect(const char *str, int len); extern int inrec(IOBUF *iop, int *errcode); -extern int nextfile(IOBUF **curfile, int skipping); +extern int nextfile(IOBUF **curfile, bool skipping); /* main.c */ -extern int arg_assign(char *arg, int initing); +extern int arg_assign(char *arg, bool initing); extern int is_std_var(const char *var); extern char *estrdup(const char *str, size_t len); extern void update_global_values(); @@ -1608,7 +1602,6 @@ extern void (*lintfunc) (const char *mesg, ...) ATTRIBUTE_PRINTF_1; extern void (*lintfunc) (const char *mesg, ...); #endif /* profile.c */ -extern void init_profiling(int *flag, const char *def_file); extern void init_profiling_signals(void); extern void set_prof_file(const char *filename); extern void dump_prog(INSTRUCTION *code); @@ -1617,7 +1610,7 @@ extern char *pp_string(const char *in_str, size_t len, int delim); extern char *pp_node(NODE *n); extern int pp_func(INSTRUCTION *pc, void *); extern void pp_string_fp(Func_print print_func, FILE *fp, const char *str, - size_t namelen, int delim, int breaklines); + size_t namelen, int delim, bool breaklines); /* node.c */ extern NODE *r_force_number(NODE *n); extern NODE *r_format_val(const char *format, int index, NODE *s); @@ -1643,7 +1636,7 @@ extern void init_btowc_cache(); #define free_wstr(NODE) /* empty */ #endif /* re.c */ -extern Regexp *make_regexp(const char *s, size_t len, int ignorecase, int dfa, int canfatal); +extern Regexp *make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal); extern int research(Regexp *rp, char *str, int start, size_t len, int flags); extern void refree(Regexp *rp); extern void reg_error(const char *s); @@ -1652,7 +1645,7 @@ extern void resyntax(int syntax); extern void resetup(void); extern int avoid_dfa(NODE *re, char *str, size_t len); extern int reisstring(const char *text, size_t len, Regexp *re, const char *buf); -extern int get_numbase(const char *str, int use_locale); +extern int get_numbase(const char *str, bool use_locale); /* symbol.c */ extern NODE *install_symbol(char *name, NODETYPE type); @@ -1672,7 +1665,7 @@ extern AWK_CONTEXT *new_context(void); extern void push_context(AWK_CONTEXT *ctxt); extern void pop_context(); extern int in_main_context(); -extern void free_context(AWK_CONTEXT *ctxt, int ); +extern void free_context(AWK_CONTEXT *ctxt, bool keep_globals); extern NODE **variable_list(); extern NODE **function_list(int sort); extern void print_vars(NODE **table, Func_print print_func, FILE *fp); @@ -116,7 +116,7 @@ static INSTRUCTION *mk_boolean(INSTRUCTION *left, INSTRUCTION *right, INSTRUCTIO static INSTRUCTION *mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op); static INSTRUCTION *mk_getline(INSTRUCTION *op, INSTRUCTION *opt_var, INSTRUCTION *redir, int redirtype); static NODE *make_regnode(int type, NODE *exp); -static int count_expressions(INSTRUCTION **list, int isarg); +static int count_expressions(INSTRUCTION **list, bool isarg); static INSTRUCTION *optimize_assignment(INSTRUCTION *exp); static void add_lint(INSTRUCTION *list, LINTTYPE linttype); @@ -127,8 +127,8 @@ static void check_funcs(void); static ssize_t read_one_line(int fd, void *buffer, size_t count); static int one_line_close(int fd); -static int want_source = FALSE; -static int want_regexp; /* lexical scanning kludge */ +static bool want_source = false; +static bool want_regexp; /* lexical scanning kludge */ static char *in_function; /* parsing kludge */ static int rule = 0; @@ -141,25 +141,24 @@ const char *const ruletab[] = { "ENDFILE", }; -static int in_print = FALSE; /* lexical scanning kludge for print */ +static bool in_print = false; /* lexical scanning kludge for print */ static int in_parens = 0; /* lexical scanning kludge for print */ static int sub_counter = 0; /* array dimension counter for use in delete */ static char *lexptr = NULL; /* pointer to next char during parsing */ static char *lexend; static char *lexptr_begin; /* keep track of where we were for error msgs */ static char *lexeme; /* beginning of lexeme for debugging */ -static int lexeof; /* seen EOF for current source? */ +static bool lexeof; /* seen EOF for current source? */ static char *thisline = NULL; static int in_braces = 0; /* count braces for firstline, lastline in an 'action' */ static int lastline = 0; static int firstline = 0; static SRCFILE *sourcefile = NULL; /* current program source */ static int lasttok = 0; -static int eof_warned = FALSE; /* GLOBAL: want warning for each file */ +static bool eof_warned = false; /* GLOBAL: want warning for each file */ static int break_allowed; /* kludge for break */ static int continue_allowed; /* kludge for continue */ - #define END_FILE -1000 #define END_SRC -2000 @@ -196,7 +195,7 @@ extern double fmod(double x, double y); /* Line 268 of yacc.c */ -#line 200 "awkgram.c" +#line 199 "awkgram.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -344,7 +343,7 @@ typedef int YYSTYPE; /* Line 343 of yacc.c */ -#line 348 "awkgram.c" +#line 347 "awkgram.c" #ifdef short # undef short @@ -707,25 +706,25 @@ static const yytype_int16 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 193, 193, 195, 200, 201, 205, 217, 221, 232, - 238, 243, 251, 259, 261, 266, 274, 276, 282, 283, - 285, 311, 322, 333, 339, 348, 358, 360, 362, 368, - 373, 374, 378, 397, 396, 430, 432, 437, 438, 451, - 456, 457, 461, 463, 465, 472, 562, 604, 646, 759, - 766, 773, 783, 792, 801, 810, 825, 841, 840, 864, - 876, 876, 974, 974, 999, 1022, 1028, 1029, 1035, 1036, - 1043, 1048, 1060, 1074, 1076, 1084, 1089, 1091, 1099, 1101, - 1110, 1111, 1119, 1124, 1124, 1135, 1139, 1147, 1148, 1151, - 1153, 1158, 1159, 1168, 1169, 1174, 1179, 1185, 1187, 1189, - 1196, 1197, 1203, 1204, 1209, 1211, 1216, 1218, 1220, 1222, - 1228, 1235, 1237, 1239, 1255, 1265, 1272, 1274, 1279, 1281, - 1283, 1291, 1293, 1298, 1300, 1305, 1307, 1309, 1359, 1361, - 1363, 1365, 1367, 1369, 1371, 1373, 1396, 1401, 1406, 1431, - 1437, 1439, 1441, 1443, 1445, 1447, 1452, 1456, 1488, 1490, - 1496, 1502, 1515, 1516, 1517, 1522, 1527, 1531, 1535, 1550, - 1563, 1568, 1604, 1622, 1623, 1629, 1630, 1635, 1637, 1644, - 1661, 1678, 1680, 1687, 1692, 1700, 1710, 1722, 1731, 1735, - 1739, 1743, 1747, 1751, 1754, 1756, 1760, 1764, 1768 + 0, 192, 192, 194, 199, 200, 204, 216, 220, 231, + 237, 242, 250, 258, 260, 265, 273, 275, 281, 282, + 284, 310, 321, 332, 338, 347, 357, 359, 361, 367, + 372, 373, 377, 396, 395, 429, 431, 436, 437, 450, + 455, 456, 460, 462, 464, 471, 561, 603, 645, 758, + 765, 772, 782, 791, 800, 809, 824, 840, 839, 863, + 875, 875, 973, 973, 998, 1021, 1027, 1028, 1034, 1035, + 1042, 1047, 1059, 1073, 1075, 1083, 1088, 1090, 1098, 1100, + 1109, 1110, 1118, 1123, 1123, 1134, 1138, 1146, 1147, 1150, + 1152, 1157, 1158, 1167, 1168, 1173, 1178, 1184, 1186, 1188, + 1195, 1196, 1202, 1203, 1208, 1210, 1215, 1217, 1219, 1221, + 1227, 1234, 1236, 1238, 1254, 1264, 1271, 1273, 1278, 1280, + 1282, 1290, 1292, 1297, 1299, 1304, 1306, 1308, 1358, 1360, + 1362, 1364, 1366, 1368, 1370, 1372, 1395, 1400, 1405, 1430, + 1436, 1438, 1440, 1442, 1444, 1446, 1451, 1455, 1487, 1489, + 1495, 1501, 1514, 1515, 1516, 1521, 1526, 1530, 1534, 1549, + 1562, 1567, 1603, 1621, 1622, 1628, 1629, 1634, 1636, 1643, + 1660, 1677, 1679, 1686, 1691, 1699, 1709, 1721, 1730, 1734, + 1738, 1742, 1746, 1750, 1753, 1755, 1759, 1763, 1767 }; #endif @@ -2047,7 +2046,7 @@ yyreduce: case 3: /* Line 1806 of yacc.c */ -#line 196 "awkgram.y" +#line 195 "awkgram.y" { rule = 0; yyerrok; @@ -2057,7 +2056,7 @@ yyreduce: case 5: /* Line 1806 of yacc.c */ -#line 202 "awkgram.y" +#line 201 "awkgram.y" { next_sourcefile(); } @@ -2066,7 +2065,7 @@ yyreduce: case 6: /* Line 1806 of yacc.c */ -#line 206 "awkgram.y" +#line 205 "awkgram.y" { rule = 0; /* @@ -2080,7 +2079,7 @@ yyreduce: case 7: /* Line 1806 of yacc.c */ -#line 218 "awkgram.y" +#line 217 "awkgram.y" { (void) append_rule((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)])); } @@ -2089,7 +2088,7 @@ yyreduce: case 8: /* Line 1806 of yacc.c */ -#line 222 "awkgram.y" +#line 221 "awkgram.y" { if (rule != Rule) { msg(_("%s blocks must have an action part"), ruletab[rule]); @@ -2105,7 +2104,7 @@ yyreduce: case 9: /* Line 1806 of yacc.c */ -#line 233 "awkgram.y" +#line 232 "awkgram.y" { in_function = NULL; (void) mk_function((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)])); @@ -2116,9 +2115,9 @@ yyreduce: case 10: /* Line 1806 of yacc.c */ -#line 239 "awkgram.y" +#line 238 "awkgram.y" { - want_source = FALSE; + want_source = false; yyerrok; } break; @@ -2126,9 +2125,9 @@ yyreduce: case 11: /* Line 1806 of yacc.c */ -#line 244 "awkgram.y" +#line 243 "awkgram.y" { - want_source = FALSE; + want_source = false; yyerrok; } break; @@ -2136,7 +2135,7 @@ yyreduce: case 12: /* Line 1806 of yacc.c */ -#line 252 "awkgram.y" +#line 251 "awkgram.y" { if (include_source((yyvsp[(1) - (1)])) < 0) YYABORT; @@ -2149,21 +2148,21 @@ yyreduce: case 13: /* Line 1806 of yacc.c */ -#line 260 "awkgram.y" +#line 259 "awkgram.y" { (yyval) = NULL; } break; case 14: /* Line 1806 of yacc.c */ -#line 262 "awkgram.y" +#line 261 "awkgram.y" { (yyval) = NULL; } break; case 15: /* Line 1806 of yacc.c */ -#line 267 "awkgram.y" +#line 266 "awkgram.y" { if (load_library((yyvsp[(1) - (1)])) < 0) YYABORT; @@ -2176,35 +2175,35 @@ yyreduce: case 16: /* Line 1806 of yacc.c */ -#line 275 "awkgram.y" +#line 274 "awkgram.y" { (yyval) = NULL; } break; case 17: /* Line 1806 of yacc.c */ -#line 277 "awkgram.y" +#line 276 "awkgram.y" { (yyval) = NULL; } break; case 18: /* Line 1806 of yacc.c */ -#line 282 "awkgram.y" +#line 281 "awkgram.y" { (yyval) = NULL; rule = Rule; } break; case 19: /* Line 1806 of yacc.c */ -#line 284 "awkgram.y" +#line 283 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); rule = Rule; } break; case 20: /* Line 1806 of yacc.c */ -#line 286 "awkgram.y" +#line 285 "awkgram.y" { INSTRUCTION *tp; @@ -2213,7 +2212,7 @@ yyreduce: tp = instruction(Op_no_op); list_prepend((yyvsp[(1) - (4)]), bcalloc(Op_line_range, !!do_pretty_print + 1, 0)); - (yyvsp[(1) - (4)])->nexti->triggered = FALSE; + (yyvsp[(1) - (4)])->nexti->triggered = false; (yyvsp[(1) - (4)])->nexti->target_jmp = (yyvsp[(4) - (4)])->nexti; list_append((yyvsp[(1) - (4)]), instruction(Op_cond_pair)); @@ -2235,7 +2234,7 @@ yyreduce: case 21: /* Line 1806 of yacc.c */ -#line 312 "awkgram.y" +#line 311 "awkgram.y" { static int begin_seen = 0; if (do_lint_old && ++begin_seen == 2) @@ -2251,7 +2250,7 @@ yyreduce: case 22: /* Line 1806 of yacc.c */ -#line 323 "awkgram.y" +#line 322 "awkgram.y" { static int end_seen = 0; if (do_lint_old && ++end_seen == 2) @@ -2267,7 +2266,7 @@ yyreduce: case 23: /* Line 1806 of yacc.c */ -#line 334 "awkgram.y" +#line 333 "awkgram.y" { (yyvsp[(1) - (1)])->in_rule = rule = BEGINFILE; (yyvsp[(1) - (1)])->source_file = source; @@ -2278,7 +2277,7 @@ yyreduce: case 24: /* Line 1806 of yacc.c */ -#line 340 "awkgram.y" +#line 339 "awkgram.y" { (yyvsp[(1) - (1)])->in_rule = rule = ENDFILE; (yyvsp[(1) - (1)])->source_file = source; @@ -2289,7 +2288,7 @@ yyreduce: case 25: /* Line 1806 of yacc.c */ -#line 349 "awkgram.y" +#line 348 "awkgram.y" { if ((yyvsp[(2) - (5)]) == NULL) (yyval) = list_create(instruction(Op_no_op)); @@ -2301,21 +2300,21 @@ yyreduce: case 26: /* Line 1806 of yacc.c */ -#line 359 "awkgram.y" +#line 358 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 27: /* Line 1806 of yacc.c */ -#line 361 "awkgram.y" +#line 360 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 28: /* Line 1806 of yacc.c */ -#line 363 "awkgram.y" +#line 362 "awkgram.y" { yyerror(_("`%s' is a built-in function, it cannot be redefined"), tokstart); @@ -2326,14 +2325,14 @@ yyreduce: case 29: /* Line 1806 of yacc.c */ -#line 369 "awkgram.y" +#line 368 "awkgram.y" { (yyval) = (yyvsp[(2) - (2)]); } break; case 32: /* Line 1806 of yacc.c */ -#line 379 "awkgram.y" +#line 378 "awkgram.y" { (yyvsp[(1) - (6)])->source_file = source; if (install_function((yyvsp[(2) - (6)])->lextok, (yyvsp[(1) - (6)]), (yyvsp[(4) - (6)])) < 0) @@ -2349,14 +2348,14 @@ yyreduce: case 33: /* Line 1806 of yacc.c */ -#line 397 "awkgram.y" +#line 396 "awkgram.y" { ++want_regexp; } break; case 34: /* Line 1806 of yacc.c */ -#line 399 "awkgram.y" +#line 398 "awkgram.y" { NODE *n, *exp; char *re; @@ -2390,21 +2389,21 @@ yyreduce: case 35: /* Line 1806 of yacc.c */ -#line 431 "awkgram.y" +#line 430 "awkgram.y" { bcfree((yyvsp[(1) - (1)])); } break; case 37: /* Line 1806 of yacc.c */ -#line 437 "awkgram.y" +#line 436 "awkgram.y" { (yyval) = NULL; } break; case 38: /* Line 1806 of yacc.c */ -#line 439 "awkgram.y" +#line 438 "awkgram.y" { if ((yyvsp[(2) - (2)]) == NULL) (yyval) = (yyvsp[(1) - (2)]); @@ -2422,28 +2421,28 @@ yyreduce: case 39: /* Line 1806 of yacc.c */ -#line 452 "awkgram.y" +#line 451 "awkgram.y" { (yyval) = NULL; } break; case 42: /* Line 1806 of yacc.c */ -#line 462 "awkgram.y" +#line 461 "awkgram.y" { (yyval) = NULL; } break; case 43: /* Line 1806 of yacc.c */ -#line 464 "awkgram.y" +#line 463 "awkgram.y" { (yyval) = (yyvsp[(2) - (3)]); } break; case 44: /* Line 1806 of yacc.c */ -#line 466 "awkgram.y" +#line 465 "awkgram.y" { if (do_pretty_print) (yyval) = list_prepend((yyvsp[(1) - (1)]), instruction(Op_exec_count)); @@ -2455,7 +2454,7 @@ yyreduce: case 45: /* Line 1806 of yacc.c */ -#line 473 "awkgram.y" +#line 472 "awkgram.y" { INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt; INSTRUCTION *ip, *nextc, *tbreak; @@ -2501,7 +2500,7 @@ yyreduce: case_values[case_count++] = caseval; } else { /* match a constant regex against switch expression. */ - (curr + 1)->match_exp = TRUE; + (curr + 1)->match_exp = true; } curr->stmt_start = casestmt->nexti; curr->stmt_end = casestmt->lasti; @@ -2550,7 +2549,7 @@ yyreduce: case 46: /* Line 1806 of yacc.c */ -#line 563 "awkgram.y" +#line 562 "awkgram.y" { /* * ----------------- @@ -2597,7 +2596,7 @@ yyreduce: case 47: /* Line 1806 of yacc.c */ -#line 605 "awkgram.y" +#line 604 "awkgram.y" { /* * ----------------- @@ -2644,7 +2643,7 @@ yyreduce: case 48: /* Line 1806 of yacc.c */ -#line 647 "awkgram.y" +#line 646 "awkgram.y" { INSTRUCTION *ip; char *var_name = (yyvsp[(3) - (8)])->lextok; @@ -2762,7 +2761,7 @@ regular_loop: case 49: /* Line 1806 of yacc.c */ -#line 760 "awkgram.y" +#line 759 "awkgram.y" { (yyval) = mk_for_loop((yyvsp[(1) - (12)]), (yyvsp[(3) - (12)]), (yyvsp[(6) - (12)]), (yyvsp[(9) - (12)]), (yyvsp[(12) - (12)])); @@ -2774,7 +2773,7 @@ regular_loop: case 50: /* Line 1806 of yacc.c */ -#line 767 "awkgram.y" +#line 766 "awkgram.y" { (yyval) = mk_for_loop((yyvsp[(1) - (11)]), (yyvsp[(3) - (11)]), (INSTRUCTION *) NULL, (yyvsp[(8) - (11)]), (yyvsp[(11) - (11)])); @@ -2786,7 +2785,7 @@ regular_loop: case 51: /* Line 1806 of yacc.c */ -#line 774 "awkgram.y" +#line 773 "awkgram.y" { if (do_pretty_print) (yyval) = list_prepend((yyvsp[(1) - (1)]), instruction(Op_exec_count)); @@ -2798,7 +2797,7 @@ regular_loop: case 52: /* Line 1806 of yacc.c */ -#line 784 "awkgram.y" +#line 783 "awkgram.y" { if (! break_allowed) error_ln((yyvsp[(1) - (2)])->source_line, @@ -2812,7 +2811,7 @@ regular_loop: case 53: /* Line 1806 of yacc.c */ -#line 793 "awkgram.y" +#line 792 "awkgram.y" { if (! continue_allowed) error_ln((yyvsp[(1) - (2)])->source_line, @@ -2826,7 +2825,7 @@ regular_loop: case 54: /* Line 1806 of yacc.c */ -#line 802 "awkgram.y" +#line 801 "awkgram.y" { /* if inside function (rule = 0), resolve context at run-time */ if (rule && rule != Rule) @@ -2840,7 +2839,7 @@ regular_loop: case 55: /* Line 1806 of yacc.c */ -#line 811 "awkgram.y" +#line 810 "awkgram.y" { if (do_traditional) error_ln((yyvsp[(1) - (2)])->source_line, @@ -2860,7 +2859,7 @@ regular_loop: case 56: /* Line 1806 of yacc.c */ -#line 826 "awkgram.y" +#line 825 "awkgram.y" { /* Initialize the two possible jump targets, the actual target * is resolved at run-time. @@ -2880,7 +2879,7 @@ regular_loop: case 57: /* Line 1806 of yacc.c */ -#line 841 "awkgram.y" +#line 840 "awkgram.y" { if (! in_function) yyerror(_("`return' used outside function context")); @@ -2890,7 +2889,7 @@ regular_loop: case 58: /* Line 1806 of yacc.c */ -#line 844 "awkgram.y" +#line 843 "awkgram.y" { if ((yyvsp[(3) - (4)]) == NULL) { (yyval) = list_create((yyvsp[(1) - (4)])); @@ -2905,7 +2904,7 @@ regular_loop: * call without a return value is recognized * in mk_function(). */ - ((yyvsp[(3) - (4)])->lasti + 1)->tail_call = TRUE; + ((yyvsp[(3) - (4)])->lasti + 1)->tail_call = true; } (yyval) = list_append((yyvsp[(3) - (4)]), (yyvsp[(1) - (4)])); @@ -2916,14 +2915,14 @@ regular_loop: case 60: /* Line 1806 of yacc.c */ -#line 876 "awkgram.y" - { in_print = TRUE; in_parens = 0; } +#line 875 "awkgram.y" + { in_print = true; in_parens = 0; } break; case 61: /* Line 1806 of yacc.c */ -#line 877 "awkgram.y" +#line 876 "awkgram.y" { /* * Optimization: plain `print' has no expression list, so $3 is null. @@ -2939,7 +2938,7 @@ regular_loop: && (yyvsp[(3) - (4)])->nexti->nexti->memory->type == Node_val) ) ) { - static short warned = FALSE; + static bool warned = false; /* ----------------- * output_redir * [ redirect exp ] @@ -2962,7 +2961,7 @@ regular_loop: bcfree((yyvsp[(3) - (4)])); /* Op_list */ } else { if (do_lint && (rule == BEGIN || rule == END) && ! warned) { - warned = TRUE; + warned = true; lintwarn_ln((yyvsp[(1) - (4)])->source_line, _("plain `print' in BEGIN or END rule should probably be `print \"\"'")); } @@ -2999,7 +2998,7 @@ regular_print: (yyval) = list_create((yyvsp[(1) - (4)])); } else { INSTRUCTION *t = (yyvsp[(3) - (4)]); - (yyvsp[(1) - (4)])->expr_count = count_expressions(&t, FALSE); + (yyvsp[(1) - (4)])->expr_count = count_expressions(&t, false); (yyvsp[(1) - (4)])->redir_type = redirect_none; (yyval) = list_append(t, (yyvsp[(1) - (4)])); } @@ -3014,7 +3013,7 @@ regular_print: (yyval) = list_append((yyvsp[(4) - (4)]), (yyvsp[(1) - (4)])); } else { INSTRUCTION *t = (yyvsp[(3) - (4)]); - (yyvsp[(1) - (4)])->expr_count = count_expressions(&t, FALSE); + (yyvsp[(1) - (4)])->expr_count = count_expressions(&t, false); (yyval) = list_append(list_merge((yyvsp[(4) - (4)]), t), (yyvsp[(1) - (4)])); } } @@ -3025,14 +3024,14 @@ regular_print: case 62: /* Line 1806 of yacc.c */ -#line 974 "awkgram.y" +#line 973 "awkgram.y" { sub_counter = 0; } break; case 63: /* Line 1806 of yacc.c */ -#line 975 "awkgram.y" +#line 974 "awkgram.y" { char *arr = (yyvsp[(2) - (4)])->lextok; @@ -3040,10 +3039,10 @@ regular_print: (yyvsp[(2) - (4)])->memory = variable((yyvsp[(2) - (4)])->source_line, arr, Node_var_new); if ((yyvsp[(4) - (4)]) == NULL) { - static short warned = FALSE; + static bool warned = false; if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn_ln((yyvsp[(1) - (4)])->source_line, _("`delete array' is a gawk extension")); } @@ -3062,13 +3061,13 @@ regular_print: case 64: /* Line 1806 of yacc.c */ -#line 1004 "awkgram.y" +#line 1003 "awkgram.y" { - static short warned = FALSE; + static bool warned = false; char *arr = (yyvsp[(3) - (4)])->lextok; if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn_ln((yyvsp[(1) - (4)])->source_line, _("`delete(array)' is a non-portable tawk extension")); } @@ -3086,35 +3085,35 @@ regular_print: case 65: /* Line 1806 of yacc.c */ -#line 1023 "awkgram.y" +#line 1022 "awkgram.y" { (yyval) = optimize_assignment((yyvsp[(1) - (1)])); } break; case 66: /* Line 1806 of yacc.c */ -#line 1028 "awkgram.y" +#line 1027 "awkgram.y" { (yyval) = NULL; } break; case 67: /* Line 1806 of yacc.c */ -#line 1030 "awkgram.y" +#line 1029 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 68: /* Line 1806 of yacc.c */ -#line 1035 "awkgram.y" +#line 1034 "awkgram.y" { (yyval) = NULL; } break; case 69: /* Line 1806 of yacc.c */ -#line 1037 "awkgram.y" +#line 1036 "awkgram.y" { if ((yyvsp[(1) - (2)]) == NULL) (yyval) = list_create((yyvsp[(2) - (2)])); @@ -3126,14 +3125,14 @@ regular_print: case 70: /* Line 1806 of yacc.c */ -#line 1044 "awkgram.y" +#line 1043 "awkgram.y" { (yyval) = NULL; } break; case 71: /* Line 1806 of yacc.c */ -#line 1049 "awkgram.y" +#line 1048 "awkgram.y" { INSTRUCTION *casestmt = (yyvsp[(5) - (5)]); if ((yyvsp[(5) - (5)]) == NULL) @@ -3150,7 +3149,7 @@ regular_print: case 72: /* Line 1806 of yacc.c */ -#line 1061 "awkgram.y" +#line 1060 "awkgram.y" { INSTRUCTION *casestmt = (yyvsp[(4) - (4)]); if ((yyvsp[(4) - (4)]) == NULL) @@ -3166,14 +3165,14 @@ regular_print: case 73: /* Line 1806 of yacc.c */ -#line 1075 "awkgram.y" +#line 1074 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 74: /* Line 1806 of yacc.c */ -#line 1077 "awkgram.y" +#line 1076 "awkgram.y" { NODE *n = (yyvsp[(2) - (2)])->memory; (void) force_number(n); @@ -3186,7 +3185,7 @@ regular_print: case 75: /* Line 1806 of yacc.c */ -#line 1085 "awkgram.y" +#line 1084 "awkgram.y" { bcfree((yyvsp[(1) - (2)])); (yyval) = (yyvsp[(2) - (2)]); @@ -3196,14 +3195,14 @@ regular_print: case 76: /* Line 1806 of yacc.c */ -#line 1090 "awkgram.y" +#line 1089 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 77: /* Line 1806 of yacc.c */ -#line 1092 "awkgram.y" +#line 1091 "awkgram.y" { (yyvsp[(1) - (1)])->opcode = Op_push_re; (yyval) = (yyvsp[(1) - (1)]); @@ -3213,21 +3212,21 @@ regular_print: case 78: /* Line 1806 of yacc.c */ -#line 1100 "awkgram.y" +#line 1099 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 79: /* Line 1806 of yacc.c */ -#line 1102 "awkgram.y" +#line 1101 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 81: /* Line 1806 of yacc.c */ -#line 1112 "awkgram.y" +#line 1111 "awkgram.y" { (yyval) = (yyvsp[(2) - (3)]); } @@ -3236,9 +3235,9 @@ regular_print: case 82: /* Line 1806 of yacc.c */ -#line 1119 "awkgram.y" +#line 1118 "awkgram.y" { - in_print = FALSE; + in_print = false; in_parens = 0; (yyval) = NULL; } @@ -3247,14 +3246,14 @@ regular_print: case 83: /* Line 1806 of yacc.c */ -#line 1124 "awkgram.y" - { in_print = FALSE; in_parens = 0; } +#line 1123 "awkgram.y" + { in_print = false; in_parens = 0; } break; case 84: /* Line 1806 of yacc.c */ -#line 1125 "awkgram.y" +#line 1124 "awkgram.y" { if ((yyvsp[(1) - (3)])->redir_type == redirect_twoway && (yyvsp[(3) - (3)])->lasti->opcode == Op_K_getline_redir @@ -3267,7 +3266,7 @@ regular_print: case 85: /* Line 1806 of yacc.c */ -#line 1136 "awkgram.y" +#line 1135 "awkgram.y" { (yyval) = mk_condition((yyvsp[(3) - (6)]), (yyvsp[(1) - (6)]), (yyvsp[(6) - (6)]), NULL, NULL); } @@ -3276,7 +3275,7 @@ regular_print: case 86: /* Line 1806 of yacc.c */ -#line 1141 "awkgram.y" +#line 1140 "awkgram.y" { (yyval) = mk_condition((yyvsp[(3) - (9)]), (yyvsp[(1) - (9)]), (yyvsp[(6) - (9)]), (yyvsp[(7) - (9)]), (yyvsp[(9) - (9)])); } @@ -3285,14 +3284,14 @@ regular_print: case 91: /* Line 1806 of yacc.c */ -#line 1158 "awkgram.y" +#line 1157 "awkgram.y" { (yyval) = NULL; } break; case 92: /* Line 1806 of yacc.c */ -#line 1160 "awkgram.y" +#line 1159 "awkgram.y" { bcfree((yyvsp[(1) - (2)])); (yyval) = (yyvsp[(2) - (2)]); @@ -3302,21 +3301,21 @@ regular_print: case 93: /* Line 1806 of yacc.c */ -#line 1168 "awkgram.y" +#line 1167 "awkgram.y" { (yyval) = NULL; } break; case 94: /* Line 1806 of yacc.c */ -#line 1170 "awkgram.y" +#line 1169 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]) ; } break; case 95: /* Line 1806 of yacc.c */ -#line 1175 "awkgram.y" +#line 1174 "awkgram.y" { (yyvsp[(1) - (1)])->param_count = 0; (yyval) = list_create((yyvsp[(1) - (1)])); @@ -3326,7 +3325,7 @@ regular_print: case 96: /* Line 1806 of yacc.c */ -#line 1180 "awkgram.y" +#line 1179 "awkgram.y" { (yyvsp[(3) - (3)])->param_count = (yyvsp[(1) - (3)])->lasti->param_count + 1; (yyval) = list_append((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); @@ -3337,63 +3336,63 @@ regular_print: case 97: /* Line 1806 of yacc.c */ -#line 1186 "awkgram.y" +#line 1185 "awkgram.y" { (yyval) = NULL; } break; case 98: /* Line 1806 of yacc.c */ -#line 1188 "awkgram.y" +#line 1187 "awkgram.y" { (yyval) = (yyvsp[(1) - (2)]); } break; case 99: /* Line 1806 of yacc.c */ -#line 1190 "awkgram.y" +#line 1189 "awkgram.y" { (yyval) = (yyvsp[(1) - (3)]); } break; case 100: /* Line 1806 of yacc.c */ -#line 1196 "awkgram.y" +#line 1195 "awkgram.y" { (yyval) = NULL; } break; case 101: /* Line 1806 of yacc.c */ -#line 1198 "awkgram.y" +#line 1197 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 102: /* Line 1806 of yacc.c */ -#line 1203 "awkgram.y" +#line 1202 "awkgram.y" { (yyval) = NULL; } break; case 103: /* Line 1806 of yacc.c */ -#line 1205 "awkgram.y" +#line 1204 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 104: /* Line 1806 of yacc.c */ -#line 1210 "awkgram.y" +#line 1209 "awkgram.y" { (yyval) = mk_expression_list(NULL, (yyvsp[(1) - (1)])); } break; case 105: /* Line 1806 of yacc.c */ -#line 1212 "awkgram.y" +#line 1211 "awkgram.y" { (yyval) = mk_expression_list((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)])); yyerrok; @@ -3403,35 +3402,35 @@ regular_print: case 106: /* Line 1806 of yacc.c */ -#line 1217 "awkgram.y" +#line 1216 "awkgram.y" { (yyval) = NULL; } break; case 107: /* Line 1806 of yacc.c */ -#line 1219 "awkgram.y" +#line 1218 "awkgram.y" { (yyval) = NULL; } break; case 108: /* Line 1806 of yacc.c */ -#line 1221 "awkgram.y" +#line 1220 "awkgram.y" { (yyval) = NULL; } break; case 109: /* Line 1806 of yacc.c */ -#line 1223 "awkgram.y" +#line 1222 "awkgram.y" { (yyval) = NULL; } break; case 110: /* Line 1806 of yacc.c */ -#line 1229 "awkgram.y" +#line 1228 "awkgram.y" { if (do_lint && (yyvsp[(3) - (3)])->lasti->opcode == Op_match_rec) lintwarn_ln((yyvsp[(2) - (3)])->source_line, @@ -3443,21 +3442,21 @@ regular_print: case 111: /* Line 1806 of yacc.c */ -#line 1236 "awkgram.y" +#line 1235 "awkgram.y" { (yyval) = mk_boolean((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); } break; case 112: /* Line 1806 of yacc.c */ -#line 1238 "awkgram.y" +#line 1237 "awkgram.y" { (yyval) = mk_boolean((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); } break; case 113: /* Line 1806 of yacc.c */ -#line 1240 "awkgram.y" +#line 1239 "awkgram.y" { if ((yyvsp[(1) - (3)])->lasti->opcode == Op_match_rec) warning_ln((yyvsp[(2) - (3)])->source_line, @@ -3478,7 +3477,7 @@ regular_print: case 114: /* Line 1806 of yacc.c */ -#line 1256 "awkgram.y" +#line 1255 "awkgram.y" { if (do_lint_old) warning_ln((yyvsp[(2) - (3)])->source_line, @@ -3493,7 +3492,7 @@ regular_print: case 115: /* Line 1806 of yacc.c */ -#line 1266 "awkgram.y" +#line 1265 "awkgram.y" { if (do_lint && (yyvsp[(3) - (3)])->lasti->opcode == Op_match_rec) lintwarn_ln((yyvsp[(2) - (3)])->source_line, @@ -3505,35 +3504,35 @@ regular_print: case 116: /* Line 1806 of yacc.c */ -#line 1273 "awkgram.y" +#line 1272 "awkgram.y" { (yyval) = mk_condition((yyvsp[(1) - (5)]), (yyvsp[(2) - (5)]), (yyvsp[(3) - (5)]), (yyvsp[(4) - (5)]), (yyvsp[(5) - (5)])); } break; case 117: /* Line 1806 of yacc.c */ -#line 1275 "awkgram.y" +#line 1274 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 118: /* Line 1806 of yacc.c */ -#line 1280 "awkgram.y" +#line 1279 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 119: /* Line 1806 of yacc.c */ -#line 1282 "awkgram.y" +#line 1281 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 120: /* Line 1806 of yacc.c */ -#line 1284 "awkgram.y" +#line 1283 "awkgram.y" { (yyvsp[(2) - (2)])->opcode = Op_assign_quotient; (yyval) = (yyvsp[(2) - (2)]); @@ -3543,52 +3542,52 @@ regular_print: case 121: /* Line 1806 of yacc.c */ -#line 1292 "awkgram.y" +#line 1291 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 122: /* Line 1806 of yacc.c */ -#line 1294 "awkgram.y" +#line 1293 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 123: /* Line 1806 of yacc.c */ -#line 1299 "awkgram.y" +#line 1298 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 124: /* Line 1806 of yacc.c */ -#line 1301 "awkgram.y" +#line 1300 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 125: /* Line 1806 of yacc.c */ -#line 1306 "awkgram.y" +#line 1305 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 126: /* Line 1806 of yacc.c */ -#line 1308 "awkgram.y" +#line 1307 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 127: /* Line 1806 of yacc.c */ -#line 1310 "awkgram.y" +#line 1309 "awkgram.y" { int count = 2; - int is_simple_var = FALSE; + bool is_simple_var = false; if ((yyvsp[(1) - (2)])->lasti->opcode == Op_concat) { /* multiple (> 2) adjacent strings optimization */ @@ -3637,49 +3636,49 @@ regular_print: case 129: /* Line 1806 of yacc.c */ -#line 1362 "awkgram.y" +#line 1361 "awkgram.y" { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); } break; case 130: /* Line 1806 of yacc.c */ -#line 1364 "awkgram.y" +#line 1363 "awkgram.y" { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); } break; case 131: /* Line 1806 of yacc.c */ -#line 1366 "awkgram.y" +#line 1365 "awkgram.y" { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); } break; case 132: /* Line 1806 of yacc.c */ -#line 1368 "awkgram.y" +#line 1367 "awkgram.y" { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); } break; case 133: /* Line 1806 of yacc.c */ -#line 1370 "awkgram.y" +#line 1369 "awkgram.y" { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); } break; case 134: /* Line 1806 of yacc.c */ -#line 1372 "awkgram.y" +#line 1371 "awkgram.y" { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); } break; case 135: /* Line 1806 of yacc.c */ -#line 1374 "awkgram.y" +#line 1373 "awkgram.y" { /* * In BEGINFILE/ENDFILE, allow `getline var < file' @@ -3707,7 +3706,7 @@ regular_print: case 136: /* Line 1806 of yacc.c */ -#line 1397 "awkgram.y" +#line 1396 "awkgram.y" { (yyvsp[(2) - (2)])->opcode = Op_postincrement; (yyval) = mk_assignment((yyvsp[(1) - (2)]), NULL, (yyvsp[(2) - (2)])); @@ -3717,7 +3716,7 @@ regular_print: case 137: /* Line 1806 of yacc.c */ -#line 1402 "awkgram.y" +#line 1401 "awkgram.y" { (yyvsp[(2) - (2)])->opcode = Op_postdecrement; (yyval) = mk_assignment((yyvsp[(1) - (2)]), NULL, (yyvsp[(2) - (2)])); @@ -3727,7 +3726,7 @@ regular_print: case 138: /* Line 1806 of yacc.c */ -#line 1407 "awkgram.y" +#line 1406 "awkgram.y" { if (do_lint_old) { warning_ln((yyvsp[(4) - (5)])->source_line, @@ -3743,7 +3742,7 @@ regular_print: (yyval) = list_merge((yyvsp[(5) - (5)]), (yyvsp[(4) - (5)])); } else { INSTRUCTION *t = (yyvsp[(2) - (5)]); - (yyvsp[(4) - (5)])->expr_count = count_expressions(&t, FALSE); + (yyvsp[(4) - (5)])->expr_count = count_expressions(&t, false); (yyval) = list_append(list_merge(t, (yyvsp[(5) - (5)])), (yyvsp[(4) - (5)])); } } @@ -3752,7 +3751,7 @@ regular_print: case 139: /* Line 1806 of yacc.c */ -#line 1432 "awkgram.y" +#line 1431 "awkgram.y" { (yyval) = mk_getline((yyvsp[(3) - (4)]), (yyvsp[(4) - (4)]), (yyvsp[(1) - (4)]), (yyvsp[(2) - (4)])->redir_type); bcfree((yyvsp[(2) - (4)])); @@ -3762,49 +3761,49 @@ regular_print: case 140: /* Line 1806 of yacc.c */ -#line 1438 "awkgram.y" +#line 1437 "awkgram.y" { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); } break; case 141: /* Line 1806 of yacc.c */ -#line 1440 "awkgram.y" +#line 1439 "awkgram.y" { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); } break; case 142: /* Line 1806 of yacc.c */ -#line 1442 "awkgram.y" +#line 1441 "awkgram.y" { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); } break; case 143: /* Line 1806 of yacc.c */ -#line 1444 "awkgram.y" +#line 1443 "awkgram.y" { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); } break; case 144: /* Line 1806 of yacc.c */ -#line 1446 "awkgram.y" +#line 1445 "awkgram.y" { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); } break; case 145: /* Line 1806 of yacc.c */ -#line 1448 "awkgram.y" +#line 1447 "awkgram.y" { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); } break; case 146: /* Line 1806 of yacc.c */ -#line 1453 "awkgram.y" +#line 1452 "awkgram.y" { (yyval) = list_create((yyvsp[(1) - (1)])); } @@ -3813,7 +3812,7 @@ regular_print: case 147: /* Line 1806 of yacc.c */ -#line 1457 "awkgram.y" +#line 1456 "awkgram.y" { if ((yyvsp[(2) - (2)])->opcode == Op_match_rec) { (yyvsp[(2) - (2)])->opcode = Op_nomatch; @@ -3850,14 +3849,14 @@ regular_print: case 148: /* Line 1806 of yacc.c */ -#line 1489 "awkgram.y" +#line 1488 "awkgram.y" { (yyval) = (yyvsp[(2) - (3)]); } break; case 149: /* Line 1806 of yacc.c */ -#line 1491 "awkgram.y" +#line 1490 "awkgram.y" { (yyval) = snode((yyvsp[(3) - (4)]), (yyvsp[(1) - (4)])); if ((yyval) == NULL) @@ -3868,7 +3867,7 @@ regular_print: case 150: /* Line 1806 of yacc.c */ -#line 1497 "awkgram.y" +#line 1496 "awkgram.y" { (yyval) = snode((yyvsp[(3) - (4)]), (yyvsp[(1) - (4)])); if ((yyval) == NULL) @@ -3879,12 +3878,12 @@ regular_print: case 151: /* Line 1806 of yacc.c */ -#line 1503 "awkgram.y" +#line 1502 "awkgram.y" { - static short warned1 = FALSE; + static bool warned = false; - if (do_lint && ! warned1) { - warned1 = TRUE; + if (do_lint && ! warned) { + warned = true; lintwarn_ln((yyvsp[(1) - (1)])->source_line, _("call of `length' without parentheses is not portable")); } @@ -3897,7 +3896,7 @@ regular_print: case 154: /* Line 1806 of yacc.c */ -#line 1518 "awkgram.y" +#line 1517 "awkgram.y" { (yyvsp[(1) - (2)])->opcode = Op_preincrement; (yyval) = mk_assignment((yyvsp[(2) - (2)]), NULL, (yyvsp[(1) - (2)])); @@ -3907,7 +3906,7 @@ regular_print: case 155: /* Line 1806 of yacc.c */ -#line 1523 "awkgram.y" +#line 1522 "awkgram.y" { (yyvsp[(1) - (2)])->opcode = Op_predecrement; (yyval) = mk_assignment((yyvsp[(2) - (2)]), NULL, (yyvsp[(1) - (2)])); @@ -3917,7 +3916,7 @@ regular_print: case 156: /* Line 1806 of yacc.c */ -#line 1528 "awkgram.y" +#line 1527 "awkgram.y" { (yyval) = list_create((yyvsp[(1) - (1)])); } @@ -3926,7 +3925,7 @@ regular_print: case 157: /* Line 1806 of yacc.c */ -#line 1532 "awkgram.y" +#line 1531 "awkgram.y" { (yyval) = list_create((yyvsp[(1) - (1)])); } @@ -3935,7 +3934,7 @@ regular_print: case 158: /* Line 1806 of yacc.c */ -#line 1536 "awkgram.y" +#line 1535 "awkgram.y" { if ((yyvsp[(2) - (2)])->lasti->opcode == Op_push_i && ((yyvsp[(2) - (2)])->lasti->memory->flags & (STRCUR|STRING)) == 0 @@ -3955,7 +3954,7 @@ regular_print: case 159: /* Line 1806 of yacc.c */ -#line 1551 "awkgram.y" +#line 1550 "awkgram.y" { /* * was: $$ = $2 @@ -3970,7 +3969,7 @@ regular_print: case 160: /* Line 1806 of yacc.c */ -#line 1564 "awkgram.y" +#line 1563 "awkgram.y" { func_use((yyvsp[(1) - (1)])->lasti->func_name, FUNC_USE); (yyval) = (yyvsp[(1) - (1)]); @@ -3980,19 +3979,19 @@ regular_print: case 161: /* Line 1806 of yacc.c */ -#line 1569 "awkgram.y" +#line 1568 "awkgram.y" { /* indirect function call */ INSTRUCTION *f, *t; char *name; NODE *indirect_var; - static short warned = FALSE; + static bool warned = false; const char *msg = _("indirect function calls are a gawk extension"); if (do_traditional || do_posix) yyerror("%s", msg); else if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn("%s", msg); } @@ -4018,7 +4017,7 @@ regular_print: case 162: /* Line 1806 of yacc.c */ -#line 1605 "awkgram.y" +#line 1604 "awkgram.y" { param_sanity((yyvsp[(3) - (4)])); (yyvsp[(1) - (4)])->opcode = Op_func_call; @@ -4028,7 +4027,7 @@ regular_print: (yyval) = list_create((yyvsp[(1) - (4)])); } else { INSTRUCTION *t = (yyvsp[(3) - (4)]); - ((yyvsp[(1) - (4)]) + 1)->expr_count = count_expressions(&t, TRUE); + ((yyvsp[(1) - (4)]) + 1)->expr_count = count_expressions(&t, true); (yyval) = list_append(t, (yyvsp[(1) - (4)])); } } @@ -4037,42 +4036,42 @@ regular_print: case 163: /* Line 1806 of yacc.c */ -#line 1622 "awkgram.y" +#line 1621 "awkgram.y" { (yyval) = NULL; } break; case 164: /* Line 1806 of yacc.c */ -#line 1624 "awkgram.y" +#line 1623 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 165: /* Line 1806 of yacc.c */ -#line 1629 "awkgram.y" +#line 1628 "awkgram.y" { (yyval) = NULL; } break; case 166: /* Line 1806 of yacc.c */ -#line 1631 "awkgram.y" +#line 1630 "awkgram.y" { (yyval) = (yyvsp[(1) - (2)]); } break; case 167: /* Line 1806 of yacc.c */ -#line 1636 "awkgram.y" +#line 1635 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 168: /* Line 1806 of yacc.c */ -#line 1638 "awkgram.y" +#line 1637 "awkgram.y" { (yyval) = list_merge((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)])); } @@ -4081,7 +4080,7 @@ regular_print: case 169: /* Line 1806 of yacc.c */ -#line 1645 "awkgram.y" +#line 1644 "awkgram.y" { INSTRUCTION *ip = (yyvsp[(1) - (1)])->lasti; int count = ip->sub_count; /* # of SUBSEP-seperated expressions */ @@ -4100,7 +4099,7 @@ regular_print: case 170: /* Line 1806 of yacc.c */ -#line 1662 "awkgram.y" +#line 1661 "awkgram.y" { INSTRUCTION *t = (yyvsp[(2) - (3)]); if ((yyvsp[(2) - (3)]) == NULL) { @@ -4111,7 +4110,7 @@ regular_print: t->nexti->memory = dupnode(Nnull_string); (yyvsp[(3) - (3)])->sub_count = 1; } else - (yyvsp[(3) - (3)])->sub_count = count_expressions(&t, FALSE); + (yyvsp[(3) - (3)])->sub_count = count_expressions(&t, false); (yyval) = list_append(t, (yyvsp[(3) - (3)])); } break; @@ -4119,14 +4118,14 @@ regular_print: case 171: /* Line 1806 of yacc.c */ -#line 1679 "awkgram.y" +#line 1678 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); } break; case 172: /* Line 1806 of yacc.c */ -#line 1681 "awkgram.y" +#line 1680 "awkgram.y" { (yyval) = list_merge((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)])); } @@ -4135,14 +4134,14 @@ regular_print: case 173: /* Line 1806 of yacc.c */ -#line 1688 "awkgram.y" +#line 1687 "awkgram.y" { (yyval) = (yyvsp[(1) - (2)]); } break; case 174: /* Line 1806 of yacc.c */ -#line 1693 "awkgram.y" +#line 1692 "awkgram.y" { char *var_name = (yyvsp[(1) - (1)])->lextok; @@ -4155,7 +4154,7 @@ regular_print: case 175: /* Line 1806 of yacc.c */ -#line 1701 "awkgram.y" +#line 1700 "awkgram.y" { char *arr = (yyvsp[(1) - (2)])->lextok; (yyvsp[(1) - (2)])->memory = variable((yyvsp[(1) - (2)])->source_line, arr, Node_var_new); @@ -4167,7 +4166,7 @@ regular_print: case 176: /* Line 1806 of yacc.c */ -#line 1711 "awkgram.y" +#line 1710 "awkgram.y" { INSTRUCTION *ip = (yyvsp[(1) - (1)])->nexti; if (ip->opcode == Op_push @@ -4184,7 +4183,7 @@ regular_print: case 177: /* Line 1806 of yacc.c */ -#line 1723 "awkgram.y" +#line 1722 "awkgram.y" { (yyval) = list_append((yyvsp[(2) - (3)]), (yyvsp[(1) - (3)])); if ((yyvsp[(3) - (3)]) != NULL) @@ -4195,7 +4194,7 @@ regular_print: case 178: /* Line 1806 of yacc.c */ -#line 1732 "awkgram.y" +#line 1731 "awkgram.y" { (yyvsp[(1) - (1)])->opcode = Op_postincrement; } @@ -4204,7 +4203,7 @@ regular_print: case 179: /* Line 1806 of yacc.c */ -#line 1736 "awkgram.y" +#line 1735 "awkgram.y" { (yyvsp[(1) - (1)])->opcode = Op_postdecrement; } @@ -4213,49 +4212,49 @@ regular_print: case 180: /* Line 1806 of yacc.c */ -#line 1739 "awkgram.y" +#line 1738 "awkgram.y" { (yyval) = NULL; } break; case 182: /* Line 1806 of yacc.c */ -#line 1747 "awkgram.y" +#line 1746 "awkgram.y" { yyerrok; } break; case 183: /* Line 1806 of yacc.c */ -#line 1751 "awkgram.y" +#line 1750 "awkgram.y" { yyerrok; } break; case 186: /* Line 1806 of yacc.c */ -#line 1760 "awkgram.y" +#line 1759 "awkgram.y" { yyerrok; } break; case 187: /* Line 1806 of yacc.c */ -#line 1764 "awkgram.y" +#line 1763 "awkgram.y" { (yyval) = (yyvsp[(1) - (1)]); yyerrok; } break; case 188: /* Line 1806 of yacc.c */ -#line 1768 "awkgram.y" +#line 1767 "awkgram.y" { yyerrok; } break; /* Line 1806 of yacc.c */ -#line 4271 "awkgram.c" +#line 4270 "awkgram.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -4486,7 +4485,7 @@ yyreturn: /* Line 2067 of yacc.c */ -#line 1770 "awkgram.y" +#line 1769 "awkgram.y" struct token { @@ -4864,7 +4863,7 @@ mk_program() if (endfile_block == NULL) endfile_block = list_create(ip_endfile); else { - ip_rec->has_endfile = TRUE; + ip_rec->has_endfile = true; (void) list_prepend(endfile_block, ip_endfile); } @@ -4969,7 +4968,7 @@ parse_program(INSTRUCTION **pcode) sourcefile = sourcefile->next) ; - lexeof = FALSE; + lexeof = false; lexptr = NULL; lasttok = 0; memset(rule_block, 0, sizeof(ruletab) * sizeof(INSTRUCTION *)); @@ -5018,7 +5017,7 @@ do_add_srcfile(int stype, char *src, char *path, SRCFILE *thisfile) */ SRCFILE * -add_srcfile(int stype, char *src, SRCFILE *thisfile, int *already_included, int *errcode) +add_srcfile(int stype, char *src, SRCFILE *thisfile, bool *already_included, int *errcode) { SRCFILE *s; struct stat sbuf; @@ -5026,7 +5025,7 @@ add_srcfile(int stype, char *src, SRCFILE *thisfile, int *already_included, int int errno_val = 0; if (already_included) - *already_included = FALSE; + *already_included = false; if (errcode) *errcode = 0; if (stype == SRC_CMDLINE || stype == SRC_STDIN) @@ -5063,7 +5062,7 @@ add_srcfile(int stype, char *src, SRCFILE *thisfile, int *already_included, int } efree(path); if (already_included) - *already_included = TRUE; + *already_included = true; return NULL; } } @@ -5082,7 +5081,7 @@ include_source(INSTRUCTION *file) SRCFILE *s; char *src = file->lextok; int errcode; - int already_included; + bool already_included; if (do_traditional || do_posix) { error_ln(file->source_line, _("@include is a gawk extension")); @@ -5119,8 +5118,8 @@ include_source(INSTRUCTION *file) sourceline = 0; source = NULL; lasttok = 0; - lexeof = FALSE; - eof_warned = FALSE; + lexeof = false; + eof_warned = false; return 0; } @@ -5132,7 +5131,7 @@ load_library(INSTRUCTION *file) SRCFILE *s; char *src = file->lextok; int errcode; - int already_included; + bool already_included; if (do_traditional || do_posix) { error_ln(file->source_line, _("@load is a gawk extension")); @@ -5182,11 +5181,11 @@ next_sourcefile() * Previous versions of gawk did not core dump in such a * case. * - * assert(lexeof == TRUE); + * assert(lexeof == true); */ - lexeof = FALSE; - eof_warned = FALSE; + lexeof = false; + eof_warned = false; sourcefile->srclines = sourceline; /* total no of lines in current file */ if (sourcefile->fd > INVALID_HANDLE) { if (sourcefile->fd != fileno(stdin)) /* safety */ @@ -5230,7 +5229,7 @@ get_src_buf() { int n; char *scan; - int newfile; + bool newfile; int savelen; struct stat sbuf; @@ -5255,7 +5254,7 @@ get_src_buf() readfunc = read_one_line; } - newfile = FALSE; + newfile = false; if (sourcefile == srcfiles) return NULL; @@ -5271,13 +5270,13 @@ get_src_buf() * gawk '' /path/name * Sigh. */ - static short warned = FALSE; + static bool warned = false; if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("empty program text on command line")); } - lexeof = TRUE; + lexeof = true; } } else if (sourcefile->buf == NULL && *(lexptr-1) != '\n') { /* @@ -5305,7 +5304,7 @@ get_src_buf() lexend = lexptr + 1; sourcefile->buf = buf; } else - lexeof = TRUE; + lexeof = true; return lexptr; } @@ -5326,7 +5325,7 @@ get_src_buf() error(_("can't open source file `%s' for reading (%s)"), in, strerror(errno)); errcount++; - lexeof = TRUE; + lexeof = true; return sourcefile->src; } @@ -5342,7 +5341,7 @@ get_src_buf() l = A_DECENT_BUFFER_SIZE; #undef A_DECENT_BUFFER_SIZE sourcefile->bufsize = l; - newfile = TRUE; + newfile = true; emalloc(sourcefile->buf, char *, sourcefile->bufsize, "get_src_buf"); lexptr = lexptr_begin = lexeme = sourcefile->buf; savelen = 0; @@ -5393,17 +5392,17 @@ get_src_buf() error(_("can't read sourcefile `%s' (%s)"), source, strerror(errno)); errcount++; - lexeof = TRUE; + lexeof = true; } else { lexend = lexptr + n; if (n == 0) { - static short warned = FALSE; + static bool warned = false; if (do_lint && newfile && ! warned){ - warned = TRUE; + warned = true; sourceline = 0; lintwarn(_("source file `%s' is empty"), source); } - lexeof = TRUE; + lexeof = true; } } return sourcefile->buf; @@ -5579,14 +5578,14 @@ static int newline_eof() pushback(); if (do_lint && ! eof_warned) { lintwarn(_("source file does not end in newline")); - eof_warned = TRUE; + eof_warned = true; } sourceline++; return NEWLINE; } sourceline--; - eof_warned = FALSE; + eof_warned = false; return LEX_EOF; } @@ -5596,15 +5595,15 @@ static int yylex(void) { int c; - int seen_e = FALSE; /* These are for numbers */ - int seen_point = FALSE; - int esc_seen; /* for literal strings */ + bool seen_e = false; /* These are for numbers */ + bool seen_point = false; + bool esc_seen; /* for literal strings */ int mid; int base; - static int did_newline = FALSE; + static bool did_newline = false; char *tokkey; - int inhex = FALSE; - int intlstr = FALSE; + bool inhex = false; + bool intlstr = false; AWKNUM d; #define GET_INSTRUCTION(op) bcalloc(op, 1, sourceline) @@ -5659,7 +5658,7 @@ yylex(void) * The code for \ handles \[ and \]. */ - want_regexp = FALSE; + want_regexp = false; tok = tokstart; for (;;) { c = nextc(); @@ -5776,10 +5775,10 @@ retry: while ((c = nextc()) == ' ' || c == '\t' || c == '\r') continue; if (c == '#') { - static short warned = FALSE; + static bool warned = false; if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn( _("use of `\\ #...' line continuation is not portable")); } @@ -5852,11 +5851,11 @@ retry: return lasttok = '*'; } else if (c == '*') { /* make ** and **= aliases for ^ and ^= */ - static int did_warn_op = FALSE, did_warn_assgn = FALSE; + static bool did_warn_op = false, did_warn_assgn = false; if (nextc() == '=') { if (! did_warn_assgn) { - did_warn_assgn = TRUE; + did_warn_assgn = true; if (do_lint) lintwarn(_("POSIX does not allow operator `**='")); if (do_lint_old) @@ -5867,7 +5866,7 @@ retry: } else { pushback(); if (! did_warn_op) { - did_warn_op = TRUE; + did_warn_op = true; if (do_lint) lintwarn(_("POSIX does not allow operator `**'")); if (do_lint_old) @@ -5901,11 +5900,11 @@ retry: case '^': { - static int did_warn_op = FALSE, did_warn_assgn = FALSE; + static bool did_warn_op = false, did_warn_assgn = false; if (nextc() == '=') { if (do_lint_old && ! did_warn_assgn) { - did_warn_assgn = TRUE; + did_warn_assgn = true; warning(_("operator `^=' is not supported in old awk")); } yylval = GET_INSTRUCTION(Op_assign_exp); @@ -5913,7 +5912,7 @@ retry: } pushback(); if (do_lint_old && ! did_warn_op) { - did_warn_op = TRUE; + did_warn_op = true; warning(_("operator `^' is not supported in old awk")); } yylval = GET_INSTRUCTION(Op_exp); @@ -5992,7 +5991,7 @@ retry: * hacking the grammar. */ if (did_newline) { - did_newline = FALSE; + did_newline = false; if (--in_braces == 0) lastline = sourceline; return lasttok = c; @@ -6003,7 +6002,7 @@ retry: case '"': string: - esc_seen = FALSE; + esc_seen = false; while ((c = nextc()) != '"') { if (c == '\n') { pushback(); @@ -6017,7 +6016,7 @@ retry: sourceline++; continue; } - esc_seen = TRUE; + esc_seen = true; if (! want_source || c != '"') tokadd('\\'); } @@ -6039,7 +6038,7 @@ retry: tok - tokstart, esc_seen ? SCAN : 0); if (intlstr) { yylval->memory->flags |= INTLSTR; - intlstr = FALSE; + intlstr = false; if (do_intl) dumpintlstr(yylval->memory->stptr, yylval->memory->stlen); } @@ -6078,7 +6077,7 @@ retry: case '9': /* It's a number */ for (;;) { - int gotnumber = FALSE; + bool gotnumber = false; tokadd(c); switch (c) { @@ -6090,7 +6089,7 @@ retry: int peek = nextc(); if (isxdigit(peek)) { - inhex = TRUE; + inhex = true; pushback(); /* following digit */ } else { pushback(); /* x or X */ @@ -6101,20 +6100,20 @@ retry: case '.': /* period ends exponent part of floating point number */ if (seen_point || seen_e) { - gotnumber = TRUE; + gotnumber = true; break; } - seen_point = TRUE; + seen_point = true; break; case 'e': case 'E': if (inhex) break; if (seen_e) { - gotnumber = TRUE; + gotnumber = true; break; } - seen_e = TRUE; + seen_e = true; if ((c = nextc()) == '-' || c == '+') { int c2 = nextc(); @@ -6159,7 +6158,7 @@ retry: break; default: done: - gotnumber = TRUE; + gotnumber = true; } if (gotnumber) break; @@ -6172,7 +6171,7 @@ retry: base = 10; if (! do_traditional) { - base = get_numbase(tokstart, FALSE); + base = get_numbase(tokstart, false); if (do_lint) { if (base == 8) lintwarn("numeric constant `%.*s' treated as octal", @@ -6264,7 +6263,7 @@ retry: */ if (! do_traditional && c == '_' && lasttok != '$') { if ((c = nextc()) == '"') { - intlstr = TRUE; + intlstr = true; goto string; } pushback(); @@ -6322,7 +6321,7 @@ retry: switch (class) { case LEX_INCLUDE: case LEX_LOAD: - want_source = TRUE; + want_source = true; break; case LEX_EVAL: if (in_main_context()) @@ -6368,7 +6367,7 @@ out: yylval->lextok = tokkey; return lasttok = FUNC_CALL; } else { - static short goto_warned = FALSE; + static bool goto_warned = false; yylval = GET_INSTRUCTION(Op_token); yylval->lextok = tokkey; @@ -6376,7 +6375,7 @@ out: #define SMART_ALECK 1 if (SMART_ALECK && do_lint && ! goto_warned && strcasecmp(tokkey, "goto") == 0) { - goto_warned = TRUE; + goto_warned = true; lintwarn(_("`goto' considered harmful!\n")); } return lasttok = NAME; @@ -6454,10 +6453,10 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) yyerror(_("%s third parameter is not a changeable object"), operator); else - ip->do_reference = TRUE; + ip->do_reference = true; } - r->expr_count = count_expressions(&subn, FALSE); + r->expr_count = count_expressions(&subn, false); ip = subn->lasti; (void) list_append(subn, r); @@ -6486,7 +6485,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) list_append(list_create(ip), instruction(Op_field_spec))); } - r->expr_count = count_expressions(&subn, FALSE); + r->expr_count = count_expressions(&subn, false); return list_append(subn, r); } } @@ -6522,14 +6521,14 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push) arg->nexti->opcode = Op_push_arg; /* argument may be array */ } else if (r->builtin == do_match) { - static short warned = FALSE; + static bool warned = false; arg = subn->nexti->lasti->nexti; /* 2nd arg list */ (void) mk_rexp(arg); if (nexp == 3) { /* 3rd argument there */ if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("match: third argument is a gawk extension")); } if (do_traditional) { @@ -6583,10 +6582,10 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) ip->opcode = Op_push_array; } } else if (r->builtin == do_close) { - static short warned = FALSE; + static bool warned = false; if (nexp == 2) { if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("close: second argument is a gawk extension")); } if (do_traditional) { @@ -6641,7 +6640,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) #endif if (subn != NULL) { - r->expr_count = count_expressions(&subn, FALSE); + r->expr_count = count_expressions(&subn, false); return list_append(subn, r); } @@ -6656,7 +6655,7 @@ static int parms_shadow(INSTRUCTION *pc, int *shadow) { int pcount, i; - int ret = FALSE; + bool ret = false; NODE *func, *fp; char *fname; @@ -6666,7 +6665,7 @@ parms_shadow(INSTRUCTION *pc, int *shadow) #if 0 /* can't happen, already exited if error ? */ if (fname == NULL || func == NULL) /* error earlier */ - return FALSE; + return false; #endif pcount = func->param_cnt; @@ -6685,7 +6684,7 @@ parms_shadow(INSTRUCTION *pc, int *shadow) warning( _("function `%s': parameter `%s' shadows global variable"), fname, fp[i].param); - ret = TRUE; + ret = true; } } @@ -6701,7 +6700,7 @@ valinfo(NODE *n, Func_print print_func, FILE *fp) if (n == Nnull_string) print_func(fp, "uninitialized scalar\n"); else if (n->flags & STRING) { - pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', FALSE); + pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', false); print_func(fp, "\n"); } else if (n->flags & NUMBER) { #ifdef HAVE_MPFR @@ -6713,7 +6712,7 @@ valinfo(NODE *n, Func_print print_func, FILE *fp) #endif print_func(fp, "%.17g\n", n->numbr); } else if (n->flags & STRCUR) { - pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', FALSE); + pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', false); print_func(fp, "\n"); } else if (n->flags & NUMCUR) { #ifdef HAVE_MPFR @@ -6758,7 +6757,7 @@ void dump_funcs() { NODE **funcs; - funcs = function_list(TRUE); + funcs = function_list(true); (void) foreach_func(funcs, (int (*)(INSTRUCTION *, void *)) pp_func, (void *) 0); efree(funcs); } @@ -6770,13 +6769,13 @@ void shadow_funcs() { static int calls = 0; - int shadow = FALSE; + bool shadow = false; NODE **funcs; if (calls++ != 0) fatal(_("shadow_funcs() called twice!")); - funcs = function_list(TRUE); + funcs = function_list(true); (void) foreach_func(funcs, (int (*)(INSTRUCTION *, void *)) parms_shadow, & shadow); efree(funcs); @@ -6807,7 +6806,7 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def) ; if (t->opcode == Op_func_call && strcmp(t->func_name, thisfunc->vname) == 0) - (t + 1)->tail_call = TRUE; + (t + 1)->tail_call = true; } /* add an implicit return at end; @@ -7082,7 +7081,7 @@ variable(int location, char *name, NODETYPE type) /* not found */ struct deferred_variable *dv; - for (dv = deferred_variables; TRUE; dv = dv->next) { + for (dv = deferred_variables; true; dv = dv->next) { if (dv == NULL) { /* * This is the only case in which we may not free the string. @@ -7112,7 +7111,7 @@ make_regnode(int type, NODE *exp) n->re_cnt = 1; if (type == Node_regex) { - n->re_reg = make_regexp(exp->stptr, exp->stlen, FALSE, TRUE, FALSE); + n->re_reg = make_regexp(exp->stptr, exp->stlen, false, true, false); if (n->re_reg == NULL) { freenode(n); return NULL; @@ -7179,12 +7178,12 @@ isnoeffect(OPCODE type) case Op_match_rec: case Op_not: case Op_in_array: - return TRUE; + return true; default: break; /* keeps gcc -Wall happy */ } - return FALSE; + return false; } /* make_assignable --- make this operand an assignable one if posiible */ @@ -7225,7 +7224,7 @@ dumpintlstr(const char *str, size_t len) } printf("msgid "); - pp_string_fp(fprintf, stdout, str, len, '"', TRUE); + pp_string_fp(fprintf, stdout, str, len, '"', true); putchar('\n'); printf("msgstr \"\"\n\n"); fflush(stdout); @@ -7248,10 +7247,10 @@ dumpintlstr2(const char *str1, size_t len1, const char *str2, size_t len2) } printf("msgid "); - pp_string_fp(fprintf, stdout, str1, len1, '"', TRUE); + pp_string_fp(fprintf, stdout, str1, len1, '"', true); putchar('\n'); printf("msgid_plural "); - pp_string_fp(fprintf, stdout, str2, len2, '"', TRUE); + pp_string_fp(fprintf, stdout, str2, len2, '"', true); putchar('\n'); printf("msgstr[0] \"\"\nmsgstr[1] \"\"\n\n"); fflush(stdout); @@ -7629,7 +7628,7 @@ mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op) && tp->memory->type == Node_var && tp->memory->var_assign ) { - tp->do_reference = FALSE; /* no uninitialized reference checking + tp->do_reference = false; /* no uninitialized reference checking * for a special variable. */ (void) list_append(ip, instruction(Op_var_assign)); @@ -8032,7 +8031,7 @@ mk_expression_list(INSTRUCTION *list, INSTRUCTION *s1) */ static int -count_expressions(INSTRUCTION **list, int isarg) +count_expressions(INSTRUCTION **list, bool isarg) { INSTRUCTION *expr; INSTRUCTION *r = NULL; @@ -8148,13 +8147,13 @@ check_special(const char *name) int low, high, mid; int i; #if 'a' == 0x81 /* it's EBCDIC */ - static int did_sort = FALSE; + static bool did_sort = false; if (! did_sort) { qsort((void *) tokentab, sizeof(tokentab) / sizeof(tokentab[0]), sizeof(tokentab[0]), tokcompare); - did_sort = TRUE; + did_sort = true; } #endif @@ -72,7 +72,7 @@ static INSTRUCTION *mk_boolean(INSTRUCTION *left, INSTRUCTION *right, INSTRUCTIO static INSTRUCTION *mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op); static INSTRUCTION *mk_getline(INSTRUCTION *op, INSTRUCTION *opt_var, INSTRUCTION *redir, int redirtype); static NODE *make_regnode(int type, NODE *exp); -static int count_expressions(INSTRUCTION **list, int isarg); +static int count_expressions(INSTRUCTION **list, bool isarg); static INSTRUCTION *optimize_assignment(INSTRUCTION *exp); static void add_lint(INSTRUCTION *list, LINTTYPE linttype); @@ -83,8 +83,8 @@ static void check_funcs(void); static ssize_t read_one_line(int fd, void *buffer, size_t count); static int one_line_close(int fd); -static int want_source = FALSE; -static int want_regexp; /* lexical scanning kludge */ +static bool want_source = false; +static bool want_regexp; /* lexical scanning kludge */ static char *in_function; /* parsing kludge */ static int rule = 0; @@ -97,25 +97,24 @@ const char *const ruletab[] = { "ENDFILE", }; -static int in_print = FALSE; /* lexical scanning kludge for print */ +static bool in_print = false; /* lexical scanning kludge for print */ static int in_parens = 0; /* lexical scanning kludge for print */ static int sub_counter = 0; /* array dimension counter for use in delete */ static char *lexptr = NULL; /* pointer to next char during parsing */ static char *lexend; static char *lexptr_begin; /* keep track of where we were for error msgs */ static char *lexeme; /* beginning of lexeme for debugging */ -static int lexeof; /* seen EOF for current source? */ +static bool lexeof; /* seen EOF for current source? */ static char *thisline = NULL; static int in_braces = 0; /* count braces for firstline, lastline in an 'action' */ static int lastline = 0; static int firstline = 0; static SRCFILE *sourcefile = NULL; /* current program source */ static int lasttok = 0; -static int eof_warned = FALSE; /* GLOBAL: want warning for each file */ +static bool eof_warned = false; /* GLOBAL: want warning for each file */ static int break_allowed; /* kludge for break */ static int continue_allowed; /* kludge for continue */ - #define END_FILE -1000 #define END_SRC -2000 @@ -237,12 +236,12 @@ rule } | '@' LEX_INCLUDE source statement_term { - want_source = FALSE; + want_source = false; yyerrok; } | '@' LEX_LOAD library statement_term { - want_source = FALSE; + want_source = false; yyerrok; } ; @@ -291,7 +290,7 @@ pattern tp = instruction(Op_no_op); list_prepend($1, bcalloc(Op_line_range, !!do_pretty_print + 1, 0)); - $1->nexti->triggered = FALSE; + $1->nexti->triggered = false; $1->nexti->target_jmp = $4->nexti; list_append($1, instruction(Op_cond_pair)); @@ -515,7 +514,7 @@ statement case_values[case_count++] = caseval; } else { /* match a constant regex against switch expression. */ - (curr + 1)->match_exp = TRUE; + (curr + 1)->match_exp = true; } curr->stmt_start = casestmt->nexti; curr->stmt_end = casestmt->lasti; @@ -855,7 +854,7 @@ non_compound_stmt * call without a return value is recognized * in mk_function(). */ - ($3->lasti + 1)->tail_call = TRUE; + ($3->lasti + 1)->tail_call = true; } $$ = list_append($3, $1); @@ -873,7 +872,7 @@ non_compound_stmt * We don't bother to document it though. So there. */ simple_stmt - : print { in_print = TRUE; in_parens = 0; } print_expression_list output_redir + : print { in_print = true; in_parens = 0; } print_expression_list output_redir { /* * Optimization: plain `print' has no expression list, so $3 is null. @@ -889,7 +888,7 @@ simple_stmt && $3->nexti->nexti->memory->type == Node_val) ) ) { - static short warned = FALSE; + static bool warned = false; /* ----------------- * output_redir * [ redirect exp ] @@ -912,7 +911,7 @@ simple_stmt bcfree($3); /* Op_list */ } else { if (do_lint && (rule == BEGIN || rule == END) && ! warned) { - warned = TRUE; + warned = true; lintwarn_ln($1->source_line, _("plain `print' in BEGIN or END rule should probably be `print \"\"'")); } @@ -949,7 +948,7 @@ regular_print: $$ = list_create($1); } else { INSTRUCTION *t = $3; - $1->expr_count = count_expressions(&t, FALSE); + $1->expr_count = count_expressions(&t, false); $1->redir_type = redirect_none; $$ = list_append(t, $1); } @@ -964,7 +963,7 @@ regular_print: $$ = list_append($4, $1); } else { INSTRUCTION *t = $3; - $1->expr_count = count_expressions(&t, FALSE); + $1->expr_count = count_expressions(&t, false); $$ = list_append(list_merge($4, t), $1); } } @@ -979,10 +978,10 @@ regular_print: $2->memory = variable($2->source_line, arr, Node_var_new); if ($4 == NULL) { - static short warned = FALSE; + static bool warned = false; if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn_ln($1->source_line, _("`delete array' is a gawk extension")); } @@ -1002,11 +1001,11 @@ regular_print: * should always be done. */ { - static short warned = FALSE; + static bool warned = false; char *arr = $3->lextok; if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn_ln($1->source_line, _("`delete(array)' is a non-portable tawk extension")); } @@ -1117,11 +1116,11 @@ print_expression_list output_redir : /* empty */ { - in_print = FALSE; + in_print = false; in_parens = 0; $$ = NULL; } - | IO_OUT { in_print = FALSE; in_parens = 0; } common_exp + | IO_OUT { in_print = false; in_parens = 0; } common_exp { if ($1->redir_type == redirect_twoway && $3->lasti->opcode == Op_K_getline_redir @@ -1309,7 +1308,7 @@ common_exp | common_exp simp_exp %prec CONCAT_OP { int count = 2; - int is_simple_var = FALSE; + bool is_simple_var = false; if ($1->lasti->opcode == Op_concat) { /* multiple (> 2) adjacent strings optimization */ @@ -1419,7 +1418,7 @@ simp_exp $$ = list_merge($5, $4); } else { INSTRUCTION *t = $2; - $4->expr_count = count_expressions(&t, FALSE); + $4->expr_count = count_expressions(&t, false); $$ = list_append(list_merge(t, $5), $4); } } @@ -1501,10 +1500,10 @@ non_post_simp_exp } | LEX_LENGTH { - static short warned1 = FALSE; + static bool warned = false; - if (do_lint && ! warned1) { - warned1 = TRUE; + if (do_lint && ! warned) { + warned = true; lintwarn_ln($1->source_line, _("call of `length' without parentheses is not portable")); } @@ -1571,13 +1570,13 @@ func_call INSTRUCTION *f, *t; char *name; NODE *indirect_var; - static short warned = FALSE; + static bool warned = false; const char *msg = _("indirect function calls are a gawk extension"); if (do_traditional || do_posix) yyerror("%s", msg); else if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn("%s", msg); } @@ -1611,7 +1610,7 @@ direct_func_call $$ = list_create($1); } else { INSTRUCTION *t = $3; - ($1 + 1)->expr_count = count_expressions(&t, TRUE); + ($1 + 1)->expr_count = count_expressions(&t, true); $$ = list_append(t, $1); } } @@ -1669,7 +1668,7 @@ bracketed_exp_list t->nexti->memory = dupnode(Nnull_string); $3->sub_count = 1; } else - $3->sub_count = count_expressions(&t, FALSE); + $3->sub_count = count_expressions(&t, false); $$ = list_append(t, $3); } ; @@ -2144,7 +2143,7 @@ mk_program() if (endfile_block == NULL) endfile_block = list_create(ip_endfile); else { - ip_rec->has_endfile = TRUE; + ip_rec->has_endfile = true; (void) list_prepend(endfile_block, ip_endfile); } @@ -2249,7 +2248,7 @@ parse_program(INSTRUCTION **pcode) sourcefile = sourcefile->next) ; - lexeof = FALSE; + lexeof = false; lexptr = NULL; lasttok = 0; memset(rule_block, 0, sizeof(ruletab) * sizeof(INSTRUCTION *)); @@ -2298,7 +2297,7 @@ do_add_srcfile(int stype, char *src, char *path, SRCFILE *thisfile) */ SRCFILE * -add_srcfile(int stype, char *src, SRCFILE *thisfile, int *already_included, int *errcode) +add_srcfile(int stype, char *src, SRCFILE *thisfile, bool *already_included, int *errcode) { SRCFILE *s; struct stat sbuf; @@ -2306,7 +2305,7 @@ add_srcfile(int stype, char *src, SRCFILE *thisfile, int *already_included, int int errno_val = 0; if (already_included) - *already_included = FALSE; + *already_included = false; if (errcode) *errcode = 0; if (stype == SRC_CMDLINE || stype == SRC_STDIN) @@ -2343,7 +2342,7 @@ add_srcfile(int stype, char *src, SRCFILE *thisfile, int *already_included, int } efree(path); if (already_included) - *already_included = TRUE; + *already_included = true; return NULL; } } @@ -2362,7 +2361,7 @@ include_source(INSTRUCTION *file) SRCFILE *s; char *src = file->lextok; int errcode; - int already_included; + bool already_included; if (do_traditional || do_posix) { error_ln(file->source_line, _("@include is a gawk extension")); @@ -2399,8 +2398,8 @@ include_source(INSTRUCTION *file) sourceline = 0; source = NULL; lasttok = 0; - lexeof = FALSE; - eof_warned = FALSE; + lexeof = false; + eof_warned = false; return 0; } @@ -2412,7 +2411,7 @@ load_library(INSTRUCTION *file) SRCFILE *s; char *src = file->lextok; int errcode; - int already_included; + bool already_included; if (do_traditional || do_posix) { error_ln(file->source_line, _("@load is a gawk extension")); @@ -2462,11 +2461,11 @@ next_sourcefile() * Previous versions of gawk did not core dump in such a * case. * - * assert(lexeof == TRUE); + * assert(lexeof == true); */ - lexeof = FALSE; - eof_warned = FALSE; + lexeof = false; + eof_warned = false; sourcefile->srclines = sourceline; /* total no of lines in current file */ if (sourcefile->fd > INVALID_HANDLE) { if (sourcefile->fd != fileno(stdin)) /* safety */ @@ -2510,7 +2509,7 @@ get_src_buf() { int n; char *scan; - int newfile; + bool newfile; int savelen; struct stat sbuf; @@ -2535,7 +2534,7 @@ get_src_buf() readfunc = read_one_line; } - newfile = FALSE; + newfile = false; if (sourcefile == srcfiles) return NULL; @@ -2551,13 +2550,13 @@ get_src_buf() * gawk '' /path/name * Sigh. */ - static short warned = FALSE; + static bool warned = false; if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("empty program text on command line")); } - lexeof = TRUE; + lexeof = true; } } else if (sourcefile->buf == NULL && *(lexptr-1) != '\n') { /* @@ -2585,7 +2584,7 @@ get_src_buf() lexend = lexptr + 1; sourcefile->buf = buf; } else - lexeof = TRUE; + lexeof = true; return lexptr; } @@ -2606,7 +2605,7 @@ get_src_buf() error(_("can't open source file `%s' for reading (%s)"), in, strerror(errno)); errcount++; - lexeof = TRUE; + lexeof = true; return sourcefile->src; } @@ -2622,7 +2621,7 @@ get_src_buf() l = A_DECENT_BUFFER_SIZE; #undef A_DECENT_BUFFER_SIZE sourcefile->bufsize = l; - newfile = TRUE; + newfile = true; emalloc(sourcefile->buf, char *, sourcefile->bufsize, "get_src_buf"); lexptr = lexptr_begin = lexeme = sourcefile->buf; savelen = 0; @@ -2673,17 +2672,17 @@ get_src_buf() error(_("can't read sourcefile `%s' (%s)"), source, strerror(errno)); errcount++; - lexeof = TRUE; + lexeof = true; } else { lexend = lexptr + n; if (n == 0) { - static short warned = FALSE; + static bool warned = false; if (do_lint && newfile && ! warned){ - warned = TRUE; + warned = true; sourceline = 0; lintwarn(_("source file `%s' is empty"), source); } - lexeof = TRUE; + lexeof = true; } } return sourcefile->buf; @@ -2859,14 +2858,14 @@ static int newline_eof() pushback(); if (do_lint && ! eof_warned) { lintwarn(_("source file does not end in newline")); - eof_warned = TRUE; + eof_warned = true; } sourceline++; return NEWLINE; } sourceline--; - eof_warned = FALSE; + eof_warned = false; return LEX_EOF; } @@ -2876,15 +2875,15 @@ static int yylex(void) { int c; - int seen_e = FALSE; /* These are for numbers */ - int seen_point = FALSE; - int esc_seen; /* for literal strings */ + bool seen_e = false; /* These are for numbers */ + bool seen_point = false; + bool esc_seen; /* for literal strings */ int mid; int base; - static int did_newline = FALSE; + static bool did_newline = false; char *tokkey; - int inhex = FALSE; - int intlstr = FALSE; + bool inhex = false; + bool intlstr = false; AWKNUM d; #define GET_INSTRUCTION(op) bcalloc(op, 1, sourceline) @@ -2939,7 +2938,7 @@ yylex(void) * The code for \ handles \[ and \]. */ - want_regexp = FALSE; + want_regexp = false; tok = tokstart; for (;;) { c = nextc(); @@ -3056,10 +3055,10 @@ retry: while ((c = nextc()) == ' ' || c == '\t' || c == '\r') continue; if (c == '#') { - static short warned = FALSE; + static bool warned = false; if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn( _("use of `\\ #...' line continuation is not portable")); } @@ -3132,11 +3131,11 @@ retry: return lasttok = '*'; } else if (c == '*') { /* make ** and **= aliases for ^ and ^= */ - static int did_warn_op = FALSE, did_warn_assgn = FALSE; + static bool did_warn_op = false, did_warn_assgn = false; if (nextc() == '=') { if (! did_warn_assgn) { - did_warn_assgn = TRUE; + did_warn_assgn = true; if (do_lint) lintwarn(_("POSIX does not allow operator `**='")); if (do_lint_old) @@ -3147,7 +3146,7 @@ retry: } else { pushback(); if (! did_warn_op) { - did_warn_op = TRUE; + did_warn_op = true; if (do_lint) lintwarn(_("POSIX does not allow operator `**'")); if (do_lint_old) @@ -3181,11 +3180,11 @@ retry: case '^': { - static int did_warn_op = FALSE, did_warn_assgn = FALSE; + static bool did_warn_op = false, did_warn_assgn = false; if (nextc() == '=') { if (do_lint_old && ! did_warn_assgn) { - did_warn_assgn = TRUE; + did_warn_assgn = true; warning(_("operator `^=' is not supported in old awk")); } yylval = GET_INSTRUCTION(Op_assign_exp); @@ -3193,7 +3192,7 @@ retry: } pushback(); if (do_lint_old && ! did_warn_op) { - did_warn_op = TRUE; + did_warn_op = true; warning(_("operator `^' is not supported in old awk")); } yylval = GET_INSTRUCTION(Op_exp); @@ -3272,7 +3271,7 @@ retry: * hacking the grammar. */ if (did_newline) { - did_newline = FALSE; + did_newline = false; if (--in_braces == 0) lastline = sourceline; return lasttok = c; @@ -3283,7 +3282,7 @@ retry: case '"': string: - esc_seen = FALSE; + esc_seen = false; while ((c = nextc()) != '"') { if (c == '\n') { pushback(); @@ -3297,7 +3296,7 @@ retry: sourceline++; continue; } - esc_seen = TRUE; + esc_seen = true; if (! want_source || c != '"') tokadd('\\'); } @@ -3319,7 +3318,7 @@ retry: tok - tokstart, esc_seen ? SCAN : 0); if (intlstr) { yylval->memory->flags |= INTLSTR; - intlstr = FALSE; + intlstr = false; if (do_intl) dumpintlstr(yylval->memory->stptr, yylval->memory->stlen); } @@ -3358,7 +3357,7 @@ retry: case '9': /* It's a number */ for (;;) { - int gotnumber = FALSE; + bool gotnumber = false; tokadd(c); switch (c) { @@ -3370,7 +3369,7 @@ retry: int peek = nextc(); if (isxdigit(peek)) { - inhex = TRUE; + inhex = true; pushback(); /* following digit */ } else { pushback(); /* x or X */ @@ -3381,20 +3380,20 @@ retry: case '.': /* period ends exponent part of floating point number */ if (seen_point || seen_e) { - gotnumber = TRUE; + gotnumber = true; break; } - seen_point = TRUE; + seen_point = true; break; case 'e': case 'E': if (inhex) break; if (seen_e) { - gotnumber = TRUE; + gotnumber = true; break; } - seen_e = TRUE; + seen_e = true; if ((c = nextc()) == '-' || c == '+') { int c2 = nextc(); @@ -3439,7 +3438,7 @@ retry: break; default: done: - gotnumber = TRUE; + gotnumber = true; } if (gotnumber) break; @@ -3452,7 +3451,7 @@ retry: base = 10; if (! do_traditional) { - base = get_numbase(tokstart, FALSE); + base = get_numbase(tokstart, false); if (do_lint) { if (base == 8) lintwarn("numeric constant `%.*s' treated as octal", @@ -3544,7 +3543,7 @@ retry: */ if (! do_traditional && c == '_' && lasttok != '$') { if ((c = nextc()) == '"') { - intlstr = TRUE; + intlstr = true; goto string; } pushback(); @@ -3602,7 +3601,7 @@ retry: switch (class) { case LEX_INCLUDE: case LEX_LOAD: - want_source = TRUE; + want_source = true; break; case LEX_EVAL: if (in_main_context()) @@ -3648,7 +3647,7 @@ out: yylval->lextok = tokkey; return lasttok = FUNC_CALL; } else { - static short goto_warned = FALSE; + static bool goto_warned = false; yylval = GET_INSTRUCTION(Op_token); yylval->lextok = tokkey; @@ -3656,7 +3655,7 @@ out: #define SMART_ALECK 1 if (SMART_ALECK && do_lint && ! goto_warned && strcasecmp(tokkey, "goto") == 0) { - goto_warned = TRUE; + goto_warned = true; lintwarn(_("`goto' considered harmful!\n")); } return lasttok = NAME; @@ -3734,10 +3733,10 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) yyerror(_("%s third parameter is not a changeable object"), operator); else - ip->do_reference = TRUE; + ip->do_reference = true; } - r->expr_count = count_expressions(&subn, FALSE); + r->expr_count = count_expressions(&subn, false); ip = subn->lasti; (void) list_append(subn, r); @@ -3766,7 +3765,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) list_append(list_create(ip), instruction(Op_field_spec))); } - r->expr_count = count_expressions(&subn, FALSE); + r->expr_count = count_expressions(&subn, false); return list_append(subn, r); } } @@ -3802,14 +3801,14 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push) arg->nexti->opcode = Op_push_arg; /* argument may be array */ } else if (r->builtin == do_match) { - static short warned = FALSE; + static bool warned = false; arg = subn->nexti->lasti->nexti; /* 2nd arg list */ (void) mk_rexp(arg); if (nexp == 3) { /* 3rd argument there */ if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("match: third argument is a gawk extension")); } if (do_traditional) { @@ -3863,10 +3862,10 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) ip->opcode = Op_push_array; } } else if (r->builtin == do_close) { - static short warned = FALSE; + static bool warned = false; if (nexp == 2) { if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("close: second argument is a gawk extension")); } if (do_traditional) { @@ -3921,7 +3920,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) #endif if (subn != NULL) { - r->expr_count = count_expressions(&subn, FALSE); + r->expr_count = count_expressions(&subn, false); return list_append(subn, r); } @@ -3936,7 +3935,7 @@ static int parms_shadow(INSTRUCTION *pc, int *shadow) { int pcount, i; - int ret = FALSE; + bool ret = false; NODE *func, *fp; char *fname; @@ -3946,7 +3945,7 @@ parms_shadow(INSTRUCTION *pc, int *shadow) #if 0 /* can't happen, already exited if error ? */ if (fname == NULL || func == NULL) /* error earlier */ - return FALSE; + return false; #endif pcount = func->param_cnt; @@ -3965,7 +3964,7 @@ parms_shadow(INSTRUCTION *pc, int *shadow) warning( _("function `%s': parameter `%s' shadows global variable"), fname, fp[i].param); - ret = TRUE; + ret = true; } } @@ -3981,7 +3980,7 @@ valinfo(NODE *n, Func_print print_func, FILE *fp) if (n == Nnull_string) print_func(fp, "uninitialized scalar\n"); else if (n->flags & STRING) { - pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', FALSE); + pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', false); print_func(fp, "\n"); } else if (n->flags & NUMBER) { #ifdef HAVE_MPFR @@ -3993,7 +3992,7 @@ valinfo(NODE *n, Func_print print_func, FILE *fp) #endif print_func(fp, "%.17g\n", n->numbr); } else if (n->flags & STRCUR) { - pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', FALSE); + pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', false); print_func(fp, "\n"); } else if (n->flags & NUMCUR) { #ifdef HAVE_MPFR @@ -4038,7 +4037,7 @@ void dump_funcs() { NODE **funcs; - funcs = function_list(TRUE); + funcs = function_list(true); (void) foreach_func(funcs, (int (*)(INSTRUCTION *, void *)) pp_func, (void *) 0); efree(funcs); } @@ -4050,13 +4049,13 @@ void shadow_funcs() { static int calls = 0; - int shadow = FALSE; + bool shadow = false; NODE **funcs; if (calls++ != 0) fatal(_("shadow_funcs() called twice!")); - funcs = function_list(TRUE); + funcs = function_list(true); (void) foreach_func(funcs, (int (*)(INSTRUCTION *, void *)) parms_shadow, & shadow); efree(funcs); @@ -4087,7 +4086,7 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def) ; if (t->opcode == Op_func_call && strcmp(t->func_name, thisfunc->vname) == 0) - (t + 1)->tail_call = TRUE; + (t + 1)->tail_call = true; } /* add an implicit return at end; @@ -4362,7 +4361,7 @@ variable(int location, char *name, NODETYPE type) /* not found */ struct deferred_variable *dv; - for (dv = deferred_variables; TRUE; dv = dv->next) { + for (dv = deferred_variables; true; dv = dv->next) { if (dv == NULL) { /* * This is the only case in which we may not free the string. @@ -4392,7 +4391,7 @@ make_regnode(int type, NODE *exp) n->re_cnt = 1; if (type == Node_regex) { - n->re_reg = make_regexp(exp->stptr, exp->stlen, FALSE, TRUE, FALSE); + n->re_reg = make_regexp(exp->stptr, exp->stlen, false, true, false); if (n->re_reg == NULL) { freenode(n); return NULL; @@ -4459,12 +4458,12 @@ isnoeffect(OPCODE type) case Op_match_rec: case Op_not: case Op_in_array: - return TRUE; + return true; default: break; /* keeps gcc -Wall happy */ } - return FALSE; + return false; } /* make_assignable --- make this operand an assignable one if posiible */ @@ -4505,7 +4504,7 @@ dumpintlstr(const char *str, size_t len) } printf("msgid "); - pp_string_fp(fprintf, stdout, str, len, '"', TRUE); + pp_string_fp(fprintf, stdout, str, len, '"', true); putchar('\n'); printf("msgstr \"\"\n\n"); fflush(stdout); @@ -4528,10 +4527,10 @@ dumpintlstr2(const char *str1, size_t len1, const char *str2, size_t len2) } printf("msgid "); - pp_string_fp(fprintf, stdout, str1, len1, '"', TRUE); + pp_string_fp(fprintf, stdout, str1, len1, '"', true); putchar('\n'); printf("msgid_plural "); - pp_string_fp(fprintf, stdout, str2, len2, '"', TRUE); + pp_string_fp(fprintf, stdout, str2, len2, '"', true); putchar('\n'); printf("msgstr[0] \"\"\nmsgstr[1] \"\"\n\n"); fflush(stdout); @@ -4909,7 +4908,7 @@ mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op) && tp->memory->type == Node_var && tp->memory->var_assign ) { - tp->do_reference = FALSE; /* no uninitialized reference checking + tp->do_reference = false; /* no uninitialized reference checking * for a special variable. */ (void) list_append(ip, instruction(Op_var_assign)); @@ -5312,7 +5311,7 @@ mk_expression_list(INSTRUCTION *list, INSTRUCTION *s1) */ static int -count_expressions(INSTRUCTION **list, int isarg) +count_expressions(INSTRUCTION **list, bool isarg) { INSTRUCTION *expr; INSTRUCTION *r = NULL; @@ -5428,13 +5427,13 @@ check_special(const char *name) int low, high, mid; int i; #if 'a' == 0x81 /* it's EBCDIC */ - static int did_sort = FALSE; + static bool did_sort = false; if (! did_sort) { qsort((void *) tokentab, sizeof(tokentab) / sizeof(tokentab[0]), sizeof(tokentab[0]), tokcompare); - did_sort = TRUE; + did_sort = true; } #endif @@ -73,7 +73,7 @@ extern void srandom(unsigned long seed); extern NODE **args_array; extern int max_args; extern NODE **fields_arr; -extern int output_is_tty; +extern bool output_is_tty; extern FILE *output_fp; @@ -83,7 +83,7 @@ s1 = POP(); \ do { if (s1->type == Node_var_array) { \ DEREF(s2); \ fatal(_("attempt to use array `%s' in a scalar context"), array_vname(s1)); \ -}} while (FALSE) +}} while (false) /* @@ -93,7 +93,7 @@ fatal(_("attempt to use array `%s' in a scalar context"), array_vname(s1)); \ #define GAWK_RANDOM_MAX 0x7fffffffL static void efwrite(const void *ptr, size_t size, size_t count, FILE *fp, - const char *from, struct redirect *rp, int flush); + const char *from, struct redirect *rp, bool flush); /* efwrite --- like fwrite, but with error checking */ @@ -104,7 +104,7 @@ efwrite(const void *ptr, FILE *fp, const char *from, struct redirect *rp, - int flush) + bool flush) { errno = 0; if (fwrite(ptr, size, count, fp) != count) @@ -319,7 +319,7 @@ do_index(int nargs) size_t l1, l2; long ret; #if MBS_SUPPORT - int do_single_byte = FALSE; + bool do_single_byte = false; mbstate_t mbs1, mbs2; if (gawk_mb_cur_max > 1) { @@ -491,12 +491,12 @@ do_length(int nargs) tmp = POP(); if (tmp->type == Node_var_array) { - static short warned = FALSE; + static bool warned = false; if (do_posix) fatal(_("length: received array argument")); if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("`length(array)' is a gawk extension")); } return make_number((AWKNUM) tmp->table_size); @@ -560,7 +560,7 @@ mpz2mpfr(mpz_ptr zi) { size_t prec; static mpfr_t mpfrval; - static int inited = FALSE; + static bool inited = false; int tval; /* estimate minimum precision for exact conversion */ @@ -573,7 +573,7 @@ mpz2mpfr(mpz_ptr zi) if (! inited) { mpfr_init2(mpfrval, prec); - inited = TRUE; + inited = true; } else mpfr_set_prec(mpfrval, prec); tval = mpfr_set_z(mpfrval, zi, ROUND_MODE); @@ -640,7 +640,7 @@ format_tree( size_t cur_arg = 0; NODE *r = NULL; int i, nc; - int toofew = FALSE; + bool toofew = false; char *obuf, *obufout; size_t osiz, ofre; const char *chbuf; @@ -648,11 +648,11 @@ format_tree( int cs1; NODE *arg; long fw, prec, argnum; - int used_dollar; - int lj, alt, big_flag, bigbig_flag, small_flag, have_prec, need_format; + bool used_dollar; + bool lj, alt, big_flag, bigbig_flag, small_flag, have_prec, need_format; long *cur = NULL; uintmax_t uval; - int sgn; + bool sgn; int base; /* * Although this is an array, the elements serve two different @@ -672,10 +672,10 @@ format_tree( char *cp; const char *fill; AWKNUM tmpval = 0.0; - char signchar = FALSE; + char signchar = '\0'; size_t len; - int zero_flag = FALSE; - int quote_flag = FALSE; + bool zero_flag = false; + bool quote_flag = false; int ii, jj; char *chp; size_t copy_count, char_count; @@ -747,7 +747,7 @@ format_tree( goto out; \ } else if (cur_arg >= num_args) { \ arg = 0; /* shutup the compiler */ \ - toofew = TRUE; \ + toofew = true; \ break; \ } else { \ arg = the_args[cur_arg]; \ @@ -755,8 +755,8 @@ format_tree( } \ } - need_format = FALSE; - used_dollar = FALSE; + need_format = false; + used_dollar = false; s0 = s1 = fmt_string; while (n0-- > 0) { @@ -764,7 +764,7 @@ format_tree( s1++; continue; } - need_format = TRUE; + need_format = true; bchunk(s0, s1 - s0); s0 = s1; cur = &fw; @@ -773,17 +773,17 @@ format_tree( base = 0; argnum = 0; base = 0; - have_prec = FALSE; - signchar = FALSE; - zero_flag = FALSE; - quote_flag = FALSE; + have_prec = false; + signchar = '\0'; + zero_flag = false; + quote_flag = false; #ifdef HAVE_MPFR mf = NULL; zi = NULL; #endif fmt_type = 0; - lj = alt = big_flag = bigbig_flag = small_flag = FALSE; + lj = alt = big_flag = bigbig_flag = small_flag = false; fill = sp; cp = cend; chbuf = lchbuf; @@ -800,7 +800,7 @@ check_pos: break; /* reject as a valid format */ goto retry; case '%': - need_format = FALSE; + need_format = false; /* * 29 Oct. 2002: * The C99 standard pages 274 and 279 seem to imply that @@ -832,7 +832,7 @@ check_pos: * screws up floating point formatting. */ if (cur == & fw) - zero_flag = TRUE; + zero_flag = true; if (lj) goto retry; /* FALL through */ @@ -859,7 +859,7 @@ check_pos: *cur = *cur * 10 + *s1++ - '0'; } if (prec < 0) /* negative precision is discarded */ - have_prec = FALSE; + have_prec = false; if (cur == &prec) cur = NULL; if (n0 == 0) /* badly formatted control string */ @@ -874,7 +874,7 @@ check_pos: if (cur == &fw) { argnum = fw; fw = 0; - used_dollar = TRUE; + used_dollar = true; if (argnum <= 0) { msg(_("fatal: arg count with `$' must be > 0")); goto out; @@ -907,7 +907,7 @@ check_pos: n0--; } if (val >= num_args) { - toofew = TRUE; + toofew = true; break; } arg = the_args[val]; @@ -922,16 +922,16 @@ check_pos: } if (cur == &prec) { if (*cur >= 0) - have_prec = TRUE; + have_prec = true; else - have_prec = FALSE; + have_prec = false; cur = NULL; } goto retry; case ' ': /* print ' ' or '-' */ /* 'space' flag is ignored */ /* if '+' already present */ - if (signchar != FALSE) + if (signchar != false) goto check_pos; /* FALL THROUGH */ case '+': /* print '+' or '-' */ @@ -951,16 +951,16 @@ check_pos: if (cur != &fw) break; cur = ≺ - have_prec = TRUE; + have_prec = true; goto retry; case '#': - alt = TRUE; + alt = true; goto check_pos; case '\'': #if defined(HAVE_LOCALE_H) /* allow quote_flag if there is a thousands separator. */ if (loc.thousands_sep[0] != '\0') - quote_flag = TRUE; + quote_flag = true; goto check_pos; #else goto retry; @@ -969,55 +969,55 @@ check_pos: if (big_flag) break; else { - static short warned = FALSE; + static bool warned = false; if (do_lint && ! warned) { lintwarn(_("`l' is meaningless in awk formats; ignored")); - warned = TRUE; + warned = true; } if (do_posix) { msg(_("fatal: `l' is not permitted in POSIX awk formats")); goto out; } } - big_flag = TRUE; + big_flag = true; goto retry; case 'L': if (bigbig_flag) break; else { - static short warned = FALSE; + static bool warned = false; if (do_lint && ! warned) { lintwarn(_("`L' is meaningless in awk formats; ignored")); - warned = TRUE; + warned = true; } if (do_posix) { msg(_("fatal: `L' is not permitted in POSIX awk formats")); goto out; } } - bigbig_flag = TRUE; + bigbig_flag = true; goto retry; case 'h': if (small_flag) break; else { - static short warned = FALSE; + static bool warned = false; if (do_lint && ! warned) { lintwarn(_("`h' is meaningless in awk formats; ignored")); - warned = TRUE; + warned = true; } if (do_posix) { msg(_("fatal: `h' is not permitted in POSIX awk formats")); goto out; } } - small_flag = TRUE; + small_flag = true; goto retry; case 'c': - need_format = FALSE; + need_format = false; parse_next_arg(); /* user input that looks numeric is numeric */ if ((arg->flags & (MAYBE_NUM|NUMBER)) == MAYBE_NUM) @@ -1090,7 +1090,7 @@ out2: prec = 1; goto pr_tail; case 's': - need_format = FALSE; + need_format = false; parse_next_arg(); arg = force_string(arg); if (fw == 0 && ! have_prec) @@ -1104,7 +1104,7 @@ out2: goto pr_tail; case 'd': case 'i': - need_format = FALSE; + need_format = false; parse_next_arg(); (void) force_number(arg); #ifdef HAVE_MPFR @@ -1133,12 +1133,12 @@ out2: if (tmpval < 0) { tmpval = -tmpval; - sgn = TRUE; + sgn = true; } else { if (tmpval == -0.0) /* avoid printing -0 */ tmpval = 0.0; - sgn = FALSE; + sgn = false; } /* * Use snprintf return value to tell if there @@ -1174,7 +1174,7 @@ out2: if (loc.grouping[ii+1] == 0) jj = 0; /* keep using current val in loc.grouping[ii] */ else if (loc.grouping[ii+1] == CHAR_MAX) - quote_flag = FALSE; + quote_flag = false; else { ii++; jj = 0; @@ -1224,7 +1224,7 @@ out2: base += 2; /* FALL THROUGH */ case 'o': base += 8; - need_format = FALSE; + need_format = false; parse_next_arg(); (void) force_number(arg); #ifdef HAVE_MPFR @@ -1243,7 +1243,7 @@ mpz0: mf = mpz2mpfr(zi); goto mpf1; } - signchar = FALSE; /* Don't print '+' */ + signchar = '\0'; /* Don't print '+' */ } /* See comments above about when to fill with zeros */ @@ -1283,7 +1283,7 @@ mpf1: goto pr_tail; /* printf("%.0x", 0) is no characters */ goto int0; } - signchar = FALSE; /* Don't print '+' */ + signchar = '\0'; /* Don't print '+' */ } /* See comments above about when to fill with zeros */ @@ -1349,7 +1349,7 @@ mpf1: if (loc.grouping[ii+1] == 0) jj = 0; /* keep using current val in loc.grouping[ii] */ else if (loc.grouping[ii+1] == CHAR_MAX) - quote_flag = FALSE; + quote_flag = false; else { ii++; jj = 0; @@ -1420,7 +1420,7 @@ mpf1: case 'e': case 'f': case 'E': - need_format = FALSE; + need_format = false; parse_next_arg(); (void) force_number(arg); @@ -1629,7 +1629,7 @@ do_printf(int nargs, int redirtype) DEREF(tmp); return; } - efwrite(tmp->stptr, sizeof(char), tmp->stlen, fp, "printf", rp, TRUE); + efwrite(tmp->stptr, sizeof(char), tmp->stlen, fp, "printf", rp, true); if (rp != NULL && (rp->flag & RED_TWOWAY) != 0) fflush(rp->fp); DEREF(tmp); @@ -1827,7 +1827,7 @@ do_strftime(int nargs) format = def_strftime_format; /* traditional date format */ formatlen = strlen(format); (void) time(& fclock); /* current time of day */ - do_gmt = FALSE; + do_gmt = false; if (PROCINFO_node != NULL) { sub = make_string("strftime", 8); @@ -2073,15 +2073,15 @@ do_print(int nargs, int redirtype) } for (i = nargs; i > 0; i--) { - efwrite(args_array[i]->stptr, sizeof(char), args_array[i]->stlen, fp, "print", rp, FALSE); + efwrite(args_array[i]->stptr, sizeof(char), args_array[i]->stlen, fp, "print", rp, false); DEREF(args_array[i]); if (i != 1 && OFSlen > 0) efwrite(OFS, sizeof(char), (size_t) OFSlen, - fp, "print", rp, FALSE); + fp, "print", rp, false); } if (ORSlen > 0) - efwrite(ORS, sizeof(char), (size_t) ORSlen, fp, "print", rp, TRUE); + efwrite(ORS, sizeof(char), (size_t) ORSlen, fp, "print", rp, true); if (rp != NULL && (rp->flag & RED_TWOWAY) != 0) fflush(rp->fp); @@ -2120,10 +2120,10 @@ do_print_rec(int nargs, int redirtype) if (do_lint && f0 == Nnull_string) lintwarn(_("reference to uninitialized field `$%d'"), 0); - efwrite(f0->stptr, sizeof(char), f0->stlen, fp, "print", rp, FALSE); + efwrite(f0->stptr, sizeof(char), f0->stlen, fp, "print", rp, false); if (ORSlen > 0) - efwrite(ORS, sizeof(char), (size_t) ORSlen, fp, "print", rp, TRUE); + efwrite(ORS, sizeof(char), (size_t) ORSlen, fp, "print", rp, true); if (rp != NULL && (rp->flag & RED_TWOWAY) != 0) fflush(rp->fp); @@ -2320,7 +2320,7 @@ do_cos(int nargs) /* do_rand --- do the rand function */ -static int firstrand = TRUE; +static bool firstrand = true; /* Some systems require this array to be integer aligned. Sigh. */ #define SIZEOF_STATE 256 static uint32_t istate[SIZEOF_STATE/sizeof(uint32_t)]; @@ -2333,7 +2333,7 @@ do_rand(int nargs ATTRIBUTE_UNUSED) if (firstrand) { (void) initstate((unsigned) 1, state, SIZEOF_STATE); /* don't need to srandom(1), initstate() does it for us. */ - firstrand = FALSE; + firstrand = false; setstate(state); } /* @@ -2356,7 +2356,7 @@ do_srand(int nargs) if (firstrand) { (void) initstate((unsigned) 1, state, SIZEOF_STATE); /* don't need to srandom(1), we're changing the seed below */ - firstrand = FALSE; + firstrand = false; (void) setstate(state); } @@ -2517,7 +2517,7 @@ do_match(int nargs) * #! /usr/local/bin/mawk -f * * BEGIN { - * TRUE = 1; FALSE = 0 + * true = 1; false = 0 * print "--->", mygsub("abc", "b+", "FOO") * print "--->", mygsub("abc", "x*", "X") * print "--->", mygsub("abc", "b*", "X") @@ -2529,10 +2529,10 @@ do_match(int nargs) * function mygsub(str, regex, replace, origstr, newstr, eosflag, nonzeroflag) * { * origstr = str; - * eosflag = nonzeroflag = FALSE + * eosflag = nonzeroflag = false * while (match(str, regex)) { * if (RLENGTH > 0) { # easy case - * nonzeroflag = TRUE + * nonzeroflag = true * if (RSTART == 1) { # match at front of string * newstr = newstr replace * } else { @@ -2545,7 +2545,7 @@ do_match(int nargs) * # which we don't really want, so skip over it * newstr = newstr substr(str, 1, 1) * str = substr(str, 2) - * nonzeroflag = FALSE + * nonzeroflag = false * } else { * # 0-length match * if (RSTART == 1) { @@ -2559,7 +2559,7 @@ do_match(int nargs) * if (eosflag) * break * else - * eosflag = TRUE + * eosflag = true * } * if (length(str) > 0) * newstr = newstr str # rest of string @@ -2626,7 +2626,7 @@ do_sub(int nargs, unsigned int flags) long how_many = 1; /* one substitution for sub, also gensub default */ int global; long current; - int lastmatchnonzero; + bool lastmatchnonzero; char *mb_indices = NULL; if ((flags & GENSUB) != 0) { @@ -2764,7 +2764,7 @@ set_how_many: } } - lastmatchnonzero = FALSE; + lastmatchnonzero = false; bp = buf; for (current = 1;; current++) { matches++; @@ -2796,7 +2796,7 @@ set_how_many: if (matchstart == matchend && lastmatchnonzero && matchstart == text) { - lastmatchnonzero = FALSE; + lastmatchnonzero = false; matches--; goto empty; } @@ -2865,7 +2865,7 @@ set_how_many: } else *bp++ = *scan; if (matchstart != matchend) - lastmatchnonzero = TRUE; + lastmatchnonzero = true; } else { /* * don't want this match, skip over it by copying diff --git a/cint_array.c b/cint_array.c index f82eb4b6..3245cdc1 100644 --- a/cint_array.c +++ b/cint_array.c @@ -825,14 +825,14 @@ tree_remove(NODE *symbol, NODE *tree, long k) assert(i >= 0); tn = tree->nodes[i]; if (tn == NULL) - return FALSE; + return false; if (tn->type == Node_array_tree && ! tree_remove(symbol, tn, k)) - return FALSE; + return false; else if (tn->type == Node_array_leaf && ! leaf_remove(symbol, tn, k)) - return FALSE; + return false; if (tn->table_size == 0) { freenode(tn); @@ -845,7 +845,7 @@ tree_remove(NODE *symbol, NODE *tree, long k) memset(tree, '\0', sizeof(NODE)); tree->type = Node_array_tree; } - return TRUE; + return true; } @@ -1086,7 +1086,7 @@ leaf_remove(NODE *symbol, NODE *array, long k) lhs = array->nodes + (k - array->array_base); if (*lhs == NULL) - return FALSE; + return false; *lhs = NULL; if (--array->table_size == 0) { efree(array->nodes); @@ -1094,7 +1094,7 @@ leaf_remove(NODE *symbol, NODE *array, long k) symbol->array_capacity -= array->array_size; array->array_size = 0; /* sanity */ } - return TRUE; + return true; } @@ -36,11 +36,11 @@ extern NODE *get_function(void); extern int gprintf(FILE *fp, const char *format, ...); extern jmp_buf pager_quit_tag; -extern int pager_quit_tag_valid; +extern bool pager_quit_tag_valid; extern int output_is_tty; extern int input_fd; -extern int input_from_tty; +extern bool input_from_tty; extern FILE *out_fp; extern char *dbg_prompt; extern char *commands_prompt; @@ -168,10 +168,10 @@ extern char *(*read_a_line)(const char *prompt); extern char *read_commands_string(const char *prompt); extern int in_cmd_src(const char *); extern int get_eof_status(void); -extern void push_cmd_src(int fd, int istty, char * (*readfunc)(const char *), +extern void push_cmd_src(int fd, bool istty, char * (*readfunc)(const char *), int (*closefunc)(int), int cmd, int eofstatus); extern int pop_cmd_src(void); -extern int has_break_or_watch_point(int *pnum, int any); +extern int has_break_or_watch_point(int *pnum, bool any); extern int do_list(CMDARG *arg, int cmd); extern int do_info(CMDARG *arg, int cmd); extern int do_print_var(CMDARG *arg, int cmd); @@ -89,17 +89,17 @@ static void yyerror(const char *mesg, ...); static int find_command(const char *token, size_t toklen); -static int want_nodeval = FALSE; +static bool want_nodeval = false; static int cmd_idx = -1; /* index of current command in cmd table */ static int repeat_idx = -1; /* index of last repeatable command in command table */ static CMDARG *arg_list = NULL; /* list of arguments */ static long errcount = 0; static char *lexptr_begin = NULL; -static int in_commands = FALSE; +static bool in_commands = false; static int num_dim; -static int in_eval = FALSE; +static bool in_eval = false; static const char start_EVAL[] = "function @eval(){"; static const char end_EVAL[] = "}"; static CMDARG *append_statement(CMDARG *stmt_list, char *stmt); @@ -1717,7 +1717,7 @@ yyreduce: #line 109 "command.y" { cmd_idx = -1; - want_nodeval = FALSE; + want_nodeval = false; if (lexptr_begin != NULL) { if (input_from_tty && lexptr_begin[0] != '\0') add_history(lexptr_begin); @@ -1738,7 +1738,7 @@ yyreduce: { if (errcount == 0 && cmd_idx >= 0) { Func_cmd cmdfunc; - int terminate = FALSE; + bool terminate = false; CMDARG *args; int ctype = 0; @@ -1772,7 +1772,7 @@ yyreduce: if (in_commands) cmdfunc = do_commands; cmd_idx = -1; - want_nodeval = FALSE; + want_nodeval = false; args = arg_list; arg_list = NULL; @@ -1799,7 +1799,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 212 "command.y" - { want_nodeval = TRUE; } + { want_nodeval = true; } break; case 23: @@ -1818,7 +1818,7 @@ yyreduce: rl_inhibit_completion = 1; } cmd_idx = -1; - in_eval = TRUE; + in_eval = true; } } break; @@ -1869,7 +1869,7 @@ yyreduce: rl_inhibit_completion = 0; } cmd_idx = find_command("eval", 4); - in_eval = FALSE; + in_eval = false; } break; @@ -1921,42 +1921,42 @@ yyreduce: /* Line 1806 of yacc.c */ #line 305 "command.y" - { want_nodeval = TRUE; } + { want_nodeval = true; } break; case 40: /* Line 1806 of yacc.c */ #line 306 "command.y" - { want_nodeval = TRUE; } + { want_nodeval = true; } break; case 46: /* Line 1806 of yacc.c */ #line 311 "command.y" - { want_nodeval = TRUE; } + { want_nodeval = true; } break; case 49: /* Line 1806 of yacc.c */ #line 313 "command.y" - { want_nodeval = TRUE; } + { want_nodeval = true; } break; case 51: /* Line 1806 of yacc.c */ #line 314 "command.y" - { want_nodeval = TRUE; } + { want_nodeval = true; } break; case 53: /* Line 1806 of yacc.c */ #line 315 "command.y" - { want_nodeval = TRUE; } + { want_nodeval = true; } break; case 57: @@ -1994,12 +1994,12 @@ yyreduce: ; else if (in_commands) yyerror(_("Can't use command `commands' for breakpoint/watchpoint commands")); - else if ((yyvsp[(2) - (2)]) == NULL && ! (type = has_break_or_watch_point(&num, TRUE))) + else if ((yyvsp[(2) - (2)]) == NULL && ! (type = has_break_or_watch_point(&num, true))) yyerror(_("no breakpoint/watchpoint has been set yet")); - else if ((yyvsp[(2) - (2)]) != NULL && ! (type = has_break_or_watch_point(&num, FALSE))) + else if ((yyvsp[(2) - (2)]) != NULL && ! (type = has_break_or_watch_point(&num, false))) yyerror(_("invalid breakpoint/watchpoint number")); if (type) { - in_commands = TRUE; + in_commands = true; if (input_from_tty) { dbg_prompt = commands_prompt; fprintf(out_fp, _("Type commands for when %s %d is hit, one per line.\n"), @@ -2020,7 +2020,7 @@ yyreduce: else { if (input_from_tty) dbg_prompt = dgawk_prompt; - in_commands = FALSE; + in_commands = false; } } break; @@ -2056,7 +2056,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 381 "command.y" - { want_nodeval = TRUE; } + { want_nodeval = true; } break; case 64: @@ -2066,7 +2066,7 @@ yyreduce: { int type; int num = (yyvsp[(2) - (4)])->a_int; - type = has_break_or_watch_point(&num, FALSE); + type = has_break_or_watch_point(&num, false); if (! type) yyerror(_("condition: invalid breakpoint/watchpoint number")); } @@ -2213,14 +2213,14 @@ yyreduce: /* Line 1806 of yacc.c */ #line 496 "command.y" - { want_nodeval = TRUE; } + { want_nodeval = true; } break; case 92: /* Line 1806 of yacc.c */ #line 498 "command.y" - { want_nodeval = TRUE; } + { want_nodeval = true; } break; case 95: @@ -3179,7 +3179,7 @@ again: if (c == '"') { char *str, *p; int flags = ALREADY_MALLOCED; - int esc_seen = FALSE; + bool esc_seen = false; toklen = lexend - lexptr; emalloc(str, char *, toklen + 2, "yylex"); @@ -3194,7 +3194,7 @@ err: } if (c == '\\') { c = *++lexptr; - esc_seen = TRUE; + esc_seen = true; if (want_nodeval || c != '"') *p++ = '\\'; } @@ -3391,7 +3391,7 @@ find_command(const char *token, size_t toklen) { char *name, *abrv; int i, k; - int try_exact = TRUE; + bool try_exact = true; int abrv_match = -1; int partial_match = -1; @@ -3415,7 +3415,7 @@ find_command(const char *token, size_t toklen) return i; if (*name > *token || i == (k - 1)) - try_exact = FALSE; + try_exact = false; if (abrv_match < 0) { abrv = cmdtab[i].abbrvn; @@ -3469,7 +3469,7 @@ do_help(CMDARG *arg, int cmd) fprintf(out_fp, _("undefined command: %s\n"), name); } - return FALSE; + return false; } @@ -3518,7 +3518,7 @@ command_completion(const char *text, int start, int end) int idx; int len; - rl_attempted_completion_over = TRUE; /* no default filename completion please */ + rl_attempted_completion_over = true; /* no default filename completion please */ this_cmd = D_illegal; len = start; @@ -37,17 +37,17 @@ static void yyerror(const char *mesg, ...); static int find_command(const char *token, size_t toklen); -static int want_nodeval = FALSE; +static bool want_nodeval = false; static int cmd_idx = -1; /* index of current command in cmd table */ static int repeat_idx = -1; /* index of last repeatable command in command table */ static CMDARG *arg_list = NULL; /* list of arguments */ static long errcount = 0; static char *lexptr_begin = NULL; -static int in_commands = FALSE; +static bool in_commands = false; static int num_dim; -static int in_eval = FALSE; +static bool in_eval = false; static const char start_EVAL[] = "function @eval(){"; static const char end_EVAL[] = "}"; static CMDARG *append_statement(CMDARG *stmt_list, char *stmt); @@ -108,7 +108,7 @@ input | input line { cmd_idx = -1; - want_nodeval = FALSE; + want_nodeval = false; if (lexptr_begin != NULL) { if (input_from_tty && lexptr_begin[0] != '\0') add_history(lexptr_begin); @@ -128,7 +128,7 @@ line { if (errcount == 0 && cmd_idx >= 0) { Func_cmd cmdfunc; - int terminate = FALSE; + bool terminate = false; CMDARG *args; int ctype = 0; @@ -162,7 +162,7 @@ line if (in_commands) cmdfunc = do_commands; cmd_idx = -1; - want_nodeval = FALSE; + want_nodeval = false; args = arg_list; arg_list = NULL; @@ -209,7 +209,7 @@ break_cmd /* mid-rule action buried in non-terminal to avoid conflict */ set_want_nodeval - : { want_nodeval = TRUE; } + : { want_nodeval = true; } ; eval_prologue @@ -226,7 +226,7 @@ eval_prologue rl_inhibit_completion = 1; } cmd_idx = -1; - in_eval = TRUE; + in_eval = true; } } ; @@ -261,7 +261,7 @@ eval_cmd rl_inhibit_completion = 0; } cmd_idx = find_command("eval", 4); - in_eval = FALSE; + in_eval = false; } | D_EVAL set_want_nodeval string_node { @@ -302,17 +302,17 @@ command } | D_IGNORE plus_integer D_INT | D_ENABLE enable_args - | D_PRINT { want_nodeval = TRUE; } print_args - | D_PRINTF { want_nodeval = TRUE; } printf_args + | D_PRINT { want_nodeval = true; } print_args + | D_PRINTF { want_nodeval = true; } printf_args | D_LIST list_args | D_UNTIL location | D_CLEAR location | break_cmd break_args - | D_SET { want_nodeval = TRUE; } variable '=' node + | D_SET { want_nodeval = true; } variable '=' node | D_OPTION option_args - | D_RETURN { want_nodeval = TRUE; } opt_node - | D_DISPLAY { want_nodeval = TRUE; } opt_variable - | D_WATCH { want_nodeval = TRUE; } variable condition_exp + | D_RETURN { want_nodeval = true; } opt_node + | D_DISPLAY { want_nodeval = true; } opt_variable + | D_WATCH { want_nodeval = true; } variable condition_exp | d_cmd opt_integer_list | D_DUMP opt_string | D_SOURCE D_STRING @@ -337,12 +337,12 @@ command ; else if (in_commands) yyerror(_("Can't use command `commands' for breakpoint/watchpoint commands")); - else if ($2 == NULL && ! (type = has_break_or_watch_point(&num, TRUE))) + else if ($2 == NULL && ! (type = has_break_or_watch_point(&num, true))) yyerror(_("no breakpoint/watchpoint has been set yet")); - else if ($2 != NULL && ! (type = has_break_or_watch_point(&num, FALSE))) + else if ($2 != NULL && ! (type = has_break_or_watch_point(&num, false))) yyerror(_("invalid breakpoint/watchpoint number")); if (type) { - in_commands = TRUE; + in_commands = true; if (input_from_tty) { dbg_prompt = commands_prompt; fprintf(out_fp, _("Type commands for when %s %d is hit, one per line.\n"), @@ -358,7 +358,7 @@ command else { if (input_from_tty) dbg_prompt = dgawk_prompt; - in_commands = FALSE; + in_commands = false; } } | D_SILENT @@ -378,11 +378,11 @@ command $2->a_argument = argtab[idx].value; } } - | D_CONDITION plus_integer { want_nodeval = TRUE; } condition_exp + | D_CONDITION plus_integer { want_nodeval = true; } condition_exp { int type; int num = $2->a_int; - type = has_break_or_watch_point(&num, FALSE); + type = has_break_or_watch_point(&num, false); if (! type) yyerror(_("condition: invalid breakpoint/watchpoint number")); } @@ -493,9 +493,9 @@ location break_args : /* empty */ { $$ = NULL; } - | plus_integer { want_nodeval = TRUE; } condition_exp + | plus_integer { want_nodeval = true; } condition_exp | func_name - | D_STRING ':' plus_integer { want_nodeval = TRUE; } condition_exp + | D_STRING ':' plus_integer { want_nodeval = true; } condition_exp | D_STRING ':' func_name ; @@ -1165,7 +1165,7 @@ again: if (c == '"') { char *str, *p; int flags = ALREADY_MALLOCED; - int esc_seen = FALSE; + bool esc_seen = false; toklen = lexend - lexptr; emalloc(str, char *, toklen + 2, "yylex"); @@ -1180,7 +1180,7 @@ err: } if (c == '\\') { c = *++lexptr; - esc_seen = TRUE; + esc_seen = true; if (want_nodeval || c != '"') *p++ = '\\'; } @@ -1377,7 +1377,7 @@ find_command(const char *token, size_t toklen) { char *name, *abrv; int i, k; - int try_exact = TRUE; + bool try_exact = true; int abrv_match = -1; int partial_match = -1; @@ -1401,7 +1401,7 @@ find_command(const char *token, size_t toklen) return i; if (*name > *token || i == (k - 1)) - try_exact = FALSE; + try_exact = false; if (abrv_match < 0) { abrv = cmdtab[i].abbrvn; @@ -1455,7 +1455,7 @@ do_help(CMDARG *arg, int cmd) fprintf(out_fp, _("undefined command: %s\n"), name); } - return FALSE; + return false; } @@ -1504,7 +1504,7 @@ command_completion(const char *text, int start, int end) int idx; int len; - rl_attempted_completion_over = TRUE; /* no default filename completion please */ + rl_attempted_completion_over = true; /* no default filename completion please */ this_cmd = D_illegal; len = start; @@ -30,7 +30,7 @@ #include <fcntl.h> /* open() */ #endif -extern int exiting; +extern bool exiting; extern SRCFILE *srcfiles; extern INSTRUCTION *rule_list; extern INSTRUCTION *code_block; @@ -53,7 +53,7 @@ char *dbg_prompt; char *commands_prompt = "> "; /* breakpoint or watchpoint commands list */ char *eval_prompt = "@> "; /* awk statement(s) */ -int input_from_tty = FALSE; +bool input_from_tty = false; int input_fd; static SRCFILE *cur_srcfile; @@ -61,7 +61,7 @@ static long cur_frame = 0; static INSTRUCTION *cur_pc; int cur_rule = 0; -static int prog_running = FALSE; +static bool prog_running = false; struct condition { INSTRUCTION *code; @@ -89,7 +89,7 @@ typedef struct break_point { INSTRUCTION *bpi; /* Op_breakpoint */ struct commands_item commands; /* list of commands to run */ - int silent; + bool silent; struct condition cndn; @@ -168,8 +168,8 @@ static struct { INSTRUCTION *pc; /* 'until' and 'return' commands */ int repeat_count; /* 'step', 'next', 'stepi', 'nexti' commands */ - int print_frame; /* print frame info, 'finish' and 'until' */ - int print_ret; /* print returned value, 'finish' */ + bool print_frame; /* print frame info, 'finish' and 'until' */ + bool print_ret; /* print returned value, 'finish' */ int break_point; /* non-zero (breakpoint number) if stopped at break point */ int watch_point; /* non-zero (watchpoint number) if stopped at watch point */ @@ -184,7 +184,7 @@ static struct { /* restart related stuff */ extern char **d_argv; /* copy of argv array */ -static int need_restart = FALSE; +static bool need_restart = false; enum { BREAK=1, WATCH, DISPLAY, HISTORY, OPTION }; static const char *const env_variable[] = { "", @@ -236,9 +236,9 @@ static const char *history_file = DEFAULT_HISTFILE; static char *output_file = "/dev/stdout"; /* gawk output redirection */ char *dgawk_prompt = NULL; /* initialized in interpret */ static int list_size = DEFAULT_LISTSIZE; /* # of lines that 'list' prints */ -static int do_trace = FALSE; -static int do_save_history = TRUE; -static int do_save_options = TRUE; +static int do_trace = false; +static int do_save_history = true; +static int do_save_options = true; static int history_size = DEFAULT_HISTSIZE; /* max # of lines in history file */ static const struct dbg_option option_list[] = { @@ -264,18 +264,18 @@ static void save_options(const char *file); /* pager */ jmp_buf pager_quit_tag; -int pager_quit_tag_valid = FALSE; +bool pager_quit_tag_valid = false; static int screen_width = INT_MAX; /* no of columns */ static int screen_height = INT_MAX; /* no of rows */ static int pager_lines_printed = 0; /* no of lines printed so far */ -static void restart(int run) ATTRIBUTE_NORETURN; +static void restart(bool run) ATTRIBUTE_NORETURN; static void close_all(void); static int open_readfd(const char *file); static int find_lines(SRCFILE *s); static SRCFILE *source_find(char *src); static int print_lines(char *src, int start_line, int nlines); -static void print_symbol(NODE *r, int isparam); +static void print_symbol(NODE *r, bool isparam); static NODE *find_frame(long num); static NODE *find_param(const char *name, long num, char **pname); static NODE *find_symbol(const char *name, char **pname); @@ -292,10 +292,9 @@ static void delete_commands_item(struct commands_item *c); static NODE *execute_code(volatile INSTRUCTION *code); static int pre_execute_code(INSTRUCTION **pi); static int parse_condition(int type, int num, char *expr); -static BREAKPOINT *add_breakpoint(INSTRUCTION *, INSTRUCTION *, char *, int); +static BREAKPOINT *add_breakpoint(INSTRUCTION *prevp, INSTRUCTION *ip, char *src, bool silent); static BREAKPOINT *set_breakpoint_next(INSTRUCTION *rp, INSTRUCTION *ip); -static BREAKPOINT *set_breakpoint_at(INSTRUCTION *, int, int); -static int set_breakpoint(CMDARG *arg, int temporary); +static BREAKPOINT *set_breakpoint_at(INSTRUCTION *rp, int lineno, bool silent); static void delete_breakpoint(BREAKPOINT *b); static BREAKPOINT *find_breakpoint(long num); static void display(struct list_item *d); @@ -313,7 +312,7 @@ static char *g_readline(const char *prompt); static int prompt_yes_no(const char *, char , int , FILE *); static struct pf_data { Func_print print_func; - int defn; + bool defn; FILE *fp; } pf_data; @@ -338,9 +337,9 @@ static struct command_source *cmd_src = NULL; do { \ if (! prog_running) { \ d_error(_("program not running.")); \ - return FALSE; \ + return false; \ } \ - } while (FALSE) + } while (false) /* g_readline -- read a line of text; the interface is like 'readline' but @@ -485,7 +484,7 @@ source_find(char *src) return s; } - path = find_source(src, & sbuf, & errno_val, FALSE); + path = find_source(src, & sbuf, & errno_val, false); if (path != NULL) { for (s = srcfiles->next; s != srcfiles; s = s->next) { if ((s->stype == SRC_FILE || s->stype == SRC_INC) @@ -574,10 +573,10 @@ print_lines(char *src, int start_line, int nlines) */ if (nlines > 1) { BREAKPOINT *b; - int has_bpt = FALSE; + bool has_bpt = false; for (b = breakpoints.prev; b != &breakpoints; b = b->prev) { if (src == b->src && i == b->bpi->source_line) { - has_bpt = TRUE; + has_bpt = true; break; } } @@ -652,7 +651,7 @@ do_list(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) if (last_printed_line != last_print_count) line_first = 1; else - return FALSE; + return false; } } else { line: @@ -706,7 +705,7 @@ list: last_printed_line = line_last; last_print_count = line_last - line_first + 1; } - return FALSE; + return false; } /* do_info --- info command */ @@ -717,7 +716,7 @@ do_info(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) NODE **table; if (arg == NULL || arg->type != D_argument) - return FALSE; + return false; switch (arg->a_argument) { case A_SOURCE: @@ -808,7 +807,7 @@ do_info(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) if (func == NULL) { /* print ARGV ? */ fprintf(out_fp, _("None in main().\n")); - return FALSE; + return false; } pcount = func->param_cnt; /* # of defined params */ @@ -832,7 +831,7 @@ do_info(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) if (r->type == Node_array_ref) r = r->orig_array; fprintf(out_fp, "%s = ", func->fparms[i].param); - print_symbol(r, TRUE); + print_symbol(r, true); } if (to < from) fprintf(out_fp, "%s", @@ -853,13 +852,13 @@ do_info(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) break; case A_FUNCTIONS: - table = function_list(TRUE); + table = function_list(true); initialize_pager(out_fp); if (setjmp(pager_quit_tag) == 0) { gprintf(out_fp, _("All defined functions:\n\n")); pf_data.print_func = gprintf; pf_data.fp = out_fp; - pf_data.defn = TRUE; + pf_data.defn = true; (void) foreach_func(table, (int (*)(INSTRUCTION *, void *)) print_function, &pf_data); @@ -925,13 +924,13 @@ do_info(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) break; } - return FALSE; + return false; } /* print_symbol --- print a symbol table entry */ static void -print_symbol(NODE *r, int isparam) +print_symbol(NODE *r, bool isparam) { switch (r->type) { case Node_var_new: @@ -962,7 +961,7 @@ find_frame(long num) if (num == 0) return frame_ptr; - assert(prog_running == TRUE); + assert(prog_running == true); assert(num <= fcall_count); assert(fcall_list[num] != NULL); return fcall_list[num]; @@ -1115,7 +1114,7 @@ print_subscript(NODE *arr, char *arr_name, CMDARG *a, int count) else { /* print # of elements in array */ fprintf(out_fp, "%s = ", r->vname); - print_symbol(r, FALSE); + print_symbol(r, false); } } else { fprintf(out_fp, "%s[\"%s\"] = ", arr_name, subs->stptr); @@ -1188,7 +1187,7 @@ do_print_var(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) break; } } - return FALSE; + return false; } /* do_set_var --- set command */ @@ -1300,7 +1299,7 @@ do_set_var(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) default: break; } - return FALSE; + return false; } /* find_item --- find an item in the watch/display list */ @@ -1345,7 +1344,7 @@ delete_item(struct list_item *d) delete_commands_item(c->next); } - free_context(d->cndn.ctxt, FALSE); + free_context(d->cndn.ctxt, false); if (d->cndn.expr != NULL) efree(d->cndn.expr); @@ -1554,13 +1553,13 @@ do_display(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) /* display all items */ for (d = display_list.prev; d != &display_list; d = d->prev) display(d); - return FALSE; + return false; } if ((d = do_add_item(&display_list, arg)) != NULL) display(d); - return FALSE; + return false; } /* do_undisplay --- undisplay command */ @@ -1569,7 +1568,7 @@ int do_undisplay(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) { do_delete_item(&display_list, arg); - return FALSE; + return false; } /* condition_triggered --- test if a condition expression is true */ @@ -1582,13 +1581,13 @@ condition_triggered(struct condition *cndn) assert(cndn != NULL); if (cndn->code == NULL) - return TRUE; + return true; push_context(cndn->ctxt); r = execute_code((volatile INSTRUCTION *) cndn->code); pop_context(); /* switch to prev context */ if (r == NULL) /* fatal error */ - return FALSE; /* not triggered */ + return false; /* not triggered */ force_number(r); di = ! iszero(r); @@ -1620,7 +1619,7 @@ find_subscript(struct list_item *item, NODE **ptr) return 0; } -/* cmp_val --- compare values of watched item, returns TRUE if different; */ +/* cmp_val --- compare values of watched item, returns true if different; */ static int cmp_val(struct list_item *w, NODE *old, NODE *new) @@ -1628,38 +1627,38 @@ cmp_val(struct list_item *w, NODE *old, NODE *new) /* * case old new result * ------------------------------ - * 1: NULL ARRAY TRUE - * 2: NULL SCALAR TRUE - * 3: NULL NULL FALSE + * 1: NULL ARRAY true + * 2: NULL SCALAR true + * 3: NULL NULL false * 4: SCALAR SCALAR cmp_node - * 5: SCALAR ARRAY TRUE - * 6: SCALAR NULL TRUE - * 7: ARRAY SCALAR TRUE + * 5: SCALAR ARRAY true + * 6: SCALAR NULL true + * 7: ARRAY SCALAR true * 8: ARRAY ARRAY compare size - * 9: ARRAY NULL TRUE + * 9: ARRAY NULL true */ if (WATCHING_ARRAY(w)) { long size = 0; if (! new) /* 9 */ - return TRUE; + return true; if (new->type == Node_val) /* 7 */ - return TRUE; + return true; /* new->type == Node_var_array */ /* 8 */ size = new->table_size; if (w->cur_size == size) - return FALSE; - return TRUE; + return false; + return true; } if (! old && ! new) /* 3 */ - return FALSE; + return false; if ((! old && new) /* 1, 2 */ || (old && ! new)) /* 6 */ - return TRUE; + return true; if (new->type == Node_var_array) /* 5 */ - return TRUE; + return true; return cmp_nodes(old, new); /* 4 */ } @@ -1797,11 +1796,11 @@ do_watch(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) w = do_add_item(&watch_list, arg); if (w == NULL) - return FALSE; + return false; if (initialize_watch_item(w) == -1) { delete_item(w); - return FALSE; + return false; } fprintf(out_fp, "Watchpoint %d: ", w->number); @@ -1820,7 +1819,7 @@ do_watch(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) else fprintf(out_fp, "%s\n", w->sname); - return FALSE; + return false; } /* do_unwatch --- unwatch command */ @@ -1829,7 +1828,7 @@ int do_unwatch(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) { do_delete_item(&watch_list, arg); - return FALSE; + return false; } /* callback from pop_frame in eval.c */ @@ -1905,7 +1904,7 @@ print_frame(NODE *func, char *src, int srcline) else { pf_data.print_func = fprintf; pf_data.fp = out_fp; - pf_data.defn = FALSE; + pf_data.defn = false; (void) print_function(func->code_ptr, &pf_data); } fprintf(out_fp, _(" at `%s':%d"), src, srcline); @@ -1918,7 +1917,7 @@ print_numbered_frame(long num) { NODE *f; - assert(prog_running == TRUE); + assert(prog_running == true); f = find_frame(num); if (num == 0) { fprintf(out_fp, "#%ld\t ", num); @@ -1962,7 +1961,7 @@ do_backtrace(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) } if (cur <= fcall_count) fprintf(out_fp, _("More stack frames follow ...\n")); - return FALSE; + return false; } /* print_cur_frame_and_sourceline --- print current frame, and @@ -1976,7 +1975,7 @@ print_cur_frame_and_sourceline() int srcline; char *src; - assert(prog_running == TRUE); + assert(prog_running == true); f = find_frame(cur_frame); if (cur_frame == 0) { src = source; @@ -2005,12 +2004,12 @@ do_frame(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) if (arg && arg->type == D_int) { if (arg->a_int < 0 || arg->a_int > fcall_count) { d_error(_("invalid frame number")); - return FALSE; + return false; } cur_frame = arg->a_int; } print_cur_frame_and_sourceline(); - return FALSE; + return false; } /* do_up --- up command */ @@ -2028,7 +2027,7 @@ do_up(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) else if (cur_frame > fcall_count) cur_frame = fcall_count; print_cur_frame_and_sourceline(); - return FALSE; + return false; } /* do_down --- down command */ @@ -2046,7 +2045,7 @@ do_down(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) else if (cur_frame > fcall_count) cur_frame = fcall_count; print_cur_frame_and_sourceline(); - return FALSE; + return false; } /* find_rule --- find a rule or function in file 'src' containing @@ -2082,7 +2081,7 @@ mk_breakpoint(char *src, int srcline) emalloc(b, BREAKPOINT *, sizeof(BREAKPOINT), "mk_breakpoint"); memset(&b->cndn, 0, sizeof(struct condition)); b->commands.next = b->commands.prev = &b->commands; - b->silent = FALSE; + b->silent = false; b->number = ++watch_list.number; /* breakpoints and watchpoints use same counter */ @@ -2126,7 +2125,7 @@ delete_breakpoint(BREAKPOINT *b) delete_commands_item(c->next); } - free_context(b->cndn.ctxt, FALSE); + free_context(b->cndn.ctxt, false); if (b->cndn.expr != NULL) efree(b->cndn.expr); @@ -2156,7 +2155,7 @@ find_breakpoint(long num) /* add_breakpoint --- add a breakpoint instruction between PREVP and IP */ static BREAKPOINT * -add_breakpoint(INSTRUCTION *prevp, INSTRUCTION *ip, char *src, int silent) +add_breakpoint(INSTRUCTION *prevp, INSTRUCTION *ip, char *src, bool silent) { BREAKPOINT *b; INSTRUCTION *bp; @@ -2222,7 +2221,7 @@ add_breakpoint(INSTRUCTION *prevp, INSTRUCTION *ip, char *src, int silent) /* set_breakpoint_at --- set a breakpoint at given line number*/ static BREAKPOINT * -set_breakpoint_at(INSTRUCTION *rp, int lineno, int silent) +set_breakpoint_at(INSTRUCTION *rp, int lineno, bool silent) { INSTRUCTION *ip, *prevp; @@ -2266,7 +2265,7 @@ set_breakpoint_next(INSTRUCTION *rp, INSTRUCTION *ip) ip = ip->nexti; for (; ip; prevp = ip, ip = ip->nexti) { if (ip->source_line > 0) - return add_breakpoint(prevp, ip, rp->source_file, FALSE); + return add_breakpoint(prevp, ip, rp->source_file, false); if (ip == (rp + 1)->lasti) break; } @@ -2276,7 +2275,7 @@ set_breakpoint_next(INSTRUCTION *rp, INSTRUCTION *ip) /* set_breakpoint --- set a breakpoint */ static int -set_breakpoint(CMDARG *arg, int temporary) +set_breakpoint(CMDARG *arg, bool temporary) { int lineno; BREAKPOINT *b = NULL; @@ -2325,7 +2324,7 @@ set_breakpoint(CMDARG *arg, int temporary) if (temporary) b->flags |= BP_TEMP; } - return FALSE; + return false; } /* arg != NULL */ @@ -2336,7 +2335,7 @@ set_breakpoint(CMDARG *arg, int temporary) arg = arg->next; if (s == NULL || arg == NULL || (arg->type != D_int && arg->type != D_func)) - return FALSE; + return false; src = s->src; if (arg->type == D_func) /* break filename:function */ goto func; @@ -2350,7 +2349,7 @@ set_breakpoint(CMDARG *arg, int temporary) rp = find_rule(src, lineno); if (rp == NULL) fprintf(out_fp, _("Can't find rule!!!\n")); - if (rp == NULL || (b = set_breakpoint_at(rp, lineno, FALSE)) == NULL) + if (rp == NULL || (b = set_breakpoint_at(rp, lineno, false)) == NULL) fprintf(out_fp, _("Can't set breakpoint at `%s':%d\n"), src, lineno); if (b != NULL && temporary) @@ -2362,7 +2361,7 @@ set_breakpoint(CMDARG *arg, int temporary) func: func = arg->a_node; rp = func->code_ptr; - if ((b = set_breakpoint_at(rp, rp->source_line, FALSE)) == NULL) + if ((b = set_breakpoint_at(rp, rp->source_line, false)) == NULL) fprintf(out_fp, _("Can't set breakpoint in function `%s'\n"), func->vname); else if (temporary) @@ -2371,7 +2370,7 @@ func: break; default: - return FALSE; + return false; } /* condition if any */ arg = arg->next; @@ -2382,7 +2381,7 @@ func: fprintf(out_fp, _("breakpoint %d set at file `%s', line %d is unconditional\n"), b->number, src, lineno); } - return FALSE; + return false; } @@ -2415,7 +2414,7 @@ breakpoint_triggered(BREAKPOINT *b) int do_breakpoint(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) { - return set_breakpoint(arg, FALSE); + return set_breakpoint(arg, false); } /* do_tmp_breakpoint --- tbreak command */ @@ -2423,7 +2422,7 @@ do_breakpoint(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) int do_tmp_breakpoint(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) { - return set_breakpoint(arg, TRUE); + return set_breakpoint(arg, true); } /* do_clear --- clear command */ @@ -2437,7 +2436,7 @@ do_clear(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) NODE *func; SRCFILE *s = cur_srcfile; char *src = cur_srcfile->src; - int bp_found = FALSE; + bool bp_found = false; if (arg == NULL) { /* clear */ CHECK_PROG_RUNNING(); @@ -2459,7 +2458,7 @@ do_clear(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) arg = arg->next; if (s == NULL || arg == NULL || (arg->type != D_int && arg->type != D_func)) - return FALSE; + return false; src = s->src; if (arg->type == D_func) goto func; @@ -2469,7 +2468,7 @@ do_clear(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) lineno = (int) arg->a_int; if (lineno <= 0 || lineno > s->srclines) { d_error(_("line number %d in file `%s' out of range"), lineno, src); - return FALSE; + return false; } break; @@ -2496,7 +2495,7 @@ func: fprintf(out_fp, "\n"); /* fall through */ default: - return FALSE; + return false; } delete_bp: @@ -2521,7 +2520,7 @@ delete_bp: src, (int) lineno); else fprintf(out_fp, "\n"); - return FALSE; + return false; } /* enable_breakpoint --- enable a breakpoint and set its disposition */ @@ -2577,7 +2576,7 @@ do_enable_breakpoint(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) enable_breakpoint(b, disp); } } - return FALSE; + return false; } /* do_delete_breakpoint --- delete command */ @@ -2586,10 +2585,10 @@ int do_delete_breakpoint(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) { if (arg == NULL) { - int delete_all = TRUE; + bool delete_all = true; delete_all = prompt_yes_no( _("Delete all breakpoints? (y or n) "), - _("y")[0], TRUE, out_fp); + _("y")[0], true, out_fp); if (delete_all) { while (breakpoints.next != &breakpoints) @@ -2618,7 +2617,7 @@ do_delete_breakpoint(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) delete_breakpoint(b); } } - return FALSE; + return false; } /* do_ignore_breakpoint --- ignore command */ @@ -2630,7 +2629,7 @@ do_ignore_breakpoint(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) if (arg == NULL || arg->type != D_int || arg->next == NULL || arg->next->type != D_int) - return FALSE; + return false; if ((b = find_breakpoint(arg->a_int)) == NULL) d_error(_("invalid breakpoint number")); @@ -2646,7 +2645,7 @@ do_ignore_breakpoint(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) b->number); } } - return FALSE; + return false; } /* do_disable_breakpoint --- disable command */ @@ -2681,7 +2680,7 @@ do_disable_breakpoint(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) b->flags &= ~BP_ENABLE; } } - return FALSE; + return false; } #ifdef HAVE_LIBREADLINE @@ -2741,7 +2740,7 @@ debug_prog(INSTRUCTION *pc) input_fd = fileno(stdin); out_fp = stdout; if (os_isatty(input_fd)) - input_from_tty = TRUE; + input_from_tty = true; if (input_fd == 0 && input_from_tty) initialize_readline(); @@ -2792,7 +2791,7 @@ debug_prog(INSTRUCTION *pc) command_file, strerror(errno)); exit(EXIT_FAILURE); } - push_cmd_src(fd, FALSE, g_readline, close, 0, EXIT_FAILURE); + push_cmd_src(fd, false, g_readline, close, 0, EXIT_FAILURE); cmd_src->str = estrdup(command_file, strlen(command_file)); } else { @@ -2806,7 +2805,7 @@ debug_prog(INSTRUCTION *pc) /* read saved options */ fd = open_readfd(options_file); if (fd > INVALID_HANDLE) - push_cmd_src(fd, FALSE, g_readline, close, 0, EXIT_SUCCESS); + push_cmd_src(fd, false, g_readline, close, 0, EXIT_SUCCESS); } /* start the command interpreter */ @@ -2825,16 +2824,16 @@ check_watchpoint() struct list_item *w; if (stop.command == D_return) - return FALSE; + return false; for (w = watch_list.prev; w != &watch_list; w = w->prev) { int wnum = watchpoint_triggered(w); if (wnum > 0) { stop.watch_point = wnum; - stop.print_frame = TRUE; - return TRUE; + stop.print_frame = true; + return true; } } - return FALSE; + return false; } /* check_breakpoint --- check if breakpoint triggered */ @@ -2846,7 +2845,7 @@ check_breakpoint(INSTRUCTION **pi) pc = *pi; if (stop.command == D_return) - return FALSE; + return false; if (pc->opcode == Op_breakpoint) { int bnum; *pi = pc->nexti; /* skip past the breakpoint instruction; @@ -2855,17 +2854,17 @@ check_breakpoint(INSTRUCTION **pi) bnum = breakpoint_triggered(pc->break_pt); if (bnum > 0) { stop.break_point = bnum; - stop.print_frame = TRUE; - return TRUE; + stop.print_frame = true; + return true; } } - return FALSE; + return false; } /* restart --- restart the debugger */ static void -restart(int run) +restart(bool run) { /* save state in the environment after serialization */ serialize(BREAK); @@ -2875,7 +2874,7 @@ restart(int run) serialize(OPTION); /* tell the new process to restore state from the environment */ - setenv("DGAWK_RESTART", (run ? "TRUE" : "FALSE"), 1); + setenv("DGAWK_RESTART", (run ? "true" : "false"), 1); /* close all open files */ close_all(); @@ -2895,15 +2894,15 @@ do_run(CMDARG *arg ATTRIBUTE_UNUSED, int cmd ATTRIBUTE_UNUSED) { if (prog_running) { if (! input_from_tty) - need_restart = TRUE; /* handled later */ + need_restart = true; /* handled later */ else { need_restart = prompt_yes_no( _("Program already running. Restart from beginning (y/n)? "), - _("y")[0], FALSE, out_fp); + _("y")[0], false, out_fp); if (! need_restart) { fprintf(out_fp, _("Program not restarted\n")); - return FALSE; + return false; } } } @@ -2911,36 +2910,36 @@ do_run(CMDARG *arg ATTRIBUTE_UNUSED, int cmd ATTRIBUTE_UNUSED) if (need_restart) { /* avoid endless cycles of restarting */ if (command_file != NULL) { - /* input_from_tty = FALSE */ + /* input_from_tty = false */ fprintf(stderr, _("error: cannot restart, operation not allowed\n")); exit(EXIT_FAILURE); } if (cmd_src->cmd == D_source) { - /* input_from_tty = FALSE */ + /* input_from_tty = false */ fprintf(out_fp, _("error (%s): cannot restart, ignoring rest of the commands\n"), cmd_src->str); pop_cmd_src(); - return FALSE; + return false; } - restart(TRUE); /* does not return */ + restart(true); /* does not return */ } fprintf(out_fp, _("Starting program: \n")); - prog_running = TRUE; - fatal_tag_valid = TRUE; + prog_running = true; + fatal_tag_valid = true; if (setjmp(fatal_tag) == 0) (void) interpret(code_block); - fatal_tag_valid = FALSE; - prog_running = FALSE; + fatal_tag_valid = false; + prog_running = false; fprintf(out_fp, _("Program exited %s with exit value: %d\n"), (! exiting && exit_val != EXIT_SUCCESS) ? "abnormally" : "normally", exit_val); - need_restart = TRUE; - return FALSE; + need_restart = true; + return false; } /* do_quit --- quit command */ @@ -2948,14 +2947,14 @@ do_run(CMDARG *arg ATTRIBUTE_UNUSED, int cmd ATTRIBUTE_UNUSED) int do_quit(CMDARG *arg ATTRIBUTE_UNUSED, int cmd ATTRIBUTE_UNUSED) { - int terminate = TRUE; + bool terminate = true; if (prog_running) terminate = prompt_yes_no( _("The program is running. Exit anyway (y/n)? "), - _("y")[0], TRUE, out_fp); + _("y")[0], true, out_fp); if (terminate) { close_all(); - do_trace = FALSE; /* don't save 'trace on' */ + do_trace = false; /* don't save 'trace on' */ #ifdef HAVE_LIBREADLINE if (do_save_history && input_from_tty) { @@ -2970,7 +2969,7 @@ do_quit(CMDARG *arg ATTRIBUTE_UNUSED, int cmd ATTRIBUTE_UNUSED) exit(exit_val); } - return FALSE; + return false; } /* do_continue --- continue command */ @@ -2982,23 +2981,23 @@ do_continue(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) CHECK_PROG_RUNNING(); if (! arg || arg->type != D_int) - return TRUE; + return true; /* arg is breakpoint ignore count if stopped at a breakpoint */ if (! stop.break_point) { fprintf(out_fp, _("Not stopped at any breakpoint; argument ignored.\n")); - return TRUE; + return true; } b = find_breakpoint(stop.break_point); if (b == NULL) { d_error(_("invalid breakpoint number %d."), stop.break_point); - return FALSE; + return false; } b->flags |= BP_IGNORE; b->ignore_count = arg->a_int; fprintf(out_fp, _("Will ignore next %ld crossings of breakpoint %d.\n"), b->ignore_count, stop.break_point); - return TRUE; + return true; } /* next_step --- common code for next and step commands */ @@ -3012,10 +3011,10 @@ next_step(CMDARG *arg, int cmd) else stop.repeat_count = 1; stop.command = cmd; - return TRUE; + return true; } -/* check_step --- process step command, return TRUE if stopping */ +/* check_step --- process step command, return true if stopping */ static int check_step(INSTRUCTION **pi) @@ -3024,7 +3023,7 @@ check_step(INSTRUCTION **pi) stop.fcall_count = fcall_count; stop.sourceline = sourceline; stop.source = source; - stop.print_frame = TRUE; + stop.print_frame = true; return (--stop.repeat_count == 0); } @@ -3038,10 +3037,10 @@ check_step(INSTRUCTION **pi) stop.sourceline = sourceline; return (--stop.repeat_count == 0); } - return FALSE; + return false; } -/* do_step -- process step command, return TRUE if stopping */ +/* do_step -- process step command, return true if stopping */ int do_step(CMDARG *arg, int cmd) @@ -3057,7 +3056,7 @@ do_step(CMDARG *arg, int cmd) return ret; } -/* do_stepi -- process stepi command, return TRUE if stopping */ +/* do_stepi -- process stepi command, return true if stopping */ static int check_stepi(INSTRUCTION **pi) @@ -3078,7 +3077,7 @@ do_stepi(CMDARG *arg, int cmd) } -/* check_next -- process next command returning TRUE if stopping */ +/* check_next -- process next command returning true if stopping */ static int check_next(INSTRUCTION **pi) @@ -3089,7 +3088,7 @@ check_next(INSTRUCTION **pi) stop.fcall_count = fcall_count; stop.sourceline = sourceline; stop.source = source; - stop.print_frame = TRUE; + stop.print_frame = true; return (--stop.repeat_count == 0); } @@ -3113,7 +3112,7 @@ check_next(INSTRUCTION **pi) } #endif - return FALSE; + return false; } /* do_next -- next command */ @@ -3133,7 +3132,7 @@ do_next(CMDARG *arg, int cmd) return ret; } -/* check_nexti --- process nexti command, returns TRUE if stopping */ +/* check_nexti --- process nexti command, returns true if stopping */ static int check_nexti(INSTRUCTION **pi) @@ -3141,7 +3140,7 @@ check_nexti(INSTRUCTION **pi) /* make sure not to step inside function calls */ if (fcall_count < stop.fcall_count) { - stop.print_frame = TRUE; + stop.print_frame = true; stop.fcall_count = fcall_count; } return (fcall_count == stop.fcall_count @@ -3163,16 +3162,16 @@ do_nexti(CMDARG *arg, int cmd) return ret; } -/* check_finish --- process finish command, returns TRUE if stopping */ +/* check_finish --- process finish command, returns true if stopping */ static int check_finish(INSTRUCTION **pi) { if (fcall_count == stop.fcall_count) { - stop.print_frame = TRUE; - return TRUE; + stop.print_frame = true; + return true; } - return FALSE; + return false; } /* do_finish --- finish command */ @@ -3184,7 +3183,7 @@ do_finish(CMDARG *arg ATTRIBUTE_UNUSED, int cmd) if (cur_frame == fcall_count) { fprintf(out_fp, _("'finish' not meaningful in the outermost frame main()\n")); - return FALSE; + return false; } stop.fcall_count = fcall_count - cur_frame - 1; assert(stop.fcall_count >= 0); @@ -3192,11 +3191,11 @@ do_finish(CMDARG *arg ATTRIBUTE_UNUSED, int cmd) print_numbered_frame(cur_frame); stop.check_func = check_finish; stop.command = cmd; - stop.print_ret = TRUE; - return TRUE; + stop.print_ret = true; + return true; } -/* check_return --- process return, returns TRUE if stopping */ +/* check_return --- process return, returns true if stopping */ static int check_return(INSTRUCTION **pi) @@ -3204,8 +3203,8 @@ check_return(INSTRUCTION **pi) assert(fcall_count >= stop.fcall_count); if (fcall_count == stop.fcall_count) { - stop.print_frame = TRUE; - return TRUE; + stop.print_frame = true; + return true; } if (fcall_count > stop.fcall_count) { /* innermost frame just returned */ @@ -3218,7 +3217,7 @@ check_return(INSTRUCTION **pi) /* assert((*pi)->opcode == Op_K_return); */ } - return FALSE; + return false; } /* do_return --- return command */ @@ -3232,7 +3231,7 @@ do_return(CMDARG *arg, int cmd) func = find_frame(cur_frame)->func_node; if (func == NULL) { fprintf(out_fp, _("'return' not meaningful in the outermost frame main()\n")); - return FALSE; + return false; } stop.fcall_count = fcall_count - cur_frame - 1; @@ -3249,26 +3248,26 @@ do_return(CMDARG *arg, int cmd) n = dupnode(Nnull_string); PUSH(n); - return TRUE; + return true; } -/* check_until --- process until, returns TRUE if stopping */ +/* check_until --- process until, returns true if stopping */ int check_until(INSTRUCTION **pi) { if (fcall_count < stop.fcall_count) { /* current stack frame returned */ - stop.print_frame = TRUE; - return TRUE; + stop.print_frame = true; + return true; } else if (fcall_count == stop.fcall_count) { if (stop.pc && *pi == stop.pc) /* until location */ - return TRUE; + return true; if (stop.sourceline > 0 /* until */ && source == stop.source && sourceline > stop.sourceline) - return TRUE; + return true; } - return FALSE; + return false; } /* do_until --- until command */ @@ -3303,7 +3302,7 @@ do_until(CMDARG *arg, int cmd) stop.fcall_count = fcall_count - cur_frame; stop.check_func = check_until; stop.command = cmd; - return TRUE; + return true; } /* GDB: until location - continue running program until @@ -3317,7 +3316,7 @@ do_until(CMDARG *arg, int cmd) arg = arg->next; if (s == NULL || arg == NULL || (arg->type != D_int && arg->type != D_func)) - return FALSE; + return false; src = s->src; if (arg->type == D_func) goto func; @@ -3328,7 +3327,7 @@ do_until(CMDARG *arg, int cmd) if (lineno <= 0 || lineno > s->srclines) { d_error(_("line number %d in file `%s' out of range"), lineno, src); - return FALSE; + return false; } break; @@ -3342,19 +3341,19 @@ func: stop.fcall_count = fcall_count - cur_frame; stop.check_func = check_until; stop.command = cmd; - return TRUE; + return true; } } fprintf(out_fp, _("Can't find specified location in function `%s'\n"), func->vname); /* fall through */ default: - return FALSE; + return false; } if ((rp = find_rule(src, lineno)) == NULL) { d_error(_("invalid source line %d in file `%s'"), lineno, src); - return FALSE; + return false; } for (ip = rp->nexti; ip; ip = ip->nexti) { @@ -3363,14 +3362,14 @@ func: stop.fcall_count = fcall_count - cur_frame; stop.check_func = check_until; stop.command = cmd; - return TRUE; + return true; } if (ip == (rp + 1)->lasti) break; } fprintf(out_fp, _("Can't find specified location %d in file `%s'\n"), lineno, src); - return FALSE; + return false; } /* print_watch_item --- print watched item name, old and current values */ @@ -3457,7 +3456,7 @@ next_command() if (stop.print_frame) { print_frame(frame_ptr->func_node, source, sourceline); fprintf(out_fp, "\n"); - stop.print_frame = FALSE; + stop.print_frame = false; } (void) print_lines(source, sourceline, 1); @@ -3515,15 +3514,15 @@ debug_post_execute(INSTRUCTION *pc) case Op_K_exit: if (stop.command == D_finish) { /* cancel finish command */ - stop.print_ret = FALSE; - stop.print_frame = FALSE; + stop.print_ret = false; + stop.print_frame = false; stop.command = D_illegal; stop.check_func = NULL; fprintf(out_fp, _("'finish' not meaningful with non-local jump '%s'\n"), op2str(pc->opcode)); } else if (stop.command == D_until) { /* cancel until command */ - stop.print_frame = FALSE; + stop.print_frame = false; stop.command = D_illegal; stop.check_func = NULL; fprintf(out_fp, _("'until' not meaningful with non-local jump '%s'\n"), @@ -3541,7 +3540,7 @@ debug_post_execute(INSTRUCTION *pc) r = TOP(); fprintf(out_fp, "Returned value = "); valinfo(r, fprintf, out_fp); - stop.print_ret = FALSE; + stop.print_ret = false; } break; @@ -3562,7 +3561,7 @@ debug_post_execute(INSTRUCTION *pc) static int debug_pre_execute(INSTRUCTION **pi) { - static int cant_stop = FALSE; + static bool cant_stop = false; NODE *m; if (! in_main_context()) @@ -3577,7 +3576,7 @@ debug_pre_execute(INSTRUCTION **pi) && cur_pc->opcode != Op_breakpoint && stop.command != D_return ) - print_instruction(cur_pc, fprintf, out_fp, FALSE); + print_instruction(cur_pc, fprintf, out_fp, false); /* N.B.: For Op_field_spec_lhs must execute instructions upto Op_field_assign * as a group before stopping. Otherwise, watch/print of field variables @@ -3587,48 +3586,48 @@ debug_pre_execute(INSTRUCTION **pi) switch (cur_pc->opcode) { case Op_field_spec_lhs: - cant_stop = TRUE; + cant_stop = true; break; case Op_field_assign: - cant_stop = FALSE; - return TRUE; /* may stop at next instruction */ + cant_stop = false; + return true; /* may stop at next instruction */ case Op_push_lhs: m = cur_pc->memory; if (m->type == Node_var && m->var_assign) - cant_stop = TRUE; + cant_stop = true; break; case Op_arrayfor_incr: /* can have special var as array variable !!! */ m = cur_pc->array_var; if (m->type == Node_var && m->var_assign) - cant_stop = TRUE; + cant_stop = true; break; case Op_var_assign: - cant_stop = FALSE; - return TRUE; /* may stop at next instruction */ + cant_stop = false; + return true; /* may stop at next instruction */ case Op_rule: cur_rule = cur_pc->in_rule; - return TRUE; + return true; case Op_func: case Op_var_update: - return TRUE; + return true; case Op_breakpoint: break; /* processed later in check_breakpoint() */ default: if (cur_pc->source_line <= 0) - return TRUE; + return true; break; } if (cant_stop) - return TRUE; + return true; assert(sourceline > 0); @@ -3665,7 +3664,7 @@ print_memory(NODE *m, NODE *func, Func_print print_func, FILE *fp) #endif print_func(fp, "%g", m->numbr); } else if ((m->flags & STRING) != 0) - pp_string_fp(print_func, fp, m->stptr, m->stlen, '"', FALSE); + pp_string_fp(print_func, fp, m->stptr, m->stlen, '"', false); else if ((m->flags & NUMCUR) != 0) { #ifdef HAVE_MPFR if (m->flags & MPFN) @@ -3676,14 +3675,14 @@ print_memory(NODE *m, NODE *func, Func_print print_func, FILE *fp) #endif print_func(fp, "%g", m->numbr); } else if ((m->flags & STRCUR) != 0) - pp_string_fp(print_func, fp, m->stptr, m->stlen, '"', FALSE); + pp_string_fp(print_func, fp, m->stptr, m->stlen, '"', false); else print_func(fp, "-?-"); print_func(fp, " [%s]", flags2str(m->flags)); break; case Node_regex: - pp_string_fp(print_func, fp, m->re_exp->stptr, m->re_exp->stlen, '/', FALSE); + pp_string_fp(print_func, fp, m->re_exp->stptr, m->re_exp->stlen, '/', false); break; case Node_dynregex: @@ -3773,7 +3772,7 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump) case Op_field_spec_lhs: print_func(fp, "[target_assign = %p] [do_reference = %s]\n", - pc->target_assign, pc->do_reference ? "TRUE" : "FALSE"); + pc->target_assign, pc->do_reference ? "true" : "false"); break; case Op_func: @@ -3783,12 +3782,12 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump) case Op_K_getline_redir: print_func(fp, "[into_var = %s] [redir_type = \"%s\"]\n", - pc->into_var ? "TRUE" : "FALSE", + pc->into_var ? "true" : "false", redir2str(pc->redir_type)); break; case Op_K_getline: - print_func(fp, "[into_var = %s]\n", pc->into_var ? "TRUE" : "FALSE"); + print_func(fp, "[into_var = %s]\n", pc->into_var ? "true" : "false"); print_func(fp, "%*s[target_beginfile = %p] [target_endfile = %p]\n", noffset, "", (pc + 1)->target_beginfile, (pc + 1)->target_endfile); @@ -3844,7 +3843,7 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump) case Op_K_case: print_func(fp, "[target_jmp = %p] [match_exp = %s]\n", - pc->target_jmp, (pc + 1)->match_exp ? "TRUE" : "FALSE"); + pc->target_jmp, (pc + 1)->match_exp ? "true" : "false"); break; case Op_arrayfor_incr: @@ -3907,7 +3906,7 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump) case Op_subscript_lhs: print_func(fp, "[sub_count = %ld] [do_reference = %s]\n", pc->sub_count, - pc->do_reference ? "TRUE" : "FALSE"); + pc->do_reference ? "true" : "false"); break; case Op_K_delete: @@ -3955,7 +3954,7 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump) case Op_push_lhs: print_memory(pc->memory, func, print_func, fp); print_func(fp, " [do_reference = %s]\n", - pc->do_reference ? "TRUE" : "FALSE"); + pc->do_reference ? "true" : "false"); break; case Op_push_i: @@ -3989,10 +3988,10 @@ do_trace_instruction(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) { if (arg != NULL && arg->type == D_argument && arg->a_argument == A_TRACE_ON) - do_trace = TRUE; + do_trace = true; else - do_trace = FALSE; - return FALSE; + do_trace = false; + return false; } /* print_code --- print a list of instructions */ @@ -4019,34 +4018,34 @@ do_dump_instructions(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) if ((fp = fopen(arg->a_string, "w")) == NULL) { d_error(_("could not open `%s' for writing (%s)"), arg->a_string, strerror(errno)); - return FALSE; + return false; } pf_data.print_func = fprintf; pf_data.fp = fp; - pf_data.defn = TRUE; /* in_dump = TRUE */ + pf_data.defn = true; /* in_dump = true */ (void) print_code(code_block, &pf_data); - funcs = function_list(TRUE); + funcs = function_list(true); (void) foreach_func(funcs, (int (*)(INSTRUCTION *, void *)) print_code, &pf_data); efree(funcs); fclose(fp); - return FALSE; + return false; } - funcs = function_list(TRUE); + funcs = function_list(true); initialize_pager(out_fp); if (setjmp(pager_quit_tag) == 0) { pf_data.print_func = gprintf; pf_data.fp = out_fp; - pf_data.defn = TRUE; /* in_dump = TRUE */ + pf_data.defn = true; /* in_dump = true */ (void) print_code(code_block, &pf_data); (void) foreach_func(funcs, (int (*)(INSTRUCTION *, void *)) print_code, &pf_data); } efree(funcs); - return FALSE; + return false; } /* do_save --- save command */ @@ -4062,7 +4061,7 @@ do_save(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) if ((fp = fopen(arg->a_string, "w")) == NULL) { d_error(_("could not open `%s' for writing (%s)"), arg->a_string, strerror(errno)); - return FALSE; + return false; } hist_list = history_list(); @@ -4085,7 +4084,7 @@ do_save(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) } fclose(fp); #endif - return FALSE; + return false; } /* do_option --- option command */ @@ -4103,7 +4102,7 @@ do_option(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) else fprintf(out_fp, "%s = %d\n", opt->name, *(opt->num_val)); } - return FALSE; + return false; } name = arg->a_string; @@ -4115,7 +4114,7 @@ do_option(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) break; } if (! opt->name) - return FALSE; + return false; if (value == NULL) { /* display current setting */ if (opt->str_val != NULL) @@ -4124,7 +4123,7 @@ do_option(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) fprintf(out_fp, "%s = %d\n", opt->name, *(opt->num_val)); } else (*(opt->assign))(value); - return FALSE; + return false; } @@ -4157,12 +4156,12 @@ initialize_pager(FILE *fp) static void prompt_continue(FILE *fp) { - int quit_pager = FALSE; + bool quit_pager = false; if (os_isatty(fileno(fp)) && input_fd == 0) quit_pager = prompt_yes_no( _("\t------[Enter] to continue or q [Enter] to quit------"), - _("q")[0], FALSE, fp); + _("q")[0], false, fp); if (quit_pager) longjmp(pager_quit_tag, 1); pager_lines_printed = 0; @@ -4190,7 +4189,7 @@ gprintf(FILE *fp, const char *format, ...) } #undef GPRINTF_BUFSIZ - while (TRUE) { + while (true) { va_start(args, format); nchar = vsnprintf(buf + bl, buflen - bl, format, args); va_end(args); @@ -4526,7 +4525,7 @@ unserialize_commands(char *str, int str_len) return; commands_string = str; commands_string_len = str_len; - push_cmd_src(INVALID_HANDLE, FALSE, read_commands_string, 0, 0, EXIT_FATAL); + push_cmd_src(INVALID_HANDLE, false, read_commands_string, 0, 0, EXIT_FATAL); line_sep = CSEP; read_command(); /* forced to return in do_commands */ pop_cmd_src(); @@ -4628,7 +4627,7 @@ unserialize_breakpoint(char **pstr, int *pstr_len, int field_cnt) return NULL; rp = find_rule(src, lineno); if (rp == NULL - || (b = set_breakpoint_at(rp, lineno, TRUE)) == NULL + || (b = set_breakpoint_at(rp, lineno, true)) == NULL ) return NULL; @@ -4760,14 +4759,14 @@ prompt_yes_no(const char *mesg, char res_true, int res_default, FILE *fp) } /* has_break_or_watch_point --- check if given breakpoint or watchpoint - * number exists. When flag any is TRUE, + * number exists. When flag any is true, * check if any breakpoint/watchpoint * has been set (ignores num). Returns * type (breakpoint or watchpoint) or 0. */ int -has_break_or_watch_point(int *pnum, int any) +has_break_or_watch_point(int *pnum, bool any) { BREAKPOINT *b = NULL; struct list_item *w = NULL; @@ -4837,10 +4836,10 @@ do_commands(CMDARG *arg, int cmd) if (cmd == D_commands) { int num, type; if (arg == NULL) - type = has_break_or_watch_point(&num, TRUE); + type = has_break_or_watch_point(&num, true); else { num = arg->a_int; - type = has_break_or_watch_point(&num, FALSE); + type = has_break_or_watch_point(&num, false); } b = NULL; w = NULL; @@ -4856,19 +4855,19 @@ do_commands(CMDARG *arg, int cmd) c = c->prev; delete_commands_item(c->next); } - return FALSE; + return false; } else if (cmd == D_end) { commands = NULL; if (read_a_line == read_commands_string) /* unserializig commands */ - return TRUE; /* done unserializing, terminate zzparse() */ - return FALSE; + return true; /* done unserializing, terminate zzparse() */ + return false; } else if (cmd == D_silent) { if (b != NULL) - b->silent = TRUE; + b->silent = true; else if (w != NULL) - w->silent = TRUE; + w->silent = true; /* we also append silent command to the list for use * in `info break(watch)', and to simplify * serialization/unserialization of commands. @@ -4891,7 +4890,7 @@ do_commands(CMDARG *arg, int cmd) c->next = commands; commands->prev = c; c->prev->next = c; - return FALSE; + return false; } /* execute_commands --- execute breakpoint/watchpoint commands, the first @@ -4904,7 +4903,7 @@ execute_commands(struct commands_item *commands) { struct commands_item *c; Func_cmd cmd_ptr; - int ret = FALSE; + bool ret = false; for (c = commands->next; c != commands; c = c->next) { if (c->cmd == D_silent) @@ -5023,7 +5022,7 @@ do_print_f(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) } done: efree(tmp); - return FALSE; + return false; } /* do_source --- source command */ @@ -5038,12 +5037,12 @@ do_source(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) if (fd <= INVALID_HANDLE) { d_error(_("can't open source file `%s' for reading (%s)"), file, strerror(errno)); - return FALSE; + return false; } - push_cmd_src(fd, FALSE, g_readline, close, D_source, EXIT_SUCCESS); + push_cmd_src(fd, false, g_readline, close, D_source, EXIT_SUCCESS); cmd_src->str = estrdup(file, strlen(file)); - return FALSE; + return false; } /* open_readfd --- open a file for reading */ @@ -5209,9 +5208,9 @@ set_option_flag(const char *value) { long n; if (strcmp(value, "on") == 0) - return TRUE; + return true; if (strcmp(value, "off") == 0) - return FALSE; + return false; errno = 0; n = strtol(value, NULL, 0); return (errno == 0 && n != 0); @@ -5329,11 +5328,11 @@ save_options(const char *file) static void close_all() { - int stdio_problem; + bool stdio_problem; struct command_source *cs; - (void) nextfile(&curfile, TRUE); /* close input data file */ - (void) close_io(&stdio_problem); + (void) nextfile(& curfile, true); /* close input data file */ + (void) close_io(& stdio_problem); if (cur_srcfile->fd != INVALID_HANDLE) { close(cur_srcfile->fd); cur_srcfile->fd = INVALID_HANDLE; @@ -5398,7 +5397,7 @@ execute_code(volatile INSTRUCTION *code) */ save_stack_size = (stack_ptr - stack_bottom) + 1; - do_flags = FALSE; + do_flags = false; PUSH_BINDING(fatal_tag_stack, fatal_tag, fatal_tag_valid); if (setjmp(fatal_tag) == 0) { @@ -5441,14 +5440,14 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) ctxt->install_func = append_symbol; /* keep track of newly installed globals */ push_context(ctxt); (void) add_srcfile(SRC_CMDLINE, arg->a_string, srcfiles, NULL, NULL); - do_flags = FALSE; + do_flags = false; ret = parse_program(&code); do_flags = save_flags; remove_params(this_func); if (ret != 0) { pop_context(); /* switch to prev context */ - free_context(ctxt, FALSE /* keep_globals */); - return FALSE; + free_context(ctxt, false /* keep_globals */); + return false; } f = lookup("@eval"); @@ -5505,7 +5504,7 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) #if 0 pf_data.print_func = fprintf; pf_data.fp = out_fp; - pf_data.defn = FALSE; /* in_dump = FALSE */ + pf_data.defn = false; /* in_dump = false */ (void) print_code(f->code_ptr, &pf_data); #endif @@ -5549,7 +5548,7 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) free_context(ctxt, (ret_val != NULL)); /* free all instructions and optionally symbols */ if (ret_val != NULL) destroy_symbol(f); /* destroy "@eval" */ - return FALSE; + return false; } /* @@ -5611,14 +5610,14 @@ parse_condition(int type, int num, char *expr) ctxt->install_func = check_symbol; push_context(ctxt); (void) add_srcfile(SRC_CMDLINE, expr, srcfiles, NULL, NULL); - do_flags = FALSE; + do_flags = false; ret = parse_program(&code); do_flags = save_flags; remove_params(this_func); pop_context(); if (ret != 0 || invalid_symbol) { - free_context(ctxt, FALSE /* keep_globals */); + free_context(ctxt, false /* keep_globals */); return -1; } @@ -5648,7 +5647,7 @@ parse_condition(int type, int num, char *expr) out: if (cndn->expr != NULL) efree(cndn->expr); - free_context(cndn->ctxt, FALSE); + free_context(cndn->ctxt, false); cndn->code = code; cndn->expr = expr; cndn->ctxt = ctxt; @@ -5665,15 +5664,15 @@ do_condition(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) char *expr = NULL; num = arg->a_int; - type = has_break_or_watch_point(&num, FALSE); + type = has_break_or_watch_point(&num, false); if (! type) - return FALSE; + return false; arg = arg->next; /* condition expression */ if (arg != NULL) expr = arg->a_string; if (parse_condition(type, num, expr) == 0 && arg != NULL) arg->a_string = NULL; /* don't let free_cmdarg free it */ - return FALSE; + return false; } /* in_cmd_src --- check if filename already in cmd_src */ @@ -5684,9 +5683,9 @@ in_cmd_src(const char *filename) struct command_source *cs; for (cs = cmd_src; cs != NULL; cs = cs->next) { if (cs->str != NULL && strcmp(cs->str, filename) == 0) - return TRUE; + return true; } - return FALSE; + return false; } int @@ -5700,7 +5699,7 @@ get_eof_status() void push_cmd_src( int fd, - int istty, + bool istty, char * (*readfunc)(const char *), int (*closefunc)(int), int ctype, @@ -33,7 +33,7 @@ NODE **fcall_list = NULL; long fcall_count = 0; int currule = 0; IOBUF *curfile = NULL; /* current data file */ -int exiting = FALSE; +bool exiting = false; int (*interpret)(INSTRUCTION *); #define MAX_EXEC_HOOKS 10 @@ -206,12 +206,12 @@ load_casetable(void) #if defined(LC_CTYPE) int i; char *cp; - static int loaded = FALSE; + static bool loaded = false; if (loaded || do_traditional) return; - loaded = TRUE; + loaded = true; cp = setlocale(LC_CTYPE, NULL); /* this is not per standard, but it's pretty safe */ @@ -696,16 +696,16 @@ dump_fcall_stack(FILE *fp) void set_IGNORECASE() { - static short warned = FALSE; + static bool warned = false; NODE *n = IGNORECASE_node->var_value; if ((do_lint || do_traditional) && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("`IGNORECASE' is a gawk extension")); } load_casetable(); if (do_traditional) - IGNORECASE = FALSE; + IGNORECASE = false; else if ((n->flags & (STRING|STRCUR)) != 0) { if ((n->flags & MAYBE_NUM) == 0) { (void) force_string(n); @@ -717,7 +717,7 @@ set_IGNORECASE() } else if ((n->flags & (NUMCUR|NUMBER)) != 0) IGNORECASE = ! iszero(n); else - IGNORECASE = FALSE; /* shouldn't happen */ + IGNORECASE = false; /* shouldn't happen */ set_RS(); /* set_RS() calls set_FS() if need be, for us */ } @@ -727,12 +727,12 @@ set_IGNORECASE() void set_BINMODE() { - static short warned = FALSE; + static bool warned = false; char *p; NODE *v = BINMODE_node->var_value; if ((do_lint || do_traditional) && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("`BINMODE' is a gawk extension")); } if (do_traditional) @@ -1107,12 +1107,12 @@ grow_stack() */ NODE ** -r_get_lhs(NODE *n, int reference) +r_get_lhs(NODE *n, bool reference) { - int isparam = FALSE; + bool isparam = false; if (n->type == Node_param_list) { - isparam = TRUE; + isparam = true; n = GET_PARAM(n->param_cnt); } @@ -1151,7 +1151,7 @@ r_get_lhs(NODE *n, int reference) /* r_get_field --- get the address of a field node */ static inline NODE ** -r_get_field(NODE *n, Func_ptr *assign, int reference) +r_get_field(NODE *n, Func_ptr *assign, bool reference) { long field_num; NODE **lhs; @@ -1230,7 +1230,7 @@ setup_frame(INSTRUCTION *pc) NODE *m, *f, *fp; NODE **sp = NULL; int pcount, arg_count, i, j; - int tail_optimize = FALSE; + bool tail_optimize = false; f = pc->func_body; pcount = f->param_cnt; @@ -1490,11 +1490,11 @@ unwind_stack(long n) static inline int eval_condition(NODE *t) { - if (t == node_Boolean[FALSE]) - return FALSE; + if (t == node_Boolean[false]) + return false; - if (t == node_Boolean[TRUE]) - return TRUE; + if (t == node_Boolean[true]) + return true; if ((t->flags & MAYBE_NUM) != 0) force_number(t); @@ -1699,10 +1699,10 @@ register_exec_hook(Func_pre_exec preh, Func_post_exec posth) */ if (! preh || (post_execute && posth)) - return FALSE; + return false; if (num_exec_hook == MAX_EXEC_HOOKS) - return FALSE; + return false; /* * Add to the beginning of the array but do not displace the @@ -1720,7 +1720,7 @@ register_exec_hook(Func_pre_exec preh, Func_post_exec posth) if (posth) post_execute = posth; - return TRUE; + return true; } @@ -1755,12 +1755,12 @@ init_interpret() frame_ptr->num_tail_calls = 0; frame_ptr->vname = NULL; - /* initialize TRUE and FALSE nodes */ - node_Boolean[FALSE] = make_number(0.0); - node_Boolean[TRUE] = make_number(1.0); - if (! is_mpg_number(node_Boolean[FALSE])) { - node_Boolean[FALSE]->flags |= NUMINT; - node_Boolean[TRUE]->flags |= NUMINT; + /* initialize true and false nodes */ + node_Boolean[false] = make_number(0.0); + node_Boolean[true] = make_number(1.0); + if (! is_mpg_number(node_Boolean[false])) { + node_Boolean[false]->flags |= NUMINT; + node_Boolean[true]->flags |= NUMINT; } /* @@ -189,7 +189,7 @@ get_argument(int i) */ NODE * -get_actual_argument(int i, int optional, int want_array) +get_actual_argument(int i, bool optional, bool want_array) { NODE *t; char *fname; @@ -213,7 +213,7 @@ get_actual_argument(int i, int optional, int want_array) if (t->type == Node_var_new) { if (want_array) - return get_array(t, FALSE); + return get_array(t, false); else { t->type = Node_var; t->var_value = dupnode(Nnull_string); diff --git a/extension/ChangeLog b/extension/ChangeLog index 7c6976de..a38ce15c 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,7 @@ +2012-05-11 Arnold D. Robbins <arnold@skeeve.com> + + Sweeping change: Use `bool', `true', and `false' everywhere. + 2012-04-11 Andrew J. Schorr <aschorr@telemetry-investments.com> * filefuncs.c (array_set): New function to set an array element. diff --git a/extension/arrayparm.c b/extension/arrayparm.c index 1e28811e..02b8c2e4 100644 --- a/extension/arrayparm.c +++ b/extension/arrayparm.c @@ -52,9 +52,9 @@ do_mkarray(int nargs) if (do_lint && nargs > 3) lintwarn("mkarray: called with too many arguments"); - var = get_array_argument(0, FALSE); - sub = get_scalar_argument(1, FALSE); - val = get_scalar_argument(2, FALSE); + var = get_array_argument(0, false); + sub = get_scalar_argument(1, false); + val = get_scalar_argument(2, false); printf("var->type = %s\n", nodetype2str(var->type)); printf("sub->type = %s\n", nodetype2str(sub->type)); diff --git a/extension/dl.c b/extension/dl.c index afc16af5..ee3b08fe 100644 --- a/extension/dl.c +++ b/extension/dl.c @@ -47,7 +47,7 @@ zaxxon(int nargs) for (i = 0; i < nargs; i++) { - obj = get_scalar_argument(i, TRUE); + obj = get_scalar_argument(i, true); if (obj == NULL) break; @@ -63,7 +63,7 @@ zaxxon(int nargs) /* * Do something useful */ - obj = get_scalar_argument(0, FALSE); + obj = get_scalar_argument(0, false); if (obj != NULL) { force_string(obj); diff --git a/extension/filefuncs.c b/extension/filefuncs.c index 8e5e8daa..9758ba8e 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -42,7 +42,7 @@ do_chdir(int nargs) if (do_lint && nargs != 1) lintwarn("chdir: called with incorrect number of arguments"); - newdir = get_scalar_argument(0, FALSE); + newdir = get_scalar_argument(0, false); (void) force_string(newdir); ret = chdir(newdir->stptr); if (ret < 0) @@ -239,8 +239,8 @@ do_stat(int nargs) lintwarn("stat: called with too many arguments"); /* file is first arg, array to hold results is second */ - file = get_scalar_argument(0, FALSE); - array = get_array_argument(1, FALSE); + file = get_scalar_argument(0, false); + array = get_array_argument(1, false); /* empty out the array */ assoc_clear(array); diff --git a/extension/fork.c b/extension/fork.c index 7e6bb731..3c288c04 100644 --- a/extension/fork.c +++ b/extension/fork.c @@ -78,7 +78,7 @@ do_waitpid(int nargs) if (do_lint && nargs > 1) lintwarn("waitpid: called with too many arguments"); - pidnode = get_scalar_argument(0, FALSE); + pidnode = get_scalar_argument(0, false); if (pidnode != NULL) { pidval = get_number_d(pidnode); pid = (int) pidval; diff --git a/extension/ordchr.c b/extension/ordchr.c index a979607b..6abda181 100644 --- a/extension/ordchr.c +++ b/extension/ordchr.c @@ -43,7 +43,7 @@ do_ord(int nargs) if (do_lint && nargs > 1) lintwarn("ord: called with too many arguments"); - str = get_scalar_argument(0, FALSE); + str = get_scalar_argument(0, false); if (str != NULL) { (void) force_string(str); ret = str->stptr[0]; @@ -70,7 +70,7 @@ do_chr(int nargs) if (do_lint && nargs > 1) lintwarn("chr: called with too many arguments"); - num = get_scalar_argument(0, FALSE); + num = get_scalar_argument(0, false); if (num != NULL) { val = get_number_d(num); ret = val; /* convert to int */ diff --git a/extension/readfile.c b/extension/readfile.c index 57cf6cdd..17e70a6d 100644 --- a/extension/readfile.c +++ b/extension/readfile.c @@ -53,7 +53,7 @@ do_readfile(int nargs) if (do_lint && nargs > 1) lintwarn("readfile: called with too many arguments"); - filename = get_scalar_argument(0, FALSE); + filename = get_scalar_argument(0, false); if (filename != NULL) { (void) force_string(filename); diff --git a/extension/rwarray.c b/extension/rwarray.c index f4f8cd58..fed040fc 100644 --- a/extension/rwarray.c +++ b/extension/rwarray.c @@ -86,8 +86,8 @@ do_writea(int nargs) lintwarn("writea: called with too many arguments"); /* directory is first arg, array to dump is second */ - file = get_scalar_argument(0, FALSE); - array = get_array_argument(1, FALSE); + file = get_scalar_argument(0, false); + array = get_array_argument(1, false); /* open the file, if error, set ERRNO and return */ (void) force_string(file); @@ -254,8 +254,8 @@ do_reada(int nargs) lintwarn("reada: called with too many arguments"); /* directory is first arg, array to dump is second */ - file = get_scalar_argument(0, FALSE); - array = get_array_argument(1, FALSE); + file = get_scalar_argument(0, false); + array = get_array_argument(1, false); (void) force_string(file); fd = open(file->stptr, O_RDONLY); diff --git a/extension/testarg.c b/extension/testarg.c index 4d012db5..32481b33 100644 --- a/extension/testarg.c +++ b/extension/testarg.c @@ -10,13 +10,13 @@ do_check_arg(int nargs) printf("arg count: defined = 3, supplied = %d\n", nargs); - arg1 = get_scalar_argument(0, FALSE); - arg2 = get_array_argument(1, FALSE); - arg3 = get_scalar_argument(2, TRUE); /* optional */ + arg1 = get_scalar_argument(0, false); + arg2 = get_array_argument(1, false); + arg3 = get_scalar_argument(2, true); /* optional */ if (nargs > 3) { /* try to use an extra arg */ NODE *arg4; - arg4 = get_array_argument(3, TRUE); + arg4 = get_array_argument(3, true); printf("Shouldn't see this line\n"); } if (arg3 != NULL) { @@ -39,22 +39,22 @@ is_blank(int c) typedef void (* Setfunc)(long, char *, long, NODE *); static long (*parse_field)(long, char **, int, NODE *, - Regexp *, Setfunc, NODE *, NODE *, int); + Regexp *, Setfunc, NODE *, NODE *, bool); static void rebuild_record(void); static long re_parse_field(long, char **, int, NODE *, - Regexp *, Setfunc, NODE *, NODE *, int); + Regexp *, Setfunc, NODE *, NODE *, bool); static long def_parse_field(long, char **, int, NODE *, - Regexp *, Setfunc, NODE *, NODE *, int); + Regexp *, Setfunc, NODE *, NODE *, bool); static long posix_def_parse_field(long, char **, int, NODE *, - Regexp *, Setfunc, NODE *, NODE *, int); + Regexp *, Setfunc, NODE *, NODE *, bool); static long null_parse_field(long, char **, int, NODE *, - Regexp *, Setfunc, NODE *, NODE *, int); + Regexp *, Setfunc, NODE *, NODE *, bool); static long sc_parse_field(long, char **, int, NODE *, - Regexp *, Setfunc, NODE *, NODE *, int); + Regexp *, Setfunc, NODE *, NODE *, bool); static long fw_parse_field(long, char **, int, NODE *, - Regexp *, Setfunc, NODE *, NODE *, int); + Regexp *, Setfunc, NODE *, NODE *, bool); static long fpat_parse_field(long, char **, int, NODE *, - Regexp *, Setfunc, NODE *, NODE *, int); + Regexp *, Setfunc, NODE *, NODE *, bool); static void set_element(long num, char * str, long len, NODE *arr); static void grow_fields_arr(long num); static void set_field(long num, char *str, long len, NODE *dummy); @@ -62,15 +62,15 @@ static void set_field(long num, char *str, long len, NODE *dummy); static char *parse_extent; /* marks where to restart parse of record */ static long parse_high_water = 0; /* field number that we have parsed so far */ static long nf_high_water = 0; /* size of fields_arr */ -static int resave_fs; +static bool resave_fs; static NODE *save_FS; /* save current value of FS when line is read, * to be used in deferred parsing */ static int *FIELDWIDTHS = NULL; NODE **fields_arr; /* array of pointers to the field nodes */ -int field0_valid; /* $(>0) has not been changed yet */ -int default_FS; /* TRUE when FS == " " */ +bool field0_valid; /* $(>0) has not been changed yet */ +int default_FS; /* true when FS == " " */ Regexp *FS_re_yes_case = NULL; Regexp *FS_re_no_case = NULL; Regexp *FS_regexp = NULL; @@ -92,7 +92,7 @@ init_fields() *Null_field = *Nnull_string; Null_field->valref = 1; Null_field->flags = (FIELD|STRCUR|STRING); - field0_valid = TRUE; + field0_valid = true; } /* grow_fields --- acquire new fields as needed */ @@ -231,7 +231,7 @@ rebuild_record() unref(fields_arr[0]); fields_arr[0] = tmp; - field0_valid = TRUE; + field0_valid = true; } /* @@ -314,12 +314,12 @@ reset_record() * $0 = $0 should resplit using the current value of FS. */ if (resave_fs) { - resave_fs = FALSE; + resave_fs = false; unref(save_FS); save_FS = dupnode(FS_node->var_value); } - field0_valid = TRUE; + field0_valid = true; } /* set_NF --- handle what happens to $0 and fields when NF is changed */ @@ -357,7 +357,7 @@ set_NF() } parse_high_water = NF; } - field0_valid = FALSE; + field0_valid = false; } /* @@ -376,7 +376,7 @@ re_parse_field(long up_to, /* parse only up to this field number */ Setfunc set, /* routine to set the value of the parsed field */ NODE *n, NODE *sep_arr, /* array of field separators (maybe NULL) */ - int in_middle) + bool in_middle) { char *scan = *buf; long nf = parse_high_water; @@ -470,7 +470,7 @@ def_parse_field(long up_to, /* parse only up to this field number */ Setfunc set, /* routine to set the value of the parsed field */ NODE *n, NODE *sep_arr, /* array of field separators (maybe NULL) */ - int in_middle ATTRIBUTE_UNUSED) + bool in_middle ATTRIBUTE_UNUSED) { char *scan = *buf; long nf = parse_high_water; @@ -551,7 +551,7 @@ posix_def_parse_field(long up_to, /* parse only up to this field number */ Setfunc set, /* routine to set the value of the parsed field */ NODE *n, NODE *dummy ATTRIBUTE_UNUSED, /* sep_arr not needed here: hence dummy */ - int in_middle ATTRIBUTE_UNUSED) + bool in_middle ATTRIBUTE_UNUSED) { char *scan = *buf; long nf = parse_high_water; @@ -617,7 +617,7 @@ null_parse_field(long up_to, /* parse only up to this field number */ Setfunc set, /* routine to set the value of the parsed field */ NODE *n, NODE *sep_arr, /* array of field separators (maybe NULL) */ - int in_middle ATTRIBUTE_UNUSED) + bool in_middle ATTRIBUTE_UNUSED) { char *scan = *buf; long nf = parse_high_water; @@ -672,7 +672,7 @@ sc_parse_field(long up_to, /* parse only up to this field number */ Setfunc set, /* routine to set the value of the parsed field */ NODE *n, NODE *sep_arr, /* array of field separators (maybe NULL) */ - int in_middle ATTRIBUTE_UNUSED) + bool in_middle ATTRIBUTE_UNUSED) { char *scan = *buf; char fschar; @@ -753,7 +753,7 @@ fw_parse_field(long up_to, /* parse only up to this field number */ Setfunc set, /* routine to set the value of the parsed field */ NODE *n, NODE *dummy ATTRIBUTE_UNUSED, /* sep_arr not needed here: hence dummy */ - int in_middle ATTRIBUTE_UNUSED) + bool in_middle ATTRIBUTE_UNUSED) { char *scan = *buf; long nf = parse_high_water; @@ -819,7 +819,7 @@ fw_parse_field(long up_to, /* parse only up to this field number */ void invalidate_field0() { - field0_valid = FALSE; + field0_valid = false; } /* get_field --- return a particular $n */ @@ -829,7 +829,7 @@ invalidate_field0() NODE ** get_field(long requested, Func_ptr *assign) { - int in_middle = FALSE; + bool in_middle = false; /* * if requesting whole line but some other field has been altered, * then the whole line must be rebuilt @@ -858,7 +858,7 @@ get_field(long requested, Func_ptr *assign) #if 0 if (assign != NULL) - field0_valid = FALSE; /* $0 needs reconstruction */ + field0_valid = false; /* $0 needs reconstruction */ #else /* * Keep things uniform. Also, mere intention of assigning something @@ -883,7 +883,7 @@ get_field(long requested, Func_ptr *assign) if (parse_high_water == 0) /* starting at the beginning */ parse_extent = fields_arr[0]->stptr; else - in_middle = TRUE; + in_middle = true; parse_high_water = (*parse_field)(requested, &parse_extent, fields_arr[0]->stlen - (parse_extent - fields_arr[0]->stptr), save_FS, NULL, set_field, (NODE *) NULL, (NODE *) NULL, in_middle); @@ -952,11 +952,11 @@ do_split(int nargs) NODE *src, *arr, *sep, *fs, *tmp, *sep_arr = NULL; char *s; long (*parseit)(long, char **, int, NODE *, - Regexp *, Setfunc, NODE *, NODE *, int); + Regexp *, Setfunc, NODE *, NODE *, bool); Regexp *rp = NULL; if (nargs == 4) { - static short warned1 = FALSE, warned2 = FALSE; + static bool warned1 = false, warned2 = false; if (do_traditional || do_posix) { fatal(_("split: fourth argument is a gawk extension")); @@ -965,11 +965,11 @@ do_split(int nargs) if (sep_arr->type != Node_var_array) fatal(_("split: fourth argument is not an array")); if (do_lint && ! warned1) { - warned1 = TRUE; + warned1 = true; lintwarn(_("split: fourth argument is a gawk extension")); } if (do_lint_old && ! warned2) { - warned2 = TRUE; + warned2 = true; warning(_("split: fourth argument is a gawk extension")); } } @@ -1012,12 +1012,12 @@ do_split(int nargs) fs = sep->re_exp; if (fs->stlen == 0) { - static short warned = FALSE; + static bool warned = false; parseit = null_parse_field; if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("split: null string for third arg is a gawk extension")); } } else if (fs->stlen == 1 && (sep->re_flags & CONSTANT) == 0) { @@ -1036,7 +1036,7 @@ do_split(int nargs) s = src->stptr; tmp = make_number((AWKNUM) (*parseit)(UNLIMITED, &s, (int) src->stlen, - fs, rp, set_element, arr, sep_arr, FALSE)); + fs, rp, set_element, arr, sep_arr, false)); src = POP_SCALAR(); /* really pop off stack */ DEREF(src); @@ -1096,7 +1096,7 @@ do_patsplit(int nargs) s = src->stptr; tmp = make_number((AWKNUM) fpat_parse_field(UNLIMITED, &s, (int) src->stlen, fpat, rp, - set_element, arr, sep_arr, FALSE)); + set_element, arr, sep_arr, false)); } src = POP_SCALAR(); /* really pop off stack */ @@ -1113,12 +1113,12 @@ set_FIELDWIDTHS() char *end; int i; static int fw_alloc = 4; - static short warned = FALSE; - int fatal_error = FALSE; + static bool warned = false; + bool fatal_error = false; NODE *tmp; if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("`FIELDWIDTHS' is a gawk extension")); } if (do_traditional) /* quick and dirty, does the trick */ @@ -1152,7 +1152,7 @@ set_FIELDWIDTHS() ++scan; } if (*scan == '-') { - fatal_error = TRUE; + fatal_error = true; break; } if (*scan == '\0') @@ -1167,7 +1167,7 @@ set_FIELDWIDTHS() || (*end != '\0' && ! is_blank(*end)) || !(0 < tmp && tmp <= INT_MAX) ) { - fatal_error = TRUE; + fatal_error = true; break; } FIELDWIDTHS[i] = tmp; @@ -1196,7 +1196,7 @@ set_FS() NODE *fs; static NODE *save_fs = NULL; static NODE *save_rs = NULL; - int remake_re = TRUE; + bool remake_re = true; /* * If changing the way fields are split, obey least-surprise @@ -1223,7 +1223,7 @@ set_FS() if (current_field_sep() == Using_FS) { return; } else { - remake_re = FALSE; + remake_re = false; goto choose_fs_function; } } @@ -1232,7 +1232,7 @@ set_FS() save_fs = dupnode(FS_node->var_value); unref(save_rs); save_rs = dupnode(RS_node->var_value); - resave_fs = TRUE; + resave_fs = true; /* If FS_re_no_case assignment is fatal (make_regexp in remake_re) * FS_regexp will be NULL with a non-null FS_re_yes_case. @@ -1246,16 +1246,16 @@ set_FS() choose_fs_function: buf[0] = '\0'; - default_FS = FALSE; + default_FS = false; fs = force_string(FS_node->var_value); if (! do_traditional && fs->stlen == 0) { - static short warned = FALSE; + static bool warned = false; parse_field = null_parse_field; if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("null string for `FS' is a gawk extension")); } } else if (fs->stlen > 1) { @@ -1267,7 +1267,7 @@ choose_fs_function: parse_field = sc_parse_field; if (fs->stlen == 1) { if (fs->stptr[0] == ' ') { - default_FS = TRUE; + default_FS = true; strcpy(buf, "[ \t\n]+"); } else if (fs->stptr[0] == '\\') { /* yet another special case */ @@ -1283,7 +1283,7 @@ choose_fs_function: if (fs->stlen == 1) { if (fs->stptr[0] == ' ') - default_FS = TRUE; + default_FS = true; else if (fs->stptr[0] == '\\') /* same special case */ strcpy(buf, "[\\\\]"); @@ -1297,13 +1297,13 @@ choose_fs_function: FS_re_yes_case = FS_re_no_case = FS_regexp = NULL; if (buf[0] != '\0') { - FS_re_yes_case = make_regexp(buf, strlen(buf), FALSE, TRUE, TRUE); - FS_re_no_case = make_regexp(buf, strlen(buf), TRUE, TRUE, TRUE); + FS_re_yes_case = make_regexp(buf, strlen(buf), false, true, true); + FS_re_no_case = make_regexp(buf, strlen(buf), true, true, true); FS_regexp = (IGNORECASE ? FS_re_no_case : FS_re_yes_case); parse_field = re_parse_field; } else if (parse_field == re_parse_field) { - FS_re_yes_case = make_regexp(fs->stptr, fs->stlen, FALSE, TRUE, TRUE); - FS_re_no_case = make_regexp(fs->stptr, fs->stlen, TRUE, TRUE, TRUE); + FS_re_yes_case = make_regexp(fs->stptr, fs->stlen, false, true, true); + FS_re_no_case = make_regexp(fs->stptr, fs->stlen, true, true, true); FS_regexp = (IGNORECASE ? FS_re_no_case : FS_re_yes_case); } else FS_re_yes_case = FS_re_no_case = FS_regexp = NULL; @@ -1372,13 +1372,13 @@ update_PROCINFO_num(const char *subscript, AWKNUM val) void set_FPAT() { - static short warned = FALSE; + static bool warned = false; static NODE *save_fpat = NULL; - int remake_re = TRUE; + bool remake_re = true; NODE *fpat; if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("`FPAT' is a gawk extension")); } if (do_traditional) /* quick and dirty, does the trick */ @@ -1406,7 +1406,7 @@ set_FPAT() if (current_field_sep() == Using_FPAT) { return; } else { - remake_re = FALSE; + remake_re = false; goto set_fpat_function; } } @@ -1426,8 +1426,8 @@ set_fpat_function: refree(FPAT_re_no_case); FPAT_re_yes_case = FPAT_re_no_case = FPAT_regexp = NULL; - FPAT_re_yes_case = make_regexp(fpat->stptr, fpat->stlen, FALSE, TRUE, TRUE); - FPAT_re_no_case = make_regexp(fpat->stptr, fpat->stlen, TRUE, TRUE, TRUE); + FPAT_re_yes_case = make_regexp(fpat->stptr, fpat->stlen, false, true, true); + FPAT_re_no_case = make_regexp(fpat->stptr, fpat->stlen, true, true, true); FPAT_regexp = (IGNORECASE ? FPAT_re_no_case : FPAT_re_yes_case); } @@ -1484,8 +1484,8 @@ incr_scan(char **scanp, size_t len, mbstate_t *mbs) * by gsub. * * BEGIN { - * FALSE = 0 - * TRUE = 1 + * false = 0 + * true = 1 * * fpat[1] = "([^,]*)|(\"[^\"]+\")" * fpat[2] = fpat[1] @@ -1518,11 +1518,11 @@ incr_scan(char **scanp, size_t len, mbstate_t *mbs) * if (length(string) == 0) * return 0 * - * eosflag = non_empty = FALSE + * eosflag = non_empty = false * nf = 0 * while (match(string, pattern)) { * if (RLENGTH > 0) { # easy case - * non_empty = TRUE + * non_empty = true * if (! (nf in seps)) { * if (RSTART == 1) # match at front of string * seps[nf] = "" @@ -1537,7 +1537,7 @@ incr_scan(char **scanp, size_t len, mbstate_t *mbs) * # last match was non-empty, and at the * # current character we get a zero length match, * # which we don't want, so skip over it - * non_empty = FALSE + * non_empty = false * seps[nf] = substr(string, 1, 1) * string = substr(string, 2) * } else { @@ -1557,13 +1557,13 @@ incr_scan(char **scanp, size_t len, mbstate_t *mbs) * } else { * string = substr(string, RSTART + 1) * } - * non_empty = FALSE + * non_empty = false * } * if (length(string) == 0) { * if (eosflag) * break * else - * eosflag = TRUE + * eosflag = true * } * } * if (length(string) > 0) @@ -1581,16 +1581,16 @@ fpat_parse_field(long up_to, /* parse only up to this field number */ Setfunc set, /* routine to set the value of the parsed field */ NODE *n, NODE *sep_arr, /* array of field separators (may be NULL) */ - int in_middle) + bool in_middle) { char *scan = *buf; long nf = parse_high_water; char *start; char *end = scan + len; int regex_flags = RE_NEED_START; - int need_to_set_sep; - int non_empty; - int eosflag; + bool need_to_set_sep; + bool non_empty; + bool eosflag; #if MBS_SUPPORT mbstate_t mbs; @@ -1611,16 +1611,16 @@ fpat_parse_field(long up_to, /* parse only up to this field number */ regex_flags |= RE_NO_BOL; non_empty = rp->non_empty; } else - non_empty = FALSE; + non_empty = false; - eosflag = FALSE; - need_to_set_sep = TRUE; + eosflag = false; + need_to_set_sep = true; start = scan; while (research(rp, scan, 0, (end - scan), regex_flags) != -1 && nf < up_to) { if (REEND(rp, scan) > RESTART(rp, scan)) { /* if (RLENGTH > 0) */ - non_empty = TRUE; + non_empty = true; if (sep_arr != NULL && need_to_set_sep) { if (RESTART(rp, scan) == 0) /* match at front */ set_element(nf, start, 0L, sep_arr); @@ -1639,16 +1639,16 @@ fpat_parse_field(long up_to, /* parse only up to this field number */ scan += REEND(rp, scan); if (scan >= end) break; - need_to_set_sep = TRUE; + need_to_set_sep = true; } else if (non_empty) { /* else if non_empty */ /* * last match was non-empty, and at the * current character we get a zero length match, * which we don't want, so skip over it */ - non_empty = FALSE; + non_empty = false; if (sep_arr != NULL) { - need_to_set_sep = FALSE; + need_to_set_sep = false; set_element(nf, start, 1L, sep_arr); } increment_scan(& scan, end - scan); @@ -1662,12 +1662,12 @@ fpat_parse_field(long up_to, /* parse only up to this field number */ (long) RESTART(rp, scan), sep_arr); } - need_to_set_sep = TRUE; + need_to_set_sep = true; (*set)(++nf, scan, 0L, n); if (! non_empty && ! eosflag) { /* prev was empty */ if (sep_arr != NULL) { set_element(nf, start, 1L, sep_arr); - need_to_set_sep = FALSE; + need_to_set_sep = false; } } if (RESTART(rp, scan) == 0) @@ -1675,13 +1675,13 @@ fpat_parse_field(long up_to, /* parse only up to this field number */ else { scan += RESTART(rp, scan); } - non_empty = FALSE; + non_empty = false; } if (scan >= end) { /* length(string) == 0 */ if (eosflag) break; else - eosflag = TRUE; + eosflag = true; } start = scan; diff --git a/int_array.c b/int_array.c index 0fa37642..4e1ff2b1 100644 --- a/int_array.c +++ b/int_array.c @@ -94,10 +94,10 @@ is_integer(NODE *symbol, NODE *subs) return NULL; } - /* a[3]=1; print "3" in a -- TRUE - * a[3]=1; print "+3" in a -- FALSE - * a[3]=1; print "03" in a -- FALSE - * a[-3]=1; print "-3" in a -- TRUE + /* a[3]=1; print "3" in a -- true + * a[3]=1; print "+3" in a -- false + * a[3]=1; print "03" in a -- false + * a[-3]=1; print "-3" in a -- true */ if ((subs->flags & (STRING|STRCUR)) != 0) { diff --git a/interpret.h b/interpret.h index 009e6e10..3ff5e929 100644 --- a/interpret.h +++ b/interpret.h @@ -39,12 +39,12 @@ r_interpret(INSTRUCTION *code) Regexp *rp; /* array subscript */ -#define mk_sub(n) (n == 1 ? POP_SCALAR() : concat_exp(n, TRUE)) +#define mk_sub(n) (n == 1 ? POP_SCALAR() : concat_exp(n, true)) #ifdef EXEC_HOOK -#define JUMPTO(x) do { if (post_execute) post_execute(pc); pc = (x); goto top; } while (FALSE) +#define JUMPTO(x) do { if (post_execute) post_execute(pc); pc = (x); goto top; } while (false) #else -#define JUMPTO(x) do { pc = (x); goto top; } while (FALSE) +#define JUMPTO(x) do { pc = (x); goto top; } while (false) #endif pc = code; @@ -79,12 +79,12 @@ top: case Op_atexit: { - int stdio_problem = FALSE; + bool stdio_problem = false; /* avoid false source indications */ source = NULL; sourceline = 0; - (void) nextfile(& curfile, TRUE); /* close input data file */ + (void) nextfile(& curfile, true); /* close input data file */ /* * This used to be: * @@ -129,11 +129,11 @@ top: case Op_push_arg: { NODE *save_symbol; - int isparam = FALSE; + bool isparam = false; save_symbol = m = pc->memory; if (m->type == Node_param_list) { - isparam = TRUE; + isparam = true; save_symbol = m = GET_PARAM(m->param_cnt); if (m->type == Node_array_ref) m = m->orig_array; @@ -262,7 +262,7 @@ top: case Op_field_spec: t1 = TOP_SCALAR(); - lhs = r_get_field(t1, (Func_ptr *) 0, TRUE); + lhs = r_get_field(t1, (Func_ptr *) 0, true); decr_sp(); DEREF(t1); r = dupnode(*lhs); /* can't use UPREF here */ @@ -522,7 +522,7 @@ mod: /* array[sub] assignment optimization, * see awkgram.y (optimize_assignment) */ - t1 = get_array(pc->memory, TRUE); /* array */ + t1 = get_array(pc->memory, true); /* array */ t2 = mk_sub(pc->expr_count); /* subscript */ lhs = assoc_lookup(t1, t2); if ((*lhs)->type == Node_var_array) { @@ -540,7 +540,7 @@ mod: * see awkgram.y (optimize_assignment) */ - lhs = get_lhs(pc->memory, FALSE); + lhs = get_lhs(pc->memory, false); unref(*lhs); r = pc->initval; /* constant initializer */ if (r == NULL) @@ -559,7 +559,7 @@ mod: Func_ptr assign; t1 = TOP_SCALAR(); - lhs = r_get_field(t1, & assign, FALSE); + lhs = r_get_field(t1, & assign, false); decr_sp(); DEREF(t1); unref(*lhs); @@ -571,7 +571,7 @@ mod: case Op_assign_concat: /* x = x ... string concatenation optimization */ - lhs = get_lhs(pc->memory, FALSE); + lhs = get_lhs(pc->memory, false); t1 = force_string(*lhs); t2 = POP_STRING(); @@ -766,7 +766,7 @@ arrayfor: } t1 = r->for_list[r->cur_idx]; - lhs = get_lhs(pc->array_var, FALSE); + lhs = get_lhs(pc->array_var, false); unref(*lhs); *lhs = dupnode(t1); break; @@ -943,7 +943,7 @@ match_re: case Op_K_getline_redir: if ((currule == BEGINFILE || currule == ENDFILE) - && pc->into_var == FALSE + && pc->into_var == false && pc->redir_type == redirect_input) fatal(_("`getline' invalid inside `%s' rule"), ruletab[currule]); r = do_getline_redir(pc->into_var, pc->redir_type); @@ -957,7 +957,7 @@ match_re: do { int ret; - ret = nextfile(& curfile, FALSE); + ret = nextfile(& curfile, false); if (ret <= 0) r = do_getline(pc->into_var, curfile); else { @@ -1003,7 +1003,7 @@ match_re: { int ret; - ret = nextfile(& curfile, FALSE); + ret = nextfile(& curfile, false); if (ret < 0) /* end of input */ JUMPTO(pc->target_jmp); /* end block or Op_atexit */ @@ -1058,7 +1058,7 @@ match_re: fatal(_("`nextfile' cannot be called from a `%s' rule"), ruletab[currule]); - ret = nextfile(& curfile, TRUE); /* skip current file */ + ret = nextfile(& curfile, true); /* skip current file */ if (currule == BEGINFILE) { long stack_size; @@ -1104,7 +1104,7 @@ match_re: if (! currule) fatal(_("`exit' cannot be called in the current context")); - exiting = TRUE; + exiting = true; t1 = POP_NUMBER(); exit_val = (int) get_number_si(t1); DEREF(t1); @@ -1171,9 +1171,9 @@ match_re: ip = pc->line_range; /* Op_line_range */ if (! ip->triggered && di) { - /* not already triggered and left expression is TRUE */ + /* not already triggered and left expression is true */ decr_sp(); - ip->triggered = TRUE; + ip->triggered = true; JUMPTO(ip->target_jmp); /* evaluate right expression */ } @@ -198,12 +198,12 @@ struct recmatch { static int iop_close(IOBUF *iop); struct redirect *redirect(NODE *redir_exp, int redirtype, int *errflg); static void close_one(void); -static int close_redir(struct redirect *rp, int exitwarn, two_way_close_type how); +static int close_redir(struct redirect *rp, bool exitwarn, two_way_close_type how); #ifndef PIPES_SIMULATED static int wait_any(int interesting); #endif static IOBUF *gawk_popen(const char *cmd, struct redirect *rp); -static IOBUF *iop_alloc(int fd, const char *name, IOBUF *buf, int do_openhooks); +static IOBUF *iop_alloc(int fd, const char *name, IOBUF *buf, bool do_openhooks); static int gawk_pclose(struct redirect *rp); static int str2mode(const char *mode); static int two_way_open(const char *str, struct redirect *rp); @@ -225,7 +225,7 @@ static NODE *in_PROCINFO(const char *pidx1, const char *pidx2, NODE **full_idx); static long get_read_timeout(IOBUF *iop); static ssize_t read_with_timeout(int fd, char *buf, size_t size); -static int read_can_timeout = FALSE; +static bool read_can_timeout = false; static long read_timeout; static long read_default_timeout; @@ -235,7 +235,7 @@ static Regexp *RS_re_yes_case; /* regexp for RS when ignoring case */ static Regexp *RS_re_no_case; /* regexp for RS when not ignoring case */ static Regexp *RS_regexp; -int RS_is_null; +bool RS_is_null; extern NODE *ARGC_node; extern NODE *ARGV_node; @@ -258,7 +258,7 @@ init_io() tmout = getenv_long("GAWK_READ_TIMEOUT"); if (tmout > 0) { read_default_timeout = tmout; - read_can_timeout = TRUE; + read_can_timeout = true; } /* @@ -266,7 +266,7 @@ init_io() * We can't be any more specific than this. */ if (PROCINFO_node != NULL) - read_can_timeout = TRUE; + read_can_timeout = true; } @@ -342,10 +342,10 @@ after_beginfile(IOBUF **curfile) /* nextfile --- move to the next input data file */ int -nextfile(IOBUF **curfile, int skipping) +nextfile(IOBUF **curfile, bool skipping) { static long i = 1; - static int files = FALSE; + static bool files = false; NODE *arg, *tmp; static IOBUF mybuf; const char *fname; @@ -390,8 +390,8 @@ nextfile(IOBUF **curfile, int skipping) ARGIND_node->var_value = make_number((AWKNUM) i); } - if (! arg_assign(arg->stptr, FALSE)) { - files = TRUE; + if (! arg_assign(arg->stptr, false)) { + files = true; fname = arg->stptr; errno = 0; fd = devopen(fname, binmode("r")); @@ -406,7 +406,7 @@ nextfile(IOBUF **curfile, int skipping) mpz_set_ui(MFNR, 0); #endif FNR = 0; - iop = *curfile = iop_alloc(fd, fname, & mybuf, FALSE); + iop = *curfile = iop_alloc(fd, fname, & mybuf, false); if (fd == INVALID_HANDLE) iop->errcode = errcode; else @@ -416,8 +416,8 @@ nextfile(IOBUF **curfile, int skipping) } } - if (files == FALSE) { - files = TRUE; + if (files == false) { + files = true; /* no args. -- use stdin */ /* FNR is init'ed to 0 */ errno = 0; @@ -427,7 +427,7 @@ nextfile(IOBUF **curfile, int skipping) FILENAME_node->var_value = make_string("-", 1); FILENAME_node->var_value->flags |= MAYBE_NUM; /* be pedantic */ fname = "-"; - iop = *curfile = iop_alloc(fileno(stdin), fname, & mybuf, FALSE); + iop = *curfile = iop_alloc(fileno(stdin), fname, & mybuf, false); iop->flag |= IOP_NOFREE_OBJ; if (iop->fd == INVALID_HANDLE) { @@ -636,7 +636,7 @@ redirect(NODE *redir_exp, int redirtype, int *errflg) const char *mode; int fd; const char *what = NULL; - int new_rp = FALSE; + bool new_rp = false; int len; /* used with /inet */ static struct redirect *save_rp = NULL; /* hold onto rp that should * be freed for reuse @@ -739,7 +739,7 @@ redirect(NODE *redir_exp, int redirtype, int *errflg) } if (rp == NULL) { - new_rp = TRUE; + new_rp = true; if (save_rp != NULL) { rp = save_rp; efree(rp->value); @@ -805,7 +805,7 @@ redirect(NODE *redir_exp, int redirtype, int *errflg) /* do not free rp, saving it for reuse (save_rp = rp) */ return NULL; } - rp->iop = iop_alloc(fd, str, NULL, TRUE); + rp->iop = iop_alloc(fd, str, NULL, true); break; case redirect_twoway: direction = "to/from"; @@ -948,10 +948,10 @@ close_one() struct redirect *rp; struct redirect *rplast = NULL; - static short warned = FALSE; + static bool warned = false; if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("reached system limit for open files: starting to multiplex file descriptors")); } @@ -1029,7 +1029,7 @@ do_close(int nargs) } DEREF(tmp); fflush(stdout); /* synchronize regular output */ - tmp = make_number((AWKNUM) close_redir(rp, FALSE, how)); + tmp = make_number((AWKNUM) close_redir(rp, false, how)); rp = NULL; /* * POSIX says close() returns 0 on success, non-zero otherwise. @@ -1107,7 +1107,7 @@ close_rp(struct redirect *rp, two_way_close_type how) /* close_redir --- close an open file or pipe */ static int -close_redir(struct redirect *rp, int exitwarn, two_way_close_type how) +close_redir(struct redirect *rp, bool exitwarn, two_way_close_type how) { int status = 0; @@ -1225,7 +1225,7 @@ flush_io() /* close_io --- close all open files, called when exiting */ int -close_io(int *stdio_problem) +close_io(bool *stdio_problem) { struct redirect *rp; struct redirect *next; @@ -1247,16 +1247,16 @@ close_io(int *stdio_problem) * on stdout and stderr. Since we don't really need to close * them, we just flush them, and do that across the board. */ - *stdio_problem = FALSE; + *stdio_problem = false; if (fflush(stdout)) { warning(_("error writing standard output (%s)"), strerror(errno)); status++; - *stdio_problem = TRUE; + *stdio_problem = true; } if (fflush(stderr)) { warning(_("error writing standard error (%s)"), strerror(errno)); status++; - *stdio_problem = TRUE; + *stdio_problem = true; } return status; } @@ -1551,7 +1551,7 @@ devopen(const char *name, const char *mode) { #define DEFAULT_RETRIES 20 static unsigned long def_retries = DEFAULT_RETRIES; - static int first_time = TRUE; + static bool first_time = true; unsigned long retries = 0; static long msleep = 1000; @@ -1560,7 +1560,7 @@ devopen(const char *name, const char *mode) unsigned long count = 0; char *ms2; - first_time = FALSE; + first_time = false; if ((cp = getenv("GAWK_SOCK_RETRIES")) != NULL) { count = strtoul(cp, & end, 10); if (end != cp && count > 0) @@ -1630,7 +1630,7 @@ strictopen: static int two_way_open(const char *str, struct redirect *rp) { - static int no_ptys = FALSE; + static bool no_ptys = false; #ifdef HAVE_SOCKETS /* case 1: socket */ @@ -1639,34 +1639,34 @@ two_way_open(const char *str, struct redirect *rp) fd = devopen(str, "rw"); if (fd == INVALID_HANDLE) - return FALSE; + return false; rp->fp = fdopen(fd, "w"); if (rp->fp == NULL) { close(fd); - return FALSE; + return false; } newfd = dup(fd); if (newfd < 0) { fclose(rp->fp); - return FALSE; + return false; } os_close_on_exec(fd, str, "socket", "to/from"); os_close_on_exec(newfd, str, "socket", "to/from"); - rp->iop = iop_alloc(newfd, str, NULL, TRUE); + rp->iop = iop_alloc(newfd, str, NULL, true); if (rp->iop == NULL) { close(newfd); fclose(rp->fp); - return FALSE; + return false; } rp->flag |= RED_SOCKET; - return TRUE; + return true; } #endif /* HAVE_SOCKETS */ #if defined(HAVE_TERMIOS_H) && ! defined(ZOS_USS) /* case 2: use ptys for two-way communications to child */ if (! no_ptys && pty_vs_pipe(str)) { - static int initialized = FALSE; + static bool initialized = false; static char first_pty_letter; #ifdef HAVE_GRANTPT static int have_dev_ptmx; @@ -1684,7 +1684,7 @@ two_way_open(const char *str, struct redirect *rp) int i; if (! initialized) { - initialized = TRUE; + initialized = true; #ifdef HAVE_GRANTPT have_dev_ptmx = (stat("/dev/ptmx", & statb) >= 0); #endif @@ -1733,7 +1733,7 @@ two_way_open(const char *str, struct redirect *rp) for (i = 0; i < 16; i++) { sprintf(slavenam, "/dev/pty%c%x", c, i); if (stat(slavenam, & statb) < 0) { - no_ptys = TRUE; /* bypass all this next time */ + no_ptys = true; /* bypass all this next time */ goto use_pipes; } @@ -1753,7 +1753,7 @@ two_way_open(const char *str, struct redirect *rp) c = *cp; } while (c != first_pty_letter); } else - no_ptys = TRUE; + no_ptys = true; /* Couldn't find a pty. Fall back to using pipes. */ goto use_pipes; @@ -1836,7 +1836,7 @@ two_way_open(const char *str, struct redirect *rp) save_errno = errno; close(master); errno = save_errno; - return FALSE; + return false; } @@ -1848,11 +1848,11 @@ two_way_open(const char *str, struct redirect *rp) } rp->pid = pid; - rp->iop = iop_alloc(master, str, NULL, TRUE); + rp->iop = iop_alloc(master, str, NULL, true); if (rp->iop == NULL) { (void) close(master); (void) kill(pid, SIGKILL); - return FALSE; + return false; } /* @@ -1867,13 +1867,13 @@ two_way_open(const char *str, struct redirect *rp) (void) kill(pid, SIGKILL); if (dup_master > 0) (void) close(dup_master); - return FALSE; + return false; } rp->flag |= RED_PTY; os_close_on_exec(master, str, "pipe", "from"); os_close_on_exec(dup_master, str, "pipe", "to"); first_pty_letter = '\0'; /* reset for next command */ - return TRUE; + return true; } #endif /* defined(HAVE_TERMIOS_H) && ! defined(ZOS_USS) */ @@ -1889,14 +1889,14 @@ use_pipes: #endif if (pipe(ptoc) < 0) - return FALSE; /* errno set, diagnostic from caller */ + return false; /* errno set, diagnostic from caller */ if (pipe(ctop) < 0) { save_errno = errno; close(ptoc[0]); close(ptoc[1]); errno = save_errno; - return FALSE; + return false; } #ifdef __EMX__ @@ -1913,7 +1913,7 @@ use_pipes: close(ptoc[0]); close(ptoc[1]); close(ctop[0]); close(ctop[1]); errno = save_errno; - return FALSE; + return false; } /* connect pipes to stdin and stdout */ @@ -1967,7 +1967,7 @@ use_pipes: close(ctop[0]); errno = save_errno; - return FALSE; + return false; } #else /* NOT __EMX__ */ @@ -1976,7 +1976,7 @@ use_pipes: close(ptoc[0]); close(ptoc[1]); close(ctop[0]); close(ctop[1]); errno = save_errno; - return FALSE; + return false; } if (pid == 0) { /* child */ @@ -2001,7 +2001,7 @@ use_pipes: /* parent */ rp->pid = pid; - rp->iop = iop_alloc(ctop[0], str, NULL, TRUE); + rp->iop = iop_alloc(ctop[0], str, NULL, true); if (rp->iop == NULL) { (void) close(ctop[0]); (void) close(ctop[1]); @@ -2009,7 +2009,7 @@ use_pipes: (void) close(ptoc[1]); (void) kill(pid, SIGKILL); - return FALSE; + return false; } rp->fp = fdopen(ptoc[1], "w"); if (rp->fp == NULL) { @@ -2021,7 +2021,7 @@ use_pipes: (void) close(ptoc[1]); (void) kill(pid, SIGKILL); - return FALSE; + return false; } #ifndef __EMX__ @@ -2032,14 +2032,14 @@ use_pipes: (void) close(ctop[1]); #endif - return TRUE; + return true; } #else /*PIPES_SIMULATED*/ fatal(_("`|&' not supported")); /*NOTREACHED*/ - return FALSE; + return false; #endif } @@ -2165,7 +2165,7 @@ gawk_popen(const char *cmd, struct redirect *rp) } #endif os_close_on_exec(p[0], cmd, "pipe", "from"); - rp->iop = iop_alloc(p[0], cmd, NULL, TRUE); + rp->iop = iop_alloc(p[0], cmd, NULL, true); if (rp->iop == NULL) (void) close(p[0]); @@ -2210,7 +2210,7 @@ gawk_popen(const char *cmd, struct redirect *rp) if (current == NULL) return NULL; os_close_on_exec(fileno(current), cmd, "pipe", "from"); - rp->iop = iop_alloc(fileno(current), cmd, NULL, TRUE); + rp->iop = iop_alloc(fileno(current), cmd, NULL, true); if (rp->iop == NULL) { (void) pclose(current); current = NULL; @@ -2357,13 +2357,13 @@ typedef struct { static path_info pi_awkpath = { /* envname */ "AWKPATH", /* dfltp */ & defpath, - /* try_cwd */ TRUE, + /* try_cwd */ true, }; static path_info pi_awklibpath = { /* envname */ "AWKLIBPATH", /* dfltp */ & deflibpath, - /* try_cwd */ FALSE, + /* try_cwd */ false, }; /* init_awkpath --- split path(=$AWKPATH) into components */ @@ -2431,7 +2431,7 @@ get_cwd () size_t bsize = BSIZE; emalloc(buf, char *, bsize * sizeof(char), "get_cwd"); - while (TRUE) { + while (true) { if (getcwd(buf, bsize) == buf) return buf; if (errno != ERANGE) { @@ -2614,14 +2614,14 @@ find_open_hook(IOBUF *iop) /* iop_alloc --- allocate an IOBUF structure for an open fd */ static IOBUF * -iop_alloc(int fd, const char *name, IOBUF *iop, int do_openhooks) +iop_alloc(int fd, const char *name, IOBUF *iop, bool do_openhooks) { struct stat sbuf; - int iop_malloced = FALSE; + bool iop_malloced = false; if (iop == NULL) { emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc"); - iop_malloced = TRUE; + iop_malloced = true; } memset(iop, '\0', sizeof(IOBUF)); iop->fd = fd; @@ -3219,7 +3219,7 @@ set_RS() } unref(save_rs); save_rs = dupnode(RS_node->var_value); - RS_is_null = FALSE; + RS_is_null = false; RS = force_string(RS_node->var_value); /* * used to be if (RS_regexp != NULL) { refree(..); refree(..); ...; }. @@ -3231,20 +3231,20 @@ set_RS() RS_re_yes_case = RS_re_no_case = RS_regexp = NULL; if (RS->stlen == 0) { - RS_is_null = TRUE; + RS_is_null = true; matchrec = rsnullscan; } else if (RS->stlen > 1) { - static short warned = FALSE; + static bool warned = false; - RS_re_yes_case = make_regexp(RS->stptr, RS->stlen, FALSE, TRUE, TRUE); - RS_re_no_case = make_regexp(RS->stptr, RS->stlen, TRUE, TRUE, TRUE); + RS_re_yes_case = make_regexp(RS->stptr, RS->stlen, false, true, true); + RS_re_no_case = make_regexp(RS->stptr, RS->stlen, true, true, true); RS_regexp = (IGNORECASE ? RS_re_no_case : RS_re_yes_case); matchrec = rsrescan; if (do_lint && ! warned) { lintwarn(_("multicharacter value of `RS' is a gawk extension")); - warned = TRUE; + warned = true; } } else matchrec = rs1scan; @@ -3267,7 +3267,7 @@ pty_vs_pipe(const char *command) NODE *val; if (PROCINFO_node == NULL) - return FALSE; + return false; val = in_PROCINFO(command, "pty", NULL); if (val) { if (val->flags & MAYBE_NUM) @@ -3278,7 +3278,7 @@ pty_vs_pipe(const char *command) return (val->stlen != 0); } #endif /* HAVE_TERMIOS_H */ - return FALSE; + return false; } /* iopflags2str --- make IOP flags printable */ @@ -3312,22 +3312,22 @@ free_rp(struct redirect *rp) static int inetfile(const char *str, int *length, int *family) { - int ret = FALSE; + bool ret = false; if (strncmp(str, "/inet/", 6) == 0) { - ret = TRUE; + ret = true; if (length != NULL) *length = 6; if (family != NULL) *family = AF_UNSPEC; } else if (strncmp(str, "/inet4/", 7) == 0) { - ret = TRUE; + ret = true; if (length != NULL) *length = 7; if (family != NULL) *family = AF_INET; } else if (strncmp(str, "/inet6/", 7) == 0) { - ret = TRUE; + ret = true; if (length != NULL) *length = 7; if (family != NULL) @@ -130,23 +130,23 @@ struct pre_assign { static struct pre_assign *preassigns = NULL; /* requested via -v or -F */ static long numassigns = -1; /* how many of them */ -static int disallow_var_assigns = FALSE; /* true for --exec */ +static bool disallow_var_assigns = false; /* true for --exec */ static void add_preassign(enum assign_type type, char *val); -int do_flags = FALSE; -int do_optimize = TRUE; /* apply default optimizations */ -static int do_nostalgia = FALSE; /* provide a blast from the past */ -static int do_binary = FALSE; /* hands off my data! */ +int do_flags = false; +bool do_optimize = true; /* apply default optimizations */ +static int do_nostalgia = false; /* provide a blast from the past */ +static int do_binary = false; /* hands off my data! */ -int use_lc_numeric = FALSE; /* obey locale for decimal point */ +int use_lc_numeric = false; /* obey locale for decimal point */ #if MBS_SUPPORT int gawk_mb_cur_max; /* MB_CUR_MAX value, see comment in main() */ #endif FILE *output_fp; /* default gawk output, can be redirected in the debugger */ -int output_is_tty = FALSE; /* control flushing of output */ +bool output_is_tty = false; /* control flushing of output */ /* default format for strftime(), available via PROCINFO */ const char def_strftime_format[] = "%a %b %e %H:%M:%S %Z %Y"; @@ -203,13 +203,13 @@ main(int argc, char **argv) * The + on the front tells GNU getopt not to rearrange argv. */ const char *optlist = "+F:f:v:W;m:bcCd::D::e:E:gh:l:L:nNo::Op::MPrStVY"; - int stopped_early = FALSE; + bool stopped_early = false; int old_optind; int i; int c; char *scan, *src; char *extra_stack; - int have_srcfile = FALSE; + int have_srcfile = 0; SRCFILE *s; /* do these checks early */ @@ -296,7 +296,7 @@ main(int argc, char **argv) output_fp = stdout; /* we do error messages ourselves on invalid options */ - opterr = FALSE; + opterr = false; /* copy argv before getopt gets to it; used to restart the debugger */ save_argv(argc, argv); @@ -309,7 +309,7 @@ main(int argc, char **argv) (c = getopt_long(argc, argv, optlist, optab, NULL)) != EOF; optopt = 0, old_optind = optind) { if (do_posix) - opterr = TRUE; + opterr = true; switch (c) { case 'F': @@ -317,7 +317,7 @@ main(int argc, char **argv) break; case 'E': - disallow_var_assigns = TRUE; + disallow_var_assigns = true; /* fall through */ case 'f': /* @@ -358,7 +358,7 @@ main(int argc, char **argv) break; case 'b': - do_binary = TRUE; + do_binary = true; break; case 'c': @@ -428,7 +428,7 @@ main(int argc, char **argv) break; case 'N': - use_lc_numeric = TRUE; + use_lc_numeric = true; break; case 'O': @@ -510,7 +510,7 @@ main(int argc, char **argv) * won't have incremented optind. */ optind = old_optind; - stopped_early = TRUE; + stopped_early = true; goto out; } else if (optopt != '\0') { /* Use POSIX required message format */ @@ -540,7 +540,7 @@ out: } if (do_posix) { - use_lc_numeric = TRUE; + use_lc_numeric = true; if (do_traditional) /* both on command line */ warning(_("`--posix' overrides `--traditional'")); else @@ -609,7 +609,7 @@ out: /* Now process the pre-assignments */ for (i = 0; i <= numassigns; i++) { if (preassigns[i].type == PRE_ASSIGN) - (void) arg_assign(preassigns[i].val, TRUE); + (void) arg_assign(preassigns[i].val, true); else /* PRE_ASSIGN_FS */ cmdline_fs(preassigns[i].val); efree(preassigns[i].val); @@ -632,7 +632,7 @@ out: setbuf(stdout, (char *) NULL); /* make debugging easier */ #endif if (os_isatty(fileno(stdout))) - output_is_tty = TRUE; + output_is_tty = true; /* load extension libs */ for (s = srcfiles->next; s != srcfiles; s = s->next) { @@ -938,42 +938,42 @@ struct varinit { AWKNUM numval; Func_ptr update; Func_ptr assign; - int do_assign; + bool do_assign; int flags; #define NO_INSTALL 0x01 #define NON_STANDARD 0x02 }; static const struct varinit varinit[] = { -{NULL, "ARGC", NULL, 0, NULL, NULL, FALSE, NO_INSTALL }, -{&ARGIND_node, "ARGIND", NULL, 0, NULL, NULL, FALSE, NON_STANDARD }, -{NULL, "ARGV", NULL, 0, NULL, NULL, FALSE, NO_INSTALL }, -{&BINMODE_node, "BINMODE", NULL, 0, NULL, set_BINMODE, FALSE, NON_STANDARD }, -{&CONVFMT_node, "CONVFMT", "%.6g", 0, NULL, set_CONVFMT,TRUE, 0 }, -{NULL, "ENVIRON", NULL, 0, NULL, NULL, FALSE, NO_INSTALL }, -{&ERRNO_node, "ERRNO", "", 0, NULL, NULL, FALSE, NON_STANDARD }, -{&FIELDWIDTHS_node, "FIELDWIDTHS", "", 0, NULL, set_FIELDWIDTHS, FALSE, NON_STANDARD }, -{&FILENAME_node, "FILENAME", "", 0, NULL, NULL, FALSE, 0 }, -{&FNR_node, "FNR", NULL, 0, update_FNR, set_FNR, TRUE, 0 }, -{&FS_node, "FS", " ", 0, NULL, set_FS, FALSE, 0 }, -{&FPAT_node, "FPAT", "[^[:space:]]+", 0, NULL, set_FPAT, FALSE, NON_STANDARD }, -{&IGNORECASE_node, "IGNORECASE", NULL, 0, NULL, set_IGNORECASE, FALSE, NON_STANDARD }, -{&LINT_node, "LINT", NULL, 0, NULL, set_LINT, FALSE, NON_STANDARD }, -{&PREC_node, "PREC", NULL, DEFAULT_PREC, NULL, set_PREC, FALSE, NON_STANDARD}, -{&NF_node, "NF", NULL, -1, update_NF, set_NF, FALSE, 0 }, -{&NR_node, "NR", NULL, 0, update_NR, set_NR, TRUE, 0 }, -{&OFMT_node, "OFMT", "%.6g", 0, NULL, set_OFMT, TRUE, 0 }, -{&OFS_node, "OFS", " ", 0, NULL, set_OFS, TRUE, 0 }, -{&ORS_node, "ORS", "\n", 0, NULL, set_ORS, TRUE, 0 }, -{NULL, "PROCINFO", NULL, 0, NULL, NULL, FALSE, NO_INSTALL | NON_STANDARD }, -{&RLENGTH_node, "RLENGTH", NULL, 0, NULL, NULL, FALSE, 0 }, -{&ROUNDMODE_node, "ROUNDMODE", DEFAULT_ROUNDMODE, 0, NULL, set_ROUNDMODE, FALSE, NON_STANDARD }, -{&RS_node, "RS", "\n", 0, NULL, set_RS, TRUE, 0 }, -{&RSTART_node, "RSTART", NULL, 0, NULL, NULL, FALSE, 0 }, -{&RT_node, "RT", "", 0, NULL, NULL, FALSE, NON_STANDARD }, -{&SUBSEP_node, "SUBSEP", "\034", 0, NULL, set_SUBSEP, TRUE, 0 }, -{&TEXTDOMAIN_node, "TEXTDOMAIN", "messages", 0, NULL, set_TEXTDOMAIN, TRUE, NON_STANDARD }, -{0, NULL, NULL, 0, NULL, NULL, FALSE, 0 }, +{NULL, "ARGC", NULL, 0, NULL, NULL, false, NO_INSTALL }, +{&ARGIND_node, "ARGIND", NULL, 0, NULL, NULL, false, NON_STANDARD }, +{NULL, "ARGV", NULL, 0, NULL, NULL, false, NO_INSTALL }, +{&BINMODE_node, "BINMODE", NULL, 0, NULL, set_BINMODE, false, NON_STANDARD }, +{&CONVFMT_node, "CONVFMT", "%.6g", 0, NULL, set_CONVFMT,true, 0 }, +{NULL, "ENVIRON", NULL, 0, NULL, NULL, false, NO_INSTALL }, +{&ERRNO_node, "ERRNO", "", 0, NULL, NULL, false, NON_STANDARD }, +{&FIELDWIDTHS_node, "FIELDWIDTHS", "", 0, NULL, set_FIELDWIDTHS, false, NON_STANDARD }, +{&FILENAME_node, "FILENAME", "", 0, NULL, NULL, false, 0 }, +{&FNR_node, "FNR", NULL, 0, update_FNR, set_FNR, true, 0 }, +{&FS_node, "FS", " ", 0, NULL, set_FS, false, 0 }, +{&FPAT_node, "FPAT", "[^[:space:]]+", 0, NULL, set_FPAT, false, NON_STANDARD }, +{&IGNORECASE_node, "IGNORECASE", NULL, 0, NULL, set_IGNORECASE, false, NON_STANDARD }, +{&LINT_node, "LINT", NULL, 0, NULL, set_LINT, false, NON_STANDARD }, +{&PREC_node, "PREC", NULL, DEFAULT_PREC, NULL, set_PREC, false, NON_STANDARD}, +{&NF_node, "NF", NULL, -1, update_NF, set_NF, false, 0 }, +{&NR_node, "NR", NULL, 0, update_NR, set_NR, true, 0 }, +{&OFMT_node, "OFMT", "%.6g", 0, NULL, set_OFMT, true, 0 }, +{&OFS_node, "OFS", " ", 0, NULL, set_OFS, true, 0 }, +{&ORS_node, "ORS", "\n", 0, NULL, set_ORS, true, 0 }, +{NULL, "PROCINFO", NULL, 0, NULL, NULL, false, NO_INSTALL | NON_STANDARD }, +{&RLENGTH_node, "RLENGTH", NULL, 0, NULL, NULL, false, 0 }, +{&ROUNDMODE_node, "ROUNDMODE", DEFAULT_ROUNDMODE, 0, NULL, set_ROUNDMODE, false, NON_STANDARD }, +{&RS_node, "RS", "\n", 0, NULL, set_RS, true, 0 }, +{&RSTART_node, "RSTART", NULL, 0, NULL, NULL, false, 0 }, +{&RT_node, "RT", "", 0, NULL, NULL, false, NON_STANDARD }, +{&SUBSEP_node, "SUBSEP", "\034", 0, NULL, set_SUBSEP, true, 0 }, +{&TEXTDOMAIN_node, "TEXTDOMAIN", "messages", 0, NULL, set_TEXTDOMAIN, true, NON_STANDARD }, +{0, NULL, NULL, 0, NULL, NULL, false, 0 }, }; /* init_vars --- actually initialize everything in the symbol table */ @@ -1173,13 +1173,13 @@ is_std_var(const char *var) for (vp = varinit; vp->name != NULL; vp++) { if (strcmp(vp->name, var) == 0) { if ((do_traditional || do_posix) && (vp->flags & NON_STANDARD) != 0) - return FALSE; + return false; - return TRUE; + return true; } } - return FALSE; + return false; } @@ -1205,23 +1205,23 @@ get_spec_varname(Func_ptr fptr) /* arg_assign --- process a command-line assignment */ int -arg_assign(char *arg, int initing) +arg_assign(char *arg, bool initing) { char *cp, *cp2; - int badvar; + bool badvar; NODE *var; NODE *it; NODE **lhs; long save_FNR; if (! initing && disallow_var_assigns) - return FALSE; /* --exec */ + return false; /* --exec */ cp = strchr(arg, '='); if (cp == NULL) { if (! initing) - return FALSE; /* This is file name, not assignment. */ + return false; /* This is file name, not assignment. */ fprintf(stderr, _("%s: `%s' argument to `-v' not in `var=value' form\n\n"), @@ -1238,13 +1238,13 @@ arg_assign(char *arg, int initing) FNR = 0; /* first check that the variable name has valid syntax */ - badvar = FALSE; + badvar = false; if (! isalpha((unsigned char) arg[0]) && arg[0] != '_') - badvar = TRUE; + badvar = true; else for (cp2 = arg+1; *cp2; cp2++) if (! isalnum((unsigned char) *cp2) && *cp2 != '_') { - badvar = TRUE; + badvar = true; break; } @@ -1295,7 +1295,7 @@ arg_assign(char *arg, int initing) exit(EXIT_FATAL); if (var->type == Node_var && var->var_update) var->var_update(); - lhs = get_lhs(var, FALSE); + lhs = get_lhs(var, false); unref(*lhs); *lhs = it; /* check for set_FOO() routine */ @@ -36,7 +36,7 @@ extern NODE **fmt_list; /* declared in eval.c */ mpz_t mpzval; /* GMP integer type, used as temporary in few places */ mpz_t MNR; mpz_t MFNR; -int do_ieee_fmt; /* IEEE-754 floating-point emulation */ +bool do_ieee_fmt; /* IEEE-754 floating-point emulation */ mpfr_rnd_t ROUND_MODE; static mpfr_rnd_t get_rnd_mode(const char rmode); @@ -91,7 +91,7 @@ init_mpfr(mpfr_prec_t prec, const char *rmode) mpz_init(MNR); mpz_init(MFNR); - do_ieee_fmt = FALSE; + do_ieee_fmt = false; mpz_init(_mpz1); mpz_init(_mpz2); @@ -247,14 +247,14 @@ mpg_maybe_float(const char *str, int use_locale) || ( (s[0] == 'n' || s[0] == 'N') && (s[1] == 'a' || s[1] == 'A') && (s[2] == 'n' || s[2] == 'N')))) - return TRUE; + return true; for (; *s != '\0'; s++) { if (*s == dec_point || *s == 'e' || *s == 'E') - return TRUE; + return true; } - return FALSE; + return false; } @@ -286,7 +286,7 @@ force_mpnum(NODE *n, int do_nondec, int use_locale) if (n->stlen == 0) { mpg_zero(n); - return FALSE; + return false; } cp = n->stptr; @@ -295,7 +295,7 @@ force_mpnum(NODE *n, int do_nondec, int use_locale) cp++; if (cp == cpend) { /* only spaces */ mpg_zero(n); - return FALSE; + return false; } save = *cpend; @@ -337,9 +337,9 @@ done: ptr++; *cpend = save; if (errno == 0 && ptr == cpend) - return TRUE; + return true; errno = 0; - return FALSE; + return false; } /* mpg_force_number --- force a value to be a multiple-precision number */ @@ -357,7 +357,7 @@ mpg_force_number(NODE *n) newflags = NUMBER; } - if (force_mpnum(n, (do_non_decimal_data && ! do_traditional), TRUE)) { + if (force_mpnum(n, (do_non_decimal_data && ! do_traditional), true)) { n->flags |= newflags; n->flags |= NUMCUR; } @@ -551,7 +551,7 @@ set_PREC() max_exp = ieee_fmts[i].emax; min_exp = ieee_fmts[i].emin; - do_ieee_fmt = TRUE; + do_ieee_fmt = true; } } @@ -563,7 +563,7 @@ set_PREC() warning(_("PREC value `%.*s' is invalid"), (int) val->stlen, val->stptr); prec = 0; } else - do_ieee_fmt = FALSE; + do_ieee_fmt = false; } if (prec > 0) @@ -1027,7 +1027,7 @@ do_mpfr_strtonum(int nargs) r = mpg_integer(); /* will be changed to MPFR float if necessary in force_mpnum() */ r->stptr = tmp->stptr; r->stlen = tmp->stlen; - force_mpnum(r, TRUE, use_lc_numeric); + force_mpnum(r, true, use_lc_numeric); r->stptr = NULL; r->stlen = 0; } else { @@ -1063,7 +1063,7 @@ do_mpfr_xor(int nargs) } -static int firstrand = TRUE; +static bool firstrand = true; static gmp_randstate_t state; static mpz_t seed; /* current seed */ @@ -1091,7 +1091,7 @@ do_mpfr_rand(int nargs ATTRIBUTE_UNUSED) mpz_set_ui(seed, 1); /* seed state */ gmp_randseed(state, seed); - firstrand = FALSE; + firstrand = false; } res = mpg_float(); tval = mpfr_urandomb(res->mpg_numbr, state); @@ -1122,7 +1122,7 @@ do_mpfr_srand(int nargs) mpz_init(seed); mpz_set_ui(seed, 1); /* No need to seed state, will change it below */ - firstrand = FALSE; + firstrand = false; } res = mpg_integer(); @@ -1574,11 +1574,11 @@ mod: break; default: - return TRUE; /* unhandled */ + return true; /* unhandled */ } *cp = pc->nexti; /* next instruction to execute */ - return FALSE; + return false; } @@ -33,7 +33,7 @@ static const char *srcfile = NULL; static int srcline; jmp_buf fatal_tag; -int fatal_tag_valid = FALSE; +bool fatal_tag_valid = false; /* err --- print an error message with source line and file and record */ @@ -120,7 +120,7 @@ r_force_number(NODE *n) if (do_non_decimal_data) { /* main.c assures false if do_posix */ errno = 0; - if (! do_traditional && get_numbase(cp, TRUE) != 10) { + if (! do_traditional && get_numbase(cp, true) != 10) { n->numbr = nondec2awknum(cp, cpend - cp); n->flags |= NUMCUR; ptr = cpend; @@ -564,10 +564,10 @@ parse_escape(const char **string_ptr) return i; case 'x': if (do_lint) { - static short warned = FALSE; + static bool warned = false; if (! warned) { - warned = TRUE; + warned = true; lintwarn(_("POSIX does not allow `\\x' escapes")); } } @@ -603,13 +603,13 @@ parse_escape(const char **string_ptr) return c; default: { - static short warned[256]; + static bool warned[256]; unsigned char uc = (unsigned char) c; /* N.B.: use unsigned char here to avoid Latin-1 problems */ if (! warned[uc]) { - warned[uc] = TRUE; + warned[uc] = true; warning(_("escape sequence `\\%c' treated as plain `%c'"), uc, uc); } @@ -621,7 +621,7 @@ parse_escape(const char **string_ptr) /* get_numbase --- return the base to use for the number in 's' */ int -get_numbase(const char *s, int use_locale) +get_numbase(const char *s, bool use_locale) { int dec_point = '.'; const char *str = s; @@ -672,7 +672,7 @@ str2wstr(NODE *n, size_t **ptr) char *sp; mbstate_t mbs; wchar_t wc, *wsp; - static short warned = FALSE; + static bool warned = false; assert((n->flags & (STRING|STRCUR)) != 0); @@ -755,7 +755,7 @@ str2wstr(NODE *n, size_t **ptr) memset(& mbs, 0, sizeof(mbs)); /* And warn the user something's wrong */ if (do_lint && ! warned) { - warned = TRUE; + warned = true; lintwarn(_("Invalid multibyte data detected. There may be a mismatch between your data and your locale.")); } break; @@ -936,7 +936,7 @@ is_ieee_magic_val(const char *val) static AWKNUM get_ieee_magic_val(const char *val) { - static short first = TRUE; + static bool first = true; static AWKNUM inf; static AWKNUM nan; @@ -945,7 +945,7 @@ get_ieee_magic_val(const char *val) if (val == ptr) { /* Older strtod implementations don't support inf or nan. */ if (first) { - first = FALSE; + first = false; nan = sqrt(-1.0); inf = -log(0.0); } diff --git a/posix/ChangeLog b/posix/ChangeLog index 425f1c91..bf36414f 100644 --- a/posix/ChangeLog +++ b/posix/ChangeLog @@ -1,3 +1,7 @@ +2012-05-11 Arnold D. Robbins <arnold@skeeve.com> + + * gawkmisc.c: Use `bool', `true', and `false' everywhere. + 2012-03-20 Andrew J. Schorr <aschorr@telemetry-investments.com> * gawkmisc.c (deflibpath): New global variable. diff --git a/posix/gawkmisc.c b/posix/gawkmisc.c index 270872ac..3baf852e 100644 --- a/posix/gawkmisc.c +++ b/posix/gawkmisc.c @@ -93,8 +93,8 @@ optimal_bufsize(int fd, struct stat *stb) { char *val; static size_t env_val = 0; - static short first = TRUE; - static short exact = FALSE; + static bool first = true; + static bool exact = false; /* force all members to zero in case OS doesn't use all of them. */ memset(stb, '\0', sizeof(struct stat)); @@ -104,11 +104,11 @@ optimal_bufsize(int fd, struct stat *stb) fatal("can't stat fd %d (%s)", fd, strerror(errno)); if (first) { - first = FALSE; + first = false; if ((val = getenv("AWKBUFSIZE")) != NULL) { if (strcmp(val, "exact") == 0) - exact = TRUE; + exact = true; else if (isdigit((unsigned char) *val)) { for (; *val && isdigit((unsigned char) *val); val++) env_val = (env_val * 10) + *val - '0'; @@ -25,7 +25,7 @@ #include "awk.h" -static void pprint(INSTRUCTION *startp, INSTRUCTION *endp, int in_for_header); +static void pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header); static void pp_parenthesize(NODE *n); static void parenthesize(int type, NODE *left, NODE *right); static char *pp_list(int nargs, const char *paren, const char *delim); @@ -161,7 +161,7 @@ pp_free(NODE *n) */ static void -pprint(INSTRUCTION *startp, INSTRUCTION *endp, int in_for_header) +pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header) { INSTRUCTION *pc; NODE *t1; @@ -193,7 +193,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int in_for_header) ip = pc->nexti; indent(ip->exec_count); if (ip != (pc + 1)->firsti) { /* non-empty pattern */ - pprint(ip->nexti, (pc + 1)->firsti, FALSE); + pprint(ip->nexti, (pc + 1)->firsti, false); t1 = pp_pop(); fprintf(prof_fp, "%s {", t1->pp_str); pp_free(t1); @@ -210,7 +210,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int in_for_header) ip = ip->nexti; } indent_in(); - pprint(ip, (pc + 1)->lasti, FALSE); + pprint(ip, (pc + 1)->lasti, false); indent_out(); fprintf(prof_fp, "\t}\n\n"); pc = (pc + 1)->lasti; @@ -676,8 +676,8 @@ cleanup: case Op_line_range: ip = pc + 1; - pprint(pc->nexti, ip->condpair_left, FALSE); - pprint(ip->condpair_left->nexti, ip->condpair_right, FALSE); + pprint(pc->nexti, ip->condpair_left, false); + pprint(ip->condpair_left->nexti, ip->condpair_right, false); t2 = pp_pop(); t1 = pp_pop(); str = pp_concat(t1->pp_str, ", ", t2->pp_str); @@ -691,12 +691,12 @@ cleanup: ip = pc + 1; indent(ip->while_body->exec_count); fprintf(prof_fp, "%s (", op2str(pc->opcode)); - pprint(pc->nexti, ip->while_body, FALSE); + pprint(pc->nexti, ip->while_body, false); t1 = pp_pop(); fprintf(prof_fp, "%s) {\n", t1->pp_str); pp_free(t1); indent_in(); - pprint(ip->while_body->nexti, pc->target_break, FALSE); + pprint(ip->while_body->nexti, pc->target_break, false); indent_out(); indent(SPACEOVER); fprintf(prof_fp, "}\n"); @@ -708,9 +708,9 @@ cleanup: indent(pc->nexti->exec_count); fprintf(prof_fp, "%s {\n", op2str(pc->opcode)); indent_in(); - pprint(pc->nexti->nexti, ip->doloop_cond, FALSE); + pprint(pc->nexti->nexti, ip->doloop_cond, false); indent_out(); - pprint(ip->doloop_cond, pc->target_break, FALSE); + pprint(ip->doloop_cond, pc->target_break, false); indent(SPACEOVER); t1 = pp_pop(); fprintf(prof_fp, "} %s (%s)\n", op2str(Op_K_while), t1->pp_str); @@ -722,23 +722,23 @@ cleanup: ip = pc + 1; indent(ip->forloop_body->exec_count); fprintf(prof_fp, "%s (", op2str(pc->opcode)); - pprint(pc->nexti, ip->forloop_cond, TRUE); + pprint(pc->nexti, ip->forloop_cond, true); fprintf(prof_fp, "; "); if (ip->forloop_cond->opcode == Op_no_op && ip->forloop_cond->nexti == ip->forloop_body) fprintf(prof_fp, "; "); else { - pprint(ip->forloop_cond, ip->forloop_body, TRUE); + pprint(ip->forloop_cond, ip->forloop_body, true); t1 = pp_pop(); fprintf(prof_fp, "%s; ", t1->pp_str); pp_free(t1); } - pprint(pc->target_continue, pc->target_break, TRUE); + pprint(pc->target_continue, pc->target_break, true); fprintf(prof_fp, ") {\n"); indent_in(); - pprint(ip->forloop_body->nexti, pc->target_continue, FALSE); + pprint(ip->forloop_body->nexti, pc->target_continue, false); indent_out(); indent(SPACEOVER); fprintf(prof_fp, "}\n"); @@ -763,7 +763,7 @@ cleanup: item, op2str(Op_in_array), array); indent_in(); pp_free(t1); - pprint(ip->forloop_body->nexti, pc->target_break, FALSE); + pprint(ip->forloop_body->nexti, pc->target_break, false); indent_out(); indent(SPACEOVER); fprintf(prof_fp, "}\n"); @@ -774,11 +774,11 @@ cleanup: case Op_K_switch: ip = pc + 1; fprintf(prof_fp, "%s (", op2str(pc->opcode)); - pprint(pc->nexti, ip->switch_start, FALSE); + pprint(pc->nexti, ip->switch_start, false); t1 = pp_pop(); fprintf(prof_fp, "%s) {\n", t1->pp_str); pp_free(t1); - pprint(ip->switch_start, ip->switch_end, FALSE); + pprint(ip->switch_start, ip->switch_end, false); indent(SPACEOVER); fprintf(prof_fp, "}\n"); pc = pc->target_break; @@ -794,13 +794,13 @@ cleanup: } else fprintf(prof_fp, "%s:\n", op2str(pc->opcode)); indent_in(); - pprint(pc->stmt_start->nexti, pc->stmt_end->nexti, FALSE); + pprint(pc->stmt_start->nexti, pc->stmt_end->nexti, false); indent_out(); break; case Op_K_if: fprintf(prof_fp, "%s (", op2str(pc->opcode)); - pprint(pc->nexti, pc->branch_if, FALSE); + pprint(pc->nexti, pc->branch_if, false); t1 = pp_pop(); fprintf(prof_fp, "%s) {", t1->pp_str); pp_free(t1); @@ -810,7 +810,7 @@ cleanup: fprintf(prof_fp, " # %ld", ip->exec_count); fprintf(prof_fp, "\n"); indent_in(); - pprint(ip->nexti, pc->branch_else, FALSE); + pprint(ip->nexti, pc->branch_else, false); indent_out(); pc = pc->branch_else; if (pc->nexti->opcode == Op_no_op) { @@ -822,7 +822,7 @@ cleanup: case Op_K_else: fprintf(prof_fp, "} %s {\n", op2str(pc->opcode)); indent_in(); - pprint(pc->nexti, pc->branch_end, FALSE); + pprint(pc->nexti, pc->branch_end, false); indent_out(); indent(SPACEOVER); fprintf(prof_fp, "}\n"); @@ -834,14 +834,14 @@ cleanup: NODE *f, *t, *cond; size_t len; - pprint(pc->nexti, pc->branch_if, FALSE); + pprint(pc->nexti, pc->branch_if, false); ip = pc->branch_if; - pprint(ip->nexti, pc->branch_else, FALSE); + pprint(ip->nexti, pc->branch_else, false); ip = pc->branch_else->nexti; pc = ip->nexti; assert(pc->opcode == Op_cond_exp); - pprint(pc->nexti, pc->branch_end, FALSE); + pprint(pc->nexti, pc->branch_end, false); f = pp_pop(); t = pp_pop(); @@ -882,7 +882,7 @@ cleanup: void pp_string_fp(Func_print print_func, FILE *fp, const char *in_str, - size_t len, int delim, int breaklines) + size_t len, int delim, bool breaklines) { char *s = pp_string(in_str, len, delim); int count; @@ -941,7 +941,7 @@ dump_prog(INSTRUCTION *code) (void) time(& now); /* \n on purpose, with \n in ctime() output */ fprintf(prof_fp, _("\t# gawk profile, created %s\n"), ctime(& now)); - pprint(code, NULL, FALSE); + pprint(code, NULL, false); } /* prec_level --- return the precedence of an operator, for paren tests */ @@ -1081,10 +1081,10 @@ is_binary(int type) case Op_in_array: case Op_K_getline_redir: /* sometimes */ case Op_K_getline: - return TRUE; + return true; default: - return FALSE; + return false; } } @@ -1319,12 +1319,12 @@ int pp_func(INSTRUCTION *pc, void *data ATTRIBUTE_UNUSED) { int j; - static int first = TRUE; + static bool first = true; NODE *func; int pcount; if (first) { - first = FALSE; + first = false; fprintf(prof_fp, _("\n\t# Functions, listed alphabetically\n")); } @@ -1341,7 +1341,7 @@ pp_func(INSTRUCTION *pc, void *data ATTRIBUTE_UNUSED) } fprintf(prof_fp, ")\n\t{\n"); indent_in(); - pprint(pc->nexti->nexti, NULL, FALSE); /* function body */ + pprint(pc->nexti->nexti, NULL, false); /* function body */ indent_out(); fprintf(prof_fp, "\t}\n"); return 0; @@ -31,7 +31,7 @@ static void check_bracket_exp(char *s, size_t len); /* make_regexp --- generate compiled regular expressions */ Regexp * -make_regexp(const char *s, size_t len, int ignorecase, int dfa, int canfatal) +make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal) { static char metas[] = ".*+(){}[]|?^$\\"; Regexp *rp; @@ -42,10 +42,9 @@ make_regexp(const char *s, size_t len, int ignorecase, int dfa, int canfatal) const char *end = s + len; char *dest; int c, c2; - static short first = TRUE; - static short no_dfa = FALSE; - int has_anchor = FALSE; - int may_have_range = 0; + static bool first = true; + static bool no_dfa = false; + bool has_anchor = false; reg_syntax_t dfa_syn; int i; @@ -62,7 +61,7 @@ make_regexp(const char *s, size_t len, int ignorecase, int dfa, int canfatal) #endif if (first) { - first = FALSE; + first = false; /* for debugging and testing */ no_dfa = (getenv("GAWK_NO_DFA") != NULL); } @@ -162,9 +161,7 @@ make_regexp(const char *s, size_t len, int ignorecase, int dfa, int canfatal) } else { c = *src; if (c == '^' || c == '$') - has_anchor = TRUE; - if (c == '[' || c == '-' || c == ']') - may_have_range++; + has_anchor = true; *dest++ = *src++; /* not '\\' */ } @@ -227,26 +224,26 @@ make_regexp(const char *s, size_t len, int ignorecase, int dfa, int canfatal) } /* gack. this must be done *after* re_compile_pattern */ - rp->pat.newline_anchor = FALSE; /* don't get \n in middle of string */ + rp->pat.newline_anchor = false; /* don't get \n in middle of string */ if (dfa && ! no_dfa) { - rp->dfa = TRUE; + rp->dfa = true; rp->dfareg = dfaalloc(); - dfacomp(buf, len, rp->dfareg, TRUE); + dfacomp(buf, len, rp->dfareg, true); } else - rp->dfa = FALSE; + rp->dfa = false; rp->has_anchor = has_anchor; /* Additional flags that help with RS as regexp. */ for (i = 0; i < len; i++) { if (strchr(metas, buf[i]) != NULL) { - rp->has_meta = TRUE; + rp->has_meta = true; break; } } for (i = len - 1; i >= 0; i--) { if (strchr("*+|?", buf[i]) != NULL) { - rp->maybe_long = TRUE; + rp->maybe_long = true; break; } } @@ -291,13 +288,13 @@ research(Regexp *rp, char *str, int start, * text. So we just save and restore the character. */ save = str[start+len]; - ret = dfaexec(rp->dfareg, str+start, str+start+len, TRUE, + ret = dfaexec(rp->dfareg, str+start, str+start+len, true, &count, &try_backref); str[start+len] = save; } if (ret) { - if (need_start || rp->dfa == FALSE || try_backref) { + if (need_start || rp->dfa == false || try_backref) { /* * Passing NULL as last arg speeds up search for cases * where we don't need the start/end info. @@ -384,7 +381,7 @@ re_update(NODE *t) } /* compile it */ t->re_reg = make_regexp(t->re_text->stptr, t->re_text->stlen, - IGNORECASE, t->re_cnt, TRUE); + IGNORECASE, t->re_cnt, true); /* clear case flag */ t->re_flags &= ~CASE; @@ -414,7 +411,7 @@ resetup() syn |= RE_INTERVALS | RE_INVALID_INTERVAL_ORD; (void) re_set_syntax(syn); - dfasyntax(syn, FALSE, '\n'); + dfasyntax(syn, false, '\n'); } /* avoid_dfa --- return true if we should not use the DFA matcher */ @@ -425,16 +422,16 @@ avoid_dfa(NODE *re, char *str, size_t len) char *end; if (! re->re_reg->has_anchor) - return FALSE; + return false; for (end = str + len; str < end; str++) if (*str == '\n') - return TRUE; + return true; - return FALSE; + return false; } -/* reisstring --- return TRUE if the RE match is a simple string match */ +/* reisstring --- return true if the RE match is a simple string match */ int reisstring(const char *text, size_t len, Regexp *re, const char *buf) @@ -444,7 +441,7 @@ reisstring(const char *text, size_t len, Regexp *re, const char *buf) /* simple checking for meta characters in re */ if (re->has_meta) - return FALSE; /* give up early, can't be string match */ + return false; /* give up early, can't be string match */ /* make accessable to gdb */ matched = &buf[RESTART(re, buf)]; @@ -516,28 +513,28 @@ check_bracket_exp(char *s, size_t length) static struct reclass { const char *name; size_t len; - short warned; + bool warned; } classes[] = { /* * Ordered by what we hope is frequency, * since it's linear searched. */ - { "[:alpha:]", 9, FALSE }, - { "[:digit:]", 9, FALSE }, - { "[:alnum:]", 9, FALSE }, - { "[:upper:]", 9, FALSE }, - { "[:lower:]", 9, FALSE }, - { "[:space:]", 9, FALSE }, - { "[:xdigit:]", 10, FALSE }, - { "[:punct:]", 9, FALSE }, - { "[:print:]", 9, FALSE }, - { "[:graph:]", 9, FALSE }, - { "[:cntrl:]", 9, FALSE }, - { "[:blank:]", 9, FALSE }, + { "[:alpha:]", 9, false }, + { "[:digit:]", 9, false }, + { "[:alnum:]", 9, false }, + { "[:upper:]", 9, false }, + { "[:lower:]", 9, false }, + { "[:space:]", 9, false }, + { "[:xdigit:]", 10, false }, + { "[:punct:]", 9, false }, + { "[:print:]", 9, false }, + { "[:graph:]", 9, false }, + { "[:cntrl:]", 9, false }, + { "[:blank:]", 9, false }, { NULL, 0 } }; int i; - int found = FALSE; + bool found = false; char save; char *sp, *sp2, *end; int len; @@ -557,7 +554,7 @@ again: goto done; for (count++, sp++; *sp != '\0'; sp++) { - static short range_warned = FALSE; + static bool range_warned = false; if (*sp == '[') count++; @@ -567,7 +564,7 @@ again: && sp[-1] != '[' && sp[1] != ']' && ! isdigit((unsigned char) sp[-1]) && ! isdigit((unsigned char) sp[1]) && ! (sp[-2] == '[' && sp[-1] == '^')) { - range_warned = TRUE; + range_warned = true; warning(_("range of the form `[%c-%c]' is locale dependent"), sp[-1], sp[1]); } @@ -589,7 +586,7 @@ again: len = classes[i].len; if ( len == (sp - sp2) && memcmp(sp2, classes[i].name, len) == 0) { - found = TRUE; + found = true; break; } } @@ -597,11 +594,11 @@ again: if (found && ! classes[i].warned) { warning(_("regexp component `%.*s' should probably be `[%.*s]'"), len, sp2, len, sp2); - classes[i].warned = TRUE; + classes[i].warned = true; } if (sp < end) { - found = FALSE; + found = false; goto again; } done: @@ -360,7 +360,7 @@ get_symbols(SYMBOL_TYPE what, int sort) NODE ** variable_list() { - return get_symbols(VARIABLE, TRUE); + return get_symbols(VARIABLE, true); } /* function_list --- list of functions */ @@ -616,7 +616,7 @@ in_main_context() /* free_context --- free context structure and related data. */ void -free_context(AWK_CONTEXT *ctxt, int keep_globals) +free_context(AWK_CONTEXT *ctxt, bool keep_globals) { SRCFILE *s, *sn; |