From a76a789747458e3690e44ee81332099a3f80c156 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 5 Mar 2014 06:00:03 +0200 Subject: Continue to straighten out enum usage. --- ChangeLog | 11 +++++++++++ awk.h | 2 +- awkgram.c | 4 ++-- awkgram.y | 4 ++-- cmd.h | 3 ++- command.c | 2 +- command.y | 2 +- ext.c | 8 ++++---- io.c | 2 +- 9 files changed, 25 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b08057b..669f5a0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2014-03-05 Arnold D. Robbins + + Straighten out enumerated types some more. + + * awk.h (add_srcfile): Fix type of first parameter. + * awkgram.y (add_srcfile, do_add_srcfile): Ditto. + * cmd.h (A_NONE): New enum nametypeval. + * command.y (argtab): Use it in final value. + * ext.c (make_builtin): Use awk_false, awk_true. + * io.c (init_output_wrapper): Use awk_false. + 2014-03-03 Arnold D. Robbins * dfa.c: Sync with grep. Yet again. diff --git a/awk.h b/awk.h index a846483a..5fe1e0b5 100644 --- a/awk.h +++ b/awk.h @@ -1371,7 +1371,7 @@ extern const char *getfname(NODE *(*)(int)); extern NODE *stopme(int nargs); extern void shadow_funcs(void); extern int check_special(const char *name); -extern SRCFILE *add_srcfile(int stype, char *src, SRCFILE *curr, bool *already_included, int *errcode); +extern SRCFILE *add_srcfile(enum srctype stype, char *src, SRCFILE *curr, bool *already_included, int *errcode); extern void register_deferred_variable(const char *name, NODE *(*load_func)(void)); extern int files_are_same(char *path, SRCFILE *src); extern void valinfo(NODE *n, Func_print print_func, FILE *fp); diff --git a/awkgram.c b/awkgram.c index 948e63bf..80d6ea05 100644 --- a/awkgram.c +++ b/awkgram.c @@ -4675,7 +4675,7 @@ parse_program(INSTRUCTION **pcode) /* do_add_srcfile --- add one item to srcfiles */ static SRCFILE * -do_add_srcfile(int stype, char *src, char *path, SRCFILE *thisfile) +do_add_srcfile(enum srctype stype, char *src, char *path, SRCFILE *thisfile) { SRCFILE *s; @@ -4697,7 +4697,7 @@ do_add_srcfile(int stype, char *src, char *path, SRCFILE *thisfile) */ SRCFILE * -add_srcfile(int stype, char *src, SRCFILE *thisfile, bool *already_included, int *errcode) +add_srcfile(enum srctype stype, char *src, SRCFILE *thisfile, bool *already_included, int *errcode) { SRCFILE *s; struct stat sbuf; diff --git a/awkgram.y b/awkgram.y index ecce1f6e..7d530b7f 100644 --- a/awkgram.y +++ b/awkgram.y @@ -2336,7 +2336,7 @@ parse_program(INSTRUCTION **pcode) /* do_add_srcfile --- add one item to srcfiles */ static SRCFILE * -do_add_srcfile(int stype, char *src, char *path, SRCFILE *thisfile) +do_add_srcfile(enum srctype stype, char *src, char *path, SRCFILE *thisfile) { SRCFILE *s; @@ -2358,7 +2358,7 @@ do_add_srcfile(int stype, char *src, char *path, SRCFILE *thisfile) */ SRCFILE * -add_srcfile(int stype, char *src, SRCFILE *thisfile, bool *already_included, int *errcode) +add_srcfile(enum srctype stype, char *src, SRCFILE *thisfile, bool *already_included, int *errcode) { SRCFILE *s; struct stat sbuf; diff --git a/cmd.h b/cmd.h index 5a5fd294..3c64efbe 100644 --- a/cmd.h +++ b/cmd.h @@ -109,7 +109,8 @@ enum argtype { /* non-number arguments to commands */ enum nametypeval { - A_ARGS = 1, + A_NONE = 0, + A_ARGS, A_BREAK, A_DEL, A_DISPLAY, diff --git a/command.c b/command.c index c4fe1e48..2d4ccf8c 100644 --- a/command.c +++ b/command.c @@ -2667,7 +2667,7 @@ struct argtoken argtab[] = { { "sources", D_info, A_SOURCES }, { "variables", D_info, A_VARIABLES }, { "watch", D_info, A_WATCH }, - { NULL, D_illegal, 0 }, + { NULL, D_illegal, A_NONE }, }; diff --git a/command.y b/command.y index 742b185a..576af159 100644 --- a/command.y +++ b/command.y @@ -916,7 +916,7 @@ struct argtoken argtab[] = { { "sources", D_info, A_SOURCES }, { "variables", D_info, A_VARIABLES }, { "watch", D_info, A_WATCH }, - { NULL, D_illegal, 0 }, + { NULL, D_illegal, A_NONE }, }; diff --git a/ext.c b/ext.c index cae882ff..09e10164 100644 --- a/ext.c +++ b/ext.c @@ -221,11 +221,11 @@ make_builtin(const awk_ext_func_t *funcinfo) fatal(_("make_builtin: missing function name")); if (! is_letter(*sp)) - return false; + return awk_false; for (sp++; (c = *sp++) != '\0';) { if (! is_identifier_char(c)) - return false; + return awk_false; } f = lookup(name); @@ -238,7 +238,7 @@ make_builtin(const awk_ext_func_t *funcinfo) /* multiple extension() calls etc. */ if (do_lint) lintwarn(_("make_builtin: function `%s' already defined"), name); - return false; + return awk_false; } else /* variable name etc. */ fatal(_("make_builtin: function name `%s' previously defined"), name); @@ -258,7 +258,7 @@ make_builtin(const awk_ext_func_t *funcinfo) symbol = install_symbol(estrdup(name, strlen(name)), Node_ext_func); symbol->code_ptr = b; track_ext_func(name); - return true; + return awk_true; } /* make_old_builtin --- register name to be called as func with a builtin body */ diff --git a/io.c b/io.c index 3e527da0..b0b60deb 100644 --- a/io.c +++ b/io.c @@ -3968,7 +3968,7 @@ init_output_wrapper(awk_output_buf_t *outbuf) outbuf->mode = NULL; outbuf->fp = NULL; outbuf->opaque = NULL; - outbuf->redirected = false; + outbuf->redirected = awk_false; outbuf->gawk_fwrite = gawk_fwrite; outbuf->gawk_fflush = gawk_fflush; outbuf->gawk_ferror = gawk_ferror; -- cgit v1.2.1