[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5430-gc34167da
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5430-gc34167da |
Date: |
Tue, 28 Nov 2023 14:07:13 -0500 (EST) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk-5.3-stable has been updated
via c34167da18b40e8b49666cd9d35af44cdde91d82 (commit)
from 4a3627d70523681f75025ad5d50b35966d254b02 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=c34167da18b40e8b49666cd9d35af44cdde91d82
commit c34167da18b40e8b49666cd9d35af44cdde91d82
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Tue Nov 28 21:06:36 2023 +0200
Make type of plain a[1] smarter, add doc and tests.
diff --git a/ChangeLog b/ChangeLog
index 3cd53d98..12c386fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2023-11-28 Arnold D. Robbins <arnold@skeeve.com>
+
+ Straighten out Node_elem_new some more. Thanks to "M"
+ <c24p0101@gmail.com> for the report and to Andrew Schorr for
+ the reduced test case.
+
+ * awk.h (force_string_fmt): Don't clear NUMBER from the flags.
+ (force_number): Handle Node_elem_new case. (Ooops.)
+ * builtin.c (do_typeof): Make unassigned case check smarter.
+ * mpfr.c (mpg_force_number): Don't clear STRING and don't
+ change the string value.
+ * node.c (r_force_number): Ditto.
+
2023-11-20 Arnold D. Robbins <arnold@skeeve.com>
* command.y (yylex): Change _("%s") into "%s". Sheesh.
diff --git a/awk.h b/awk.h
index cbc0a7e8..8e38976d 100644
--- a/awk.h
+++ b/awk.h
@@ -1966,7 +1966,6 @@ force_string_fmt(NODE *s, const char *fmtstr, int fmtidx)
{
if (s->type == Node_elem_new) {
s->type = Node_val;
- s->flags &= ~NUMBER;
return s;
}
@@ -2006,6 +2005,11 @@ unref(NODE *r)
static inline NODE *
force_number(NODE *n)
{
+ if (n->type == Node_elem_new) {
+ n->type = Node_val;
+
+ return n;
+ }
return (n->flags & NUMCUR) != 0 ? n : str2number(n);
}
diff --git a/builtin.c b/builtin.c
index ba3459db..6fc76b72 100644
--- a/builtin.c
+++ b/builtin.c
@@ -4374,10 +4374,16 @@ do_typeof(int nargs)
res = "string";
// fall through
case NUMBER|STRING:
- if (arg == Nnull_string || (arg->flags & NULL_FIELD) !=
0) {
+ {
+ int flags = STRING|NUMBER|STRCUR|NUMCUR;
+
+ if ( arg == Nnull_string // unassigned
scalar
+ || (arg->flags & NULL_FIELD) != 0 // unassigned
field
+ || (arg->flags & flags) == flags) { //
Node_elem_new used as scalar value
res = "unassigned";
break;
}
+ }
/* fall through */
default:
if (res == NULL) {
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 2de6bb51..7850e103 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,9 @@
+2023-11-28 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawk.texi: Rework documentation on dynamic typing, moving
+ stuff around and adding more information. Thanks to Andrew Schorr
+ for pointing out the need.
+
2023-11-16 Arnold D. Robbins <arnold@skeeve.com>
* gawk.texi (POSIX/GNU): Mention namespaces and `::'.
diff --git a/doc/gawk.info b/doc/gawk.info
index bbd9537b..50e73762 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -419,6 +419,9 @@ in (a) below. A copy of the license is included in the
section entitled
returns.
* Dynamic Typing:: How variable types can change at
runtime.
+* Dynamic Typing Awk:: Dynamic typing in standard
+ âawkâ.
+* Dynamic Typing Gawk:: Dynamic typing in âgawkâ.
* Indirect Calls:: Choosing the function to call at
runtime.
* Functions Summary:: Summary of functions.
@@ -13091,6 +13094,7 @@ you determine at runtime what function is to be called.
* Built-in:: Summarizes the built-in functions.
* User-defined:: Describes User-defined functions in detail.
+* Dynamic Typing:: How variable types can change at runtime.
* Indirect Calls:: Choosing the function to call at runtime.
* Functions Summary:: Summary of functions.
@@ -14804,34 +14808,12 @@ contexts.
attribute; *note Variable Typing::.)
â"unassigned"â
- X is a scalar variable that has not been assigned a value yet.
- For example:
-
- BEGIN {
- # creates a[1] but it has no assigned value
- a[1]
- print typeof(a[1]) # unassigned
- }
+ X is a _scalar_ variable that has not been assigned a value
+ yet.
â"untyped"â
X has not yet been used yet at all; it can become a scalar or
- an array. The typing could even conceivably differ from run
- to run of the same program! For example:
-
- BEGIN {
- print "initially, typeof(v) = ", typeof(v)
-
- if ("FOO" in ENVIRON)
- make_scalar(v)
- else
- make_array(v)
-
- print "typeof(v) =", typeof(v)
- }
-
- function make_scalar(p, l) { l = p }
-
- function make_array(p) { p[1] = 1 }
+ an array.
âisarray()â is meant for use in two circumstances. The first is when
traversing a multidimensional array: you can test if an element is
@@ -14848,28 +14830,8 @@ parameter is an array or not.
variable or function parameter is a scalar (number, string, or strongly
typed regexp) or an array.
- Normally, passing a variable that has never been used to a built-in
-function causes it to become a scalar variable (unassigned). However,
-âisarray()â and âtypeof()â are different; they do not change their
-arguments from untyped to unassigned.
-
- This applies to both variables denoted by simple identifiers and
-array elements that come into existence simply by referencing them.
-Consider:
-
- $ gawk 'BEGIN { print typeof(x) }'
- ⣠untyped
- $ gawk 'BEGIN { print typeof(x["foo"]) }'
- ⣠untyped
-
- Note that prior to version 5.2, array elements that come into
-existence simply by referencing them were different, they were
-automatically forced to be scalars:
-
- $ gawk-5.1.1 'BEGIN { print typeof(x) }'
- ⣠untyped
- $ gawk-5.1.1 'BEGIN { print typeof(x["foo"]) }'
- ⣠unassigned
+ We delay further discussion of âunassignedâ vs. âuntypedâ to *note
+Dynamic Typing Gawk::.
File: gawk.info, Node: I18N Functions, Prev: Type Functions, Up: Built-in
@@ -14907,7 +14869,7 @@ story. Optional parameters are enclosed in square
brackets ([ ]):
default value for CATEGORY is â"LC_MESSAGES"â.
-File: gawk.info, Node: User-defined, Next: Indirect Calls, Prev: Built-in,
Up: Functions
+File: gawk.info, Node: User-defined, Next: Dynamic Typing, Prev: Built-in,
Up: Functions
9.2 User-Defined Functions
==========================
@@ -14924,7 +14886,6 @@ tell âawkâ what they should do).
does.
* Function Calling:: Calling user-defined functions.
* Return Statement:: Specifying the value a function returns.
-* Dynamic Typing:: How variable types can change at runtime.
File: gawk.info, Node: Definition Syntax, Next: Function Example, Up:
User-defined
@@ -15433,7 +15394,7 @@ the warning, fix your code! It's incorrect, after all.)
point you will wonder, "what was I thinking?!?"
-File: gawk.info, Node: Return Statement, Next: Dynamic Typing, Prev:
Function Calling, Up: User-defined
+File: gawk.info, Node: Return Statement, Prev: Function Calling, Up:
User-defined
9.2.4 The âreturnâ Statement
----------------------------
@@ -15518,10 +15479,10 @@ the program reports (predictably) that 99,385 is the
largest value in
the array.
-File: gawk.info, Node: Dynamic Typing, Prev: Return Statement, Up:
User-defined
+File: gawk.info, Node: Dynamic Typing, Next: Indirect Calls, Prev:
User-defined, Up: Functions
-9.2.5 Functions and Their Effects on Variable Typing
-----------------------------------------------------
+9.3 Variable Typing Is Dynamic
+==============================
It's a desert topping!
It's a floor wax!
@@ -15529,7 +15490,20 @@ File: gawk.info, Node: Dynamic Typing, Prev: Return
Statement, Up: User-defin
âawkâ is a very fluid language. It is possible that âawkâ can't
tell
if an identifier represents a scalar variable or an array until runtime.
-Here is an annotated sample program:
+
+* Menu:
+
+* Dynamic Typing Awk:: Dynamic typing in standard âawkâ.
+* Dynamic Typing Gawk:: Dynamic typing in âgawkâ.
+
+
+File: gawk.info, Node: Dynamic Typing Awk, Next: Dynamic Typing Gawk, Up:
Dynamic Typing
+
+9.3.1 Dynamic Typing In Standard âawkâ
+--------------------------------------
+
+Let's first discuss standard âawkâ. Here is an annotated sample
+program:
function foo(a)
{
@@ -15595,9 +15569,115 @@ array. âgawkâ and the MKS âawkâ do this:
different implementations work differently.
-File: gawk.info, Node: Indirect Calls, Next: Functions Summary, Prev:
User-defined, Up: Functions
+File: gawk.info, Node: Dynamic Typing Gawk, Prev: Dynamic Typing Awk, Up:
Dynamic Typing
+
+9.3.2 Dynamic Typing In âgawkâ
+------------------------------
+
+ Hc Svnt Dracones ("Here be dragons")
+ -- _The Lenox Globe_
+
+ Things in âgawkâ can be a little more unexpected. Because âgawkâ
+allows arrays of arrays, the same dynamic typing can be applied to array
+elements that have been created but not used.
+
+ BEGIN {
+ funky(a[1])
+ if (A == 0)
+ print "<" a[1] ">"
+ else
+ print a[1][1]
+ }
+
+ function funky(arr)
+ {
+ if (A == 0)
+ arr = 1
+ else
+ arr[1] = 1
+ }
+
+When run, the results are the same as in the earlier case:
+
+ $ gawk -v A=0 -f funky2.awk
+ ⣠<>
+ $ gawk -v A=1 -f funky2.awk
+ ⣠1
+
+ The âtypeof()â function provides us a "window" into âgawkâ's inner
+workings. Let's see how using a variable or array element can change
+it's type dynamically. Let's start with using a variable as a scalar:
+
+ BEGIN {
+ print typeof(a) # we don't know what a is yet
+ printf("a = %d\n", a) # use it as a scalar
+ print typeof(a) # now we know it's not an array
+ }
+
+When run:
+
+ $ gawk -f typing1.awk
+ ⣠untyped
+ ⣠a = 0
+ ⣠unassigned
+
+ Initially, âaâ is âuntypedâ, since we don't know yet if it's an
array
+or scalar. After using it in the call to âprintf()â, we know it's a
+scalar. However, since it was never given a concrete value (number,
+string, or regexp), it's type is âunassignedâ.
+
+ âgawkâ is peculiar in that we can do the same thing, but change âaâ
+into an array:
+
+ BEGIN {
+ print typeof(a) # we don't know what a is yet
+ a[1] # make a into an array
+ print typeof(a[1]) # but we don't know what a[1] is yet
+ printf("a[1] = %d\n", a[1]) # use it as a scalar
+ print typeof(a[1]) # now we know it's not an array
+ }
+
+When run:
+
+ $ gawk -f typing2.awk
+ ⣠untyped
+ ⣠untyped
+ ⣠a[1] = 0
+ ⣠unassigned
+
+ Normally, passing a variable that has never been used to a built-in
+function causes it to become a scalar variable (âunassignedâ). However,
+âisarray()â and âtypeof()â are different; they do not change their
+arguments from âuntypedâ to âunassignedâ.
+
+ As we saw, this applies to both variables denoted by simple
+identifiers and array elements that come into existence simply by
+referencing them:
+
+ $ gawk 'BEGIN { print typeof(x) }'
+ ⣠untyped
+ $ gawk 'BEGIN { print typeof(x["foo"]) }'
+ ⣠untyped
+
+ Note that prior to version 5.2, array elements that come into
+existence simply by referencing them were different, they were
+automatically forced to be scalars:
+
+ $ gawk-5.1.1 'BEGIN { print typeof(x) }'
+ ⣠untyped
+ $ gawk-5.1.1 'BEGIN { print typeof(x["foo"]) }'
+ ⣠unassigned
+
+ To sum up, variables and array elements get their nature (array or
+scalar) "fixed" upon first use. This can lead to some weird cases, and
+it is best to avoid taking advantage of âgawkâ's dynamic nature, other
+than in the standard manner of passing untyped variables and array
+elements as function parameters.
+
+
+File: gawk.info, Node: Indirect Calls, Next: Functions Summary, Prev:
Dynamic Typing, Up: Functions
-9.3 Indirect Function Calls
+9.4 Indirect Function Calls
===========================
This minor node describes an advanced, âgawkâ-specific extension.
@@ -15910,7 +15990,7 @@ example, in the following case:
File: gawk.info, Node: Functions Summary, Prev: Indirect Calls, Up:
Functions
-9.4 Summary
+9.5 Summary
===========
⢠âawkâ provides built-in functions and lets you define your own
@@ -15960,6 +16040,10 @@ File: gawk.info, Node: Functions Summary, Prev:
Indirect Calls, Up: Functions
function, how that function treats the variable can set its nature:
either scalar or array.
+ ⢠âgawkâ is even more fluid in its designation of variables and array
+ elements as scalars or arrays. However, this can lead to weird
+ situations, so you should tread carefully.
+
⢠âgawkâ provides indirect function calls using a special syntax. By
setting a variable to the name of a function, you can determine at
runtime what function will be called at that point in the program.
@@ -39716,625 +39800,627 @@ Index
Tag Table:
Node: Top1203
-Node: Foreword346844
-Node: Foreword451418
-Node: Preface52962
-Ref: Preface-Footnote-155948
-Ref: Preface-Footnote-256057
-Ref: Preface-Footnote-356291
-Node: History56437
-Node: Names59051
-Ref: Names-Footnote-160205
-Node: This Manual60368
-Ref: This Manual-Footnote-167297
-Node: Conventions67405
-Node: Manual History69834
-Ref: Manual History-Footnote-172859
-Ref: Manual History-Footnote-272900
-Node: How To Contribute72974
-Node: Acknowledgments73920
-Node: Getting Started78909
-Node: Running gawk81436
-Node: One-shot82654
-Node: Read Terminal83953
-Node: Long86007
-Node: Executable Scripts87657
-Ref: Executable Scripts-Footnote-190427
-Node: Comments90534
-Node: Quoting93064
-Node: DOS Quoting98708
-Node: Sample Data Files100788
-Node: Very Simple103423
-Node: Two Rules109677
-Node: More Complex111629
-Node: Statements/Lines114049
-Ref: Statements/Lines-Footnote-1119561
-Node: Other Features119850
-Node: When120818
-Ref: When-Footnote-1122620
-Node: Intro Summary122685
-Node: Invoking Gawk123639
-Node: Command Line125201
-Node: Options126051
-Ref: Options-Footnote-1145391
-Ref: Options-Footnote-2145626
-Node: Other Arguments145651
-Node: Naming Standard Input149816
-Node: Environment Variables151086
-Node: AWKPATH Variable151660
-Ref: AWKPATH Variable-Footnote-1155244
-Ref: AWKPATH Variable-Footnote-2155278
-Node: AWKLIBPATH Variable155669
-Ref: AWKLIBPATH Variable-Footnote-1157442
-Node: Other Environment Variables157837
-Node: Exit Status162313
-Node: Include Files163026
-Node: Loading Shared Libraries167078
-Node: Obsolete168568
-Node: Undocumented169317
-Node: Invoking Summary169614
-Node: Regexp172639
-Node: Regexp Usage174133
-Node: Escape Sequences176234
-Ref: Escape Sequences-Footnote-1183747
-Node: Regexp Operators183825
-Node: Regexp Operator Details184318
-Ref: Regexp Operator Details-Footnote-1192329
-Node: Interval Expressions192488
-Ref: Interval Expressions-Footnote-1194755
-Node: Bracket Expressions194853
-Ref: table-char-classes197409
-Node: Leftmost Longest200907
-Node: Computed Regexps202263
-Node: GNU Regexp Operators205778
-Node: Case-sensitivity209794
-Ref: Case-sensitivity-Footnote-1212744
-Ref: Case-sensitivity-Footnote-2212987
-Node: Regexp Summary213099
-Node: Reading Files214621
-Node: Records216938
-Node: awk split records218213
-Node: gawk split records223095
-Ref: gawk split records-Footnote-1228383
-Node: Fields228420
-Ref: Fields-Footnote-1231336
-Node: Nonconstant Fields231456
-Ref: Nonconstant Fields-Footnote-1233764
-Node: Changing Fields233980
-Node: Field Separators240278
-Node: Default Field Splitting243147
-Node: Regexp Field Splitting244289
-Node: Single Character Fields248118
-Node: Comma Separated Fields249207
-Ref: table-csv-examples250611
-Node: Command Line Field Separator252910
-Node: Full Line Fields256286
-Ref: Full Line Fields-Footnote-1257864
-Ref: Full Line Fields-Footnote-2257910
-Node: Field Splitting Summary258015
-Node: Constant Size260332
-Node: Fixed width data261076
-Node: Skipping intervening264591
-Node: Allowing trailing data265393
-Node: Fields with fixed data266454
-Node: Splitting By Content268076
-Ref: Splitting By Content-Footnote-1272526
-Node: More CSV272689
-Node: FS versus FPAT274347
-Node: Testing field creation275547
-Node: Multiple Line277321
-Node: Getline283790
-Node: Plain Getline286373
-Node: Getline/Variable289019
-Node: Getline/File290214
-Node: Getline/Variable/File291662
-Ref: Getline/Variable/File-Footnote-1293307
-Node: Getline/Pipe293403
-Node: Getline/Variable/Pipe296211
-Node: Getline/Coprocess297394
-Node: Getline/Variable/Coprocess298717
-Node: Getline Notes299483
-Node: Getline Summary302436
-Ref: table-getline-variants302880
-Node: Read Timeout303784
-Ref: Read Timeout-Footnote-1307746
-Node: Retrying Input307804
-Node: Command-line directories309071
-Node: Input Summary310009
-Node: Input Exercises313389
-Node: Printing313827
-Node: Print315770
-Node: Print Examples317271
-Node: Output Separators320116
-Node: OFMT322223
-Node: Printf323936
-Node: Basic Printf324741
-Node: Control Letters326376
-Node: Format Modifiers331822
-Node: Printf Examples338094
-Node: Redirection340635
-Node: Special FD348407
-Ref: Special FD-Footnote-1351705
-Node: Special Files351783
-Node: Other Inherited Files352412
-Node: Special Network353477
-Node: Special Caveats354365
-Node: Close Files And Pipes355348
-Ref: Close Files And Pipes-Footnote-1361472
-Node: Close Return Value361620
-Ref: table-close-pipe-return-values362891
-Ref: Close Return Value-Footnote-1363722
-Node: Noflush363878
-Node: Nonfatal365386
-Node: Output Summary367801
-Node: Output Exercises369087
-Node: Expressions369778
-Node: Values370978
-Node: Constants371656
-Node: Scalar Constants372351
-Ref: Scalar Constants-Footnote-1374927
-Ref: Scalar Constants-Footnote-2375177
-Node: Nondecimal-numbers375257
-Node: Regexp Constants378370
-Node: Using Constant Regexps378916
-Node: Standard Regexp Constants379562
-Node: Strong Regexp Constants382858
-Node: Variables386701
-Node: Using Variables387366
-Node: Assignment Options389340
-Node: Conversion391891
-Node: Strings And Numbers392423
-Ref: Strings And Numbers-Footnote-1395633
-Node: Locale influences conversions395742
-Ref: table-locale-affects398580
-Node: All Operators399222
-Node: Arithmetic Ops399863
-Node: Concatenation402686
-Ref: Concatenation-Footnote-1405622
-Node: Assignment Ops405741
-Ref: table-assign-ops410868
-Node: Increment Ops412249
-Node: Truth Values and Conditions415840
-Node: Truth Values416934
-Node: Typing and Comparison418014
-Node: Variable Typing418846
-Ref: Variable Typing-Footnote-1425490
-Ref: Variable Typing-Footnote-2425570
-Node: Comparison Operators425651
-Ref: table-relational-ops426078
-Node: POSIX String Comparison429754
-Ref: POSIX String Comparison-Footnote-1431511
-Ref: POSIX String Comparison-Footnote-2431654
-Node: Boolean Ops431738
-Ref: Boolean Ops-Footnote-1436412
-Node: Conditional Exp436508
-Node: Function Calls438288
-Node: Precedence442235
-Node: Locales446098
-Node: Expressions Summary447774
-Node: Patterns and Actions450429
-Node: Pattern Overview451565
-Node: Regexp Patterns453290
-Node: Expression Patterns453836
-Node: Ranges457741
-Node: BEGIN/END460915
-Node: Using BEGIN/END461724
-Ref: Using BEGIN/END-Footnote-1464632
-Node: I/O And BEGIN/END464742
-Node: BEGINFILE/ENDFILE467223
-Node: Empty470654
-Node: Using Shell Variables470971
-Node: Action Overview473307
-Node: Statements475742
-Node: If Statement477638
-Node: While Statement479201
-Node: Do Statement481289
-Node: For Statement482473
-Node: Switch Statement485828
-Node: Break Statement488377
-Node: Continue Statement490569
-Node: Next Statement492500
-Node: Nextfile Statement494979
-Node: Exit Statement497832
-Node: Built-in Variables500359
-Node: User-modified501536
-Node: Auto-set509743
-Ref: Auto-set-Footnote-1527827
-Ref: Auto-set-Footnote-2528045
-Node: ARGC and ARGV528101
-Node: Pattern Action Summary532530
-Node: Arrays535136
-Node: Array Basics536509
-Node: Array Intro537357
-Ref: figure-array-elements539368
-Ref: Array Intro-Footnote-1542221
-Node: Reference to Elements542353
-Node: Assigning Elements544873
-Node: Array Example545368
-Node: Scanning an Array547330
-Node: Controlling Scanning550425
-Ref: Controlling Scanning-Footnote-1557060
-Node: Numeric Array Subscripts557384
-Node: Uninitialized Subscripts559652
-Node: Delete561325
-Ref: Delete-Footnote-1564137
-Node: Multidimensional564194
-Node: Multiscanning567397
-Node: Arrays of Arrays569064
-Node: Arrays Summary573368
-Node: Functions575555
-Node: Built-in576613
-Node: Calling Built-in577802
-Node: Boolean Functions579842
-Node: Numeric Functions580404
-Ref: Numeric Functions-Footnote-1584589
-Ref: Numeric Functions-Footnote-2585272
-Ref: Numeric Functions-Footnote-3585324
-Node: String Functions585600
-Ref: String Functions-Footnote-1612051
-Ref: String Functions-Footnote-2612183
-Ref: String Functions-Footnote-3612439
-Node: Gory Details612526
-Ref: table-sub-escapes614535
-Ref: table-sub-proposed616166
-Ref: table-posix-sub617661
-Ref: table-gensub-escapes619334
-Ref: Gory Details-Footnote-1620253
-Node: I/O Functions620407
-Ref: table-system-return-values627083
-Ref: I/O Functions-Footnote-1629245
-Ref: I/O Functions-Footnote-2629393
-Node: Time Functions629513
-Ref: Time Functions-Footnote-1640595
-Ref: Time Functions-Footnote-2640663
-Ref: Time Functions-Footnote-3640825
-Ref: Time Functions-Footnote-4640936
-Ref: Time Functions-Footnote-5641052
-Ref: Time Functions-Footnote-6641279
-Node: Bitwise Functions641557
-Ref: table-bitwise-ops642155
-Ref: Bitwise Functions-Footnote-1648397
-Ref: Bitwise Functions-Footnote-2648574
-Node: Type Functions648769
-Node: I18N Functions652362
-Node: User-defined654097
-Node: Definition Syntax654917
-Ref: Definition Syntax-Footnote-1660735
-Node: Function Example660810
-Ref: Function Example-Footnote-1663789
-Node: Function Calling663811
-Node: Calling A Function664403
-Node: Variable Scope665373
-Node: Pass By Value/Reference668427
-Node: Function Caveats671155
-Ref: Function Caveats-Footnote-1673246
-Node: Return Statement673366
-Node: Dynamic Typing676421
-Node: Indirect Calls678803
-Node: Functions Summary689938
-Node: Library Functions692707
-Ref: Library Functions-Footnote-1696255
-Ref: Library Functions-Footnote-2696400
-Node: Library Names696575
-Ref: Library Names-Footnote-1700346
-Ref: Library Names-Footnote-2700573
-Node: General Functions700667
-Node: Strtonum Function701937
-Node: Assert Function705019
-Node: Round Function708469
-Node: Cliff Random Function710041
-Node: Ordinal Functions711065
-Ref: Ordinal Functions-Footnote-1714168
-Ref: Ordinal Functions-Footnote-2714420
-Node: Join Function714634
-Ref: Join Function-Footnote-1716432
-Node: Getlocaltime Function716636
-Node: Readfile Function720410
-Node: Shell Quoting722439
-Node: Isnumeric Function723895
-Node: To CSV Function725331
-Node: Data File Management727423
-Node: Filetrans Function728055
-Node: Rewind Function732331
-Node: File Checking734302
-Ref: File Checking-Footnote-1735668
-Node: Empty Files735873
-Node: Ignoring Assigns737936
-Node: Getopt Function739510
-Ref: Getopt Function-Footnote-1755328
-Node: Passwd Functions755540
-Ref: Passwd Functions-Footnote-1764675
-Node: Group Functions764763
-Ref: Group Functions-Footnote-1772887
-Node: Walking Arrays773098
-Node: Library Functions Summary776144
-Node: Library Exercises777564
-Node: Sample Programs778049
-Node: Running Examples778831
-Node: Clones779583
-Node: Cut Program780851
-Node: Egrep Program791275
-Node: Id Program800580
-Node: Split Program810672
-Ref: Split Program-Footnote-1820885
-Node: Tee Program821070
-Node: Uniq Program823976
-Node: Wc Program831836
-Node: Bytes vs. Characters832231
-Node: Using extensions833831
-Node: wc program834609
-Node: Miscellaneous Programs839602
-Node: Dupword Program840827
-Node: Alarm Program842876
-Node: Translate Program847779
-Ref: Translate Program-Footnote-1852488
-Node: Labels Program852766
-Ref: Labels Program-Footnote-1856201
-Node: Word Sorting856285
-Node: History Sorting860459
-Node: Extract Program862732
-Node: Simple Sed870987
-Node: Igawk Program874197
-Ref: Igawk Program-Footnote-1889407
-Ref: Igawk Program-Footnote-2889613
-Ref: Igawk Program-Footnote-3889743
-Node: Anagram Program889870
-Node: Signature Program892956
-Node: Programs Summary894206
-Node: Programs Exercises895460
-Ref: Programs Exercises-Footnote-1899762
-Node: Advanced Features899848
-Node: Nondecimal Data902329
-Node: Boolean Typed Values903959
-Node: Array Sorting905916
-Node: Controlling Array Traversal906645
-Ref: Controlling Array Traversal-Footnote-1915148
-Node: Array Sorting Functions915270
-Ref: Array Sorting Functions-Footnote-1921367
-Node: Two-way I/O921575
-Ref: Two-way I/O-Footnote-1929546
-Ref: Two-way I/O-Footnote-2929737
-Node: TCP/IP Networking929819
-Node: Profiling932987
-Node: Persistent Memory942657
-Ref: Persistent Memory-Footnote-1952229
-Node: Extension Philosophy952360
-Node: Advanced Features Summary953887
-Node: Internationalization956153
-Node: I18N and L10N957855
-Node: Explaining gettext958550
-Ref: Explaining gettext-Footnote-1964686
-Ref: Explaining gettext-Footnote-2964879
-Node: Programmer i18n965044
-Ref: Programmer i18n-Footnote-1970156
-Node: Translator i18n970205
-Node: String Extraction971035
-Ref: String Extraction-Footnote-1972211
-Node: Printf Ordering972309
-Ref: Printf Ordering-Footnote-1975167
-Node: I18N Portability975235
-Ref: I18N Portability-Footnote-1977795
-Node: I18N Example977862
-Ref: I18N Example-Footnote-1981256
-Ref: I18N Example-Footnote-2981329
-Node: Gawk I18N981446
-Node: I18N Summary982100
-Node: Debugger983497
-Node: Debugging984517
-Node: Debugging Concepts984966
-Node: Debugging Terms986783
-Node: Awk Debugging989386
-Ref: Awk Debugging-Footnote-1990359
-Node: Sample Debugging Session990495
-Node: Debugger Invocation991045
-Node: Finding The Bug992670
-Node: List of Debugger Commands999302
-Node: Breakpoint Control1000679
-Node: Debugger Execution Control1004501
-Node: Viewing And Changing Data1007975
-Node: Execution Stack1011709
-Node: Debugger Info1013390
-Node: Miscellaneous Debugger Commands1017685
-Node: Readline Support1022926
-Node: Limitations1023870
-Node: Debugging Summary1026494
-Node: Namespaces1027793
-Node: Global Namespace1028920
-Node: Qualified Names1030354
-Node: Default Namespace1031389
-Node: Changing The Namespace1032162
-Node: Naming Rules1033844
-Node: Internal Name Management1035759
-Node: Namespace Example1036829
-Node: Namespace And Features1039406
-Node: Namespace Summary1040861
-Node: Arbitrary Precision Arithmetic1042372
-Node: Computer Arithmetic1043891
-Ref: table-numeric-ranges1047699
-Ref: table-floating-point-ranges1048196
-Ref: Computer Arithmetic-Footnote-11048854
-Node: Math Definitions1048911
-Ref: table-ieee-formats1051943
-Node: MPFR features1052516
-Node: MPFR On Parole1052969
-Ref: MPFR On Parole-Footnote-11053810
-Node: MPFR Intro1053969
-Node: FP Math Caution1055653
-Ref: FP Math Caution-Footnote-11056725
-Node: Inexactness of computations1057098
-Node: Inexact representation1058129
-Node: Comparing FP Values1059510
-Node: Errors accumulate1060768
-Node: Strange values1062233
-Ref: Strange values-Footnote-11064887
-Node: Getting Accuracy1064992
-Node: Try To Round1067729
-Node: Setting precision1068636
-Ref: table-predefined-precision-strings1069341
-Node: Setting the rounding mode1071225
-Ref: table-gawk-rounding-modes1071607
-Ref: Setting the rounding mode-Footnote-11075659
-Node: Arbitrary Precision Integers1075842
-Ref: Arbitrary Precision Integers-Footnote-11079052
-Node: Checking for MPFR1079205
-Node: POSIX Floating Point Problems1080695
-Ref: POSIX Floating Point Problems-Footnote-11085515
-Node: Floating point summary1085553
-Node: Dynamic Extensions1087809
-Node: Extension Intro1089406
-Node: Plugin License1090708
-Node: Extension Mechanism Outline1091521
-Ref: figure-load-extension1091972
-Ref: figure-register-new-function1093550
-Ref: figure-call-new-function1094659
-Node: Extension API Description1096774
-Node: Extension API Functions Introduction1098503
-Ref: table-api-std-headers1100397
-Node: General Data Types1104838
-Ref: General Data Types-Footnote-11113984
-Node: Memory Allocation Functions1114287
-Ref: Memory Allocation Functions-Footnote-11119004
-Node: Constructor Functions1119103
-Node: API Ownership of MPFR and GMP Values1123004
-Node: Registration Functions1124557
-Node: Extension Functions1125261
-Node: Exit Callback Functions1130835
-Node: Extension Version String1132149
-Node: Input Parsers1132844
-Node: Output Wrappers1147463
-Node: Two-way processors1152305
-Node: Printing Messages1154658
-Ref: Printing Messages-Footnote-11155869
-Node: Updating ERRNO1156022
-Node: Requesting Values1156821
-Ref: table-value-types-returned1157574
-Node: Accessing Parameters1158682
-Node: Symbol Table Access1159963
-Node: Symbol table by name1160475
-Ref: Symbol table by name-Footnote-11163676
-Node: Symbol table by cookie1163808
-Ref: Symbol table by cookie-Footnote-11168077
-Node: Cached values1168141
-Ref: Cached values-Footnote-11171773
-Node: Array Manipulation1171930
-Ref: Array Manipulation-Footnote-11173029
-Node: Array Data Types1173066
-Ref: Array Data Types-Footnote-11175884
-Node: Array Functions1175980
-Node: Flattening Arrays1181009
-Node: Creating Arrays1188057
-Node: Redirection API1192899
-Node: Extension API Variables1195916
-Node: Extension Versioning1196639
-Ref: gawk-api-version1197068
-Node: Extension GMP/MPFR Versioning1198855
-Node: Extension API Informational Variables1200559
-Node: Extension API Boilerplate1201812
-Node: Changes from API V11205942
-Node: Finding Extensions1207574
-Node: Extension Example1208149
-Node: Internal File Description1208971
-Node: Internal File Ops1213263
-Ref: Internal File Ops-Footnote-11224813
-Node: Using Internal File Ops1224961
-Ref: Using Internal File Ops-Footnote-11227392
-Node: Extension Samples1227670
-Node: Extension Sample File Functions1229239
-Node: Extension Sample Fnmatch1237364
-Node: Extension Sample Fork1238959
-Node: Extension Sample Inplace1240235
-Node: Extension Sample Ord1243901
-Node: Extension Sample Readdir1244777
-Ref: table-readdir-file-types1245566
-Node: Extension Sample Revout1246922
-Node: Extension Sample Rev2way1247519
-Node: Extension Sample Read write array1248271
-Node: Extension Sample Readfile1251545
-Node: Extension Sample Time1252676
-Node: Extension Sample API Tests1254964
-Node: gawkextlib1255472
-Node: Extension summary1258504
-Node: Extension Exercises1262352
-Node: Language History1263622
-Node: V7/SVR3.11265334
-Node: SVR41267684
-Node: POSIX1269216
-Node: BTL1270641
-Node: POSIX/GNU1271408
-Node: Feature History1278063
-Node: Common Extensions1297865
-Node: Ranges and Locales1299340
-Ref: Ranges and Locales-Footnote-11304125
-Ref: Ranges and Locales-Footnote-21304152
-Ref: Ranges and Locales-Footnote-31304387
-Node: Contributors1304610
-Node: History summary1310801
-Node: Installation1312243
-Node: Gawk Distribution1313207
-Node: Getting1313699
-Node: Extracting1314698
-Node: Distribution contents1316404
-Node: Unix Installation1324478
-Node: Quick Installation1325298
-Node: Compiling with MPFR1327838
-Node: Shell Startup Files1328544
-Node: Additional Configuration Options1329701
-Node: Configuration Philosophy1332084
-Node: Compiling from Git1334584
-Node: Building the Documentation1335143
-Node: Non-Unix Installation1336555
-Node: PC Installation1337031
-Node: PC Binary Installation1337900
-Node: PC Compiling1338793
-Node: PC Using1339971
-Node: Cygwin1343687
-Node: MSYS1344939
-Node: OpenVMS Installation1345565
-Node: OpenVMS Compilation1346246
-Ref: OpenVMS Compilation-Footnote-11347729
-Node: OpenVMS Dynamic Extensions1347787
-Node: OpenVMS Installation Details1349423
-Node: OpenVMS Running1351854
-Node: OpenVMS GNV1355991
-Node: Bugs1356746
-Node: Bug definition1357666
-Node: Bug address1361267
-Node: Usenet1364836
-Node: Performance bugs1366049
-Node: Asking for help1369065
-Node: Maintainers1371052
-Node: Other Versions1372079
-Node: Installation summary1381683
-Node: Notes1383065
-Node: Compatibility Mode1383875
-Node: Additions1384697
-Node: Accessing The Source1385642
-Node: Adding Code1387173
-Node: New Ports1394284
-Node: Derived Files1398787
-Ref: Derived Files-Footnote-11404598
-Ref: Derived Files-Footnote-21404633
-Ref: Derived Files-Footnote-31405244
-Node: Future Extensions1405358
-Node: Implementation Limitations1406028
-Node: Extension Design1407270
-Node: Old Extension Problems1408430
-Ref: Old Extension Problems-Footnote-11410002
-Node: Extension New Mechanism Goals1410063
-Ref: Extension New Mechanism Goals-Footnote-11413533
-Node: Extension Other Design Decisions1413734
-Node: Extension Future Growth1415931
-Node: Notes summary1416551
-Node: Basic Concepts1417761
-Node: Basic High Level1418446
-Ref: figure-general-flow1418728
-Ref: figure-process-flow1419430
-Ref: Basic High Level-Footnote-11422800
-Node: Basic Data Typing1422989
-Node: Glossary1426397
-Node: Copying1459276
-Node: GNU Free Documentation License1496834
-Node: Index1521957
+Node: Foreword347032
+Node: Foreword451606
+Node: Preface53150
+Ref: Preface-Footnote-156136
+Ref: Preface-Footnote-256245
+Ref: Preface-Footnote-356479
+Node: History56625
+Node: Names59239
+Ref: Names-Footnote-160393
+Node: This Manual60556
+Ref: This Manual-Footnote-167485
+Node: Conventions67593
+Node: Manual History70022
+Ref: Manual History-Footnote-173047
+Ref: Manual History-Footnote-273088
+Node: How To Contribute73162
+Node: Acknowledgments74108
+Node: Getting Started79097
+Node: Running gawk81624
+Node: One-shot82842
+Node: Read Terminal84141
+Node: Long86195
+Node: Executable Scripts87845
+Ref: Executable Scripts-Footnote-190615
+Node: Comments90722
+Node: Quoting93252
+Node: DOS Quoting98896
+Node: Sample Data Files100976
+Node: Very Simple103611
+Node: Two Rules109865
+Node: More Complex111817
+Node: Statements/Lines114237
+Ref: Statements/Lines-Footnote-1119749
+Node: Other Features120038
+Node: When121006
+Ref: When-Footnote-1122808
+Node: Intro Summary122873
+Node: Invoking Gawk123827
+Node: Command Line125389
+Node: Options126239
+Ref: Options-Footnote-1145579
+Ref: Options-Footnote-2145814
+Node: Other Arguments145839
+Node: Naming Standard Input150004
+Node: Environment Variables151274
+Node: AWKPATH Variable151848
+Ref: AWKPATH Variable-Footnote-1155432
+Ref: AWKPATH Variable-Footnote-2155466
+Node: AWKLIBPATH Variable155857
+Ref: AWKLIBPATH Variable-Footnote-1157630
+Node: Other Environment Variables158025
+Node: Exit Status162501
+Node: Include Files163214
+Node: Loading Shared Libraries167266
+Node: Obsolete168756
+Node: Undocumented169505
+Node: Invoking Summary169802
+Node: Regexp172827
+Node: Regexp Usage174321
+Node: Escape Sequences176422
+Ref: Escape Sequences-Footnote-1183935
+Node: Regexp Operators184013
+Node: Regexp Operator Details184506
+Ref: Regexp Operator Details-Footnote-1192517
+Node: Interval Expressions192676
+Ref: Interval Expressions-Footnote-1194943
+Node: Bracket Expressions195041
+Ref: table-char-classes197597
+Node: Leftmost Longest201095
+Node: Computed Regexps202451
+Node: GNU Regexp Operators205966
+Node: Case-sensitivity209982
+Ref: Case-sensitivity-Footnote-1212932
+Ref: Case-sensitivity-Footnote-2213175
+Node: Regexp Summary213287
+Node: Reading Files214809
+Node: Records217126
+Node: awk split records218401
+Node: gawk split records223283
+Ref: gawk split records-Footnote-1228571
+Node: Fields228608
+Ref: Fields-Footnote-1231524
+Node: Nonconstant Fields231644
+Ref: Nonconstant Fields-Footnote-1233952
+Node: Changing Fields234168
+Node: Field Separators240466
+Node: Default Field Splitting243335
+Node: Regexp Field Splitting244477
+Node: Single Character Fields248306
+Node: Comma Separated Fields249395
+Ref: table-csv-examples250799
+Node: Command Line Field Separator253098
+Node: Full Line Fields256474
+Ref: Full Line Fields-Footnote-1258052
+Ref: Full Line Fields-Footnote-2258098
+Node: Field Splitting Summary258203
+Node: Constant Size260520
+Node: Fixed width data261264
+Node: Skipping intervening264779
+Node: Allowing trailing data265581
+Node: Fields with fixed data266642
+Node: Splitting By Content268264
+Ref: Splitting By Content-Footnote-1272714
+Node: More CSV272877
+Node: FS versus FPAT274535
+Node: Testing field creation275735
+Node: Multiple Line277509
+Node: Getline283978
+Node: Plain Getline286561
+Node: Getline/Variable289207
+Node: Getline/File290402
+Node: Getline/Variable/File291850
+Ref: Getline/Variable/File-Footnote-1293495
+Node: Getline/Pipe293591
+Node: Getline/Variable/Pipe296399
+Node: Getline/Coprocess297582
+Node: Getline/Variable/Coprocess298905
+Node: Getline Notes299671
+Node: Getline Summary302624
+Ref: table-getline-variants303068
+Node: Read Timeout303972
+Ref: Read Timeout-Footnote-1307934
+Node: Retrying Input307992
+Node: Command-line directories309259
+Node: Input Summary310197
+Node: Input Exercises313577
+Node: Printing314015
+Node: Print315958
+Node: Print Examples317459
+Node: Output Separators320304
+Node: OFMT322411
+Node: Printf324124
+Node: Basic Printf324929
+Node: Control Letters326564
+Node: Format Modifiers332010
+Node: Printf Examples338282
+Node: Redirection340823
+Node: Special FD348595
+Ref: Special FD-Footnote-1351893
+Node: Special Files351971
+Node: Other Inherited Files352600
+Node: Special Network353665
+Node: Special Caveats354553
+Node: Close Files And Pipes355536
+Ref: Close Files And Pipes-Footnote-1361660
+Node: Close Return Value361808
+Ref: table-close-pipe-return-values363079
+Ref: Close Return Value-Footnote-1363910
+Node: Noflush364066
+Node: Nonfatal365574
+Node: Output Summary367989
+Node: Output Exercises369275
+Node: Expressions369966
+Node: Values371166
+Node: Constants371844
+Node: Scalar Constants372539
+Ref: Scalar Constants-Footnote-1375115
+Ref: Scalar Constants-Footnote-2375365
+Node: Nondecimal-numbers375445
+Node: Regexp Constants378558
+Node: Using Constant Regexps379104
+Node: Standard Regexp Constants379750
+Node: Strong Regexp Constants383046
+Node: Variables386889
+Node: Using Variables387554
+Node: Assignment Options389528
+Node: Conversion392079
+Node: Strings And Numbers392611
+Ref: Strings And Numbers-Footnote-1395821
+Node: Locale influences conversions395930
+Ref: table-locale-affects398768
+Node: All Operators399410
+Node: Arithmetic Ops400051
+Node: Concatenation402874
+Ref: Concatenation-Footnote-1405810
+Node: Assignment Ops405929
+Ref: table-assign-ops411056
+Node: Increment Ops412437
+Node: Truth Values and Conditions416028
+Node: Truth Values417122
+Node: Typing and Comparison418202
+Node: Variable Typing419034
+Ref: Variable Typing-Footnote-1425678
+Ref: Variable Typing-Footnote-2425758
+Node: Comparison Operators425839
+Ref: table-relational-ops426266
+Node: POSIX String Comparison429942
+Ref: POSIX String Comparison-Footnote-1431699
+Ref: POSIX String Comparison-Footnote-2431842
+Node: Boolean Ops431926
+Ref: Boolean Ops-Footnote-1436600
+Node: Conditional Exp436696
+Node: Function Calls438476
+Node: Precedence442423
+Node: Locales446286
+Node: Expressions Summary447962
+Node: Patterns and Actions450617
+Node: Pattern Overview451753
+Node: Regexp Patterns453478
+Node: Expression Patterns454024
+Node: Ranges457929
+Node: BEGIN/END461103
+Node: Using BEGIN/END461912
+Ref: Using BEGIN/END-Footnote-1464820
+Node: I/O And BEGIN/END464930
+Node: BEGINFILE/ENDFILE467411
+Node: Empty470842
+Node: Using Shell Variables471159
+Node: Action Overview473495
+Node: Statements475930
+Node: If Statement477826
+Node: While Statement479389
+Node: Do Statement481477
+Node: For Statement482661
+Node: Switch Statement486016
+Node: Break Statement488565
+Node: Continue Statement490757
+Node: Next Statement492688
+Node: Nextfile Statement495167
+Node: Exit Statement498020
+Node: Built-in Variables500547
+Node: User-modified501724
+Node: Auto-set509931
+Ref: Auto-set-Footnote-1528015
+Ref: Auto-set-Footnote-2528233
+Node: ARGC and ARGV528289
+Node: Pattern Action Summary532718
+Node: Arrays535324
+Node: Array Basics536697
+Node: Array Intro537545
+Ref: figure-array-elements539556
+Ref: Array Intro-Footnote-1542409
+Node: Reference to Elements542541
+Node: Assigning Elements545061
+Node: Array Example545556
+Node: Scanning an Array547518
+Node: Controlling Scanning550613
+Ref: Controlling Scanning-Footnote-1557248
+Node: Numeric Array Subscripts557572
+Node: Uninitialized Subscripts559840
+Node: Delete561513
+Ref: Delete-Footnote-1564325
+Node: Multidimensional564382
+Node: Multiscanning567585
+Node: Arrays of Arrays569252
+Node: Arrays Summary573556
+Node: Functions575743
+Node: Built-in576875
+Node: Calling Built-in578064
+Node: Boolean Functions580104
+Node: Numeric Functions580666
+Ref: Numeric Functions-Footnote-1584851
+Ref: Numeric Functions-Footnote-2585534
+Ref: Numeric Functions-Footnote-3585586
+Node: String Functions585862
+Ref: String Functions-Footnote-1612313
+Ref: String Functions-Footnote-2612445
+Ref: String Functions-Footnote-3612701
+Node: Gory Details612788
+Ref: table-sub-escapes614797
+Ref: table-sub-proposed616428
+Ref: table-posix-sub617923
+Ref: table-gensub-escapes619596
+Ref: Gory Details-Footnote-1620515
+Node: I/O Functions620669
+Ref: table-system-return-values627345
+Ref: I/O Functions-Footnote-1629507
+Ref: I/O Functions-Footnote-2629655
+Node: Time Functions629775
+Ref: Time Functions-Footnote-1640857
+Ref: Time Functions-Footnote-2640925
+Ref: Time Functions-Footnote-3641087
+Ref: Time Functions-Footnote-4641198
+Ref: Time Functions-Footnote-5641314
+Ref: Time Functions-Footnote-6641541
+Node: Bitwise Functions641819
+Ref: table-bitwise-ops642417
+Ref: Bitwise Functions-Footnote-1648659
+Ref: Bitwise Functions-Footnote-2648836
+Node: Type Functions649031
+Node: I18N Functions651202
+Node: User-defined652937
+Node: Definition Syntax653683
+Ref: Definition Syntax-Footnote-1659501
+Node: Function Example659576
+Ref: Function Example-Footnote-1662555
+Node: Function Calling662577
+Node: Calling A Function663169
+Node: Variable Scope664139
+Node: Pass By Value/Reference667193
+Node: Function Caveats669921
+Ref: Function Caveats-Footnote-1672012
+Node: Return Statement672132
+Node: Dynamic Typing675164
+Node: Dynamic Typing Awk675742
+Node: Dynamic Typing Gawk677880
+Node: Indirect Calls681252
+Node: Functions Summary692389
+Node: Library Functions695355
+Ref: Library Functions-Footnote-1698903
+Ref: Library Functions-Footnote-2699048
+Node: Library Names699223
+Ref: Library Names-Footnote-1702994
+Ref: Library Names-Footnote-2703221
+Node: General Functions703315
+Node: Strtonum Function704585
+Node: Assert Function707667
+Node: Round Function711117
+Node: Cliff Random Function712689
+Node: Ordinal Functions713713
+Ref: Ordinal Functions-Footnote-1716816
+Ref: Ordinal Functions-Footnote-2717068
+Node: Join Function717282
+Ref: Join Function-Footnote-1719080
+Node: Getlocaltime Function719284
+Node: Readfile Function723058
+Node: Shell Quoting725087
+Node: Isnumeric Function726543
+Node: To CSV Function727979
+Node: Data File Management730071
+Node: Filetrans Function730703
+Node: Rewind Function734979
+Node: File Checking736950
+Ref: File Checking-Footnote-1738316
+Node: Empty Files738521
+Node: Ignoring Assigns740584
+Node: Getopt Function742158
+Ref: Getopt Function-Footnote-1757976
+Node: Passwd Functions758188
+Ref: Passwd Functions-Footnote-1767323
+Node: Group Functions767411
+Ref: Group Functions-Footnote-1775535
+Node: Walking Arrays775746
+Node: Library Functions Summary778792
+Node: Library Exercises780212
+Node: Sample Programs780697
+Node: Running Examples781479
+Node: Clones782231
+Node: Cut Program783499
+Node: Egrep Program793923
+Node: Id Program803228
+Node: Split Program813320
+Ref: Split Program-Footnote-1823533
+Node: Tee Program823718
+Node: Uniq Program826624
+Node: Wc Program834484
+Node: Bytes vs. Characters834879
+Node: Using extensions836479
+Node: wc program837257
+Node: Miscellaneous Programs842250
+Node: Dupword Program843475
+Node: Alarm Program845524
+Node: Translate Program850427
+Ref: Translate Program-Footnote-1855136
+Node: Labels Program855414
+Ref: Labels Program-Footnote-1858849
+Node: Word Sorting858933
+Node: History Sorting863107
+Node: Extract Program865380
+Node: Simple Sed873635
+Node: Igawk Program876845
+Ref: Igawk Program-Footnote-1892055
+Ref: Igawk Program-Footnote-2892261
+Ref: Igawk Program-Footnote-3892391
+Node: Anagram Program892518
+Node: Signature Program895604
+Node: Programs Summary896854
+Node: Programs Exercises898108
+Ref: Programs Exercises-Footnote-1902410
+Node: Advanced Features902496
+Node: Nondecimal Data904977
+Node: Boolean Typed Values906607
+Node: Array Sorting908564
+Node: Controlling Array Traversal909293
+Ref: Controlling Array Traversal-Footnote-1917796
+Node: Array Sorting Functions917918
+Ref: Array Sorting Functions-Footnote-1924015
+Node: Two-way I/O924223
+Ref: Two-way I/O-Footnote-1932194
+Ref: Two-way I/O-Footnote-2932385
+Node: TCP/IP Networking932467
+Node: Profiling935635
+Node: Persistent Memory945305
+Ref: Persistent Memory-Footnote-1954877
+Node: Extension Philosophy955008
+Node: Advanced Features Summary956535
+Node: Internationalization958801
+Node: I18N and L10N960503
+Node: Explaining gettext961198
+Ref: Explaining gettext-Footnote-1967334
+Ref: Explaining gettext-Footnote-2967527
+Node: Programmer i18n967692
+Ref: Programmer i18n-Footnote-1972804
+Node: Translator i18n972853
+Node: String Extraction973683
+Ref: String Extraction-Footnote-1974859
+Node: Printf Ordering974957
+Ref: Printf Ordering-Footnote-1977815
+Node: I18N Portability977883
+Ref: I18N Portability-Footnote-1980443
+Node: I18N Example980510
+Ref: I18N Example-Footnote-1983904
+Ref: I18N Example-Footnote-2983977
+Node: Gawk I18N984094
+Node: I18N Summary984748
+Node: Debugger986145
+Node: Debugging987165
+Node: Debugging Concepts987614
+Node: Debugging Terms989431
+Node: Awk Debugging992034
+Ref: Awk Debugging-Footnote-1993007
+Node: Sample Debugging Session993143
+Node: Debugger Invocation993693
+Node: Finding The Bug995318
+Node: List of Debugger Commands1001950
+Node: Breakpoint Control1003327
+Node: Debugger Execution Control1007149
+Node: Viewing And Changing Data1010623
+Node: Execution Stack1014357
+Node: Debugger Info1016038
+Node: Miscellaneous Debugger Commands1020333
+Node: Readline Support1025574
+Node: Limitations1026518
+Node: Debugging Summary1029142
+Node: Namespaces1030441
+Node: Global Namespace1031568
+Node: Qualified Names1033002
+Node: Default Namespace1034037
+Node: Changing The Namespace1034810
+Node: Naming Rules1036492
+Node: Internal Name Management1038407
+Node: Namespace Example1039477
+Node: Namespace And Features1042054
+Node: Namespace Summary1043509
+Node: Arbitrary Precision Arithmetic1045020
+Node: Computer Arithmetic1046539
+Ref: table-numeric-ranges1050347
+Ref: table-floating-point-ranges1050844
+Ref: Computer Arithmetic-Footnote-11051502
+Node: Math Definitions1051559
+Ref: table-ieee-formats1054591
+Node: MPFR features1055164
+Node: MPFR On Parole1055617
+Ref: MPFR On Parole-Footnote-11056458
+Node: MPFR Intro1056617
+Node: FP Math Caution1058301
+Ref: FP Math Caution-Footnote-11059373
+Node: Inexactness of computations1059746
+Node: Inexact representation1060777
+Node: Comparing FP Values1062158
+Node: Errors accumulate1063416
+Node: Strange values1064881
+Ref: Strange values-Footnote-11067535
+Node: Getting Accuracy1067640
+Node: Try To Round1070377
+Node: Setting precision1071284
+Ref: table-predefined-precision-strings1071989
+Node: Setting the rounding mode1073873
+Ref: table-gawk-rounding-modes1074255
+Ref: Setting the rounding mode-Footnote-11078307
+Node: Arbitrary Precision Integers1078490
+Ref: Arbitrary Precision Integers-Footnote-11081700
+Node: Checking for MPFR1081853
+Node: POSIX Floating Point Problems1083343
+Ref: POSIX Floating Point Problems-Footnote-11088163
+Node: Floating point summary1088201
+Node: Dynamic Extensions1090457
+Node: Extension Intro1092054
+Node: Plugin License1093356
+Node: Extension Mechanism Outline1094169
+Ref: figure-load-extension1094620
+Ref: figure-register-new-function1096198
+Ref: figure-call-new-function1097307
+Node: Extension API Description1099422
+Node: Extension API Functions Introduction1101151
+Ref: table-api-std-headers1103045
+Node: General Data Types1107486
+Ref: General Data Types-Footnote-11116632
+Node: Memory Allocation Functions1116935
+Ref: Memory Allocation Functions-Footnote-11121652
+Node: Constructor Functions1121751
+Node: API Ownership of MPFR and GMP Values1125652
+Node: Registration Functions1127205
+Node: Extension Functions1127909
+Node: Exit Callback Functions1133483
+Node: Extension Version String1134797
+Node: Input Parsers1135492
+Node: Output Wrappers1150111
+Node: Two-way processors1154953
+Node: Printing Messages1157306
+Ref: Printing Messages-Footnote-11158517
+Node: Updating ERRNO1158670
+Node: Requesting Values1159469
+Ref: table-value-types-returned1160222
+Node: Accessing Parameters1161330
+Node: Symbol Table Access1162611
+Node: Symbol table by name1163123
+Ref: Symbol table by name-Footnote-11166324
+Node: Symbol table by cookie1166456
+Ref: Symbol table by cookie-Footnote-11170725
+Node: Cached values1170789
+Ref: Cached values-Footnote-11174421
+Node: Array Manipulation1174578
+Ref: Array Manipulation-Footnote-11175677
+Node: Array Data Types1175714
+Ref: Array Data Types-Footnote-11178532
+Node: Array Functions1178628
+Node: Flattening Arrays1183657
+Node: Creating Arrays1190705
+Node: Redirection API1195547
+Node: Extension API Variables1198564
+Node: Extension Versioning1199287
+Ref: gawk-api-version1199716
+Node: Extension GMP/MPFR Versioning1201503
+Node: Extension API Informational Variables1203207
+Node: Extension API Boilerplate1204460
+Node: Changes from API V11208590
+Node: Finding Extensions1210222
+Node: Extension Example1210797
+Node: Internal File Description1211619
+Node: Internal File Ops1215911
+Ref: Internal File Ops-Footnote-11227461
+Node: Using Internal File Ops1227609
+Ref: Using Internal File Ops-Footnote-11230040
+Node: Extension Samples1230318
+Node: Extension Sample File Functions1231887
+Node: Extension Sample Fnmatch1240012
+Node: Extension Sample Fork1241607
+Node: Extension Sample Inplace1242883
+Node: Extension Sample Ord1246549
+Node: Extension Sample Readdir1247425
+Ref: table-readdir-file-types1248214
+Node: Extension Sample Revout1249570
+Node: Extension Sample Rev2way1250167
+Node: Extension Sample Read write array1250919
+Node: Extension Sample Readfile1254193
+Node: Extension Sample Time1255324
+Node: Extension Sample API Tests1257612
+Node: gawkextlib1258120
+Node: Extension summary1261152
+Node: Extension Exercises1265000
+Node: Language History1266270
+Node: V7/SVR3.11267982
+Node: SVR41270332
+Node: POSIX1271864
+Node: BTL1273289
+Node: POSIX/GNU1274056
+Node: Feature History1280711
+Node: Common Extensions1300513
+Node: Ranges and Locales1301988
+Ref: Ranges and Locales-Footnote-11306773
+Ref: Ranges and Locales-Footnote-21306800
+Ref: Ranges and Locales-Footnote-31307035
+Node: Contributors1307258
+Node: History summary1313449
+Node: Installation1314891
+Node: Gawk Distribution1315855
+Node: Getting1316347
+Node: Extracting1317346
+Node: Distribution contents1319052
+Node: Unix Installation1327126
+Node: Quick Installation1327946
+Node: Compiling with MPFR1330486
+Node: Shell Startup Files1331192
+Node: Additional Configuration Options1332349
+Node: Configuration Philosophy1334732
+Node: Compiling from Git1337232
+Node: Building the Documentation1337791
+Node: Non-Unix Installation1339203
+Node: PC Installation1339679
+Node: PC Binary Installation1340548
+Node: PC Compiling1341441
+Node: PC Using1342619
+Node: Cygwin1346335
+Node: MSYS1347587
+Node: OpenVMS Installation1348213
+Node: OpenVMS Compilation1348894
+Ref: OpenVMS Compilation-Footnote-11350377
+Node: OpenVMS Dynamic Extensions1350435
+Node: OpenVMS Installation Details1352071
+Node: OpenVMS Running1354502
+Node: OpenVMS GNV1358639
+Node: Bugs1359394
+Node: Bug definition1360314
+Node: Bug address1363915
+Node: Usenet1367484
+Node: Performance bugs1368697
+Node: Asking for help1371713
+Node: Maintainers1373700
+Node: Other Versions1374727
+Node: Installation summary1384331
+Node: Notes1385713
+Node: Compatibility Mode1386523
+Node: Additions1387345
+Node: Accessing The Source1388290
+Node: Adding Code1389821
+Node: New Ports1396932
+Node: Derived Files1401435
+Ref: Derived Files-Footnote-11407246
+Ref: Derived Files-Footnote-21407281
+Ref: Derived Files-Footnote-31407892
+Node: Future Extensions1408006
+Node: Implementation Limitations1408676
+Node: Extension Design1409918
+Node: Old Extension Problems1411078
+Ref: Old Extension Problems-Footnote-11412650
+Node: Extension New Mechanism Goals1412711
+Ref: Extension New Mechanism Goals-Footnote-11416181
+Node: Extension Other Design Decisions1416382
+Node: Extension Future Growth1418579
+Node: Notes summary1419199
+Node: Basic Concepts1420409
+Node: Basic High Level1421094
+Ref: figure-general-flow1421376
+Ref: figure-process-flow1422078
+Ref: Basic High Level-Footnote-11425448
+Node: Basic Data Typing1425637
+Node: Glossary1429045
+Node: Copying1461924
+Node: GNU Free Documentation License1499482
+Node: Index1524605
End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 97907d96..32df96a4 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -810,6 +810,9 @@ particular records in a file and perform operations upon
them.
returns.
* Dynamic Typing:: How variable types can change at
runtime.
+* Dynamic Typing Awk:: Dynamic typing in standard
+ @command{awk}.
+* Dynamic Typing Gawk:: Dynamic typing in @command{gawk}.
* Indirect Calls:: Choosing the function to call at
runtime.
* Functions Summary:: Summary of functions.
@@ -17943,6 +17946,7 @@ be called.
@menu
* Built-in:: Summarizes the built-in functions.
* User-defined:: Describes User-defined functions in detail.
+* Dynamic Typing:: How variable types can change at runtime.
* Indirect Calls:: Choosing the function to call at runtime.
* Functions Summary:: Summary of functions.
@end menu
@@ -20390,38 +20394,11 @@ the result of calling @code{split()}. (I.e., @var{x}
has the strnum
attribute; @pxref{Variable Typing}.)
@item "unassigned"
-@var{x} is a scalar variable that has not been assigned a value yet.
-For example:
-
-@example
-BEGIN @{
- # creates a[1] but it has no assigned value
- a[1]
- print typeof(a[1]) # unassigned
-@}
-@end example
+@var{x} is a @emph{scalar} variable that has not been assigned a value yet.
@item "untyped"
@var{x} has not yet been used yet at all; it can become a scalar or an
-array. The typing could even conceivably differ from run to run of
-the same program! For example:
-
-@example
-BEGIN @{
- print "initially, typeof(v) = ", typeof(v)
-
- if ("FOO" in ENVIRON)
- make_scalar(v)
- else
- make_array(v)
-
- print "typeof(v) =", typeof(v)
-@}
-
-function make_scalar(p, l) @{ l = p @}
-
-function make_array(p) @{ p[1] = 1 @}
-@end example
+array.
@end table
@end table
@@ -20443,32 +20420,8 @@ The @code{typeof()} function is general; it allows you
to determine
if a variable or function parameter is a scalar (number, string,
or strongly typed regexp) or an array.
-Normally, passing a variable that has never been used to a built-in
-function causes it to become a scalar variable (unassigned).
-However, @code{isarray()} and @code{typeof()} are different; they do
-not change their arguments from untyped to unassigned.
-
-This applies to both variables denoted by simple identifiers
-and array elements that come into existence simply by referencing them.
-Consider:
-
-@example
-$ @kbd{gawk 'BEGIN @{ print typeof(x) @}'}
-@print{} untyped
-$ @kbd{gawk 'BEGIN @{ print typeof(x["foo"]) @}'}
-@print{} untyped
-@end example
-
-Note that prior to @value{PVERSION} 5.2, array elements
-that come into existence simply by referencing them
-were different, they were automatically forced to be scalars:
-
-@example
-$ @kbd{gawk-5.1.1 'BEGIN @{ print typeof(x) @}'}
-@print{} untyped
-$ @kbd{gawk-5.1.1 'BEGIN @{ print typeof(x["foo"]) @}'}
-@print{} unassigned
-@end example
+We delay further discussion of @code{unassigned} vs.@: @code{untyped}
+to @ref{Dynamic Typing Gawk}.
@node I18N Functions
@subsection String-Translation Functions
@@ -20535,7 +20488,6 @@ them (i.e., to tell @command{awk} what they should do).
does.
* Function Calling:: Calling user-defined functions.
* Return Statement:: Specifying the value a function returns.
-* Dynamic Typing:: How variable types can change at runtime.
@end menu
@node Definition Syntax
@@ -21242,7 +21194,7 @@ the program reports (predictably) that 99,385 is the
largest value
in the array.
@node Dynamic Typing
-@subsection Functions and Their Effects on Variable Typing
+@section Variable Typing Is Dynamic
@cindex Saturday Night Live
@quotation
@@ -21254,6 +21206,16 @@ It's a floor wax!}
@command{awk} is a very fluid language.
It is possible that @command{awk} can't tell if an identifier
represents a scalar variable or an array until runtime.
+
+@menu
+* Dynamic Typing Awk:: Dynamic typing in standard @command{awk}.
+* Dynamic Typing Gawk:: Dynamic typing in @command{gawk}.
+@end menu
+
+@node Dynamic Typing Awk
+@subsection Dynamic Typing In Standard @command{awk}
+
+Let's first discuss standard @command{awk}.
Here is an annotated sample program:
@example
@@ -21330,6 +21292,133 @@ $ @kbd{gawk -v A=1 -f funky.awk }
POSIX does not specify the correct behavior, so be aware that different
implementations work differently.
+@node Dynamic Typing Gawk
+@subsection Dynamic Typing In @command{gawk}
+
+@quotation
+@i{Hc Svnt Dracones} (``Here be dragons'')
+@author The Lenox Globe @c @footnote{See
@uref{https://wiki.gis.com/wiki/index.php/Here_be_dragons}.}
+@end quotation
+
+Things in @command{gawk} can be a little more unexpected.
+Because @command{gawk} allows arrays of arrays, the same
+dynamic typing can be applied to array elements that
+have been created but not used.
+
+@example
+BEGIN @{
+ funky(a[1])
+ if (A == 0)
+ print "<" a[1] ">"
+ else
+ print a[1][1]
+@}
+
+function funky(arr)
+@{
+ if (A == 0)
+ arr = 1
+ else
+ arr[1] = 1
+@}
+@end example
+
+@noindent
+When run, the results are the same as in the earlier case:
+
+@example
+$ @kbd{gawk -v A=0 -f funky2.awk}
+@print{} <>
+$ @kbd{gawk -v A=1 -f funky2.awk}
+@print{} 1
+@end example
+
+The @code{typeof()} function provides us a ``window'' into @command{gawk}'s
+inner workings.
+Let's see how using a variable or array element can change
+it's type dynamically.
+Let's start with using a variable as a scalar:
+
+@example
+BEGIN @{
+ print typeof(a) # we don't know what a is yet
+ printf("a = %d\n", a) # use it as a scalar
+ print typeof(a) # now we know it's not an array
+@}
+@end example
+
+@noindent
+When run:
+
+@example
+$ @kbd{gawk -f typing1.awk}
+@print{} untyped
+@print{} a = 0
+@print{} unassigned
+@end example
+
+Initially, @code{a} is @code{untyped}, since we don't know yet if it's
+an array or scalar.
+After using it in the call to @code{printf()}, we know it's a scalar.
+However, since it was never given a concrete value (number, string, or regexp),
+it's type is @code{unassigned}.
+
+@command{gawk} is peculiar in that we can do the same thing, but
+change @code{a} into an array:
+
+@example
+BEGIN @{
+ print typeof(a) # we don't know what a is yet
+ a[1] # make a into an array
+ print typeof(a[1]) # but we don't know what a[1] is yet
+ printf("a[1] = %d\n", a[1]) # use it as a scalar
+ print typeof(a[1]) # now we know it's not an array
+@}
+@end example
+
+@noindent
+When run:
+
+@example
+$ @kbd{gawk -f typing2.awk}
+@print{} untyped
+@print{} untyped
+@print{} a[1] = 0
+@print{} unassigned
+@end example
+
+Normally, passing a variable that has never been used to a built-in
+function causes it to become a scalar variable (@code{unassigned}).
+However, @code{isarray()} and @code{typeof()} are different; they do
+not change their arguments from @code{untyped} to @code{unassigned}.
+
+As we saw, this applies to both variables denoted by simple identifiers
+and array elements that come into existence simply by referencing them:
+
+@example
+$ @kbd{gawk 'BEGIN @{ print typeof(x) @}'}
+@print{} untyped
+$ @kbd{gawk 'BEGIN @{ print typeof(x["foo"]) @}'}
+@print{} untyped
+@end example
+
+Note that prior to @value{PVERSION} 5.2, array elements
+that come into existence simply by referencing them
+were different, they were automatically forced to be scalars:
+
+@example
+$ @kbd{gawk-5.1.1 'BEGIN @{ print typeof(x) @}'}
+@print{} untyped
+$ @kbd{gawk-5.1.1 'BEGIN @{ print typeof(x["foo"]) @}'}
+@print{} unassigned
+@end example
+
+To sum up, variables and array elements get their nature (array or scalar)
+``fixed'' upon first use. This can lead to some weird cases, and it is
+best to avoid taking advantage of @command{gawk}'s dynamic nature, other
+than in the standard manner of passing untyped variables and array
+elements as function parameters.
+
@node Indirect Calls
@section Indirect Function Calls
@@ -21787,6 +21876,11 @@ If a variable that has never been used is passed to a
user-defined
function, how that function treats the variable can set its nature:
either scalar or array.
+@item
+@command{gawk} is even more fluid in its designation of variables
+and array elements as scalars or arrays. However, this can lead
+to weird situations, so you should tread carefully.
+
@item
@command{gawk} provides indirect function calls using a special syntax.
By setting a variable to the name of a function, you can
diff --git a/mpfr.c b/mpfr.c
index 21bac6cd..1cb02c11 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -351,9 +351,6 @@ mpg_force_number(NODE *n)
if (n->type == Node_elem_new) {
n->type = Node_val;
- n->flags &= ~STRING;
- n->stptr[0] = '0'; // STRCUR is still set
- n->stlen = 1;
return n;
}
diff --git a/node.c b/node.c
index f08a57d7..de12f05d 100644
--- a/node.c
+++ b/node.c
@@ -62,9 +62,6 @@ r_force_number(NODE *n)
if (n->type == Node_elem_new) {
n->type = Node_val;
- n->flags &= ~STRING;
- n->stptr[0] = '0'; // STRCUR is still set
- n->stlen = 1;
return n;
}
diff --git a/pc/ChangeLog b/pc/ChangeLog
index 0a42ff96..868adb5a 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,7 @@
+2023-11-28 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.tst: Regenerated.
+
2023-11-16 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.tst: Regenerated.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 39fe220a..caf72761 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -222,7 +222,7 @@ GAWK_EXT_TESTS = \
symtab11 symtab12 timeout typedregex1 typedregex2 typedregex3 \
typedregex4 typedregex5 typedregex6 typeof1 typeof2 typeof3 \
typeof4 typeof5 typeof6 unicode1 watchpoint1 \
- re_test
+ re_test typeof7 typeof8
ARRAYDEBUG_TESTS = arrdbg
EXTRA_TESTS = inftest regtest ignrcas3
@@ -3638,6 +3638,16 @@ re_test:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+typeof7:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+typeof8:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 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/ChangeLog b/test/ChangeLog
index 7d7e96b9..2061548f 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2023-11-28 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): New tests: typeof7 and typeof8.
+ * typeof7.awk, typeof7.ok, typeof8.awk, typeof8.ok: New files.
+
2023-11-16 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (EXTRA_DIST): New test, re_test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 6991272c..096ac2db 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1434,6 +1434,10 @@ EXTRA_DIST = \
typeof5.ok \
typeof6.awk \
typeof6.ok \
+ typeof7.awk \
+ typeof7.ok \
+ typeof8.awk \
+ typeof8.ok \
unicode1.awk \
unicode1.ok \
uninit2.awk \
@@ -1570,7 +1574,7 @@ GAWK_EXT_TESTS = \
symtab11 symtab12 timeout typedregex1 typedregex2 typedregex3 \
typedregex4 typedregex5 typedregex6 typeof1 typeof2 typeof3 \
typeof4 typeof5 typeof6 unicode1 watchpoint1 \
- re_test
+ re_test typeof7 typeof8
ARRAYDEBUG_TESTS = arrdbg
diff --git a/test/Makefile.in b/test/Makefile.in
index c437d114..c6463434 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1698,6 +1698,10 @@ EXTRA_DIST = \
typeof5.ok \
typeof6.awk \
typeof6.ok \
+ typeof7.awk \
+ typeof7.ok \
+ typeof8.awk \
+ typeof8.ok \
unicode1.awk \
unicode1.ok \
uninit2.awk \
@@ -1834,7 +1838,7 @@ GAWK_EXT_TESTS = \
symtab11 symtab12 timeout typedregex1 typedregex2 typedregex3 \
typedregex4 typedregex5 typedregex6 typeof1 typeof2 typeof3 \
typeof4 typeof5 typeof6 unicode1 watchpoint1 \
- re_test
+ re_test typeof7 typeof8
ARRAYDEBUG_TESTS = arrdbg
EXTRA_TESTS = inftest regtest ignrcas3
@@ -5427,6 +5431,16 @@ re_test:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+typeof7:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+typeof8:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 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 baaef547..e6f990a2 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -2319,6 +2319,16 @@ re_test:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+typeof7:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE:
$$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+typeof8:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 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/typeof7.awk b/test/typeof7.awk
new file mode 100644
index 00000000..e60b4bee
--- /dev/null
+++ b/test/typeof7.awk
@@ -0,0 +1,8 @@
+BEGIN {
+ a[1]
+ print typeof(a[1])
+ printf "test %d\n", a[1]
+ print typeof(a[1])
+ printf "test2 <%s>\n", a[1]
+ print typeof(a[1])
+}
diff --git a/test/typeof7.ok b/test/typeof7.ok
new file mode 100644
index 00000000..ea7d5c67
--- /dev/null
+++ b/test/typeof7.ok
@@ -0,0 +1,5 @@
+untyped
+test 0
+unassigned
+test2 <>
+unassigned
diff --git a/test/typeof8.awk b/test/typeof8.awk
new file mode 100644
index 00000000..71a1ee9a
--- /dev/null
+++ b/test/typeof8.awk
@@ -0,0 +1,10 @@
+BEGIN {
+ a[1]
+ print typeof(a[1])
+ printf "test %d\n", a[1]
+ print typeof(a[1])
+ a[1][2] = 5
+ print typeof(a[1])
+ printf "test2 %s\n", a[1]
+ print typeof(a[1])
+}
diff --git a/test/typeof8.ok b/test/typeof8.ok
new file mode 100644
index 00000000..ca520df7
--- /dev/null
+++ b/test/typeof8.ok
@@ -0,0 +1,5 @@
+untyped
+test 0
+unassigned
+gawk: typeof8.awk:6: fatal: attempt to use scalar `a["1"]' as an array
+EXIT CODE: 2
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 13 +
awk.h | 6 +-
builtin.c | 8 +-
doc/ChangeLog | 6 +
doc/gawk.info | 1438 +++++++++++++++++++++++++++++-------------------------
doc/gawk.texi | 208 +++++---
mpfr.c | 3 -
node.c | 3 -
pc/ChangeLog | 4 +
pc/Makefile.tst | 12 +-
test/ChangeLog | 5 +
test/Makefile.am | 6 +-
test/Makefile.in | 16 +-
test/Maketests | 10 +
test/typeof7.awk | 8 +
test/typeof7.ok | 5 +
test/typeof8.awk | 10 +
test/typeof8.ok | 5 +
18 files changed, 1022 insertions(+), 744 deletions(-)
create mode 100644 test/typeof7.awk
create mode 100644 test/typeof7.ok
create mode 100644 test/typeof8.awk
create mode 100644 test/typeof8.ok
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, gawk-5.3-stable, updated. gawk-4.1.0-5430-gc34167da,
Arnold Robbins <=