From b7d8b6ebcd5dd714bc21acf7637d9a651e2f7ea7 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Wed, 21 Jun 2017 09:57:24 -0400 Subject: Add ezalloc macro in gawk and API to allocate zero-filled memory. --- ChangeLog | 7 ++ awk.h | 19 ++++ doc/ChangeLog | 5 + doc/gawk.info | 285 +++++++++++++++++++++++++++++--------------------------- doc/gawk.texi | 10 +- doc/gawktexi.in | 10 +- gawkapi.h | 6 ++ 7 files changed, 199 insertions(+), 143 deletions(-) diff --git a/ChangeLog b/ChangeLog index 086cbe35..233ec4bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-06-19 Andrew J. Schorr + + * awk.h (ezalloc): Add new macro to allocate memory initialized to zero. + (ezalloc_real): New inline function to call calloc. + * gawkapi.h (ezalloc): Add new API macro to allocate memory initialized + to zero. + 2017-06-18 Arnold D. Robbins * builtin.c (mbc_char_count): Fix code to correctly traverse diff --git a/awk.h b/awk.h index ab84c58b..d5964f88 100644 --- a/awk.h +++ b/awk.h @@ -1331,6 +1331,7 @@ DEREF(NODE *r) __LINE__, __FILE__) #define emalloc(var,ty,x,str) (void) (var = (ty) emalloc_real((size_t)(x), str, #var, __FILE__, __LINE__)) +#define ezalloc(var,ty,x,str) (void) (var = (ty) ezalloc_real((size_t)(x), str, #var, __FILE__, __LINE__)) #define erealloc(var,ty,x,str) (void) (var = (ty) erealloc_real((void *) var, (size_t)(x), str, #var, __FILE__, __LINE__)) #define efree(p) free(p) @@ -1950,6 +1951,24 @@ emalloc_real(size_t count, const char *where, const char *var, const char *file, return ret; } +/* ezalloc_real --- malloc zero-filled bytes with error checking */ + +static inline void * +ezalloc_real(size_t count, const char *where, const char *var, const char *file, int line) +{ + void *ret; + + if (count == 0) + fatal("%s:%d: ezalloc called with zero bytes", file, line); + + ret = (void *) calloc(1, count); + if (ret == NULL) + fatal(_("%s:%d:%s: %s: can't allocate %ld bytes of memory (%s)"), + file, line, where, var, (long) count, strerror(errno)); + + return ret; +} + /* erealloc_real --- realloc with error checking */ static inline void * diff --git a/doc/ChangeLog b/doc/ChangeLog index 9ff53055..39bb693e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2017-06-19 Andrew J. Schorr + + * gawktexi.in (Memory Allocation Functions and Convenience Macros): + Document new ezalloc API macro. + 2017-06-18 Andrew J. Schorr * gawkworkflow.texi: Fix typo. diff --git a/doc/gawk.info b/doc/gawk.info index 2988fe4a..752eec86 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -24009,10 +24009,11 @@ library than was used for the 'gawk' executable.(1) If 'gawk' were to use its version of 'free()' when the memory came from an unrelated version of 'malloc()', unexpected behavior would likely result. - Two convenience macros may be used for allocating storage from -'gawk_malloc()' and 'gawk_realloc()'. If the allocation fails, they -cause 'gawk' to exit with a fatal error message. They should be used as -if they were procedure calls that do not return a value: + Three convenience macros may be used for allocating storage from +'gawk_malloc()', 'gawk_calloc', and 'gawk_realloc()'. If the allocation +fails, they cause 'gawk' to exit with a fatal error message. They +should be used as if they were procedure calls that do not return a +value: '#define emalloc(pointer, type, size, message) ...' The arguments to this macro are as follows: @@ -24041,6 +24042,12 @@ if they were procedure calls that do not return a value: strcpy(message, greet); make_malloced_string(message, strlen(message), & result); +'#define ezalloc(pointer, type, size, message) ...' + This is like 'emalloc()', but it calls 'gawk_calloc()' instead of + 'gawk_malloc()'. The arguments are the same as for the 'emalloc()' + macro, but this macro guarantees that the memory returned is + initialized to zero. + '#define erealloc(pointer, type, size, message) ...' This is like 'emalloc()', but it calls 'gawk_realloc()' instead of 'gawk_malloc()'. The arguments are the same as for the 'emalloc()' @@ -36183,140 +36190,140 @@ Node: Extension API Functions Introduction961581 Node: General Data Types966915 Ref: General Data Types-Footnote-1974120 Node: Memory Allocation Functions974419 -Ref: Memory Allocation Functions-Footnote-1977264 -Node: Constructor Functions977363 -Node: Registration Functions980362 -Node: Extension Functions981047 -Node: Exit Callback Functions986260 -Node: Extension Version String987510 -Node: Input Parsers988173 -Node: Output Wrappers1000880 -Node: Two-way processors1005392 -Node: Printing Messages1007657 -Ref: Printing Messages-Footnote-11008828 -Node: Updating ERRNO1008981 -Node: Requesting Values1009720 -Ref: table-value-types-returned1010457 -Node: Accessing Parameters1011393 -Node: Symbol Table Access1012628 -Node: Symbol table by name1013140 -Node: Symbol table by cookie1014929 -Ref: Symbol table by cookie-Footnote-11019114 -Node: Cached values1019178 -Ref: Cached values-Footnote-11022714 -Node: Array Manipulation1022805 -Ref: Array Manipulation-Footnote-11023896 -Node: Array Data Types1023933 -Ref: Array Data Types-Footnote-11026591 -Node: Array Functions1026683 -Node: Flattening Arrays1031082 -Node: Creating Arrays1038023 -Node: Redirection API1042792 -Node: Extension API Variables1045634 -Node: Extension Versioning1046267 -Ref: gawk-api-version1046704 -Node: Extension API Informational Variables1048432 -Node: Extension API Boilerplate1049496 -Node: Changes from API V11053358 -Node: Finding Extensions1054018 -Node: Extension Example1054577 -Node: Internal File Description1055375 -Node: Internal File Ops1059455 -Ref: Internal File Ops-Footnote-11070855 -Node: Using Internal File Ops1070995 -Ref: Using Internal File Ops-Footnote-11073378 -Node: Extension Samples1073652 -Node: Extension Sample File Functions1075181 -Node: Extension Sample Fnmatch1082830 -Node: Extension Sample Fork1084317 -Node: Extension Sample Inplace1085535 -Node: Extension Sample Ord1088752 -Node: Extension Sample Readdir1089588 -Ref: table-readdir-file-types1090477 -Node: Extension Sample Revout1091282 -Node: Extension Sample Rev2way1091871 -Node: Extension Sample Read write array1092611 -Node: Extension Sample Readfile1094553 -Node: Extension Sample Time1095648 -Node: Extension Sample API Tests1096996 -Node: gawkextlib1097488 -Node: Extension summary1099935 -Node: Extension Exercises1103637 -Node: Language History1105135 -Node: V7/SVR3.11106791 -Node: SVR41108943 -Node: POSIX1110377 -Node: BTL1111756 -Node: POSIX/GNU1112485 -Node: Feature History1118377 -Node: Common Extensions1132801 -Node: Ranges and Locales1134084 -Ref: Ranges and Locales-Footnote-11138700 -Ref: Ranges and Locales-Footnote-21138727 -Ref: Ranges and Locales-Footnote-31138962 -Node: Contributors1139183 -Node: History summary1144743 -Node: Installation1146123 -Node: Gawk Distribution1147067 -Node: Getting1147551 -Node: Extracting1148512 -Node: Distribution contents1150150 -Node: Unix Installation1156492 -Node: Quick Installation1157174 -Node: Shell Startup Files1159588 -Node: Additional Configuration Options1160677 -Node: Configuration Philosophy1162666 -Node: Non-Unix Installation1165035 -Node: PC Installation1165495 -Node: PC Binary Installation1166333 -Node: PC Compiling1166768 -Node: PC Using1167885 -Node: Cygwin1170930 -Node: MSYS1171700 -Node: VMS Installation1172201 -Node: VMS Compilation1172992 -Ref: VMS Compilation-Footnote-11174221 -Node: VMS Dynamic Extensions1174279 -Node: VMS Installation Details1175964 -Node: VMS Running1178217 -Node: VMS GNV1182496 -Node: VMS Old Gawk1183231 -Node: Bugs1183702 -Node: Bug address1184365 -Node: Usenet1186762 -Node: Maintainers1187539 -Node: Other Versions1188915 -Node: Installation summary1195499 -Node: Notes1196534 -Node: Compatibility Mode1197399 -Node: Additions1198181 -Node: Accessing The Source1199106 -Node: Adding Code1200541 -Node: New Ports1206759 -Node: Derived Files1211247 -Ref: Derived Files-Footnote-11216732 -Ref: Derived Files-Footnote-21216767 -Ref: Derived Files-Footnote-31217365 -Node: Future Extensions1217479 -Node: Implementation Limitations1218137 -Node: Extension Design1219320 -Node: Old Extension Problems1220474 -Ref: Old Extension Problems-Footnote-11221992 -Node: Extension New Mechanism Goals1222049 -Ref: Extension New Mechanism Goals-Footnote-11225413 -Node: Extension Other Design Decisions1225602 -Node: Extension Future Growth1227715 -Node: Old Extension Mechanism1228551 -Node: Notes summary1230314 -Node: Basic Concepts1231496 -Node: Basic High Level1232177 -Ref: figure-general-flow1232459 -Ref: figure-process-flow1233144 -Ref: Basic High Level-Footnote-11236445 -Node: Basic Data Typing1236630 -Node: Glossary1239958 -Node: Copying1271905 -Node: GNU Free Documentation License1309444 -Node: Index1334562 +Ref: Memory Allocation Functions-Footnote-1977571 +Node: Constructor Functions977670 +Node: Registration Functions980669 +Node: Extension Functions981354 +Node: Exit Callback Functions986567 +Node: Extension Version String987817 +Node: Input Parsers988480 +Node: Output Wrappers1001187 +Node: Two-way processors1005699 +Node: Printing Messages1007964 +Ref: Printing Messages-Footnote-11009135 +Node: Updating ERRNO1009288 +Node: Requesting Values1010027 +Ref: table-value-types-returned1010764 +Node: Accessing Parameters1011700 +Node: Symbol Table Access1012935 +Node: Symbol table by name1013447 +Node: Symbol table by cookie1015236 +Ref: Symbol table by cookie-Footnote-11019421 +Node: Cached values1019485 +Ref: Cached values-Footnote-11023021 +Node: Array Manipulation1023112 +Ref: Array Manipulation-Footnote-11024203 +Node: Array Data Types1024240 +Ref: Array Data Types-Footnote-11026898 +Node: Array Functions1026990 +Node: Flattening Arrays1031389 +Node: Creating Arrays1038330 +Node: Redirection API1043099 +Node: Extension API Variables1045941 +Node: Extension Versioning1046574 +Ref: gawk-api-version1047011 +Node: Extension API Informational Variables1048739 +Node: Extension API Boilerplate1049803 +Node: Changes from API V11053665 +Node: Finding Extensions1054325 +Node: Extension Example1054884 +Node: Internal File Description1055682 +Node: Internal File Ops1059762 +Ref: Internal File Ops-Footnote-11071162 +Node: Using Internal File Ops1071302 +Ref: Using Internal File Ops-Footnote-11073685 +Node: Extension Samples1073959 +Node: Extension Sample File Functions1075488 +Node: Extension Sample Fnmatch1083137 +Node: Extension Sample Fork1084624 +Node: Extension Sample Inplace1085842 +Node: Extension Sample Ord1089059 +Node: Extension Sample Readdir1089895 +Ref: table-readdir-file-types1090784 +Node: Extension Sample Revout1091589 +Node: Extension Sample Rev2way1092178 +Node: Extension Sample Read write array1092918 +Node: Extension Sample Readfile1094860 +Node: Extension Sample Time1095955 +Node: Extension Sample API Tests1097303 +Node: gawkextlib1097795 +Node: Extension summary1100242 +Node: Extension Exercises1103944 +Node: Language History1105442 +Node: V7/SVR3.11107098 +Node: SVR41109250 +Node: POSIX1110684 +Node: BTL1112063 +Node: POSIX/GNU1112792 +Node: Feature History1118684 +Node: Common Extensions1133108 +Node: Ranges and Locales1134391 +Ref: Ranges and Locales-Footnote-11139007 +Ref: Ranges and Locales-Footnote-21139034 +Ref: Ranges and Locales-Footnote-31139269 +Node: Contributors1139490 +Node: History summary1145050 +Node: Installation1146430 +Node: Gawk Distribution1147374 +Node: Getting1147858 +Node: Extracting1148819 +Node: Distribution contents1150457 +Node: Unix Installation1156799 +Node: Quick Installation1157481 +Node: Shell Startup Files1159895 +Node: Additional Configuration Options1160984 +Node: Configuration Philosophy1162973 +Node: Non-Unix Installation1165342 +Node: PC Installation1165802 +Node: PC Binary Installation1166640 +Node: PC Compiling1167075 +Node: PC Using1168192 +Node: Cygwin1171237 +Node: MSYS1172007 +Node: VMS Installation1172508 +Node: VMS Compilation1173299 +Ref: VMS Compilation-Footnote-11174528 +Node: VMS Dynamic Extensions1174586 +Node: VMS Installation Details1176271 +Node: VMS Running1178524 +Node: VMS GNV1182803 +Node: VMS Old Gawk1183538 +Node: Bugs1184009 +Node: Bug address1184672 +Node: Usenet1187069 +Node: Maintainers1187846 +Node: Other Versions1189222 +Node: Installation summary1195806 +Node: Notes1196841 +Node: Compatibility Mode1197706 +Node: Additions1198488 +Node: Accessing The Source1199413 +Node: Adding Code1200848 +Node: New Ports1207066 +Node: Derived Files1211554 +Ref: Derived Files-Footnote-11217039 +Ref: Derived Files-Footnote-21217074 +Ref: Derived Files-Footnote-31217672 +Node: Future Extensions1217786 +Node: Implementation Limitations1218444 +Node: Extension Design1219627 +Node: Old Extension Problems1220781 +Ref: Old Extension Problems-Footnote-11222299 +Node: Extension New Mechanism Goals1222356 +Ref: Extension New Mechanism Goals-Footnote-11225720 +Node: Extension Other Design Decisions1225909 +Node: Extension Future Growth1228022 +Node: Old Extension Mechanism1228858 +Node: Notes summary1230621 +Node: Basic Concepts1231803 +Node: Basic High Level1232484 +Ref: figure-general-flow1232766 +Ref: figure-process-flow1233451 +Ref: Basic High Level-Footnote-11236752 +Node: Basic Data Typing1236937 +Node: Glossary1240265 +Node: Copying1272212 +Node: GNU Free Documentation License1309751 +Node: Index1334869  End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 79292a00..afdefff4 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -32978,8 +32978,8 @@ to use its version of @code{free()} when the memory came from an unrelated version of @code{malloc()}, unexpected behavior would likely result. -Two convenience macros may be used for allocating storage -from @code{gawk_malloc()} and +Three convenience macros may be used for allocating storage +from @code{gawk_malloc()}, @code{gawk_calloc}, and @code{gawk_realloc()}. If the allocation fails, they cause @command{gawk} to exit with a fatal error message. They should be used as if they were procedure calls that do not return a value: @@ -33018,6 +33018,12 @@ strcpy(message, greet); make_malloced_string(message, strlen(message), & result); @end example +@item #define ezalloc(pointer, type, size, message) @dots{} +This is like @code{emalloc()}, but it calls @code{gawk_calloc()} +instead of @code{gawk_malloc()}. +The arguments are the same as for the @code{emalloc()} macro, but this +macro guarantees that the memory returned is initialized to zero. + @item #define erealloc(pointer, type, size, message) @dots{} This is like @code{emalloc()}, but it calls @code{gawk_realloc()} instead of @code{gawk_malloc()}. diff --git a/doc/gawktexi.in b/doc/gawktexi.in index e4c91645..7d60a2c7 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -31992,8 +31992,8 @@ to use its version of @code{free()} when the memory came from an unrelated version of @code{malloc()}, unexpected behavior would likely result. -Two convenience macros may be used for allocating storage -from @code{gawk_malloc()} and +Three convenience macros may be used for allocating storage +from @code{gawk_malloc()}, @code{gawk_calloc}, and @code{gawk_realloc()}. If the allocation fails, they cause @command{gawk} to exit with a fatal error message. They should be used as if they were procedure calls that do not return a value: @@ -32032,6 +32032,12 @@ strcpy(message, greet); make_malloced_string(message, strlen(message), & result); @end example +@item #define ezalloc(pointer, type, size, message) @dots{} +This is like @code{emalloc()}, but it calls @code{gawk_calloc()} +instead of @code{gawk_malloc()}. +The arguments are the same as for the @code{emalloc()} macro, but this +macro guarantees that the memory returned is initialized to zero. + @item #define erealloc(pointer, type, size, message) @dots{} This is like @code{emalloc()}, but it calls @code{gawk_realloc()} instead of @code{gawk_malloc()}. diff --git a/gawkapi.h b/gawkapi.h index 484ab27e..8562b5f4 100644 --- a/gawkapi.h +++ b/gawkapi.h @@ -878,6 +878,12 @@ typedef struct gawk_api { fatal(ext_id, "%s: malloc of %d bytes failed\n", message, size); \ } while(0) +#define ezalloc(pointer, type, size, message) \ + do { \ + if ((pointer = (type) gawk_calloc(1, size)) == 0) \ + fatal(ext_id, "%s: calloc of %d bytes failed\n", message, size); \ + } while(0) + #define erealloc(pointer, type, size, message) \ do { \ if ((pointer = (type) gawk_realloc(pointer, size)) == 0) \ -- cgit v1.2.3 From 288b15d0793936fa14b51ed860056f6ce6200c52 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Thu, 22 Jun 2017 08:26:27 -0400 Subject: Replace malloc+memset with calloc, mostly by using the new ezalloc macro. --- ChangeLog | 20 ++++++++++++++++++++ awkgram.c | 9 +++------ awkgram.y | 9 +++------ cint_array.c | 18 ++++++------------ command.c | 3 +-- command.y | 3 +-- debug.c | 3 +-- eval.c | 3 +-- extension/ChangeLog | 8 ++++++++ extension/filefuncs.c | 3 +-- extension/gawkfts.c | 3 +-- extension/readfile.c | 3 +-- extension/rwarray.c | 3 +-- extension/rwarray0.c | 3 +-- field.c | 4 +--- gawkapi.c | 3 +-- int_array.c | 6 ++---- io.c | 6 ++---- missing_d/ChangeLog | 4 ++++ missing_d/getaddrinfo.c | 3 +-- node.c | 3 +-- old-extension/ChangeLog | 4 ++++ old-extension/bindarr.c | 3 +-- re.c | 3 +-- str_array.c | 6 ++---- symbol.c | 6 ++---- 26 files changed, 71 insertions(+), 71 deletions(-) diff --git a/ChangeLog b/ChangeLog index 233ec4bd..fe8e49b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2017-06-21 Andrew J. Schorr + + Replace malloc/memset combinations with calloc by using the new ezalloc + macro. + * awkgram.y (yyerror, do_add_srcfile, funcuse): Replace emalloc+memset + with ezalloc. + * cint_array.c (cint_lookup, cint_copy, tree_lookup, tree_copy, + leaf_lookup, leaf_copy): Ditto. + * command.y (mk_cmdarg): Ditto. + * debug.c (add_item): Ditto. + * eval.c (setup_frame): Ditto. + * field.c (set_record): Ditto. + * gawkapi.c (api_flatten_array_typed): Ditto. + * int_array.c (int_copy, grow_int_table): Ditto. + * io.c (init_awkpath, iop_alloc): Ditto. + * node.c (str2wstr): Ditto. + * re.c (make_regexp): Ditto. + * str_array.c (str_copy, grow_table): Ditto. + * symbol.c (make_params, new_context): Ditto. + 2017-06-19 Andrew J. Schorr * awk.h (ezalloc): Add new macro to allocate memory initialized to zero. diff --git a/awkgram.c b/awkgram.c index 4325e77d..28845c61 100644 --- a/awkgram.c +++ b/awkgram.c @@ -4813,8 +4813,7 @@ yyerror(const char *m, ...) count = strlen(mesg) + 1; if (lexptr != NULL) count += (lexeme - thisline) + 2; - emalloc(buf, char *, count+1, "yyerror"); - memset(buf, 0, count+1); + ezalloc(buf, char *, count+1, "yyerror"); bp = buf; @@ -5033,8 +5032,7 @@ do_add_srcfile(enum srctype stype, char *src, char *path, SRCFILE *thisfile) { SRCFILE *s; - emalloc(s, SRCFILE *, sizeof(SRCFILE), "do_add_srcfile"); - memset(s, 0, sizeof(SRCFILE)); + ezalloc(s, SRCFILE *, sizeof(SRCFILE), "do_add_srcfile"); s->src = estrdup(src, strlen(src)); s->fullpath = path; s->stype = stype; @@ -7313,8 +7311,7 @@ func_use(const char *name, enum defref how) /* not in the table, fall through to allocate a new one */ - emalloc(fp, struct fdesc *, sizeof(struct fdesc), "func_use"); - memset(fp, '\0', sizeof(struct fdesc)); + ezalloc(fp, struct fdesc *, sizeof(struct fdesc), "func_use"); emalloc(fp->name, char *, len + 1, "func_use"); strcpy(fp->name, name); fp->next = ftable[ind]; diff --git a/awkgram.y b/awkgram.y index e4f5bab0..ad6873bb 100644 --- a/awkgram.y +++ b/awkgram.y @@ -2393,8 +2393,7 @@ yyerror(const char *m, ...) count = strlen(mesg) + 1; if (lexptr != NULL) count += (lexeme - thisline) + 2; - emalloc(buf, char *, count+1, "yyerror"); - memset(buf, 0, count+1); + ezalloc(buf, char *, count+1, "yyerror"); bp = buf; @@ -2613,8 +2612,7 @@ do_add_srcfile(enum srctype stype, char *src, char *path, SRCFILE *thisfile) { SRCFILE *s; - emalloc(s, SRCFILE *, sizeof(SRCFILE), "do_add_srcfile"); - memset(s, 0, sizeof(SRCFILE)); + ezalloc(s, SRCFILE *, sizeof(SRCFILE), "do_add_srcfile"); s->src = estrdup(src, strlen(src)); s->fullpath = path; s->stype = stype; @@ -4893,8 +4891,7 @@ func_use(const char *name, enum defref how) /* not in the table, fall through to allocate a new one */ - emalloc(fp, struct fdesc *, sizeof(struct fdesc), "func_use"); - memset(fp, '\0', sizeof(struct fdesc)); + ezalloc(fp, struct fdesc *, sizeof(struct fdesc), "func_use"); emalloc(fp->name, char *, len + 1, "func_use"); strcpy(fp->name, name); fp->next = ftable[ind]; diff --git a/cint_array.c b/cint_array.c index 092ce88a..851e980e 100644 --- a/cint_array.c +++ b/cint_array.c @@ -228,8 +228,7 @@ cint_lookup(NODE *symbol, NODE *subs) assert(symbol->table_size == 0); /* nodes[0] .. nodes[NHAT- 1] not used */ - emalloc(symbol->nodes, NODE **, INT32_BIT * sizeof(NODE *), "cint_lookup"); - memset(symbol->nodes, '\0', INT32_BIT * sizeof(NODE *)); + ezalloc(symbol->nodes, NODE **, INT32_BIT * sizeof(NODE *), "cint_lookup"); } symbol->table_size++; /* one more element in array */ @@ -387,8 +386,7 @@ cint_copy(NODE *symbol, NODE *newsymb) assert(symbol->nodes != NULL); /* allocate new table */ - emalloc(new, NODE **, INT32_BIT * sizeof(NODE *), "cint_copy"); - memset(new, '\0', INT32_BIT * sizeof(NODE *)); + ezalloc(new, NODE **, INT32_BIT * sizeof(NODE *), "cint_copy"); old = symbol->nodes; for (i = NHAT; i < INT32_BIT; i++) { @@ -754,8 +752,7 @@ tree_lookup(NODE *symbol, NODE *tree, long k, int m, long base) actual_size /= 2; tree->flags |= HALFHAT; } - emalloc(table, NODE **, actual_size * sizeof(NODE *), "tree_lookup"); - memset(table, '\0', actual_size * sizeof(NODE *)); + ezalloc(table, NODE **, actual_size * sizeof(NODE *), "tree_lookup"); tree->nodes = table; } else size = tree->array_size; @@ -928,8 +925,7 @@ tree_copy(NODE *newsymb, NODE *tree, NODE *newtree) if ((tree->flags & HALFHAT) != 0) hsize /= 2; - emalloc(new, NODE **, hsize * sizeof(NODE *), "tree_copy"); - memset(new, '\0', hsize * sizeof(NODE *)); + ezalloc(new, NODE **, hsize * sizeof(NODE *), "tree_copy"); newtree->nodes = new; newtree->array_base = tree->array_base; newtree->array_size = tree->array_size; @@ -1047,8 +1043,7 @@ leaf_lookup(NODE *symbol, NODE *array, long k, long size, long base) array->table_size = 0; /* sanity */ array->array_size = size; array->array_base = base; - emalloc(array->nodes, NODE **, size * sizeof(NODE *), "leaf_lookup"); - memset(array->nodes, '\0', size * sizeof(NODE *)); + ezalloc(array->nodes, NODE **, size * sizeof(NODE *), "leaf_lookup"); symbol->array_capacity += size; } @@ -1127,8 +1122,7 @@ leaf_copy(NODE *newsymb, NODE *array, NODE *newarray) long size, i; size = array->array_size; - emalloc(new, NODE **, size * sizeof(NODE *), "leaf_copy"); - memset(new, '\0', size * sizeof(NODE *)); + ezalloc(new, NODE **, size * sizeof(NODE *), "leaf_copy"); newarray->nodes = new; newarray->array_size = size; newarray->array_base = array->array_base; diff --git a/command.c b/command.c index a0469bb8..1d804c75 100644 --- a/command.c +++ b/command.c @@ -2707,8 +2707,7 @@ static CMDARG * mk_cmdarg(enum argtype type) { CMDARG *arg; - emalloc(arg, CMDARG *, sizeof(CMDARG), "mk_cmdarg"); - memset(arg, 0, sizeof(CMDARG)); + ezalloc(arg, CMDARG *, sizeof(CMDARG), "mk_cmdarg"); arg->type = type; return arg; } diff --git a/command.y b/command.y index 4597dba1..65d21853 100644 --- a/command.y +++ b/command.y @@ -957,8 +957,7 @@ static CMDARG * mk_cmdarg(enum argtype type) { CMDARG *arg; - emalloc(arg, CMDARG *, sizeof(CMDARG), "mk_cmdarg"); - memset(arg, 0, sizeof(CMDARG)); + ezalloc(arg, CMDARG *, sizeof(CMDARG), "mk_cmdarg"); arg->type = type; return arg; } diff --git a/debug.c b/debug.c index fc0f94cd..c3bc3009 100644 --- a/debug.c +++ b/debug.c @@ -1371,8 +1371,7 @@ add_item(struct list_item *list, int type, NODE *symbol, char *pname) { struct list_item *d; - emalloc(d, struct list_item *, sizeof(struct list_item), "add_item"); - memset(d, 0, sizeof(struct list_item)); + ezalloc(d, struct list_item *, sizeof(struct list_item), "add_item"); d->commands.next = d->commands.prev = &d->commands; d->number = ++list->number; diff --git a/eval.c b/eval.c index 73bd7fc9..c5fea5ee 100644 --- a/eval.c +++ b/eval.c @@ -1269,8 +1269,7 @@ setup_frame(INSTRUCTION *pc) sp = frame_ptr->stack; } else if (pcount > 0) { - emalloc(sp, NODE **, pcount * sizeof(NODE *), "setup_frame"); - memset(sp, 0, pcount * sizeof(NODE *)); + ezalloc(sp, NODE **, pcount * sizeof(NODE *), "setup_frame"); } diff --git a/extension/ChangeLog b/extension/ChangeLog index d10dc766..378de373 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,11 @@ +2017-06-21 Andrew J. Schorr + + * filefuncs.c (do_fts): Replace emalloc+memset with ezalloc. + * readfile.c (read_file_to_buffer): Ditto. + * rwarray.c (read_value): Replace gawk_malloc+memset with gawk_calloc. + * gawkfts.c (fts_open): Replace malloc+memset with calloc. + * rwarray0.c (read_value): Ditto. + 2017-04-03 Arnold D. Robbins * inplace.c (inplace_end): Correct the function name in the diff --git a/extension/filefuncs.c b/extension/filefuncs.c index 394de504..9ca22de8 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -877,8 +877,7 @@ do_fts(int nargs, awk_value_t *result, struct awk_ext_func *unused) /* make pathvector */ count = path_array->count + 1; - emalloc(pathvector, char **, count * sizeof(char *), "do_fts"); - memset(pathvector, 0, count * sizeof(char *)); + ezalloc(pathvector, char **, count * sizeof(char *), "do_fts"); /* fill it in */ count--; /* ignore final NULL at end of vector */ diff --git a/extension/gawkfts.c b/extension/gawkfts.c index 4a712153..d9edd87f 100644 --- a/extension/gawkfts.c +++ b/extension/gawkfts.c @@ -162,9 +162,8 @@ fts_open(char * const *argv, int options, } /* Allocate/initialize the stream */ - if ((sp = malloc((unsigned int)sizeof(FTS))) == NULL) + if ((sp = calloc(1, (unsigned int)sizeof(FTS))) == NULL) return (NULL); - memset(sp, 0, sizeof(FTS)); sp->fts_compar = compar; sp->fts_options = options; diff --git a/extension/readfile.c b/extension/readfile.c index fb1a376b..f470237b 100644 --- a/extension/readfile.c +++ b/extension/readfile.c @@ -82,8 +82,7 @@ read_file_to_buffer(int fd, const struct stat *sbuf) goto done; } - emalloc(text, char *, sbuf->st_size + 1, "do_readfile"); - memset(text, '\0', sbuf->st_size + 1); + ezalloc(text, char *, sbuf->st_size + 1, "do_readfile"); if ((ret = read(fd, text, sbuf->st_size)) != sbuf->st_size) { update_ERRNO_int(errno); diff --git a/extension/rwarray.c b/extension/rwarray.c index a7d752cf..370e38ac 100644 --- a/extension/rwarray.c +++ b/extension/rwarray.c @@ -482,8 +482,7 @@ read_value(FILE *fp, awk_value_t *value) break; } value->str_value.len = len; - value->str_value.str = gawk_malloc(len + 1); - memset(value->str_value.str, '\0', len + 1); + value->str_value.str = gawk_calloc(1, len + 1); if (fread(value->str_value.str, 1, len, fp) != (ssize_t) len) { gawk_free(value->str_value.str); diff --git a/extension/rwarray0.c b/extension/rwarray0.c index faa73783..abeb5326 100644 --- a/extension/rwarray0.c +++ b/extension/rwarray0.c @@ -446,8 +446,7 @@ read_value(int fd, awk_value_t *value) len = ntohl(len); value->val_type = AWK_STRING; value->str_value.len = len; - value->str_value.str = malloc(len + 1); - memset(value->str_value.str, '\0', len + 1); + value->str_value.str = calloc(1, len + 1); if (read(fd, value->str_value.str, len) != (ssize_t) len) { free(value->str_value.str); diff --git a/field.c b/field.c index 61f0d7f6..d8c97413 100644 --- a/field.c +++ b/field.c @@ -274,10 +274,8 @@ set_record(const char *buf, int cnt, const awk_fieldwidth_info_t *fw) /* buffer management: */ if (databuf_size == 0) { /* first time */ - emalloc(databuf, char *, INITIAL_SIZE, "set_record"); + ezalloc(databuf, char *, INITIAL_SIZE, "set_record"); databuf_size = INITIAL_SIZE; - memset(databuf, '\0', INITIAL_SIZE); - } /* * Make sure there's enough room. Since we sometimes need diff --git a/gawkapi.c b/gawkapi.c index 4c6a2f8f..fcdfe0dc 100644 --- a/gawkapi.c +++ b/gawkapi.c @@ -1111,9 +1111,8 @@ api_flatten_array_typed(awk_ext_id_t id, alloc_size = sizeof(awk_flat_array_t) + (array->table_size - 1) * sizeof(awk_element_t); - emalloc(*data, awk_flat_array_t *, alloc_size, + ezalloc(*data, awk_flat_array_t *, alloc_size, "api_flatten_array_typed"); - memset(*data, 0, alloc_size); list = assoc_list(array, "@unsorted", ASORTI); diff --git a/int_array.c b/int_array.c index 992da4a6..1c309cfd 100644 --- a/int_array.c +++ b/int_array.c @@ -458,8 +458,7 @@ int_copy(NODE *symbol, NODE *newsymb) cursize = symbol->array_size; /* allocate new table */ - emalloc(new, BUCKET **, cursize * sizeof(BUCKET *), "int_copy"); - memset(new, '\0', cursize * sizeof(BUCKET *)); + ezalloc(new, BUCKET **, cursize * sizeof(BUCKET *), "int_copy"); old = symbol->buckets; @@ -842,8 +841,7 @@ grow_int_table(NODE *symbol) } /* allocate new table */ - emalloc(new, BUCKET **, newsize * sizeof(BUCKET *), "grow_int_table"); - memset(new, '\0', newsize * sizeof(BUCKET *)); + ezalloc(new, BUCKET **, newsize * sizeof(BUCKET *), "grow_int_table"); old = symbol->buckets; symbol->buckets = new; diff --git a/io.c b/io.c index e08c3373..5d79e170 100644 --- a/io.c +++ b/io.c @@ -2803,8 +2803,7 @@ init_awkpath(path_info *pi) max_path++; // +3 --> 2 for null entries at front and end of path, 1 for NULL end of list - emalloc(pi->awkpath, char **, (max_path + 3) * sizeof(char *), "init_awkpath"); - memset(pi->awkpath, 0, (max_path + 3) * sizeof(char *)); + ezalloc(pi->awkpath, char **, (max_path + 3) * sizeof(char *), "init_awkpath"); start = path; i = 0; @@ -3211,9 +3210,8 @@ iop_alloc(int fd, const char *name, int errno_val) { IOBUF *iop; - emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc"); + ezalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc"); - memset(iop, '\0', sizeof(IOBUF)); iop->public.fd = fd; iop->public.name = name; iop->public.read_func = ( ssize_t(*)() ) read; diff --git a/missing_d/ChangeLog b/missing_d/ChangeLog index 83f5b93e..7d9bddc4 100644 --- a/missing_d/ChangeLog +++ b/missing_d/ChangeLog @@ -1,3 +1,7 @@ +2017-06-21 Andrew J. Schorr + + * getaddrinfo.c (getaddrinfo): Replace malloc+memset with calloc. + 2016-10-23 Arnold D. Robbins * General: Remove trailing whitespace from all relevant files. diff --git a/missing_d/getaddrinfo.c b/missing_d/getaddrinfo.c index f24ac598..5233cf56 100644 --- a/missing_d/getaddrinfo.c +++ b/missing_d/getaddrinfo.c @@ -33,12 +33,11 @@ getaddrinfo(const char *hostname, const char *portname, if (res == NULL) return EINVAL; - out = (struct addrinfo *) malloc(sizeof(*out)); + out = (struct addrinfo *) calloc(1, sizeof(*out)); if (out == NULL) { *res = NULL; return ENOMEM; } - memset(out, '\0', sizeof(*out)); out->ai_addr = (struct sockaddr *) malloc(sizeof(struct sockaddr_in)); if (out->ai_addr == NULL) { diff --git a/node.c b/node.c index 962a650d..200d61dc 100644 --- a/node.c +++ b/node.c @@ -728,8 +728,7 @@ str2wstr(NODE *n, size_t **ptr) * Create the array. */ if (ptr != NULL) { - emalloc(*ptr, size_t *, sizeof(size_t) * n->stlen, "str2wstr"); - memset(*ptr, 0, sizeof(size_t) * n->stlen); + ezalloc(*ptr, size_t *, sizeof(size_t) * n->stlen, "str2wstr"); } sp = n->stptr; diff --git a/old-extension/ChangeLog b/old-extension/ChangeLog index bd848f9a..99352c6e 100644 --- a/old-extension/ChangeLog +++ b/old-extension/ChangeLog @@ -1,3 +1,7 @@ +2017-06-21 Andrew J. Schorr + + * bindarr.c (do_bind_array): Replace emalloc+memset with ezalloc. + 2016-10-23 Arnold D. Robbins * General: Remove trailing whitespace from all relevant files. diff --git a/old-extension/bindarr.c b/old-extension/bindarr.c index 1a0104db..34e7e983 100644 --- a/old-extension/bindarr.c +++ b/old-extension/bindarr.c @@ -209,8 +209,7 @@ do_bind_array(int nargs) assoc_clear(symbol); - emalloc(aq, array_t *, sizeof(array_t), "do_bind_array"); - memset(aq, '\0', sizeof(array_t)); + ezalloc(aq, array_t *, sizeof(array_t), "do_bind_array"); t = get_array_argument(1, false); diff --git a/re.c b/re.c index 73e75cbb..cf369a97 100644 --- a/re.c +++ b/re.c @@ -168,8 +168,7 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal) *dest = '\0'; len = dest - buf; - emalloc(rp, Regexp *, sizeof(*rp), "make_regexp"); - memset((char *) rp, 0, sizeof(*rp)); + ezalloc(rp, Regexp *, sizeof(*rp), "make_regexp"); rp->pat.allocated = 0; /* regex will allocate the buffer */ emalloc(rp->pat.fastmap, char *, 256, "make_regexp"); diff --git a/str_array.c b/str_array.c index fe07ce4b..0f75b300 100644 --- a/str_array.c +++ b/str_array.c @@ -325,8 +325,7 @@ str_copy(NODE *symbol, NODE *newsymb) cursize = symbol->array_size; /* allocate new table */ - emalloc(new, BUCKET **, cursize * sizeof(BUCKET *), "str_copy"); - memset(new, '\0', cursize * sizeof(BUCKET *)); + ezalloc(new, BUCKET **, cursize * sizeof(BUCKET *), "str_copy"); old = symbol->buckets; @@ -666,8 +665,7 @@ grow_table(NODE *symbol) } /* allocate new table */ - emalloc(new, BUCKET **, newsize * sizeof(BUCKET *), "grow_table"); - memset(new, '\0', newsize * sizeof(BUCKET *)); + ezalloc(new, BUCKET **, newsize * sizeof(BUCKET *), "grow_table"); old = symbol->buckets; symbol->buckets = new; diff --git a/symbol.c b/symbol.c index ea5ee0af..cbbd8ed2 100644 --- a/symbol.c +++ b/symbol.c @@ -133,8 +133,7 @@ make_params(char **pnames, int pcount) if (pcount <= 0 || pnames == NULL) return NULL; - emalloc(parms, NODE *, pcount * sizeof(NODE), "make_params"); - memset(parms, '\0', pcount * sizeof(NODE)); + ezalloc(parms, NODE *, pcount * sizeof(NODE), "make_params"); for (i = 0, p = parms; i < pcount; i++, p++) { p->type = Node_param_list; @@ -759,8 +758,7 @@ new_context() { AWK_CONTEXT *ctxt; - emalloc(ctxt, AWK_CONTEXT *, sizeof(AWK_CONTEXT), "new_context"); - memset(ctxt, 0, sizeof(AWK_CONTEXT)); + ezalloc(ctxt, AWK_CONTEXT *, sizeof(AWK_CONTEXT), "new_context"); ctxt->srcfiles.next = ctxt->srcfiles.prev = & ctxt->srcfiles; ctxt->rule_list.opcode = Op_list; ctxt->rule_list.lasti = & ctxt->rule_list; -- cgit v1.2.3 From 0ac746db72a0879bbd44325fe15b3ae33c63ecef Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Thu, 22 Jun 2017 11:02:08 -0400 Subject: In readfile extension, no need to zero out the buffer before overwriting it. --- extension/ChangeLog | 6 ++++++ extension/readfile.c | 14 ++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/extension/ChangeLog b/extension/ChangeLog index 378de373..9574865c 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,9 @@ +2017-06-22 Andrew J. Schorr + + * readfile.c (read_file_to_buffer): Use emalloc instead of ezalloc, + since there's no need to initialize the memory to zero before + overwriting it with the file's contents. + 2017-06-21 Andrew J. Schorr * filefuncs.c (do_fts): Replace emalloc+memset with ezalloc. diff --git a/extension/readfile.c b/extension/readfile.c index f470237b..b600f27a 100644 --- a/extension/readfile.c +++ b/extension/readfile.c @@ -73,24 +73,22 @@ int plugin_is_GPL_compatible; static char * read_file_to_buffer(int fd, const struct stat *sbuf) { - char *text = NULL; - int ret; + char *text; if ((sbuf->st_mode & S_IFMT) != S_IFREG) { errno = EINVAL; update_ERRNO_int(errno); - goto done; + return NULL; } - ezalloc(text, char *, sbuf->st_size + 1, "do_readfile"); + emalloc(text, char *, sbuf->st_size + 1, "do_readfile"); - if ((ret = read(fd, text, sbuf->st_size)) != sbuf->st_size) { + if (read(fd, text, sbuf->st_size) != sbuf->st_size) { update_ERRNO_int(errno); gawk_free(text); - text = NULL; - /* fall through to return */ + return NULL; } -done: + text[sbuf->st_size] = '\0'; return text; } -- cgit v1.2.3 From a702a6b6d6009068f4608a865bdd06a07259cf67 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 22 Jun 2017 22:14:49 +0300 Subject: Update regex routines from GLIBC. --- support/ChangeLog | 5 +++++ support/regcomp.c | 9 +++++---- support/regex.c | 2 +- support/regex.h | 2 +- support/regex_internal.c | 6 +++--- support/regex_internal.h | 5 +---- support/regexec.c | 16 ++++++++-------- 7 files changed, 24 insertions(+), 21 deletions(-) diff --git a/support/ChangeLog b/support/ChangeLog index 54756048..ec54675a 100644 --- a/support/ChangeLog +++ b/support/ChangeLog @@ -1,3 +1,8 @@ +2017-06-22 Arnold D. Robbins + + * regcomp.c, regex.c, regex.h, regex_internal.c, regex_internal.h, + regexec.c: Sync with GLIBC. + 2017-06-18 Arnold D. Robbins * intprops.h: Sync with GNULIB. diff --git a/support/regcomp.c b/support/regcomp.c index 5ac53701..c45e91fc 100644 --- a/support/regcomp.c +++ b/support/regcomp.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2016 Free Software Foundation, Inc. + Copyright (C) 2002-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -961,8 +961,9 @@ static void internal_function init_word_char (re_dfa_t *dfa) { - int i, j, ch; dfa->word_ops_used = 1; + int i = 0; + int ch = 0; #ifndef GAWK if (BE (dfa->map_notascii == 0, 1)) { @@ -996,8 +997,8 @@ init_word_char (re_dfa_t *dfa) } #endif - for (i = 0, ch = 0; i < BITSET_WORDS; ++i) - for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch) + for (; i < BITSET_WORDS; ++i) + for (int j = 0; j < BITSET_WORD_BITS; ++j, ++ch) if (isalnum (ch) || ch == '_') dfa->word_char[i] |= (bitset_word_t) 1 << j; } diff --git a/support/regex.c b/support/regex.c index 9f133fab..d3a44851 100644 --- a/support/regex.c +++ b/support/regex.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2016 Free Software Foundation, Inc. + Copyright (C) 2002-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . diff --git a/support/regex.h b/support/regex.h index 143b3afa..adddd9ee 100644 --- a/support/regex.h +++ b/support/regex.h @@ -1,6 +1,6 @@ /* Definitions for data structures and routines for the regular expression library. - Copyright (C) 1985, 1989-2016 Free Software Foundation, Inc. + Copyright (C) 1985, 1989-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/support/regex_internal.c b/support/regex_internal.c index 18641ef1..2b3120c2 100644 --- a/support/regex_internal.c +++ b/support/regex_internal.c @@ -840,7 +840,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags) } static unsigned char -internal_function __attribute__ ((__pure__)) +internal_function __attribute ((pure)) re_string_peek_byte_case (const re_string_t *pstr, int idx) { int ch, off; @@ -1372,7 +1372,7 @@ re_node_set_insert_last (re_node_set *set, int elem) return 1 if SET1 and SET2 are equivalent, return 0 otherwise. */ static int -internal_function __attribute__ ((__pure__)) +internal_function __attribute ((pure)) re_node_set_compare (const re_node_set *set1, const re_node_set *set2) { int i; @@ -1387,7 +1387,7 @@ re_node_set_compare (const re_node_set *set1, const re_node_set *set2) /* Return (idx + 1) if SET contains the element ELEM, return 0 otherwise. */ static int -internal_function __attribute__ ((__pure__)) +internal_function __attribute ((pure)) re_node_set_contains (const re_node_set *set, int elem) { unsigned int idx, right, mid; diff --git a/support/regex_internal.h b/support/regex_internal.h index 01465e76..9f4ff070 100644 --- a/support/regex_internal.h +++ b/support/regex_internal.h @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2016 Free Software Foundation, Inc. + Copyright (C) 2002-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -44,9 +44,6 @@ #if defined HAVE_STDINT_H || defined _LIBC # include #endif /* HAVE_STDINT_H || _LIBC */ - -#include "intprops.h" - #if defined _LIBC # include #else diff --git a/support/regexec.c b/support/regexec.c index c8f11e52..14813596 100644 --- a/support/regexec.c +++ b/support/regexec.c @@ -1,5 +1,5 @@ /* Extended regular expression matching and search library. - Copyright (C) 2002-2016 Free Software Foundation, Inc. + Copyright (C) 2002-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Isamu Hasegawa . @@ -55,7 +55,8 @@ static int re_search_stub (struct re_pattern_buffer *bufp, int ret_len) internal_function; static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, int nregs, int regs_allocated) internal_function; -static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx); +static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx) + internal_function; static int check_matching (re_match_context_t *mctx, int fl_longest_match, int *p_match_first) internal_function; static int check_halt_state_context (const re_match_context_t *mctx, @@ -362,12 +363,10 @@ re_search_2_stub (struct re_pattern_buffer *bufp, const char *string1, { const char *str; int rval; - int len; + int len = length1 + length2; char *s = NULL; - if (BE ((length1 < 0 || length2 < 0 || stop < 0 - || INT_ADD_WRAPV (length1, length2, &len)), - 0)) + if (BE (length1 < 0 || length2 < 0 || stop < 0 || len < length1, 0)) return -2; /* Concatenate the strings. */ @@ -939,6 +938,7 @@ re_search_internal (const regex_t *preg, const char *string, int length, } static reg_errcode_t +internal_function __attribute_warn_unused_result__ prune_impossible_nodes (re_match_context_t *mctx) { const re_dfa_t *const dfa = mctx->dfa; @@ -1034,7 +1034,7 @@ prune_impossible_nodes (re_match_context_t *mctx) since initial states may have constraints like "\<", "^", etc.. */ static inline re_dfastate_t * -__attribute__ ((always_inline)) internal_function +__attribute ((always_inline)) internal_function acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx, int idx) { @@ -2395,7 +2395,7 @@ merge_state_with_log (reg_errcode_t *err, re_match_context_t *mctx, /* Skip bytes in the input that correspond to part of a multi-byte match, then look in the log for a state from which to restart matching. */ -static re_dfastate_t * +re_dfastate_t * internal_function find_recover_state (reg_errcode_t *err, re_match_context_t *mctx) { -- cgit v1.2.3 From f4df3ba54ba5c2a4aec34d643424834c03645dd9 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Thu, 22 Jun 2017 15:21:38 -0400 Subject: In rwarray extensions, use malloc where calloc not needed. --- extension/ChangeLog | 6 ++++++ extension/rwarray.c | 3 ++- extension/rwarray0.c | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/extension/ChangeLog b/extension/ChangeLog index 9574865c..8bb97590 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,9 @@ +2017-06-22 Andrew J. Schorr + + * rwarray.c (read_value): Use malloc instead of calloc, since + we immediately overwrite the buffer with data from the file. + * rwarray0.c (read_value): Ditto. + 2017-06-22 Andrew J. Schorr * readfile.c (read_file_to_buffer): Use emalloc instead of ezalloc, diff --git a/extension/rwarray.c b/extension/rwarray.c index 370e38ac..53c908df 100644 --- a/extension/rwarray.c +++ b/extension/rwarray.c @@ -482,12 +482,13 @@ read_value(FILE *fp, awk_value_t *value) break; } value->str_value.len = len; - value->str_value.str = gawk_calloc(1, len + 1); + value->str_value.str = gawk_malloc(len + 1); if (fread(value->str_value.str, 1, len, fp) != (ssize_t) len) { gawk_free(value->str_value.str); return awk_false; } + value->str_value.str[len] = '\0'; } return awk_true; diff --git a/extension/rwarray0.c b/extension/rwarray0.c index abeb5326..79dee79e 100644 --- a/extension/rwarray0.c +++ b/extension/rwarray0.c @@ -446,12 +446,13 @@ read_value(int fd, awk_value_t *value) len = ntohl(len); value->val_type = AWK_STRING; value->str_value.len = len; - value->str_value.str = calloc(1, len + 1); + value->str_value.str = malloc(len + 1); if (read(fd, value->str_value.str, len) != (ssize_t) len) { free(value->str_value.str); return awk_false; } + value->str_value.str[len] = '\0'; } return awk_true; -- cgit v1.2.3 From 44e29458a6355ad64e8d89676a441b224ce76cbc Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 23 Jun 2017 12:36:13 +0300 Subject: Fix parenthesization in the pretty printer for real (we hope!). --- ChangeLog | 17 +++ NEWS | 10 +- awk.h | 1 + awkgram.c | 165 +++++++++++---------- awkgram.y | 9 +- eval.c | 1 + interpret.h | 1 + profile.c | 82 +++++------ test/ChangeLog | 5 + test/profile4.ok | 6 +- test/profile5.ok | 426 +++++++++++++++++++++++++++--------------------------- test/profile7.awk | 2 + test/profile7.ok | 6 +- 13 files changed, 385 insertions(+), 346 deletions(-) diff --git a/ChangeLog b/ChangeLog index fe8e49b1..2d9a5b98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2017-06-22 Arnold D. Robbins + + Make pretty-printing include parentheses that were explicitly + in the source code. Thanks to Hermann Peifer for the bug report. + + * awk.h (OPCODE): Add Op_parens. + * awkgram.y [Grammar]: If pretty-printing, add Op_parens ot end of + list for parenthesized expression. + * eval.c (optypetab): Add Op_parens. + * interpret.h (r_interpret): Ditto. + * profile.c (pprint): Ditto. For ?:, don't parenthesize it. + (pp_parenthesize): If string starts with left paren, return early. + (parenthesize): Don't call div_on_left_mul_on_right. + (div_on_left_mul_on_right): Remove function. + (pp_concat): Don't add parentheses if expressions already have them. + * NEWS: Updated. + 2017-06-21 Andrew J. Schorr Replace malloc/memset combinations with calloc by using the new ezalloc diff --git a/NEWS b/NEWS index 7f2072a8..327b9259 100644 --- a/NEWS +++ b/NEWS @@ -74,7 +74,7 @@ Changes from 4.1.x to 4.2.0 18. Support for GNU/Linux on Alpha systems has been removed. 19. Optimizations are now enabled by default. Use the new -s/--no-optimize - option(s) to disable them. Pretty printing and profiling automatically + option(s) to disable them. Pretty-printing and profiling automatically disable optimizations so that the output program is the same as the original input program. @@ -84,8 +84,8 @@ Changes from 4.1.x to 4.2.0 20. Gawk now uses fwrite_unlocked if it's available. The yields a 7% - 18% improvement in raw output speed (gawk '{ print }' on a large file). -21. Pretty printing now uses the original text of constant numeric values for - pretty printing and profiling. +21. Pretty-printing now uses the original text of constant numeric values for + pretty-printing and profiling. 22. Passing negative operands to any of the bitwise functions now produces a fatal error. @@ -118,6 +118,10 @@ Changes from 4.1.x to 4.2.0 28. The PROCINFO["argv"] array records all of gawk's command line arguments as gawk received them (the values of the C level argv array). +29. Pretty-printing now preserves parenthesized expressions as they + were in the source file. This solves several niggling corner cases + with such things. + Changes from 4.1.3 to 4.1.4 --------------------------- diff --git a/awk.h b/awk.h index d5964f88..1ed5a4ef 100644 --- a/awk.h +++ b/awk.h @@ -736,6 +736,7 @@ typedef enum opcodeval { Op_K_else, Op_K_function, Op_cond_exp, + Op_parens, Op_final /* sentry value, not legal */ } OPCODE; diff --git a/awkgram.c b/awkgram.c index 28845c61..82ac3589 100644 --- a/awkgram.c +++ b/awkgram.c @@ -686,11 +686,11 @@ static const yytype_uint16 yyrline[] = 1520, 1527, 1529, 1534, 1536, 1538, 1546, 1548, 1553, 1555, 1560, 1562, 1564, 1620, 1622, 1624, 1626, 1628, 1630, 1632, 1634, 1648, 1653, 1658, 1683, 1689, 1691, 1693, 1695, 1697, - 1699, 1704, 1708, 1740, 1742, 1748, 1754, 1767, 1768, 1769, - 1774, 1779, 1783, 1787, 1802, 1823, 1828, 1865, 1894, 1895, - 1901, 1902, 1907, 1909, 1916, 1933, 1950, 1952, 1959, 1964, - 1972, 1982, 1994, 2003, 2007, 2011, 2015, 2019, 2023, 2026, - 2028, 2032, 2036, 2040 + 1699, 1704, 1708, 1740, 1747, 1753, 1759, 1772, 1773, 1774, + 1779, 1784, 1788, 1792, 1807, 1828, 1833, 1870, 1899, 1900, + 1906, 1907, 1912, 1914, 1921, 1938, 1955, 1957, 1964, 1969, + 1977, 1987, 1999, 2008, 2012, 2016, 2020, 2024, 2028, 2031, + 2033, 2037, 2041, 2045 }; #endif @@ -3842,32 +3842,37 @@ regular_print: case 163: #line 1741 "awkgram.y" /* yacc.c:1646 */ - { (yyval) = (yyvsp[-1]); } -#line 3847 "awkgram.c" /* yacc.c:1646 */ + { + if (do_pretty_print) + (yyval) = list_append((yyvsp[-1]), bcalloc(Op_parens, 1, sourceline)); + else + (yyval) = (yyvsp[-1]); + } +#line 3852 "awkgram.c" /* yacc.c:1646 */ break; case 164: -#line 1743 "awkgram.y" /* yacc.c:1646 */ +#line 1748 "awkgram.y" /* yacc.c:1646 */ { (yyval) = snode((yyvsp[-1]), (yyvsp[-3])); if ((yyval) == NULL) YYABORT; } -#line 3857 "awkgram.c" /* yacc.c:1646 */ +#line 3862 "awkgram.c" /* yacc.c:1646 */ break; case 165: -#line 1749 "awkgram.y" /* yacc.c:1646 */ +#line 1754 "awkgram.y" /* yacc.c:1646 */ { (yyval) = snode((yyvsp[-1]), (yyvsp[-3])); if ((yyval) == NULL) YYABORT; } -#line 3867 "awkgram.c" /* yacc.c:1646 */ +#line 3872 "awkgram.c" /* yacc.c:1646 */ break; case 166: -#line 1755 "awkgram.y" /* yacc.c:1646 */ +#line 1760 "awkgram.y" /* yacc.c:1646 */ { static bool warned = false; @@ -3880,45 +3885,45 @@ regular_print: if ((yyval) == NULL) YYABORT; } -#line 3884 "awkgram.c" /* yacc.c:1646 */ +#line 3889 "awkgram.c" /* yacc.c:1646 */ break; case 169: -#line 1770 "awkgram.y" /* yacc.c:1646 */ +#line 1775 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[-1])->opcode = Op_preincrement; (yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1])); } -#line 3893 "awkgram.c" /* yacc.c:1646 */ +#line 3898 "awkgram.c" /* yacc.c:1646 */ break; case 170: -#line 1775 "awkgram.y" /* yacc.c:1646 */ +#line 1780 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[-1])->opcode = Op_predecrement; (yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1])); } -#line 3902 "awkgram.c" /* yacc.c:1646 */ +#line 3907 "awkgram.c" /* yacc.c:1646 */ break; case 171: -#line 1780 "awkgram.y" /* yacc.c:1646 */ +#line 1785 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_create((yyvsp[0])); } -#line 3910 "awkgram.c" /* yacc.c:1646 */ +#line 3915 "awkgram.c" /* yacc.c:1646 */ break; case 172: -#line 1784 "awkgram.y" /* yacc.c:1646 */ +#line 1789 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_create((yyvsp[0])); } -#line 3918 "awkgram.c" /* yacc.c:1646 */ +#line 3923 "awkgram.c" /* yacc.c:1646 */ break; case 173: -#line 1788 "awkgram.y" /* yacc.c:1646 */ +#line 1793 "awkgram.y" /* yacc.c:1646 */ { if ((yyvsp[0])->lasti->opcode == Op_push_i && ((yyvsp[0])->lasti->memory->flags & STRING) == 0 @@ -3933,11 +3938,11 @@ regular_print: (yyval) = list_append((yyvsp[0]), (yyvsp[-1])); } } -#line 3937 "awkgram.c" /* yacc.c:1646 */ +#line 3942 "awkgram.c" /* yacc.c:1646 */ break; case 174: -#line 1803 "awkgram.y" /* yacc.c:1646 */ +#line 1808 "awkgram.y" /* yacc.c:1646 */ { if ((yyvsp[0])->lasti->opcode == Op_push_i && ((yyvsp[0])->lasti->memory->flags & STRING) == 0 @@ -3955,20 +3960,20 @@ regular_print: (yyval) = list_append((yyvsp[0]), (yyvsp[-1])); } } -#line 3959 "awkgram.c" /* yacc.c:1646 */ +#line 3964 "awkgram.c" /* yacc.c:1646 */ break; case 175: -#line 1824 "awkgram.y" /* yacc.c:1646 */ +#line 1829 "awkgram.y" /* yacc.c:1646 */ { func_use((yyvsp[0])->lasti->func_name, FUNC_USE); (yyval) = (yyvsp[0]); } -#line 3968 "awkgram.c" /* yacc.c:1646 */ +#line 3973 "awkgram.c" /* yacc.c:1646 */ break; case 176: -#line 1829 "awkgram.y" /* yacc.c:1646 */ +#line 1834 "awkgram.y" /* yacc.c:1646 */ { /* indirect function call */ INSTRUCTION *f, *t; @@ -4002,11 +4007,11 @@ regular_print: (yyval) = list_prepend((yyvsp[0]), t); at_seen = false; } -#line 4006 "awkgram.c" /* yacc.c:1646 */ +#line 4011 "awkgram.c" /* yacc.c:1646 */ break; case 177: -#line 1866 "awkgram.y" /* yacc.c:1646 */ +#line 1871 "awkgram.y" /* yacc.c:1646 */ { NODE *n; @@ -4031,49 +4036,49 @@ regular_print: (yyval) = list_append(t, (yyvsp[-3])); } } -#line 4035 "awkgram.c" /* yacc.c:1646 */ +#line 4040 "awkgram.c" /* yacc.c:1646 */ break; case 178: -#line 1894 "awkgram.y" /* yacc.c:1646 */ +#line 1899 "awkgram.y" /* yacc.c:1646 */ { (yyval) = NULL; } -#line 4041 "awkgram.c" /* yacc.c:1646 */ +#line 4046 "awkgram.c" /* yacc.c:1646 */ break; case 179: -#line 1896 "awkgram.y" /* yacc.c:1646 */ +#line 1901 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[0]); } -#line 4047 "awkgram.c" /* yacc.c:1646 */ +#line 4052 "awkgram.c" /* yacc.c:1646 */ break; case 180: -#line 1901 "awkgram.y" /* yacc.c:1646 */ +#line 1906 "awkgram.y" /* yacc.c:1646 */ { (yyval) = NULL; } -#line 4053 "awkgram.c" /* yacc.c:1646 */ +#line 4058 "awkgram.c" /* yacc.c:1646 */ break; case 181: -#line 1903 "awkgram.y" /* yacc.c:1646 */ +#line 1908 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[-1]); } -#line 4059 "awkgram.c" /* yacc.c:1646 */ +#line 4064 "awkgram.c" /* yacc.c:1646 */ break; case 182: -#line 1908 "awkgram.y" /* yacc.c:1646 */ +#line 1913 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[0]); } -#line 4065 "awkgram.c" /* yacc.c:1646 */ +#line 4070 "awkgram.c" /* yacc.c:1646 */ break; case 183: -#line 1910 "awkgram.y" /* yacc.c:1646 */ +#line 1915 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_merge((yyvsp[-1]), (yyvsp[0])); } -#line 4073 "awkgram.c" /* yacc.c:1646 */ +#line 4078 "awkgram.c" /* yacc.c:1646 */ break; case 184: -#line 1917 "awkgram.y" /* yacc.c:1646 */ +#line 1922 "awkgram.y" /* yacc.c:1646 */ { INSTRUCTION *ip = (yyvsp[0])->lasti; int count = ip->sub_count; /* # of SUBSEP-seperated expressions */ @@ -4087,11 +4092,11 @@ regular_print: sub_counter++; /* count # of dimensions */ (yyval) = (yyvsp[0]); } -#line 4091 "awkgram.c" /* yacc.c:1646 */ +#line 4096 "awkgram.c" /* yacc.c:1646 */ break; case 185: -#line 1934 "awkgram.y" /* yacc.c:1646 */ +#line 1939 "awkgram.y" /* yacc.c:1646 */ { INSTRUCTION *t = (yyvsp[-1]); if ((yyvsp[-1]) == NULL) { @@ -4105,31 +4110,31 @@ regular_print: (yyvsp[0])->sub_count = count_expressions(&t, false); (yyval) = list_append(t, (yyvsp[0])); } -#line 4109 "awkgram.c" /* yacc.c:1646 */ +#line 4114 "awkgram.c" /* yacc.c:1646 */ break; case 186: -#line 1951 "awkgram.y" /* yacc.c:1646 */ +#line 1956 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[0]); } -#line 4115 "awkgram.c" /* yacc.c:1646 */ +#line 4120 "awkgram.c" /* yacc.c:1646 */ break; case 187: -#line 1953 "awkgram.y" /* yacc.c:1646 */ +#line 1958 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_merge((yyvsp[-1]), (yyvsp[0])); } -#line 4123 "awkgram.c" /* yacc.c:1646 */ +#line 4128 "awkgram.c" /* yacc.c:1646 */ break; case 188: -#line 1960 "awkgram.y" /* yacc.c:1646 */ +#line 1965 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[-1]); } -#line 4129 "awkgram.c" /* yacc.c:1646 */ +#line 4134 "awkgram.c" /* yacc.c:1646 */ break; case 189: -#line 1965 "awkgram.y" /* yacc.c:1646 */ +#line 1970 "awkgram.y" /* yacc.c:1646 */ { char *var_name = (yyvsp[0])->lextok; @@ -4137,22 +4142,22 @@ regular_print: (yyvsp[0])->memory = variable((yyvsp[0])->source_line, var_name, Node_var_new); (yyval) = list_create((yyvsp[0])); } -#line 4141 "awkgram.c" /* yacc.c:1646 */ +#line 4146 "awkgram.c" /* yacc.c:1646 */ break; case 190: -#line 1973 "awkgram.y" /* yacc.c:1646 */ +#line 1978 "awkgram.y" /* yacc.c:1646 */ { char *arr = (yyvsp[-1])->lextok; (yyvsp[-1])->memory = variable((yyvsp[-1])->source_line, arr, Node_var_new); (yyvsp[-1])->opcode = Op_push_array; (yyval) = list_prepend((yyvsp[0]), (yyvsp[-1])); } -#line 4152 "awkgram.c" /* yacc.c:1646 */ +#line 4157 "awkgram.c" /* yacc.c:1646 */ break; case 191: -#line 1983 "awkgram.y" /* yacc.c:1646 */ +#line 1988 "awkgram.y" /* yacc.c:1646 */ { INSTRUCTION *ip = (yyvsp[0])->nexti; if (ip->opcode == Op_push @@ -4164,73 +4169,73 @@ regular_print: } else (yyval) = (yyvsp[0]); } -#line 4168 "awkgram.c" /* yacc.c:1646 */ +#line 4173 "awkgram.c" /* yacc.c:1646 */ break; case 192: -#line 1995 "awkgram.y" /* yacc.c:1646 */ +#line 2000 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_append((yyvsp[-1]), (yyvsp[-2])); if ((yyvsp[0]) != NULL) mk_assignment((yyvsp[-1]), NULL, (yyvsp[0])); } -#line 4178 "awkgram.c" /* yacc.c:1646 */ +#line 4183 "awkgram.c" /* yacc.c:1646 */ break; case 193: -#line 2004 "awkgram.y" /* yacc.c:1646 */ +#line 2009 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[0])->opcode = Op_postincrement; } -#line 4186 "awkgram.c" /* yacc.c:1646 */ +#line 4191 "awkgram.c" /* yacc.c:1646 */ break; case 194: -#line 2008 "awkgram.y" /* yacc.c:1646 */ +#line 2013 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[0])->opcode = Op_postdecrement; } -#line 4194 "awkgram.c" /* yacc.c:1646 */ +#line 4199 "awkgram.c" /* yacc.c:1646 */ break; case 195: -#line 2011 "awkgram.y" /* yacc.c:1646 */ +#line 2016 "awkgram.y" /* yacc.c:1646 */ { (yyval) = NULL; } -#line 4200 "awkgram.c" /* yacc.c:1646 */ +#line 4205 "awkgram.c" /* yacc.c:1646 */ break; case 197: -#line 2019 "awkgram.y" /* yacc.c:1646 */ +#line 2024 "awkgram.y" /* yacc.c:1646 */ { yyerrok; } -#line 4206 "awkgram.c" /* yacc.c:1646 */ +#line 4211 "awkgram.c" /* yacc.c:1646 */ break; case 198: -#line 2023 "awkgram.y" /* yacc.c:1646 */ +#line 2028 "awkgram.y" /* yacc.c:1646 */ { yyerrok; } -#line 4212 "awkgram.c" /* yacc.c:1646 */ +#line 4217 "awkgram.c" /* yacc.c:1646 */ break; case 201: -#line 2032 "awkgram.y" /* yacc.c:1646 */ +#line 2037 "awkgram.y" /* yacc.c:1646 */ { yyerrok; } -#line 4218 "awkgram.c" /* yacc.c:1646 */ +#line 4223 "awkgram.c" /* yacc.c:1646 */ break; case 202: -#line 2036 "awkgram.y" /* yacc.c:1646 */ +#line 2041 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[0]); yyerrok; } -#line 4224 "awkgram.c" /* yacc.c:1646 */ +#line 4229 "awkgram.c" /* yacc.c:1646 */ break; case 203: -#line 2040 "awkgram.y" /* yacc.c:1646 */ +#line 2045 "awkgram.y" /* yacc.c:1646 */ { yyerrok; } -#line 4230 "awkgram.c" /* yacc.c:1646 */ +#line 4235 "awkgram.c" /* yacc.c:1646 */ break; -#line 4234 "awkgram.c" /* yacc.c:1646 */ +#line 4239 "awkgram.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -4458,7 +4463,7 @@ yyreturn: #endif return yyresult; } -#line 2042 "awkgram.y" /* yacc.c:1906 */ +#line 2047 "awkgram.y" /* yacc.c:1906 */ struct token { @@ -8329,7 +8334,7 @@ add_lint(INSTRUCTION *list, LINTTYPE linttype) // closest to the opcode if that opcode doesn't have one if (ip->source_line != 0) line = ip->source_line; - } + } if (do_lint) { /* compile-time warning */ if (isnoeffect(ip->opcode)) { diff --git a/awkgram.y b/awkgram.y index ad6873bb..d06faf8d 100644 --- a/awkgram.y +++ b/awkgram.y @@ -1738,7 +1738,12 @@ non_post_simp_exp } } | '(' exp r_paren - { $$ = $2; } + { + if (do_pretty_print) + $$ = list_append($2, bcalloc(Op_parens, 1, sourceline)); + else + $$ = $2; + } | LEX_BUILTIN '(' opt_fcall_expression_list r_paren { $$ = snode($3, $1); @@ -5909,7 +5914,7 @@ add_lint(INSTRUCTION *list, LINTTYPE linttype) // closest to the opcode if that opcode doesn't have one if (ip->source_line != 0) line = ip->source_line; - } + } if (do_lint) { /* compile-time warning */ if (isnoeffect(ip->opcode)) { diff --git a/eval.c b/eval.c index c5fea5ee..afa37891 100644 --- a/eval.c +++ b/eval.c @@ -381,6 +381,7 @@ static struct optypetab { { "Op_K_else", "else" }, { "Op_K_function", "function" }, { "Op_cond_exp", NULL }, + { "Op_parens", NULL }, { "Op_final --- this should never appear", NULL }, { NULL, NULL }, }; diff --git a/interpret.h b/interpret.h index 13394e22..ec6a3dda 100644 --- a/interpret.h +++ b/interpret.h @@ -1437,6 +1437,7 @@ match_re: case Op_K_else: case Op_cond_exp: case Op_comment: + case Op_parens: break; default: diff --git a/profile.c b/profile.c index ebb7b7e6..6cdb5baa 100644 --- a/profile.c +++ b/profile.c @@ -427,6 +427,13 @@ cleanup: pp_push(pc->opcode, str, CAN_FREE); break; + case Op_parens: + t1 = pp_pop(); + str = pp_group3("(", t1->pp_str, ")"); + pp_free(t1); + pp_push(pc->opcode, str, CAN_FREE); + break; + case Op_plus: case Op_minus: case Op_times: @@ -546,7 +553,7 @@ cleanup: } else { t2 = pp_pop(); if (prec_level(t2->type) < prec_level(Op_in_array)) { - pp_parenthesize(t2); + pp_parenthesize(t2); } sub = t2->pp_str; str = pp_group3(sub, op2str(Op_in_array), array); @@ -1008,7 +1015,7 @@ cleanup: len = f->pp_len + t->pp_len + cond->pp_len + 12; emalloc(str, char *, len, "pprint"); - sprintf(str, "(%s ? %s : %s)", cond->pp_str, t->pp_str, f->pp_str); + sprintf(str, "%s ? %s : %s", cond->pp_str, t->pp_str, f->pp_str); pp_free(cond); pp_free(t); @@ -1363,6 +1370,9 @@ pp_parenthesize(NODE *sp) char *p = sp->pp_str; size_t len = sp->pp_len; + if (p[0] == '(') // already parenthesized + return; + emalloc(p, char *, len + 3, "pp_parenthesize"); *p = '('; memcpy(p + 1, sp->pp_str, len); @@ -1375,26 +1385,6 @@ pp_parenthesize(NODE *sp) sp->flags |= CAN_FREE; } -/* div_on_left_mul_on_right --- have / or % on left and * on right */ - -static bool -div_on_left_mul_on_right(int o1, int o2) -{ - OPCODE op1 = (OPCODE) o1; - OPCODE op2 = (OPCODE) o2; - - switch (op1) { - case Op_quotient: - case Op_quotient_i: - case Op_mod: - case Op_mod_i: - return (op2 == Op_times || op2 == Op_times_i); - - default: - return false; - } -} - /* parenthesize --- parenthesize two nodes relative to parent node type */ static void @@ -1404,11 +1394,9 @@ parenthesize(int type, NODE *left, NODE *right) int lprec = prec_level(left->type); int prec = prec_level(type); - if (lprec < prec - || (lprec == prec && div_on_left_mul_on_right(left->type, type))) + if (lprec < prec) pp_parenthesize(left); - if (rprec < prec - || (rprec == prec && div_on_left_mul_on_right(type, right->type))) + if (rprec < prec) pp_parenthesize(right); } @@ -1643,22 +1631,27 @@ pp_concat(int nargs) for (i = 1; i < nargs; i++) { r = pp_args[i]; - pl_l = prec_level(pp_args[i]->type); - pl_r = prec_level(pp_args[i+1]->type); - - if (i >= 2 && is_unary_minus(r->pp_str)) { - *s++ = '('; - memcpy(s, r->pp_str, r->pp_len); - s += r->pp_len; - *s++ = ')'; - } else if (is_scalar(pp_args[i]->type) && is_scalar(pp_args[i+1]->type)) { - memcpy(s, r->pp_str, r->pp_len); - s += r->pp_len; - } else if (pl_l <= pl_r || is_scalar(pp_args[i+1]->type)) { - *s++ = '('; - memcpy(s, r->pp_str, r->pp_len); - s += r->pp_len; - *s++ = ')'; + if (r->pp_str[0] != '(') { + pl_l = prec_level(pp_args[i]->type); + pl_r = prec_level(pp_args[i+1]->type); + + if (i >= 2 && is_unary_minus(r->pp_str)) { + *s++ = '('; + memcpy(s, r->pp_str, r->pp_len); + s += r->pp_len; + *s++ = ')'; + } else if (is_scalar(pp_args[i]->type) && is_scalar(pp_args[i+1]->type)) { + memcpy(s, r->pp_str, r->pp_len); + s += r->pp_len; + } else if (pl_l <= pl_r || is_scalar(pp_args[i+1]->type)) { + *s++ = '('; + memcpy(s, r->pp_str, r->pp_len); + s += r->pp_len; + *s++ = ')'; + } else { + memcpy(s, r->pp_str, r->pp_len); + s += r->pp_len; + } } else { memcpy(s, r->pp_str, r->pp_len); s += r->pp_len; @@ -1673,7 +1666,10 @@ pp_concat(int nargs) pl_l = prec_level(pp_args[nargs-1]->type); pl_r = prec_level(pp_args[nargs]->type); r = pp_args[nargs]; - if (is_unary_minus(r->pp_str) || ((pl_l >= pl_r && ! is_scalar(pp_args[nargs]->type)))) { + if (r->pp_str[0] == '(') { + memcpy(s, r->pp_str, r->pp_len); + s += r->pp_len; + } else if (is_unary_minus(r->pp_str) || ((pl_l >= pl_r && ! is_scalar(pp_args[nargs]->type)))) { *s++ = '('; memcpy(s, r->pp_str, r->pp_len); s += r->pp_len; diff --git a/test/ChangeLog b/test/ChangeLog index d2dd6abd..d1561ac0 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2017-06-22 Arnold D. Robbins + + * profile4.ok, profile5.ok, profile7.ok: Updated after code changes. + * profile7.awk: Added two more statements. + 2017-06-18 Arnold D. Robbins * Makefile.am (mbprintf5): New test. diff --git a/test/profile4.ok b/test/profile4.ok index 9d2b9430..06b31bc1 100644 --- a/test/profile4.ok +++ b/test/profile4.ok @@ -1,9 +1,9 @@ BEGIN { - a = "foo" (c = "bar") + a = ("foo" (c = "bar")) a = (b - c) "foo" a = "foo" (b - c) q = (d = "x") (e = "y") - a = (c = tolower("FOO")) in JUNK - x = y == 0 && z == 2 && q == 45 + a = ((c = tolower("FOO")) in JUNK) + x = (y == 0 && z == 2 && q == 45) } diff --git a/test/profile5.ok b/test/profile5.ok index 0fb8589e..c8abf1fb 100644 --- a/test/profile5.ok +++ b/test/profile5.ok @@ -103,7 +103,7 @@ BEGIN { #___________________________________________________________________________________ BEGIN { _SYS_STDCON = "CON" - _CON_WIDTH = (match(_cmd("MODE " _SYS_STDCON " 2>NUL"), /Columns:[ \t]*([0-9]+)/, A) ? strtonum(A[1]) : 80) + _CON_WIDTH = match(_cmd("MODE " _SYS_STDCON " 2>NUL"), /Columns:[ \t]*([0-9]+)/, A) ? strtonum(A[1]) : 80 } BEGIN { @@ -286,7 +286,7 @@ BEGIN { a = ENVIRON["EGAWK_CMDLINE"] gsub(/^[ \t]*/, "", a) a = _lib_CMDLN(a) - if (a != "" && ! _LIBAPI["F"]["!"]) { + if ((a != "") && (! _LIBAPI["F"]["!"])) { _out(_lib_HELP()) _fatal("Bad comandline argument `" a "'") } @@ -733,7 +733,7 @@ function _BASE(c, t, P, A) return _endpass(_basexit_fl = 1) } if (_cmdln_version) { - _out(_ln(_PRODUCT_NAME " v" _PRODUCT_VERSION) _ln(_PRODUCT_COPYRIGHT) _ln() ((_cmdln_version == "v" ? "" : _lib_NAMEVER()))) + _out(_ln(_PRODUCT_NAME " v" _PRODUCT_VERSION) _ln(_PRODUCT_COPYRIGHT) _ln() (_cmdln_version == "v" ? "" : _lib_NAMEVER())) return _endpass(_basexit_fl = 1) } return @@ -826,7 +826,7 @@ function _ERRLOG(c, t, P, a, b, A) } } if (_ERRLOG_IF) { - _info("Log-message types inherited acc/deny: " "TRACE " ((_ERRLOG_TF ? "ON" : "OFF")) "/" "VERBOSE " ((_ERRLOG_VF ? "ON" : "OFF")) "/" "INFO " ((_ERRLOG_IF ? "ON" : "OFF")) "/" "WARNING " ((_ERRLOG_WF ? "ON" : "OFF")) "/" "ERROR " ((_ERRLOG_EF ? "ON" : "OFF")) "/" "FATAL " ((_ERRLOG_FF ? "ON" : "OFF"))) + _info("Log-message types inherited acc/deny: " "TRACE " (_ERRLOG_TF ? "ON" : "OFF") "/" "VERBOSE " (_ERRLOG_VF ? "ON" : "OFF") "/" "INFO " (_ERRLOG_IF ? "ON" : "OFF") "/" "WARNING " (_ERRLOG_WF ? "ON" : "OFF") "/" "ERROR " (_ERRLOG_EF ? "ON" : "OFF") "/" "FATAL " (_ERRLOG_FF ? "ON" : "OFF")) } } return @@ -1118,7 +1118,7 @@ function _START(t, i, A) _defile(p, "config.dll", "config.dll", "") _defsrv(p, "DS Plug-in Service", "Altiris Deployment Solution - System Configuration") _defreg(p, "Deployment Agent Path", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Deployment\\AgentInstallPath.STR") - _defile(p, "Altiris_DeploymentSolutionAgent_7_1_x86.msi", (_SYS["OSArchitecture"] == "64-bit" ? "C:\\Program Files\\Altiris\\Altiris Agent\\Agents\\SoftwareManagement\\Software Delivery\\{9D76E4CA-377A-472D-A82E-EDAD77E7E4ED}\\cache\\Altiris_DeploymentSolutionAgent_7_1_x64.msi" : "C:\\Program Files\\Altiris\\Altiris Agent\\Agents\\SoftwareManagement\\Software Delivery\\{4B747D25-612F-48FC-B6B5-9916D1BB755C}\\cache\\Altiris_DeploymentSolutionAgent_7_1_x86.msi"), "") + _defile(p, "Altiris_DeploymentSolutionAgent_7_1_x86.msi", _SYS["OSArchitecture"] == "64-bit" ? "C:\\Program Files\\Altiris\\Altiris Agent\\Agents\\SoftwareManagement\\Software Delivery\\{9D76E4CA-377A-472D-A82E-EDAD77E7E4ED}\\cache\\Altiris_DeploymentSolutionAgent_7_1_x64.msi" : "C:\\Program Files\\Altiris\\Altiris Agent\\Agents\\SoftwareManagement\\Software Delivery\\{4B747D25-612F-48FC-B6B5-9916D1BB755C}\\cache\\Altiris_DeploymentSolutionAgent_7_1_x86.msi", "") _defdir(p, "Deployment Folder", a = gensub(/[^\\]*$/, "", 1, _rdsafe(_REG, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Deployment\\AgentInstallPath.STR", "C:\\Program Files\\Altiris\\Altiris Agent\\Agents\\Deployment\\Agent\\"))) #___________________________________________________________________________________ p = _defsolution(pp, "DS Auto", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Altiris Agent\\Plugin Objects\\Agents\\") @@ -1191,7 +1191,7 @@ function _Zexparr(S, s, t, i) t = "" if (isarray(S)) { for (i in S) { - t = t ((isarray(S[i]) ? _Zexparr_i1(i) "\020" _Zexparr_i0(S[i]) "\021\021\020" : _Zexparr_i2(_Zexparr_i3(i) "\021" _Zexparr_i3(S[i])) "\020")) + t = t (isarray(S[i]) ? (_Zexparr_i1(i) "\020" _Zexparr_i0(S[i]) "\021\021\020") : (_Zexparr_i2(_Zexparr_i3(i) "\021" _Zexparr_i3(S[i])) "\020")) } } if (s != "") { @@ -1207,7 +1207,7 @@ function _Zexparr(S, s, t, i) function _Zexparr_i0(S, t, i) { for (i in S) { - t = t ((isarray(S[i]) ? _Zexparr_i1(i) "\020" _Zexparr_i0(S[i]) "\021\021\020" : _Zexparr_i2(_Zexparr_i3(i) "\021" _Zexparr_i3(S[i])) "\020")) + t = t (isarray(S[i]) ? (_Zexparr_i1(i) "\020" _Zexparr_i0(S[i]) "\021\021\020") : (_Zexparr_i2(_Zexparr_i3(i) "\021" _Zexparr_i3(S[i])) "\020")) } return t } @@ -1252,7 +1252,7 @@ function _Zimparr(D, t, A, B) #_________________________________________________________________ function _Zimparr_i0(A, B, i) { - return ((i in A ? A[i] B[i] _Zimparr_i0(A, B, i + 1) : "")) + return (i in A ? (A[i] B[i] _Zimparr_i0(A, B, i + 1)) : "") } #_________________________________________________________________ @@ -1453,7 +1453,7 @@ function _addf(A, f) function _addfile(f, d, a, b) { ################################## - if ((f = _wfilerdnehnd(f)) == "" || _filene(f) == "") { + if (((f = _wfilerdnehnd(f)) == "") || (_filene(f) == "")) { ERRNO = "Filename error" return } @@ -1497,7 +1497,7 @@ function _addlist(A, v) function _bearray(A) { #_______________________________________________________________________ - if (isarray(A) || A == 0 && A == "") { + if (isarray(A) || (A == 0 && A == "")) { return 1 #################################################### } } @@ -1512,7 +1512,7 @@ function _bframe(A, t, p) #___________________________________________________________ function _bframe_i0(A, t, p, f) { - return ((f ? _bframe_i0(A, t, p, A[f]) (@f(t, p)) : "")) + return (f ? (_bframe_i0(A, t, p, A[f]) (@f(t, p))) : "") } # add to _dumparr: checking that if element is undefined @@ -1547,8 +1547,8 @@ function _cfguid(p, optr, pfx, sfx, hstrcnt, lstrchr) _UIDOBL[p] = _UIDOBL[optr] } } - _UIDPFX[p] = (_istr(pfx) ? pfx : "") - _UIDSFX[p] = (_istr(sfx) ? sfx : "") + _UIDPFX[p] = _istr(pfx) ? pfx : "" + _UIDSFX[p] = _istr(sfx) ? sfx : "" if (_isptr(hstrcnt)) { if (hstrcnt != p) { _UIDCHR[p] = _UIDCHR[_UIDCNT[p] = _UIDCNT[hstrcnt]] @@ -1615,7 +1615,7 @@ function _check(p) function _chrline(t, ts, w, s) { ############################################# - return ((t = " " _tabtospc(t, ts) ((t ? (t ~ /[ \t]$/ ? "" : " ") : ""))) _getchrln((s ? s : "_"), ((w ? w : _CON_WIDTH - 1)) - length(t)) _CHR["EOL"]) + return (t = " " _tabtospc(t, ts) (t ? t ~ /[ \t]$/ ? "" : " " : "")) _getchrln(s ? s : "_", (w ? w : _CON_WIDTH - 1) - length(t)) _CHR["EOL"] } #_____________________________________________________________________________ @@ -1674,23 +1674,23 @@ function _con(t, ts, a, b, c, d, i, r, A, B) if ((i = length(t = _tabtospc(A[1], ts, _conlastrln))) < _constatstrln) { t = t _getchrln(" ", _constatstrln - i) } - print(t B[1]) > _SYS_STDCON + print((t B[1])) > _SYS_STDCON for (i = 2; i < c; i++) { - print(_tabtospc(A[i], ts) B[i]) > _SYS_STDCON + print((_tabtospc(A[i], ts) B[i])) > _SYS_STDCON } - print(_conlastr = _tabtospc(A[c], ts)) > _SYS_STDCON + print((_conlastr = _tabtospc(A[c], ts))) > _SYS_STDCON fflush(_SYS_STDCON) } else { - print(t = _tabtospc(t, ts, _conlastrln)) > _SYS_STDCON + print((t = _tabtospc(t, ts, _conlastrln))) > _SYS_STDCON fflush(_SYS_STDCON) _conlastr = _conlastr t } if ((i = length(_conlastr)) >= _CON_WIDTH) { - _conlastr = substr(_conlastr, 1 + int(i / _CON_WIDTH) * _CON_WIDTH) + _conlastr = substr(_conlastr, 1 + (int(i / _CON_WIDTH) * _CON_WIDTH)) } _conlastrln = length(_conlastr) if (_constatstr) { - print((t = _constatgtstr(_constatstr, _CON_WIDTH - 1 - _conlastrln)) _CHR["CR"] _conlastr) > _SYS_STDCON + print(((t = _constatgtstr(_constatstr, _CON_WIDTH - 1 - _conlastrln)) _CHR["CR"] _conlastr)) > _SYS_STDCON fflush(_SYS_STDCON) _constatstrln = length(t) } @@ -1728,7 +1728,7 @@ function _conin(t, a, b) function _conl(t, ts) { #################################################### - return _con(t ((t ~ /\x0A$/ ? "" : _CHR["EOL"])), ts) + return _con(t (t ~ /\x0A$/ ? "" : _CHR["EOL"]), ts) } #_______________________________________________________________________ @@ -1757,7 +1757,7 @@ function _constat(t, ts, ln, a) a = BINMODE BINMODE = "rw" ORS = "" - print(t _CHR["CR"] _conlastr) > _SYS_STDCON + print((t _CHR["CR"] _conlastr)) > _SYS_STDCON fflush(_SYS_STDCON) ORS = ln BINMODE = a @@ -1806,7 +1806,7 @@ function _constatpush(t, ts) #___________________________________________________________________________________ function _creport(p, t, f, z) { - _[p]["REPORT"] = _[p]["REPORT"] _ln(t ((f == "" ? "" : ": " f))) + _[p]["REPORT"] = _[p]["REPORT"] _ln(t (f == "" ? "" : ": " f)) } #_________________________________________________________________________________________ @@ -1909,7 +1909,7 @@ function _del(f, c, a, A) { ################################################# if (match(f, /\\[ \t]*$/)) { - if ((c = toupper(_filerd(f))) && length(f) == FLENGTH) { + if ((c = toupper(_filerd(f))) && (length(f) == FLENGTH)) { _cmd("rd " c " /S /Q 2>NUL") _deletepfx(_WFILEROOTDIR, c) _deletepfx(_FILEIO_RDTMP, c) @@ -1996,7 +1996,7 @@ function _dir(A, rd, i, r, f, ds, pf, B, C) return "" } i = split(_cmd("dir \"" rd "\" 2>NUL"), B, /\x0D?\x0A/) - 3 - pf = (match(B[4], /Directory of ([^\x00-\x1F]+)/, C) ? C[1] ((C[1] ~ /\\$/ ? "" : "\\")) : "") + pf = (match(B[4], /Directory of ([^\x00-\x1F]+)/, C) ? (C[1] (C[1] ~ /\\$/ ? "" : "\\")) : "") for (r = 0; i > 5; i--) { if (match(B[i], /^([^ \t]*)[ \t]+([^ \t]*)[ \t]+(()|([0-9\,]+))[ \t]+([^\x00-\x1F]+)$/, C)) { if (C[6] !~ /^\.\.?$/) { @@ -2006,7 +2006,7 @@ function _dir(A, rd, i, r, f, ds, pf, B, C) ds = C[5] " " gsub(/\,/, "", ds) } - if ((f = _filepath(pf C[6] ((C[4] ? "\\" : "")))) != "") { + if ((f = _filepath(pf C[6] (C[4] ? "\\" : ""))) != "") { A[f] = ds C[1] " " C[2] r++ } @@ -2142,13 +2142,13 @@ function _dllerr(p, t, f) t = "ERROR: \000" t } _errfl = 1 - _[p]["ERROR"] = _[p]["ERROR"] _ln(t ((f == "" ? "" : ": " f))) + _[p]["ERROR"] = _[p]["ERROR"] _ln(t (f == "" ? "" : ": " f)) } function _drawuid(p, cn, ch, o) { _conl("uid: " p) - _conl("\toblptr: " ((p in _UIDOBL ? _UIDOBL[p] "'" : "-"))) + _conl("\toblptr: " (p in _UIDOBL ? _UIDOBL[p] "'" : "-")) if (p in _UIDOBL) { if (! _isptr(o = _UIDOBL[p])) { _conl(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> oblptr not pointer") @@ -2157,14 +2157,14 @@ function _drawuid(p, cn, ch, o) _conl(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> no OBLV array at ptr") } } - _conl("\tprefix: " ((p in _UIDPFX ? _UIDPFX[p] "'" : "-"))) - _conl("\tsuffix: " ((p in _UIDSFX ? _UIDSFX[p] "'" : "-"))) - _conl("\tcounters: " (cn = (p in _UIDCNT ? _UIDCNT[p] "'" : "-"))) + _conl("\tprefix: " (p in _UIDPFX ? _UIDPFX[p] "'" : "-")) + _conl("\tsuffix: " (p in _UIDSFX ? _UIDSFX[p] "'" : "-")) + _conl("\tcounters: " (cn = p in _UIDCNT ? _UIDCNT[p] "'" : "-")) if (cn != "-") { _conl("\t\tcntrL: " _UIDCNTL[_UIDCNT[p]] "'") _conl("\t\tcntrH: " _UIDCNTH[_UIDCNT[p]] "'") } - _conl("\tcharset: " (ch = (p in _UIDCHR ? _UIDCHR[p] "'" : "-"))) + _conl("\tcharset: " (ch = p in _UIDCHR ? _UIDCHR[p] "'" : "-")) if (ch != "-") { _conl("chrH: ") _conl(_dumparr(_UIDCHRH[_UIDCHR[p]])) @@ -2184,7 +2184,7 @@ function _dumparr(A, t, lv, a) if (isarray(A)) { delete _DUMPARR _dumparrc = _dumparrd = "" - _dumparr_i1(A, lv = ((lv == "" ? 16 : (lv == 0 || lv + 0 != 0 ? lv : (lv == "-*" ? -3 : (lv ~ /^\+?\*$/ ? 3 : 16))))) + 0, (lv < 0 ? -1 : 1), 0, _tabtospc(t)) + _dumparr_i1(A, lv = (lv == "" ? 16 : lv == 0 || (lv + 0) != 0 ? lv : lv == "-*" ? -3 : lv ~ /^\+?\*$/ ? 3 : 16) + 0, lv < 0 ? -1 : 1, 0, _tabtospc(t)) PROCINFO["sorted_in"] = a return _retarrd(_DUMPARR, _dumparrd, _dumparrd = "") } @@ -2201,10 +2201,10 @@ function _dumparr_i1(A, lv, ls, ln, t, t2, i, a, f) } } else { for (i in A) { - (isarray(A[i]) ? ++a : "") + isarray(A[i]) ? ++a : "" } } - if (length(_dumparrd = _dumparrd t ((a > 0 ? " ... (x" a ")" : "")) _CHR["EOL"]) > 262144) { + if (length(_dumparrd = _dumparrd t (a > 0 ? " ... (x" a ")" : "") _CHR["EOL"]) > 262144) { _DUMPARR[++_dumparrc] = _dumparrd _dumparrd = "" } @@ -2213,7 +2213,7 @@ function _dumparr_i1(A, lv, ls, ln, t, t2, i, a, f) if (ls >= 0) { for (i in A) { if (! isarray(A[i])) { - if (length(_dumparrd = _dumparrd ((f ? t2 : t _nop(f = 1))) "[" i "]=" A[i] "'" _CHR["EOL"]) > 262144) { + if (length(_dumparrd = _dumparrd (f ? t2 : t _nop(f = 1)) "[" i "]=" A[i] "'" _CHR["EOL"]) > 262144) { _DUMPARR[++_dumparrc] = _dumparrd _dumparrd = "" } @@ -2222,7 +2222,7 @@ function _dumparr_i1(A, lv, ls, ln, t, t2, i, a, f) } for (i in A) { if (isarray(A[i])) { - _dumparr_i1(A[i], lv, ls, ln + ls, _th0((f ? t2 : t), f = 1) "[" i "]") + _dumparr_i1(A[i], lv, ls, ln + ls, _th0(f ? t2 : t, f = 1) "[" i "]") } } if (! f) { @@ -2245,8 +2245,8 @@ function _dumpobj(p, f, t, s) { ################################################### s = _dumpobj_i0(p, f, t = t "." p "{") - if (p = _rFCHLD(p)) { - return (s = s _dumpobjm(p, f, (s ? _getchrln(" ", length(t) - 1) : t " "))) + if ((p = _rFCHLD(p))) { + return (s = s _dumpobjm(p, f, s ? _getchrln(" ", length(t) - 1) : t " ")) } return s } @@ -2266,7 +2266,7 @@ function _dumpobj_i0(p, f, t) #___________________________________________________________ function _dumpobj_i1(p, t) { - return _ln(t substr(((p in _tPREV ? "\253" _tPREV[p] : "")) " ", 1, 7) " " substr(((p in _tPARENT ? "\210" _tPARENT[p] : "")) " ", 1, 7) " " substr(((p in _tFCHLD ? _tFCHLD[p] : "")) "\205" ((p in _tQCHLD ? " (" _tQCHLD[p] ") " : "\205")) "\205" ((p in _tLCHLD ? _tLCHLD[p] : "")) " ", 1, 22) substr(((p in _tNEXT ? "\273" _tNEXT[p] : "")) " ", 1, 8)) + return _ln(t substr(((p in _tPREV) ? "\253" _tPREV[p] : "") " ", 1, 7) " " substr(((p in _tPARENT) ? "\210" _tPARENT[p] : "") " ", 1, 7) " " substr(((p in _tFCHLD) ? _tFCHLD[p] : "") "\205" ((p in _tQCHLD) ? " (" _tQCHLD[p] ") " : "\205") "\205" ((p in _tLCHLD) ? _tLCHLD[p] : "") " ", 1, 22) substr(((p in _tNEXT) ? "\273" _tNEXT[p] : "") " ", 1, 8)) } #___________________________________________________________ @@ -2291,7 +2291,7 @@ function _dumpobj_i3(A, t, p, e, s, i, t2) } return s } - return ((e == "" ? "" : t e)) + return (e == "" ? "" : t e) } if (A == 0 && A == "") { return @@ -2323,7 +2323,7 @@ function _dumpobjm(p, f, t, s, t2) do { s = s _dumpobj(p, f, t) t = t2 - } while (p = _rNEXT(p)) + } while ((p = _rNEXT(p))) return s } @@ -2335,13 +2335,13 @@ function _dumpobjm_nc(p, f, t, s, t2) do { s = s _dumpobj_nc(p, f, t) t = t2 - } while (p = _rNEXT(p)) + } while ((p = _rNEXT(p))) return s } function _dumpuidgen(p, pd, pc, ps) { - _conline("#" ++cntdm ": " p "'") + _conline("#" (++cntdm) ": " p "'") _conl() if (p in _tuidel) { _conl("DEL: " _var(pd = _tuidel[p])) @@ -2349,13 +2349,13 @@ function _dumpuidgen(p, pd, pc, ps) } _conl("PFX: " _tUIDPFX[p] "'") _conl("SFX: " _tUIDSFX[p] "'") - _conl("COUNT: " ((p in _tuidcnt ? (pc = _tuidcnt[p]) "'" : _th0("-", pc = -2)))) + _conl("COUNT: " (p in _tuidcnt ? (pc = _tuidcnt[p]) "'" : _th0("-", pc = -2))) _con("CHARS: ") if (p in _tuidchr) { _conl((ps = _tuidchr[p]) "'") - _conl("HCHR: " ((pc == -2 ? "-" : _tUIDCNTH[pc] "'"))) + _conl("HCHR: " (pc == -2 ? "-" : _tUIDCNTH[pc] "'")) _conl(_dumparr(_tUIDCHRH[ps]) _ln()) - _conl("LCHR: " ((pc == -2 ? "-" : _tUIDCNTL[pc] "'"))) + _conl("LCHR: " (pc == -2 ? "-" : _tUIDCNTL[pc] "'")) _conl(_dumparr(_tUIDCHRL[ps]) _ln()) } else { _conl("-") @@ -2365,7 +2365,7 @@ function _dumpuidgen(p, pd, pc, ps) #_____________________________________________________________________________ function _dumpval(v, n) { - _dumpstr = _dumpstr (v = _ln(((n == 0 && n == "" ? "RET" : n)) ": " ((v == 0 && v == "" ? "-" : v "'")))) + _dumpstr = _dumpstr (v = _ln((n == 0 && n == "" ? "RET" : n) ": " (v == 0 && v == "" ? "-" : v "'"))) return v } @@ -2418,7 +2418,7 @@ function _err(t, a, b) function _errnl(t) { ################################################ - return _err(t ((t ~ /\x0A$/ ? "" : _CHR["EOL"]))) + return _err(t (t ~ /\x0A$/ ? "" : _CHR["EOL"])) } #_______________________________________________________________________ @@ -2459,7 +2459,7 @@ function _expout(t, d, a, b) b = ORS BINMODE = "rw" ORS = "" - print(t) > ((d ? d : d = _errlog_file)) + print(t) > (d ? d : (d = _errlog_file)) fflush(d) BINMODE = a ORS = b @@ -2481,7 +2481,7 @@ function _faccl_i0(A, t, p, P, f, r) { f = r = "" if (isarray(A)) { - while (f = A[f]) { + while ((f = A[f])) { r = (@f(t, p, P)) r } } @@ -2492,7 +2492,7 @@ function _faccr_i0(A, t, p, P, f, r) { f = r = "" if (isarray(A)) { - while (f = A[f]) { + while ((f = A[f])) { r = r @f(t, p, P) } } @@ -2543,7 +2543,7 @@ function _fframe(A, t, p) #___________________________________________________________ function _fframe_i0(A, t, p, f) { - return ((f ? (@f(t, p)) _fframe_i0(A, t, p, A[f]) : "")) + return (f ? ((@f(t, p)) _fframe_i0(A, t, p, A[f])) : "") } #_________________________________________________________________ @@ -2553,7 +2553,7 @@ function _file(f) if ((f = _filerdnehnd(f)) == "") { return "" } - return ((f in _FILEXT ? _FILEXT[f] : "")) + return (f in _FILEXT ? _FILEXT[f] : "") } #_______________________________________________________________________ @@ -2569,7 +2569,7 @@ function _file_check_i0(p, pp, p1, p2, f, v) { if (_[p]["TYPE"] == "defile") { f = _[p]["FILE"] - f = ((match(f, /^.:/) ? "" : _[_[pp]["AGENT"]][".Install Path"] "\\")) _[p]["FILE"] + f = (match(f, /^.:/) ? "" : _[_[pp]["AGENT"]][".Install Path"] "\\") _[p]["FILE"] if ("RQVERSION" in _[p]) { v = _[p]["RQVERSION"] } else { @@ -2583,7 +2583,7 @@ function _file_check_i0(p, pp, p1, p2, f, v) if (v != "" && v != (_[p]["VERSION"] = _getfilever(f))) { return _dllerr(p, " file version mismatch: ==`" _[p]["VERSION"] "'; !=`" v "'", f) } - _creport(p, substr("OK: FILE DETECTED" ((v == "" ? "" : "(" v ")")) ": " f, 1, 122)) + _creport(p, substr("OK: FILE DETECTED" (v == "" ? "" : "(" v ")") ": " f, 1, 122)) } else if (_[p]["TYPE"] == "defdir") { if (_filexist(f = _[p]["DIR"])) { _creport(p, substr("OK: DIR DETECTED: " f, 1, 112)) @@ -2604,12 +2604,12 @@ function _filed(f, dd, d) return _FILEDIR[f] } if (f in _FILEROOT) { - if (d = filegetdrvdir(_FILEROOT[f])) { + if ((d = filegetdrvdir(_FILEROOT[f]))) { _FILEDIRFL[f] } return (_FILEDIR[f] = d _FILEDIR[f]) } - if ((dd = (dd ? dd : _FILEIO_RD), f) in _FILEDIR) { + if (((dd = dd ? dd : _FILEIO_RD), f) in _FILEDIR) { return _FILEDIR[dd, f] } if ((d = filedi(dd) _FILEDIR[f]) ~ /^\\/) { @@ -2625,7 +2625,7 @@ function _filen(f) if ((f = _filerdnehnd(f)) == "") { return "" } - return ((f in _FILENAM ? _FILENAM[f] : "")) + return (f in _FILENAM ? _FILENAM[f] : "") } #_________________________________________________________________ @@ -2635,7 +2635,7 @@ function _filene(f) if ((f = _filerdnehnd(f)) == "") { return "" } - return (((f in _FILENAM ? _FILENAM[f] : "")) ((f in _FILEXT ? _FILEXT[f] : ""))) + return (f in _FILENAM ? _FILENAM[f] : "") (f in _FILEXT ? _FILEXT[f] : "") } #_________________________________________________________________ @@ -2663,7 +2663,7 @@ function _filepath(f, dd) if ((f = _filerdnehnd(f)) == "") { return "" } - return (filegetrootdir(f, dd) ((f in _FILENAM ? _FILENAM[f] : "")) ((f in _FILEXT ? _FILEXT[f] : ""))) + return (filegetrootdir(f, dd) (f in _FILENAM ? _FILENAM[f] : "") (f in _FILEXT ? _FILEXT[f] : "")) } #_________________________________________________________________ @@ -2676,7 +2676,7 @@ function _filer(f, dd) if (f in _FILEROOT) { return _FILEROOT[f] } - if ((dd = (dd ? dd : _FILEIO_RD), f) in _FILEROOT) { + if (((dd = dd ? dd : _FILEIO_RD), f) in _FILEROOT) { return _FILEROOT[dd, f] } return (_FILEROOT[dd, f] = fileri(dd)) @@ -2699,7 +2699,7 @@ function _filerdn(f, dd) if ((f = _filerdnehnd(f)) == "") { return "" } - return ((f in _FILENAM ? filegetrootdir(f, dd) _FILENAM[f] : "")) + return (f in _FILENAM ? (filegetrootdir(f, dd) _FILENAM[f]) : "") } #_________________________________________________________________ @@ -2709,8 +2709,8 @@ function _filerdne(f, dd) if ((f = _filerdnehnd(f)) == "") { return "" } - if (f in _FILENAM) { - return (filegetrootdir(f, dd) _FILENAM[f] ((f in _FILEXT ? _FILEXT[f] : ""))) + if ((f in _FILENAM)) { + return (filegetrootdir(f, dd) _FILENAM[f] (f in _FILEXT ? _FILEXT[f] : "")) } if (f in _FILEXT) { return (filegetrootdir(f, dd) _FILEXT[f]) @@ -2729,7 +2729,7 @@ function _filerdnehnd(st, c, r, d, n, A) if (match(st, /^[ \t]*\\[ \t]*\\/)) { if (match(substr(st, (FLENGTH = RLENGTH) + 1), /^[ \t]*([0-9A-Za-z\-]+)[ \t]*(\\[ \t]*([A-Za-z])[ \t]*\$[ \t]*)?(\\[ \t]*([0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+( +[0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+)*[ \t]*\\)+[ \t]*)?(([0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+( +[0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+)*)[ \t]*)?/, A)) { FLENGTH = FLENGTH + RLENGTH - d = ((A[3] ? "\\" A[3] "$" : "")) A[4] + d = (A[3] ? ("\\" A[3] "$") : "") A[4] gsub(/[ \t]*\\[ \t]*/, "\\", d) if ((st = toupper((r = "\\\\" A[1]) d (n = A[8]))) in _FILECACHE) { return (_FILECACHE[substr(c, 1, FLENGTH)] = _FILECACHE[st]) @@ -2812,7 +2812,7 @@ function _foreach(A, f, r, p0, p1, p2, i, p) } if (_isptr(A)) { _TMP0[p = _n()][_ARRLEN] = 1 - _tframe4("_foreach_i1" ((r ? "~" r : "")), A, f, _TMP0[p], p0, p1) + _tframe4("_foreach_i1" (r ? "~" r : ""), A, f, _TMP0[p], p0, p1) return _th0(_retarr(_TMP0[p]), _tdel(p)) } } @@ -2921,7 +2921,7 @@ function _fthru(A, c, p, B) #_________________________________________________________________ function _fthru_i0(A, c, p, B, f) { - return ((f ? @f(c, _fthru_i0(A, c, p, B, A[f]), B) : "")) + return (f ? @f(c, _fthru_i0(A, c, p, B, A[f]), B) : "") } function _gen(D, t) @@ -2951,7 +2951,7 @@ function _get_errout(p) #_______________________________________________________________________ function _get_errout_i0(p, t, n, a) { - return ((p in _tLOG ? _get_errout_i1(p) _get_errout_i3(p) : "")) + return (p in _tLOG ? (_get_errout_i1(p) _get_errout_i3(p)) : "") } #_________________________________________________________________ @@ -2974,7 +2974,7 @@ function _get_errout_i1(p, t, n, a) #_______________________________________________________________________ function _get_errout_i2(p) { - return (("FILE" in _tLOG[p] ? _tLOG[p]["FILE"] (("LINE" in _tLOG[p] ? "(" _tLOG[p]["LINE"] ")" : "")) ": " : "")) + return ("FILE" in _tLOG[p] ? (_tLOG[p]["FILE"] ("LINE" in _tLOG[p] ? ("(" _tLOG[p]["LINE"] ")") : "") ": ") : "") } #_______________________________________________________________________ @@ -3007,9 +3007,9 @@ function _get_logout(p) function _get_logout_i0(p, t, n, a) { if (p in _tLOG) { - n = (("DATE" in _tLOG[p] ? _tLOG[p]["DATE"] " " : "")) (("TIME" in _tLOG[p] ? _tLOG[p]["TIME"] " " : "")) + n = ("DATE" in _tLOG[p] ? (_tLOG[p]["DATE"] " ") : "") ("TIME" in _tLOG[p] ? (_tLOG[p]["TIME"] " ") : "") if (_tLOG[p]["TYPE"]) { - n = n _tLOG[p]["TYPE"] ": " (("FILE" in _tLOG[p] ? _tLOG[p]["FILE"] (("LINE" in _tLOG[p] ? "(" _tLOG[p]["LINE"] ")" : "")) ": " : "")) + n = n _tLOG[p]["TYPE"] ": " ("FILE" in _tLOG[p] ? (_tLOG[p]["FILE"] ("LINE" in _tLOG[p] ? ("(" _tLOG[p]["LINE"] ")") : "") ": ") : "") if (match(_tLOG[p]["TEXT"], /\x1F/)) { t = n gsub(/[^\t]/, " ", t) @@ -3062,7 +3062,7 @@ function _getfilepath(t, f, al, b, A) al = RLENGTH f = A[3] A[5] A[7] _conl("_getfilepath(" f ") (" al ")") - if (b = _filepath(f)) { + if ((b = _filepath(f))) { if (length(f) <= FLENGTH) { FLENGTH = al return b @@ -3093,10 +3093,10 @@ function _getime() function _getmpdir(f, dd) { ########################################## - if (! dd || ! (dd = _filerd(dd))) { + if ((! dd) || (! (dd = _filerd(dd)))) { dd = _FILEIO_TMPRD } - if (f = (f ? _filerd(f, dd) : _filerd("_" ++_FILEIO_TMPCNTR "\\", dd))) { + if ((f = f ? _filerd(f, dd) : _filerd("_" ++_FILEIO_TMPCNTR "\\", dd))) { _FILEIO_RDTMP[toupper(f)] } return f @@ -3106,10 +3106,10 @@ function _getmpdir(f, dd) function _getmpfile(f, dd) { ######################################### - if (! dd || ! (dd = _filerd(dd))) { + if ((! dd) || (! (dd = _filerd(dd)))) { dd = _FILEIO_TMPRD } - if (f = _filerdne((_filene(f) ? f : f "_" ++_FILEIO_TMPCNTR), dd)) { + if ((f = _filerdne(_filene(f) ? f : (f "_" ++_FILEIO_TMPCNTR), dd))) { _FILEIO_RDNETMP[toupper(f)] } return f @@ -3119,7 +3119,7 @@ function _getmpfile(f, dd) function _getperf(o, t, a) { ############################################### - (o == "" ? ++_getperf_opcurr : _getperf_opcurr = o) + o == "" ? ++_getperf_opcurr : _getperf_opcurr = o if ((a = _getsecond()) != _getperf_last) { _getperf_opsec = (_getperf_opcurr - _getperf_opstart) / ((_getperf_last = a) - _getperf_start) return @_getperf_fn(o, t, a) @@ -3134,7 +3134,7 @@ function _getperf_(o, t, a) return 0 } if (_getperf_opsecp != _getperf_opsec) { - _constat(((_constatstr == _getperf_stat ? _getperf_statstr : _getperf_statstr = _constatstr)) t " [TIME=" (a - _getperf_start) " sec(" (_getperf_opsecp = _getperf_opsec) " ops/sec)]") + _constat((_constatstr == _getperf_stat ? _getperf_statstr : (_getperf_statstr = _constatstr)) t " [TIME=" (a - _getperf_start) " sec(" (_getperf_opsecp = _getperf_opsec) " ops/sec)]") _getperf_stat = _constatstr } return 1 @@ -3144,7 +3144,7 @@ function _getperf_(o, t, a) function _getperf_noe(o, t, a) { if (_getperf_opsecp != _getperf_opsec) { - _constat(((_constatstr == _getperf_stat ? _getperf_statstr : _getperf_statstr = _constatstr)) t " [TIME=" (a - _getperf_start) " sec(" (_getperf_opsecp = _getperf_opsec) " ops/sec)]") + _constat((_constatstr == _getperf_stat ? _getperf_statstr : (_getperf_statstr = _constatstr)) t " [TIME=" (a - _getperf_start) " sec(" (_getperf_opsecp = _getperf_opsec) " ops/sec)]") _getperf_stat = _constatstr } return 1 @@ -3229,7 +3229,7 @@ function _getuid_i0(p, UL, UH) if ("" == (_tptr = UL[_UIDCNTL[p]])) { for (_tptr in UH) { delete UH[_tptr] - return ((_UIDCNTH[p] = _tptr) (_UIDCNTL[p] = UL[""])) + return (_UIDCNTH[p] = _tptr) (_UIDCNTL[p] = UL[""]) } _fatal("out of UID") } @@ -3248,7 +3248,7 @@ function _hexnum(n, l) if (l + 0 < 1) { l = 2 } - return sprintf("%." ((l + 0 < 1 ? 2 : l)) "X", n) + return sprintf("%." (l + 0 < 1 ? 2 : l) "X", n) } #_________________________________________________________________ @@ -3266,7 +3266,7 @@ function _igetperf(t, s, o) _getperf_opstart = _getperf_opcurr = o + 0 _getperf_opsec = _getperf_opsecp = _getperf_stat = _getperf_statstr = "" _getperf_end = t + (_getperf_start = _getperf_last = _getsecondsync()) - _getperf_fn = ((t + 0 > 0 ? "_getperf_" : "_getperf_noe")) ((s ? "" : "not")) + _getperf_fn = (t + 0 > 0 ? "_getperf_" : "_getperf_noe") (s ? "" : "not") return _getperf_start } @@ -3497,14 +3497,14 @@ function _istr(p) it = "-" return 0 } - return (it = (p == "" ? "s" : "S")) + return (it = p == "" ? "s" : "S") } #_________________________________________________________________ function _lengthsort(i1, v1, i2, v2) { ############################## - return ((length(i1) < length(i2) ? -1 : (length(i1) > length(i2) ? 1 : (i1 < i2 ? -1 : 1)))) + return (length(i1) < length(i2) ? -1 : length(i1) > length(i2) ? 1 : i1 < i2 ? -1 : 1) } #_________________________________________________________________ @@ -3547,7 +3547,7 @@ function _lib_NAMEVER() function _ln(t) { ############################################################### - return ((t ~ /\x0A$/ ? t : t _CHR["EOL"])) + return (t ~ /\x0A$/ ? t : (t _CHR["EOL"])) } #_________________________________________________________________ @@ -3683,7 +3683,7 @@ function _mpusub(F, D, C, d, p1, p2, p3, q) if (isarray(F[_mpucc0])) { _mpufn0 = F[_mpucc0] } - _conl("FN: `" _mpucc0 "' > CALL: `" _mpufn0 "' : _mpuacc=" _mpuacc "'") + _conl("FN: `" _mpucc0 "' > CALL: `" (_mpufn0) "' : _mpuacc=" _mpuacc "'") } else { _mpufn0 = "_mpudefaulthnd" } @@ -3692,7 +3692,7 @@ function _mpusub(F, D, C, d, p1, p2, p3, q) _conl("WARNING: unclosed expression: `" d _mpuacc "'") _mpuacc = d _mpuacc } - _retarrm(D, q, "", (_mpufn0 == -1 ? _th0(d, _mpusubwrng("WARNING: unclosed expression", d _mpuacc)) : "")) + _retarrm(D, q, "", _mpufn0 == -1 ? _th0(d, _mpusubwrng("WARNING: unclosed expression", d _mpuacc)) : "") # collect: _mpuacc=_retarr(D) _mpuacc _conl("mpusub exit: _mpuacc: `" _mpuacc "'") } @@ -3806,7 +3806,7 @@ function _nop(p0, p1, p2, p3) function _nretarr(A, i, v, r, q) { ##################################### - if ((i = (i == "" ? 1 : i + 0)) <= (q = A[_ARRLEN])) { + if ((i = i == "" ? 1 : i + 0) <= (q = A[_ARRLEN])) { if (i <= (r = q - 16)) { _ARRSTR = A[i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] while (i < r) { @@ -3826,7 +3826,7 @@ function _nretarr(A, i, v, r, q) function _nretarrd(A, i, v, r, q) { ############################## - if ((i = (i == "" ? 1 : i + 0)) <= (q = A[_ARRLEN])) { + if ((i = i == "" ? 1 : i + 0) <= (q = A[_ARRLEN])) { if (i <= (r = q - 16)) { _ARRSTR = A[i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] while (i < r) { @@ -3866,7 +3866,7 @@ function _out(t, a, b) function _outnl(t) { ################################################ - return _out(t ((t ~ /\x0A$/ ? "" : _CHR["EOL"]))) + return _out(t (t ~ /\x0A$/ ? "" : _CHR["EOL"])) } function _p1(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8) @@ -3926,7 +3926,7 @@ function _pass(A, f, t, p2, i, a) i = 1 while (t && i) { i = "" - while ((i = A[i]) && t == (t = @i(f, t, p2))) { + while ((i = A[i]) && (t == (t = @i(f, t, p2)))) { } } if (i && _endpass_v0) { @@ -4087,11 +4087,11 @@ function _printarr(A, t, lv, r, a) #################################### a = PROCINFO["sorted_in"] PROCINFO["sorted_in"] = "_lengthsort" - _printarrexp = (r ? r : "") + _printarrexp = r ? r : "" if (isarray(A)) { delete _DUMPARR _dumparrc = _dumparrd = "" - _printarr_i1(A, lv = ((lv == "" ? 16 : (lv == 0 || lv + 0 != 0 ? lv : (lv == "-*" ? -3 : (lv ~ /^\+?\*$/ ? 3 : 16))))) + 0, (lv < 0 ? -1 : 1), 0, _tabtospc(t)) + _printarr_i1(A, lv = (lv == "" ? 16 : lv == 0 || (lv + 0) != 0 ? lv : lv == "-*" ? -3 : lv ~ /^\+?\*$/ ? 3 : 16) + 0, lv < 0 ? -1 : 1, 0, _tabtospc(t)) PROCINFO["sorted_in"] = a return _retarrd(_DUMPARR, _dumparrd, _dumparrd = "") } @@ -4108,10 +4108,10 @@ function _printarr_i1(A, lv, ls, ln, t, t2, i, a, f) } } else { for (i in A) { - (isarray(A[i]) ? ++a : "") + isarray(A[i]) ? ++a : "" } } - if (length(_dumparrd = _dumparrd t ((a > 0 ? " ... (x" a ")" : "")) _CHR["EOL"]) > 262144) { + if (length(_dumparrd = _dumparrd t (a > 0 ? " ... (x" a ")" : "") _CHR["EOL"]) > 262144) { _conl(_dumparrd) _dumparrd = "" } @@ -4121,7 +4121,7 @@ function _printarr_i1(A, lv, ls, ln, t, t2, i, a, f) for (i in A) { if (! _printarrexp || i ~ _printarrexp) { if (! isarray(A[i])) { - if (length(_dumparrd = _dumparrd ((f ? t2 : t _nop(f = 1))) "[" i "]=" A[i] "'" _CHR["EOL"]) > 262144) { + if (length(_dumparrd = _dumparrd (f ? t2 : t _nop(f = 1)) "[" i "]=" A[i] "'" _CHR["EOL"]) > 262144) { _conl(_dumparrd) _dumparrd = "" } @@ -4132,7 +4132,7 @@ function _printarr_i1(A, lv, ls, ln, t, t2, i, a, f) for (i in A) { if (isarray(A[i])) { if (! _printarrexp || i ~ _printarrexp) { - _printarr_i1(A[i], lv, ls, ln + ls, _th0((f ? t2 : t), f = 1) "[" i "]") + _printarr_i1(A[i], lv, ls, ln + ls, _th0(f ? t2 : t, f = 1) "[" i "]") } } } @@ -4248,7 +4248,7 @@ function _rFBRO(p) function _rFCHLD(p) { ##################################################### - if (p && p in _tFCHLD) { + if ((p) && (p in _tFCHLD)) { return _tFCHLD[p] } return "" @@ -4274,7 +4274,7 @@ function _rLBRO(p) function _rLCHLD(p) { #_______________________________________________________________________ - if (p && p in _tLCHLD) { ##################################################### + if ((p) && (p in _tLCHLD)) { ##################################################### return _tLCHLD[p] } return "" @@ -4284,14 +4284,14 @@ function _rLCHLD(p) function _rLINK(p) { ###################################################### - return ((p in _tLINK ? _tLINK[p] : "")) + return (p in _tLINK ? _tLINK[p] : "") } ######################## p="" function _rNEXT(p) { #_______________________________________________________________________ - if (p && p in _tNEXT) { ###################################################### + if ((p) && (p in _tNEXT)) { ###################################################### return _tNEXT[p] } return "" @@ -4301,7 +4301,7 @@ function _rNEXT(p) function _rPARENT(p) { #_______________________________________________________________________ - if (p && p in _tPARENT) { #################################################### + if ((p) && (p in _tPARENT)) { #################################################### return _tPARENT[p] } return "" @@ -4311,7 +4311,7 @@ function _rPARENT(p) function _rPREV(p) { #_______________________________________________________________________ - if (p && p in _tPREV) { ###################################################### + if ((p) && (p in _tPREV)) { ###################################################### return _tPREV[p] } return "" @@ -4344,7 +4344,7 @@ function _rQBRO(p, c, p1) function _rQCHLD(p) { #_______________________________________________________________________ - if (p && p in _tQCHLD) { ##################################################### + if ((p) && (p in _tQCHLD)) { ##################################################### return _tQCHLD[p] } return "" @@ -4403,7 +4403,7 @@ function _rSQNEXTA(g, p, A) return p } } - return ((p in _tPARENT ? _rSQNEXTA(g, _tPARENT[p], A) : "")) + return (p in _tPARENT ? _rSQNEXTA(g, _tPARENT[p], A) : "") } function _rconl(t) @@ -4430,14 +4430,14 @@ function _rd_shortcut(D, f) } } } - return ((ERRNO ? ERRNO = "read shortcut: " ERRNO : _NOP)) + return (ERRNO ? ERRNO = "read shortcut: " ERRNO : _NOP) } #_______________________________________________________________________ function _rdfile(f, i, A) { ################################################ - if ((f = _filerdne(f)) == "" || _filene(f) == "") { + if (((f = _filerdne(f)) == "") || (_filene(f) == "")) { ERRNO = "Filename error" return } @@ -4576,7 +4576,7 @@ function _regpath0(D, i, s, q, S) if ("ext" in S) { D["ext"] = S["ext"] } - s = ((toupper(s = (i in S ? S[i] : "")) in _REGPATH0REGDIR ? D[++q] = _REGPATH0REGDIR[toupper(s)] : (D[++q] = _REGPATH0REGDIR[""]) "\\" (D[++q] = s))) "\\" + s = (toupper(s = i in S ? S[i] : "") in _REGPATH0REGDIR ? D[++q] = _REGPATH0REGDIR[toupper(s)] : (D[++q] = _REGPATH0REGDIR[""]) "\\" (D[++q] = s)) "\\" while (++i in S) { s = s (D[++q] = S[i]) "\\" } @@ -4584,7 +4584,7 @@ function _regpath0(D, i, s, q, S) D[0] = s } IGNORECASE = 1 - D["hostdir"] = "\\\\" (D["host"] = ("host" in S && ("" == (i = S["host"]) || "." == i || "?" == i || "localhost" == i) ? ENVIRON["COMPUTERNAME"] : i)) "\\" s + D["hostdir"] = "\\\\" (D["host"] = "host" in S && (("" == (i = S["host"])) || "." == i || "?" == i || "localhost" == i) ? ENVIRON["COMPUTERNAME"] : i) "\\" s IGNORECASE = 0 } } @@ -4620,7 +4620,7 @@ function _reporterr(p, t3, pp, t, t2) t = "" pp = p do { - ("NAME" in _[pp] ? t = _[pp]["NAME"] ": " t : "") + "NAME" in _[pp] ? t = _[pp]["NAME"] ": " t : "" } while (pp = _rPARENT(pp)) if (match(t3, /\x00/)) { return (substr(t3, 1, RSTART - 1) t substr(t3, RSTART + 1)) @@ -4692,7 +4692,7 @@ function _retarr(A, i, p, a, q) { ################################################## if (isarray(A)) { - i = (i == "" ? 0 : i + 0) + i = i == "" ? 0 : i + 0 q = A[_ARRLEN] + 0 if (i < q) { return (p A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] _retarr_i0(A, q, i, a)) @@ -4716,7 +4716,7 @@ function _retarrd(A, v, i) { ######################################### if (1 in A) { - return (A[1] A[2] A[3] A[4] A[5] A[6] A[7] A[8] A[9] A[10] A[11] A[12] A[13] A[14] A[15] A[16] (((i = 17) in A ? _retarrd_i0(A, i) v : v))) + return (A[1] A[2] A[3] A[4] A[5] A[6] A[7] A[8] A[9] A[10] A[11] A[12] A[13] A[14] A[15] A[16] ((i = 17) in A ? _retarrd_i0(A, i) v : v)) } delete A return v @@ -4726,7 +4726,7 @@ function _retarrd(A, v, i) function _retarrd_i0(A, i) { if (i in A) { - return (A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] ((i in A ? _retarrd_i0(A, i) : ""))) + return (A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] A[i++] (i in A ? _retarrd_i0(A, i) : "")) } delete A } @@ -4834,7 +4834,7 @@ function _rrdreg(DD, p, k, t, v, c, i, q, tT, A, B, C, D) t = "BIN" } } - DD[gensub(/(\\)\\+/, "\\1", "G", p "\\" _unstr(D[3] ((D[5] ? "(Default)" : ""))) "." t)] = v + DD[gensub(/(\\)\\+/, "\\1", "G", p "\\" _unstr(D[3] (D[5] ? "(Default)" : "")) "." t)] = v } else { _fatal("regedit: unknown output format(" c "): `" C[c] "'") } @@ -4886,11 +4886,11 @@ function _rtn(v, A) function _rtn2(v, A, r, t) { - r = (isarray(A) ? _typa(v, A) : _typ(v)) + r = isarray(A) ? _typa(v, A) : _typ(v) if ("`" > _t0 && _t0) { _conl("ggggg") } - t = ((r ? "TRUE" : "FALSE")) " / " ((r > 0 ? r ">0" : r "!>0")) " / " ((r + 0 > 0 ? r "+0>0" : r "+0!>0")) " / " ((r + 0 != r ? r "+0!=" r : r "+0==" r)) " / " ((r && "`" > r ? "'`'>" r " && " r : "!('`'>" r " && " r ")")) + t = (r ? "TRUE" : "FALSE") " / " (r > 0 ? r ">0" : r "!>0") " / " (r + 0 > 0 ? r "+0>0" : r "+0!>0") " / " (r + 0 != r ? r "+0!=" r : r "+0==" r) " / " (r && "`" > r ? "'`'>" r " && " r : "!('`'>" r " && " r ")") _conl("`" r "' : " t) return r } @@ -5001,7 +5001,7 @@ function _setmpath(p, a) { ################################################ ERRNO = "" - if (p && (a = _filerd(p))) { + if ((p) && (a = _filerd(p))) { if (_FILEIO_TMPRD) { _FILEIO_TMPATHS[_FILEIO_TMPRD] } @@ -5009,7 +5009,7 @@ function _setmpath(p, a) #_cmd("rd " a " /S /Q 2>NUL"); _cmd("del " a " /Q 2>NUL") return (_FILEIO_TMPRD = a) } else { - return _warning("`" p "': cannot set temporary folder" ((ERRNO ? ": " ERRNO : ""))) + return _warning("`" p "': cannot set temporary folder" (ERRNO ? (": " ERRNO) : "")) } } @@ -5019,14 +5019,14 @@ function _sharelist(D, h, q, c, l, A, B) { ################################################# delete D - c = _sharextool " \\\\" ((h == "" ? h = ENVIRON["COMPUTERNAME"] : h)) " 2>&1" + c = _sharextool " \\\\" (h == "" ? h = ENVIRON["COMPUTERNAME"] : h) " 2>&1" if (match(c = _cmd(c), /\x0AShare[^\x0A]*Remark/)) { gsub(/(^[^-]*\x0D?\x0A-+\x0D?\x0A[ \t]*)|(\x0D?\x0AThe command completed successfully.*$)/, "", c) l = RLENGTH - 7 split(c, A, /([ \t]*\x0D?\x0A)+[ \t]*/) for (c in A) { if (match(A[c], /((([^ \t:]+[ \t]+)*[^ \t:]+)[ \t]+)([A-Za-z])[ \t]*:/, B) && ++q) { - D[B[2]] = (A[c] ~ /\.\.\.$/ ? _sharepath(h, B[2]) : gensub(/[ \t\\\/]*$/, "\\\\", 1, substr(A[c], 1 + B[1, "length"], l - B[1, "length"]))) + D[B[2]] = A[c] ~ /\.\.\.$/ ? _sharepath(h, B[2]) : gensub(/[ \t\\\/]*$/, "\\\\", 1, substr(A[c], 1 + B[1, "length"], l - B[1, "length"])) } } return q @@ -5038,7 +5038,7 @@ function _sharelist(D, h, q, c, l, A, B) function _sharepath(h, s, A) { ################################################### - s = _sharextool " \\\\" ((h == "" ? h = ENVIRON["COMPUTERNAME"] : h)) "\\\"" s "\" 2>&1" + s = _sharextool " \\\\" (h == "" ? h = ENVIRON["COMPUTERNAME"] : h) "\\\"" s "\" 2>&1" if (match(s = _cmd(s), /\x0APath[ \t]+([^\x0D\x0A]+)/, _SHAREPATHA0)) { return gensub(/[ \t\\\/]*$/, "\\\\", 1, _SHAREPATHA0[1]) } @@ -5120,7 +5120,7 @@ function _shortcut_init(A, B, q) function _shortcut_nerr(t, s, A) { if (match(t, /\x0ASystem error (-?[0-9]+)[^\x0D\x0A]*[\x0D\x0A]+([^\x0D\x0A]+)/, A)) { - ERRNO = ((A[1] in _SHORTCUTERR ? _SHORTCUTERR[A[1]] : (A[2] in _SHORTCUTERR ? _SHORTCUTERR[A[2]] : tolower(gensub(/^(The )?(((.*)\.$)|(.*[^\.]$))/, "\\4\\5", "G", A[2])) "(" A[1] ")"))) ((s ? ": `" s "'" : "")) + ERRNO = (A[1] in _SHORTCUTERR ? _SHORTCUTERR[A[1]] : A[2] in _SHORTCUTERR ? _SHORTCUTERR[A[2]] : tolower(gensub(/^(The )?(((.*)\.$)|(.*[^\.]$))/, "\\4\\5", "G", A[2])) "(" A[1] ")") (s ? ": `" s "'" : "") } else { return 1 } @@ -5333,7 +5333,7 @@ function _subseqon(B, r, F, f, s, e, q, i, A) s = substr(e = B[i], 2, 1) #_conl("curr r==`" r "': A[" i "]=`" A[i] "'") #s=s in F ? _th0(F[s],_conl("handler `" F[s] "' for `" s "' ost=`" substr(e,3,length(e)-3) "'")) : _th0(F[""],_conl("default handler for `" s "'")) - s = (s in F ? F[s] : F[""]) + s = s in F ? F[s] : F[""] #_conl("`" f "'") r = r (@f(A[i])) (@s(substr(e, 3, length(e) - 3))) } @@ -5511,7 +5511,7 @@ function _tbframe(f, p, p0, p1) { ################################################## delete _t_ENDF[++_t_ENDF[0]] - f = (p ? _tbframe_i0(f, p, p0, p1) : "") + f = p ? _tbframe_i0(f, p, p0, p1) : "" --_t_ENDF[0] return f } @@ -5522,7 +5522,7 @@ function _tbframe_i0(f, p, p0, p1, a) while (p in _tLINK) { p = _tLINK[p] } - return ((p in _tLCHLD ? _tmbframe(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1))) + return (p in _tLCHLD ? _tmbframe(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1)) } #_______________________________________________________________________ @@ -5530,7 +5530,7 @@ function _tbframex(f, p, p0, p1) { ########################################### delete _t_ENDF[++_t_ENDF[0]] - f = (p ? _tbframex_i0(f, p, p0, p1) : "") + f = p ? _tbframex_i0(f, p, p0, p1) : "" --_t_ENDF[0] return f } @@ -5541,7 +5541,7 @@ function _tbframex_i0(f, p, p0, p1) while (p in _tLINK) { p = _tLINK[p] } - return ((p in _tLCHLD ? _tmbframex(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1))) + return (p in _tLCHLD ? _tmbframex(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1)) } #_____________________________________________________________________________ @@ -5549,7 +5549,7 @@ function _tbpass(f, p, p0, p1) { ################################################### delete _t_ENDF[++_t_ENDF[0]] - f = (p ? _tbpass_i0(f, p, p0, p1) : "") + f = p ? _tbpass_i0(f, p, p0, p1) : "" --_t_ENDF[0] return f } @@ -5560,7 +5560,7 @@ function _tbpass_i0(f, p, p0, p1, a) while (p in _tLINK) { p = _tLINK[p] } - return ((p in _tLCHLD ? _tmbpass(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1))) + return (p in _tLCHLD ? _tmbpass(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1)) } #_____________________________________________________________________________ @@ -5568,7 +5568,7 @@ function _tbpassx(f, p, p0, p1) { ################################################## delete _t_ENDF[++_t_ENDF[0]] - f = (p ? _tbpassx_i0(f, p, p0, p1) : "") + f = p ? _tbpassx_i0(f, p, p0, p1) : "" --_t_ENDF[0] return f } @@ -5579,7 +5579,7 @@ function _tbpassx_i0(f, p, p0, p1) while (p in _tLINK) { p = _tLINK[p] } - return ((p in _tLCHLD ? _tmbpassx(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1))) + return (p in _tLCHLD ? _tmbpassx(f, _tLCHLD[p], p0, p1) : @f(p, p0, p1)) } #_____________________________________________________________________________ @@ -5670,28 +5670,28 @@ function _tbrochld(p, f, pp) function _tbrunframe(f, p, p0, p1) { ################################### - return _tbframe((f ? f : "_trunframe_i0"), p, p0, p1) + return _tbframe(f ? f : "_trunframe_i0", p, p0, p1) } #_________________________________________________________________ function _tbrunframex(f, p, p0, p1) { ################################## - return _tbframex((f ? f : "_trunframe_i0"), p, p0, p1) + return _tbframex(f ? f : "_trunframe_i0", p, p0, p1) } #_________________________________________________________________ function _tbrunpass(f, p, p0, p1) { #################################### - return _tbpass((f ? f : "_trunframe_i0"), p, p0, p1) + return _tbpass(f ? f : "_trunframe_i0", p, p0, p1) } #_________________________________________________________________ function _tbrunpassx(f, p, p0, p1) { ################################### - return _tbpassx((f ? f : "_trunframe_i0"), p, p0, p1) + return _tbpassx(f ? f : "_trunframe_i0", p, p0, p1) } #_____________________________________________________________________________ @@ -5703,14 +5703,14 @@ function _tdel(p, i) for (i in _ptr[p]) { if (isarray(_ptr[p][i])) { _tdel_i1(_ptr[p][i]) - } else if (i = _ptr[p][i]) { + } else if ((i = _ptr[p][i])) { _tdel(i) } } if (p in _tFCHLD) { i = _tFCHLD[p] do { - i = ((i in _tNEXT ? _tNEXT[i] : "")) _tdel_i0(i) + i = (i in _tNEXT ? _tNEXT[i] : "") _tdel_i0(i) } while (i) } delete _[p] @@ -5724,14 +5724,14 @@ function _tdel_i0(p, i) for (i in _ptr[p]) { if (isarray(_ptr[p][i])) { _tdel_i1(_ptr[p][i]) - } else if (i = _ptr[p][i]) { + } else if ((i = _ptr[p][i])) { _tdel(i) } } if (p in _tFCHLD) { i = _tFCHLD[p] do { - i = ((i in _tNEXT ? _tNEXT[i] : "")) _tdel_i0(i) + i = (i in _tNEXT ? _tNEXT[i] : "") _tdel_i0(i) } while (i) } delete _[p] @@ -5744,7 +5744,7 @@ function _tdel_i1(A, i) for (i in A) { if (isarray(A[i])) { _tdel_i1(A[i]) - } else if (i = A[i]) { + } else if ((i = A[i])) { _tdel(i) } } @@ -5832,7 +5832,7 @@ function _tframe(fF, p, p0, p1, p2) { ############################################### delete _t_ENDF[++_t_ENDF[0]] - p = (_isptr(p) ? (isarray(fF) ? _tframe_i1(fF, p, p0, p1, p2) : _tframe_i0(fF, p, p0, p1, p2)) : "") + p = _isptr(p) ? isarray(fF) ? _tframe_i1(fF, p, p0, p1, p2) : _tframe_i0(fF, p, p0, p1, p2) : "" --_t_ENDF[0] return p } @@ -5894,7 +5894,7 @@ function _tframe0_i2(A, m, p) p = _tDLINK[p] } if (m in A) { - if (m "~" in A) { + if ((m "~") in A) { if (! (_TYPEWORD in _[p]) || A[m "~"] !~ _[p][_TYPEWORD]) { return } @@ -5950,7 +5950,7 @@ function _tframe1_i2(A, m, p, p0) p = _tDLINK[p] } if (m in A) { - if (m "~" in A) { + if ((m "~") in A) { if (! (_TYPEWORD in _[p]) || A[m "~"] !~ _[p][_TYPEWORD]) { return } @@ -6006,7 +6006,7 @@ function _tframe2_i2(A, m, p, p0, p1) p = _tDLINK[p] } if (m in A) { - if (m "~" in A) { + if ((m "~") in A) { if (! (_TYPEWORD in _[p]) || A[m "~"] !~ _[p][_TYPEWORD]) { return } @@ -6062,7 +6062,7 @@ function _tframe3_i2(A, m, p, p0, p1, p2) p = _tDLINK[p] } if (m in A) { - if (m "~" in A) { + if ((m "~") in A) { if (! (_TYPEWORD in _[p]) || A[m "~"] !~ _[p][_TYPEWORD]) { return } @@ -6118,7 +6118,7 @@ function _tframe4_i2(A, m, p, p0, p1, p2, p3) p = _tDLINK[p] } if (m in A) { - if (m "~" in A) { + if ((m "~") in A) { if (! (_TYPEWORD in _[p]) || A[m "~"] !~ _[p][_TYPEWORD]) { return } @@ -6134,7 +6134,7 @@ function _tframe_i0(f, p, p0, p1, p2, a) while (p in _tLINK) { p = _tLINK[p] } - return ((p in _tFCHLD ? _tmframe_i0(f, _tFCHLD[p], p0, p1, p2) : (p in _tDLINK ? @f(_tDLINK[p], p0, p1, p2) : @f(p, p0, p1, p2)))) + return (p in _tFCHLD ? _tmframe_i0(f, _tFCHLD[p], p0, p1, p2) : (p in _tDLINK ? @f(_tDLINK[p], p0, p1, p2) : @f(p, p0, p1, p2))) } #___________________________________________________________ @@ -6143,7 +6143,7 @@ function _tframe_i1(F, p, p0, p1, p2, a) while (p in _tLINK) { p = _tLINK[p] } - return ((p in _tFCHLD ? (("." in F ? _th1(a = F["."], @a(p, p0, p1, p2)) : "")) _tmframe_i1(F, _tFCHLD[p], p0, p1, p2) : (">" in F ? _th1(a = F[">"], (p in _tDLINK ? @a(_tDLINK[p], p0, p1, p2) : @a(p, p0, p1, p2))) : ""))) + return (p in _tFCHLD ? ("." in F ? _th1(a = F["."], @a(p, p0, p1, p2)) : "") _tmframe_i1(F, _tFCHLD[p], p0, p1, p2) : (">" in F ? _th1(a = F[">"], p in _tDLINK ? @a(_tDLINK[p], p0, p1, p2) : @a(p, p0, p1, p2)) : "")) } #_______________________________________________________________________ @@ -6151,7 +6151,7 @@ function _tframex(f, p, p0, p1) { ############################################ delete _t_ENDF[++_t_ENDF[0]] - f = (p ? _tframex_i0(f, p, p0, p1) : "") + f = p ? _tframex_i0(f, p, p0, p1) : "" --_t_ENDF[0] return f } @@ -6162,7 +6162,7 @@ function _tframex_i0(f, p, p0, p1) while (p in _tLINK) { p = _tLINK[p] } - return ((p in _tFCHLD ? _tmframex(f, _tFCHLD[p], p0, p1) : @f(p, p0, p1))) + return (p in _tFCHLD ? _tmframex(f, _tFCHLD[p], p0, p1) : @f(p, p0, p1)) } #_____________________________________________________ @@ -6261,7 +6261,7 @@ function _tgetitem(p, n, a, b) { ############################################ if (p) { - if (isarray(_PTR[p]["ITEM"]) && n in _PTR[p]["ITEM"]) { + if (isarray(_PTR[p]["ITEM"]) && (n in _PTR[p]["ITEM"])) { a = _PTR[p]["ITEM"][n] } else { a = _PTR[p]["ITEM"][n] = _N() @@ -6322,7 +6322,7 @@ function _th3(p0, p1, p2, r) function _tifend(l) { ############################################### - return ((_t_ENDF[0] + l in _t_ENDF ? (_t_ENDF[_t_ENDF[0] + l] ? _t_ENDF[_t_ENDF[0] + l] : 1) : "")) + return (_t_ENDF[0] + l) in _t_ENDF ? (_t_ENDF[_t_ENDF[0] + l] ? _t_ENDF[_t_ENDF[0] + l] : 1) : "" } # test _tbrochld fn; develope tOBJ r\w func specification for brochld func @@ -6423,7 +6423,7 @@ function _tlist(L, p, f) if (f == 0 && f == "") { _tlist_i0(L, p) } else { - _tlistf0 = (f in _TAPI ? _TAPI[f] : f) + _tlistf0 = f in _TAPI ? _TAPI[f] : f _tlist_i1(L, p) } return (_tlisti0 - _tlisti1) @@ -6445,7 +6445,7 @@ function _tlist_i0(L, p, q, i) } L[++_tlisti0] = p if (p in _tFCHLD) { - for (p = _tFCHLD[p]; p; p = (p in _tNEXT ? _tNEXT[p] : "")) { + for (p = _tFCHLD[p]; p; p = p in _tNEXT ? _tNEXT[p] : "") { _tlist_i0(L, p) } } @@ -6470,7 +6470,7 @@ function _tlist_i1(L, p) L[++_tlisti0] = p } if (p in _tFCHLD) { - for (p = _tFCHLD[p]; p; p = (p in _tNEXT ? _tNEXT[p] : "")) { + for (p = _tFCHLD[p]; p; p = p in _tNEXT ? _tNEXT[p] : "") { _tlist_i1(L, p) } } @@ -6481,8 +6481,8 @@ function _tlist_i1(L, p) function _tmbframe(f, p, p0, p1, t) { ################################## - while (p && ! (_t_ENDF[0] in _t_ENDF)) { - t = t _tbframe_i0(f, p, p0, p1, p = (p in _tPREV ? _tPREV[p] : "")) + while ((p) && (! (_t_ENDF[0] in _t_ENDF))) { + t = t _tbframe_i0(f, p, p0, p1, p = p in _tPREV ? _tPREV[p] : "") } return t } @@ -6491,9 +6491,9 @@ function _tmbframe(f, p, p0, p1, t) function _tmbframex(f, p, p0, p1, t) { ################################# - while (p && ! (_t_ENDF[0] in _t_ENDF)) { + while ((p) && (! (_t_ENDF[0] in _t_ENDF))) { t = t _tbframex_i0(f, p, p0, p1) - p = (p in _tPREV ? _tPREV[p] : "") + p = p in _tPREV ? _tPREV[p] : "" } return t } @@ -6502,8 +6502,8 @@ function _tmbframex(f, p, p0, p1, t) function _tmbpass(f, p, p0, p1) { ###################################### - while (p && ! (_t_ENDF[0] in _t_ENDF)) { - p0 = _tbpass_i0(f, p, p0, p1, p = (p in _tPREV ? _tPREV[p] : "")) + while ((p) && (! (_t_ENDF[0] in _t_ENDF))) { + p0 = _tbpass_i0(f, p, p0, p1, p = p in _tPREV ? _tPREV[p] : "") } return p0 } @@ -6512,9 +6512,9 @@ function _tmbpass(f, p, p0, p1) function _tmbpassx(f, p, p0, p1) { ##################################### - while (p && ! (_t_ENDF[0] in _t_ENDF)) { + while ((p) && (! (_t_ENDF[0] in _t_ENDF))) { p0 = _tbpassx_i0(f, p, p0, p1) - p = (p in _tPREV ? _tPREV[p] : "") + p = p in _tPREV ? _tPREV[p] : "" } return p0 } @@ -6524,7 +6524,7 @@ function _tmframe(f, p, p0, p1, p2) { ################################### delete _t_ENDF[++_t_ENDF[0]] - f = (p ? _tmframe_i0(f, p, p0, p1, p2) : "") + f = p ? _tmframe_i0(f, p, p0, p1, p2) : "" --_t_ENDF[0] return f } @@ -6532,8 +6532,8 @@ function _tmframe(f, p, p0, p1, p2) #___________________________________________________________ function _tmframe_i0(f, p, p0, p1, p2, t) { - while (p && ! (_t_ENDF[0] in _t_ENDF)) { - t = t _tframe_i0(f, p, p0, p1, p2, p = (p in _tNEXT ? _tNEXT[p] : "")) + while ((p) && (! (_t_ENDF[0] in _t_ENDF))) { + t = t _tframe_i0(f, p, p0, p1, p2, p = p in _tNEXT ? _tNEXT[p] : "") } return t } @@ -6541,8 +6541,8 @@ function _tmframe_i0(f, p, p0, p1, p2, t) #___________________________________________________________ function _tmframe_i1(F, p, p0, p1, p2, t) { - while (p && ! (_t_ENDF[0] in _t_ENDF)) { - t = t _tframe_i1(F, p, p0, p1, p2, p = (p in _tNEXT ? _tNEXT[p] : "")) + while ((p) && (! (_t_ENDF[0] in _t_ENDF))) { + t = t _tframe_i1(F, p, p0, p1, p2, p = p in _tNEXT ? _tNEXT[p] : "") } return t } @@ -6551,9 +6551,9 @@ function _tmframe_i1(F, p, p0, p1, p2, t) function _tmframex(f, p, p0, p1, t) { ################################## - while (p && ! (_t_ENDF[0] in _t_ENDF)) { + while ((p) && (! (_t_ENDF[0] in _t_ENDF))) { t = t _tframex_i0(f, p, p0, p1) - p = (p in _tNEXT ? _tNEXT[p] : "") + p = p in _tNEXT ? _tNEXT[p] : "" } return t } @@ -6562,8 +6562,8 @@ function _tmframex(f, p, p0, p1, t) function _tmpass(f, p, p0, p1) { ####################################### - while (p && ! (_t_ENDF[0] in _t_ENDF)) { - p0 = _tbpass_i0(f, p, p0, p1, p = (p in _tNEXT ? _tNEXT[p] : "")) + while ((p) && (! (_t_ENDF[0] in _t_ENDF))) { + p0 = _tbpass_i0(f, p, p0, p1, p = p in _tNEXT ? _tNEXT[p] : "") } return p0 } @@ -6572,9 +6572,9 @@ function _tmpass(f, p, p0, p1) function _tmpassx(f, p, p0, p1) { ###################################### - while (p && ! (_t_ENDF[0] in _t_ENDF)) { + while ((p) && (! (_t_ENDF[0] in _t_ENDF))) { p0 = _tbpassx_i0(f, p, p0, p1) - p = (p in _tNEXT ? _tNEXT[p] : "") + p = p in _tNEXT ? _tNEXT[p] : "" } return p0 } @@ -6617,7 +6617,7 @@ function _tpass(f, p, p0, p1) { #################################################### delete _t_ENDF[++_t_ENDF[0]] - f = (p ? _tpass_i0(f, p, p0, p1) : "") + f = p ? _tpass_i0(f, p, p0, p1) : "" --_t_ENDF[0] return f } @@ -6628,7 +6628,7 @@ function _tpass_i0(f, p, p0, p1, a) while (p in _tLINK) { p = _tLINK[p] } - return ((p in _tFCHLD ? _tmpass(f, _tFCHLD[p], p0, p1) : @f(p, p0, p1))) + return (p in _tFCHLD ? _tmpass(f, _tFCHLD[p], p0, p1) : @f(p, p0, p1)) } #_____________________________________________________________________________ @@ -6636,7 +6636,7 @@ function _tpassx(f, p, p0, p1) { ################################################### delete _t_ENDF[++_t_ENDF[0]] - f = (p ? _tpassx_i0(f, p, p0, p1) : "") + f = p ? _tpassx_i0(f, p, p0, p1) : "" --_t_ENDF[0] return f } @@ -6647,7 +6647,7 @@ function _tpassx_i0(f, p, p0, p1) while (p in _tLINK) { p = _tLINK[p] } - return ((p in _tFCHLD ? _tmpassx(f, _tFCHLD[p], p0, p1) : @f(p, p0, p1))) + return (p in _tFCHLD ? _tmpassx(f, _tFCHLD[p], p0, p1) : @f(p, p0, p1)) } #_________________________________________________________________ @@ -6696,7 +6696,7 @@ function _tr(n, cs, H) _rconl("delptr: " _une(H[2]) "'") _rconl("pfxstr: " _une(H[5]) "'") _rconl("hichr: " _une(H[7]) "'") - _rconl("lochr: " _une((H[10] ? H[7] "' and " H[11] "'" : H[11] "'"))) + _rconl("lochr: " _une(H[10] ? H[7] "' and " H[11] "'" : H[11] "'")) _rconl("sfxstr: " _une(H[14]) "'") } else { _rconl("NOT MATCH!") @@ -6719,7 +6719,7 @@ function _trace(t, d, A) function _trunframe(f, p, p0, p1, p2) { ################################# - return _tframe((f ? f : "_trunframe_i0"), p, p0, p1, p2) + return _tframe(f ? f : "_trunframe_i0", p, p0, p1, p2) } #_________________________________________________________________ @@ -6735,21 +6735,21 @@ function _trunframe_i0(p, p0, p1, p2, f) function _trunframex(f, p, p0, p1) { ################################### - return _tframex((f ? f : "_trunframe_i0"), p, p0, p1) + return _tframex(f ? f : "_trunframe_i0", p, p0, p1) } #_________________________________________________________________ function _trunpass(f, p, p0, p1) { ##################################### - return _tpass((f ? f : "_trunframe_i0"), p, p0, p1) + return _tpass(f ? f : "_trunframe_i0", p, p0, p1) } #_________________________________________________________________ function _trunpassx(f, p, p0, p1) { #################################### - return _tpassx((f ? f : "_trunframe_i0"), p, p0, p1) + return _tpassx(f ? f : "_trunframe_i0", p, p0, p1) } #_________________________________________________________________ @@ -6898,12 +6898,12 @@ function _tstv(p, A, r, f) function _typ(p) { - return (_t0 = (isarray(p) ? "#" : (p == 0 ? (p == "" ? 0 : (p in _CLASSPTR ? "`" : (p ? 3 : 4))) : (p in _CLASSPTR ? "`" : (p + 0 == p ? 5 : (p ? 3 : 2)))))) + return (_t0 = isarray(p) ? "#" : p == 0 ? p == "" ? 0 : p in _CLASSPTR ? "`" : p ? 3 : 4 : p in _CLASSPTR ? "`" : p + 0 == p ? 5 : p ? 3 : 2) } function _typa(p, A) { - return (_t0 = (isarray(p) ? "#" : (p == 0 ? (p == "" ? 0 : (p in A ? "`" : (p ? 3 : 4))) : (p in A ? "`" : (p + 0 == p ? 5 : (p ? 3 : 2)))))) + return (_t0 = isarray(p) ? "#" : p == 0 ? p == "" ? 0 : p in A ? "`" : p ? 3 : 4 : p in A ? "`" : p + 0 == p ? 5 : p ? 3 : 2) } #_____________________________________________________ @@ -6944,7 +6944,7 @@ function _tzend(a, b) function _uidcyc(p, i) { _dumpuidgen(p) - for (i = 1; i < 64 * 8 * 6 - 1; i++) { + for (i = 1; i < (64 * 8 * 6 - 1); i++) { _conl(i ":" _var(_getuid(p))) } _dumpuidgen(p) @@ -6961,7 +6961,7 @@ function _unformatrexp(t) _formatstrq0 = split(t, _FORMATSTRA, /(\\[0-9]{1,3})|(\\x[[:xdigit:]]+)|(\\.)/, _FORMATSTRB) _formatstrs0 = "" for (t = 1; t < _formatstrq0; t++) { - _formatstrs0 = _formatstrs0 _FORMATSTRA[t] ((_FORMATSTRB[t] in _QESCHR ? _QESCREXP[_FORMATSTRB[t]] : _QESCREXP[toupper(substr(_FORMATSTRB[t], length(_FORMATSTRB[t]) - 1))])) + _formatstrs0 = _formatstrs0 _FORMATSTRA[t] (_FORMATSTRB[t] in _QESCHR ? _QESCREXP[_FORMATSTRB[t]] : _QESCREXP[toupper(substr(_FORMATSTRB[t], length(_FORMATSTRB[t]) - 1))]) } return (_formatstrs0 _FORMATSTRA[t]) } @@ -6972,10 +6972,10 @@ function _unformatrexp_init(i, a) _formatstrs0 = "\\^$.[]|()*+?{}-sSwW<>yB`'" delete _FORMATSTRB for (i = 0; i < 256; i++) { - _QESCREXP["\\" _CHR[i]] = (index(_formatstrs0, _CHR[i]) ? "\\" _CHR[i] : _CHR[i]) + _QESCREXP["\\" _CHR[i]] = index(_formatstrs0, _CHR[i]) ? "\\" _CHR[i] : _CHR[i] } for (i = 0; i < 256; i++) { - a = (index(_formatstrs0, _CHR[i]) ? "\\" : "") + a = index(_formatstrs0, _CHR[i]) ? "\\" : "" _QESCREXP[sprintf("%.2X", i)] = a _CHR[i] _QESCREXP["\\" sprintf("%.3o", i)] = a _CHR[i] if (i < 8) { @@ -7000,7 +7000,7 @@ function _unformatstr(t) _formatstrq0 = split(t, _FORMATSTRA, /(\\[0-9]{1,3})|(\\x[[:xdigit:]]+)|(\\.)/, _FORMATSTRB) _formatstrs0 = "" for (t = 1; t < _formatstrq0; t++) { - _formatstrs0 = _formatstrs0 _FORMATSTRA[t] ((_FORMATSTRB[t] in _QESCHR ? _QESCHR[_FORMATSTRB[t]] : _QESCHR[toupper(substr(_FORMATSTRB[t], length(_FORMATSTRB[t]) - 1))])) + _formatstrs0 = _formatstrs0 _FORMATSTRA[t] (_FORMATSTRB[t] in _QESCHR ? _QESCHR[_FORMATSTRB[t]] : _QESCHR[toupper(substr(_FORMATSTRB[t], length(_FORMATSTRB[t]) - 1))]) } return (_formatstrs0 _FORMATSTRA[t]) } @@ -7072,7 +7072,7 @@ function _unstr(t) function _untmp(f, a) { ############################################# - if (f = filepath(f)) { + if ((f = filepath(f))) { if (match(f, /\\$/)) { _deletepfx(_FILEIO_RDTMP, a = toupper(f)) _deletepfx(_FILEIO_RDNETMP, a) @@ -7320,7 +7320,7 @@ function _wFCHLD(p, v, a) delete _tQCHLD[p] do { delete _tPARENT[v] - } while (v in _tNEXT && (v = _tNEXT[v])) + } while ((v in _tNEXT) && (v = _tNEXT[v])) } } return v @@ -7522,7 +7522,7 @@ function _wLCHLD(p, v, a) delete _tQCHLD[p] do { delete _tPARENT[v] - } while (v in _tNEXT && (v = _tNEXT[v])) + } while ((v in _tNEXT) && (v = _tNEXT[v])) } } return v @@ -7721,7 +7721,7 @@ function _wQCHLD(p, v) delete _tQCHLD[p] do { delete _tPARENT[v] - } while (v in _tNEXT && (v = _tNEXT[v])) + } while ((v in _tNEXT) && (v = _tNEXT[v])) } } return v @@ -7771,7 +7771,7 @@ function _wonline(t) #___________________________________________________________ function _wr_shortcut(f, S) { - if (_shrtcutf0 = _filepath(f)) { + if ((_shrtcutf0 = _filepath(f))) { ERRNO = "" _shrtcuta0 = _shortcut_fpath " /A:C /F:\"" _shrtcutf0 "\" 2>&1" for (f in _SHORTCUTWSTRUC) { @@ -7783,14 +7783,14 @@ function _wr_shortcut(f, S) return } } - return ((ERRNO ? ERRNO = "write shortcut: " ERRNO : _NOP)) + return (ERRNO ? ERRNO = "write shortcut: " ERRNO : _NOP) } #_________________________________________________________________ function _wrfile(f, d, a, b) { ######################################### - if ((f = _wfilerdnehnd(f)) == "" || _filene(f) == "") { + if (((f = _wfilerdnehnd(f)) == "") || (_filene(f) == "")) { ERRNO = "Filename error" return } @@ -7816,7 +7816,7 @@ function _wrfile(f, d, a, b) function _wrfile1(f, d, a, b) { ################################## - if ((f = _wfilerdnehnd(f)) == "" || _filene(f) == "") { + if (((f = _wfilerdnehnd(f)) == "") || (_filene(f) == "")) { ERRNO = "Filename error" return } @@ -7863,7 +7863,7 @@ function _yexport_i0(p, p0, p1, p2) function cmp_str_idx(i1, v1, i2, v2) { ############################## - return ((i1 < i2 ? -1 : 1)) + return (i1 < i2 ? -1 : 1) } #___________________________________________________________ @@ -7876,7 +7876,7 @@ function filedi(f, d) return _FILEDIR[f] } if (f in _FILEROOT) { - if (d = filegetdrvdir(_FILEROOT[f])) { + if ((d = filegetdrvdir(_FILEROOT[f]))) { _FILEDIRFL[f] } return (_FILEDIR[f] = d _FILEDIR[f]) @@ -7897,7 +7897,7 @@ function filegetdrvdir(t, r) r = gensub(/[ \t]*([\\\$\:])[ \t]*/, "\\1", "G", substr(r, RSTART, RLENGTH)) gsub(/(^[ \t]*)|([ \t]*$)/, "", r) if (match(r, /\:(.*)/)) { - return (_FILEDRV[tolower(t)] = _FILEDRV[toupper(t)] = substr(r, RSTART + 1) ((r ~ /\\$/ ? "" : "\\"))) + return (_FILEDRV[tolower(t)] = _FILEDRV[toupper(t)] = substr(r, RSTART + 1) (r ~ /\\$/ ? "" : "\\")) } } return "" @@ -7910,20 +7910,20 @@ function filegetrootdir(f, dd, d) if (f in _FILEROOT) { return (_FILEROOT[f] _FILEDIR[f]) } - if ((dd = (dd ? dd : _FILEIO_RD), f) in _FILEROOT) { + if (((dd = dd ? dd : _FILEIO_RD), f) in _FILEROOT) { return (_FILEROOT[dd, f] _FILEDIR[f]) } - return ((_FILEROOT[dd, f] = fileri(dd)) _FILEDIR[f]) + return (_FILEROOT[dd, f] = fileri(dd)) _FILEDIR[f] } if (f in _FILEROOT) { - if (d = filegetdrvdir(_FILEROOT[f])) { + if ((d = filegetdrvdir(_FILEROOT[f]))) { _FILEDIRFL[f] return (_FILEROOT[f] (_FILEDIR[f] = d _FILEDIR[f])) } else { return (_FILEROOT[f] _FILEDIR[f]) } } - if ((dd = (dd ? dd : _FILEIO_RD), f) in _FILEROOT) { + if (((dd = dd ? dd : _FILEIO_RD), f) in _FILEROOT) { if ((dd, f) in _FILEDIR) { return (_FILEROOT[dd, f] _FILEDIR[dd, f]) } @@ -7933,12 +7933,12 @@ function filegetrootdir(f, dd, d) return (_FILEROOT[dd, f] d) } if ((dd, f) in _FILEDIR) { - return ((_FILEROOT[dd, f] = fileri(dd)) _FILEDIR[dd, f]) + return (_FILEROOT[dd, f] = fileri(dd)) _FILEDIR[dd, f] } if ((d = filedi(dd) _FILEDIR[f]) ~ /^\\/) { - return ((_FILEROOT[dd, f] = fileri(dd)) (_FILEDIR[dd, f] = d)) + return (_FILEROOT[dd, f] = fileri(dd)) (_FILEDIR[dd, f] = d) } - return ((_FILEROOT[dd, f] = fileri(dd)) d) + return (_FILEROOT[dd, f] = fileri(dd)) d } #___________________________________________________________ @@ -7951,7 +7951,7 @@ function filerdnehndi(st, a, c, r, d, n, A) if (match(st, /^[ \t]*\\[ \t]*\\/)) { if (match(substr(st, a = RLENGTH + 1), /^[ \t]*([0-9A-Za-z\-]+)[ \t]*(\\[ \t]*([A-Za-z])[ \t]*\$[ \t]*)?(\\[ \t]*([0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+( +[0-9A-Za-z_\!\+\-\[\]\(\)\{\}\~\.]+)*[ \t]*\\)*[ \t]*)?(([0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+( +[0-9A-Za-z_\!\+\.\~\-\[\]\{\}\(\)]+)*)[ \t]*)?/, A)) { a = a + RLENGTH - d = ((A[3] ? "\\" A[3] "$" : "")) "\\" A[5] + d = (A[3] ? ("\\" A[3] "$") : "") "\\" A[5] gsub(/[ \t]*\\[ \t]*/, "\\", d) if ((st = toupper((r = "\\\\" A[1]) d (n = A[8]))) in _FILECACHE) { return (_FILECACHE[substr(c, 1, a)] = _FILECACHE[st]) @@ -8018,7 +8018,7 @@ function hujf(a, b, c) function ncmp_str_idx(i1, v1, i2, v2) { ####################### - return ((i1 < i2 ? 1 : -1)) + return (i1 < i2 ? 1 : -1) } function test_cfg(p, z, AA0, a) @@ -8054,7 +8054,7 @@ function test_cfg(p, z, AA0, a) _conline() _conl() _drawuid(p) - _conl("```````````````````" z "'''''''''" ((_isptr(z) ? " ptr" : " not ptr"))) + _conl("```````````````````" z "'''''''''" (_isptr(z) ? " ptr" : " not ptr")) _drawuid(z) } @@ -8094,7 +8094,7 @@ function tst_splitstr(t, A, R, r) delete A A["not cleared"] _wonl() - _wonline("_splitstr(" ((isarray(t) ? "ARR" ((length(t) > 0 ? "#" ((t[1] != "zhopa" ? "U" : "l")) : "")) : _val0(t))) ",A" ((isarray(R) ? ", ARR" ((length(R) > 0 ? "#" ((R[1] != "zhopa" ? "U" : "l")) : "")) : ", " _val0(R))) "):") + _wonline("_splitstr(" (isarray(t) ? "ARR" (length(t) > 0 ? "#" (t[1] != "zhopa" ? "U" : "l") : "") : _val0(t)) ",A" (isarray(R) ? ", ARR" (length(R) > 0 ? "#" (R[1] != "zhopa" ? "U" : "l") : "") : ", " _val0(R)) "):") _wonl(_val0(r = _splitstr(t, A, R))) _wonl("arrary A:") _wonl(_dumparr(A)) diff --git a/test/profile7.awk b/test/profile7.awk index 454694f9..815aebb8 100644 --- a/test/profile7.awk +++ b/test/profile7.awk @@ -5,6 +5,8 @@ BEGIN { print 1 % (10 * 10) print (10 * 5) / 2 print 10 * (5 / 2) + print 10 - (1 + 3 * 3) + print 10 - (3 * 2 + 1) a = 5 b = 3 print a - 1 - b diff --git a/test/profile7.ok b/test/profile7.ok index d65afa86..10da2eb4 100644 --- a/test/profile7.ok +++ b/test/profile7.ok @@ -5,8 +5,10 @@ 1 print 1 / (10 * 10) 1 print 1 % 10 * 10 1 print 1 % (10 * 10) - 1 print 10 * 5 / 2 - 1 print 10 * 5 / 2 + 1 print (10 * 5) / 2 + 1 print 10 * (5 / 2) + 1 print 10 - (1 + 3 * 3) + 1 print 10 - (3 * 2 + 1) 1 a = 5 1 b = 3 1 print a - 1 - b -- cgit v1.2.3