summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2020-01-24 09:36:43 +0200
committerArnold D. Robbins <arnold@skeeve.com>2020-01-24 09:36:43 +0200
commitc0dfb9269380ff5a90dbf6606f64989848304527 (patch)
tree2d21a4e0bc3d75b8a98cc6b0b3db8e7fafd90dbd
parent1ef484e65a03a8360434c404c9a3006671bab2f7 (diff)
downloadgawk-c0dfb9269380ff5a90dbf6606f64989848304527.tar.gz
Fix assertion error in sorted loops for SYMTAB/FUNCTAB.
-rw-r--r--ChangeLog11
-rw-r--r--TODO5
-rw-r--r--array.c39
-rw-r--r--doc/ChangeLog6
-rw-r--r--doc/gawk.info872
-rw-r--r--doc/gawk.texi13
-rw-r--r--doc/gawktexi.in13
-rw-r--r--test/ChangeLog5
-rw-r--r--test/Makefile.am8
-rw-r--r--test/Makefile.in76
-rw-r--r--test/Maketests60
-rw-r--r--test/symtab11.awk30
-rw-r--r--test/symtab11.ok76
13 files changed, 651 insertions, 563 deletions
diff --git a/ChangeLog b/ChangeLog
index aa2d9a78..48d1f646 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2020-01-23 Arnold D. Robbins <arnold@skeeve.com>
+
+ * array.c (sort_up_value_type): Handle other types of nodes,
+ in case someone applies PROCINFO["sorted_in"] to SYMTAB or
+ FUNCTAB. This threw an assertion error if assertions were
+ enabled.
+ (asort_actual): Disallow SYMTAB and FUNCTAB as first arguments.
+ * TODO: Note that we should should eventually allow SYMTAB/FUNCTAB
+ passed to asort/asaorti if a destination array is provided. (The
+ current code breaks right now.)
+
2020-01-19 Arnold D. Robbins <arnold@skeeve.com>
* profile.c (pp_top): New macro.
diff --git a/TODO b/TODO
index 59b57a2b..c6aae80d 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,4 @@
-Tue Jul 16 20:33:19 IDT 2019
+Thu Jan 23 11:15:44 IST 2020
============================
There were too many files tracking different thoughts and ideas for
@@ -15,6 +15,9 @@ TODO
Minor Cleanups and Code Improvements
------------------------------------
+ Allow SYMTAB and FUNCTAB as arguments to asort/asorti if a
+ destination array is provided.
+
API:
??? #if !defined(GAWK) && !defined(GAWK_OMIT_CONVENIENCE_MACROS)
diff --git a/array.c b/array.c
index 43f84717..4f894577 100644
--- a/array.c
+++ b/array.c
@@ -832,6 +832,14 @@ asort_actual(int nargs, sort_context_t ctxt)
_("asort: first argument not an array") :
_("asorti: first argument not an array"));
}
+ else if (array == symbol_table)
+ fatal(ctxt == ASORT ?
+ _("asort: first argument cannot be SYMTAB") :
+ _("asorti: first argument cannot be SYMTAB"));
+ else if (array == func_table)
+ fatal(ctxt == ASORT ?
+ _("asort: first argument cannot be FUNCTAB") :
+ _("asorti: first argument cannot be FUNCTAB"));
if (dest != NULL) {
for (r = dest->parent_array; r != NULL; r = r->parent_array) {
@@ -1145,20 +1153,47 @@ static int
sort_up_value_type(const void *p1, const void *p2)
{
NODE *n1, *n2;
+ int n1_pos, n2_pos, i;
+
+ static const NODETYPE element_types[] = {
+ Node_builtin_func,
+ Node_func,
+ Node_ext_func,
+ Node_var_new,
+ Node_var,
+ Node_var_array,
+ Node_val,
+ Node_illegal
+ };
/* we want to compare the element values */
n1 = *((NODE *const *) p1 + 1);
n2 = *((NODE *const *) p2 + 1);
- /* 1. Arrays vs. scalar, scalar is less than array */
+ /* 1. Arrays vs. everything else, everything else is less than array */
if (n1->type == Node_var_array) {
/* return 0 if n2 is a sub-array too, else return 1 */
return (n2->type != Node_var_array);
}
if (n2->type == Node_var_array) {
- return -1; /* n1 (scalar) < n2 (sub-array) */
+ return -1; /* n1 (non-array) < n2 (sub-array) */
}
+ /* 2. Non scalars */
+ n1_pos = n2_pos = -1;
+ for (i = 0; element_types[i] != Node_illegal; i++) {
+ if (n1->type == element_types[i])
+ n1_pos = i;
+
+ if (n2->type == element_types[i])
+ n2_pos = i;
+ }
+
+ assert(n1_pos != -1 && n2_pos != -1);
+
+ if (n1->type != Node_val || n2->type != Node_val)
+ return (n1_pos - n2_pos);
+
/* two scalars */
(void) fixtype(n1);
(void) fixtype(n2);
diff --git a/doc/ChangeLog b/doc/ChangeLog
index d1a976d1..c8265436 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-23 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Document arry sorting by value for FUNCTAB.
+ Document that SYMTAB and FUNCTAB cannot be used with
+ asort() or asorti().
+
2020-01-19 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Escape Sequences): Stronger wording for \/
diff --git a/doc/gawk.info b/doc/gawk.info
index c9bf229a..999ee49f 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -11969,6 +11969,12 @@ available:
string values, which in turn come before all subarrays. (Subarrays
have not been described yet; *note Arrays of Arrays::.)
+ If you choose to use this feature in traversing 'FUNCTAB' (*note
+ Auto-set::), then the order is built-in functions first (*note
+ Built-in::), then user-defined functions (*note User-defined::)
+ next, and finally functions loaded from an extension (*note Dynamic
+ Extensions::).
+
'"@val_str_asc"'
Order by element values in ascending order (rather than by
indices). Scalar values are compared as strings. Subarrays, if
@@ -12849,6 +12855,12 @@ Options::):
a[2] = "last"
a[3] = "middle"
+ NOTE: Due to implementation limitations, you may not use
+ either 'SYMTAB' or 'FUNCTAB' as arguments to these functions,
+ even if providing a second array to use for the actual
+ sorting. Attempting to do so produces a fatal error. This
+ restriction may be lifted in the future.
+
'gensub(REGEXP, REPLACEMENT, HOW' [', TARGET']') #'
Search the target string TARGET for matches of the regular
expression REGEXP. If HOW is a string beginning with 'g' or 'G'
@@ -33729,7 +33741,7 @@ Index
* * (asterisk), *= operator <1>: Precedence. (line 94)
* * (asterisk), **= operator <1>: Precedence. (line 94)
* * (asterisk), * operator, null strings, matching: String Functions.
- (line 542)
+ (line 548)
* + (plus sign), regexp operator: Regexp Operator Details.
(line 107)
* + (plus sign), += operator: Assignment Ops. (line 81)
@@ -34107,7 +34119,7 @@ Index
* arrays, multidimensional, scanning: Multiscanning. (line 11)
* arrays, arrays of arrays: Arrays of Arrays. (line 6)
* arrays, elements, retrieving number of: String Functions. (line 42)
-* arrays, number of elements: String Functions. (line 201)
+* arrays, number of elements: String Functions. (line 207)
* arrays, as parameters to functions: Pass By Value/Reference.
(line 44)
* arrays, associative, library functions and: Library Names. (line 58)
@@ -34166,7 +34178,7 @@ Index
* asterisk (*), *= operator <1>: Precedence. (line 94)
* asterisk (*), **= operator <1>: Precedence. (line 94)
* asterisk (*), * operator, null strings, matching: String Functions.
- (line 542)
+ (line 548)
* at-sign (@), @include directive: Include Files. (line 8)
* at-sign (@), @load directive: Loading Shared Libraries.
(line 8)
@@ -34411,7 +34423,7 @@ Index
* Brian Kernighan's awk <9>: Continue Statement. (line 44)
* Brian Kernighan's awk <10>: Nextfile Statement. (line 47)
* Brian Kernighan's awk <11>: Delete. (line 51)
-* Brian Kernighan's awk <12>: String Functions. (line 498)
+* Brian Kernighan's awk <12>: String Functions. (line 504)
* Brian Kernighan's awk <13>: Gory Details. (line 19)
* Brian Kernighan's awk <14>: I/O Functions. (line 43)
* Brian Kernighan's awk, extensions: BTL. (line 6)
@@ -34474,7 +34486,7 @@ Index
* case sensitivity, string comparisons and: User-modified. (line 79)
* case sensitivity, regexps and <1>: User-modified. (line 79)
* case sensitivity, array indices and: Array Intro. (line 100)
-* case sensitivity, converting case: String Functions. (line 528)
+* case sensitivity, converting case: String Functions. (line 534)
* case sensitivity, example programs: Library Functions. (line 53)
* CGI, awk scripts for: Options. (line 147)
* character sets (machine character encodings): Ordinal Functions.
@@ -34552,7 +34564,7 @@ Index
* common extensions, **= operator: Assignment Ops. (line 138)
* common extensions, delete to delete entire arrays: Delete. (line 39)
* common extensions, length() applied to an array: String Functions.
- (line 201)
+ (line 207)
* common extensions, func keyword: Definition Syntax. (line 99)
* common extensions, BINMODE variable: PC Using. (line 20)
* comp.lang.awk newsgroup: Usenet. (line 11)
@@ -34610,9 +34622,9 @@ Index
* converting, numbers to strings: Strings And Numbers. (line 6)
* converting, integer array subscripts to strings: Numeric Array Subscripts.
(line 31)
-* converting, string to numbers <1>: String Functions. (line 396)
-* converting, string to lower case: String Functions. (line 529)
-* converting, string to upper case: String Functions. (line 535)
+* converting, string to numbers <1>: String Functions. (line 402)
+* converting, string to lower case: String Functions. (line 535)
+* converting, string to upper case: String Functions. (line 541)
* converting, dates to timestamps: Time Functions. (line 78)
* converting, string to numbers <2>: Bitwise Functions. (line 109)
* converting, numbers to strings <1>: Bitwise Functions. (line 109)
@@ -34695,9 +34707,9 @@ Index
* dark corner, array subscripts: Uninitialized Subscripts.
(line 43)
* dark corner, regexp as second argument to index(): String Functions.
- (line 165)
-* dark corner, length() function: String Functions. (line 187)
-* dark corner, split() function: String Functions. (line 366)
+ (line 171)
+* dark corner, length() function: String Functions. (line 193)
+* dark corner, split() function: String Functions. (line 372)
* dark corner <1>: Glossary. (line 266)
* data, fixed-width: Constant Size. (line 6)
* data-driven languages: Basic High Level. (line 74)
@@ -34945,11 +34957,11 @@ Index
* differences in awk and gawk, function arguments: Calling Built-in.
(line 16)
* differences in awk and gawk, length() function: String Functions.
- (line 201)
+ (line 207)
* differences in awk and gawk, match() function: String Functions.
- (line 263)
+ (line 269)
* differences in awk and gawk, split() function: String Functions.
- (line 351)
+ (line 357)
* differences in awk and gawk, indirect function calls: Indirect Calls.
(line 6)
* differences in awk and gawk, BINMODE variable <1>: PC Using.
@@ -35146,7 +35158,7 @@ Index
* extensions, common, **= operator: Assignment Ops. (line 138)
* extensions, common, delete to delete entire arrays: Delete. (line 39)
* extensions, common, length() applied to an array: String Functions.
- (line 201)
+ (line 207)
* extensions, common, fflush() function: I/O Functions. (line 43)
* extensions, common, func keyword: Definition Syntax. (line 99)
* extensions, loadable, allocating memory: Memory Allocation Functions.
@@ -35278,7 +35290,7 @@ Index
(line 80)
* files, message object, converting from portable object files: I18N Example.
(line 80)
-* find substring in string: String Functions. (line 156)
+* find substring in string: String Functions. (line 162)
* finding extensions: Finding Extensions. (line 6)
* finish debugger command: Debugger Execution Control.
(line 39)
@@ -35315,7 +35327,7 @@ Index
* format time string: Time Functions. (line 50)
* formats, numeric output: OFMT. (line 6)
* formatting, output: Printf. (line 6)
-* formatting, strings: String Functions. (line 389)
+* formatting, strings: String Functions. (line 395)
* forward slash (/), to enclose regular expressions: Regexp. (line 10)
* forward slash (/), /= operator: Assignment Ops. (line 129)
* forward slash (/), /= operator, vs. /=.../ regexp constant: Assignment Ops.
@@ -35515,7 +35527,7 @@ Index
* generate time values: Time Functions. (line 25)
* gensub: Standard Regexp Constants.
(line 43)
-* gensub <1>: String Functions. (line 89)
+* gensub <1>: String Functions. (line 95)
* gensub() function (gawk), escape processing: Gory Details. (line 6)
* getaddrinfo() function (C library): TCP/IP Networking. (line 39)
* getgrent() function (C library): Group Functions. (line 6)
@@ -35597,8 +35609,8 @@ Index
* groups, information about: Group Functions. (line 6)
* gsub: Standard Regexp Constants.
(line 43)
-* gsub <1>: String Functions. (line 140)
-* gsub() function, arguments of: String Functions. (line 468)
+* gsub <1>: String Functions. (line 146)
+* gsub() function, arguments of: String Functions. (line 474)
* gsub() function, escape processing: Gory Details. (line 6)
* Guerrero, Juan Manuel: Acknowledgments. (line 60)
* Guerrero, Juan Manuel <1>: Contributors. (line 150)
@@ -35665,7 +35677,7 @@ Index
* @include directive: Include Files. (line 8)
* including files, @include directive: Include Files. (line 8)
* increment operators: Increment Ops. (line 6)
-* index: String Functions. (line 156)
+* index: String Functions. (line 162)
* indexing arrays: Array Intro. (line 48)
* indirect function calls: Indirect Calls. (line 6)
* indirect function calls, @-notation: Indirect Calls. (line 47)
@@ -35691,7 +35703,7 @@ Index
(line 6)
* input files, counting elements in: Wc Program. (line 6)
* input pipeline: Getline/Pipe. (line 10)
-* input record, length of: String Functions. (line 178)
+* input record, length of: String Functions. (line 184)
* input redirection: Getline/File. (line 6)
* input/output, from BEGIN and END: I/O And BEGIN/END. (line 6)
* input/output, binary: User-modified. (line 15)
@@ -35799,9 +35811,9 @@ Index
* left angle bracket (<), <= operator <1>: Precedence. (line 64)
* left shift, bitwise: Bitwise Functions. (line 32)
* leftmost longest match: Multiple Line. (line 26)
-* length: String Functions. (line 171)
-* length of input record: String Functions. (line 178)
-* length of string: String Functions. (line 171)
+* length: String Functions. (line 177)
+* length of input record: String Functions. (line 184)
+* length of string: String Functions. (line 177)
* Lesser General Public License (LGPL): Glossary. (line 489)
* LGPL (Lesser General Public License): Glossary. (line 489)
* libmawk: Other Versions. (line 129)
@@ -35890,15 +35902,15 @@ Index
* marked string extraction (internationalization): String Extraction.
(line 6)
* Marx, Groucho: Increment Ops. (line 60)
-* match: String Functions. (line 211)
-* match regexp in string: String Functions. (line 211)
+* match: String Functions. (line 217)
+* match regexp in string: String Functions. (line 217)
* match() function, RSTART/RLENGTH variables: String Functions.
- (line 228)
-* match() function, side effects: String Functions. (line 228)
+ (line 234)
+* match() function, side effects: String Functions. (line 234)
* matching, leftmost longest: Multiple Line. (line 26)
* matching, expressions: Typing and Comparison.
(line 9)
-* matching, null strings: String Functions. (line 542)
+* matching, null strings: String Functions. (line 548)
* mawk utility: Escape Sequences. (line 121)
* mawk utility <1>: Getline/Pipe. (line 62)
* mawk utility <2>: Concatenation. (line 36)
@@ -36020,9 +36032,9 @@ Index
* null strings, as array subscripts: Uninitialized Subscripts.
(line 43)
* null strings, deleting array elements and: Delete. (line 27)
-* null strings, matching: String Functions. (line 542)
+* null strings, matching: String Functions. (line 548)
* null strings <3>: Basic Data Typing. (line 26)
-* number of array elements: String Functions. (line 201)
+* number of array elements: String Functions. (line 207)
* number sign (#), #! (executable scripts): Executable Scripts.
(line 6)
* number sign (#), commenting: Comments. (line 6)
@@ -36130,7 +36142,7 @@ Index
(line 77)
* parentheses (), in a profile: Profiling. (line 146)
* password file: Passwd Functions. (line 16)
-* patsplit: String Functions. (line 297)
+* patsplit: String Functions. (line 303)
* patterns, default: Very Simple. (line 35)
* patterns, regexp constants as: Regexp Usage. (line 6)
* patterns: Patterns and Actions.
@@ -36194,8 +36206,8 @@ Index
* portability, operators: Increment Ops. (line 60)
* portability, operators, not in POSIX awk: Precedence. (line 97)
* portability, deleting array elements: Delete. (line 56)
-* portability, length() function: String Functions. (line 180)
-* portability, substr() function: String Functions. (line 518)
+* portability, length() function: String Functions. (line 186)
+* portability, substr() function: String Functions. (line 524)
* portability, functions, defining: Definition Syntax. (line 114)
* portability, next statement in user-defined functions: Function Caveats.
(line 26)
@@ -36249,7 +36261,7 @@ Index
* POSIX awk, continue statement and: Continue Statement. (line 44)
* POSIX awk, next/nextfile statements and: Next Statement. (line 44)
* POSIX awk, CONVFMT variable and: User-modified. (line 30)
-* POSIX awk, functions and, length(): String Functions. (line 180)
+* POSIX awk, functions and, length(): String Functions. (line 186)
* POSIX awk, functions and, gsub()/sub(): Gory Details. (line 90)
* POSIX awk, timestamps and: Time Functions. (line 6)
* POSIX awk, date utility and: Time Functions. (line 255)
@@ -36270,7 +36282,7 @@ Index
(line 12)
* POSIX mode <9>: POSIX String Comparison.
(line 34)
-* POSIX mode <10>: String Functions. (line 385)
+* POSIX mode <10>: String Functions. (line 391)
* POSIX mode <11>: Controlling Array Traversal.
(line 226)
* POSIX mode <12>: POSIX Floating Point Problems.
@@ -36484,7 +36496,7 @@ Index
* regular expressions, as patterns <1>: Regexp Patterns. (line 6)
* regular expressions, case sensitivity <1>: User-modified. (line 79)
* regular expressions, searching for: Egrep Program. (line 6)
-* replace in string: String Functions. (line 414)
+* replace in string: String Functions. (line 420)
* retrying input: Retrying Input. (line 6)
* return debugger command: Debugger Execution Control.
(line 54)
@@ -36509,7 +36521,7 @@ Index
* right shift, bitwise: Bitwise Functions. (line 32)
* Ritchie, Dennis: Basic Data Typing. (line 54)
* RLENGTH variable: Auto-set. (line 335)
-* RLENGTH variable, match() function and: String Functions. (line 228)
+* RLENGTH variable, match() function and: String Functions. (line 234)
* Robbins, Miriam: Acknowledgments. (line 94)
* Robbins, Jean: Acknowledgments. (line 94)
* Robbins, Harry: Acknowledgments. (line 94)
@@ -36537,7 +36549,7 @@ Index
* RS variable <1>: User-modified. (line 136)
* rshift: Bitwise Functions. (line 54)
* RSTART variable: Auto-set. (line 341)
-* RSTART variable, match() function and: String Functions. (line 228)
+* RSTART variable, match() function and: String Functions. (line 234)
* RT variable: awk split records. (line 131)
* RT variable <1>: gawk split records. (line 58)
* RT variable <2>: Multiple Line. (line 139)
@@ -36563,8 +36575,8 @@ Index
* Schorr, Andrew <2>: Contributors. (line 136)
* Schreiber, Bert: Acknowledgments. (line 38)
* Schreiber, Rita: Acknowledgments. (line 38)
-* search and replace in strings: String Functions. (line 89)
-* search for substring: String Functions. (line 156)
+* search and replace in strings: String Functions. (line 95)
+* search for substring: String Functions. (line 162)
* search paths, for source files: AWKPATH Variable. (line 6)
* search paths, for loadable extensions: AWKLIBPATH Variable. (line 6)
* search paths: Programs Exercises. (line 70)
@@ -36645,9 +36657,9 @@ Index
* side effects, statements: Action Overview. (line 32)
* side effects, array indexing: Reference to Elements.
(line 43)
-* side effects, match() function: String Functions. (line 228)
-* side effects, sub() function: String Functions. (line 468)
-* side effects, gsub() function: String Functions. (line 468)
+* side effects, match() function: String Functions. (line 234)
+* side effects, sub() function: String Functions. (line 474)
+* side effects, gsub() function: String Functions. (line 474)
* side effects, asort() function: Array Sorting Functions.
(line 24)
* side effects, asorti() function: Array Sorting Functions.
@@ -36677,7 +36689,7 @@ Index
(line 147)
* sidebar, Operator Evaluation Order: Increment Ops. (line 58)
* sidebar, Changing NR and FNR: Auto-set. (line 407)
-* sidebar, Matching the Null String: String Functions. (line 540)
+* sidebar, Matching the Null String: String Functions. (line 546)
* sidebar, Interactive Versus Noninteractive Buffering: I/O Functions.
(line 74)
* sidebar, Controlling Output Buffering with system(): I/O Functions.
@@ -36745,13 +36757,13 @@ Index
* source files, search path for: Programs Exercises. (line 70)
* sparse arrays: Array Intro. (line 76)
* Spencer, Henry: Glossary. (line 16)
-* split: String Functions. (line 318)
-* split string into array: String Functions. (line 297)
+* split: String Functions. (line 324)
+* split string into array: String Functions. (line 303)
* split utility: Split Program. (line 6)
* split() function, array elements, deleting: Delete. (line 61)
* split.awk program: Split Program. (line 30)
* sprintf: OFMT. (line 15)
-* sprintf <1>: String Functions. (line 389)
+* sprintf <1>: String Functions. (line 395)
* sprintf() function, print/printf statements and: Round Function.
(line 6)
* sqrt: Numeric Functions. (line 78)
@@ -36786,8 +36798,8 @@ Index
* string, constants, vs. regexp constants: Computed Regexps. (line 40)
* string, constants: Scalar Constants. (line 15)
* string, operators: Concatenation. (line 9)
-* string, length: String Functions. (line 171)
-* string, regular expression match of: String Functions. (line 211)
+* string, length: String Functions. (line 177)
+* string, regular expression match of: String Functions. (line 217)
* string, extraction (internationalization): String Extraction.
(line 6)
* string-manipulation functions: String Functions. (line 6)
@@ -36802,19 +36814,19 @@ Index
* strings, numeric: Variable Typing. (line 67)
* strings, converting, numbers to: User-modified. (line 30)
* strings, converting, numbers to <1>: User-modified. (line 107)
-* strings, splitting, example: String Functions. (line 337)
-* strings, converting letter case: String Functions. (line 528)
+* strings, splitting, example: String Functions. (line 343)
+* strings, converting letter case: String Functions. (line 534)
* strings, converting <1>: Bitwise Functions. (line 109)
* strings, merging arrays into: Join Function. (line 6)
* strings, for localization: Programmer i18n. (line 13)
* strings, extracting: String Extraction. (line 6)
-* strtonum: String Functions. (line 396)
+* strtonum: String Functions. (line 402)
* strtonum() function (gawk), --non-decimal-data option and: Nondecimal Data.
(line 35)
* sub: Standard Regexp Constants.
(line 43)
-* sub <1>: String Functions. (line 414)
-* sub() function, arguments of: String Functions. (line 468)
+* sub <1>: String Functions. (line 420)
+* sub() function, arguments of: String Functions. (line 474)
* sub() function, escape processing: Gory Details. (line 6)
* subscript separators: User-modified. (line 149)
* subscripts in arrays, numbers as: Numeric Array Subscripts.
@@ -36827,9 +36839,9 @@ Index
* SUBSEP variable: User-modified. (line 149)
* SUBSEP variable, multidimensional arrays and: Multidimensional.
(line 16)
-* substitute in string: String Functions. (line 89)
-* substr: String Functions. (line 487)
-* substring: String Functions. (line 487)
+* substitute in string: String Functions. (line 95)
+* substr: String Functions. (line 493)
+* substring: String Functions. (line 493)
* Sumner, Andrew: Other Versions. (line 64)
* supplementary groups of gawk process: Auto-set. (line 292)
* switch statement: Switch Statement. (line 6)
@@ -36890,8 +36902,8 @@ Index
* timestamps, converting dates to: Time Functions. (line 78)
* timestamps, formatted: Getlocaltime Function.
(line 6)
-* tolower: String Functions. (line 529)
-* toupper: String Functions. (line 535)
+* tolower: String Functions. (line 535)
+* toupper: String Functions. (line 541)
* tr utility: Translate Program. (line 6)
* trace debugger command: Miscellaneous Debugger Commands.
(line 108)
@@ -36922,9 +36934,9 @@ Index
* troubleshooting, function call syntax: Function Calls. (line 30)
* troubleshooting, gawk, fatal errors, function arguments: Calling Built-in.
(line 16)
-* troubleshooting, match() function: String Functions. (line 292)
-* troubleshooting, gsub()/sub() functions: String Functions. (line 478)
-* troubleshooting, substr() function: String Functions. (line 505)
+* troubleshooting, match() function: String Functions. (line 298)
+* troubleshooting, gsub()/sub() functions: String Functions. (line 484)
+* troubleshooting, substr() function: String Functions. (line 511)
* troubleshooting, fflush() function: I/O Functions. (line 63)
* troubleshooting, system() function: I/O Functions. (line 128)
* troubleshooting, readable data files: File Checking. (line 6)
@@ -37348,371 +37360,371 @@ Node: Assigning Elements503938
Node: Array Example504429
Node: Scanning an Array506188
Node: Controlling Scanning509210
-Ref: Controlling Scanning-Footnote-1514609
-Node: Numeric Array Subscripts514925
-Node: Uninitialized Subscripts517109
-Node: Delete518728
-Ref: Delete-Footnote-1521480
-Node: Multidimensional521537
-Node: Multiscanning524632
-Node: Arrays of Arrays526223
-Node: Arrays Summary530991
-Node: Functions533084
-Node: Built-in534122
-Node: Calling Built-in535203
-Node: Numeric Functions537199
-Ref: Numeric Functions-Footnote-1541227
-Ref: Numeric Functions-Footnote-2541875
-Ref: Numeric Functions-Footnote-3541923
-Node: String Functions542195
-Ref: String Functions-Footnote-1566053
-Ref: String Functions-Footnote-2566181
-Ref: String Functions-Footnote-3566429
-Node: Gory Details566516
-Ref: table-sub-escapes568307
-Ref: table-sub-proposed569826
-Ref: table-posix-sub571189
-Ref: table-gensub-escapes572730
-Ref: Gory Details-Footnote-1573553
-Node: I/O Functions573707
-Ref: table-system-return-values580175
-Ref: I/O Functions-Footnote-1582255
-Ref: I/O Functions-Footnote-2582403
-Node: Time Functions582523
-Ref: Time Functions-Footnote-1593194
-Ref: Time Functions-Footnote-2593262
-Ref: Time Functions-Footnote-3593420
-Ref: Time Functions-Footnote-4593531
-Ref: Time Functions-Footnote-5593643
-Ref: Time Functions-Footnote-6593870
-Node: Bitwise Functions594136
-Ref: table-bitwise-ops594730
-Ref: Bitwise Functions-Footnote-1600793
-Ref: Bitwise Functions-Footnote-2600966
-Node: Type Functions601157
-Node: I18N Functions604020
-Node: User-defined605671
-Node: Definition Syntax606483
-Ref: Definition Syntax-Footnote-1612170
-Node: Function Example612241
-Ref: Function Example-Footnote-1615163
-Node: Function Calling615185
-Node: Calling A Function615773
-Node: Variable Scope616731
-Node: Pass By Value/Reference619725
-Node: Function Caveats622369
-Ref: Function Caveats-Footnote-1624416
-Node: Return Statement624536
-Node: Dynamic Typing627515
-Node: Indirect Calls628445
-Ref: Indirect Calls-Footnote-1638697
-Node: Functions Summary638825
-Node: Library Functions641530
-Ref: Library Functions-Footnote-1645137
-Ref: Library Functions-Footnote-2645280
-Node: Library Names645451
-Ref: Library Names-Footnote-1649118
-Ref: Library Names-Footnote-2649341
-Node: General Functions649427
-Node: Strtonum Function650530
-Node: Assert Function653552
-Node: Round Function656878
-Node: Cliff Random Function658418
-Node: Ordinal Functions659434
-Ref: Ordinal Functions-Footnote-1662497
-Ref: Ordinal Functions-Footnote-2662749
-Node: Join Function662959
-Ref: Join Function-Footnote-1664729
-Node: Getlocaltime Function664929
-Node: Readfile Function668671
-Node: Shell Quoting670648
-Node: Data File Management672049
-Node: Filetrans Function672681
-Node: Rewind Function676777
-Node: File Checking678686
-Ref: File Checking-Footnote-1680020
-Node: Empty Files680221
-Node: Ignoring Assigns682200
-Node: Getopt Function683750
-Ref: Getopt Function-Footnote-1695219
-Node: Passwd Functions695419
-Ref: Passwd Functions-Footnote-1704258
-Node: Group Functions704346
-Ref: Group Functions-Footnote-1712244
-Node: Walking Arrays712451
-Node: Library Functions Summary715459
-Node: Library Exercises716865
-Node: Sample Programs717330
-Node: Running Examples718100
-Node: Clones718828
-Node: Cut Program720052
-Node: Egrep Program729981
-Ref: Egrep Program-Footnote-1737493
-Node: Id Program737603
-Node: Split Program741283
-Ref: Split Program-Footnote-1744741
-Node: Tee Program744870
-Node: Uniq Program747660
-Node: Wc Program755281
-Ref: Wc Program-Footnote-1759536
-Node: Miscellaneous Programs759630
-Node: Dupword Program760843
-Node: Alarm Program762873
-Node: Translate Program767728
-Ref: Translate Program-Footnote-1772293
-Node: Labels Program772563
-Ref: Labels Program-Footnote-1775914
-Node: Word Sorting775998
-Node: History Sorting780070
-Node: Extract Program782295
-Node: Simple Sed790349
-Node: Igawk Program793423
-Ref: Igawk Program-Footnote-1807754
-Ref: Igawk Program-Footnote-2807956
-Ref: Igawk Program-Footnote-3808078
-Node: Anagram Program808193
-Node: Signature Program811255
-Node: Programs Summary812502
-Node: Programs Exercises813716
-Ref: Programs Exercises-Footnote-1817845
-Node: Advanced Features817936
-Node: Nondecimal Data819926
-Node: Array Sorting821517
-Node: Controlling Array Traversal822217
-Ref: Controlling Array Traversal-Footnote-1830585
-Node: Array Sorting Functions830703
-Ref: Array Sorting Functions-Footnote-1835794
-Node: Two-way I/O835990
-Ref: Two-way I/O-Footnote-1843711
-Ref: Two-way I/O-Footnote-2843898
-Node: TCP/IP Networking843980
-Node: Profiling847098
-Node: Advanced Features Summary856113
-Node: Internationalization857957
-Node: I18N and L10N859437
-Node: Explaining gettext860124
-Ref: Explaining gettext-Footnote-1866016
-Ref: Explaining gettext-Footnote-2866201
-Node: Programmer i18n866366
-Ref: Programmer i18n-Footnote-1871315
-Node: Translator i18n871364
-Node: String Extraction872158
-Ref: String Extraction-Footnote-1873290
-Node: Printf Ordering873376
-Ref: Printf Ordering-Footnote-1876162
-Node: I18N Portability876226
-Ref: I18N Portability-Footnote-1878682
-Node: I18N Example878745
-Ref: I18N Example-Footnote-1882020
-Ref: I18N Example-Footnote-2882093
-Node: Gawk I18N882202
-Node: I18N Summary882851
-Node: Debugger884192
-Node: Debugging885192
-Node: Debugging Concepts885633
-Node: Debugging Terms887442
-Node: Awk Debugging890017
-Ref: Awk Debugging-Footnote-1890962
-Node: Sample Debugging Session891094
-Node: Debugger Invocation891628
-Node: Finding The Bug893014
-Node: List of Debugger Commands899488
-Node: Breakpoint Control900821
-Node: Debugger Execution Control904515
-Node: Viewing And Changing Data907877
-Node: Execution Stack911418
-Node: Debugger Info913055
-Node: Miscellaneous Debugger Commands917126
-Node: Readline Support922188
-Node: Limitations923084
-Node: Debugging Summary925638
-Node: Namespaces926917
-Node: Global Namespace928028
-Node: Qualified Names929426
-Node: Default Namespace930425
-Node: Changing The Namespace931166
-Node: Naming Rules932780
-Node: Internal Name Management934628
-Node: Namespace Example935670
-Node: Namespace And Features938232
-Node: Namespace Summary939667
-Node: Arbitrary Precision Arithmetic941144
-Node: Computer Arithmetic942631
-Ref: table-numeric-ranges946397
-Ref: table-floating-point-ranges946890
-Ref: Computer Arithmetic-Footnote-1947548
-Node: Math Definitions947605
-Ref: table-ieee-formats950921
-Ref: Math Definitions-Footnote-1951524
-Node: MPFR features951629
-Node: FP Math Caution953347
-Ref: FP Math Caution-Footnote-1954419
-Node: Inexactness of computations954788
-Node: Inexact representation955748
-Node: Comparing FP Values957108
-Node: Errors accumulate958349
-Node: Getting Accuracy959782
-Node: Try To Round962492
-Node: Setting precision963391
-Ref: table-predefined-precision-strings964088
-Node: Setting the rounding mode965918
-Ref: table-gawk-rounding-modes966292
-Ref: Setting the rounding mode-Footnote-1970223
-Node: Arbitrary Precision Integers970402
-Ref: Arbitrary Precision Integers-Footnote-1973577
-Node: Checking for MPFR973726
-Node: POSIX Floating Point Problems975200
-Ref: POSIX Floating Point Problems-Footnote-1979485
-Node: Floating point summary979523
-Node: Dynamic Extensions981713
-Node: Extension Intro983266
-Node: Plugin License984532
-Node: Extension Mechanism Outline985329
-Ref: figure-load-extension985768
-Ref: figure-register-new-function987333
-Ref: figure-call-new-function988425
-Node: Extension API Description990487
-Node: Extension API Functions Introduction992129
-Ref: table-api-std-headers993965
-Node: General Data Types997830
-Ref: General Data Types-Footnote-11006191
-Node: Memory Allocation Functions1006490
-Ref: Memory Allocation Functions-Footnote-11010700
-Node: Constructor Functions1010799
-Node: Registration Functions1014385
-Node: Extension Functions1015070
-Node: Exit Callback Functions1020392
-Node: Extension Version String1021642
-Node: Input Parsers1022305
-Node: Output Wrappers1035026
-Node: Two-way processors1039538
-Node: Printing Messages1041803
-Ref: Printing Messages-Footnote-11042974
-Node: Updating ERRNO1043127
-Node: Requesting Values1043866
-Ref: table-value-types-returned1044603
-Node: Accessing Parameters1045539
-Node: Symbol Table Access1046774
-Node: Symbol table by name1047286
-Ref: Symbol table by name-Footnote-11050310
-Node: Symbol table by cookie1050438
-Ref: Symbol table by cookie-Footnote-11054623
-Node: Cached values1054687
-Ref: Cached values-Footnote-11058223
-Node: Array Manipulation1058376
-Ref: Array Manipulation-Footnote-11059467
-Node: Array Data Types1059504
-Ref: Array Data Types-Footnote-11062162
-Node: Array Functions1062254
-Node: Flattening Arrays1066752
-Node: Creating Arrays1073728
-Node: Redirection API1078495
-Node: Extension API Variables1081328
-Node: Extension Versioning1082039
-Ref: gawk-api-version1082468
-Node: Extension GMP/MPFR Versioning1084199
-Node: Extension API Informational Variables1085827
-Node: Extension API Boilerplate1086900
-Node: Changes from API V11090874
-Node: Finding Extensions1092446
-Node: Extension Example1093005
-Node: Internal File Description1093803
-Node: Internal File Ops1097883
-Ref: Internal File Ops-Footnote-11109233
-Node: Using Internal File Ops1109373
-Ref: Using Internal File Ops-Footnote-11111756
-Node: Extension Samples1112030
-Node: Extension Sample File Functions1113559
-Node: Extension Sample Fnmatch1121208
-Node: Extension Sample Fork1122695
-Node: Extension Sample Inplace1123913
-Node: Extension Sample Ord1127538
-Node: Extension Sample Readdir1128374
-Ref: table-readdir-file-types1129263
-Node: Extension Sample Revout1130330
-Node: Extension Sample Rev2way1130919
-Node: Extension Sample Read write array1131659
-Node: Extension Sample Readfile1133601
-Node: Extension Sample Time1134696
-Node: Extension Sample API Tests1136448
-Node: gawkextlib1136940
-Node: Extension summary1139858
-Node: Extension Exercises1143560
-Node: Language History1144802
-Node: V7/SVR3.11146458
-Node: SVR41148610
-Node: POSIX1150044
-Node: BTL1151424
-Node: POSIX/GNU1152153
-Node: Feature History1157931
-Node: Common Extensions1174124
-Node: Ranges and Locales1175407
-Ref: Ranges and Locales-Footnote-11180023
-Ref: Ranges and Locales-Footnote-21180050
-Ref: Ranges and Locales-Footnote-31180285
-Node: Contributors1180506
-Node: History summary1186459
-Node: Installation1187839
-Node: Gawk Distribution1188783
-Node: Getting1189267
-Node: Extracting1190230
-Node: Distribution contents1191868
-Node: Unix Installation1198348
-Node: Quick Installation1199030
-Node: Shell Startup Files1201444
-Node: Additional Configuration Options1202533
-Node: Configuration Philosophy1204848
-Node: Non-Unix Installation1207217
-Node: PC Installation1207677
-Node: PC Binary Installation1208515
-Node: PC Compiling1208950
-Node: PC Using1210067
-Node: Cygwin1213620
-Node: MSYS1214844
-Node: VMS Installation1215345
-Node: VMS Compilation1216136
-Ref: VMS Compilation-Footnote-11217365
-Node: VMS Dynamic Extensions1217423
-Node: VMS Installation Details1219108
-Node: VMS Running1221361
-Node: VMS GNV1225640
-Node: VMS Old Gawk1226375
-Node: Bugs1226846
-Node: Bug address1227509
-Node: Usenet1230491
-Node: Maintainers1231495
-Node: Other Versions1232756
-Node: Installation summary1239844
-Node: Notes1241046
-Node: Compatibility Mode1241840
-Node: Additions1242622
-Node: Accessing The Source1243547
-Node: Adding Code1244984
-Node: New Ports1251203
-Node: Derived Files1255578
-Ref: Derived Files-Footnote-11261238
-Ref: Derived Files-Footnote-21261273
-Ref: Derived Files-Footnote-31261871
-Node: Future Extensions1261985
-Node: Implementation Limitations1262643
-Node: Extension Design1263826
-Node: Old Extension Problems1264970
-Ref: Old Extension Problems-Footnote-11266488
-Node: Extension New Mechanism Goals1266545
-Ref: Extension New Mechanism Goals-Footnote-11269909
-Node: Extension Other Design Decisions1270098
-Node: Extension Future Growth1272211
-Node: Notes summary1273047
-Node: Basic Concepts1274205
-Node: Basic High Level1274886
-Ref: figure-general-flow1275168
-Ref: figure-process-flow1275853
-Ref: Basic High Level-Footnote-11279154
-Node: Basic Data Typing1279339
-Node: Glossary1282667
-Node: Copying1314505
-Node: GNU Free Documentation License1352048
-Node: Index1377168
+Ref: Controlling Scanning-Footnote-1514910
+Node: Numeric Array Subscripts515226
+Node: Uninitialized Subscripts517410
+Node: Delete519029
+Ref: Delete-Footnote-1521781
+Node: Multidimensional521838
+Node: Multiscanning524933
+Node: Arrays of Arrays526524
+Node: Arrays Summary531292
+Node: Functions533385
+Node: Built-in534423
+Node: Calling Built-in535504
+Node: Numeric Functions537500
+Ref: Numeric Functions-Footnote-1541528
+Ref: Numeric Functions-Footnote-2542176
+Ref: Numeric Functions-Footnote-3542224
+Node: String Functions542496
+Ref: String Functions-Footnote-1566680
+Ref: String Functions-Footnote-2566808
+Ref: String Functions-Footnote-3567056
+Node: Gory Details567143
+Ref: table-sub-escapes568934
+Ref: table-sub-proposed570453
+Ref: table-posix-sub571816
+Ref: table-gensub-escapes573357
+Ref: Gory Details-Footnote-1574180
+Node: I/O Functions574334
+Ref: table-system-return-values580802
+Ref: I/O Functions-Footnote-1582882
+Ref: I/O Functions-Footnote-2583030
+Node: Time Functions583150
+Ref: Time Functions-Footnote-1593821
+Ref: Time Functions-Footnote-2593889
+Ref: Time Functions-Footnote-3594047
+Ref: Time Functions-Footnote-4594158
+Ref: Time Functions-Footnote-5594270
+Ref: Time Functions-Footnote-6594497
+Node: Bitwise Functions594763
+Ref: table-bitwise-ops595357
+Ref: Bitwise Functions-Footnote-1601420
+Ref: Bitwise Functions-Footnote-2601593
+Node: Type Functions601784
+Node: I18N Functions604647
+Node: User-defined606298
+Node: Definition Syntax607110
+Ref: Definition Syntax-Footnote-1612797
+Node: Function Example612868
+Ref: Function Example-Footnote-1615790
+Node: Function Calling615812
+Node: Calling A Function616400
+Node: Variable Scope617358
+Node: Pass By Value/Reference620352
+Node: Function Caveats622996
+Ref: Function Caveats-Footnote-1625043
+Node: Return Statement625163
+Node: Dynamic Typing628142
+Node: Indirect Calls629072
+Ref: Indirect Calls-Footnote-1639324
+Node: Functions Summary639452
+Node: Library Functions642157
+Ref: Library Functions-Footnote-1645764
+Ref: Library Functions-Footnote-2645907
+Node: Library Names646078
+Ref: Library Names-Footnote-1649745
+Ref: Library Names-Footnote-2649968
+Node: General Functions650054
+Node: Strtonum Function651157
+Node: Assert Function654179
+Node: Round Function657505
+Node: Cliff Random Function659045
+Node: Ordinal Functions660061
+Ref: Ordinal Functions-Footnote-1663124
+Ref: Ordinal Functions-Footnote-2663376
+Node: Join Function663586
+Ref: Join Function-Footnote-1665356
+Node: Getlocaltime Function665556
+Node: Readfile Function669298
+Node: Shell Quoting671275
+Node: Data File Management672676
+Node: Filetrans Function673308
+Node: Rewind Function677404
+Node: File Checking679313
+Ref: File Checking-Footnote-1680647
+Node: Empty Files680848
+Node: Ignoring Assigns682827
+Node: Getopt Function684377
+Ref: Getopt Function-Footnote-1695846
+Node: Passwd Functions696046
+Ref: Passwd Functions-Footnote-1704885
+Node: Group Functions704973
+Ref: Group Functions-Footnote-1712871
+Node: Walking Arrays713078
+Node: Library Functions Summary716086
+Node: Library Exercises717492
+Node: Sample Programs717957
+Node: Running Examples718727
+Node: Clones719455
+Node: Cut Program720679
+Node: Egrep Program730608
+Ref: Egrep Program-Footnote-1738120
+Node: Id Program738230
+Node: Split Program741910
+Ref: Split Program-Footnote-1745368
+Node: Tee Program745497
+Node: Uniq Program748287
+Node: Wc Program755908
+Ref: Wc Program-Footnote-1760163
+Node: Miscellaneous Programs760257
+Node: Dupword Program761470
+Node: Alarm Program763500
+Node: Translate Program768355
+Ref: Translate Program-Footnote-1772920
+Node: Labels Program773190
+Ref: Labels Program-Footnote-1776541
+Node: Word Sorting776625
+Node: History Sorting780697
+Node: Extract Program782922
+Node: Simple Sed790976
+Node: Igawk Program794050
+Ref: Igawk Program-Footnote-1808381
+Ref: Igawk Program-Footnote-2808583
+Ref: Igawk Program-Footnote-3808705
+Node: Anagram Program808820
+Node: Signature Program811882
+Node: Programs Summary813129
+Node: Programs Exercises814343
+Ref: Programs Exercises-Footnote-1818472
+Node: Advanced Features818563
+Node: Nondecimal Data820553
+Node: Array Sorting822144
+Node: Controlling Array Traversal822844
+Ref: Controlling Array Traversal-Footnote-1831212
+Node: Array Sorting Functions831330
+Ref: Array Sorting Functions-Footnote-1836421
+Node: Two-way I/O836617
+Ref: Two-way I/O-Footnote-1844338
+Ref: Two-way I/O-Footnote-2844525
+Node: TCP/IP Networking844607
+Node: Profiling847725
+Node: Advanced Features Summary856740
+Node: Internationalization858584
+Node: I18N and L10N860064
+Node: Explaining gettext860751
+Ref: Explaining gettext-Footnote-1866643
+Ref: Explaining gettext-Footnote-2866828
+Node: Programmer i18n866993
+Ref: Programmer i18n-Footnote-1871942
+Node: Translator i18n871991
+Node: String Extraction872785
+Ref: String Extraction-Footnote-1873917
+Node: Printf Ordering874003
+Ref: Printf Ordering-Footnote-1876789
+Node: I18N Portability876853
+Ref: I18N Portability-Footnote-1879309
+Node: I18N Example879372
+Ref: I18N Example-Footnote-1882647
+Ref: I18N Example-Footnote-2882720
+Node: Gawk I18N882829
+Node: I18N Summary883478
+Node: Debugger884819
+Node: Debugging885819
+Node: Debugging Concepts886260
+Node: Debugging Terms888069
+Node: Awk Debugging890644
+Ref: Awk Debugging-Footnote-1891589
+Node: Sample Debugging Session891721
+Node: Debugger Invocation892255
+Node: Finding The Bug893641
+Node: List of Debugger Commands900115
+Node: Breakpoint Control901448
+Node: Debugger Execution Control905142
+Node: Viewing And Changing Data908504
+Node: Execution Stack912045
+Node: Debugger Info913682
+Node: Miscellaneous Debugger Commands917753
+Node: Readline Support922815
+Node: Limitations923711
+Node: Debugging Summary926265
+Node: Namespaces927544
+Node: Global Namespace928655
+Node: Qualified Names930053
+Node: Default Namespace931052
+Node: Changing The Namespace931793
+Node: Naming Rules933407
+Node: Internal Name Management935255
+Node: Namespace Example936297
+Node: Namespace And Features938859
+Node: Namespace Summary940294
+Node: Arbitrary Precision Arithmetic941771
+Node: Computer Arithmetic943258
+Ref: table-numeric-ranges947024
+Ref: table-floating-point-ranges947517
+Ref: Computer Arithmetic-Footnote-1948175
+Node: Math Definitions948232
+Ref: table-ieee-formats951548
+Ref: Math Definitions-Footnote-1952151
+Node: MPFR features952256
+Node: FP Math Caution953974
+Ref: FP Math Caution-Footnote-1955046
+Node: Inexactness of computations955415
+Node: Inexact representation956375
+Node: Comparing FP Values957735
+Node: Errors accumulate958976
+Node: Getting Accuracy960409
+Node: Try To Round963119
+Node: Setting precision964018
+Ref: table-predefined-precision-strings964715
+Node: Setting the rounding mode966545
+Ref: table-gawk-rounding-modes966919
+Ref: Setting the rounding mode-Footnote-1970850
+Node: Arbitrary Precision Integers971029
+Ref: Arbitrary Precision Integers-Footnote-1974204
+Node: Checking for MPFR974353
+Node: POSIX Floating Point Problems975827
+Ref: POSIX Floating Point Problems-Footnote-1980112
+Node: Floating point summary980150
+Node: Dynamic Extensions982340
+Node: Extension Intro983893
+Node: Plugin License985159
+Node: Extension Mechanism Outline985956
+Ref: figure-load-extension986395
+Ref: figure-register-new-function987960
+Ref: figure-call-new-function989052
+Node: Extension API Description991114
+Node: Extension API Functions Introduction992756
+Ref: table-api-std-headers994592
+Node: General Data Types998457
+Ref: General Data Types-Footnote-11006818
+Node: Memory Allocation Functions1007117
+Ref: Memory Allocation Functions-Footnote-11011327
+Node: Constructor Functions1011426
+Node: Registration Functions1015012
+Node: Extension Functions1015697
+Node: Exit Callback Functions1021019
+Node: Extension Version String1022269
+Node: Input Parsers1022932
+Node: Output Wrappers1035653
+Node: Two-way processors1040165
+Node: Printing Messages1042430
+Ref: Printing Messages-Footnote-11043601
+Node: Updating ERRNO1043754
+Node: Requesting Values1044493
+Ref: table-value-types-returned1045230
+Node: Accessing Parameters1046166
+Node: Symbol Table Access1047401
+Node: Symbol table by name1047913
+Ref: Symbol table by name-Footnote-11050937
+Node: Symbol table by cookie1051065
+Ref: Symbol table by cookie-Footnote-11055250
+Node: Cached values1055314
+Ref: Cached values-Footnote-11058850
+Node: Array Manipulation1059003
+Ref: Array Manipulation-Footnote-11060094
+Node: Array Data Types1060131
+Ref: Array Data Types-Footnote-11062789
+Node: Array Functions1062881
+Node: Flattening Arrays1067379
+Node: Creating Arrays1074355
+Node: Redirection API1079122
+Node: Extension API Variables1081955
+Node: Extension Versioning1082666
+Ref: gawk-api-version1083095
+Node: Extension GMP/MPFR Versioning1084826
+Node: Extension API Informational Variables1086454
+Node: Extension API Boilerplate1087527
+Node: Changes from API V11091501
+Node: Finding Extensions1093073
+Node: Extension Example1093632
+Node: Internal File Description1094430
+Node: Internal File Ops1098510
+Ref: Internal File Ops-Footnote-11109860
+Node: Using Internal File Ops1110000
+Ref: Using Internal File Ops-Footnote-11112383
+Node: Extension Samples1112657
+Node: Extension Sample File Functions1114186
+Node: Extension Sample Fnmatch1121835
+Node: Extension Sample Fork1123322
+Node: Extension Sample Inplace1124540
+Node: Extension Sample Ord1128165
+Node: Extension Sample Readdir1129001
+Ref: table-readdir-file-types1129890
+Node: Extension Sample Revout1130957
+Node: Extension Sample Rev2way1131546
+Node: Extension Sample Read write array1132286
+Node: Extension Sample Readfile1134228
+Node: Extension Sample Time1135323
+Node: Extension Sample API Tests1137075
+Node: gawkextlib1137567
+Node: Extension summary1140485
+Node: Extension Exercises1144187
+Node: Language History1145429
+Node: V7/SVR3.11147085
+Node: SVR41149237
+Node: POSIX1150671
+Node: BTL1152051
+Node: POSIX/GNU1152780
+Node: Feature History1158558
+Node: Common Extensions1174751
+Node: Ranges and Locales1176034
+Ref: Ranges and Locales-Footnote-11180650
+Ref: Ranges and Locales-Footnote-21180677
+Ref: Ranges and Locales-Footnote-31180912
+Node: Contributors1181133
+Node: History summary1187086
+Node: Installation1188466
+Node: Gawk Distribution1189410
+Node: Getting1189894
+Node: Extracting1190857
+Node: Distribution contents1192495
+Node: Unix Installation1198975
+Node: Quick Installation1199657
+Node: Shell Startup Files1202071
+Node: Additional Configuration Options1203160
+Node: Configuration Philosophy1205475
+Node: Non-Unix Installation1207844
+Node: PC Installation1208304
+Node: PC Binary Installation1209142
+Node: PC Compiling1209577
+Node: PC Using1210694
+Node: Cygwin1214247
+Node: MSYS1215471
+Node: VMS Installation1215972
+Node: VMS Compilation1216763
+Ref: VMS Compilation-Footnote-11217992
+Node: VMS Dynamic Extensions1218050
+Node: VMS Installation Details1219735
+Node: VMS Running1221988
+Node: VMS GNV1226267
+Node: VMS Old Gawk1227002
+Node: Bugs1227473
+Node: Bug address1228136
+Node: Usenet1231118
+Node: Maintainers1232122
+Node: Other Versions1233383
+Node: Installation summary1240471
+Node: Notes1241673
+Node: Compatibility Mode1242467
+Node: Additions1243249
+Node: Accessing The Source1244174
+Node: Adding Code1245611
+Node: New Ports1251830
+Node: Derived Files1256205
+Ref: Derived Files-Footnote-11261865
+Ref: Derived Files-Footnote-21261900
+Ref: Derived Files-Footnote-31262498
+Node: Future Extensions1262612
+Node: Implementation Limitations1263270
+Node: Extension Design1264453
+Node: Old Extension Problems1265597
+Ref: Old Extension Problems-Footnote-11267115
+Node: Extension New Mechanism Goals1267172
+Ref: Extension New Mechanism Goals-Footnote-11270536
+Node: Extension Other Design Decisions1270725
+Node: Extension Future Growth1272838
+Node: Notes summary1273674
+Node: Basic Concepts1274832
+Node: Basic High Level1275513
+Ref: figure-general-flow1275795
+Ref: figure-process-flow1276480
+Ref: Basic High Level-Footnote-11279781
+Node: Basic Data Typing1279966
+Node: Glossary1283294
+Node: Copying1315132
+Node: GNU Free Documentation License1352675
+Node: Index1377795

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 5e344e52..1a41f880 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -17183,6 +17183,12 @@ which in turn come before all subarrays.
(Subarrays have not been described yet;
@pxref{Arrays of Arrays}.)
+If you choose to use this feature in traversing @code{FUNCTAB}
+(@pxref{Auto-set}), then the order is built-in functions first
+(@pxref{Built-in}), then user-defined functions (@pxref{User-defined})
+next, and finally functions loaded from an extension
+(@pxref{Dynamic Extensions}).
+
@item "@@val_str_asc"
Order by element values in ascending order (rather than by indices). Scalar values are
compared as strings. Subarrays, if present, come out last.
@@ -18303,6 +18309,13 @@ a[2] = "last"
a[3] = "middle"
@end example
+@quotation NOTE
+Due to implementation limitations, you may not use either @code{SYMTAB}
+or @code{FUNCTAB} as arguments to these functions, even if providing a
+second array to use for the actual sorting. Attempting to do so produces
+a fatal error. This restriction may be lifted in the future.
+@end quotation
+
@item @code{gensub(@var{regexp}, @var{replacement}, @var{how}} [@code{, @var{target}}]@code{) #}
@cindexgawkfunc{gensub}
@cindex search and replace in strings
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index f2be74ca..fe2cc17c 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -16452,6 +16452,12 @@ which in turn come before all subarrays.
(Subarrays have not been described yet;
@pxref{Arrays of Arrays}.)
+If you choose to use this feature in traversing @code{FUNCTAB}
+(@pxref{Auto-set}), then the order is built-in functions first
+(@pxref{Built-in}), then user-defined functions (@pxref{User-defined})
+next, and finally functions loaded from an extension
+(@pxref{Dynamic Extensions}).
+
@item "@@val_str_asc"
Order by element values in ascending order (rather than by indices). Scalar values are
compared as strings. Subarrays, if present, come out last.
@@ -17572,6 +17578,13 @@ a[2] = "last"
a[3] = "middle"
@end example
+@quotation NOTE
+Due to implementation limitations, you may not use either @code{SYMTAB}
+or @code{FUNCTAB} as arguments to these functions, even if providing a
+second array to use for the actual sorting. Attempting to do so produces
+a fatal error. This restriction may be lifted in the future.
+@end quotation
+
@item @code{gensub(@var{regexp}, @var{replacement}, @var{how}} [@code{, @var{target}}]@code{) #}
@cindexgawkfunc{gensub}
@cindex search and replace in strings
diff --git a/test/ChangeLog b/test/ChangeLog
index c188931b..b4ba26ff 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-23 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): New test, symtab11.
+ * symtab11.awk, symtab11.ok: New files.
+
2020-01-19 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (EXTRA_DIST): New test, profile13.
diff --git a/test/Makefile.am b/test/Makefile.am
index bf77ea34..677b7551 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,7 +1,7 @@
#
# test/Makefile.am --- automake input file for gawk
#
-# Copyright (C) 1988-2019 the Free Software Foundation, Inc.
+# Copyright (C) 1988-2020 the Free Software Foundation, Inc.
#
# This file is part of GAWK, the GNU implementation of the
# AWK Programming Language.
@@ -1226,6 +1226,8 @@ EXTRA_DIST = \
symtab10.awk \
symtab10.in \
symtab10.ok \
+ symtab11.awk \
+ symtab11.ok \
synerr1.awk \
synerr1.ok \
synerr2.awk \
@@ -1402,8 +1404,8 @@ GAWK_EXT_TESTS = \
sourcesplit split_after_fpat \
splitarg4 strftfld strftime strtonum strtonum1 \
stupid1 stupid2 stupid3 stupid4 \
- switch2 symtab1 symtab2 \
- symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \
+ switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 symtab7
+ symtab8 symtab9 symtab10 symtab11 \
timeout typedregex1 typedregex2 typedregex3 typedregex4 \
typedregex5 typedregex6 \
typeof1 typeof2 typeof3 typeof4 typeof5 \
diff --git a/test/Makefile.in b/test/Makefile.in
index 0794b3b8..5543ea46 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -17,7 +17,7 @@
#
# test/Makefile.am --- automake input file for gawk
#
-# Copyright (C) 1988-2019 the Free Software Foundation, Inc.
+# Copyright (C) 1988-2020 the Free Software Foundation, Inc.
#
# This file is part of GAWK, the GNU implementation of the
# AWK Programming Language.
@@ -1485,6 +1485,8 @@ EXTRA_DIST = \
symtab10.awk \
symtab10.in \
symtab10.ok \
+ symtab11.awk \
+ symtab11.ok \
synerr1.awk \
synerr1.ok \
synerr2.awk \
@@ -1661,12 +1663,7 @@ GAWK_EXT_TESTS = \
sourcesplit split_after_fpat \
splitarg4 strftfld strftime strtonum strtonum1 \
stupid1 stupid2 stupid3 stupid4 \
- switch2 symtab1 symtab2 \
- symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \
- timeout typedregex1 typedregex2 typedregex3 typedregex4 \
- typedregex5 typedregex6 \
- typeof1 typeof2 typeof3 typeof4 typeof5 \
- watchpoint1
+ switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 symtab7
ARRAYDEBUG_TESTS = arrdbg
EXTRA_TESTS = inftest regtest ignrcas3
@@ -2007,6 +2004,11 @@ uninstall-am:
.PRECIOUS: Makefile
+ symtab8 symtab9 symtab10 symtab11 \
+ timeout typedregex1 typedregex2 typedregex3 typedregex4 \
+ typedregex5 typedregex6 \
+ typeof1 typeof2 typeof3 typeof4 typeof5 \
+ watchpoint1
# Message stuff is to make it a little easier to follow.
# Make the pass-fail last and dependent on others to avoid
@@ -4820,66 +4822,6 @@ symtab7:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-symtab10:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --debug < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-timeout:
- @echo $@ $(ZOS_FAIL)
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typedregex1:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typedregex2:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typedregex3:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typedregex5:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typedregex6:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typeof1:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typeof2:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typeof3:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typeof4:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typeof5:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
double1:
@echo $@ $(ZOS_FAIL)
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index d8c3299a..8f3fbe49 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1971,66 +1971,6 @@ symtab7:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-symtab10:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --debug < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-timeout:
- @echo $@ $(ZOS_FAIL)
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typedregex1:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typedregex2:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typedregex3:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typedregex5:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typedregex6:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typeof1:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typeof2:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typeof3:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typeof4:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-typeof5:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
double1:
@echo $@ $(ZOS_FAIL)
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/symtab11.awk b/test/symtab11.awk
new file mode 100644
index 00000000..ec7f096b
--- /dev/null
+++ b/test/symtab11.awk
@@ -0,0 +1,30 @@
+BEGIN {
+ PROCINFO["sorted_in"] = "@val_type_asc" # okay with PROCINFO commented out, kaboom if not
+ IGNORECASE = 1 # yes
+
+ printf("BEGIN -- Symtab is next\n") > "/dev/stdout"
+ for (i in SYMTAB) {
+ printf "[%s]\n", i # else {printf("[%s]\t(%s)\n",i,SYMTAB[i]);}
+ }
+ printf("BEGIN-- after Symtab loop\n") > "/dev/stdout" # never got here
+
+ printf("BEGIN -- Functab is next\n") > "/dev/stdout"
+ for (i in FUNCTAB) {
+ printf "[%s]\n", i # else {printf("[%s]\t(%s)\n",i,FUNCTAB[i]);}
+ }
+ printf("BEGIN-- after Functab loop\n") > "/dev/stdout" # never got here
+ exit
+}
+
+function foo()
+{
+ print "foo called"
+}
+
+function bar()
+{
+ print "bar called"
+}
+
+# e-o-begin
+# --- No END, No Main ... ---
diff --git a/test/symtab11.ok b/test/symtab11.ok
new file mode 100644
index 00000000..c5e3e0fc
--- /dev/null
+++ b/test/symtab11.ok
@@ -0,0 +1,76 @@
+BEGIN -- Symtab is next
+[i]
+[ROUNDMODE]
+[ORS]
+[OFS]
+[LINT]
+[FNR]
+[ERRNO]
+[NR]
+[IGNORECASE]
+[TEXTDOMAIN]
+[NF]
+[ARGIND]
+[ARGC]
+[FIELDWIDTHS]
+[CONVFMT]
+[SUBSEP]
+[PREC]
+[RS]
+[FPAT]
+[RT]
+[RLENGTH]
+[OFMT]
+[FS]
+[RSTART]
+[FILENAME]
+[BINMODE]
+[ARGV]
+[PROCINFO]
+[ENVIRON]
+BEGIN-- after Symtab loop
+BEGIN -- Functab is next
+[rand]
+[dcgettext]
+[gsub]
+[match]
+[int]
+[log]
+[sprintf]
+[systime]
+[strftime]
+[length]
+[and]
+[srand]
+[asort]
+[atan2]
+[cos]
+[split]
+[compl]
+[bindtextdomain]
+[exp]
+[or]
+[fflush]
+[gensub]
+[dcngettext]
+[index]
+[system]
+[sqrt]
+[rshift]
+[tolower]
+[sin]
+[asorti]
+[typeof]
+[close]
+[mktime]
+[isarray]
+[patsplit]
+[sub]
+[substr]
+[xor]
+[lshift]
+[strtonum]
+[toupper]
+[bar]
+[foo]
+BEGIN-- after Functab loop