aboutsummaryrefslogtreecommitdiffstats
path: root/debug.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2016-10-23 12:12:50 +0300
committerArnold D. Robbins <arnold@skeeve.com>2016-10-23 12:12:50 +0300
commit3055361c2a022c9ac9ae42ac88c00e3055498a0d (patch)
tree9be951749f48d867218ba99d75f9ffb94e5133ca /debug.c
parenta562d9af7650afcda1115e2cd8a2426641c020df (diff)
downloadegawk-3055361c2a022c9ac9ae42ac88c00e3055498a0d.tar.gz
egawk-3055361c2a022c9ac9ae42ac88c00e3055498a0d.tar.bz2
egawk-3055361c2a022c9ac9ae42ac88c00e3055498a0d.zip
Remove trailing whitespace everywhere. Fix Unicode into ASCII.
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c270
1 files changed, 135 insertions, 135 deletions
diff --git a/debug.c b/debug.c
index 7f58e927..6e3082d7 100644
--- a/debug.c
+++ b/debug.c
@@ -1,23 +1,23 @@
/*
- * debug.c - gawk debugger
+ * debug.c - gawk debugger
*/
-/*
+/*
* Copyright (C) 2004, 2010-2013, 2016 the Free Software Foundation, Inc.
- *
+ *
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
- *
+ *
* GAWK is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* GAWK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
@@ -77,7 +77,7 @@ struct commands_item {
CMDARG *arg;
};
-/* breakpoint structure */
+/* breakpoint structure */
typedef struct break_point {
struct break_point *next;
struct break_point *prev;
@@ -99,7 +99,7 @@ typedef struct break_point {
#define BP_TEMP 4
#define BP_IGNORE 8
-} BREAKPOINT;
+} BREAKPOINT;
static BREAKPOINT breakpoints = { &breakpoints, &breakpoints, 0 };
@@ -126,12 +126,12 @@ struct list_item {
NODE *symbol; /* variable or function param */
NODE **subs; /* subscripts */
- int num_subs; /* subscript(dimension) count */
+ int num_subs; /* subscript(dimension) count */
char *sname; /* symbol or param name */
long fcall_count;
- struct commands_item commands;
+ struct commands_item commands;
int silent;
struct condition cndn;
@@ -149,8 +149,8 @@ struct list_item {
#define PARAM 1
#define SUBSCRIPT 2
#define FIELD_NUM 4
-#define OLD_IS_ARRAY 8 /* old item is array */
-#define CUR_IS_ARRAY 16 /* current item is array */
+#define OLD_IS_ARRAY 8 /* old item is array */
+#define CUR_IS_ARRAY 16 /* current item is array */
};
#define IS_PARAM(d) (((d)->flags & PARAM) != 0)
@@ -175,7 +175,7 @@ static struct {
INSTRUCTION *pc; /* 'until' and 'return' commands */
int repeat_count; /* 'step', 'next', 'stepi', 'nexti' commands */
bool print_frame; /* print frame info, 'finish' and 'until' */
- bool print_ret; /* print returned value, 'finish' */
+ 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 */
@@ -183,7 +183,7 @@ static struct {
* awk interpreter and return control
* to debugger command interpreter.
*/
-
+
enum argtype command; /* command type */
} stop;
@@ -216,7 +216,7 @@ struct dbg_option {
int *num_val;
char **str_val;
void (*assign)(const char *);
- const char *help_txt;
+ const char *help_txt;
};
#define DEFAULT_HISTFILE "./.gawk_history"
@@ -273,7 +273,7 @@ jmp_buf pager_quit_tag;
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 int pager_lines_printed = 0; /* no of lines printed so far */
static void restart(bool run) ATTRIBUTE_NORETURN;
static void close_all(void);
@@ -574,7 +574,7 @@ print_lines(char *src, int start_line, int nlines)
for (i = start_line; i < start_line + nlines; i++) {
int supposed_len, len;
char *p;
-
+
sprintf(linebuf, "%-8d", i);
/* mark the line about to be executed with =>; nlines > 1
@@ -582,7 +582,7 @@ print_lines(char *src, int start_line, int nlines)
*/
if (nlines > 1) {
BREAKPOINT *b;
- bool 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;
@@ -595,7 +595,7 @@ print_lines(char *src, int start_line, int nlines)
else
sprintf(linebuf, "%-4d =>", i);
} else if (has_bpt)
- sprintf(linebuf, "%-4d:b ", i);
+ sprintf(linebuf, "%-4d:b ", i);
}
p = linebuf + strlen(linebuf);
@@ -647,7 +647,7 @@ do_list(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
long count = list_size;
INSTRUCTION *rp;
char *src = cur_srcfile->src;
-
+
line_first = last_printed_line + 1; /* default or no arg */
if (arg == NULL) /* list or list + */
goto list;
@@ -679,10 +679,10 @@ range:
count = arg->a_int - line_first + 1;
break;
- case D_string:
+ case D_string:
src = arg->a_string;
if (arg->next != NULL) {
- arg = arg->next;
+ arg = arg->next;
if (arg->type == D_int) /* list file:n */
goto line;
else if (arg->type == D_range) /* list file:m-n */
@@ -713,7 +713,7 @@ list:
if (line_last != -1) {
last_printed_line = line_last;
last_print_count = line_last - line_first + 1;
- }
+ }
return false;
}
@@ -780,7 +780,7 @@ do_info(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
continue;
start++;
*end = '\0';
- gprintf(out_fp, "%s", start); /* FIXME: translate ? */
+ gprintf(out_fp, "%s", start); /* FIXME: translate ? */
*end = '}';
}
}
@@ -900,7 +900,7 @@ do_info(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
sub = d->subs[i];
gprintf(out_fp, "[\"%s\"]", sub->stptr);
}
- gprintf(out_fp, "\n");
+ gprintf(out_fp, "\n");
} else if (IS_FIELD(d))
gprintf(out_fp, "%d:\t$%ld\n", d->number, get_number_si(symbol));
else
@@ -920,7 +920,7 @@ do_info(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
continue;
start++;
*end = '\0';
- gprintf(out_fp, "%s", start); /* FIXME: translate ? */
+ gprintf(out_fp, "%s", start); /* FIXME: translate ? */
*end = '}';
}
}
@@ -998,7 +998,7 @@ find_param(const char *name, long num, char **pname)
func = f->func_node;
pcount = func->param_cnt;
for (i = 0; i < pcount; i++) {
- fparam = func->fparms[i].param;
+ fparam = func->fparms[i].param;
if (strcmp(name, fparam) == 0) {
r = f->stack[i];
if (r->type == Node_array_ref)
@@ -1123,7 +1123,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);
@@ -1163,7 +1163,7 @@ do_print_var(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
if ((r = find_array(name)) != NULL) {
int count = a->a_count;
for (; count > 0; count--) {
- NODE *value, *subs;
+ NODE *value, *subs;
a = a->next;
subs = a->a_node;
value = in_array(r, subs);
@@ -1195,9 +1195,9 @@ do_print_var(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
/* notably D_node, subscript for invalid array name; skip */
break;
}
- }
+ }
return false;
-}
+}
/* do_set_var --- set command */
@@ -1358,7 +1358,7 @@ delete_item(struct list_item *d)
free_context(d->cndn.ctxt, false);
if (d->cndn.expr != NULL)
efree(d->cndn.expr);
-
+
d->next->prev = d->prev;
d->prev->next = d->next;
efree(d);
@@ -1533,7 +1533,7 @@ display(struct list_item *d)
symbol = r;
if (i == count - 1) /* it's a sub-array */
goto print_sym; /* print # of elements in sub-array */
- } else {
+ } else {
if (i != count - 1)
return; /* FIXME msg and delete item ? */
fprintf(out_fp, "%d: %s[\"%s\"] = ", d->number,
@@ -1574,15 +1574,15 @@ do_display(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
}
/* do_undisplay --- undisplay command */
-
+
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 */
+/* condition_triggered --- test if a condition expression is true */
static int
condition_triggered(struct condition *cndn)
@@ -1631,21 +1631,21 @@ find_subscript(struct list_item *item, NODE **ptr)
}
/* cmp_val --- compare values of watched item, returns true if different; */
-
+
static int
-cmp_val(struct list_item *w, NODE *old, NODE *new)
+cmp_val(struct list_item *w, NODE *old, NODE *new)
{
/*
* case old new result
* ------------------------------
- * 1: NULL ARRAY true
+ * 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
- * 8: ARRAY ARRAY compare size
+ * 8: ARRAY ARRAY compare size
* 9: ARRAY NULL true
*/
@@ -1834,7 +1834,7 @@ do_watch(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
}
/* do_unwatch --- unwatch command */
-
+
int
do_unwatch(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
{
@@ -1881,9 +1881,9 @@ print_function(INSTRUCTION *pc, void *x)
{
NODE *func;
int i, pcount;
- struct pf_data *data = (struct pf_data *) x;
+ struct pf_data *data = (struct pf_data *) x;
int defn = data->defn;
- Func_print print_func = data->print_func;
+ Func_print print_func = data->print_func;
FILE *fp = data->fp;
func = pc->func_body;
@@ -1892,7 +1892,7 @@ print_function(INSTRUCTION *pc, void *x)
print_func(fp, "%s(", func->vname);
for (i = 0; i < pcount; i++) {
print_func(fp, "%s", func->fparms[i].param);
- if (i < pcount - 1)
+ if (i < pcount - 1)
print_func(fp, ", ");
}
print_func(fp, ")");
@@ -1936,7 +1936,7 @@ print_numbered_frame(long num)
} else {
fprintf(out_fp, _("#%ld\tin "), num);
print_frame(f->func_node, f->vname,
- ((INSTRUCTION *) find_frame(num - 1)->reti)->source_line);
+ ((INSTRUCTION *) find_frame(num - 1)->reti)->source_line);
}
fprintf(out_fp, "\n");
}
@@ -1965,7 +1965,7 @@ do_backtrace(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
if (cur < 0)
cur = 0;
}
- }
+ }
for (; cur <= last; cur++) {
print_numbered_frame(cur);
@@ -1973,12 +1973,12 @@ do_backtrace(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
if (cur <= fcall_count)
fprintf(out_fp, _("More stack frames follow ...\n"));
return false;
-}
+}
/* print_cur_frame_and_sourceline --- print current frame, and
* current source line.
*/
-
+
static void
print_cur_frame_and_sourceline()
{
@@ -2092,7 +2092,7 @@ find_rule(char *src, long lineno)
/* mk_breakpoint --- create a breakpoint instruction and the corresponding
* breakpoint structure.
*/
-
+
static INSTRUCTION *
mk_breakpoint(char *src, int srcline)
{
@@ -2113,7 +2113,7 @@ mk_breakpoint(char *src, int srcline)
b->src = src;
bp->break_pt = b;
b->bpi = bp;
-
+
/* prepend to list */
b->next = breakpoints.next;
b->prev = &breakpoints;
@@ -2136,7 +2136,7 @@ delete_breakpoint(BREAKPOINT *b)
* deleteing the instruction is not that simple,
* since could have reference to it somewhere else (e.g. cur_pc).
*/
-
+
pc->opcode = Op_no_op;
pc->source_line = 0;
pc->break_pt = NULL;
@@ -2147,7 +2147,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);
@@ -2165,7 +2165,7 @@ find_breakpoint(long num)
BREAKPOINT *b;
if (num <= 0)
- return NULL;
+ return NULL;
for (b = breakpoints.next; b != &breakpoints; b = b->next) {
if (b->number == num)
@@ -2175,7 +2175,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, bool silent)
{
@@ -2255,7 +2255,7 @@ set_breakpoint_at(INSTRUCTION *rp, int lineno, bool silent)
* a monotonically increasing sequence. Check if the line # is between
* the first and last statements of the case block before continuing
* the search.
- */
+ */
for (i2 = ip->stmt_start, i1 = i2->nexti; i2 != ip->stmt_end;
i2 = i1, i1 = i1->nexti) {
if (i1->source_line >= lineno)
@@ -2293,7 +2293,7 @@ set_breakpoint_next(INSTRUCTION *rp, INSTRUCTION *ip)
}
return NULL;
}
-
+
/* set_breakpoint --- set a breakpoint */
static int
@@ -2309,7 +2309,7 @@ set_breakpoint(CMDARG *arg, bool temporary)
if (arg == NULL) {
/*
* (From GDB Documentation):
-*
+*
* When called without any arguments, break sets a breakpoint at the next instruction
* to be executed in the selected stack frame (see section Examining the Stack).
* In any selected frame but the innermost, this makes your program stop as soon
@@ -2322,7 +2322,7 @@ set_breakpoint(CMDARG *arg, bool temporary)
* one instruction has been executed. If it did not do this,
* you would be unable to proceed past a breakpoint without first disabling the
* breakpoint. This rule applies whether or not the breakpoint already existed
-* when your program stopped.
+* when your program stopped.
*/
CHECK_PROG_RUNNING();
if (cur_frame == 0) {
@@ -2427,7 +2427,7 @@ breakpoint_triggered(BREAKPOINT *b)
if ((b->flags & BP_ENABLE_ONCE) != 0) {
b->flags &= ~BP_ENABLE_ONCE;
b->flags &= ~BP_ENABLE;
- }
+ }
return b->number;
}
@@ -2437,7 +2437,7 @@ int
do_breakpoint(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
{
return set_breakpoint(arg, false);
-}
+}
/* do_tmp_breakpoint --- tbreak command */
@@ -2611,7 +2611,7 @@ do_delete_breakpoint(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
delete_all = prompt_yes_no(
_("Delete all breakpoints? (y or n) "),
_("y")[0], true, out_fp);
-
+
if (delete_all) {
while (breakpoints.next != &breakpoints)
delete_breakpoint(breakpoints.next);
@@ -2736,7 +2736,7 @@ initialize_readline()
/* our completion function. */
rl_attempted_completion_function = command_completion;
- read_a_line = readline;
+ read_a_line = readline;
}
#else
#define initialize_readline() /* nothing */
@@ -2769,9 +2769,9 @@ debug_prog(INSTRUCTION *pc)
if (! read_a_line)
read_a_line = g_readline;
- push_cmd_src(input_fd, input_from_tty, read_a_line, 0, 0, EXIT_FATAL);
+ push_cmd_src(input_fd, input_from_tty, read_a_line, 0, 0, EXIT_FATAL);
- setbuf(out_fp, (char *) NULL);
+ setbuf(out_fp, (char *) NULL);
for (cur_srcfile = srcfiles->prev; cur_srcfile != srcfiles;
cur_srcfile = cur_srcfile->prev) {
if (cur_srcfile->stype == SRC_FILE
@@ -2800,7 +2800,7 @@ debug_prog(INSTRUCTION *pc)
unserialize(HISTORY);
unserialize(OPTION);
unsetenv("DGAWK_RESTART");
- fprintf(out_fp, "Restarting ...\n");
+ fprintf(out_fp, "Restarting ...\n");
if (strcasecmp(run, "true") == 0)
(void) do_run(NULL, 0);
@@ -2867,7 +2867,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;
@@ -3239,7 +3239,7 @@ check_return(INSTRUCTION **pi)
func = find_frame(cur_frame)->func_node;
assert(func != NULL);
- *pi = (func->code_ptr + 1)->lasti;
+ *pi = (func->code_ptr + 1)->lasti;
/* assert((*pi)->opcode == Op_K_return); */
}
@@ -3306,7 +3306,7 @@ do_until(CMDARG *arg, int cmd)
int lineno;
INSTRUCTION *rp, *ip;
NODE *func;
-
+
CHECK_PROG_RUNNING();
stop.pc = NULL;
stop.sourceline = 0;
@@ -3413,7 +3413,7 @@ print_watch_item(struct list_item *w)
sub = w->subs[i];
fprintf(out_fp, "[\"%s\"]", sub->stptr);
}
- fprintf(out_fp, "\n");
+ fprintf(out_fp, "\n");
} else if (IS_FIELD(w))
fprintf(out_fp, "$%ld\n", get_number_si(symbol));
else
@@ -3478,12 +3478,12 @@ next_command()
print_watch_item(w);
}
- /* frame info */
+ /* frame info */
if (stop.print_frame) {
print_frame(frame_ptr->func_node, source, sourceline);
fprintf(out_fp, "\n");
stop.print_frame = false;
- }
+ }
(void) print_lines(source, sourceline, 1);
@@ -3495,12 +3495,12 @@ no_output:
/* update last_printed_line, so that output of 'list' is
* centered around current sourceline
*/
-
+
last_printed_line = sourceline - list_size / 2;
if (last_printed_line < 0)
last_printed_line = 0;
- /* update current source file */
+ /* update current source file */
s = source_find(source);
if (cur_srcfile != s) {
if (cur_srcfile->fd != INVALID_HANDLE) {
@@ -3526,7 +3526,7 @@ no_output:
read_command(); /* zzparse */
}
-/* debug_post_execute --- post_hook in the interpreter */
+/* debug_post_execute --- post_hook in the interpreter */
static void
debug_post_execute(INSTRUCTION *pc)
@@ -3545,14 +3545,14 @@ debug_post_execute(INSTRUCTION *pc)
stop.command = D_illegal;
stop.check_func = NULL;
fprintf(out_fp, _("'finish' not meaningful with non-local jump '%s'\n"),
- op2str(pc->opcode));
+ op2str(pc->opcode));
} else if (stop.command == D_until) {
/* cancel until command */
stop.print_frame = false;
stop.command = D_illegal;
stop.check_func = NULL;
fprintf(out_fp, _("'until' not meaningful with non-local jump '%s'\n"),
- op2str(pc->opcode));
+ op2str(pc->opcode));
}
break;
@@ -3579,7 +3579,7 @@ debug_post_execute(INSTRUCTION *pc)
}
}
-/* debug_pre_execute --- pre_hook, called by the interpreter before execution;
+/* debug_pre_execute --- pre_hook, called by the interpreter before execution;
* checks if execution needs to be suspended and control
* transferred to the debugger.
*/
@@ -3609,7 +3609,7 @@ debug_pre_execute(INSTRUCTION **pi)
* yield surprising results. Ditto for Op_push_lhs for special variables
* (upto Op_var_assign, the set_FOO routine).
*/
-
+
switch (cur_pc->opcode) {
case Op_field_spec_lhs:
cant_stop = true;
@@ -3617,7 +3617,7 @@ debug_pre_execute(INSTRUCTION **pi)
case Op_field_assign:
cant_stop = false;
- return true; /* may stop at next instruction */
+ return true; /* may stop at next instruction */
case Op_push_lhs:
m = cur_pc->memory;
@@ -3647,7 +3647,7 @@ debug_pre_execute(INSTRUCTION **pi)
break; /* processed later in check_breakpoint() */
default:
- if (cur_pc->source_line <= 0)
+ if (cur_pc->source_line <= 0)
return true;
break;
}
@@ -3685,7 +3685,7 @@ debug_pre_execute(INSTRUCTION **pi)
/* print_memory --- print a scalar value */
-static void
+static void
print_memory(NODE *m, NODE *func, Func_print print_func, FILE *fp)
{
switch (m->type) {
@@ -3714,7 +3714,7 @@ print_memory(NODE *m, NODE *func, Func_print print_func, FILE *fp)
case Node_dynregex:
break;
-
+
case Node_param_list:
assert(func != NULL);
print_func(fp, "%s", func->fparms[m->param_cnt].param);
@@ -3779,7 +3779,7 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump)
func = find_frame(0)->func_node;
}
-
+
switch (pc->opcode) {
case Op_K_if:
print_func(fp, "[branch_if = %p] [branch_else = %p] [branch_else->lasti = %p]\n",
@@ -3943,7 +3943,7 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump)
genflags2str(pc->sub_flags, values));
}
break;
-
+
case Op_builtin:
print_func(fp, "%s [arg_count = %ld]\n", getfname(pc->builtin),
pc->expr_count);
@@ -3976,7 +3976,7 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump)
break;
case Op_concat:
- /* NB: concat_flag CSVAR only used in grammar, don't display it */
+ /* NB: concat_flag CSVAR only used in grammar, don't display it */
print_func(fp, "[expr_count = %ld] [concat_flag = %s]\n",
pc->expr_count,
(pc->concat_flag & CSUBSEP) != 0 ? "CSUBSEP" : "0");
@@ -4061,7 +4061,7 @@ do_trace_instruction(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
else
do_trace = false;
return false;
-}
+}
/* print_code --- print a list of instructions */
@@ -4145,7 +4145,7 @@ do_save(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
*/
if (strlen(line) > 1
- && strncmp(line, "sa", 2) == 0)
+ && strncmp(line, "sa", 2) == 0)
continue;
fprintf(fp, "%s\n", line);
@@ -4161,9 +4161,9 @@ do_save(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
int
do_option(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
{
- const struct dbg_option *opt;
+ const struct dbg_option *opt;
char *name, *value;
-
+
if (arg == NULL) { /* display all available options and corresponding values */
for (opt = option_list; opt->name; opt++) {
if (opt->str_val != NULL)
@@ -4198,7 +4198,7 @@ do_option(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
#ifdef HAVE_LIBREADLINE
-/* initialize_pager --- initialize our idea of the terminal size */
+/* initialize_pager --- initialize our idea of the terminal size */
void
initialize_pager(FILE *fp)
@@ -4234,9 +4234,9 @@ prompt_continue(FILE *fp)
if (quit_pager)
longjmp(pager_quit_tag, 1);
pager_lines_printed = 0;
-}
+}
-/* gprintf --- like fprintf but allows paging */
+/* gprintf --- like fprintf but allows paging */
int
gprintf(FILE *fp, const char *format, ...)
@@ -4255,9 +4255,9 @@ gprintf(FILE *fp, const char *format, ...)
} else if (buflen - bl < GPRINTF_BUFSIZ/2) {
buflen += GPRINTF_BUFSIZ;
erealloc(buf, char *, buflen * sizeof(char), "gprintf");
- }
+ }
#undef GPRINTF_BUFSIZ
-
+
while (true) {
va_start(args, format);
nchar = vsnprintf(buf + bl, buflen - bl, format, args);
@@ -4271,14 +4271,14 @@ gprintf(FILE *fp, const char *format, ...)
break;
}
- /* enlarge buffer, and try again */
+ /* enlarge buffer, and try again */
buflen *= 2;
erealloc(buf, char *, buflen * sizeof(char), "gprintf");
}
bl = 0;
for (p = buf; (q = strchr(p, '\n')) != NULL; p = q + 1) {
- int sz = (int) (q - p);
+ int sz = (int) (q - p);
while (sz > 0) {
int cnt;
@@ -4298,7 +4298,7 @@ gprintf(FILE *fp, const char *format, ...)
sz -= screen_width;
assert(sz > 0);
p += cnt;
- }
+ }
}
fprintf(fp, "\n");
@@ -4454,7 +4454,7 @@ enlarge_buffer:
else
nchar = snprintf(buf + bl, buflen - bl, "%d%c%d%c%s%c",
wd->number, FSEP, D_variable, FSEP, wd->sname, FSEP);
- cnum = wd->number;
+ cnum = wd->number;
commands = &wd->commands;
cndn = &wd->cndn;
break;
@@ -4545,8 +4545,8 @@ enlarge_buffer:
buf[bl++] = FSEP; /* field */
buf[bl++] = RSEP; /* record */
buf[bl] = '\0';
-
- /* condition expression */
+
+ /* condition expression */
if (cndn->expr) {
bl--; /* undo RSEP from above */
nchar = strlen(cndn->expr);
@@ -4574,7 +4574,7 @@ enlarge_buffer:
break;
default:
break;
- }
+ }
}
if (bl > 0) /* non-empty list */
@@ -4597,7 +4597,7 @@ unserialize_commands(char *str, int str_len)
/* unserialize_list_item --- create a list_item structure from unserialized data */
-
+
static struct list_item *
unserialize_list_item(struct list_item *list, char **pstr, int *pstr_len, int field_cnt)
{
@@ -4647,7 +4647,7 @@ unserialize_list_item(struct list_item *list, char **pstr, int *pstr_len, int fi
l->subs = subs;
}
l->number = num; /* keep same item number across executions */
-
+
if (list == &watch_list) {
initialize_watch_item(l);
/* unserialize watchpoint `commands' */
@@ -4664,11 +4664,11 @@ unserialize_list_item(struct list_item *list, char **pstr, int *pstr_len, int fi
} else
list->number = num;
- return l;
+ return l;
}
/* unserialize_breakpoint --- create a breakpoint structure from unserialized data */
-
+
static BREAKPOINT *
unserialize_breakpoint(char **pstr, int *pstr_len, int field_cnt)
{
@@ -4703,7 +4703,7 @@ unserialize_breakpoint(char **pstr, int *pstr_len, int field_cnt)
if (field_cnt > 6) /* unserialize breakpoint `commands' */
unserialize_commands(pstr[6], pstr_len[6]);
- if (field_cnt > 7) { /* condition expression */
+ if (field_cnt > 7) { /* condition expression */
char *expr;
expr = estrdup(pstr[7], pstr_len[7]);
if (parse_condition(D_break, b->number, expr) != 0)
@@ -4771,7 +4771,7 @@ unserialize(int type)
#ifdef GAWKDEBUG
fatal("Increase MAX_FIELD and recompile.\n");
#else
- return;
+ return;
#endif
}
@@ -4861,7 +4861,7 @@ has_break_or_watch_point(int *pnum, bool any)
/* N.B: breakpoints and watchpoints get numbers from a single
* counter/sequencer watch_list.number.
- */
+ */
for (b = breakpoints.next; b != &breakpoints; b = b->next) {
if (b->number == *pnum)
@@ -4896,7 +4896,7 @@ do_commands(CMDARG *arg, int cmd)
static struct list_item *w;
static struct commands_item *commands;
struct commands_item *c;
-
+
if (cmd == D_commands) {
int num = -1, type;
if (arg == NULL)
@@ -4944,7 +4944,7 @@ do_commands(CMDARG *arg, int cmd)
c->next = NULL;
c->cmd = cmd;
- /* N.B.: first arg is the command string, see command.y */
+ /* N.B.: first arg is the command string, see command.y */
c->cmd_string = arg->a_string;
c->arg = arg->next; /* actual arguments to the command */
efree(arg);
@@ -5041,7 +5041,7 @@ do_print_f(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
d_error(_("attempt to use array `%s[\"%s\"]' in a scalar context"),
name, subs->stptr);
goto done;
- } else
+ } else
tmp[i] = value;
} else {
if (value == NULL) {
@@ -5059,7 +5059,7 @@ do_print_f(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
}
}
}
- break;
+ break;
case D_node:
tmp[i] = a->a_node;
break;
@@ -5115,7 +5115,7 @@ static int
open_readfd(const char *file)
{
int fd;
-
+
fd = open(file, O_RDONLY);
if (fd <= INVALID_HANDLE)
return INVALID_HANDLE;
@@ -5147,14 +5147,14 @@ find_option(char *name)
void
option_help()
{
- const struct dbg_option *opt;
+ const struct dbg_option *opt;
for (opt = option_list; opt->name; opt++)
fprintf(out_fp, "\t%-15.15s - %s\n", opt->name, _(opt->help_txt));
}
#ifdef HAVE_LIBREADLINE
-
+
/* option_generator --- generator function for option name completion */
char *
@@ -5216,7 +5216,7 @@ set_gawk_output(const char *file)
output_is_tty = os_isatty(fileno(stderr));
return;
}
-
+
if (strncmp(cp, "fd/", 3) == 0) {
cp += 3;
fd = (int) strtoul(cp, NULL, 10);
@@ -5234,7 +5234,7 @@ set_gawk_output(const char *file)
if (fd > INVALID_HANDLE && fp == NULL) {
fp = fdopen(fd, "w");
if (fp == NULL)
- close(fd);
+ close(fd);
}
} else {
@@ -5265,7 +5265,7 @@ set_prompt(const char *value)
dbg_prompt = dgawk_prompt;
}
-/* set_option_flag --- convert option string to flag value */
+/* set_option_flag --- convert option string to flag value */
static int
set_option_flag(const char *value)
@@ -5349,7 +5349,7 @@ read_commands_string(const char *prompt ATTRIBUTE_UNUSED)
return NULL;
p = (char *) commands_string;
- end = (char *) commands_string + commands_string_len;
+ end = (char *) commands_string + commands_string_len;
for (; p < end; p++) {
if (*p == line_sep) {
line = estrdup(commands_string, p - commands_string);
@@ -5371,7 +5371,7 @@ static void
save_options(const char *file)
{
FILE *fp;
- const struct dbg_option *opt;
+ const struct dbg_option *opt;
fp = fopen(file, "w");
if (fp == NULL)
@@ -5410,7 +5410,7 @@ close_all()
close_extensions();
- set_gawk_output(NULL); /* closes output_fp if not stdout */
+ set_gawk_output(NULL); /* closes output_fp if not stdout */
}
/* pre_execute_code --- pre_hook for execute_code, called by pre_execute */
@@ -5460,7 +5460,7 @@ execute_code(volatile INSTRUCTION *code)
/* We use one global stack for all contexts.
* Save # of items in stack; in case of
* a fatal error, pop stack until it has that many items.
- */
+ */
save_stack_size = (stack_ptr - stack_bottom) + 1;
do_flags = false;
@@ -5496,13 +5496,13 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
int ret;
int save_flags = do_flags;
SRCFILE *the_source;
-
+
if (prog_running) {
this_frame = find_frame(0);
this_func = this_frame->func_node;
}
- install_params(this_func); /* expose current function parameters to eval */
+ install_params(this_func); /* expose current function parameters to eval */
ctxt = new_context();
ctxt->install_func = append_symbol; /* keep track of newly installed globals */
push_context(ctxt);
@@ -5527,9 +5527,9 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
eval->func_name = NULL; /* not needed, func_body already assigned */
(eval + 1)->expr_count = 0;
eval->nexti = bcalloc(Op_stop, 1, 0);
-
+
} else {
- /* execute as a part of the current function */
+ /* execute as a part of the current function */
int i;
INSTRUCTION *t;
@@ -5542,7 +5542,7 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
/* add or append eval locals to the current frame stack */
ecount = f->param_cnt; /* eval local count */
pcount = this_func->param_cnt;
-
+
if (ecount > 0) {
if (pcount == 0)
emalloc(this_frame->stack, NODE **, ecount * sizeof(NODE *), "do_eval");
@@ -5582,7 +5582,7 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
/* else
fatal error */
- if (this_func != NULL && ecount > 0) {
+ if (this_func != NULL && ecount > 0) {
int i;
/* undo frame manipulation from above */
@@ -5637,7 +5637,7 @@ GDB Documentation:
immediately for syntactic correctness, and to determine whether symbols
in it have referents in the context of your breakpoint. If expression
uses symbols not referenced in the context of the breakpoint, GDB prints
-an error message:
+an error message:
No symbol "foo" in current context.
*/
@@ -5673,7 +5673,7 @@ parse_condition(int type, int num, char *expr)
cndn = &b->cndn;
rp = find_rule(b->src, b->bpi->source_line);
if (rp != NULL && rp->opcode == Op_func)
- this_func = rp->func_body;
+ this_func = rp->func_body;
} else if (type == D_watch && (w = find_item(&watch_list, num)) != NULL) {
cndn = &w->cndn;
this_func = find_frame(cur_frame)->func_node;
@@ -5693,7 +5693,7 @@ parse_condition(int type, int num, char *expr)
do_flags = false;
ret = parse_program(&code);
do_flags = save_flags;
- remove_params(this_func);
+ remove_params(this_func);
pop_context();
if (ret != 0 || invalid_symbol) {
@@ -5702,7 +5702,7 @@ parse_condition(int type, int num, char *expr)
}
/* condition expression is parsed as awk pattern without
- * any action. The code is then modified to end up with
+ * any action. The code is then modified to end up with
* a `1.0' on stack when the expression is true, `0.0' otherwise.
*/
@@ -5717,7 +5717,7 @@ parse_condition(int type, int num, char *expr)
it->nexti = bcalloc(Op_jmp, 1, 0);
it->nexti->target_jmp = stop;
it->nexti->nexti = rule->lasti;
-
+
it = rule->lasti; /* Op_no_op, target for Op_jmp_false */
assert(it->opcode == Op_no_op);
it->opcode = Op_push_i;
@@ -5795,13 +5795,13 @@ push_cmd_src(
/* eof_status = EXIT_FATAL - exit with status EXIT_FATAL on EOF or error.
* = EXIT_FAILURE - exit status EXIT_FAILURE on error.
- * = EXIT_SUCCESS - don't exit on EOF or error.
+ * = EXIT_SUCCESS - don't exit on EOF or error.
*/
cs->eof_status = eofstatus;
cs->str = NULL;
cs->next = cmd_src;
cmd_src = cs;
-
+
input_fd = fd;
input_from_tty = istty;
read_a_line = readfunc;