summaryrefslogtreecommitdiff
path: root/debug.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2012-05-11 15:05:35 +0300
committerArnold D. Robbins <arnold@skeeve.com>2012-05-11 15:05:35 +0300
commite5353c0f447a8628985722296f57fc02dd2e0063 (patch)
treee41c41ba69b3c707cad6f6dbd3f1f9374e1eeafd /debug.c
parent4f8aff5908706e6f526b61337d10a412f4f66360 (diff)
downloadgawk-e5353c0f447a8628985722296f57fc02dd2e0063.tar.gz
Move to use of bool type, true, false, everywhere.
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c495
1 files changed, 247 insertions, 248 deletions
diff --git a/debug.c b/debug.c
index 91d95eed..6dda3a46 100644
--- a/debug.c
+++ b/debug.c
@@ -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,