diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-10-23 12:12:50 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-10-23 12:12:50 +0300 |
commit | 3055361c2a022c9ac9ae42ac88c00e3055498a0d (patch) | |
tree | 9be951749f48d867218ba99d75f9ffb94e5133ca | |
parent | a562d9af7650afcda1115e2cd8a2426641c020df (diff) | |
download | egawk-3055361c2a022c9ac9ae42ac88c00e3055498a0d.tar.gz egawk-3055361c2a022c9ac9ae42ac88c00e3055498a0d.tar.bz2 egawk-3055361c2a022c9ac9ae42ac88c00e3055498a0d.zip |
Remove trailing whitespace everywhere. Fix Unicode into ASCII.
67 files changed, 1009 insertions, 975 deletions
@@ -1,3 +1,9 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + * mpfr.c: Replace Unicode sequences with ASCII. + * cint_array.c: Ditto. + 2016-10-16 Arnold D. Robbins <arnold@skeeve.com> * awkgram.y: Typo fix in call to add_sign_to_num. @@ -2,23 +2,23 @@ * array.c - routines for awk arrays. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2014, 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 @@ -102,7 +102,7 @@ make_array() /* vname, flags, and parent_array not set here */ return array; -} +} /* null_array --- force symbol to be an empty typeless array */ @@ -150,7 +150,7 @@ null_lookup(NODE *symbol, NODE *subs) return symbol->alookup(symbol, subs); } -/* null_length --- default function for array length interface */ +/* null_length --- default function for array length interface */ NODE ** null_length(NODE *symbol, NODE *subs ATTRIBUTE_UNUSED) @@ -198,7 +198,7 @@ assoc_copy(NODE *symbol, NODE *newsymb) void assoc_dump(NODE *symbol, NODE *ndump) { - if (symbol->adump) + if (symbol->adump) (void) symbol->adump(symbol, ndump); } @@ -229,7 +229,7 @@ make_aname(const NODE *symbol) max_alen = alen + SLEN; emalloc(aname, char *, (max_alen + 1) * sizeof(char *), "make_aname"); } else if (alen > max_alen) { - max_alen = alen + SLEN; + max_alen = alen + SLEN; erealloc(aname, char *, (max_alen + 1) * sizeof(char *), "make_aname"); } memcpy(aname, symbol->vname, alen + 1); @@ -258,11 +258,11 @@ array_vname(const NODE *symbol) const NODE *save_symbol = symbol; const char *from = _("from %s"); const char *aname; - + if (symbol->type != Node_array_ref || symbol->orig_array->type != Node_var_array ) { - if (symbol->type != Node_var_array || symbol->parent_array == NULL) + if (symbol->type != Node_var_array || symbol->parent_array == NULL) return symbol->vname; return make_aname(symbol); } @@ -373,7 +373,7 @@ force_array(NODE *symbol, bool canfatal) /* set_SUBSEP --- update SUBSEP related variables when SUBSEP assigned to */ - + void set_SUBSEP() { @@ -396,7 +396,7 @@ concat_exp(int nargs, bool do_subsep) size_t subseplen = 0; int i; extern NODE **args_array; - + if (nargs == 1) return POP_STRING(); @@ -498,13 +498,13 @@ adjust_fcall_stack(NODE *symbol, int nsubs) * But excludes cases like (nsubs = 0): * * function f(c, d) { delete c; ..} - * BEGIN { a[0][0] = 1; f(a[0], a[0]); ...} + * BEGIN { a[0][0] = 1; f(a[0], a[0]); ...} */ null_array(r); r->parent_array = NULL; continue; - } + } /* Case 2 */ for (n = n->parent_array; n != NULL; n = n->parent_array) { @@ -648,7 +648,7 @@ do_delete_loop(NODE *symbol, NODE **lhs) efree(list); /* blast the array in one shot */ - adjust_fcall_stack(symbol, 0); + adjust_fcall_stack(symbol, 0); assoc_clear(symbol); } @@ -703,7 +703,7 @@ value_info(NODE *n) if ((n->flags & (STRING|STRCUR)) == STRCUR) { fprintf(output_fp, "]["); - fprintf(output_fp, "stfmt=%d, ", n->stfmt); + fprintf(output_fp, "stfmt=%d, ", n->stfmt); /* * If not STFMT_UNUSED, could be CONVFMT or OFMT if last * used in a print statement. If immutable, could be that it @@ -1054,7 +1054,7 @@ sort_up_index_number(const void *p1, const void *p2) ret = cmp_numbers(t1, t2); if (ret != 0) - return ret; + return ret; /* break a tie with the index string itself */ t1 = force_string((NODE *) t1); @@ -1241,7 +1241,7 @@ sort_user_func(const void *p1, const void *p2) } -/* assoc_list -- construct, and optionally sort, a list of array elements */ +/* assoc_list -- construct, and optionally sort, a list of array elements */ NODE ** assoc_list(NODE *symbol, const char *sort_str, sort_context_t sort_ctxt) @@ -1280,7 +1280,7 @@ assoc_list(NODE *symbol, const char *sort_str, sort_context_t sort_ctxt) extern int currule; int save_rule = 0; assoc_kind_t assoc_kind = ANONE; - + elem_size = 1; for (qi = 0, j = sizeof(sort_funcs)/sizeof(sort_funcs[0]); qi < j; qi++) { @@ -1304,7 +1304,7 @@ assoc_list(NODE *symbol, const char *sort_str, sort_context_t sort_ctxt) } else { /* unrecognized */ NODE *f; - const char *sp; + const char *sp; for (sp = sort_str; *sp != '\0' && ! isspace((unsigned char) *sp); sp++) continue; @@ -1328,7 +1328,7 @@ assoc_list(NODE *symbol, const char *sort_str, sort_context_t sort_ctxt) code->func_body = f; code->func_name = NULL; /* not needed, func_body already assigned */ (code + 1)->expr_count = 4; /* function takes 4 arguments */ - code->nexti = bcalloc(Op_stop, 1, 0); + code->nexti = bcalloc(Op_stop, 1, 0); /* * make non-redirected getline, exit, `next' and `nextfile' fatal in @@ -1355,7 +1355,7 @@ assoc_list(NODE *symbol, const char *sort_str, sort_context_t sort_ctxt) if (cmp_func == sort_user_func) { code = POP_CODE(); - currule = save_rule; /* restore current rule */ + currule = save_rule; /* restore current rule */ bcfree(code->nexti); /* Op_stop */ bcfree(code); /* Op_func_call */ } @@ -1,23 +1,23 @@ /* - * awk.h -- Definitions for gawk. + * awk.h -- Definitions for gawk. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-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 @@ -546,7 +546,7 @@ typedef struct exp_node { #define array_size sub.nodep.cnt #define array_capacity sub.nodep.reserved #define xarray sub.nodep.rn -#define parent_array sub.nodep.x.extra +#define parent_array sub.nodep.x.extra #define ainit array_funcs[0] #define ainit_ind 0 @@ -663,7 +663,7 @@ typedef enum opcodeval { Op_nomatch, Op_rule, - + /* keywords */ Op_K_case, Op_K_default, @@ -728,13 +728,13 @@ typedef enum opcodeval { Op_stop, /* parsing (yylex and yyparse), should never appear in valid compiled code */ - Op_token, + Op_token, Op_symbol, Op_list, /* program structures -- for use in the profiler/pretty printer */ Op_K_do, - Op_K_for, + Op_K_for, Op_K_arrayfor, Op_K_while, Op_K_switch, @@ -803,7 +803,7 @@ typedef struct exp_instruction { /* Op_K_exit */ #define target_end d.di -#define target_atexit x.xi +#define target_atexit x.xi /* Op_newfile, Op_K_getline, Op_nextfile */ #define target_endfile x.xi @@ -892,7 +892,7 @@ typedef struct exp_instruction { #define field_assign x.aptr /* Op_field_assign, Op_var_assign */ -#define assign_ctxt d.dl +#define assign_ctxt d.dl /* Op_concat */ #define concat_flag d.dl @@ -925,7 +925,7 @@ typedef struct exp_instruction { /* Op_line_range */ #define condpair_left d.di -#define condpair_right x.xi +#define condpair_right x.xi /* Op_store_var */ #define initval x.xn @@ -1015,7 +1015,7 @@ typedef struct srcfile { int fd; int maxlen; /* size of the longest line */ - void (*fini_func)(); /* dynamic extension of type SRC_EXTLIB */ + void (*fini_func)(); /* dynamic extension of type SRC_EXTLIB */ char *lexptr; char *lexend; @@ -1053,7 +1053,7 @@ enum block_id { BLOCK_NODE, BLOCK_BUCKET, BLOCK_MAX /* count */ -}; +}; typedef int (*Func_pre_exec)(INSTRUCTION **); typedef void (*Func_post_exec)(INSTRUCTION *); @@ -1067,7 +1067,7 @@ typedef void (*Func_post_exec)(INSTRUCTION *); #ifndef LONG_MIN #define LONG_MIN ((long)(-LONG_MAX - 1L)) #endif -#define UNLIMITED LONG_MAX +#define UNLIMITED LONG_MAX /* -------------------------- External variables -------------------------- */ /* gawk builtin variables */ @@ -1212,7 +1212,7 @@ extern STACK_ITEM *stack_top; #define POP_ADDRESS() (decr_sp()->lptr) #define PEEK(n) ((stack_ptr - (n))->rptr) #define TOP() (stack_ptr->rptr) /* same as PEEK(0) */ -#define TOP_ADDRESS() (stack_ptr->lptr) +#define TOP_ADDRESS() (stack_ptr->lptr) #define PUSH(r) (void) (incr_sp()->rptr = (r)) #define PUSH_ADDRESS(l) (void) (incr_sp()->lptr = (l)) #define REPLACE(r) (void) (stack_ptr->rptr = (r)) @@ -1338,7 +1338,7 @@ if (--val) \ typedef enum { SORTED_IN = 1, ASORT, ASORTI } sort_context_t; typedef enum { ANONE = 0x00, /* "unused" value */ - AINDEX = 0x001, /* list of indices */ + AINDEX = 0x001, /* list of indices */ AVALUE = 0x002, /* list of values */ AINUM = 0x004, /* numeric index */ AISTR = 0x008, /* string index */ @@ -1761,7 +1761,7 @@ POP_SCALAR() if (t->type == Node_var_array) fatal(_("attempt to use array `%s' in a scalar context"), array_vname(t)); - + return t; } @@ -1774,7 +1774,7 @@ TOP_SCALAR() if (t->type == Node_var_array) fatal(_("attempt to use array `%s' in a scalar context"), array_vname(t)); - + return t; } @@ -1792,7 +1792,7 @@ in_array(NODE *a, NODE *s) NODE **ret; ret = a->aexists(a, s); - + return ret ? *ret : NULL; } @@ -80,7 +80,7 @@ static void lintwarn_ln(int line, const char *m, ...) ATTRIBUTE_PRINTF_2; static void warning_ln(int line, const char *m, ...) ATTRIBUTE_PRINTF_2; static char *get_src_buf(void); static int yylex(void); -int yyparse(void); +int yyparse(void); static INSTRUCTION *snode(INSTRUCTION *subn, INSTRUCTION *op); static char **check_params(char *fname, int pcount, INSTRUCTION *list); static int install_function(char *fname, INSTRUCTION *fi, INSTRUCTION *plist); @@ -155,7 +155,7 @@ static char *lexptr; /* pointer to next char during parsing */ static char *lexend; /* end of buffer */ static char *lexptr_begin; /* keep track of where we were for error msgs */ static char *lexeme; /* beginning of lexeme for debugging */ -static bool 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; @@ -2358,7 +2358,7 @@ yyreduce: int case_count = 0; int i; - tbreak = instruction(Op_no_op); + tbreak = instruction(Op_no_op); cstmt = list_create(tbreak); cexp = list_create(instruction(Op_pop)); dflt = instruction(Op_jmp); @@ -2385,7 +2385,7 @@ yyreduce: error_ln(curr->source_line, _("duplicate case values in switch body: %s"), caseval); } - + if (case_values == NULL) emalloc(case_values, const char **, sizeof(char *) * maxcount, "statement"); else if (case_count >= maxcount) { @@ -2436,7 +2436,7 @@ yyreduce: (void) list_merge(ip, cexp); (yyval) = list_merge(ip, cstmt); - break_allowed--; + break_allowed--; fix_break_continue(ip, tbreak, NULL); } #line 2443 "awkgram.c" /* yacc.c:1646 */ @@ -2444,14 +2444,14 @@ yyreduce: case 47: #line 693 "awkgram.y" /* yacc.c:1646 */ - { + { /* * ----------------- * tc: * cond * ----------------- * [Op_jmp_false tb ] - * ----------------- + * ----------------- * body * ----------------- * [Op_jmp tc ] @@ -2496,7 +2496,7 @@ yyreduce: * z: * body * ----------------- - * tc: + * tc: * cond * ----------------- * [Op_jmp_true | z ] @@ -2547,7 +2547,7 @@ yyreduce: && ((yyvsp[0])->nexti->memory->type != Node_var || !((yyvsp[0])->nexti->memory->var_update)) && strcmp((yyvsp[0])->nexti->memory->vname, var_name) == 0 ) { - + /* Efficiency hack. Recognize the special case of * * for (iggy in foo) @@ -2559,10 +2559,10 @@ yyreduce: * * Check that the body is a `delete a[i]' statement, * and that both the loop var and array names match. - */ + */ NODE *arr = NULL; - ip = (yyvsp[0])->nexti->nexti; + ip = (yyvsp[0])->nexti->nexti; if ((yyvsp[-3])->nexti->opcode == Op_push && (yyvsp[-3])->lasti == (yyvsp[-3])->nexti) arr = (yyvsp[-3])->nexti->memory; if (arr != NULL @@ -2588,7 +2588,7 @@ yyreduce: /* [ Op_push_array a ] * [ Op_arrayfor_init | ib ] - * ic:[ Op_arrayfor_incr | ib ] + * ic:[ Op_arrayfor_incr | ib ] * [ Op_var_assign if any ] * * body @@ -2617,7 +2617,7 @@ regular_loop: } /* else $1 is NULL */ - /* add update_FOO instruction if necessary */ + /* add update_FOO instruction if necessary */ if ((yyvsp[-4])->array_var->type == Node_var && (yyvsp[-4])->array_var->var_update) { (void) list_append(ip, instruction(Op_var_update)); ip->lasti->update_var = (yyvsp[-4])->array_var->var_update; @@ -2633,7 +2633,7 @@ regular_loop: if (do_pretty_print) { (void) list_append(ip, instruction(Op_exec_count)); ((yyvsp[-7]) + 1)->forloop_cond = (yyvsp[-4]); - ((yyvsp[-7]) + 1)->forloop_body = ip->lasti; + ((yyvsp[-7]) + 1)->forloop_body = ip->lasti; } if ((yyvsp[0]) != NULL) @@ -2643,7 +2643,7 @@ regular_loop: ip->lasti->target_jmp = (yyvsp[-4]); (yyval) = list_append(ip, tbreak); fix_break_continue(ip, tbreak, tcont); - } + } break_allowed--; continue_allowed--; @@ -2687,7 +2687,7 @@ regular_loop: case 53: #line 915 "awkgram.y" /* yacc.c:1646 */ - { + { if (! break_allowed) error_ln((yyvsp[-1])->source_line, _("`break' is not allowed outside a loop or switch")); @@ -2747,7 +2747,7 @@ regular_loop: #line 957 "awkgram.y" /* yacc.c:1646 */ { /* Initialize the two possible jump targets, the actual target - * is resolved at run-time. + * is resolved at run-time. */ (yyvsp[-2])->target_end = ip_end; /* first instruction in end_block */ (yyvsp[-2])->target_atexit = ip_atexit; /* cleanup and go home */ @@ -2873,7 +2873,7 @@ regular_loop: * [$1 | NULL | redir_type | expr_count] * */ -regular_print: +regular_print: if ((yyvsp[0]) == NULL) { /* no redirection */ if ((yyvsp[-1]) == NULL) { /* printf without arg */ (yyvsp[-3])->expr_count = 0; @@ -3030,7 +3030,7 @@ regular_print: { INSTRUCTION *casestmt = (yyvsp[0]); if ((yyvsp[0]) == NULL) - casestmt = list_create(instruction(Op_no_op)); + casestmt = list_create(instruction(Op_no_op)); if (do_pretty_print) (void) list_prepend(casestmt, instruction(Op_exec_count)); (yyvsp[-4])->case_exp = (yyvsp[-3]); @@ -3064,7 +3064,7 @@ regular_print: case 75: #line 1231 "awkgram.y" /* yacc.c:1646 */ - { + { NODE *n = (yyvsp[0])->memory; (void) force_number(n); negate_num(n); @@ -3473,7 +3473,7 @@ regular_print: case 130: #line 1500 "awkgram.y" /* yacc.c:1646 */ - { + { (yyvsp[0])->opcode = Op_assign_quotient; (yyval) = (yyvsp[0]); } @@ -3843,7 +3843,7 @@ regular_print: ) { NODE *n = (yyvsp[0])->lasti->memory; (void) force_number(n); - negate_num(n); + negate_num(n); (yyval) = (yyvsp[0]); bcfree((yyvsp[-1])); } else { @@ -3901,7 +3901,7 @@ regular_print: warned = true; lintwarn("%s", msg); } - + f = (yyvsp[0])->lasti; f->opcode = Op_indirect_func_call; name = estrdup(f->func_name, strlen(f->func_name)); @@ -3945,7 +3945,7 @@ regular_print: (yyval) = list_create((yyvsp[-3])); } else { INSTRUCTION *t = (yyvsp[-1]); - ((yyvsp[-3]) + 1)->expr_count = count_expressions(&t, true); + ((yyvsp[-3]) + 1)->expr_count = count_expressions(&t, true); (yyval) = list_append(t, (yyvsp[-3])); } } @@ -3993,7 +3993,7 @@ regular_print: case 179: #line 1878 "awkgram.y" /* yacc.c:1646 */ { - INSTRUCTION *ip = (yyvsp[0])->lasti; + INSTRUCTION *ip = (yyvsp[0])->lasti; int count = ip->sub_count; /* # of SUBSEP-seperated expressions */ if (count > 1) { /* change Op_subscript or Op_sub_array to Op_concat */ @@ -4018,7 +4018,7 @@ regular_print: /* install Null string as subscript. */ t = list_create(instruction(Op_push_i)); t->nexti->memory = dupnode(Nnull_string); - (yyvsp[0])->sub_count = 1; + (yyvsp[0])->sub_count = 1; } else (yyvsp[0])->sub_count = count_expressions(&t, false); (yyval) = list_append(t, (yyvsp[0])); @@ -4393,7 +4393,7 @@ struct token { # define BREAK 0x0800 /* break allowed inside */ # define CONTINUE 0x1000 /* continue allowed inside */ # define DEBUG_USE 0x2000 /* for use by developers */ - + NODE *(*ptr)(int); /* function that implements this keyword */ NODE *(*ptr2)(int); /* alternate arbitrary-precision function */ }; @@ -4525,7 +4525,7 @@ getfname(NODE *(*fptr)(int)) j = sizeof(tokentab) / sizeof(tokentab[0]); /* linear search, no other way to do it */ - for (i = 0; i < j; i++) + for (i = 0; i < j; i++) if (tokentab[i].ptr == fptr || tokentab[i].ptr2 == fptr) return tokentab[i].operator; @@ -4598,7 +4598,7 @@ print_included_from() int saveline, line; SRCFILE *s; - /* suppress current file name, line # from `.. included from ..' msgs */ + /* suppress current file name, line # from `.. included from ..' msgs */ saveline = sourceline; sourceline = 0; @@ -4799,7 +4799,7 @@ mk_program() if (prog_block == NULL) { if (end_block->nexti == end_block->lasti - && beginfile_block->nexti == beginfile_block->lasti + && beginfile_block->nexti == beginfile_block->lasti && endfile_block->nexti == endfile_block->lasti ) { /* no pattern-action and (real) end, beginfile or endfile blocks */ @@ -4816,7 +4816,7 @@ mk_program() cp = list_merge(begin_block, end_block); if (program_comment != NULL) { (void) list_prepend(cp, program_comment); - } + } if (comment != NULL) (void) list_append(cp, comment); (void) list_append(cp, ip_atexit); @@ -4841,7 +4841,7 @@ mk_program() (void) list_prepend(prog_block, ip_rec); (void) list_append(prog_block, instruction(Op_jmp)); prog_block->lasti->target_jmp = ip_rec; - + list_append(beginfile_block, instruction(Op_after_beginfile)); cp = list_merge(beginfile_block, prog_block); @@ -4853,10 +4853,10 @@ mk_program() if (program_comment != NULL) { (void) list_prepend(cp, program_comment); - } + } if (comment != NULL) { (void) list_append(cp, comment); - } + } (void) list_append(cp, ip_atexit); (void) list_append(cp, instruction(Op_stop)); @@ -4874,7 +4874,7 @@ out: #undef end_block #undef prog_block #undef beginfile_block -#undef endfile_block +#undef endfile_block } /* parse_program --- read in the program and convert into a list of instructions */ @@ -5025,7 +5025,7 @@ add_srcfile(enum srctype stype, char *src, SRCFILE *thisfile, bool *already_incl *already_included = true; return NULL; } else { - /* duplicates are allowed for -f */ + /* duplicates are allowed for -f */ if (s->stype == SRC_INC) fatal(_("can't include `%s' and use it as a program file"), src); /* no need to scan for further matches, since @@ -5076,11 +5076,11 @@ include_source(INSTRUCTION *file) sourcefile->srclines = sourceline; sourcefile->lexptr = lexptr; sourcefile->lexend = lexend; - sourcefile->lexptr_begin = lexptr_begin; + sourcefile->lexptr_begin = lexptr_begin; sourcefile->lexeme = lexeme; sourcefile->lasttok = lasttok; - /* included file becomes the current source */ + /* included file becomes the current source */ sourcefile = s; lexptr = NULL; sourceline = 0; @@ -5387,7 +5387,7 @@ tokexpand() { static int toksize; int tokoffset; - + if (tokstart != NULL) { tokoffset = tok - tokstart; toksize *= 2; @@ -5455,7 +5455,7 @@ again: int idx, work_ring_idx = cur_ring_idx; mbstate_t tmp_state; size_t mbclen; - + for (idx = 0; lexptr + idx < lexend; idx++) { tmp_state = cur_mbstate; mbclen = mbrlen(lexptr, idx + 1, &tmp_state); @@ -5521,7 +5521,7 @@ check_comment(void) if (comment != NULL) { if (first_rule) { program_comment = comment; - } else + } else block_comment = comment; comment = NULL; } @@ -5722,7 +5722,7 @@ yylex(void) lasttok = 0; return SUBSCRIPT; } - + if (lasttok == LEX_EOF) /* error earlier in current source, must give up !! */ return 0; @@ -5757,7 +5757,7 @@ yylex(void) * * [..[..] []] [^]] [.../...] * [...\[...] [...\]...] [...\/...] - * + * * (Remember that all of the above are inside /.../) * * The code for \ handles \[, \] and \/. @@ -5786,7 +5786,7 @@ yylex(void) break; case ']': if (in_brack > 0 - && (cur_index == b_index + 1 + && (cur_index == b_index + 1 || (cur_index == b_index + 2 && tok[-1] == '^'))) ; /* do nothing */ else { @@ -5954,7 +5954,7 @@ retry: in_parens--; return lasttok = c; - case '(': + case '(': in_parens++; return lasttok = c; case '$': @@ -6057,7 +6057,7 @@ retry: did_warn_op = true; warning(_("operator `^' is not supported in old awk")); } - yylval = GET_INSTRUCTION(Op_exp); + yylval = GET_INSTRUCTION(Op_exp); return lasttok = '^'; } @@ -6180,7 +6180,7 @@ retry: yylval->lextok = estrdup(tokstart, tok - tokstart); return lasttok = FILENAME; } - + yylval->opcode = Op_push_i; yylval->memory = make_str_node(tokstart, tok - tokstart, esc_seen ? SCAN : 0); @@ -6512,7 +6512,7 @@ retry: case LEX_BEGIN: case LEX_END: case LEX_BEGINFILE: - case LEX_ENDFILE: + case LEX_ENDFILE: yylval = bcalloc(tokentab[mid].value, 3, sourceline); break; @@ -6561,7 +6561,7 @@ out: tokkey = estrdup(tokstart, tok - tokstart); if (*lexptr == '(') { yylval = bcalloc(Op_token, 2, sourceline); - yylval->lextok = tokkey; + yylval->lextok = tokkey; return lasttok = FUNC_CALL; } else { static bool goto_warned = false; @@ -6637,7 +6637,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) nexp++; } assert(nexp > 0); - } + } /* check against how many args. are allowed for this builtin */ args_allowed = tokentab[idx].flags & ARGS; @@ -6708,7 +6708,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) subn->lasti->assign_ctxt = Op_sub_builtin; } - return subn; + return subn; } else { /* gensub */ @@ -6737,16 +6737,16 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) /* special case processing for a few builtins */ if (r->builtin == do_length) { - if (nexp == 0) { + if (nexp == 0) { /* no args. Use $0 */ INSTRUCTION *list; - r->expr_count = 1; + r->expr_count = 1; list = list_create(r); (void) list_prepend(list, instruction(Op_field_spec)); (void) list_prepend(list, instruction(Op_push_i)); list->nexti->memory = make_profile_number(0.0, "0", 1); - return list; + return list; } else { arg = subn->nexti; if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push) @@ -7087,7 +7087,7 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def) return fi; } -/* +/* * install_function: * install function name in the symbol table. * Extra work, build up and install a list of the parameter names. @@ -7111,7 +7111,7 @@ install_function(char *fname, INSTRUCTION *fi, INSTRUCTION *plist) fi->func_body = f; f->param_cnt = pcount; f->code_ptr = fi; - f->fparms = NULL; + f->fparms = NULL; if (pcount > 0) { char **pnames; pnames = check_params(fname, pcount, plist); /* frees plist */ @@ -7168,7 +7168,7 @@ check_params(char *fname, int pcount, INSTRUCTION *list) } bcfree(list); - return pnames; + return pnames; } @@ -7176,7 +7176,7 @@ check_params(char *fname, int pcount, INSTRUCTION *list) undef HASHSIZE #endif #define HASHSIZE 1021 - + static struct fdesc { char *name; short used; @@ -7238,7 +7238,7 @@ check_funcs() if (! in_main_context()) goto free_mem; - + for (i = 0; i < HASHSIZE; i++) { for (fp = ftable[i]; fp != NULL; fp = fp->next) { #ifdef REALLYMEAN @@ -7578,7 +7578,7 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION *op) break; default: goto regular; - } + } op->memory = ip2->memory; bcfree(ip2); @@ -7594,7 +7594,7 @@ regular: } /* mk_boolean --- instructions for boolean and, or */ - + static INSTRUCTION * mk_boolean(INSTRUCTION *left, INSTRUCTION *right, INSTRUCTION *op) { @@ -7622,7 +7622,7 @@ mk_boolean(INSTRUCTION *left, INSTRUCTION *right, INSTRUCTION *op) right->lasti->target_stmt = left->lasti; } else { /* optimization for x || y || z || ... */ INSTRUCTION *ip; - + op->opcode = final_opc; (void) list_append(right, op); op->target_stmt = tp; @@ -7659,7 +7659,7 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch, * * ---------------- * [Op_jmp y] - * ---------------- + * ---------------- * f: * false_branch * ---------------- @@ -7821,7 +7821,7 @@ append_rule(INSTRUCTION *pattern, INSTRUCTION *action) rule_block[rule] = ip; else (void) list_merge(rule_block[rule], ip); - + return rule_block[rule]; } @@ -7843,7 +7843,7 @@ mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op) break; case Op_push: case Op_push_array: - tp->opcode = Op_push_lhs; + tp->opcode = Op_push_lhs; break; case Op_field_assign: yyerror(_("cannot assign a value to the result of a field post-increment expression")); @@ -7898,7 +7898,7 @@ optimize_assignment(INSTRUCTION *exp) * Replaces Op_push_array + Op_subscript_lhs + Op_assign + Op_pop * with single instruction Op_store_sub. * Limitation: 1 dimension and sub is simple var/value. - * + * * 2) Simple variable assignment var = x: * Replaces Op_push_lhs + Op_assign + Op_pop with Op_store_var. * @@ -7922,7 +7922,7 @@ optimize_assignment(INSTRUCTION *exp) i1 = exp->lasti; if ( i1->opcode != Op_assign - && i1->opcode != Op_field_assign) + && i1->opcode != Op_field_assign) return list_append(exp, instruction(Op_pop)); for (i2 = exp->nexti; i2 != i1; i2 = i2->nexti) { @@ -7997,7 +7997,7 @@ optimize_assignment(INSTRUCTION *exp) * so use expr_count instead. */ i3->nexti = NULL; - i2->opcode = Op_no_op; + i2->opcode = Op_no_op; bcfree(i1); /* Op_assign */ exp->lasti = i3; /* update Op_list */ return exp; @@ -8020,7 +8020,7 @@ optimize_assignment(INSTRUCTION *exp) && (i3->memory->flags & INTLSTR) == 0 && i3->nexti == i2 ) { - /* constant initializer */ + /* constant initializer */ i2->initval = i3->memory; bcfree(i3); exp->nexti = i2; @@ -8056,7 +8056,7 @@ mk_getline(INSTRUCTION *op, INSTRUCTION *var, INSTRUCTION *redir, int redirtype) * [ file (simp_exp)] * [ [ var ] ] * [ Op_K_getline_redir|NULL|redir_type|into_var] - * [ [var_assign] ] + * [ [var_assign] ] * */ @@ -8065,7 +8065,7 @@ mk_getline(INSTRUCTION *op, INSTRUCTION *var, INSTRUCTION *redir, int redirtype) bcfree(op); op = bcalloc(Op_K_getline, 2, sline); (op + 1)->target_endfile = ip_endfile; - (op + 1)->target_beginfile = ip_beginfile; + (op + 1)->target_beginfile = ip_beginfile; } if (var != NULL) { @@ -8123,11 +8123,11 @@ mk_for_loop(INSTRUCTION *forp, INSTRUCTION *init, INSTRUCTION *cond, * ------------------------ * body (may be NULL) * ------------------------ - * tc: + * tc: * incr (may be NULL) - * [ Op_jmp x ] + * [ Op_jmp x ] * ------------------------ - * tb:[ Op_no_op ] + * tb:[ Op_no_op ] */ INSTRUCTION *ip, *tbreak, *tcont; @@ -8239,7 +8239,7 @@ mk_expression_list(INSTRUCTION *list, INSTRUCTION *s1) /* we can't just combine all bytecodes, since we need to * process individual expressions for a few builtins in snode() (-: */ - + /* -- list of lists */ /* [Op_list| ... ]------ * | @@ -8295,7 +8295,7 @@ count_expressions(INSTRUCTION **list, bool isarg) (void) list_merge(r, expr); expr = t2->nexti; } - + assert(count > 0); if (! isarg && count > max_args) max_args = count; @@ -8561,7 +8561,7 @@ install_builtins(void) * The scene of the murder was grisly to look upon. When the inspector * arrived, the sergeant turned to him and said, "Another programmer stabbed * in the back. He never knew what happened." - * + * * The inspector replied, "Looks like the MO of isalpha, and his even meaner * big brother, isalnum. The Locale brothers." The sergeant merely * shuddered in horror. @@ -2,7 +2,7 @@ * awkgram.y --- yacc/bison parser */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2016 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the @@ -40,7 +40,7 @@ static void lintwarn_ln(int line, const char *m, ...) ATTRIBUTE_PRINTF_2; static void warning_ln(int line, const char *m, ...) ATTRIBUTE_PRINTF_2; static char *get_src_buf(void); static int yylex(void); -int yyparse(void); +int yyparse(void); static INSTRUCTION *snode(INSTRUCTION *subn, INSTRUCTION *op); static char **check_params(char *fname, int pcount, INSTRUCTION *list); static int install_function(char *fname, INSTRUCTION *fi, INSTRUCTION *plist); @@ -115,7 +115,7 @@ static char *lexptr; /* pointer to next char during parsing */ static char *lexend; /* end of buffer */ static char *lexptr_begin; /* keep track of where we were for error msgs */ static char *lexeme; /* beginning of lexeme for debugging */ -static bool 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; @@ -181,7 +181,7 @@ extern double fmod(double x, double y); %token LEX_BEGIN LEX_END LEX_IF LEX_ELSE LEX_RETURN LEX_DELETE %token LEX_SWITCH LEX_CASE LEX_DEFAULT LEX_WHILE LEX_DO LEX_FOR LEX_BREAK LEX_CONTINUE %token LEX_PRINT LEX_PRINTF LEX_NEXT LEX_EXIT LEX_FUNCTION -%token LEX_BEGINFILE LEX_ENDFILE +%token LEX_BEGINFILE LEX_ENDFILE %token LEX_GETLINE LEX_NEXTFILE %token LEX_IN %token LEX_AND LEX_OR INCREMENT DECREMENT @@ -322,7 +322,7 @@ pattern } else $$ = $1; } - + | exp ',' opt_nls exp { INSTRUCTION *tp; @@ -433,7 +433,7 @@ lex_builtin : LEX_BUILTIN | LEX_LENGTH ; - + function_prologue : LEX_FUNCTION func_name '(' { want_param_names = FUNC_HEADER; } opt_param_list r_paren opt_nls { @@ -608,7 +608,7 @@ statement int case_count = 0; int i; - tbreak = instruction(Op_no_op); + tbreak = instruction(Op_no_op); cstmt = list_create(tbreak); cexp = list_create(instruction(Op_pop)); dflt = instruction(Op_jmp); @@ -635,7 +635,7 @@ statement error_ln(curr->source_line, _("duplicate case values in switch body: %s"), caseval); } - + if (case_values == NULL) emalloc(case_values, const char **, sizeof(char *) * maxcount, "statement"); else if (case_count >= maxcount) { @@ -686,18 +686,18 @@ statement (void) list_merge(ip, cexp); $$ = list_merge(ip, cstmt); - break_allowed--; + break_allowed--; fix_break_continue(ip, tbreak, NULL); } | LEX_WHILE '(' exp r_paren opt_nls statement - { + { /* * ----------------- * tc: * cond * ----------------- * [Op_jmp_false tb ] - * ----------------- + * ----------------- * body * ----------------- * [Op_jmp tc ] @@ -738,7 +738,7 @@ statement * z: * body * ----------------- - * tc: + * tc: * cond * ----------------- * [Op_jmp_true | z ] @@ -785,7 +785,7 @@ statement && ($8->nexti->memory->type != Node_var || !($8->nexti->memory->var_update)) && strcmp($8->nexti->memory->vname, var_name) == 0 ) { - + /* Efficiency hack. Recognize the special case of * * for (iggy in foo) @@ -797,10 +797,10 @@ statement * * Check that the body is a `delete a[i]' statement, * and that both the loop var and array names match. - */ + */ NODE *arr = NULL; - ip = $8->nexti->nexti; + ip = $8->nexti->nexti; if ($5->nexti->opcode == Op_push && $5->lasti == $5->nexti) arr = $5->nexti->memory; if (arr != NULL @@ -826,7 +826,7 @@ statement /* [ Op_push_array a ] * [ Op_arrayfor_init | ib ] - * ic:[ Op_arrayfor_incr | ib ] + * ic:[ Op_arrayfor_incr | ib ] * [ Op_var_assign if any ] * * body @@ -855,7 +855,7 @@ regular_loop: } /* else $1 is NULL */ - /* add update_FOO instruction if necessary */ + /* add update_FOO instruction if necessary */ if ($4->array_var->type == Node_var && $4->array_var->var_update) { (void) list_append(ip, instruction(Op_var_update)); ip->lasti->update_var = $4->array_var->var_update; @@ -871,7 +871,7 @@ regular_loop: if (do_pretty_print) { (void) list_append(ip, instruction(Op_exec_count)); ($1 + 1)->forloop_cond = $4; - ($1 + 1)->forloop_body = ip->lasti; + ($1 + 1)->forloop_body = ip->lasti; } if ($8 != NULL) @@ -881,7 +881,7 @@ regular_loop: ip->lasti->target_jmp = $4; $$ = list_append(ip, tbreak); fix_break_continue(ip, tbreak, tcont); - } + } break_allowed--; continue_allowed--; @@ -912,7 +912,7 @@ regular_loop: non_compound_stmt : LEX_BREAK statement_term - { + { if (! break_allowed) error_ln($1->source_line, _("`break' is not allowed outside a loop or switch")); @@ -956,7 +956,7 @@ non_compound_stmt | LEX_EXIT opt_exp statement_term { /* Initialize the two possible jump targets, the actual target - * is resolved at run-time. + * is resolved at run-time. */ $1->target_end = ip_end; /* first instruction in end_block */ $1->target_atexit = ip_atexit; /* cleanup and go home */ @@ -1074,7 +1074,7 @@ simple_stmt * [$1 | NULL | redir_type | expr_count] * */ -regular_print: +regular_print: if ($4 == NULL) { /* no redirection */ if ($3 == NULL) { /* printf without arg */ $1->expr_count = 0; @@ -1138,7 +1138,7 @@ regular_print: $$ = list_append(list_append($4, $2), $1); } $$ = add_pending_comment($$); - } + } | LEX_DELETE '(' NAME ')' /* * this is for tawk compatibility. maybe the warnings @@ -1203,7 +1203,7 @@ case_statement { INSTRUCTION *casestmt = $5; if ($5 == NULL) - casestmt = list_create(instruction(Op_no_op)); + casestmt = list_create(instruction(Op_no_op)); if (do_pretty_print) (void) list_prepend(casestmt, instruction(Op_exec_count)); $1->case_exp = $2; @@ -1228,7 +1228,7 @@ case_value : YNUMBER { $$ = $1; } | '-' YNUMBER %prec UNARY - { + { NODE *n = $2->memory; (void) force_number(n); negate_num(n); @@ -1242,9 +1242,9 @@ case_value add_sign_to_num(n, '+'); $$ = $2; } - | YSTRING + | YSTRING { $$ = $1; } - | regexp + | regexp { if ($1->memory->type == Node_regex) $1->opcode = Op_push_re; @@ -1497,7 +1497,7 @@ assign_operator | ASSIGNOP { $$ = $1; } | SLASH_BEFORE_EQUAL ASSIGN /* `/=' */ - { + { $2->opcode = Op_assign_quotient; $$ = $2; } @@ -1752,7 +1752,7 @@ non_post_simp_exp ) { NODE *n = $2->lasti->memory; (void) force_number(n); - negate_num(n); + negate_num(n); $$ = $2; bcfree($1); } else { @@ -1801,7 +1801,7 @@ func_call warned = true; lintwarn("%s", msg); } - + f = $2->lasti; f->opcode = Op_indirect_func_call; name = estrdup(f->func_name, strlen(f->func_name)); @@ -1844,7 +1844,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); } } @@ -1876,7 +1876,7 @@ delete_subscript delete_exp_list : bracketed_exp_list { - INSTRUCTION *ip = $1->lasti; + INSTRUCTION *ip = $1->lasti; int count = ip->sub_count; /* # of SUBSEP-seperated expressions */ if (count > 1) { /* change Op_subscript or Op_sub_array to Op_concat */ @@ -1900,7 +1900,7 @@ bracketed_exp_list /* install Null string as subscript. */ t = list_create(instruction(Op_push_i)); t->nexti->memory = dupnode(Nnull_string); - $3->sub_count = 1; + $3->sub_count = 1; } else $3->sub_count = count_expressions(&t, false); $$ = list_append(t, $3); @@ -2016,7 +2016,7 @@ struct token { # define BREAK 0x0800 /* break allowed inside */ # define CONTINUE 0x1000 /* continue allowed inside */ # define DEBUG_USE 0x2000 /* for use by developers */ - + NODE *(*ptr)(int); /* function that implements this keyword */ NODE *(*ptr2)(int); /* alternate arbitrary-precision function */ }; @@ -2148,7 +2148,7 @@ getfname(NODE *(*fptr)(int)) j = sizeof(tokentab) / sizeof(tokentab[0]); /* linear search, no other way to do it */ - for (i = 0; i < j; i++) + for (i = 0; i < j; i++) if (tokentab[i].ptr == fptr || tokentab[i].ptr2 == fptr) return tokentab[i].operator; @@ -2221,7 +2221,7 @@ print_included_from() int saveline, line; SRCFILE *s; - /* suppress current file name, line # from `.. included from ..' msgs */ + /* suppress current file name, line # from `.. included from ..' msgs */ saveline = sourceline; sourceline = 0; @@ -2422,7 +2422,7 @@ mk_program() if (prog_block == NULL) { if (end_block->nexti == end_block->lasti - && beginfile_block->nexti == beginfile_block->lasti + && beginfile_block->nexti == beginfile_block->lasti && endfile_block->nexti == endfile_block->lasti ) { /* no pattern-action and (real) end, beginfile or endfile blocks */ @@ -2439,7 +2439,7 @@ mk_program() cp = list_merge(begin_block, end_block); if (program_comment != NULL) { (void) list_prepend(cp, program_comment); - } + } if (comment != NULL) (void) list_append(cp, comment); (void) list_append(cp, ip_atexit); @@ -2464,7 +2464,7 @@ mk_program() (void) list_prepend(prog_block, ip_rec); (void) list_append(prog_block, instruction(Op_jmp)); prog_block->lasti->target_jmp = ip_rec; - + list_append(beginfile_block, instruction(Op_after_beginfile)); cp = list_merge(beginfile_block, prog_block); @@ -2476,10 +2476,10 @@ mk_program() if (program_comment != NULL) { (void) list_prepend(cp, program_comment); - } + } if (comment != NULL) { (void) list_append(cp, comment); - } + } (void) list_append(cp, ip_atexit); (void) list_append(cp, instruction(Op_stop)); @@ -2497,7 +2497,7 @@ out: #undef end_block #undef prog_block #undef beginfile_block -#undef endfile_block +#undef endfile_block } /* parse_program --- read in the program and convert into a list of instructions */ @@ -2648,7 +2648,7 @@ add_srcfile(enum srctype stype, char *src, SRCFILE *thisfile, bool *already_incl *already_included = true; return NULL; } else { - /* duplicates are allowed for -f */ + /* duplicates are allowed for -f */ if (s->stype == SRC_INC) fatal(_("can't include `%s' and use it as a program file"), src); /* no need to scan for further matches, since @@ -2699,11 +2699,11 @@ include_source(INSTRUCTION *file) sourcefile->srclines = sourceline; sourcefile->lexptr = lexptr; sourcefile->lexend = lexend; - sourcefile->lexptr_begin = lexptr_begin; + sourcefile->lexptr_begin = lexptr_begin; sourcefile->lexeme = lexeme; sourcefile->lasttok = lasttok; - /* included file becomes the current source */ + /* included file becomes the current source */ sourcefile = s; lexptr = NULL; sourceline = 0; @@ -3010,7 +3010,7 @@ tokexpand() { static int toksize; int tokoffset; - + if (tokstart != NULL) { tokoffset = tok - tokstart; toksize *= 2; @@ -3078,7 +3078,7 @@ again: int idx, work_ring_idx = cur_ring_idx; mbstate_t tmp_state; size_t mbclen; - + for (idx = 0; lexptr + idx < lexend; idx++) { tmp_state = cur_mbstate; mbclen = mbrlen(lexptr, idx + 1, &tmp_state); @@ -3144,7 +3144,7 @@ check_comment(void) if (comment != NULL) { if (first_rule) { program_comment = comment; - } else + } else block_comment = comment; comment = NULL; } @@ -3345,7 +3345,7 @@ yylex(void) lasttok = 0; return SUBSCRIPT; } - + if (lasttok == LEX_EOF) /* error earlier in current source, must give up !! */ return 0; @@ -3380,7 +3380,7 @@ yylex(void) * * [..[..] []] [^]] [.../...] * [...\[...] [...\]...] [...\/...] - * + * * (Remember that all of the above are inside /.../) * * The code for \ handles \[, \] and \/. @@ -3409,7 +3409,7 @@ yylex(void) break; case ']': if (in_brack > 0 - && (cur_index == b_index + 1 + && (cur_index == b_index + 1 || (cur_index == b_index + 2 && tok[-1] == '^'))) ; /* do nothing */ else { @@ -3577,7 +3577,7 @@ retry: in_parens--; return lasttok = c; - case '(': + case '(': in_parens++; return lasttok = c; case '$': @@ -3680,7 +3680,7 @@ retry: did_warn_op = true; warning(_("operator `^' is not supported in old awk")); } - yylval = GET_INSTRUCTION(Op_exp); + yylval = GET_INSTRUCTION(Op_exp); return lasttok = '^'; } @@ -3803,7 +3803,7 @@ retry: yylval->lextok = estrdup(tokstart, tok - tokstart); return lasttok = FILENAME; } - + yylval->opcode = Op_push_i; yylval->memory = make_str_node(tokstart, tok - tokstart, esc_seen ? SCAN : 0); @@ -4135,7 +4135,7 @@ retry: case LEX_BEGIN: case LEX_END: case LEX_BEGINFILE: - case LEX_ENDFILE: + case LEX_ENDFILE: yylval = bcalloc(tokentab[mid].value, 3, sourceline); break; @@ -4184,7 +4184,7 @@ out: tokkey = estrdup(tokstart, tok - tokstart); if (*lexptr == '(') { yylval = bcalloc(Op_token, 2, sourceline); - yylval->lextok = tokkey; + yylval->lextok = tokkey; return lasttok = FUNC_CALL; } else { static bool goto_warned = false; @@ -4260,7 +4260,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) nexp++; } assert(nexp > 0); - } + } /* check against how many args. are allowed for this builtin */ args_allowed = tokentab[idx].flags & ARGS; @@ -4331,7 +4331,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) subn->lasti->assign_ctxt = Op_sub_builtin; } - return subn; + return subn; } else { /* gensub */ @@ -4360,16 +4360,16 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) /* special case processing for a few builtins */ if (r->builtin == do_length) { - if (nexp == 0) { + if (nexp == 0) { /* no args. Use $0 */ INSTRUCTION *list; - r->expr_count = 1; + r->expr_count = 1; list = list_create(r); (void) list_prepend(list, instruction(Op_field_spec)); (void) list_prepend(list, instruction(Op_push_i)); list->nexti->memory = make_profile_number(0.0, "0", 1); - return list; + return list; } else { arg = subn->nexti; if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push) @@ -4710,7 +4710,7 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def) return fi; } -/* +/* * install_function: * install function name in the symbol table. * Extra work, build up and install a list of the parameter names. @@ -4734,7 +4734,7 @@ install_function(char *fname, INSTRUCTION *fi, INSTRUCTION *plist) fi->func_body = f; f->param_cnt = pcount; f->code_ptr = fi; - f->fparms = NULL; + f->fparms = NULL; if (pcount > 0) { char **pnames; pnames = check_params(fname, pcount, plist); /* frees plist */ @@ -4791,7 +4791,7 @@ check_params(char *fname, int pcount, INSTRUCTION *list) } bcfree(list); - return pnames; + return pnames; } @@ -4799,7 +4799,7 @@ check_params(char *fname, int pcount, INSTRUCTION *list) undef HASHSIZE #endif #define HASHSIZE 1021 - + static struct fdesc { char *name; short used; @@ -4861,7 +4861,7 @@ check_funcs() if (! in_main_context()) goto free_mem; - + for (i = 0; i < HASHSIZE; i++) { for (fp = ftable[i]; fp != NULL; fp = fp->next) { #ifdef REALLYMEAN @@ -5201,7 +5201,7 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION *op) break; default: goto regular; - } + } op->memory = ip2->memory; bcfree(ip2); @@ -5217,7 +5217,7 @@ regular: } /* mk_boolean --- instructions for boolean and, or */ - + static INSTRUCTION * mk_boolean(INSTRUCTION *left, INSTRUCTION *right, INSTRUCTION *op) { @@ -5245,7 +5245,7 @@ mk_boolean(INSTRUCTION *left, INSTRUCTION *right, INSTRUCTION *op) right->lasti->target_stmt = left->lasti; } else { /* optimization for x || y || z || ... */ INSTRUCTION *ip; - + op->opcode = final_opc; (void) list_append(right, op); op->target_stmt = tp; @@ -5282,7 +5282,7 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch, * * ---------------- * [Op_jmp y] - * ---------------- + * ---------------- * f: * false_branch * ---------------- @@ -5444,7 +5444,7 @@ append_rule(INSTRUCTION *pattern, INSTRUCTION *action) rule_block[rule] = ip; else (void) list_merge(rule_block[rule], ip); - + return rule_block[rule]; } @@ -5466,7 +5466,7 @@ mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op) break; case Op_push: case Op_push_array: - tp->opcode = Op_push_lhs; + tp->opcode = Op_push_lhs; break; case Op_field_assign: yyerror(_("cannot assign a value to the result of a field post-increment expression")); @@ -5521,7 +5521,7 @@ optimize_assignment(INSTRUCTION *exp) * Replaces Op_push_array + Op_subscript_lhs + Op_assign + Op_pop * with single instruction Op_store_sub. * Limitation: 1 dimension and sub is simple var/value. - * + * * 2) Simple variable assignment var = x: * Replaces Op_push_lhs + Op_assign + Op_pop with Op_store_var. * @@ -5545,7 +5545,7 @@ optimize_assignment(INSTRUCTION *exp) i1 = exp->lasti; if ( i1->opcode != Op_assign - && i1->opcode != Op_field_assign) + && i1->opcode != Op_field_assign) return list_append(exp, instruction(Op_pop)); for (i2 = exp->nexti; i2 != i1; i2 = i2->nexti) { @@ -5620,7 +5620,7 @@ optimize_assignment(INSTRUCTION *exp) * so use expr_count instead. */ i3->nexti = NULL; - i2->opcode = Op_no_op; + i2->opcode = Op_no_op; bcfree(i1); /* Op_assign */ exp->lasti = i3; /* update Op_list */ return exp; @@ -5643,7 +5643,7 @@ optimize_assignment(INSTRUCTION *exp) && (i3->memory->flags & INTLSTR) == 0 && i3->nexti == i2 ) { - /* constant initializer */ + /* constant initializer */ i2->initval = i3->memory; bcfree(i3); exp->nexti = i2; @@ -5679,7 +5679,7 @@ mk_getline(INSTRUCTION *op, INSTRUCTION *var, INSTRUCTION *redir, int redirtype) * [ file (simp_exp)] * [ [ var ] ] * [ Op_K_getline_redir|NULL|redir_type|into_var] - * [ [var_assign] ] + * [ [var_assign] ] * */ @@ -5688,7 +5688,7 @@ mk_getline(INSTRUCTION *op, INSTRUCTION *var, INSTRUCTION *redir, int redirtype) bcfree(op); op = bcalloc(Op_K_getline, 2, sline); (op + 1)->target_endfile = ip_endfile; - (op + 1)->target_beginfile = ip_beginfile; + (op + 1)->target_beginfile = ip_beginfile; } if (var != NULL) { @@ -5746,11 +5746,11 @@ mk_for_loop(INSTRUCTION *forp, INSTRUCTION *init, INSTRUCTION *cond, * ------------------------ * body (may be NULL) * ------------------------ - * tc: + * tc: * incr (may be NULL) - * [ Op_jmp x ] + * [ Op_jmp x ] * ------------------------ - * tb:[ Op_no_op ] + * tb:[ Op_no_op ] */ INSTRUCTION *ip, *tbreak, *tcont; @@ -5862,7 +5862,7 @@ mk_expression_list(INSTRUCTION *list, INSTRUCTION *s1) /* we can't just combine all bytecodes, since we need to * process individual expressions for a few builtins in snode() (-: */ - + /* -- list of lists */ /* [Op_list| ... ]------ * | @@ -5918,7 +5918,7 @@ count_expressions(INSTRUCTION **list, bool isarg) (void) list_merge(r, expr); expr = t2->nexti; } - + assert(count > 0); if (! isarg && count > max_args) max_args = count; @@ -6184,7 +6184,7 @@ install_builtins(void) * The scene of the murder was grisly to look upon. When the inspector * arrived, the sergeant turned to him and said, "Another programmer stabbed * in the back. He never knew what happened." - * + * * The inspector replied, "Looks like the MO of isalpha, and his even meaner * big brother, isalnum. The Locale brothers." The sergeant merely * shuddered in horror. @@ -2,22 +2,22 @@ * builtin.c - Builtin functions and various utility procedures. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-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 @@ -193,9 +193,9 @@ do_fflush(int nargs) /* * November, 2012. - * It turns out that circa 2002, when BWK + * It turns out that circa 2002, when BWK * added fflush() and fflush("") to his awk, he made both of - * them flush everything. + * them flush everything. * * Now, with our inside agent getting ready to try to get fflush() * standardized in POSIX, we are going to make our awk consistent @@ -386,7 +386,7 @@ do_index(int nargs) * If we don't have valid wide character strings, use * the real bytes. */ - do_single_byte = ((s1->wstlen == 0 && s1->stlen > 0) + do_single_byte = ((s1->wstlen == 0 && s1->stlen > 0) || (s2->wstlen == 0 && s2->stlen > 0)); } @@ -521,7 +521,7 @@ do_length(int nargs) /* * Support for deferred loading of array elements requires that - * we use the array length interface even though it isn't + * we use the array length interface even though it isn't * necessary for the built-in array types. * * 1/2015: The deferred arrays are gone, but this is probably @@ -962,7 +962,7 @@ check_pos: case ' ': /* print ' ' or '-' */ /* 'space' flag is ignored */ /* if '+' already present */ - if (signchar != false) + if (signchar != false) goto check_pos; /* FALL THROUGH */ case '+': /* print '+' or '-' */ @@ -988,18 +988,18 @@ check_pos: alt = true; goto check_pos; case '\'': -#if defined(HAVE_LOCALE_H) +#if defined(HAVE_LOCALE_H) quote_flag = true; goto check_pos; #else - goto retry; + goto retry; #endif case 'l': if (big_flag) break; else { static bool warned = false; - + if (do_lint && ! warned) { lintwarn(_("`l' is meaningless in awk formats; ignored")); warned = true; @@ -1016,7 +1016,7 @@ check_pos: break; else { static bool warned = false; - + if (do_lint && ! warned) { lintwarn(_("`L' is meaningless in awk formats; ignored")); warned = true; @@ -1033,7 +1033,7 @@ check_pos: break; else { static bool warned = false; - + if (do_lint && ! warned) { lintwarn(_("`h' is meaningless in awk formats; ignored")); warned = true; @@ -1219,7 +1219,7 @@ out0: jj = 0; /* keep using current val in loc.grouping[ii] */ else if (loc.grouping[ii+1] == CHAR_MAX) quote_flag = false; - else { + else { ii++; jj = 0; } @@ -1334,7 +1334,7 @@ mpf1: zero_flag = (! lj && ((zero_flag && ! have_prec) || (fw == 0 && have_prec))); - + (void) mpfr_get_z(mpzval, mf, MPFR_RNDZ); /* convert to GMP integer */ fmt_type = have_prec ? MP_INT_WITH_PREC : MP_INT_WITHOUT_PREC; zi = mpzval; @@ -1399,11 +1399,11 @@ mpf1: PREPEND(ts[k]); } } - if (loc.grouping[ii+1] == 0) + if (loc.grouping[ii+1] == 0) jj = 0; /* keep using current val in loc.grouping[ii] */ - else if (loc.grouping[ii+1] == CHAR_MAX) + else if (loc.grouping[ii+1] == CHAR_MAX) quote_flag = false; - else { + else { ii++; jj = 0; } @@ -1964,7 +1964,7 @@ do_strftime(int nargs) tmp = POP_SCALAR(); if (do_lint && (fixtype(tmp)->flags & STRING) == 0) lintwarn(_("strftime: received non-string first argument")); - + t1 = force_string(tmp); format = t1->stptr; formatlen = t1->stlen; @@ -2225,7 +2225,7 @@ do_print(int nargs, int redirtype) /* do_print_rec --- special case printing of $0, for speed */ -void +void do_print_rec(int nargs, int redirtype) { FILE *fp = NULL; @@ -2494,11 +2494,11 @@ do_rand(int nargs ATTRIBUTE_UNUSED) * that when the values of successive values are combined * like (rand1*rand2)^2, (rand3*rand4)^2, ... the * resulting time series is not white noise. The - * following also seems to fix that bug. + * following also seems to fix that bug. * * The add/subtract 0.5 keeps small bits from filling * below 2^-53 in the double, not that anyone should be - * looking down there. + * looking down there. * * Date: Wed, 25 Sep 2013 10:45:38 -0600 (MDT) * From: "Nelson H. F. Beebe" <beebe@math.utah.edu> @@ -2506,32 +2506,32 @@ do_rand(int nargs ATTRIBUTE_UNUSED) * from integer to floating-point, and I discuss the serious pitfalls * in my book, because it leads to platform-dependent behavior at the * end points of the interval [0,1] - * + * * (5) the documentation in the gawk info node says - * + * * `rand()' * Return a random number. The values of `rand()' are uniformly * distributed between zero and one. The value could be zero but is * never one.(1) - * + * * The division by RAND_DIVISOR may not guarantee that 1.0 is never * returned: the programmer forgot the platform-dependent issue of * rounding. - * + * * For points 4 and 5, the safe way is a loop: - * - * double + * + * double * rand(void) // return value in [0.0, 1.0) * { * value = internal_rand(); * - * while (value == 1.0) + * while (value == 1.0) * value = internal_rand(); - * + * * return (value); * } */ - + do { long d1, d2; /* @@ -2605,7 +2605,7 @@ do_match(int nargs) tre = POP(); rp = re_update(tre); t1 = POP_STRING(); - + rstart = research(rp, t1->stptr, 0, t1->stlen, RE_NEED_START); if (rstart >= 0) { /* match succeded */ size_t *wc_indices = NULL; @@ -2618,7 +2618,7 @@ do_match(int nargs) } rstart++; /* now it's 1-based indexing */ - + /* Build the array only if the caller wants the optional subpatterns */ if (dest != NULL) { subsepstr = SUBSEP_node->var_value->stptr; @@ -2634,7 +2634,7 @@ do_match(int nargs) size_t subpat_len; NODE **lhs; NODE *sub; - + start = t1->stptr + s; subpat_start = s; subpat_len = len = SUBPATEND(rp, t1->stptr, ii) - s; @@ -2642,7 +2642,7 @@ do_match(int nargs) subpat_start = wc_indices[s]; subpat_len = wc_indices[s + len - 1] - subpat_start + 1; } - + it = make_string(start, len); it->flags |= MAYBE_NUM; /* user input */ @@ -2658,7 +2658,7 @@ do_match(int nargs) sprintf(buff, "%d", ii); ilen = strlen(buff); amt = ilen + subseplen + strlen("length") + 1; - + if (oldamt == 0) { emalloc(buf, char *, amt, "do_match"); } else if (amt > oldamt) { @@ -2668,9 +2668,9 @@ do_match(int nargs) memcpy(buf, buff, ilen); memcpy(buf + ilen, subsepstr, subseplen); memcpy(buf + ilen + subseplen, "start", 6); - + slen = ilen + subseplen + 5; - + it = make_number((AWKNUM) subpat_start + 1); sub = make_string(buf, slen); lhs = assoc_lookup(dest, sub); @@ -2679,13 +2679,13 @@ do_match(int nargs) if (dest->astore != NULL) (*dest->astore)(dest, sub); unref(sub); - + memcpy(buf, buff, ilen); memcpy(buf + ilen, subsepstr, subseplen); memcpy(buf + ilen + subseplen, "length", 7); - + slen = ilen + subseplen + 6; - + it = make_number((AWKNUM) subpat_len); sub = make_string(buf, slen); lhs = assoc_lookup(dest, sub); @@ -2720,9 +2720,9 @@ do_match(int nargs) * Gsub can be tricksy; particularly when handling the case of null strings. * The following awk code was useful in debugging problems. It is too bad * that it does not readily translate directly into the C code, below. - * + * * #! /usr/local/bin/mawk -f - * + * * BEGIN { * true = 1; false = 0 * print "--->", mygsub("abc", "b+", "FOO") @@ -2732,7 +2732,7 @@ do_match(int nargs) * print "--->", mygsub("abc", "c+", "X") * print "--->", mygsub("abc", "x*$", "X") * } - * + * * function mygsub(str, regex, replace, origstr, newstr, eosflag, nonzeroflag) * { * origstr = str; @@ -2770,7 +2770,7 @@ do_match(int nargs) * } * if (length(str) > 0) * newstr = newstr str # rest of string - * + * * return newstr * } */ @@ -2782,7 +2782,7 @@ do_match(int nargs) * * The relevant text is to be found on lines 6394-6407 (pages 166, 167) of the * 2001 standard: - * + * * sub(ere, repl[, in ]) * Substitute the string repl in place of the first instance of the * extended regular expression ERE in string in and return the number of @@ -2840,7 +2840,7 @@ do_sub(int nargs, unsigned int flags) long current; bool lastmatchnonzero; char *mb_indices = NULL; - + if ((flags & GENSUB) != 0) { double d; NODE *glob_flag; @@ -3046,7 +3046,7 @@ do_sub(int nargs, unsigned int flags) int dig = scan[1] - '0'; if (dig < NUMSUBPATS(rp, target->stptr) && SUBPATSTART(rp, tp->stptr, dig) != -1) { char *start, *end; - + start = target->stptr + SUBPATSTART(rp, target->stptr, dig); end = target->stptr @@ -3140,7 +3140,7 @@ done: DEREF(rep_node); if ((matches == 0 || (flags & LITERAL) != 0) && buf != NULL) { - efree(buf); + efree(buf); buf = NULL; } @@ -3149,7 +3149,7 @@ done: /* return the result string */ DEREF(target); assert(buf != NULL); - return make_str_node(buf, textlen, ALREADY_MALLOCED); + return make_str_node(buf, textlen, ALREADY_MALLOCED); } /* return the original string */ @@ -3161,7 +3161,7 @@ done: DEREF(target); else if (matches > 0) { unref(*lhs); - *lhs = make_str_node(buf, textlen, ALREADY_MALLOCED); + *lhs = make_str_node(buf, textlen, ALREADY_MALLOCED); } return make_number((AWKNUM) matches); diff --git a/cint_array.c b/cint_array.c index 7a92cb0d..092ce88a 100644 --- a/cint_array.c +++ b/cint_array.c @@ -2,23 +2,23 @@ * cint_array.c - routines for arrays of (mostly) consecutive positive integer indices. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-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 @@ -37,7 +37,7 @@ extern NODE **is_integer(NODE *symbol, NODE *subs); * THRESHOLD --- Maximum capacity waste; THRESHOLD >= 2^(NHAT + 1). */ -static int NHAT = 10; +static int NHAT = 10; static long THRESHOLD; /* @@ -102,7 +102,7 @@ static void leaf_info(NODE *array, NODE *ndump, const char *aname); static void leaf_print(NODE *array, size_t bi, int indent_level); #endif -/* powers of 2 table upto 2^30 */ +/* powers of 2 table upto 2^30 */ static const long power_two_table[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, @@ -118,7 +118,7 @@ static const long power_two_table[] = { /* * To store 2^n integers, allocate top-level array of size n, elements * of which are 1-Dimensional (leaf-array) of geometrically increasing - * size (power of 2). + * size (power of 2). * * [0] --> [ 0 ] * [1] --> [ 1 ] @@ -128,7 +128,7 @@ static const long power_two_table[] = { * |k| --> [ 2^(k - 1)| ... | 2^k - 1 ] * ... * - * For a given integer n (> 0), the leaf-array is at 1 + floor(log2(n)). + * For a given integer n (> 0), the leaf-array is at 1 + floor(log2(n)). * * The idea for the geometrically increasing array sizes is from: * Fast Functional Lists, Hash-Lists, Deques and Variable Length Arrays. @@ -394,7 +394,7 @@ cint_copy(NODE *symbol, NODE *newsymb) for (i = NHAT; i < INT32_BIT; i++) { if (old[i] == NULL) continue; - new[i] = make_node(Node_array_tree); + new[i] = make_node(Node_array_tree); tree_copy(newsymb, old[i], new[i]); } @@ -494,7 +494,7 @@ cint_dump(NODE *symbol, NODE *ndump) xsize = xn->table_size; } cint_size = symbol->table_size - xsize; - + if ((symbol->flags & XARRAY) == 0) fprintf(output_fp, "%s `%s'\n", (symbol->parent_array == NULL) ? "array" : "sub-array", @@ -525,7 +525,7 @@ cint_dump(NODE *symbol, NODE *ndump) /* Node_array_tree + HAT */ kb += (sizeof(NODE) + tree_kilobytes(tn)) / 1024.0; } - kb += (INT32_BIT * sizeof(NODE *)) / 1024.0; /* symbol->nodes */ + kb += (INT32_BIT * sizeof(NODE *)) / 1024.0; /* symbol->nodes */ kb += (symbol->array_capacity * sizeof(NODE *)) / 1024.0; /* value nodes in Node_array_leaf(s) */ if (xn != NULL) { if (xn->array_funcs == int_array_func) @@ -600,12 +600,12 @@ cint_hash(long k) * By Sean Eron Anderson * seander@cs.stanford.edu * Individually, the code snippets here are in the public domain - * (unless otherwise noted) — feel free to use them however you please. - * The aggregate collection and descriptions are © 1997-2005 + * (unless otherwise noted) --- feel free to use them however you please. + * The aggregate collection and descriptions are (C) 1997-2005 * Sean Eron Anderson. The code and descriptions are distributed in the * hope that they will be useful, but WITHOUT ANY WARRANTY and without * even the implied warranty of merchantability or fitness for a particular - * purpose. + * purpose. * */ @@ -678,15 +678,15 @@ cint_print(NODE *symbol) /* * A half HAT is defined here as a HAT with a top-level array of size n^2/2 * and holds the first n^2/2 elements. - * + * * 1. 2^8 elements can be stored in a full HAT of size 2^4. - * 2. 2^9 elements can be stored in a half HAT of size 2^5. + * 2. 2^9 elements can be stored in a half HAT of size 2^5. * 3. When the number of elements is some power of 2, it * can be stored in a full or a half HAT. * 4. When the number of elements is some power of 2, it * can be stored in a HAT (full or half) with HATs as leaf elements * (full or half), and so on (e.g. 2^8 elements in a HAT of size 2^4 (top-level - * array dimension) with each leaf array being a HAT of size 2^2). + * array dimension) with each leaf array being a HAT of size 2^2). * * IMPLEMENTATION DETAILS: * 1. A HAT of 2^12 elements needs 2^6 house-keeping NODEs @@ -737,7 +737,7 @@ tree_lookup(NODE *symbol, NODE *tree, long k, int m, long base) */ n = (m + 1) / 2; - + if (tree->table_size == 0) { size_t actual_size; NODE **table; @@ -920,7 +920,7 @@ tree_list(NODE *tree, NODE **list, assoc_kind_t assoc_kind) static void tree_copy(NODE *newsymb, NODE *tree, NODE *newtree) -{ +{ NODE **old, **new; size_t j, hsize; @@ -1061,13 +1061,13 @@ leaf_lookup(NODE *symbol, NODE *array, long k, long size, long base) } -/* leaf_exists --- check if the array contains an integer subscript */ +/* leaf_exists --- check if the array contains an integer subscript */ static inline NODE ** leaf_exists(NODE *array, long k) { NODE **lhs; - lhs = array->nodes + (k - array->array_base); + lhs = array->nodes + (k - array->array_base); return (*lhs != NULL) ? lhs : NULL; } @@ -1086,7 +1086,7 @@ leaf_clear(NODE *array) continue; if (r->type == Node_var_array) { assoc_clear(r); /* recursively clear all sub-arrays */ - efree(r->vname); + efree(r->vname); freenode(r); } else unref(r); @@ -1104,7 +1104,7 @@ leaf_remove(NODE *symbol, NODE *array, long k) { NODE **lhs; - lhs = array->nodes + (k - array->array_base); + lhs = array->nodes + (k - array->array_base); if (*lhs == NULL) return false; *lhs = NULL; @@ -1171,7 +1171,7 @@ leaf_list(NODE *array, NODE **list, assoc_kind_t assoc_kind) /* index */ num = array->array_base + ci; if ((assoc_kind & AISTR) != 0) { - sprintf(buf, "%ld", num); + sprintf(buf, "%ld", num); subs = make_string(buf, strlen(buf)); subs->numbr = num; subs->flags |= (NUMCUR|NUMINT); @@ -2,22 +2,22 @@ * cmd.h - definitions for command parser */ -/* +/* * Copyright (C) 2004, 2010, 2011, 2013, 2014 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 @@ -106,7 +106,7 @@ enum argtype { D_range }; -/* non-number arguments to commands */ +/* non-number arguments to commands */ enum nametypeval { A_NONE = 0, @@ -135,7 +135,7 @@ typedef struct cmd_argument { NODE *nodeval; } value; -#define a_int value.lval /* type = D_int or D_range */ +#define a_int value.lval /* type = D_int or D_range */ #define a_argument value.lval /* type = D_argument */ #define a_string value.sval /* type = D_string, D_array, D_subscript or D_variable */ #define a_node value.nodeval /* type = D_node, D_field or D_func */ @@ -89,7 +89,7 @@ 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 CMDARG *arg_list = NULL; /* list of arguments */ static long errcount = 0; static char *lexptr_begin = NULL; static bool in_commands = false; @@ -97,7 +97,7 @@ static int num_dim; static bool in_eval = false; static const char start_EVAL[] = "function @eval(){"; -static const char end_EVAL[] = "}"; +static const char end_EVAL[] = "}"; static CMDARG *append_statement(CMDARG *stmt_list, char *stmt); static NODE *concat_args(CMDARG *a, int count); @@ -1553,7 +1553,7 @@ yyreduce: bool terminate = false; CMDARG *args; int ctype = 0; - + ctype = cmdtab[cmd_idx].type; /* a blank line repeats previous command @@ -1794,7 +1794,7 @@ yyreduce: if (type) { in_commands = true; if (input_from_tty) { - dbg_prompt = commands_prompt; + dbg_prompt = commands_prompt; fprintf(out_fp, _("Type commands for when %s %d is hit, one per line.\n"), (type == D_break) ? "breakpoint" : "watchpoint", num); fprintf(out_fp, _("End with the command \"end\"\n")); @@ -1811,7 +1811,7 @@ yyreduce: yyerror(_("`end' valid only in command `commands' or `eval'")); else { if (input_from_tty) - dbg_prompt = dgawk_prompt; + dbg_prompt = dgawk_prompt; in_commands = false; } } @@ -2108,7 +2108,7 @@ yyreduce: CMDARG *a; NODE *subs; int count = 0; - + for (a = (yyvsp[-1]); a != NULL; a = a->next) count++; subs = concat_args((yyvsp[-1]), count); @@ -2165,7 +2165,7 @@ yyreduce: case 145: #line 678 "command.y" /* yacc.c:1646 */ - { + { NODE *n = (yyvsp[0])->a_node; if ((n->flags & NUMBER) == 0) yyerror(_("non-numeric value found, numeric expected")); @@ -2176,7 +2176,7 @@ yyreduce: case 146: #line 685 "command.y" /* yacc.c:1646 */ - { + { NODE *n = (yyvsp[0])->a_node; if ((n->flags & NUMBER) == 0) yyerror(_("non-numeric value found, numeric expected")); @@ -2498,12 +2498,12 @@ yyreturn: -/* append_statement --- append 'stmt' to the list of eval awk statements */ +/* append_statement --- append 'stmt' to the list of eval awk statements */ static CMDARG * -append_statement(CMDARG *stmt_list, char *stmt) +append_statement(CMDARG *stmt_list, char *stmt) { - CMDARG *a, *arg; + CMDARG *a, *arg; char *s; int len, slen, ssize; @@ -2535,7 +2535,7 @@ append_statement(CMDARG *stmt_list, char *stmt) s[slen] = '\0'; return arg; } - + len = strlen(stmt) + 1; /* 1 for newline */ s = stmt_list->a_string; slen = strlen(s); @@ -2699,7 +2699,7 @@ get_command_name(int ctype) return cmdtab[i].name; } return NULL; -} +} /* mk_cmdarg --- make an argument for command */ @@ -2714,7 +2714,7 @@ mk_cmdarg(enum argtype type) } /* append_cmdarg --- append ARG to the list of arguments for the current command */ - + static void append_cmdarg(CMDARG *arg) { @@ -2785,7 +2785,7 @@ yylex(void) static char *lexend; int c; char *tokstart; - size_t toklen; + size_t toklen; yylval = (CMDARG *) NULL; @@ -2799,7 +2799,7 @@ yylex(void) again: lexptr_begin = read_a_line(dbg_prompt); if (lexptr_begin == NULL) { /* EOF or error */ - if (get_eof_status() == EXIT_FATAL) + if (get_eof_status() == EXIT_FATAL) exit(EXIT_FATAL); if (get_eof_status() == EXIT_FAILURE) { static int seen_eof = 0; @@ -2831,7 +2831,7 @@ again: && input_from_tty ) history_expand_line(&lexptr_begin); - + lexptr = lexptr_begin; lexend = lexptr + strlen(lexptr); if (*lexptr == '\0' /* blank line */ @@ -2850,14 +2850,14 @@ again: } repeat_idx = -1; } - + c = *lexptr; while (c == ' ' || c == '\t') c = *++lexptr; if (! input_from_tty && c == '#') - return '\n'; + return '\n'; tokstart = lexptr; if (lexptr >= lexend) @@ -2914,7 +2914,7 @@ again: } c = *lexptr; - + if (cmdtab[cmd_idx].type == D_option) { if (c == '=') return *lexptr++; @@ -3016,8 +3016,8 @@ err: r = mpg_integer(); mpfr_get_z(r->mpg_i, tmp->mpg_numbr, MPFR_RNDZ); unref(tmp); - } - } else + } + } else #endif r = make_number(strtod(tokstart, & lexptr)); @@ -3126,7 +3126,7 @@ concat_args(CMDARG *arg, int count) n = force_string(arg->a_node); return dupnode(n); } - + emalloc(tmp, NODE **, count * sizeof(NODE *), "concat_args"); subseplen = SUBSEP_node->var_value->stlen; subsep = SUBSEP_node->var_value->stptr; @@ -3161,7 +3161,7 @@ concat_args(CMDARG *arg, int count) } /* find_command --- find the index in 'cmdtab' using exact, - * abbreviation or unique partial match + * abbreviation or unique partial match */ static int @@ -3253,10 +3253,10 @@ do_help(CMDARG *arg, int cmd) #ifdef HAVE_LIBREADLINE -/* next_word --- find the next word in a line to complete +/* next_word --- find the next word in a line to complete * (word seperation characters are space and tab). */ - + static char * next_word(char *p, int len, char **endp) { @@ -3338,10 +3338,10 @@ command_completion(const char *text, int start, int end) if (this_cmd == D_print || this_cmd == D_printf) return rl_completion_matches(text, variable_generator); return NULL; -} +} /* command_generator --- generator function for command completion */ - + static char * command_generator(const char *text, int state) { @@ -3414,7 +3414,7 @@ argument_generator(const char *text, int state) if (strncmp(name, text, textlen) == 0) return estrdup(name, strlen(name)); } - } + } return NULL; } @@ -2,23 +2,23 @@ * command.y - yacc/bison parser for debugger commands. */ -/* +/* * Copyright (C) 2004, 2010, 2011, 2014, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA @@ -42,7 +42,7 @@ 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 CMDARG *arg_list = NULL; /* list of arguments */ static long errcount = 0; static char *lexptr_begin = NULL; static bool in_commands = false; @@ -50,7 +50,7 @@ static int num_dim; static bool in_eval = false; static const char start_EVAL[] = "function @eval(){"; -static const char end_EVAL[] = "}"; +static const char end_EVAL[] = "}"; static CMDARG *append_statement(CMDARG *stmt_list, char *stmt); static NODE *concat_args(CMDARG *a, int count); @@ -132,7 +132,7 @@ line bool terminate = false; CMDARG *args; int ctype = 0; - + ctype = cmdtab[cmd_idx].type; /* a blank line repeats previous command @@ -308,7 +308,7 @@ command | D_LIST list_args | D_UNTIL location | D_CLEAR location - | break_cmd break_args + | break_cmd break_args | D_SET { want_nodeval = true; } variable '=' node | D_OPTION option_args | D_RETURN { want_nodeval = true; } opt_node @@ -345,7 +345,7 @@ command if (type) { in_commands = true; if (input_from_tty) { - dbg_prompt = commands_prompt; + dbg_prompt = commands_prompt; fprintf(out_fp, _("Type commands for when %s %d is hit, one per line.\n"), (type == D_break) ? "breakpoint" : "watchpoint", num); fprintf(out_fp, _("End with the command \"end\"\n")); @@ -358,7 +358,7 @@ command yyerror(_("`end' valid only in command `commands' or `eval'")); else { if (input_from_tty) - dbg_prompt = dgawk_prompt; + dbg_prompt = dgawk_prompt; in_commands = false; } } @@ -493,9 +493,9 @@ location break_args : /* empty */ - { $$ = NULL; } + { $$ = NULL; } | plus_integer { want_nodeval = true; } condition_exp - | func_name + | func_name | D_STRING ':' plus_integer { want_nodeval = true; } condition_exp | D_STRING ':' func_name ; @@ -631,7 +631,7 @@ subscript CMDARG *a; NODE *subs; int count = 0; - + for (a = $2; a != NULL; a = a->next) count++; subs = concat_args($2, count); @@ -641,7 +641,7 @@ subscript $2->a_node = subs; $$ = $2; } - | '[' exp_list error + | '[' exp_list error ; subscript_list @@ -675,14 +675,14 @@ node : D_NODE { $$ = $1; } | '+' D_NODE - { + { NODE *n = $2->a_node; if ((n->flags & NUMBER) == 0) yyerror(_("non-numeric value found, numeric expected")); $$ = $2; } | '-' D_NODE - { + { NODE *n = $2->a_node; if ((n->flags & NUMBER) == 0) yyerror(_("non-numeric value found, numeric expected")); @@ -705,7 +705,7 @@ opt_integer | integer { $$ = $1; } ; - + plus_integer : D_INT { @@ -720,7 +720,7 @@ plus_integer $$ = $2; } ; - + integer : D_INT { $$ = $1; } @@ -748,12 +748,12 @@ nls %% -/* append_statement --- append 'stmt' to the list of eval awk statements */ +/* append_statement --- append 'stmt' to the list of eval awk statements */ static CMDARG * -append_statement(CMDARG *stmt_list, char *stmt) +append_statement(CMDARG *stmt_list, char *stmt) { - CMDARG *a, *arg; + CMDARG *a, *arg; char *s; int len, slen, ssize; @@ -785,7 +785,7 @@ append_statement(CMDARG *stmt_list, char *stmt) s[slen] = '\0'; return arg; } - + len = strlen(stmt) + 1; /* 1 for newline */ s = stmt_list->a_string; slen = strlen(s); @@ -949,7 +949,7 @@ get_command_name(int ctype) return cmdtab[i].name; } return NULL; -} +} /* mk_cmdarg --- make an argument for command */ @@ -964,7 +964,7 @@ mk_cmdarg(enum argtype type) } /* append_cmdarg --- append ARG to the list of arguments for the current command */ - + static void append_cmdarg(CMDARG *arg) { @@ -1035,7 +1035,7 @@ yylex(void) static char *lexend; int c; char *tokstart; - size_t toklen; + size_t toklen; yylval = (CMDARG *) NULL; @@ -1049,7 +1049,7 @@ yylex(void) again: lexptr_begin = read_a_line(dbg_prompt); if (lexptr_begin == NULL) { /* EOF or error */ - if (get_eof_status() == EXIT_FATAL) + if (get_eof_status() == EXIT_FATAL) exit(EXIT_FATAL); if (get_eof_status() == EXIT_FAILURE) { static int seen_eof = 0; @@ -1081,7 +1081,7 @@ again: && input_from_tty ) history_expand_line(&lexptr_begin); - + lexptr = lexptr_begin; lexend = lexptr + strlen(lexptr); if (*lexptr == '\0' /* blank line */ @@ -1100,14 +1100,14 @@ again: } repeat_idx = -1; } - + c = *lexptr; while (c == ' ' || c == '\t') c = *++lexptr; if (! input_from_tty && c == '#') - return '\n'; + return '\n'; tokstart = lexptr; if (lexptr >= lexend) @@ -1164,7 +1164,7 @@ again: } c = *lexptr; - + if (cmdtab[cmd_idx].type == D_option) { if (c == '=') return *lexptr++; @@ -1266,8 +1266,8 @@ err: r = mpg_integer(); mpfr_get_z(r->mpg_i, tmp->mpg_numbr, MPFR_RNDZ); unref(tmp); - } - } else + } + } else #endif r = make_number(strtod(tokstart, & lexptr)); @@ -1376,7 +1376,7 @@ concat_args(CMDARG *arg, int count) n = force_string(arg->a_node); return dupnode(n); } - + emalloc(tmp, NODE **, count * sizeof(NODE *), "concat_args"); subseplen = SUBSEP_node->var_value->stlen; subsep = SUBSEP_node->var_value->stptr; @@ -1411,7 +1411,7 @@ concat_args(CMDARG *arg, int count) } /* find_command --- find the index in 'cmdtab' using exact, - * abbreviation or unique partial match + * abbreviation or unique partial match */ static int @@ -1503,10 +1503,10 @@ do_help(CMDARG *arg, int cmd) #ifdef HAVE_LIBREADLINE -/* next_word --- find the next word in a line to complete +/* next_word --- find the next word in a line to complete * (word seperation characters are space and tab). */ - + static char * next_word(char *p, int len, char **endp) { @@ -1588,10 +1588,10 @@ command_completion(const char *text, int start, int end) if (this_cmd == D_print || this_cmd == D_printf) return rl_completion_matches(text, variable_generator); return NULL; -} +} /* command_generator --- generator function for command completion */ - + static char * command_generator(const char *text, int state) { @@ -1664,7 +1664,7 @@ argument_generator(const char *text, int state) if (strncmp(name, text, textlen) == 0) return estrdup(name, strlen(name)); } - } + } return NULL; } @@ -10,23 +10,23 @@ * the information, to arnold@skeeve.com. */ -/* +/* * Copyright (C) 1995-2004, 2008, 2009, 2011, 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 @@ -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; @@ -1,23 +1,23 @@ /* - * eval.c - gawk bytecode interpreter + * eval.c - gawk bytecode interpreter */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-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 @@ -53,7 +53,7 @@ static NODE *node_Boolean[2]; #ifdef C #undef C #endif -#define C(c) ((char)c) +#define C(c) ((char)c) /* * This table is used by the regexp routines to do case independent * matching. Basically, every ascii character maps to itself, except @@ -314,7 +314,7 @@ static struct optypetab { { "Op_match", " ~ " }, { "Op_match_rec", NULL }, { "Op_nomatch", " !~ " }, - { "Op_rule", NULL }, + { "Op_rule", NULL }, { "Op_K_case", "case" }, { "Op_K_default", "default" }, { "Op_K_break", "break" }, @@ -640,7 +640,7 @@ push_frame(NODE *f) } if (fcall_count > 1) - memmove(fcall_list + 2, fcall_list + 1, (fcall_count - 1) * sizeof(NODE *)); + memmove(fcall_list + 2, fcall_list + 1, (fcall_count - 1) * sizeof(NODE *)); fcall_list[1] = f; } @@ -651,7 +651,7 @@ static void pop_frame() { if (fcall_count > 1) - memmove(fcall_list + 1, fcall_list + 2, (fcall_count - 1) * sizeof(NODE *)); + memmove(fcall_list + 1, fcall_list + 2, (fcall_count - 1) * sizeof(NODE *)); fcall_count--; assert(fcall_count >= 0); if (do_debug) @@ -1075,7 +1075,7 @@ STACK_ITEM *stack_bottom; STACK_ITEM *stack_top; static unsigned long STACK_SIZE = 256; /* initial size of stack */ int max_args = 0; /* maximum # of arguments to printf, print, sprintf, - * or # of array subscripts, or adjacent strings + * or # of array subscripts, or adjacent strings * to be concatenated. */ NODE **args_array = NULL; @@ -1147,7 +1147,7 @@ r_get_lhs(NODE *n, bool reference) /* r_get_field --- get the address of a field node */ - + NODE ** r_get_field(NODE *n, Func_ptr *assign, bool reference) { @@ -1219,7 +1219,7 @@ calc_exp(AWKNUM x1, AWKNUM x2) } -/* setup_frame --- setup new frame for function call */ +/* setup_frame --- setup new frame for function call */ static INSTRUCTION * setup_frame(INSTRUCTION *pc) @@ -1261,7 +1261,7 @@ setup_frame(INSTRUCTION *pc) } - /* check for extra args */ + /* check for extra args */ if (arg_count > pcount) { warning( _("function `%s' called with more arguments than declared"), @@ -1355,7 +1355,7 @@ setup_frame(INSTRUCTION *pc) /* setup new frame */ getnode(frame_ptr); - frame_ptr->type = Node_frame; + frame_ptr->type = Node_frame; frame_ptr->stack = sp; frame_ptr->prev_frame_size = (stack_ptr - stack_bottom); /* size of the previous stack frame */ frame_ptr->func_node = f; @@ -1473,7 +1473,7 @@ unwind_stack(long n) if (in_main_context() && ! exiting) fatal(_("unwind_stack: unexpected type `%s'"), nodetype2str(r->type)); - /* else + /* else * Node_var_array, * Node_param_list, * Node_var (e.g: trying to use scalar for array) @@ -1487,7 +1487,7 @@ unwind_stack(long n) break; } return cp; -} +} /* pop_fcall --- pop off the innermost frame */ @@ -1535,7 +1535,7 @@ cmp_scalars(scalar_cmp_t comparison_type) } /* op_assign --- assignment operators excluding = */ - + static void op_assign(OPCODE op) { @@ -1637,9 +1637,9 @@ POP_CODE() typedef struct exec_state { struct exec_state *next; - INSTRUCTION *cptr; /* either getline (Op_K_getline) or the + INSTRUCTION *cptr; /* either getline (Op_K_getline) or the * implicit "open-file, read-record" loop (Op_newfile). - */ + */ int rule; /* rule for the INSTRUCTION */ @@ -1705,7 +1705,7 @@ register_exec_hook(Func_pre_exec preh, Func_post_exec posth) /* * multiple post-exec hooks aren't supported. post-exec hook is mainly * for use by the debugger. - */ + */ if (! preh || (post_execute && posth)) return false; @@ -1733,7 +1733,7 @@ register_exec_hook(Func_pre_exec preh, Func_post_exec posth) } -/* interpreter routine when not debugging */ +/* interpreter routine when not debugging */ #include "interpret.h" /* interpreter routine with exec hook(s). Used when debugging and/or with MPFR. */ @@ -1781,6 +1781,6 @@ init_interpret() if (num_exec_hook > 0) interpret = h_interpret; else - interpret = r_interpret; + interpret = r_interpret; } @@ -9,20 +9,20 @@ /* * Copyright (C) 1995 - 2001, 2003-2014, 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 @@ -120,15 +120,15 @@ make_builtin(const awk_ext_func_t *funcinfo) /* user-defined function */ fatal(_("make_builtin: can't redefine function `%s'"), name); } else if (f->type == Node_ext_func) { - /* multiple extension() calls etc. */ + /* multiple extension() calls etc. */ if (do_lint) lintwarn(_("make_builtin: function `%s' already defined"), name); return awk_false; } else - /* variable name etc. */ + /* variable name etc. */ fatal(_("make_builtin: function name `%s' previously defined"), name); } else if (check_special(name) >= 0) - fatal(_("make_builtin: can't use gawk built-in `%s' as function name"), name); + fatal(_("make_builtin: can't use gawk built-in `%s' as function name"), name); if (count < 0) fatal(_("make_builtin: negative argument count for function `%s'"), @@ -154,7 +154,7 @@ get_argument(int i) NODE *t; int arg_count; INSTRUCTION *pc; - + pc = TOP()->code_ptr; /* Op_ext_builtin instruction */ arg_count = pc->expr_count; /* # of arguments supplied */ @@ -167,7 +167,7 @@ get_argument(int i) if (t->type == Node_array_ref) { if (t->orig_array->type == Node_var) { - /* already a scalar, can no longer use it as array */ + /* already a scalar, can no longer use it as array */ t->type = Node_var; t->var_value = Nnull_string; return t; @@ -191,10 +191,10 @@ get_actual_argument(NODE *t, int i, bool want_array) { char *fname; INSTRUCTION *pc; - + pc = TOP()->code_ptr; /* Op_ext_builtin instruction */ fname = (pc + 1)->func_name; - + if (t->type == Node_var_new) { if (want_array) return force_array(t, false); @@ -239,7 +239,7 @@ close_extensions() if (srcfiles == NULL) return; - for (s = srcfiles->next; s != srcfiles; s = s->next) + for (s = srcfiles->next; s != srcfiles; s = s->next) if (s->stype == SRC_EXTLIB && s->fini_func) (*s->fini_func)(); } diff --git a/extension/ChangeLog b/extension/ChangeLog index d179b8e4..52d4ddb5 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,7 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + 2016-08-25 Arnold D. Robbins <arnold@skeeve.com> * 4.1.4: Release tar ball made. diff --git a/extension/filefuncs.c b/extension/filefuncs.c index 00387cf9..a074de53 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -12,20 +12,20 @@ /* * Copyright (C) 2001, 2004, 2005, 2010-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 @@ -484,7 +484,7 @@ do_stat(int nargs, awk_value_t *result) warning(ext_id, _("stat: bad parameters")); return make_number(-1, result); } - + if (nargs == 3) { statfunc = stat; } @@ -561,7 +561,7 @@ do_statvfs(int nargs, awk_value_t *result) #endif array_set_numeric(array, "flag", vfsbuf.f_flag); /* mount flags */ array_set_numeric(array, "namemax", vfsbuf.f_namemax); /* maximum filename length */ - + return make_number(ret, result); } diff --git a/extension/fnmatch.c b/extension/fnmatch.c index a85bcc78..f5fb02c6 100644 --- a/extension/fnmatch.c +++ b/extension/fnmatch.c @@ -8,20 +8,20 @@ /* * Copyright (C) 2012, 2013 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 diff --git a/extension/fork.c b/extension/fork.c index 0ca0a0e0..82593b7f 100644 --- a/extension/fork.c +++ b/extension/fork.c @@ -7,20 +7,20 @@ /* * Copyright (C) 2001, 2004, 2011, 2012, 2013 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 diff --git a/extension/inplace.c b/extension/inplace.c index c7eb5564..26c37922 100644 --- a/extension/inplace.c +++ b/extension/inplace.c @@ -4,20 +4,20 @@ /* * Copyright (C) 2013-2015 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 @@ -132,7 +132,7 @@ do_inplace_begin(int nargs, awk_value_t *result) if (nargs != 2) fatal(ext_id, _("inplace_begin: expects 2 arguments but called with %d"), nargs); - + if (! get_argument(0, AWK_STRING, &filename)) fatal(ext_id, _("inplace_begin: cannot retrieve 1st argument as a string filename")); diff --git a/extension/ordchr.c b/extension/ordchr.c index 8ec9de3f..4f9cd616 100644 --- a/extension/ordchr.c +++ b/extension/ordchr.c @@ -10,20 +10,20 @@ /* * Copyright (C) 2001, 2004, 2011, 2012, 2013 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 diff --git a/extension/readdir.c b/extension/readdir.c index 4578b864..6106a44b 100644 --- a/extension/readdir.c +++ b/extension/readdir.c @@ -11,20 +11,20 @@ /* * Copyright (C) 2012-2014 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 diff --git a/extension/readfile.c b/extension/readfile.c index 7673589f..fbe25748 100644 --- a/extension/readfile.c +++ b/extension/readfile.c @@ -14,20 +14,20 @@ /* * Copyright (C) 2002, 2003, 2004, 2011, 2012, 2013, 2014 * 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 diff --git a/extension/revoutput.c b/extension/revoutput.c index 69257167..84d0aaa5 100644 --- a/extension/revoutput.c +++ b/extension/revoutput.c @@ -8,20 +8,20 @@ /* * Copyright (C) 2012, 2013, 2015 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 diff --git a/extension/revtwoway.c b/extension/revtwoway.c index dfe58a1e..82fabb2b 100644 --- a/extension/revtwoway.c +++ b/extension/revtwoway.c @@ -8,20 +8,20 @@ /* * Copyright (C) 2012-2014, 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 diff --git a/extension/rwarray.c b/extension/rwarray.c index e751ea2c..15e121af 100644 --- a/extension/rwarray.c +++ b/extension/rwarray.c @@ -8,20 +8,20 @@ /* * Copyright (C) 2009-2014 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 @@ -80,7 +80,7 @@ static awk_bool_t read_value(FILE *fp, awk_value_t *value); * Minor version 4 bytes - network order * Element count 4 bytes - network order * Elements - * + * * For each element: * Length of index val: 4 bytes - network order * Index val as characters (N bytes) @@ -436,7 +436,7 @@ read_value(FILE *fp, awk_value_t *value) awk_array_t array = create_array(); if (! read_array(fp, array)) - return awk_false; + return awk_false; /* hook into value */ value->val_type = AWK_ARRAY; diff --git a/extension/rwarray0.c b/extension/rwarray0.c index ec3663cc..00289cad 100644 --- a/extension/rwarray0.c +++ b/extension/rwarray0.c @@ -8,20 +8,20 @@ /* * Copyright (C) 2009, 2010, 2011, 2012, 2013 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 @@ -76,7 +76,7 @@ static awk_bool_t read_value(int fd, awk_value_t *value); * Minor version 4 bytes - network order * Element count 4 bytes - network order * Elements - * + * * For each element: * Length of index val: 4 bytes - network order * Index val as characters (N bytes) @@ -431,7 +431,7 @@ read_value(int fd, awk_value_t *value) awk_array_t array = create_array(); if (read_array(fd, array) != 0) - return awk_false; + return awk_false; /* hook into value */ value->val_type = AWK_ARRAY; diff --git a/extension/stack.c b/extension/stack.c index 6150442c..637378e2 100644 --- a/extension/stack.c +++ b/extension/stack.c @@ -2,22 +2,22 @@ * stack.c -- Implementation for stack functions for use by extensions. */ -/* +/* * Copyright (C) 2012, 2013 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 diff --git a/extension/testext.c b/extension/testext.c index e2ddbe87..9216d64a 100644 --- a/extension/testext.c +++ b/extension/testext.c @@ -5,20 +5,20 @@ /* * Copyright (C) 2012, 2013, 2014, 2015 * 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 @@ -918,22 +918,22 @@ do_get_file(int nargs, awk_value_t *result) if (ibuf) { awk_value_t idx, val; - set_array_element(res.array_cookie, + set_array_element(res.array_cookie, make_const_string("input", 5, & idx), make_number(ibuf->fd, & val)); if (ibuf->name) - set_array_element(res.array_cookie, + set_array_element(res.array_cookie, make_const_string("input_name", 10, & idx), make_const_string(ibuf->name, strlen(ibuf->name), & val)); } if (obuf) { awk_value_t idx, val; - set_array_element(res.array_cookie, + set_array_element(res.array_cookie, make_const_string("output", 6, & idx), make_number(obuf->fp ? fileno(obuf->fp) : -1, & val)); if (obuf->name) - set_array_element(res.array_cookie, + set_array_element(res.array_cookie, make_const_string("output_name", 11, & idx), make_const_string(obuf->name, strlen(obuf->name), & val)); } @@ -2,22 +2,22 @@ * field.c - routines for dealing with fields and record parsing */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-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 @@ -276,7 +276,7 @@ set_record(const char *buf, int cnt) memcpy(databuf, buf, cnt); /* - * Add terminating '\0' so that C library routines + * Add terminating '\0' so that C library routines * will know when to stop. */ databuf[cnt] = '\0'; @@ -339,7 +339,7 @@ set_NF() assert(NF != -1); (void) force_number(NF_node->var_value); - nf = get_number_si(NF_node->var_value); + nf = get_number_si(NF_node->var_value); if (nf < 0) fatal(_("NF set to negative value")); NF = nf; @@ -407,7 +407,7 @@ re_parse_field(long up_to, /* parse only up to this field number */ sep = scan; while (scan < end && (*scan == ' ' || *scan == '\t' || *scan == '\n')) scan++; - if (sep_arr != NULL && sep < scan) + if (sep_arr != NULL && sep < scan) set_element(nf, sep, (long)(scan - sep), sep_arr); } @@ -439,8 +439,8 @@ re_parse_field(long up_to, /* parse only up to this field number */ } (*set)(++nf, field, (long)(scan + RESTART(rp, scan) - field), n); - if (sep_arr != NULL) - set_element(nf, scan + RESTART(rp, scan), + if (sep_arr != NULL) + set_element(nf, scan + RESTART(rp, scan), (long) (REEND(rp, scan) - RESTART(rp, scan)), sep_arr); scan += REEND(rp, scan); field = scan; @@ -504,7 +504,7 @@ def_parse_field(long up_to, /* parse only up to this field number */ sep = scan; for (; nf < up_to; scan++) { /* - * special case: fs is single space, strip leading whitespace + * special case: fs is single space, strip leading whitespace */ while (scan < end && (*scan == ' ' || *scan == '\t' || *scan == '\n')) scan++; @@ -786,11 +786,11 @@ get_field(long requested, Func_ptr *assign) /* * Keep things uniform. Also, mere intention of assigning something * to $n should not make $0 invalid. Makes sense to invalidate $0 - * after the actual assignment is performed. Not a real issue in + * after the actual assignment is performed. Not a real issue in * the interpreter otherwise, but causes problem in the * debugger when watching or printing fields. */ - + if (assign != NULL) *assign = invalidate_field0; /* $0 needs reconstruction */ #endif @@ -906,12 +906,12 @@ do_split(int nargs) if (sep_arr != NULL) { if (sep_arr == arr) - fatal(_("split: cannot use the same array for second and fourth args")); + fatal(_("split: cannot use the same array for second and fourth args")); /* This checks need to be done before clearing any of the arrays */ for (tmp = sep_arr->parent_array; tmp != NULL; tmp = tmp->parent_array) if (tmp == arr) - fatal(_("split: cannot use a subarray of second arg for fourth arg")); + fatal(_("split: cannot use a subarray of second arg for fourth arg")); for (tmp = arr->parent_array; tmp != NULL; tmp = tmp->parent_array) if (tmp == sep_arr) fatal(_("split: cannot use a subarray of fourth arg for second arg")); @@ -997,7 +997,7 @@ do_patsplit(int nargs) if (sep_arr != NULL) { if (sep_arr == arr) - fatal(_("patsplit: cannot use the same array for second and fourth args")); + fatal(_("patsplit: cannot use the same array for second and fourth args")); /* These checks need to be done before clearing any of the arrays */ for (tmp = sep_arr->parent_array; tmp != NULL; tmp = tmp->parent_array) @@ -1091,7 +1091,7 @@ set_FIELDWIDTHS() || (*end != '\0' && ! is_blank(*end)) || !(0 < tmp && tmp <= INT_MAX) ) { - fatal_error = true; + fatal_error = true; break; } FIELDWIDTHS[i] = tmp; @@ -1162,7 +1162,7 @@ set_FS() * FS_regexp will be NULL with a non-null FS_re_yes_case. * refree() handles null argument; no need for `if (FS_regexp != NULL)' below. * Please do not remerge. - */ + */ refree(FS_re_yes_case); refree(FS_re_no_case); FS_re_yes_case = FS_re_no_case = FS_regexp = NULL; @@ -1405,19 +1405,19 @@ incr_scan(char **scanp, size_t len, mbstate_t *mbs) * BEGIN { * false = 0 * true = 1 - * + * * fpat[1] = "([^,]*)|(\"[^\"]+\")" * fpat[2] = fpat[1] * fpat[3] = fpat[1] * fpat[4] = "aa+" * fpat[5] = fpat[4] - * + * * data[1] = "Robbins,,Arnold," * data[2] = "Smith,,\"1234 A Pretty Place, NE\",Sometown,NY,12345-6789,USA" * data[3] = "Robbins,Arnold,\"1234 A Pretty Place, NE\",Sometown,NY,12345-6789,USA" * data[4] = "bbbaaacccdddaaaaaqqqq" * data[5] = "bbbaaacccdddaaaaaqqqqa" # should get trailing qqqa - * + * * for (i = 1; i in data; i++) { * printf("Splitting: <%s>\n", data[i]) * n = mypatsplit(data[i], fields, fpat[i], seps) @@ -1428,7 +1428,7 @@ incr_scan(char **scanp, size_t len, mbstate_t *mbs) * printf("seps[%s] = <%s>\n", j, seps[j]) * } * } - * + * * function mypatsplit(string, array, pattern, seps, * eosflag, non_empty, nf) # locals * { @@ -1436,7 +1436,7 @@ incr_scan(char **scanp, size_t len, mbstate_t *mbs) * delete seps * if (length(string) == 0) * return 0 - * + * * eosflag = non_empty = false * nf = 0 * while (match(string, pattern)) { @@ -1487,7 +1487,7 @@ incr_scan(char **scanp, size_t len, mbstate_t *mbs) * } * if (length(string) > 0) * seps[nf] = string - * + * * return length(array) * } */ @@ -1560,7 +1560,7 @@ fpat_parse_field(long up_to, /* parse only up to this field number */ * 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; if (sep_arr != NULL) { need_to_set_sep = false; diff --git a/floatcomp.c b/floatcomp.c index 9ba169a4..7317fa75 100644 --- a/floatcomp.c +++ b/floatcomp.c @@ -2,23 +2,23 @@ * floatcomp.c - Isolate floating point details. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2011, 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 diff --git a/floatmagic.h b/floatmagic.h index c6aabd92..cb22b611 100644 --- a/floatmagic.h +++ b/floatmagic.h @@ -1,23 +1,23 @@ /* - * floatmagic.h -- Definitions of isnan and isinf for gawk. + * floatmagic.h -- Definitions of isnan and isinf for gawk. */ -/* +/* * Copyright (C) 2009 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 @@ -2,22 +2,22 @@ * gawkapi.c -- Implement the functions defined for gawkapi.h */ -/* +/* * Copyright (C) 2012-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 @@ -76,7 +76,7 @@ api_get_argument(awk_ext_id_t id, size_t count, goto scalar; } } - + /* at this point, we have real type */ if (arg->type == Node_var_array || arg->type == Node_array_ref) { if (wanted != AWK_ARRAY && wanted != AWK_UNDEFINED) @@ -502,7 +502,7 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted) * - No access to special variables (NF, etc.) * - One special exception: PROCINFO. * - Use sym_update() to change a value, including from UNDEFINED - * to scalar or array. + * to scalar or array. */ /* * Lookup a variable, fills in value. No messing with the value @@ -814,7 +814,7 @@ api_set_array_element(awk_ext_id_t id, awk_array_t a_cookie, } /* - * remove_element --- remove an array element + * remove_element --- remove an array element * common code used by multiple functions */ @@ -2,22 +2,22 @@ * gawkapi.h -- Definitions for use by extension functions calling into gawk. */ -/* +/* * Copyright (C) 2012-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 @@ -53,7 +53,7 @@ * This API purposely restricts itself to ISO C 90 features. In particular, no * bool, no // comments, no use of the restrict keyword, or anything else, * in order to provide maximal portability. - * + * * Exception: the "inline" keyword is used below in the "constructor" * functions. If your compiler doesn't support it, you should either * -Dinline='' on your command line, or use the autotools and include a @@ -136,7 +136,7 @@ typedef struct awk_input { * parser is responsible for managing its own memory buffer. * Similarly, gawk will make its own copy of RT, so the parser * is also responsible for managing this memory. - * + * * It is guaranteed that errcode is a valid pointer, so there is * no need to test for a NULL value. Gawk sets *errcode to 0, * so there is no need to set it unless an error occurs. @@ -165,7 +165,7 @@ typedef struct awk_input { /* put last, for alignment. bleah */ struct stat sbuf; /* stat buf */ - + } awk_input_buf_t; typedef struct awk_input_parser { @@ -531,7 +531,7 @@ typedef struct gawk_api { * - Read-only access to special variables (NF, etc.) * - One special exception: PROCINFO. * - Use sym_update() to change a value, including from UNDEFINED - * to scalar or array. + * to scalar or array. */ /* * Lookup a variable, fill in value. No messing with the value @@ -692,7 +692,7 @@ typedef struct gawk_api { * Look up a file. If the name is NULL or name_len is 0, it returns * data for the currently open input file corresponding to FILENAME * (and it will not access the filetype argument, so that may be - * undefined). + * undefined). * If the file is not already open, it tries to open it. * The "filetype" argument should be one of: * ">", ">>", "<", "|>", "|<", and "|&" @@ -2,23 +2,23 @@ * gawkmisc.c --- miscellanious gawk routines that are OS specific. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2004, 2010, 2011 * 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 diff --git a/helpers/ChangeLog b/helpers/ChangeLog index 47062233..d29071e3 100644 --- a/helpers/ChangeLog +++ b/helpers/ChangeLog @@ -1,3 +1,7 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + 2016-09-08 Paul Eggert <eggert@cs.ucla.edu> * testdfa.c: Adjust to DFA API changes. diff --git a/helpers/testdfa.c b/helpers/testdfa.c index fa7715f9..72b97907 100644 --- a/helpers/testdfa.c +++ b/helpers/testdfa.c @@ -2,22 +2,22 @@ * testdfa.c --- abstracted from gawk. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2013 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 @@ -395,7 +395,7 @@ setup_pattern(const char *pattern, size_t *len) /* * Build a copy of the string (in buf) with the * escaped characters translated, and generate the regex - * from that. + * from that. */ buf = (char *) malloc(*len + 1); if (buf == NULL) { @@ -499,16 +499,16 @@ setup_pattern(const char *pattern, size_t *len) * * Parse a C escape sequence. STRING_PTR points to a variable containing a * pointer to the string to parse. That pointer is updated past the - * characters we use. The value of the escape sequence is returned. + * characters we use. The value of the escape sequence is returned. * * A negative value means the sequence \ newline was seen, which is supposed to - * be equivalent to nothing at all. + * be equivalent to nothing at all. * * If \ is followed by a null character, we return a negative value and leave - * the string pointer pointing at the null character. + * the string pointer pointing at the null character. * * If \ is followed by 000, we return 0 and leave the string pointer after the - * zeros. A value of 0 does not mean end of string. + * zeros. A value of 0 does not mean end of string. * * POSIX doesn't allow \x. */ @@ -597,7 +597,7 @@ parse_escape(const char **string_ptr) #ifdef C #undef C #endif -#define C(c) ((char)c) +#define C(c) ((char)c) /* * This table is used by the regexp routines to do case independent * matching. Basically, every ascii character maps to itself, except diff --git a/helpers/testnet.c b/helpers/testnet.c index feda38b4..cbe2d97e 100644 --- a/helpers/testnet.c +++ b/helpers/testnet.c @@ -220,9 +220,9 @@ devopen(const char *name, const char *mode) localpname = cp; while (*cp != '/' && *cp != '\0') cp++; - /* + /* * Require a port, let them explicitly put 0 if - * they don't care. + * they don't care. */ if (*cp != '/' || cp == localpname) { fprintf(stderr, _("special file name `%s' is incomplete"), name); @@ -241,7 +241,7 @@ devopen(const char *name, const char *mode) cp++; hostname = cp; while (*cp != '/' && *cp != '\0') - cp++; + cp++; if (*cp != '/' || cp == hostname) { *localpnamelastcharp = '/'; fprintf(stderr, _("must supply a remote hostname to `/inet'")); @@ -278,7 +278,7 @@ devopen(const char *name, const char *mode) char *cp, *end; unsigned long count = 0; char *ms2; - + first_time = false; if ((cp = getenv("GAWK_SOCK_RETRIES")) != NULL) { count = strtoul(cp, & end, 10); diff --git a/int_array.c b/int_array.c index c244169f..2ab68eeb 100644 --- a/int_array.c +++ b/int_array.c @@ -2,23 +2,23 @@ * int_array.c - routines for arrays of integer indices. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-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 @@ -175,7 +175,7 @@ is_integer(NODE *symbol, NODE *subs) if (len == 0 || (! isdigit((unsigned char) *cp) && *cp != '-')) return NULL; - if (len > 1 && + if (len > 1 && ((*cp == '0') /* "00", "011" .. */ || (*cp == '-' && *(cp + 1) == '0') /* "-0", "-011" .. */ ) @@ -240,7 +240,7 @@ int_lookup(NODE *symbol, NODE *subs) if (! is_integer(symbol, subs)) { - xn = symbol->xarray; + xn = symbol->xarray; if (xn == NULL) { xn = symbol->xarray = make_array(); xn->vname = symbol->vname; /* shallow copy */ @@ -258,9 +258,9 @@ int_lookup(NODE *symbol, NODE *subs) hash1 = int_hash(k, symbol->array_size); if ((lhs = int_find(symbol, k, hash1)) != NULL) return lhs; - + /* It's not there, install it */ - + symbol->table_size++; /* first see if we would need to grow the array, before installing */ @@ -274,7 +274,7 @@ int_lookup(NODE *symbol, NODE *subs) /* have to recompute hash value for new size */ hash1 = int_hash(k, symbol->array_size); } - + return int_insert(symbol, k, hash1); } @@ -328,7 +328,7 @@ int_clear(NODE *symbol, NODE *subs ATTRIBUTE_UNUSED) r = b->aivalue[j]; if (r->type == Node_var_array) { assoc_clear(r); /* recursively clear all sub-arrays */ - efree(r->vname); + efree(r->vname); freenode(r); } else unref(r); @@ -454,7 +454,7 @@ int_copy(NODE *symbol, NODE *newsymb) /* find the current hash size */ cursize = symbol->array_size; - + /* allocate new table */ emalloc(new, BUCKET **, cursize * sizeof(BUCKET *), "int_copy"); memset(new, '\0', cursize * sizeof(BUCKET *)); @@ -493,7 +493,7 @@ int_copy(NODE *symbol, NODE *newsymb) newchain->ainext = NULL; pnew = & newchain->ainext; } - } + } if (symbol->xarray != NULL) { NODE *xn, *n; @@ -539,7 +539,7 @@ int_list(NODE *symbol, NODE *t) if ((assoc_kind & (AINDEX|AVALUE)) == (AINDEX|AVALUE)) elem_size = 2; list_size = elem_size * num_elems; - + if (symbol->xarray != NULL) { xn = symbol->xarray; list = xn->alist(xn, t); @@ -559,7 +559,7 @@ int_list(NODE *symbol, NODE *t) /* index */ num = b->ainum[j]; if ((assoc_kind & AISTR) != 0) { - sprintf(buf, "%ld", num); + sprintf(buf, "%ld", num); subs = make_string(buf, strlen(buf)); subs->numbr = num; subs->flags |= (NUMCUR|NUMINT); @@ -604,7 +604,7 @@ int_kilobytes(NODE *symbol) for (b = symbol->buckets[i]; b != NULL; b = b->ainext) bucket_cnt++; } - kb = (((AWKNUM) bucket_cnt) * sizeof (BUCKET) + + kb = (((AWKNUM) bucket_cnt) * sizeof (BUCKET) + ((AWKNUM) symbol->array_size) * sizeof (BUCKET *)) / 1024.0; if (symbol->xarray != NULL) @@ -738,7 +738,7 @@ int_hash(uint32_t k, uint32_t hsize) */ /* This is the final mixing function used by Paul Hsieh in SuperFastHash. */ - + k ^= k << 3; k += k >> 5; k ^= k << 4; @@ -780,7 +780,7 @@ int_insert(NODE *symbol, long k, uint32_t hash1) b = symbol->buckets[hash1]; - /* Only the first bucket in the chain can be partially full, but is never empty. */ + /* Only the first bucket in the chain can be partially full, but is never empty. */ if (b == NULL || (i = b->aicount) == 2) { getbucket(b); @@ -820,7 +820,7 @@ grow_int_table(NODE *symbol) static const unsigned long sizes[] = { 13, 127, 1021, 8191, 16381, 32749, 65497, 131101, 262147, 524309, 1048583, 2097169, - 4194319, 8388617, 16777259, 33554467, + 4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459, 536870923, 1073741827 }; diff --git a/interpret.h b/interpret.h index 50eea9f2..bba3cbb5 100644 --- a/interpret.h +++ b/interpret.h @@ -2,22 +2,22 @@ * interpret.h --- run a list of instructions. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2015 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 @@ -99,7 +99,7 @@ top: /* 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: * @@ -161,7 +161,7 @@ top: m = m->orig_array; } } - + switch (m->type) { case Node_var: if (do_lint && var_uninitialized(m)) @@ -203,7 +203,7 @@ uninitialized_scalar: cant_happen(); } } - break; + break; case Op_push_param: /* function argument */ m = pc->memory; @@ -241,7 +241,7 @@ uninitialized_scalar: /* for FUNCTAB, get the name as the element value */ if (t1 == func_table) { static bool warned = false; - + if (do_lint && ! warned) { warned = true; lintwarn(_("FUNCTAB is a gawk extension")); @@ -259,7 +259,7 @@ uninitialized_scalar: /* for SYMTAB, step through to the actual variable */ if (t1 == symbol_table) { static bool warned = false; - + if (do_lint && ! warned) { warned = true; lintwarn(_("SYMTAB is a gawk extension")); @@ -304,7 +304,7 @@ uninitialized_scalar: t1 = POP_ARRAY(); if (do_lint && in_array(t1, t2) == NULL) { t2 = force_string(t2); - if (pc->do_reference) + if (pc->do_reference) lintwarn(_("reference to uninitialized element `%s[\"%.*s\"]'"), array_vname(t1), (int) t2->stlen, t2->stptr); if (t2->stlen == 0) @@ -408,7 +408,7 @@ uninitialized_scalar: case Op_jmp_true: r = POP_SCALAR(); di = eval_condition(r); - DEREF(r); + DEREF(r); if (di) JUMPTO(pc->target_jmp); break; @@ -499,7 +499,7 @@ plus: case Op_minus: t2 = POP_NUMBER(); x2 = t2->numbr; - DEREF(t2); + DEREF(t2); minus: t1 = TOP_NUMBER(); r = make_number(t1->numbr - x2); @@ -549,7 +549,7 @@ quotient: r = make_number(t1->numbr / x2); DEREF(t1); REPLACE(r); - break; + break; case Op_mod_i: x2 = force_number(pc->memory)->numbr; @@ -673,7 +673,7 @@ mod: * simple variable assignment optimization, * see awkgram.y (optimize_assignment) */ - + lhs = get_lhs(pc->memory, false); unref(*lhs); r = pc->initval; /* constant initializer */ @@ -737,7 +737,7 @@ mod: } else free_wstr(*lhs); } else { - size_t nlen = t1->stlen + t2->stlen; + size_t nlen = t1->stlen + t2->stlen; char *p; emalloc(p, char *, nlen + 1, "r_interpret"); @@ -745,7 +745,7 @@ mod: memcpy(p + t1->stlen, t2->stptr, t2->stlen); /* N.B. No NUL-termination required, since make_str_node will do it. */ unref(*lhs); - t1 = *lhs = make_str_node(p, nlen, ALREADY_MALLOCED); + t1 = *lhs = make_str_node(p, nlen, ALREADY_MALLOCED); } DEREF(t2); break; @@ -760,7 +760,7 @@ mod: break; case Op_subscript_assign: - /* conditionally execute post-assignment routine for an array element */ + /* conditionally execute post-assignment routine for an array element */ if (set_idx != NULL) { di = true; @@ -994,7 +994,7 @@ arrayfor: } PUSH(m); break; - + case Op_match_rec: m = pc->memory; t1 = *get_field(0, (Func_ptr *) 0); @@ -1055,7 +1055,7 @@ match_re: } else if (f->type == Node_builtin_func) { int arg_count = (pc + 1)->expr_count; builtin_func_t the_func = lookup_builtin(t1->stptr); - + assert(the_func != NULL); /* call it */ @@ -1088,11 +1088,11 @@ match_re: npc[1] = pc[1]; npc[1].func_name = fname; /* name of the builtin */ npc[1].expr_count = bc->expr_count; /* defined max # of arguments */ - ni = npc; + ni = npc; JUMPTO(ni); } else fatal(_("function called indirectly through `%s' does not exist"), - pc->func_name); + pc->func_name); } pc->func_body = f; /* save for next call */ @@ -1126,7 +1126,7 @@ match_re: pc->expr_count = arg_count; /* actual argument count */ (pc + 1)->func_name = fname; /* name of the builtin */ (pc + 1)->expr_count = bc->expr_count; /* defined max # of arguments */ - ni = pc; + ni = pc; JUMPTO(ni); } @@ -1138,7 +1138,7 @@ match_re: m = POP_SCALAR(); /* return value */ ni = pop_fcall(); - + /* put the return value back on stack */ PUSH(m); @@ -1163,7 +1163,7 @@ match_re: /* Save execution state so that we can return to it * from Op_after_beginfile or Op_after_endfile. - */ + */ push_exec_state(pc, currule, source, stack_ptr); @@ -1221,8 +1221,8 @@ match_re: execute beginfile block */ } break; - - case Op_get_record: + + case Op_get_record: { int errcode = 0; @@ -1280,13 +1280,13 @@ match_re: JUMPTO(ni); } else { /* do run ENDFILE block(s) first. */ - + /* Execution state to return to in Op_after_endfile. */ push_exec_state(ni, currule, source, stack_ptr); JUMPTO(pc->target_endfile); - } - } /* else + } + } /* else Start over with the first rule. */ /* empty the run-time stack to avoid memory leak */ @@ -1377,7 +1377,7 @@ match_re: /* not already triggered and left expression is true */ decr_sp(); ip->triggered = true; - JUMPTO(ip->target_jmp); /* evaluate right expression */ + JUMPTO(ip->target_jmp); /* evaluate right expression */ } result = ip->triggered || di; @@ -2,23 +2,23 @@ * io.c --- routines for dealing with input and output and records */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-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 @@ -357,7 +357,7 @@ init_io() * PROCINFO entries for timeout are dynamic; * We can't be any more specific than this. */ - if (PROCINFO_node != NULL) + if (PROCINFO_node != NULL) read_can_timeout = true; } @@ -417,7 +417,7 @@ after_beginfile(IOBUF **curfile) bool valid; fname = iop->public.name; - errcode = iop->errcode; + errcode = iop->errcode; valid = iop->valid; errno = 0; update_ERRNO_int(errcode); @@ -466,12 +466,12 @@ nextfile(IOBUF **curfile, bool skipping) (void) iop_close(iop); *curfile = NULL; return 1; /* run endfile block */ - } else + } else return 0; } argc = get_number_si(ARGC_node->var_value); - + for (; i < argc; i++) { tmp = make_number((AWKNUM) i); (void) force_string(tmp); @@ -597,7 +597,7 @@ inrec(IOBUF *iop, int *errcode) cnt = EOF; else if ((iop->flag & IOP_CLOSED) != 0) cnt = EOF; - else + else cnt = get_a_record(& begin, iop, errcode); /* Note that get_a_record may return -2 when I/O would block */ @@ -1022,7 +1022,7 @@ redirect_string(const char *str, size_t explen, bool not_string, #ifdef VMS /* Alpha/VMS V7.1+ C RTL is returning these instead of EMFILE (haven't tried other post-V6.2 systems) */ - else if ((errno == EIO || errno == EVMSERR) && + else if ((errno == EIO || errno == EVMSERR) && (vaxc$errno == SS$_EXQUOTA || vaxc$errno == SS$_EXBYTLM || vaxc$errno == RMS$_ACC || @@ -1168,7 +1168,7 @@ close_one() } if (rp == NULL) /* surely this is the only reason ??? */ - fatal(_("too many pipes or input files open")); + fatal(_("too many pipes or input files open")); } /* do_close --- completely close an open file or pipe */ @@ -1747,7 +1747,7 @@ devopen(const char *name, const char *mode) char *cp, *end; unsigned long count = 0; char *ms2; - + first_time = false; if ((cp = getenv("GAWK_SOCK_RETRIES")) != NULL) { count = strtoul(cp, & end, 10); @@ -1886,7 +1886,7 @@ two_way_open(const char *str, struct redirect *rp, int extfd) char c; int master, dup_master; int slave; - int save_errno; + int save_errno; pid_t pid; struct stat statb; struct termios st; @@ -2141,7 +2141,7 @@ use_pipes: #if defined(__EMX__) || defined(__MINGW32__) save_stdin = dup(0); /* duplicate stdin */ save_stdout = dup(1); /* duplicate stdout */ - + if (save_stdout == -1 || save_stdin == -1) { /* if an error occurs close all open file handles */ save_errno = errno; @@ -2154,7 +2154,7 @@ use_pipes: errno = save_errno; return false; } - + /* connect pipes to stdin and stdout */ close(1); /* close stdout */ if (dup(ctop[1]) != 1) { /* connect pipe input to stdout */ @@ -2174,7 +2174,7 @@ use_pipes: /* none of these handles must be inherited by the child process */ (void) close(ptoc[0]); /* close pipe output, child will use stdin instead */ (void) close(ctop[1]); /* close pipe input, child will use stdout instead */ - + os_close_on_exec(ptoc[1], str, "pipe", "from"); /* pipe input: output of the parent process */ os_close_on_exec(ctop[0], str, "pipe", "from"); /* pipe output: input of the parent process */ os_close_on_exec(save_stdin, str, "pipe", "from"); /* saved stdin of the parent process */ @@ -2188,7 +2188,7 @@ use_pipes: qcmd = quote_cmd(str), NULL); efree(qcmd); #endif - + /* restore stdin and stdout */ close(1); if (dup(save_stdout) != 1) { @@ -2197,7 +2197,7 @@ use_pipes: fatal(_("restoring stdout in parent process failed\n")); } close(save_stdout); - + close(0); if (dup(save_stdin) != 0) { close(save_stdin); @@ -2223,7 +2223,7 @@ use_pipes: errno = save_errno; return false; } - + if (pid == 0) { /* child */ if (close(1) == -1) fatal(_("close of stdout in child failed (%s)"), @@ -2444,10 +2444,10 @@ gawk_popen(const char *cmd, struct redirect *rp) fatal(_("moving pipe to stdout in child failed (dup: %s)"), strerror(errno)); } - + /* none of these handles must be inherited by the child process */ close(p[1]); /* close pipe input */ - + os_close_on_exec(p[0], cmd, "pipe", "from"); /* pipe output: input of the parent process */ os_close_on_exec(save_stdout, cmd, "pipe", "from"); /* saved stdout of the parent process */ @@ -2458,7 +2458,7 @@ gawk_popen(const char *cmd, struct redirect *rp) qcmd = quote_cmd(cmd), NULL); efree(qcmd); #endif - + /* restore stdout */ close(1); if (dup(save_stdout) != 1) { @@ -2686,7 +2686,7 @@ do_getline(int into_variable, IOBUF *iop) update_ERRNO_int(errcode); if (into_variable) (void) POP_ADDRESS(); - return make_number((AWKNUM) cnt); + return make_number((AWKNUM) cnt); } if (cnt == EOF) @@ -2709,8 +2709,8 @@ do_getline(int into_variable, IOBUF *iop) typedef struct { const char *envname; char **dfltp; /* pointer to address of default path */ - char **awkpath; /* array containing library search paths */ - int max_pathlen; /* length of the longest item in awkpath */ + char **awkpath; /* array containing library search paths */ + int max_pathlen; /* length of the longest item in awkpath */ } path_info; static path_info pi_awkpath = { @@ -2779,7 +2779,7 @@ init_awkpath(path_info *pi) #undef INC_PATH } -/* do_find_source --- search $AWKPATH for file, return NULL if not found */ +/* do_find_source --- search $AWKPATH for file, return NULL if not found */ static char * do_find_source(const char *src, struct stat *stb, int *errcode, path_info *pi) @@ -2803,7 +2803,7 @@ do_find_source(const char *src, struct stat *stb, int *errcode, path_info *pi) if (pi->awkpath == NULL) init_awkpath(pi); - emalloc(path, char *, pi->max_pathlen + strlen(src) + 1, "do_find_source"); + emalloc(path, char *, pi->max_pathlen + strlen(src) + 1, "do_find_source"); for (i = 0; pi->awkpath[i] != NULL; i++) { if (strcmp(pi->awkpath[i], "./") == 0 || strcmp(pi->awkpath[i], ".") == 0) *path = '\0'; @@ -2820,7 +2820,7 @@ do_find_source(const char *src, struct stat *stb, int *errcode, path_info *pi) return NULL; } -/* find_source --- find source file with default file extension handling */ +/* find_source --- find source file with default file extension handling */ char * find_source(const char *src, struct stat *stb, int *errcode, int is_extlib) @@ -3288,51 +3288,51 @@ rs1scan(IOBUF *iop, struct recmatch *recm, SCANSTATE *state) * Subject: Re: multibyte locales: any way to find if a character isn't multibyte? * Date: Mon, 23 Jun 2003 12:20:16 +0200 * Cc: isamu@yamato.ibm.com - * + * * Hi, - * + * * > Is there any way to make the following query to the current locale? * > * > Given an 8-bit value, can this value ever appear as part of * > a multibyte character? - * + * * There is no simple answer here. The easiest solution I see is to * get the current locale's codeset (via locale_charset() which is a * wrapper around nl_langinfo(CODESET)), and then perform a case-by-case * treatment of the known multibyte encodings, from GB2312 to EUC-JISX0213; * for the unibyte encodings, a single btowc() call will tell you. - * + * * > This is particularly critical for me for ASCII newline ('\n'). If I * > can be guaranteed that it never shows up as part of a multibyte character, * > I can speed up gawk considerably in mulitbyte locales. - * + * * This is much simpler to answer! * In all ASCII based multibyte encodings used for locales today (this * excludes EBCDIC based doublebyte encodings from IBM, and also excludes * ISO-2022-JP which is used for email exchange but not as a locale encoding) * ALL bytes in the range 0x00..0x2F occur only as a single character, not * as part of a multibyte character. - * + * * So it's safe to assume, but deserves a comment in the source. - * + * * Bruno *************************************************************** * From: Bruno Haible <bruno@clisp.org> * To: Aharon Robbins <arnold@skeeve.com> * Subject: Re: multibyte locales: any way to find if a character isn't multibyte? * Date: Mon, 23 Jun 2003 14:27:49 +0200 - * + * * On Monday 23 June 2003 14:11, you wrote: - * + * * > if (rs != '\n' && MB_CUR_MAX > 1) { - * + * * If you assume ASCII, you can even write - * + * * if (rs >= 0x30 && MB_CUR_MAX > 1) { - * + * * (this catches also the space character) but if portability to EBCDIC * systems is desired, your code is fine as is. - * + * * Bruno */ /* Thus, the check for \n here; big speedup ! */ @@ -3665,7 +3665,7 @@ get_a_record(char **out, /* pointer to pointer to data */ *errcode = errno; if (errno_io_retry() && retryable(iop)) return -2; - iop->flag |= IOP_AT_EOF; + iop->flag |= IOP_AT_EOF; return EOF; } else { iop->dataend = iop->buf + iop->count; @@ -3853,7 +3853,7 @@ set_RS() * in case of fatal error in make_regexp. */ refree(RS_re_yes_case); /* NULL argument is ok */ - refree(RS_re_no_case); + refree(RS_re_no_case); RS_re_yes_case = RS_re_no_case = RS_regexp = NULL; if (RS->stlen == 0) { @@ -3978,9 +3978,9 @@ inetfile(const char *str, struct inet_socket_info *isi) isi->localport.offset = cp-str; while (*cp != '/' && *cp != '\0') cp++; - /* + /* * Require a port, let them explicitly put 0 if - * they don't care. + * they don't care. */ if (*cp != '/' || ((isi->localport.len = (cp-str)-isi->localport.offset) == 0)) return false; @@ -3989,7 +3989,7 @@ inetfile(const char *str, struct inet_socket_info *isi) cp++; isi->remotehost.offset = cp-str; while (*cp != '/' && *cp != '\0') - cp++; + cp++; if (*cp != '/' || ((isi->remotehost.len = (cp-str)-isi->remotehost.offset) == 0)) return false; @@ -4005,7 +4005,7 @@ inetfile(const char *str, struct inet_socket_info *isi) */ isi->remoteport.offset = cp-str; while (*cp != '/' && *cp != '\0') - cp++; + cp++; if (*cp != '\0' || ((isi->remoteport.len = (cp-str)-isi->remoteport.offset) == 0)) return false; @@ -4021,14 +4021,14 @@ inetfile(const char *str, struct inet_socket_info *isi) /* * in_PROCINFO --- return value for a PROCINFO element with * SUBSEP seperated indices. - */ + */ static NODE * in_PROCINFO(const char *pidx1, const char *pidx2, NODE **full_idx) { char *str; size_t str_len; - NODE *r, *sub = NULL; + NODE *r, *sub = NULL; NODE *subsep = SUBSEP_node->var_value; if (PROCINFO_node == NULL || (pidx1 == NULL && pidx2 == NULL)) @@ -1,23 +1,23 @@ /* - * main.c -- Code generator and main program for gawk. + * main.c -- Code generator and main program for gawk. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-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 @@ -357,7 +357,7 @@ main(int argc, char **argv) init_debug(); #ifdef HAVE_MPFR - /* Set up MPFR defaults, and register pre-exec hook to process arithmetic opcodes */ + /* Set up MPFR defaults, and register pre-exec hook to process arithmetic opcodes */ if (do_mpfr) init_mpfr(DEFAULT_PREC, DEFAULT_ROUNDMODE); #endif @@ -458,7 +458,7 @@ main(int argc, char **argv) /* Read in the program */ if (parse_program(& code_block) != 0) exit(EXIT_FAILURE); - + if (do_intl) exit(EXIT_SUCCESS); @@ -520,7 +520,7 @@ main(int argc, char **argv) if (do_tidy_mem) release_all_vars(); - + /* keep valgrind happier */ if (extra_stack) efree(extra_stack); @@ -663,7 +663,7 @@ GNU General Public License for more details.\n\ static const char blurb_part3[] = N_("You should have received a copy of the GNU General Public License\n\ along with this program. If not, see http://www.gnu.org/licenses/.\n"); - + /* multiple blurbs are needed for some brain dead compilers. */ printf(_(blurb_part1), UPDATE_YEAR); /* Last update year */ fputs(_(blurb_part2), stdout); @@ -774,7 +774,7 @@ static const struct varinit varinit[] = { {&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}, +{&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 }, @@ -1153,7 +1153,7 @@ arg_assign(char *arg, bool initing) if (! initing) { var = lookup(arg); if (var != NULL && var->type == Node_func) - fatal(_("cannot use function `%s' as variable name"), arg); + fatal(_("cannot use function `%s' as variable name"), arg); } /* @@ -1275,7 +1275,7 @@ version() #ifdef HAVE_MPFR printf(" (GNU MPFR %s, GNU MP %s)", mpfr_get_version(), gmp_version); #endif - printf("\n"); + printf("\n"); print_ext_versions(); /* @@ -1358,7 +1358,7 @@ estrdup(const char *str, size_t len) s[len] = '\0'; return s; } - + #if defined(HAVE_LOCALE_H) /* init_locale --- initialize locale info. */ @@ -1428,7 +1428,7 @@ long getenv_long(const char *name) { const char *val; - long newval; + long newval; if ((val = getenv(name)) != NULL && isdigit((unsigned char) *val)) { for (newval = 0; *val && isdigit((unsigned char) *val); val++) newval = (newval * 10) + *val - '0'; @@ -1454,7 +1454,7 @@ parse_args(int argc, char **argv) /* we do error messages ourselves on invalid options */ opterr = false; - /* copy argv before getopt gets to it; used to restart the debugger */ + /* copy argv before getopt gets to it; used to restart the debugger */ save_argv(argc, argv); /* option processing. ready, set, go! */ @@ -1604,7 +1604,7 @@ parse_args(int argc, char **argv) case 'r': do_flags |= DO_INTERVALS; break; - + case 's': do_optimize = false; break; diff --git a/mbsupport.h b/mbsupport.h index 37dd219d..e7b40423 100644 --- a/mbsupport.h +++ b/mbsupport.h @@ -2,23 +2,23 @@ * mbsupport.h --- Localize determination of whether we have multibyte stuff. */ -/* +/* * Copyright (C) 2004, 2005, 2011, 2012, 2015, 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 diff --git a/missing_d/ChangeLog b/missing_d/ChangeLog index 0c87aa05..83f5b93e 100644 --- a/missing_d/ChangeLog +++ b/missing_d/ChangeLog @@ -1,3 +1,7 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + 2016-09-07 Arnold D. Robbins <arnold@skeeve.com> * setenv.c: Update license text in setenv.c. Thanks diff --git a/missing_d/snprintf.c b/missing_d/snprintf.c index 6cee2bed..9d692d5a 100644 --- a/missing_d/snprintf.c +++ b/missing_d/snprintf.c @@ -2,22 +2,22 @@ * snprintf.c - Implement snprintf and vsnprintf on platforms that need them. */ -/* +/* * Copyright (C) 2006, 2007 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 @@ -2,22 +2,22 @@ * mpfr.c - routines for arbitrary-precision number support in gawk. */ -/* +/* * Copyright (C) 2012, 2013, 2015 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 @@ -118,7 +118,7 @@ mpg_node(unsigned int tp) mpz_init(r->mpg_i); r->flags = MPZN; } - + r->valref = 1; r->flags |= MALLOC|NUMBER|NUMCUR; r->stptr = NULL; @@ -151,7 +151,7 @@ mpg_make_number(double x) return r; } -/* mpg_strtoui --- assign arbitrary-precision integral value from a string */ +/* mpg_strtoui --- assign arbitrary-precision integral value from a string */ int mpg_strtoui(mpz_ptr zi, char *str, size_t len, char **end, int base) @@ -264,7 +264,7 @@ mpg_zero(NODE *n) n->flags &= ~MPFN; } if (! is_mpg_integer(n)) { - mpz_init(n->mpg_i); /* this also sets its value to 0 */ + mpz_init(n->mpg_i); /* this also sets its value to 0 */ n->flags |= MPZN; } else mpz_set_si(n->mpg_i, 0); @@ -335,7 +335,7 @@ done: if (errno == 0 && ptr == cpend) return true; errno = 0; - return false; + return false; } /* mpg_force_number --- force a value to be a multiple-precision number */ @@ -384,7 +384,7 @@ mpg_format_val(const char *format, int index, NODE *s) efree(s->stptr); s->stptr = r->stptr; freenode(r); /* Do not unref(r)! We want to keep s->stptr == r->stpr. */ - + s->flags |= STRCUR; free_wstr(s); return s; @@ -427,8 +427,8 @@ mpg_cmp(const NODE *t1, const NODE *t2) /* - * mpg_update_var --- update NR or FNR. - * NR_node->var_value(mpz_t) = MNR(mpz_t) * LONG_MAX + NR(long) + * mpg_update_var --- update NR or FNR. + * NR_node->var_value(mpz_t) = MNR(mpz_t) * LONG_MAX + NR(long) */ NODE * @@ -482,7 +482,7 @@ mpg_set_var(NODE *n) if (is_mpg_integer(val)) r = val->mpg_i; else { - /* convert float to integer */ + /* convert float to integer */ mpfr_get_z(mpzval, val->mpg_numbr, MPFR_RNDZ); r = mpzval; } @@ -548,7 +548,7 @@ set_PREC() if (prec <= 0) { force_number(val); - prec = get_number_si(val); + prec = get_number_si(val); if (prec < MPFR_PREC_MIN || prec > MPFR_PREC_MAX) { force_string(val); warning(_("PREC value `%.*s' is invalid"), (int) val->stlen, val->stptr); @@ -683,7 +683,7 @@ do_mpfr_atan2(int nargs) p1 = MP_FLOAT(t1); p2 = MP_FLOAT(t2); res = mpg_float(); - /* See MPFR documentation for handling of special values like +inf as an argument */ + /* See MPFR documentation for handling of special values like +inf as an argument */ tval = mpfr_atan2(res->mpg_numbr, p1, p2, ROUND_MODE); IEEE_FMT(res->mpg_numbr, tval); @@ -823,11 +823,11 @@ do_mpfr_compl(int nargs) mpg_fmt(_("comp(%Rg): fractional value will be truncated"), p) ); } - + mpfr_get_z(mpzval, p, MPFR_RNDZ); /* float to integer conversion */ zptr = mpzval; } else { - /* (tmp->flags & MPZN) != 0 */ + /* (tmp->flags & MPZN) != 0 */ zptr = tmp->mpg_i; if (do_lint) { if (mpz_sgn(zptr) < 0) @@ -888,8 +888,8 @@ get_intval(NODE *t1, int argnum, const char *op) mpz_init(pz); mpfr_get_z(pz, left, MPFR_RNDZ); /* float to integer conversion */ return pz; /* should be freed */ - } - /* (t1->flags & MPZN) != 0 */ + } + /* (t1->flags & MPZN) != 0 */ pz = t1->mpg_i; if (do_lint) { if (mpz_sgn(pz) < 0) @@ -922,7 +922,7 @@ do_mpfr_lshift(int nargs) NODE *t1, *t2, *res; unsigned long shift; mpz_ptr pz1, pz2; - + t2 = POP_SCALAR(); t1 = POP_SCALAR(); @@ -954,7 +954,7 @@ do_mpfr_rshift(int nargs) NODE *t1, *t2, *res; unsigned long shift; mpz_ptr pz1, pz2; - + t2 = POP_SCALAR(); t1 = POP_SCALAR(); @@ -964,7 +964,7 @@ do_mpfr_rshift(int nargs) /* N.B: See do_mpfp_lshift. */ shift = mpz_get_ui(pz2); /* GMP integer => unsigned long conversion */ res = mpg_integer(); - mpz_fdiv_q_2exp(res->mpg_i, pz1, shift); /* res = pz1 / 2^shift, round towards −inf */ + mpz_fdiv_q_2exp(res->mpg_i, pz1, shift); /* res = pz1 / 2^shift, round towards -inf */ free_intval(t1, pz1); free_intval(t2, pz2); @@ -1285,13 +1285,13 @@ mpg_tofloat(mpfr_ptr mf, mpz_ptr mz) /* * When implicitely converting a GMP integer operand to a MPFR float, use * a precision sufficiently large to hold the converted value exactly. - * + * * $ ./gawk -M 'BEGIN { print 13 % 2 }' * 1 * If the user-specified precision is used to convert the integer 13 to a * float, one will get: * $ ./gawk -M 'BEGIN { PREC=2; print 13 % 2.0 }' - * 0 + * 0 */ prec = mpz_sizeinbase(mz, 2); /* most significant 1 bit position starting at 1 */ @@ -1305,7 +1305,7 @@ mpg_tofloat(mpfr_ptr mf, mpz_ptr mz) else prec = PRECISION_MIN; /* - * Always set the precision to avoid hysteresis, since do_mpfr_func + * Always set the precision to avoid hysteresis, since do_mpfr_func * may copy our precision. */ if (prec != mpfr_get_prec(mf)) @@ -1316,7 +1316,7 @@ mpg_tofloat(mpfr_ptr mf, mpz_ptr mz) } -/* mpg_add --- add arbitrary-precision numbers */ +/* mpg_add --- add arbitrary-precision numbers */ static NODE * mpg_add(NODE *t1, NODE *t2) @@ -1399,7 +1399,7 @@ mpg_mul(NODE *t1, NODE *t2) } -/* mpg_pow --- exponentiation involving arbitrary-precision numbers */ +/* mpg_pow --- exponentiation involving arbitrary-precision numbers */ static NODE * mpg_pow(NODE *t1, NODE *t2) @@ -1498,11 +1498,11 @@ mpg_mod(NODE *t1, NODE *t2) } return r; } - + /* * mpg_interpret --- pre-exec hook in the interpreter. Handles * arithmetic operations with MPFR/GMP numbers. - */ + */ static int mpg_interpret(INSTRUCTION **cp) @@ -1583,7 +1583,7 @@ quotient: if (op == Op_quotient) DEREF(t2); REPLACE(r); - break; + break; case Op_mod_i: t2 = force_number(pc->memory); @@ -2,23 +2,23 @@ * msg.c - routines for error messages. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2001, 2003, 2010-2013 * 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 2, 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 @@ -2,23 +2,23 @@ * node.c -- routines for node management */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2001, 2003-2015, * 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 @@ -173,7 +173,7 @@ goodnum: /* * The following lookup table is used as an optimization in force_string; - * (more complicated) variations on this theme didn't seem to pay off, but + * (more complicated) variations on this theme didn't seem to pay off, but * systematic testing might be in order at some point. */ static const char *values[] = { @@ -323,7 +323,7 @@ r_dupnode(NODE *n) r->flags |= WSTRCUR; } } - + return r; } @@ -394,7 +394,7 @@ make_str_node(const char *s, size_t len, int flags) memcpy(r->stptr, s, len); } r->stptr[len] = '\0'; - + if ((flags & SCAN) != 0) { /* scan for escape sequences */ const char *pf; char *ptm; @@ -478,16 +478,16 @@ r_unref(NODE *tmp) * * Parse a C escape sequence. STRING_PTR points to a variable containing a * pointer to the string to parse. That pointer is updated past the - * characters we use. The value of the escape sequence is returned. + * characters we use. The value of the escape sequence is returned. * * A negative value means the sequence \ newline was seen, which is supposed to - * be equivalent to nothing at all. + * be equivalent to nothing at all. * * If \ is followed by a null character, we return a negative value and leave - * the string pointer pointing at the null character. + * the string pointer pointing at the null character. * * If \ is followed by 000, we return 0 and leave the string pointer after the - * zeros. A value of 0 does not mean end of string. + * zeros. A value of 0 does not mean end of string. * * POSIX doesn't allow \x. */ @@ -981,7 +981,7 @@ void init_btowc_cache() #define BLOCKCHUNK 100 BLOCK nextfree[BLOCK_MAX] = { - { 0, NULL}, /* invalid */ + { 0, NULL}, /* invalid */ { sizeof(NODE), NULL }, { sizeof(BUCKET), NULL }, }; @@ -2,22 +2,22 @@ * nonposix.h --- definitions needed on non-POSIX systems. */ -/* +/* * Copyright (C) 2012, 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 diff --git a/old-extension/ChangeLog b/old-extension/ChangeLog index 3c91b7cd..bd848f9a 100644 --- a/old-extension/ChangeLog +++ b/old-extension/ChangeLog @@ -1,3 +1,7 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + 2015-04-09 Andrew J. Schorr <aschorr@telemetry-investments.com> * bindarr.c (do_bind_array): Undo Arnold's change of 2014-12-18. diff --git a/old-extension/bindarr.c b/old-extension/bindarr.c index 41467425..1a0104db 100644 --- a/old-extension/bindarr.c +++ b/old-extension/bindarr.c @@ -3,22 +3,22 @@ * to array and array elements. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2011 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 @@ -286,7 +286,7 @@ do_unbind_array(int nargs) *symbol = *xn; freenode(xn); - return make_number(0); + return make_number(0); } diff --git a/old-extension/fileop.c b/old-extension/fileop.c index d76a7ded..97a51c81 100644 --- a/old-extension/fileop.c +++ b/old-extension/fileop.c @@ -5,20 +5,20 @@ /* * Copyright (C) 2012 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 @@ -379,7 +379,7 @@ dlload(NODE *tree, void *dl) } -/* dlunload --- routine called when exiting */ +/* dlunload --- routine called when exiting */ void dlunload() diff --git a/old-extension/sparr.c b/old-extension/sparr.c index a3d06e66..1e8642dd 100644 --- a/old-extension/sparr.c +++ b/old-extension/sparr.c @@ -5,20 +5,20 @@ /* * Copyright (C) 2012 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 @@ -75,7 +75,7 @@ static void store_SYS(NODE *symbol, NODE *subs, NODE *val, void *data) { sdata_t *sd = (sdata_t *) data; - + if (subs != NULL && val != NULL && val->type == Node_val) { force_string(subs); if (strcmp(subs->stptr, "readline") == 0) { @@ -98,7 +98,7 @@ load_READLINE(NODE *symbol, void *data) int i; bool long_line = false; - if (! sd->load_file) /* non-existent SYS["readline"] or already loaded */ + if (! sd->load_file) /* non-existent SYS["readline"] or already loaded */ return; file = sd->filename; @@ -145,7 +145,7 @@ load_READLINE(NODE *symbol, void *data) } fclose(fp); sd->load_file = false; /* don't load this file again */ -} +} /* dlload --- load this library */ diff --git a/old-extension/spec_array.c b/old-extension/spec_array.c index 34d15fc5..f933aa35 100644 --- a/old-extension/spec_array.c +++ b/old-extension/spec_array.c @@ -4,20 +4,20 @@ /* * Copyright (C) 2012, 2014 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 @@ -52,7 +52,7 @@ typedef struct spec_array { * void load_func(NODE *array, void *data) * * Use register_deferred_array(array, load_func, void *data) to - * bind an array to the load routine. + * bind an array to the load routine. */ static NODE **deferred_array_init(NODE *, NODE *); @@ -72,7 +72,7 @@ static afunc_t deferred_array_func[] = { deferred_array_exists, deferred_array_clear, deferred_array_remove, - deferred_array_list, + deferred_array_list, deferred_array_copy, null_afunc, /* dump */ (afunc_t) 0, /* store */ @@ -86,7 +86,7 @@ deferred_array_init(NODE *symbol, NODE *subs) { if (symbol != NULL) { array_t *av = (array_t *) symbol->xarray; - symbol->xarray = NULL; /* this is to avoid an assertion failure in null_array */ + symbol->xarray = NULL; /* this is to avoid an assertion failure in null_array */ null_array(symbol); /* typeless empty array */ if (symbol->parent_array == NULL) { /* main array */ @@ -141,7 +141,7 @@ static NODE ** deferred_array_remove(NODE *symbol, NODE *subs) { array_t *av = (array_t *) symbol->xarray; - + (void) SUPER(aremove)(symbol, subs); if (av) { symbol->xarray = NULL; @@ -157,7 +157,7 @@ static NODE ** deferred_array_clear(NODE *symbol, NODE *subs) { array_t *av = (array_t *) symbol->xarray; - + (void) SUPER(aclear)(symbol, subs); if (av) { symbol->xarray = NULL; @@ -181,7 +181,7 @@ deferred_array_clear(NODE *symbol, NODE *subs) * The store routine must take an additional argument for the * value. The value can be NULL if the specific element is * removed from the array. The subscript (and the value) is NULL - * when the entire array is deleted. + * when the entire array is deleted. * * void store_func(NODE *array, NODE *subs, NODE *value, void *data) * @@ -207,7 +207,7 @@ static afunc_t dyn_array_func[] = { dyn_array_exists, dyn_array_clear, dyn_array_remove, - dyn_array_list, + dyn_array_list, dyn_array_copy, null_afunc, /* dump */ dyn_array_store, diff --git a/pc/ChangeLog b/pc/ChangeLog index 8d844018..2b4b1183 100644 --- a/pc/ChangeLog +++ b/pc/ChangeLog @@ -1,3 +1,7 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + 2016-09-24 Eli Zaretskii <eliz@gnu.org> Fix compilation warnings on MinGW with the latest runtime. @@ -104,7 +104,7 @@ scriptify(const char *command) free(cmd); cmd = NULL; } - if (fp) fclose(fp); + if (fp) fclose(fp); return(cmd); } diff --git a/posix/ChangeLog b/posix/ChangeLog index c5ce0340..cd1a2f68 100644 --- a/posix/ChangeLog +++ b/posix/ChangeLog @@ -1,3 +1,7 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + 2016-08-25 Arnold D. Robbins <arnold@skeeve.com> * 4.1.4: Release tar ball made. diff --git a/posix/gawkmisc.c b/posix/gawkmisc.c index d422bd0f..40950826 100644 --- a/posix/gawkmisc.c +++ b/posix/gawkmisc.c @@ -1,5 +1,5 @@ /* gawkmisc.c --- miscellaneous gawk routines that are OS specific. - + Copyright (C) 1986, 1988, 1989, 1991 - 1998, 2001 - 2004, 2011 the Free Software Foundation, Inc. @@ -40,7 +40,7 @@ char * gawk_name(const char *filespec) { char *p; - + /* "path/name" -> "name" */ p = strrchr(filespec, '/'); return (p == NULL ? (char *) filespec : p + 1); @@ -272,7 +272,7 @@ os_isatty(int fd) { return isatty(fd); } - + /* files_are_same --- return true if files are identical */ int @@ -2,22 +2,22 @@ * profile.c - gawk bytecode pretty-printer with counts */ -/* +/* * Copyright (C) 1999-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 @@ -225,10 +225,10 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags) case Op_rule: /* * Rules are three instructions long. - * See append_rule in awkgram.y. - * The first has the Rule Op Code, nexti etc. + * See append_rule in awkgram.y. + * The first has the Rule Op Code, nexti etc. * The second, (pc + 1) has firsti and lasti: - * the first/last ACTION instructions for this rule. + * the first/last ACTION instructions for this rule. * The third has first_line and last_line: * the first and last source line numbers. */ @@ -265,7 +265,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags) t1 = pp_pop(); fprintf(prof_fp, "%s {", t1->pp_str); pp_free(t1); - } else + } else fprintf(prof_fp, "{"); ip1 = (pc + 1)->firsti; ip2 = (pc + 1)->lasti; @@ -347,7 +347,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags) cant_happen(); } - switch (pc->opcode) { + switch (pc->opcode) { case Op_store_var: t2 = pp_pop(); /* l.h.s. */ t1 = pp_pop(); /* r.h.s. */ @@ -390,7 +390,7 @@ cleanup: efree(tmp); pp_free(t1); pp_push(pc->opcode, str, CAN_FREE); - break; + break; case Op_and: case Op_or: @@ -503,7 +503,7 @@ cleanup: pp_free(t1); if ((flags & IN_FOR_HEADER) == 0) pc = end_line(pc); - break; + break; case Op_concat: str = pp_concat(pc->expr_count); @@ -520,7 +520,7 @@ cleanup: sub = pp_list(pc->expr_count, NULL, pc->expr_count > 1 ? "][" : ", "); fprintf(prof_fp, "%s %s[%s]", op2str(Op_K_delete), array, sub); efree(sub); - } else + } else fprintf(prof_fp, "%s %s", op2str(Op_K_delete), array); if ((flags & IN_FOR_HEADER) == 0) pc = end_line(pc); @@ -532,7 +532,7 @@ cleanup: /* Efficency hack not in effect because of exec_count instruction */ cant_happen(); break; - + case Op_in_array: { char *array, *sub; @@ -561,7 +561,7 @@ cleanup: case Op_field_assign: case Op_subscript_assign: case Op_arrayfor_init: - case Op_arrayfor_incr: + case Op_arrayfor_incr: case Op_arrayfor_final: case Op_newfile: case Op_get_record: @@ -622,7 +622,7 @@ cleanup: else { tmp = pp_list(pc->expr_count, " ", ", "); tmp[strlen(tmp) - 1] = '\0'; /* remove trailing space */ - } + } if (pc->redir_type != 0) { t1 = pp_pop(); @@ -641,7 +641,7 @@ cleanup: case Op_push_re: if (pc->memory->type != Node_regex) break; - /* else + /* else fall through */ case Op_match_rec: { @@ -716,7 +716,7 @@ cleanup: if (pc->opcode == Op_indirect_func_call) pre = "@"; else - pre = ""; + pre = ""; pcount = (pc + 1)->expr_count; if (pcount > 0) { tmp = pp_list(pcount, "()", ", "); @@ -812,7 +812,7 @@ cleanup: case Op_K_for: ip1 = pc + 1; indent(ip1->forloop_body->exec_count); - fprintf(prof_fp, "%s (", op2str(pc->opcode)); + fprintf(prof_fp, "%s (", op2str(pc->opcode)); /* If empty for looop header, print it a little more nicely. */ if ( pc->nexti->opcode == Op_no_op @@ -990,7 +990,7 @@ cleanup: pc = ip1->nexti; assert(pc->opcode == Op_cond_exp); - pprint(pc->nexti, pc->branch_end, NO_PPRINT_FLAGS); + pprint(pc->nexti, pc->branch_end, NO_PPRINT_FLAGS); f = pp_pop(); t = pp_pop(); @@ -1006,7 +1006,7 @@ cleanup: pp_push(Op_cond_exp, str, CAN_FREE); pc = pc->branch_end; } - break; + break; case Op_exec_count: if (flags == NO_PPRINT_FLAGS) @@ -1042,7 +1042,7 @@ end_line(INSTRUCTION *ip) print_comment(ip->nexti, -1); ret = ip->nexti; } - else + else fprintf(prof_fp, "\n"); return ret; @@ -1554,7 +1554,7 @@ pp_list(int nargs, const char *paren, const char *delim) emalloc(str, char *, len + 1, "pp_list"); s = str; if (paren != NULL) - *s++ = paren[0]; + *s++ = paren[0]; if (nargs > 0) { r = pp_args[nargs]; memcpy(s, r->pp_str, r->pp_len); @@ -1574,7 +1574,7 @@ pp_list(int nargs, const char *paren, const char *delim) if (paren != NULL) *s++ = paren[1]; *s = '\0'; - return str; + return str; } /* is_unary_minus --- return true if string starts with unary minus */ @@ -1649,7 +1649,7 @@ pp_concat(int nargs) *s++ = ' '; } } - + pl_l = prec_level(pp_args[nargs-1]->type); pl_r = prec_level(pp_args[nargs]->type); r = pp_args[nargs]; @@ -1665,7 +1665,7 @@ pp_concat(int nargs) pp_free(r); *s = '\0'; - return str; + return str; } /* pp_group3 --- string together up to 3 strings */ @@ -2,22 +2,22 @@ * protos.h -- function prototypes for when the headers don't have them. */ -/* +/* * Copyright (C) 1991 - 2002, 2011 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 @@ -64,7 +64,7 @@ extern size_t strftime(char *, size_t, const char *, const struct tm *); extern time_t time(time_t *); extern FILE *fdopen(int, const char *); -extern int fprintf(FILE *, const char *, ...); +extern int fprintf(FILE *, const char *, ...); #if ! defined(__GNU_LIBRARY__) extern size_t fwrite(const aptr_t, size_t, size_t, FILE *); #endif @@ -124,7 +124,7 @@ extern unsigned long int strtoul(const char *, char **endptr, int base); #ifndef HAVE_TZSET extern void tzset(); #endif - + #ifndef HAVE_MKTIME extern time_t mktime(struct tm *tp); #endif @@ -2,22 +2,22 @@ * random.h - redefine name of random lib routines to avoid conflicts */ -/* +/* * Copyright (C) 1996, 2001, 2004, 2005, 2013 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 @@ -2,22 +2,22 @@ * re.c - compile regular expressions. */ -/* +/* * Copyright (C) 1991-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 @@ -75,7 +75,7 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal) /* * Build a copy of the string (in buf) with the * escaped characters translated, and generate the regex - * from that. + * from that. */ if (buf == NULL) { emalloc(buf, char *, len + 1, "make_regexp"); @@ -243,7 +243,7 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal) break; } } - + return rp; } @@ -315,7 +315,7 @@ void refree(Regexp *rp) { if (rp == NULL) - return; + return; rp->pat.translate = NULL; regfree(& rp->pat); if (rp->regs.start) @@ -216,7 +216,7 @@ static const size_t __re_error_msgid_idx[] = #ifndef HAVE_BTOWC -wchar_t +wchar_t btowc (int c) { wchar_t wtmp[2]; @@ -2,22 +2,22 @@ * replace.c -- Get replacement versions of functions. */ -/* +/* * Copyright (C) 1989, 1991-2013 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 @@ -84,7 +84,7 @@ #ifndef HAVE_TZSET #include "missing_d/tzset.c" #endif /* HAVE_TZSET */ - + #ifndef HAVE_MKTIME /* mktime.c defines main() if DEBUG is set */ #undef DEBUG diff --git a/str_array.c b/str_array.c index f66b22cc..65e0b741 100644 --- a/str_array.c +++ b/str_array.c @@ -2,23 +2,23 @@ * str_array.c - routines for associative arrays of string indices. */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-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 @@ -126,7 +126,7 @@ str_array_init(NODE *symbol ATTRIBUTE_UNUSED, NODE *subs ATTRIBUTE_UNUSED) * isn't there. Returns a pointer ala get_lhs to where its value is stored. * * SYMBOL is the address of the node (or other pointer) being dereferenced. - * SUBS is a number or string used as the subscript. + * SUBS is a number or string used as the subscript. */ static NODE ** @@ -194,7 +194,7 @@ str_lookup(NODE *symbol, NODE *subs) } subs = tmp; } else { - /* string value already "frozen" */ + /* string value already "frozen" */ subs = dupnode(subs); } @@ -245,7 +245,7 @@ str_clear(NODE *symbol, NODE *subs ATTRIBUTE_UNUSED) r = b->ahvalue; if (r->type == Node_var_array) { assoc_clear(r); /* recursively clear all sub-arrays */ - efree(r->vname); + efree(r->vname); freenode(r); } else unref(r); @@ -322,7 +322,7 @@ str_copy(NODE *symbol, NODE *newsymb) BUCKET **old, **new, **pnew; BUCKET *chain, *newchain; unsigned long cursize, i; - + assert(symbol->table_size > 0); /* find the current hash size */ @@ -368,7 +368,7 @@ str_copy(NODE *symbol, NODE *newsymb) newchain->ahnext = NULL; pnew = & newchain->ahnext; } - } + } newsymb->table_size = symbol->table_size; newsymb->buckets = new; @@ -402,9 +402,9 @@ str_list(NODE *symbol, NODE *t) if ((assoc_kind & (AINDEX|AVALUE|ADELETE)) == (AINDEX|ADELETE)) num_elems = 1; list_size = elem_size * num_elems; - + emalloc(list, NODE **, list_size * sizeof(NODE *), "str_list"); - + /* populate it */ for (i = 0; i < symbol->array_size; i++) { @@ -428,7 +428,7 @@ str_list(NODE *symbol, NODE *t) } if (k >= list_size) return list; - } + } } return list; } @@ -445,7 +445,7 @@ str_kilobytes(NODE *symbol) bucket_cnt = symbol->table_size; /* This does not include extra memory for indices with stfmt != -1 */ - kb = (((AWKNUM) bucket_cnt) * sizeof (BUCKET) + + kb = (((AWKNUM) bucket_cnt) * sizeof (BUCKET) + ((AWKNUM) symbol->array_size) * sizeof (BUCKET *)) / 1024.0; return kb; } @@ -533,7 +533,7 @@ str_dump(NODE *symbol, NODE *ndump) return NULL; #undef HCNT -} +} /* awk_hash --- calculate the hash function of the string in subs */ @@ -646,11 +646,11 @@ grow_table(NODE *symbol) * very large (> 8K), we just double more or less, instead of * just jumping from 8K to 64K. */ - + static const unsigned long sizes[] = { 13, 127, 1021, 8191, 16381, 32749, 65497, 131101, 262147, 524309, 1048583, 2097169, - 4194319, 8388617, 16777259, 33554467, + 4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459, 536870923, 1073741827 }; @@ -2,22 +2,22 @@ * symbol.c - routines for symbol table management and code allocation */ -/* +/* * Copyright (C) 1986, 1988, 1989, 1991-2015 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 @@ -71,7 +71,7 @@ init_symbol_table() /* * install_symbol: * Install a global name in the symbol table, even if it is already there. - * Caller must check against redefinition if that is desired. + * Caller must check against redefinition if that is desired. */ NODE * @@ -129,7 +129,7 @@ make_params(char **pnames, int pcount) { NODE *p, *parms; int i; - + if (pcount <= 0 || pnames == NULL) return NULL; @@ -242,12 +242,12 @@ destroy_symbol(NODE *r) NODE *n; int i; int pcount = r->param_cnt; - - /* function parameters of type Node_param_list */ + + /* function parameters of type Node_param_list */ for (i = 0; i < pcount; i++) { n = r->fparms + i; efree(n->param); - } + } efree(r->fparms); } break; @@ -260,7 +260,7 @@ destroy_symbol(NODE *r) assoc_clear(r); break; - case Node_var: + case Node_var: unref(r->var_value); break; @@ -369,7 +369,7 @@ comp_symbol(const void *v1, const void *v2) typedef enum { FUNCTION = 1, VARIABLE } SYMBOL_TYPE; /* get_symbols --- return a list of optionally sorted symbols */ - + static NODE ** get_symbols(SYMBOL_TYPE what, bool sort) { @@ -448,7 +448,7 @@ function_list(bool sort) return get_symbols(FUNCTION, sort); } -/* print_vars --- print names and values of global variables */ +/* print_vars --- print names and values of global variables */ void print_vars(NODE **table, int (*print_func)(FILE *, const char *, ...), FILE *fp) @@ -708,7 +708,7 @@ bcfree(INSTRUCTION *cp) cp->opcode = 0; cp->nexti = pool_list->freei; pool_list->freei = cp; -} +} /* bcalloc --- allocate a new instruction */ @@ -804,7 +804,7 @@ push_context(AWK_CONTEXT *ctxt) ctxt_level++; } -/* pop_context --- switch to previous execution context. */ +/* pop_context --- switch to previous execution context. */ void pop_context() @@ -831,7 +831,7 @@ in_main_context() return (ctxt_level == 1); } -/* free_context --- free context structure and related data. */ +/* free_context --- free context structure and related data. */ void free_context(AWK_CONTEXT *ctxt, bool keep_globals) @@ -864,7 +864,7 @@ free_context(AWK_CONTEXT *ctxt, bool keep_globals) efree(ctxt); } -/* free_bc_internal --- free internal memory of an instruction. */ +/* free_bc_internal --- free internal memory of an instruction. */ static void free_bc_internal(INSTRUCTION *cp) @@ -888,7 +888,7 @@ free_bc_internal(INSTRUCTION *cp) if (m->re_text != NULL) unref(m->re_text); freenode(m); - break; + break; case Op_token: /* token lost during error recovery in yyparse */ if (cp->lextok != NULL) @@ -906,7 +906,7 @@ free_bc_internal(INSTRUCTION *cp) case Op_illegal: cant_happen(); default: - break; + break; } } diff --git a/vms/ChangeLog b/vms/ChangeLog index 710a35f8..29f0363a 100644 --- a/vms/ChangeLog +++ b/vms/ChangeLog @@ -1,3 +1,7 @@ +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + 2016-08-25 Arnold D. Robbins <arnold@skeeve.com> * 4.1.4: Release tar ball made. diff --git a/vms/vms_gawk.c b/vms/vms_gawk.c index 4080e1db..0caab21f 100644 --- a/vms/vms_gawk.c +++ b/vms/vms_gawk.c @@ -16,7 +16,7 @@ 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. */ - + /* * vms_gawk.c - routines to parse the command line as a native DCL command |