aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2021-08-26 22:01:10 +0300
committerArnold D. Robbins <arnold@skeeve.com>2021-08-26 22:01:10 +0300
commit340b2837d42b956dbf9d34f9a66c674bb62ca377 (patch)
tree5ff147390f457eebc06628bcca06cb6d7c59d0c9
parent251db3795ba7dc4054c2df486c0e0e91e0b28f58 (diff)
parent585a9456283db7169ea53a328824e55deb998d8f (diff)
downloadegawk-340b2837d42b956dbf9d34f9a66c674bb62ca377.tar.gz
egawk-340b2837d42b956dbf9d34f9a66c674bb62ca377.tar.bz2
egawk-340b2837d42b956dbf9d34f9a66c674bb62ca377.zip
Merge branch 'gawk-5.1-stable'
-rw-r--r--ChangeLog16
-rw-r--r--builtin.c36
-rwxr-xr-xconfigure3
-rw-r--r--configure.ac3
-rw-r--r--doc/ChangeLog7
-rw-r--r--doc/gawk.info1040
-rw-r--r--doc/gawk.texi21
-rw-r--r--doc/gawktexi.in21
-rw-r--r--pc/Makefile.tst7
-rw-r--r--support/ChangeLog5
-rw-r--r--support/Makefile.am2
-rw-r--r--test/ChangeLog5
-rw-r--r--test/Makefile.am4
-rw-r--r--test/Makefile.in9
-rw-r--r--test/Maketests5
-rw-r--r--test/regexsub.awk48
-rw-r--r--test/regexsub.ok30
17 files changed, 741 insertions, 521 deletions
diff --git a/ChangeLog b/ChangeLog
index 8f308c2a..ae33e89f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2021-08-15 Arnold D. Robbins <arnold@skeeve.com>
+
+ Allow setting AR and ARFLAGS on the configure command line.
+ Thanks to Jacob Burkholder <jake.burkholder2@gmail.com> for
+ the report.
+
+ * configure.ac (AR_FLAGS): Provide default value.
+ (AR): Call AC_SUBST on it.
+
+2021-08-13 Arnold D. Robbins <arnold@skeeve.com>
+
+ * builtin.c (do_sub): Rationalize handling of strongly typed
+ regex as argument to sub/gsub, as well as rationalize the return
+ value from gensub to always be string. Thanks to John Naman
+ <jnaman2@gmail.com> for the bug report.
+
2021-08-05 Andrew J. Schorr <aschorr@telemetry-investments.com>
* mpfr.c (do_mpfr_func): New argument, warn_negative. If true,
diff --git a/builtin.c b/builtin.c
index fe87cbe6..087f1ab0 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2934,8 +2934,6 @@ do_sub(int nargs, unsigned int flags)
RESTART(rp, target->stptr) > target->stlen)
goto done;
- target->flags |= STRING;
-
text = target->stptr;
textlen = target->stlen;
@@ -3183,6 +3181,10 @@ done:
DEREF(target);
assert(buf != NULL);
return make_str_node(buf, textlen, ALREADY_MALLOCED);
+ } else if ((target->flags & STRING) == 0) {
+ /* return a copy of original string */
+ DEREF(target);
+ return make_str_node(target->stptr, target->stlen, 0);
}
/* return the original string */
@@ -3193,8 +3195,34 @@ done:
if ((flags & LITERAL) != 0)
DEREF(target);
else if (matches > 0) {
- unref(*lhs);
- *lhs = make_str_node(buf, textlen, ALREADY_MALLOCED);
+ /*
+ * 8/2021: There's a bit of a song and dance here. If someone does
+ *
+ * x = @/abc/
+ * sub(/b/, "x", x)
+ *
+ * What should the type of x be after the call? Does it get converted
+ * to string? Or does it remain a regexp? We've decided to let it
+ * remain a regexp. In that case, we have to update the compiled
+ * regular expression that it holds.
+ */
+ bool is_regex = false;
+ NODE *target = *lhs;
+
+ if ((target->flags & REGEX) != 0) {
+ is_regex = true;
+
+ // free old regex registers
+ refree(target->typed_re->re_reg[0]);
+ if (target->typed_re->re_reg[1] != NULL)
+ refree(target->typed_re->re_reg[1]);
+ freenode(target->typed_re);
+ }
+ unref(*lhs); // nuke original value
+ if (is_regex)
+ *lhs = make_typed_regex(buf, textlen);
+ else
+ *lhs = make_str_node(buf, textlen, ALREADY_MALLOCED);
}
return make_number((AWKNUM) matches);
diff --git a/configure b/configure
index f3d59cc6..00d257d6 100755
--- a/configure
+++ b/configure
@@ -5677,6 +5677,9 @@ unknown)
esac
+AR_FLAGS = cru # set default
+
+
# This is mainly for my use during testing and development.
# Yes, it's a bit of a hack.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for special development options" >&5
diff --git a/configure.ac b/configure.ac
index c8abd7db..b5adf13f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,6 +110,9 @@ AC_PROG_MAKE_SET
# support/ builds libsupport.a, allow for cross version of ar
AM_PROG_AR
+AR_FLAGS = cru # set default
+AC_SUBST(AR)
+
# This is mainly for my use during testing and development.
# Yes, it's a bit of a hack.
AC_MSG_CHECKING([for special development options])
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 31cace78..efb3728e 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,10 @@
+2021-08-26 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Strong Regexp Constants): Document behavior
+ when used as third argument of sub() or gsub().
+ (String Functions): Document that gensub() always returns
+ a string.
+
2021-07-15 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in: Remove obsolete bits relating to VMS.
diff --git a/doc/gawk.info b/doc/gawk.info
index cc34390f..a71a01d3 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -8265,6 +8265,18 @@ and on to the built-in functions that accept regexp constants.
convert to zero. When used in string conversions, they convert to the
string value of the original regexp text.
+ There is an additional, interesting corner case. When used as the
+third argument to 'sub()' or 'gsub()', they retain their type. Thus, if
+you have something like this:
+
+ re = don't panic/
+ sub(/don't/, "do", re)
+ print typeof(re), re
+
+then 're' retains its type, but now attempts to match the string 'do
+panic'. This provides a (very indirect) way to create regexp-typed
+variables at runtime.
+

File: gawk.info, Node: Variables, Next: Conversion, Prev: Using Constant Regexps, Up: Values
@@ -13091,6 +13103,9 @@ Options::):
modified string as the result of the function. The original target
string is _not_ changed.
+ The returned value is _always_ a string, even if the original
+ TARGET was a number or a regexp value.
+
'gensub()' is a general substitution function. Its purpose is to
provide more features than the standard 'sub()' and 'gsub()'
functions.
@@ -13130,7 +13145,8 @@ Options::):
warning message.
If REGEXP does not match TARGET, 'gensub()''s return value is the
- original unchanged value of TARGET.
+ original unchanged value of TARGET. Note that, as mentioned above,
+ the returned value is a string, even if TARGET was not.
'gsub(REGEXP, REPLACEMENT' [', TARGET']')'
Search TARGET for _all_ of the longest, leftmost, _nonoverlapping_
@@ -35045,7 +35061,7 @@ Index
* * (asterisk), *= operator <1>: Precedence. (line 94)
* * (asterisk), **= operator <1>: Precedence. (line 94)
* * (asterisk), * operator, null strings, matching: String Functions.
- (line 552)
+ (line 556)
* + (plus sign), regexp operator: Regexp Operator Details.
(line 107)
* + (plus sign), += operator: Assignment Ops. (line 81)
@@ -35427,7 +35443,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 211)
+* arrays, number of elements: String Functions. (line 215)
* arrays, as parameters to functions: Pass By Value/Reference.
(line 44)
* arrays, associative, library functions and: Library Names. (line 58)
@@ -35486,7 +35502,7 @@ Index
* asterisk (*), *= operator <1>: Precedence. (line 94)
* asterisk (*), **= operator <1>: Precedence. (line 94)
* asterisk (*), * operator, null strings, matching: String Functions.
- (line 552)
+ (line 556)
* at-sign (@), @include directive: Include Files. (line 8)
* at-sign (@), @load directive: Loading Shared Libraries.
(line 8)
@@ -35732,7 +35748,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 508)
+* Brian Kernighan's awk <12>: String Functions. (line 512)
* 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)
@@ -35796,7 +35812,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 538)
+* case sensitivity, converting case: String Functions. (line 542)
* case sensitivity, example programs: Library Functions. (line 53)
* CGI, awk scripts for: Options. (line 147)
* character sets (machine character encodings): Ordinal Functions.
@@ -35880,7 +35896,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 211)
+ (line 215)
* common extensions, func keyword: Definition Syntax. (line 99)
* common extensions, BINMODE variable: PC Using. (line 20)
* comp.lang.awk newsgroup: Usenet. (line 11)
@@ -35938,9 +35954,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 406)
-* converting, string to lower case: String Functions. (line 539)
-* converting, string to upper case: String Functions. (line 545)
+* converting, string to numbers <1>: String Functions. (line 410)
+* converting, string to lower case: String Functions. (line 543)
+* converting, string to upper case: String Functions. (line 549)
* 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)
@@ -36028,9 +36044,9 @@ Index
* dark corner, array subscripts: Uninitialized Subscripts.
(line 43)
* dark corner, regexp as second argument to index(): String Functions.
- (line 175)
-* dark corner, length() function: String Functions. (line 197)
-* dark corner, split() function: String Functions. (line 376)
+ (line 179)
+* dark corner, length() function: String Functions. (line 201)
+* dark corner, split() function: String Functions. (line 380)
* dark corner, parameter name restrictions: Definition Syntax.
(line 44)
* dark corner <1>: Glossary. (line 266)
@@ -36280,11 +36296,11 @@ Index
* differences in awk and gawk, function arguments: Calling Built-in.
(line 16)
* differences in awk and gawk, length() function: String Functions.
- (line 211)
+ (line 215)
* differences in awk and gawk, match() function: String Functions.
- (line 273)
+ (line 277)
* differences in awk and gawk, split() function: String Functions.
- (line 361)
+ (line 365)
* differences in awk and gawk, indirect function calls: Indirect Calls.
(line 6)
* differences in awk and gawk, BINMODE variable <1>: PC Using.
@@ -36483,7 +36499,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 211)
+ (line 215)
* extensions, common, fflush() function: I/O Functions. (line 43)
* extensions, common, func keyword: Definition Syntax. (line 99)
* extensions, loadable, allocating memory: Memory Allocation Functions.
@@ -36615,7 +36631,7 @@ Index
(line 80)
* files, message object, converting from portable object files: I18N Example.
(line 80)
-* find substring in string: String Functions. (line 166)
+* find substring in string: String Functions. (line 170)
* finding extensions: Finding Extensions. (line 6)
* finish debugger command: Debugger Execution Control.
(line 39)
@@ -36652,7 +36668,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 399)
+* formatting, strings: String Functions. (line 403)
* forward slash (/), to enclose regular expressions: Regexp. (line 10)
* forward slash (/), /= operator: Assignment Ops. (line 129)
* forward slash (/), /= operator, vs. /=.../ regexp constant: Assignment Ops.
@@ -36938,8 +36954,8 @@ Index
* groups, information about: Group Functions. (line 6)
* gsub: Standard Regexp Constants.
(line 43)
-* gsub <1>: String Functions. (line 150)
-* gsub() function, arguments of: String Functions. (line 478)
+* gsub <1>: String Functions. (line 154)
+* gsub() function, arguments of: String Functions. (line 482)
* gsub() function, escape processing: Gory Details. (line 6)
* Guerrero, Juan Manuel: Acknowledgments. (line 60)
* Guerrero, Juan Manuel <1>: Contributors. (line 150)
@@ -37006,7 +37022,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 166)
+* index: String Functions. (line 170)
* indexing arrays: Array Intro. (line 48)
* indirect function calls: Indirect Calls. (line 6)
* indirect function calls, @-notation: Indirect Calls. (line 47)
@@ -37032,7 +37048,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 188)
+* input record, length of: String Functions. (line 192)
* 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)
@@ -37144,9 +37160,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 181)
-* length of input record: String Functions. (line 188)
-* length of string: String Functions. (line 181)
+* length: String Functions. (line 185)
+* length of input record: String Functions. (line 192)
+* length of string: String Functions. (line 185)
* Lesser General Public License (LGPL): Glossary. (line 489)
* LGPL (Lesser General Public License): Glossary. (line 489)
* libmawk: Other Versions. (line 146)
@@ -37236,15 +37252,15 @@ Index
* marked string extraction (internationalization): String Extraction.
(line 6)
* Marx, Groucho: Increment Ops. (line 60)
-* match: String Functions. (line 221)
-* match regexp in string: String Functions. (line 221)
+* match: String Functions. (line 225)
+* match regexp in string: String Functions. (line 225)
* match() function, RSTART/RLENGTH variables: String Functions.
- (line 238)
-* match() function, side effects: String Functions. (line 238)
+ (line 242)
+* match() function, side effects: String Functions. (line 242)
* matching, leftmost longest: Multiple Line. (line 26)
* matching, expressions: Typing and Comparison.
(line 9)
-* matching, null strings: String Functions. (line 552)
+* matching, null strings: String Functions. (line 556)
* mawk utility: Escape Sequences. (line 121)
* mawk utility <1>: Getline/Pipe. (line 62)
* mawk utility <2>: Concatenation. (line 36)
@@ -37374,9 +37390,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 552)
+* null strings, matching: String Functions. (line 556)
* null strings <3>: Basic Data Typing. (line 26)
-* number of array elements: String Functions. (line 211)
+* number of array elements: String Functions. (line 215)
* number sign (#), #! (executable scripts): Executable Scripts.
(line 6)
* number sign (#), commenting: Comments. (line 6)
@@ -37485,7 +37501,7 @@ Index
(line 77)
* parentheses (), in a profile: Profiling. (line 146)
* password file: Passwd Functions. (line 16)
-* patsplit: String Functions. (line 307)
+* patsplit: String Functions. (line 311)
* patterns, default: Very Simple. (line 35)
* patterns, regexp constants as: Regexp Usage. (line 6)
* patterns: Patterns and Actions.
@@ -37548,8 +37564,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 190)
-* portability, substr() function: String Functions. (line 528)
+* portability, length() function: String Functions. (line 194)
+* portability, substr() function: String Functions. (line 532)
* portability, functions, defining: Definition Syntax. (line 114)
* portability, next statement in user-defined functions: Function Caveats.
(line 26)
@@ -37603,7 +37619,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 190)
+* POSIX awk, functions and, length(): String Functions. (line 194)
* 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)
@@ -37624,7 +37640,7 @@ Index
(line 12)
* POSIX mode <9>: POSIX String Comparison.
(line 34)
-* POSIX mode <10>: String Functions. (line 395)
+* POSIX mode <10>: String Functions. (line 399)
* POSIX mode <11>: Controlling Array Traversal.
(line 226)
* POSIX mode <12>: POSIX Floating Point Problems.
@@ -37843,7 +37859,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 424)
+* replace in string: String Functions. (line 428)
* retrying input: Retrying Input. (line 6)
* return debugger command: Debugger Execution Control.
(line 54)
@@ -37868,7 +37884,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 238)
+* RLENGTH variable, match() function and: String Functions. (line 242)
* Robbins, Miriam: Acknowledgments. (line 94)
* Robbins, Jean: Acknowledgments. (line 94)
* Robbins, Harry: Acknowledgments. (line 94)
@@ -37898,7 +37914,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 238)
+* RSTART variable, match() function and: String Functions. (line 242)
* RT variable: awk split records. (line 118)
* RT variable <1>: gawk split records. (line 66)
* RT variable <2>: Multiple Line. (line 139)
@@ -37925,7 +37941,7 @@ Index
* Schreiber, Bert: Acknowledgments. (line 38)
* Schreiber, Rita: Acknowledgments. (line 38)
* search and replace in strings: String Functions. (line 99)
-* search for substring: String Functions. (line 166)
+* search for substring: String Functions. (line 170)
* search paths, for source files: AWKPATH Variable. (line 6)
* search paths, for loadable extensions: AWKLIBPATH Variable. (line 6)
* search paths: Programs Exercises. (line 70)
@@ -38007,9 +38023,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 238)
-* side effects, sub() function: String Functions. (line 478)
-* side effects, gsub() function: String Functions. (line 478)
+* side effects, match() function: String Functions. (line 242)
+* side effects, sub() function: String Functions. (line 482)
+* side effects, gsub() function: String Functions. (line 482)
* side effects, asort() function: Array Sorting Functions.
(line 24)
* side effects, asorti() function: Array Sorting Functions.
@@ -38045,7 +38061,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 550)
+* sidebar, Matching the Null String: String Functions. (line 554)
* sidebar, Interactive Versus Noninteractive Buffering: I/O Functions.
(line 74)
* sidebar, Controlling Output Buffering with system(): I/O Functions.
@@ -38115,13 +38131,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 328)
-* split string into array: String Functions. (line 307)
+* split: String Functions. (line 332)
+* split string into array: String Functions. (line 311)
* split utility: Split Program. (line 6)
* split() function, array elements, deleting: Delete. (line 61)
* split.awk program: Split Program. (line 51)
* sprintf: OFMT. (line 15)
-* sprintf <1>: String Functions. (line 399)
+* sprintf <1>: String Functions. (line 403)
* sprintf() function, print/printf statements and: Round Function.
(line 6)
* sqrt: Numeric Functions. (line 78)
@@ -38156,8 +38172,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 181)
-* string, regular expression match of: String Functions. (line 221)
+* string, length: String Functions. (line 185)
+* string, regular expression match of: String Functions. (line 225)
* string, extraction (internationalization): String Extraction.
(line 6)
* string-manipulation functions: String Functions. (line 6)
@@ -38172,19 +38188,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 347)
-* strings, converting letter case: String Functions. (line 538)
+* strings, splitting, example: String Functions. (line 351)
+* strings, converting letter case: String Functions. (line 542)
* 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 406)
+* strtonum: String Functions. (line 410)
* strtonum() function (gawk), --non-decimal-data option and: Nondecimal Data.
(line 35)
* sub: Standard Regexp Constants.
(line 43)
-* sub <1>: String Functions. (line 424)
-* sub() function, arguments of: String Functions. (line 478)
+* sub <1>: String Functions. (line 428)
+* sub() function, arguments of: String Functions. (line 482)
* sub() function, escape processing: Gory Details. (line 6)
* subscript separators: User-modified. (line 149)
* subscripts in arrays, numbers as: Numeric Array Subscripts.
@@ -38198,8 +38214,8 @@ Index
* SUBSEP variable, multidimensional arrays and: Multidimensional.
(line 16)
* substitute in string: String Functions. (line 99)
-* substr: String Functions. (line 497)
-* substring: String Functions. (line 497)
+* substr: String Functions. (line 501)
+* substring: String Functions. (line 501)
* Sumner, Andrew: Other Versions. (line 64)
* supplementary groups of gawk process: Auto-set. (line 292)
* switch statement: Switch Statement. (line 6)
@@ -38260,8 +38276,8 @@ Index
* timestamps, converting dates to: Time Functions. (line 78)
* timestamps, formatted: Getlocaltime Function.
(line 6)
-* tolower: String Functions. (line 539)
-* toupper: String Functions. (line 545)
+* tolower: String Functions. (line 543)
+* toupper: String Functions. (line 549)
* tr utility: Translate Program. (line 6)
* trace debugger command: Miscellaneous Debugger Commands.
(line 108)
@@ -38293,9 +38309,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 302)
-* troubleshooting, gsub()/sub() functions: String Functions. (line 488)
-* troubleshooting, substr() function: String Functions. (line 515)
+* troubleshooting, match() function: String Functions. (line 306)
+* troubleshooting, gsub()/sub() functions: String Functions. (line 492)
+* troubleshooting, substr() function: String Functions. (line 519)
* troubleshooting, fflush() function: I/O Functions. (line 63)
* troubleshooting, system() function: I/O Functions. (line 128)
* troubleshooting, readable data files: File Checking. (line 6)
@@ -38649,455 +38665,455 @@ Node: Regexp Constants351971
Node: Using Constant Regexps352497
Node: Standard Regexp Constants353119
Node: Strong Regexp Constants356307
-Node: Variables359319
-Node: Using Variables359976
-Node: Assignment Options361886
-Node: Conversion364357
-Node: Strings And Numbers364881
-Ref: Strings And Numbers-Footnote-1367944
-Node: Locale influences conversions368053
-Ref: table-locale-affects370811
-Node: All Operators371429
-Node: Arithmetic Ops372058
-Node: Concatenation374774
-Ref: Concatenation-Footnote-1377621
-Node: Assignment Ops377728
-Ref: table-assign-ops382719
-Node: Increment Ops384032
-Node: Truth Values and Conditions387492
-Node: Truth Values388566
-Node: Typing and Comparison389614
-Node: Variable Typing390434
-Ref: Variable Typing-Footnote-1396897
-Ref: Variable Typing-Footnote-2396969
-Node: Comparison Operators397046
-Ref: table-relational-ops397465
-Node: POSIX String Comparison400960
-Ref: POSIX String Comparison-Footnote-1402655
-Ref: POSIX String Comparison-Footnote-2402794
-Node: Boolean Ops402878
-Ref: Boolean Ops-Footnote-1407360
-Node: Conditional Exp407452
-Node: Function Calls409188
-Node: Precedence413065
-Node: Locales416724
-Node: Expressions Summary418356
-Node: Patterns and Actions420929
-Node: Pattern Overview422049
-Node: Regexp Patterns423726
-Node: Expression Patterns424268
-Node: Ranges428049
-Node: BEGIN/END431157
-Node: Using BEGIN/END431918
-Ref: Using BEGIN/END-Footnote-1434672
-Node: I/O And BEGIN/END434778
-Node: BEGINFILE/ENDFILE437091
-Node: Empty440322
-Node: Using Shell Variables440639
-Node: Action Overview442913
-Node: Statements445238
-Node: If Statement447086
-Node: While Statement448581
-Node: Do Statement450609
-Node: For Statement451757
-Node: Switch Statement454928
-Node: Break Statement457369
-Node: Continue Statement459461
-Node: Next Statement461288
-Node: Nextfile Statement463671
-Node: Exit Statement466360
-Node: Built-in Variables468763
-Node: User-modified469896
-Node: Auto-set477663
-Ref: Auto-set-Footnote-1494470
-Ref: Auto-set-Footnote-2494676
-Node: ARGC and ARGV494732
-Node: Pattern Action Summary498945
-Node: Arrays501375
-Node: Array Basics502704
-Node: Array Intro503548
-Ref: figure-array-elements505523
-Ref: Array Intro-Footnote-1508227
-Node: Reference to Elements508355
-Node: Assigning Elements510819
-Node: Array Example511310
-Node: Scanning an Array513069
-Node: Controlling Scanning516091
-Ref: Controlling Scanning-Footnote-1522547
-Node: Numeric Array Subscripts522863
-Node: Uninitialized Subscripts525047
-Node: Delete526666
-Ref: Delete-Footnote-1529418
-Node: Multidimensional529475
-Node: Multiscanning532570
-Node: Arrays of Arrays534161
-Node: Arrays Summary538929
-Node: Functions541022
-Node: Built-in542060
-Node: Calling Built-in543213
-Node: Boolean Functions545209
-Node: Numeric Functions545763
-Ref: Numeric Functions-Footnote-1549790
-Ref: Numeric Functions-Footnote-2550438
-Ref: Numeric Functions-Footnote-3550486
-Node: String Functions550758
-Ref: String Functions-Footnote-1575068
-Ref: String Functions-Footnote-2575196
-Ref: String Functions-Footnote-3575444
-Node: Gory Details575531
-Ref: table-sub-escapes577322
-Ref: table-sub-proposed578841
-Ref: table-posix-sub580204
-Ref: table-gensub-escapes581745
-Ref: Gory Details-Footnote-1582568
-Node: I/O Functions582722
-Ref: table-system-return-values589176
-Ref: I/O Functions-Footnote-1591256
-Ref: I/O Functions-Footnote-2591404
-Node: Time Functions591524
-Ref: Time Functions-Footnote-1602195
-Ref: Time Functions-Footnote-2602263
-Ref: Time Functions-Footnote-3602421
-Ref: Time Functions-Footnote-4602532
-Ref: Time Functions-Footnote-5602644
-Ref: Time Functions-Footnote-6602871
-Node: Bitwise Functions603137
-Ref: table-bitwise-ops603731
-Ref: Bitwise Functions-Footnote-1609794
-Ref: Bitwise Functions-Footnote-2609967
-Node: Type Functions610158
-Node: I18N Functions613112
-Node: User-defined614763
-Node: Definition Syntax615575
-Ref: Definition Syntax-Footnote-1621269
-Node: Function Example621340
-Ref: Function Example-Footnote-1624262
-Node: Function Calling624284
-Node: Calling A Function624872
-Node: Variable Scope625830
-Node: Pass By Value/Reference628824
-Node: Function Caveats631468
-Ref: Function Caveats-Footnote-1633515
-Node: Return Statement633635
-Node: Dynamic Typing636614
-Node: Indirect Calls637544
-Ref: Indirect Calls-Footnote-1647799
-Node: Functions Summary647927
-Node: Library Functions650632
-Ref: Library Functions-Footnote-1654239
-Ref: Library Functions-Footnote-2654382
-Node: Library Names654553
-Ref: Library Names-Footnote-1658220
-Ref: Library Names-Footnote-2658443
-Node: General Functions658529
-Node: Strtonum Function659711
-Node: Assert Function662733
-Node: Round Function666059
-Node: Cliff Random Function667599
-Node: Ordinal Functions668615
-Ref: Ordinal Functions-Footnote-1671678
-Ref: Ordinal Functions-Footnote-2671930
-Node: Join Function672140
-Ref: Join Function-Footnote-1673910
-Node: Getlocaltime Function674110
-Node: Readfile Function677852
-Node: Shell Quoting679829
-Node: Isnumeric Function681257
-Node: Data File Management682645
-Node: Filetrans Function683277
-Node: Rewind Function687373
-Node: File Checking689282
-Ref: File Checking-Footnote-1690616
-Node: Empty Files690817
-Node: Ignoring Assigns692796
-Node: Getopt Function694346
-Ref: Getopt Function-Footnote-1709569
-Node: Passwd Functions709769
-Ref: Passwd Functions-Footnote-1718608
-Node: Group Functions718696
-Ref: Group Functions-Footnote-1726594
-Node: Walking Arrays726801
-Node: Library Functions Summary729809
-Node: Library Exercises731215
-Node: Sample Programs731680
-Node: Running Examples732450
-Node: Clones733178
-Node: Cut Program734402
-Node: Egrep Program744542
-Node: Id Program753543
-Node: Split Program763490
-Ref: Split Program-Footnote-1773383
-Node: Tee Program773556
-Node: Uniq Program776346
-Node: Wc Program783934
-Node: Bytes vs. Characters784321
-Node: Using extensions785869
-Node: wc program786623
-Node: Miscellaneous Programs791488
-Node: Dupword Program792701
-Node: Alarm Program794731
-Node: Translate Program799586
-Ref: Translate Program-Footnote-1804151
-Node: Labels Program804421
-Ref: Labels Program-Footnote-1807772
-Node: Word Sorting807856
-Node: History Sorting811928
-Node: Extract Program814153
-Node: Simple Sed822207
-Node: Igawk Program825281
-Ref: Igawk Program-Footnote-1839612
-Ref: Igawk Program-Footnote-2839814
-Ref: Igawk Program-Footnote-3839936
-Node: Anagram Program840051
-Node: Signature Program843113
-Node: Programs Summary844360
-Node: Programs Exercises845574
-Ref: Programs Exercises-Footnote-1849704
-Node: Advanced Features849790
-Node: Nondecimal Data851921
-Node: Boolean Typed Values853519
-Node: Array Sorting855400
-Node: Controlling Array Traversal856105
-Ref: Controlling Array Traversal-Footnote-1864473
-Node: Array Sorting Functions864591
-Ref: Array Sorting Functions-Footnote-1869965
-Node: Two-way I/O870161
-Ref: Two-way I/O-Footnote-1877887
-Ref: Two-way I/O-Footnote-2878074
-Node: TCP/IP Networking878156
-Node: Profiling881274
-Node: Extension Philosophy890583
-Node: Advanced Features Summary892062
-Node: Internationalization894077
-Node: I18N and L10N895751
-Node: Explaining gettext896438
-Ref: Explaining gettext-Footnote-1902330
-Ref: Explaining gettext-Footnote-2902515
-Node: Programmer i18n902680
-Ref: Programmer i18n-Footnote-1907629
-Node: Translator i18n907678
-Node: String Extraction908472
-Ref: String Extraction-Footnote-1909604
-Node: Printf Ordering909690
-Ref: Printf Ordering-Footnote-1912476
-Node: I18N Portability912540
-Ref: I18N Portability-Footnote-1914996
-Node: I18N Example915059
-Ref: I18N Example-Footnote-1918334
-Ref: I18N Example-Footnote-2918407
-Node: Gawk I18N918516
-Node: I18N Summary919165
-Node: Debugger920506
-Node: Debugging921506
-Node: Debugging Concepts921947
-Node: Debugging Terms923756
-Node: Awk Debugging926331
-Ref: Awk Debugging-Footnote-1927276
-Node: Sample Debugging Session927408
-Node: Debugger Invocation927942
-Node: Finding The Bug929328
-Node: List of Debugger Commands935802
-Node: Breakpoint Control937135
-Node: Debugger Execution Control940829
-Node: Viewing And Changing Data944191
-Node: Execution Stack947732
-Node: Debugger Info949369
-Node: Miscellaneous Debugger Commands953440
-Node: Readline Support958502
-Node: Limitations959398
-Node: Debugging Summary961952
-Node: Namespaces963231
-Node: Global Namespace964342
-Node: Qualified Names965740
-Node: Default Namespace966739
-Node: Changing The Namespace967480
-Node: Naming Rules969094
-Node: Internal Name Management970942
-Node: Namespace Example971984
-Node: Namespace And Features974546
-Node: Namespace Summary975981
-Node: Arbitrary Precision Arithmetic977458
-Node: Computer Arithmetic978945
-Ref: table-numeric-ranges982711
-Ref: table-floating-point-ranges983204
-Ref: Computer Arithmetic-Footnote-1983862
-Node: Math Definitions983919
-Ref: table-ieee-formats986895
-Node: MPFR features987462
-Node: FP Math Caution989180
-Ref: FP Math Caution-Footnote-1990252
-Node: Inexactness of computations990621
-Node: Inexact representation991652
-Node: Comparing FP Values993012
-Node: Errors accumulate994253
-Node: Strange values995709
-Ref: Strange values-Footnote-1998297
-Node: Getting Accuracy998402
-Node: Try To Round1001112
-Node: Setting precision1002011
-Ref: table-predefined-precision-strings1002708
-Node: Setting the rounding mode1004538
-Ref: table-gawk-rounding-modes1004912
-Ref: Setting the rounding mode-Footnote-11008843
-Node: Arbitrary Precision Integers1009022
-Ref: Arbitrary Precision Integers-Footnote-11012197
-Node: Checking for MPFR1012346
-Node: POSIX Floating Point Problems1013820
-Ref: POSIX Floating Point Problems-Footnote-11018105
-Node: Floating point summary1018143
-Node: Dynamic Extensions1020333
-Node: Extension Intro1021886
-Node: Plugin License1023152
-Node: Extension Mechanism Outline1023949
-Ref: figure-load-extension1024388
-Ref: figure-register-new-function1025953
-Ref: figure-call-new-function1027045
-Node: Extension API Description1029107
-Node: Extension API Functions Introduction1030820
-Ref: table-api-std-headers1032656
-Node: General Data Types1036905
-Ref: General Data Types-Footnote-11045611
-Node: Memory Allocation Functions1045910
-Ref: Memory Allocation Functions-Footnote-11050411
-Node: Constructor Functions1050510
-Node: API Ownership of MPFR and GMP Values1054163
-Node: Registration Functions1055476
-Node: Extension Functions1056176
-Node: Exit Callback Functions1061498
-Node: Extension Version String1062748
-Node: Input Parsers1063411
-Node: Output Wrappers1076132
-Node: Two-way processors1080644
-Node: Printing Messages1082909
-Ref: Printing Messages-Footnote-11084080
-Node: Updating ERRNO1084233
-Node: Requesting Values1084972
-Ref: table-value-types-returned1085709
-Node: Accessing Parameters1086817
-Node: Symbol Table Access1088054
-Node: Symbol table by name1088566
-Ref: Symbol table by name-Footnote-11091590
-Node: Symbol table by cookie1091718
-Ref: Symbol table by cookie-Footnote-11095903
-Node: Cached values1095967
-Ref: Cached values-Footnote-11099503
-Node: Array Manipulation1099656
-Ref: Array Manipulation-Footnote-11100747
-Node: Array Data Types1100784
-Ref: Array Data Types-Footnote-11103442
-Node: Array Functions1103534
-Node: Flattening Arrays1108032
-Node: Creating Arrays1115008
-Node: Redirection API1119775
-Node: Extension API Variables1122608
-Node: Extension Versioning1123319
-Ref: gawk-api-version1123748
-Node: Extension GMP/MPFR Versioning1125479
-Node: Extension API Informational Variables1127107
-Node: Extension API Boilerplate1128180
-Node: Changes from API V11132154
-Node: Finding Extensions1133726
-Node: Extension Example1134285
-Node: Internal File Description1135083
-Node: Internal File Ops1139163
-Ref: Internal File Ops-Footnote-11150513
-Node: Using Internal File Ops1150653
-Ref: Using Internal File Ops-Footnote-11153036
-Node: Extension Samples1153310
-Node: Extension Sample File Functions1154839
-Node: Extension Sample Fnmatch1162488
-Node: Extension Sample Fork1163975
-Node: Extension Sample Inplace1165193
-Node: Extension Sample Ord1168819
-Node: Extension Sample Readdir1169655
-Ref: table-readdir-file-types1170544
-Node: Extension Sample Revout1171611
-Node: Extension Sample Rev2way1172200
-Node: Extension Sample Read write array1172940
-Node: Extension Sample Readfile1174882
-Node: Extension Sample Time1175977
-Node: Extension Sample API Tests1177729
-Node: gawkextlib1178221
-Node: Extension summary1181139
-Node: Extension Exercises1184841
-Node: Language History1186083
-Node: V7/SVR3.11187739
-Node: SVR41189891
-Node: POSIX1191325
-Node: BTL1192706
-Node: POSIX/GNU1193435
-Node: Feature History1199213
-Node: Common Extensions1216388
-Node: Ranges and Locales1217671
-Ref: Ranges and Locales-Footnote-11222287
-Ref: Ranges and Locales-Footnote-21222314
-Ref: Ranges and Locales-Footnote-31222549
-Node: Contributors1222772
-Node: History summary1228769
-Node: Installation1230149
-Node: Gawk Distribution1231093
-Node: Getting1231577
-Node: Extracting1232540
-Node: Distribution contents1234178
-Node: Unix Installation1240658
-Node: Quick Installation1241340
-Node: Compiling with MPFR1243821
-Node: Shell Startup Files1244513
-Node: Additional Configuration Options1245602
-Node: Configuration Philosophy1247917
-Node: Non-Unix Installation1250286
-Node: PC Installation1250746
-Node: PC Binary Installation1251584
-Node: PC Compiling1252019
-Node: PC Using1253136
-Node: Cygwin1256689
-Node: MSYS1257913
-Node: VMS Installation1258515
-Node: VMS Compilation1259234
-Ref: VMS Compilation-Footnote-11260463
-Node: VMS Dynamic Extensions1260521
-Node: VMS Installation Details1262206
-Node: VMS Running1264468
-Node: VMS GNV1268747
-Node: Bugs1269461
-Node: Bug definition1270341
-Node: Bug address1272845
-Node: Usenet1276233
-Node: Performance bugs1277242
-Node: Asking for help1280163
-Node: Maintainers1282125
-Node: Other Versions1283319
-Node: Installation summary1291171
-Node: Notes1292535
-Node: Compatibility Mode1293329
-Node: Additions1294111
-Node: Accessing The Source1295036
-Node: Adding Code1296473
-Node: New Ports1302692
-Node: Derived Files1307067
-Ref: Derived Files-Footnote-11312727
-Ref: Derived Files-Footnote-21312762
-Ref: Derived Files-Footnote-31313360
-Node: Future Extensions1313474
-Node: Implementation Limitations1314132
-Node: Extension Design1315342
-Node: Old Extension Problems1316486
-Ref: Old Extension Problems-Footnote-11318004
-Node: Extension New Mechanism Goals1318061
-Ref: Extension New Mechanism Goals-Footnote-11321425
-Node: Extension Other Design Decisions1321614
-Node: Extension Future Growth1323727
-Node: Notes summary1324333
-Node: Basic Concepts1325491
-Node: Basic High Level1326172
-Ref: figure-general-flow1326454
-Ref: figure-process-flow1327139
-Ref: Basic High Level-Footnote-11330440
-Node: Basic Data Typing1330625
-Node: Glossary1333953
-Node: Copying1365840
-Node: GNU Free Documentation License1403383
-Node: Index1428503
+Node: Variables359731
+Node: Using Variables360388
+Node: Assignment Options362298
+Node: Conversion364769
+Node: Strings And Numbers365293
+Ref: Strings And Numbers-Footnote-1368356
+Node: Locale influences conversions368465
+Ref: table-locale-affects371223
+Node: All Operators371841
+Node: Arithmetic Ops372470
+Node: Concatenation375186
+Ref: Concatenation-Footnote-1378033
+Node: Assignment Ops378140
+Ref: table-assign-ops383131
+Node: Increment Ops384444
+Node: Truth Values and Conditions387904
+Node: Truth Values388978
+Node: Typing and Comparison390026
+Node: Variable Typing390846
+Ref: Variable Typing-Footnote-1397309
+Ref: Variable Typing-Footnote-2397381
+Node: Comparison Operators397458
+Ref: table-relational-ops397877
+Node: POSIX String Comparison401372
+Ref: POSIX String Comparison-Footnote-1403067
+Ref: POSIX String Comparison-Footnote-2403206
+Node: Boolean Ops403290
+Ref: Boolean Ops-Footnote-1407772
+Node: Conditional Exp407864
+Node: Function Calls409600
+Node: Precedence413477
+Node: Locales417136
+Node: Expressions Summary418768
+Node: Patterns and Actions421341
+Node: Pattern Overview422461
+Node: Regexp Patterns424138
+Node: Expression Patterns424680
+Node: Ranges428461
+Node: BEGIN/END431569
+Node: Using BEGIN/END432330
+Ref: Using BEGIN/END-Footnote-1435084
+Node: I/O And BEGIN/END435190
+Node: BEGINFILE/ENDFILE437503
+Node: Empty440734
+Node: Using Shell Variables441051
+Node: Action Overview443325
+Node: Statements445650
+Node: If Statement447498
+Node: While Statement448993
+Node: Do Statement451021
+Node: For Statement452169
+Node: Switch Statement455340
+Node: Break Statement457781
+Node: Continue Statement459873
+Node: Next Statement461700
+Node: Nextfile Statement464083
+Node: Exit Statement466772
+Node: Built-in Variables469175
+Node: User-modified470308
+Node: Auto-set478075
+Ref: Auto-set-Footnote-1494882
+Ref: Auto-set-Footnote-2495088
+Node: ARGC and ARGV495144
+Node: Pattern Action Summary499357
+Node: Arrays501787
+Node: Array Basics503116
+Node: Array Intro503960
+Ref: figure-array-elements505935
+Ref: Array Intro-Footnote-1508639
+Node: Reference to Elements508767
+Node: Assigning Elements511231
+Node: Array Example511722
+Node: Scanning an Array513481
+Node: Controlling Scanning516503
+Ref: Controlling Scanning-Footnote-1522959
+Node: Numeric Array Subscripts523275
+Node: Uninitialized Subscripts525459
+Node: Delete527078
+Ref: Delete-Footnote-1529830
+Node: Multidimensional529887
+Node: Multiscanning532982
+Node: Arrays of Arrays534573
+Node: Arrays Summary539341
+Node: Functions541434
+Node: Built-in542472
+Node: Calling Built-in543625
+Node: Boolean Functions545621
+Node: Numeric Functions546175
+Ref: Numeric Functions-Footnote-1550202
+Ref: Numeric Functions-Footnote-2550850
+Ref: Numeric Functions-Footnote-3550898
+Node: String Functions551170
+Ref: String Functions-Footnote-1575685
+Ref: String Functions-Footnote-2575813
+Ref: String Functions-Footnote-3576061
+Node: Gory Details576148
+Ref: table-sub-escapes577939
+Ref: table-sub-proposed579458
+Ref: table-posix-sub580821
+Ref: table-gensub-escapes582362
+Ref: Gory Details-Footnote-1583185
+Node: I/O Functions583339
+Ref: table-system-return-values589793
+Ref: I/O Functions-Footnote-1591873
+Ref: I/O Functions-Footnote-2592021
+Node: Time Functions592141
+Ref: Time Functions-Footnote-1602812
+Ref: Time Functions-Footnote-2602880
+Ref: Time Functions-Footnote-3603038
+Ref: Time Functions-Footnote-4603149
+Ref: Time Functions-Footnote-5603261
+Ref: Time Functions-Footnote-6603488
+Node: Bitwise Functions603754
+Ref: table-bitwise-ops604348
+Ref: Bitwise Functions-Footnote-1610411
+Ref: Bitwise Functions-Footnote-2610584
+Node: Type Functions610775
+Node: I18N Functions613729
+Node: User-defined615380
+Node: Definition Syntax616192
+Ref: Definition Syntax-Footnote-1621886
+Node: Function Example621957
+Ref: Function Example-Footnote-1624879
+Node: Function Calling624901
+Node: Calling A Function625489
+Node: Variable Scope626447
+Node: Pass By Value/Reference629441
+Node: Function Caveats632085
+Ref: Function Caveats-Footnote-1634132
+Node: Return Statement634252
+Node: Dynamic Typing637231
+Node: Indirect Calls638161
+Ref: Indirect Calls-Footnote-1648416
+Node: Functions Summary648544
+Node: Library Functions651249
+Ref: Library Functions-Footnote-1654856
+Ref: Library Functions-Footnote-2654999
+Node: Library Names655170
+Ref: Library Names-Footnote-1658837
+Ref: Library Names-Footnote-2659060
+Node: General Functions659146
+Node: Strtonum Function660328
+Node: Assert Function663350
+Node: Round Function666676
+Node: Cliff Random Function668216
+Node: Ordinal Functions669232
+Ref: Ordinal Functions-Footnote-1672295
+Ref: Ordinal Functions-Footnote-2672547
+Node: Join Function672757
+Ref: Join Function-Footnote-1674527
+Node: Getlocaltime Function674727
+Node: Readfile Function678469
+Node: Shell Quoting680446
+Node: Isnumeric Function681874
+Node: Data File Management683262
+Node: Filetrans Function683894
+Node: Rewind Function687990
+Node: File Checking689899
+Ref: File Checking-Footnote-1691233
+Node: Empty Files691434
+Node: Ignoring Assigns693413
+Node: Getopt Function694963
+Ref: Getopt Function-Footnote-1710186
+Node: Passwd Functions710386
+Ref: Passwd Functions-Footnote-1719225
+Node: Group Functions719313
+Ref: Group Functions-Footnote-1727211
+Node: Walking Arrays727418
+Node: Library Functions Summary730426
+Node: Library Exercises731832
+Node: Sample Programs732297
+Node: Running Examples733067
+Node: Clones733795
+Node: Cut Program735019
+Node: Egrep Program745159
+Node: Id Program754160
+Node: Split Program764107
+Ref: Split Program-Footnote-1774000
+Node: Tee Program774173
+Node: Uniq Program776963
+Node: Wc Program784551
+Node: Bytes vs. Characters784938
+Node: Using extensions786486
+Node: wc program787240
+Node: Miscellaneous Programs792105
+Node: Dupword Program793318
+Node: Alarm Program795348
+Node: Translate Program800203
+Ref: Translate Program-Footnote-1804768
+Node: Labels Program805038
+Ref: Labels Program-Footnote-1808389
+Node: Word Sorting808473
+Node: History Sorting812545
+Node: Extract Program814770
+Node: Simple Sed822824
+Node: Igawk Program825898
+Ref: Igawk Program-Footnote-1840229
+Ref: Igawk Program-Footnote-2840431
+Ref: Igawk Program-Footnote-3840553
+Node: Anagram Program840668
+Node: Signature Program843730
+Node: Programs Summary844977
+Node: Programs Exercises846191
+Ref: Programs Exercises-Footnote-1850321
+Node: Advanced Features850407
+Node: Nondecimal Data852538
+Node: Boolean Typed Values854136
+Node: Array Sorting856017
+Node: Controlling Array Traversal856722
+Ref: Controlling Array Traversal-Footnote-1865090
+Node: Array Sorting Functions865208
+Ref: Array Sorting Functions-Footnote-1870582
+Node: Two-way I/O870778
+Ref: Two-way I/O-Footnote-1878504
+Ref: Two-way I/O-Footnote-2878691
+Node: TCP/IP Networking878773
+Node: Profiling881891
+Node: Extension Philosophy891200
+Node: Advanced Features Summary892679
+Node: Internationalization894694
+Node: I18N and L10N896368
+Node: Explaining gettext897055
+Ref: Explaining gettext-Footnote-1902947
+Ref: Explaining gettext-Footnote-2903132
+Node: Programmer i18n903297
+Ref: Programmer i18n-Footnote-1908246
+Node: Translator i18n908295
+Node: String Extraction909089
+Ref: String Extraction-Footnote-1910221
+Node: Printf Ordering910307
+Ref: Printf Ordering-Footnote-1913093
+Node: I18N Portability913157
+Ref: I18N Portability-Footnote-1915613
+Node: I18N Example915676
+Ref: I18N Example-Footnote-1918951
+Ref: I18N Example-Footnote-2919024
+Node: Gawk I18N919133
+Node: I18N Summary919782
+Node: Debugger921123
+Node: Debugging922123
+Node: Debugging Concepts922564
+Node: Debugging Terms924373
+Node: Awk Debugging926948
+Ref: Awk Debugging-Footnote-1927893
+Node: Sample Debugging Session928025
+Node: Debugger Invocation928559
+Node: Finding The Bug929945
+Node: List of Debugger Commands936419
+Node: Breakpoint Control937752
+Node: Debugger Execution Control941446
+Node: Viewing And Changing Data944808
+Node: Execution Stack948349
+Node: Debugger Info949986
+Node: Miscellaneous Debugger Commands954057
+Node: Readline Support959119
+Node: Limitations960015
+Node: Debugging Summary962569
+Node: Namespaces963848
+Node: Global Namespace964959
+Node: Qualified Names966357
+Node: Default Namespace967356
+Node: Changing The Namespace968097
+Node: Naming Rules969711
+Node: Internal Name Management971559
+Node: Namespace Example972601
+Node: Namespace And Features975163
+Node: Namespace Summary976598
+Node: Arbitrary Precision Arithmetic978075
+Node: Computer Arithmetic979562
+Ref: table-numeric-ranges983328
+Ref: table-floating-point-ranges983821
+Ref: Computer Arithmetic-Footnote-1984479
+Node: Math Definitions984536
+Ref: table-ieee-formats987512
+Node: MPFR features988079
+Node: FP Math Caution989797
+Ref: FP Math Caution-Footnote-1990869
+Node: Inexactness of computations991238
+Node: Inexact representation992269
+Node: Comparing FP Values993629
+Node: Errors accumulate994870
+Node: Strange values996326
+Ref: Strange values-Footnote-1998914
+Node: Getting Accuracy999019
+Node: Try To Round1001729
+Node: Setting precision1002628
+Ref: table-predefined-precision-strings1003325
+Node: Setting the rounding mode1005155
+Ref: table-gawk-rounding-modes1005529
+Ref: Setting the rounding mode-Footnote-11009460
+Node: Arbitrary Precision Integers1009639
+Ref: Arbitrary Precision Integers-Footnote-11012814
+Node: Checking for MPFR1012963
+Node: POSIX Floating Point Problems1014437
+Ref: POSIX Floating Point Problems-Footnote-11018722
+Node: Floating point summary1018760
+Node: Dynamic Extensions1020950
+Node: Extension Intro1022503
+Node: Plugin License1023769
+Node: Extension Mechanism Outline1024566
+Ref: figure-load-extension1025005
+Ref: figure-register-new-function1026570
+Ref: figure-call-new-function1027662
+Node: Extension API Description1029724
+Node: Extension API Functions Introduction1031437
+Ref: table-api-std-headers1033273
+Node: General Data Types1037522
+Ref: General Data Types-Footnote-11046228
+Node: Memory Allocation Functions1046527
+Ref: Memory Allocation Functions-Footnote-11051028
+Node: Constructor Functions1051127
+Node: API Ownership of MPFR and GMP Values1054780
+Node: Registration Functions1056093
+Node: Extension Functions1056793
+Node: Exit Callback Functions1062115
+Node: Extension Version String1063365
+Node: Input Parsers1064028
+Node: Output Wrappers1076749
+Node: Two-way processors1081261
+Node: Printing Messages1083526
+Ref: Printing Messages-Footnote-11084697
+Node: Updating ERRNO1084850
+Node: Requesting Values1085589
+Ref: table-value-types-returned1086326
+Node: Accessing Parameters1087434
+Node: Symbol Table Access1088671
+Node: Symbol table by name1089183
+Ref: Symbol table by name-Footnote-11092207
+Node: Symbol table by cookie1092335
+Ref: Symbol table by cookie-Footnote-11096520
+Node: Cached values1096584
+Ref: Cached values-Footnote-11100120
+Node: Array Manipulation1100273
+Ref: Array Manipulation-Footnote-11101364
+Node: Array Data Types1101401
+Ref: Array Data Types-Footnote-11104059
+Node: Array Functions1104151
+Node: Flattening Arrays1108649
+Node: Creating Arrays1115625
+Node: Redirection API1120392
+Node: Extension API Variables1123225
+Node: Extension Versioning1123936
+Ref: gawk-api-version1124365
+Node: Extension GMP/MPFR Versioning1126096
+Node: Extension API Informational Variables1127724
+Node: Extension API Boilerplate1128797
+Node: Changes from API V11132771
+Node: Finding Extensions1134343
+Node: Extension Example1134902
+Node: Internal File Description1135700
+Node: Internal File Ops1139780
+Ref: Internal File Ops-Footnote-11151130
+Node: Using Internal File Ops1151270
+Ref: Using Internal File Ops-Footnote-11153653
+Node: Extension Samples1153927
+Node: Extension Sample File Functions1155456
+Node: Extension Sample Fnmatch1163105
+Node: Extension Sample Fork1164592
+Node: Extension Sample Inplace1165810
+Node: Extension Sample Ord1169436
+Node: Extension Sample Readdir1170272
+Ref: table-readdir-file-types1171161
+Node: Extension Sample Revout1172228
+Node: Extension Sample Rev2way1172817
+Node: Extension Sample Read write array1173557
+Node: Extension Sample Readfile1175499
+Node: Extension Sample Time1176594
+Node: Extension Sample API Tests1178346
+Node: gawkextlib1178838
+Node: Extension summary1181756
+Node: Extension Exercises1185458
+Node: Language History1186700
+Node: V7/SVR3.11188356
+Node: SVR41190508
+Node: POSIX1191942
+Node: BTL1193323
+Node: POSIX/GNU1194052
+Node: Feature History1199830
+Node: Common Extensions1217005
+Node: Ranges and Locales1218288
+Ref: Ranges and Locales-Footnote-11222904
+Ref: Ranges and Locales-Footnote-21222931
+Ref: Ranges and Locales-Footnote-31223166
+Node: Contributors1223389
+Node: History summary1229386
+Node: Installation1230766
+Node: Gawk Distribution1231710
+Node: Getting1232194
+Node: Extracting1233157
+Node: Distribution contents1234795
+Node: Unix Installation1241275
+Node: Quick Installation1241957
+Node: Compiling with MPFR1244438
+Node: Shell Startup Files1245130
+Node: Additional Configuration Options1246219
+Node: Configuration Philosophy1248534
+Node: Non-Unix Installation1250903
+Node: PC Installation1251363
+Node: PC Binary Installation1252201
+Node: PC Compiling1252636
+Node: PC Using1253753
+Node: Cygwin1257306
+Node: MSYS1258530
+Node: VMS Installation1259132
+Node: VMS Compilation1259851
+Ref: VMS Compilation-Footnote-11261080
+Node: VMS Dynamic Extensions1261138
+Node: VMS Installation Details1262823
+Node: VMS Running1265085
+Node: VMS GNV1269364
+Node: Bugs1270078
+Node: Bug definition1270958
+Node: Bug address1273462
+Node: Usenet1276850
+Node: Performance bugs1277859
+Node: Asking for help1280780
+Node: Maintainers1282742
+Node: Other Versions1283936
+Node: Installation summary1291788
+Node: Notes1293152
+Node: Compatibility Mode1293946
+Node: Additions1294728
+Node: Accessing The Source1295653
+Node: Adding Code1297090
+Node: New Ports1303309
+Node: Derived Files1307684
+Ref: Derived Files-Footnote-11313344
+Ref: Derived Files-Footnote-21313379
+Ref: Derived Files-Footnote-31313977
+Node: Future Extensions1314091
+Node: Implementation Limitations1314749
+Node: Extension Design1315959
+Node: Old Extension Problems1317103
+Ref: Old Extension Problems-Footnote-11318621
+Node: Extension New Mechanism Goals1318678
+Ref: Extension New Mechanism Goals-Footnote-11322042
+Node: Extension Other Design Decisions1322231
+Node: Extension Future Growth1324344
+Node: Notes summary1324950
+Node: Basic Concepts1326108
+Node: Basic High Level1326789
+Ref: figure-general-flow1327071
+Ref: figure-process-flow1327756
+Ref: Basic High Level-Footnote-11331057
+Node: Basic Data Typing1331242
+Node: Glossary1334570
+Node: Copying1366457
+Node: GNU Free Documentation License1404000
+Node: Index1429120

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 84612764..90159fdb 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -11998,6 +11998,21 @@ When used in numeric conversions, strongly typed regexp variables convert
to zero. When used in string conversions, they convert to the string
value of the original regexp text.
+There is an additional, interesting corner case. When used as the third
+argument to @code{sub()} or @code{gsub()}, they retain their type. Thus,
+if you have something like this:
+
+@example
+re = @/don't panic/
+sub(/don't/, "do", re)
+print typeof(re), re
+@end example
+
+@noindent
+then @code{re} retains its type, but now attempts to match the string
+@samp{do panic}. This provides a (very indirect) way to create regexp-typed
+variables at runtime.
+
@node Variables
@subsection Variables
@@ -18710,6 +18725,9 @@ numeric values less than one as if they were one. If no @var{target}
is supplied, use @code{$0}. Return the modified string as the result
of the function. The original target string is @emph{not} changed.
+The returned value is @emph{always} a string, even if the original
+@var{target} was a number or a regexp value.
+
@code{gensub()} is a general substitution function. Its purpose is
to provide more features than the standard @code{sub()} and @code{gsub()}
functions.
@@ -18758,7 +18776,8 @@ substitution is performed. If @var{how} is zero, @command{gawk} issues
a warning message.
If @var{regexp} does not match @var{target}, @code{gensub()}'s return value
-is the original unchanged value of @var{target}.
+is the original unchanged value of @var{target}. Note that, as mentioned
+above, the returned value is a string, even if @var{target} was not.
@item @code{gsub(@var{regexp}, @var{replacement}} [@code{, @var{target}}]@code{)}
@cindexawkfunc{gsub}
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index c340fecc..337ac92d 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -11324,6 +11324,21 @@ When used in numeric conversions, strongly typed regexp variables convert
to zero. When used in string conversions, they convert to the string
value of the original regexp text.
+There is an additional, interesting corner case. When used as the third
+argument to @code{sub()} or @code{gsub()}, they retain their type. Thus,
+if you have something like this:
+
+@example
+re = @/don't panic/
+sub(/don't/, "do", re)
+print typeof(re), re
+@end example
+
+@noindent
+then @code{re} retains its type, but now attempts to match the string
+@samp{do panic}. This provides a (very indirect) way to create regexp-typed
+variables at runtime.
+
@node Variables
@subsection Variables
@@ -17851,6 +17866,9 @@ numeric values less than one as if they were one. If no @var{target}
is supplied, use @code{$0}. Return the modified string as the result
of the function. The original target string is @emph{not} changed.
+The returned value is @emph{always} a string, even if the original
+@var{target} was a number or a regexp value.
+
@code{gensub()} is a general substitution function. Its purpose is
to provide more features than the standard @code{sub()} and @code{gsub()}
functions.
@@ -17899,7 +17917,8 @@ substitution is performed. If @var{how} is zero, @command{gawk} issues
a warning message.
If @var{regexp} does not match @var{target}, @code{gensub()}'s return value
-is the original unchanged value of @var{target}.
+is the original unchanged value of @var{target}. Note that, as mentioned
+above, the returned value is a string, even if @var{target} was not.
@item @code{gsub(@var{regexp}, @var{replacement}} [@code{, @var{target}}]@code{)}
@cindexawkfunc{gsub}
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index a36356a3..a26a70c7 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -216,7 +216,7 @@ GAWK_EXT_TESTS = \
procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 \
profile7 profile8 profile9 profile10 profile11 profile12 profile13 \
profile14 profile15 pty1 pty2 \
- rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin \
+ rebuf regexsub regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin \
rsstart1 rsstart2 rsstart3 rstest6 \
sandbox1 shadow shadowbuiltin sortfor sortfor2 sortu \
sourcesplit split_after_fpat \
@@ -3157,6 +3157,11 @@ profile15:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+regexsub:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
regnul1:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/support/ChangeLog b/support/ChangeLog
index 66987e2c..915a49a9 100644
--- a/support/ChangeLog
+++ b/support/ChangeLog
@@ -1,3 +1,8 @@
+2021-08-15 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (AR): Set from @AR@ so that it can be set
+ at configure time.
+
2021-06-30 Arnold D. Robbins <arnold@skeeve.com>
* dfa.c, dynarray.h, libc-config.h, regexec.c,
diff --git a/support/Makefile.am b/support/Makefile.am
index 18e50204..a2d2df05 100644
--- a/support/Makefile.am
+++ b/support/Makefile.am
@@ -26,6 +26,8 @@
AM_CFLAGS = @CFLAGS@
AM_LDFLAGS = @LDFLAGS@
+AR = @AR@
+
# Stuff to include in the dist that doesn't need it's own
# Makefile.am files
EXTRA_DIST = \
diff --git a/test/ChangeLog b/test/ChangeLog
index 387c6a9d..4fab85b2 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2021-08-13 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): regexsub, new test.
+ * regexsub.awk, regexsub.ok: New files.
+
2021-05-15 Eli Zaretskii <eliz@gnu.org>
* iolint.ok: Reorder results to follow the order of iolint.awk.
diff --git a/test/Makefile.am b/test/Makefile.am
index 3b8815d8..94dba463 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1059,6 +1059,8 @@ EXTRA_DIST = \
regexpbrack2.ok \
regexprange.awk \
regexprange.ok \
+ regexsub.awk \
+ regexsub.ok \
reginttrad.awk \
reginttrad.ok \
regnul1.awk \
@@ -1458,7 +1460,7 @@ GAWK_EXT_TESTS = \
procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 \
profile7 profile8 profile9 profile10 profile11 profile12 profile13 \
profile14 profile15 pty1 pty2 \
- rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin \
+ rebuf regexsub regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin \
rsstart1 rsstart2 rsstart3 rstest6 \
sandbox1 shadow shadowbuiltin sortfor sortfor2 sortu \
sourcesplit split_after_fpat \
diff --git a/test/Makefile.in b/test/Makefile.in
index 43003216..18ccdfcb 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1322,6 +1322,8 @@ EXTRA_DIST = \
regexpbrack2.ok \
regexprange.awk \
regexprange.ok \
+ regexsub.awk \
+ regexsub.ok \
reginttrad.awk \
reginttrad.ok \
regnul1.awk \
@@ -1721,7 +1723,7 @@ GAWK_EXT_TESTS = \
procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 \
profile7 profile8 profile9 profile10 profile11 profile12 profile13 \
profile14 profile15 pty1 pty2 \
- rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin \
+ rebuf regexsub regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin \
rsstart1 rsstart2 rsstart3 rstest6 \
sandbox1 shadow shadowbuiltin sortfor sortfor2 sortu \
sourcesplit split_after_fpat \
@@ -4821,6 +4823,11 @@ profile15:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+regexsub:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
regnul1:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index fabc2ad5..ac6c98b6 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1885,6 +1885,11 @@ profile15:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+regexsub:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
regnul1:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/regexsub.awk b/test/regexsub.awk
new file mode 100644
index 00000000..92dede7b
--- /dev/null
+++ b/test/regexsub.awk
@@ -0,0 +1,48 @@
+BEGIN {
+ print "Initialize strong regex"
+ rgx2 = rgx1 = @/[abc]/
+ print "Test gsub on strong regex"
+ printf("rgx%d = '%s'\ttypeof(rgx%d) = '%s'\n", 1, rgx1, 1, typeof(rgx1))
+ printf("rgx%d = '%s'\ttypeof(rgx%d) = '%s'\n", 2, rgx2, 2, typeof(rgx2))
+ print "Test gsub() a strong regex"
+ gsub(/b/, "e", rgx2)
+ printf("rgx%d = '%s'\ttypeof(rgx%d) = '%s'\n", 1, rgx1, 1, typeof(rgx1))
+ printf("rgx%d = '%s'\ttypeof(rgx%d) = '%s'\n", 2, rgx2, 2, typeof(rgx2))
+
+ print "Test value not found in regex"
+ gsub(/x/, "y", rgx1) # should not change
+ printf("rgx%d = '%s'\ttypeof(rgx%d) = '%s'\n", 1, rgx1, 1, typeof(rgx1))
+
+ print "Test gsub on numbers"
+ v2 = v1 = 12345
+ printf("v%d = '%s'\ttypeof(v%d) = '%s'\n", 1, v1, 1, typeof(v1))
+ printf("v%d = '%s'\ttypeof(v%d) = '%s'\n", 2, v2, 2, typeof(v2))
+ gsub(/3/, "x", v2)
+ printf("v%d = '%s'\ttypeof(v%d) = '%s'\n", 1, v1, 1, typeof(v1))
+ printf("v%d = '%s'\ttypeof(v%d) = '%s'\n", 2, v2, 2, typeof(v2))
+ print "Test value not found in number"
+ gsub(/9/, "x", v1)
+ printf("v%d = '%s'\ttypeof(v%d) = '%s'\n", 1, v1, 1, typeof(v1))
+
+ print "Test gensub on regex"
+ a = b = @/abc/
+ c = gensub(/b/, "x", "g", a)
+ printf("a = @/%s/\ttypeof(a) = '%s'\n", a, typeof(a))
+ printf("c = \"%s\"\ttypeof(c) = '%s'\n", c, typeof(c))
+ print "Test value not found in regex"
+ c = gensub(/q/, "x", "g", b)
+ printf("b = @/%s/\ttypeof(b) = '%s'\n", b, typeof(b))
+ printf("c = \"%s\"\ttypeof(c) = '%s'\n", c, typeof(c))
+
+ print "Test gensub on numbers"
+ a = b = 12345
+ c = gensub(/3/, "x", "g", a)
+ printf("a = \"%s\"\ttypeof(a) = '%s'\n", a, typeof(a))
+ printf("b = \"%s\"\ttypeof(b) = '%s'\n", b, typeof(b))
+ printf("c = \"%s\"\ttypeof(c) = '%s'\n", c, typeof(c))
+ print "Test value not found in number"
+ c = gensub(/9/, "x", "g", b)
+ printf("b = \"%s\"\ttypeof(b) = '%s'\n", b, typeof(b))
+ printf("c = \"%s\"\ttypeof(c) = '%s'\n", c, typeof(c))
+ print typeof(c), c
+}
diff --git a/test/regexsub.ok b/test/regexsub.ok
new file mode 100644
index 00000000..44511ebc
--- /dev/null
+++ b/test/regexsub.ok
@@ -0,0 +1,30 @@
+Initialize strong regex
+Test gsub on strong regex
+rgx1 = '[abc]' typeof(rgx1) = 'regexp'
+rgx2 = '[abc]' typeof(rgx2) = 'regexp'
+Test gsub() a strong regex
+rgx1 = '[abc]' typeof(rgx1) = 'regexp'
+rgx2 = '[aec]' typeof(rgx2) = 'regexp'
+Test value not found in regex
+rgx1 = '[abc]' typeof(rgx1) = 'regexp'
+Test gsub on numbers
+v1 = '12345' typeof(v1) = 'number'
+v2 = '12345' typeof(v2) = 'number'
+v1 = '12345' typeof(v1) = 'number'
+v2 = '12x45' typeof(v2) = 'string'
+Test value not found in number
+v1 = '12345' typeof(v1) = 'number'
+Test gensub on regex
+a = @/abc/ typeof(a) = 'regexp'
+c = "axc" typeof(c) = 'string'
+Test value not found in regex
+b = @/abc/ typeof(b) = 'regexp'
+c = "abc" typeof(c) = 'string'
+Test gensub on numbers
+a = "12345" typeof(a) = 'number'
+b = "12345" typeof(b) = 'number'
+c = "12x45" typeof(c) = 'string'
+Test value not found in number
+b = "12345" typeof(b) = 'number'
+c = "12345" typeof(c) = 'string'
+string 12345