Skip to content

Commit

Permalink
Remove trailing whitespace everywhere. Fix Unicode into ASCII.
Browse files Browse the repository at this point in the history
  • Loading branch information
arnoldrobbins committed Oct 23, 2016
1 parent a562d9a commit 3055361
Show file tree
Hide file tree
Showing 67 changed files with 1,009 additions and 975 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2016-10-23 Arnold D. Robbins <[email protected]>

* 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 <[email protected]>

* awkgram.y: Typo fix in call to add_sign_to_num.
Expand Down
46 changes: 23 additions & 23 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -373,7 +373,7 @@ force_array(NODE *symbol, bool canfatal)


/* set_SUBSEP --- update SUBSEP related variables when SUBSEP assigned to */

void
set_SUBSEP()
{
Expand All @@ -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();

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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++) {
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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 */
}
Expand Down
42 changes: 21 additions & 21 deletions awk.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -663,7 +663,7 @@ typedef enum opcodeval {
Op_nomatch,

Op_rule,

/* keywords */
Op_K_case,
Op_K_default,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 *);
Expand All @@ -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 */
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -1792,7 +1792,7 @@ in_array(NODE *a, NODE *s)
NODE **ret;

ret = a->aexists(a, s);

return ret ? *ret : NULL;
}

Expand Down
Loading

0 comments on commit 3055361

Please sign in to comment.