diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | doc/ChangeLog | 5 | ||||
-rw-r--r-- | doc/awkcard.in | 24 | ||||
-rw-r--r-- | doc/gawk.1 | 56 | ||||
-rw-r--r-- | doc/gawk.info | 598 | ||||
-rw-r--r-- | doc/gawk.texi | 60 | ||||
-rw-r--r-- | symbol.c | 4 |
7 files changed, 471 insertions, 280 deletions
@@ -1,3 +1,7 @@ +2012-10-02 Arnold D. Robbins <arnold@skeeve.com> + + * symbol.c (lookup): If do_posix, skip the global table. + 2012-09-25 Arnold D. Robbins <arnold@skeeve.com> First cut at SYMTAB and FUNCTAB. This does the following: diff --git a/doc/ChangeLog b/doc/ChangeLog index f84622d7..0efd3f73 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2012-10-02 Arnold D. Robbins <arnold@skeeve.com> + + * gawk.texi, gawk.1, awkcard.in: Document FUNCTAB, SYMTAB, and + PROCINFO["identifiers"]. + 2012-09-23 Arnold D. Robbins <arnold@skeeve.com> * gawk.texi (Nextfile Statement): Document that it's now part of POSIX diff --git a/doc/awkcard.in b/doc/awkcard.in index 372d5587..9fae7cce 100644 --- a/doc/awkcard.in +++ b/doc/awkcard.in @@ -551,7 +551,8 @@ variables, each element being the value of that variable. T} \*(CB\*(FCERRNO\fP T{ -String describing the error if a +... String describing the error if a +String error value if a \*(FCgetline\*(FR redirection or read fails, or if @@ -580,6 +581,10 @@ T} Input field separator, a space by default (see \fHFields\fP above). T} +\*(CB\*(FCFUNCTAB\fP T{ +An array indexed by the names of all user-defined +and extension functions.\*(CD +T} \*(CB\*(FCIGNORECASE\fP T{ If non-zero, all regular expression and string operations ignore case. @@ -594,13 +599,13 @@ T} \*(CB\*(FCLINT\fP T{ Provides dynamic control of the \*(FC\-\^\-lint\fP option from within an AWK program. -When true, \*(GK -prints lint warnings. -When assigned the string value \*(FC"fatal"\*(FR, -lint warnings become fatal errors. -Any other true value just prints warnings.\*(CD +... When true, \*(GK +... prints lint warnings. +... When assigned the string value \*(FC"fatal"\*(FR, +... lint warnings become fatal errors. +... Any other true value just prints warnings. T} -\*(FCNF\fP T{ +\*(CD\*(FCNF\fP T{ Number of fields in the current input record. T} \*(FCNR\fP T{ @@ -650,6 +655,11 @@ Character(s) used to separate multiple subscripts in array elements, by default \*(FC"\e034"\*(FR. (See \fHArrays\fP below). T} +\*(CB\*(FCSYMTAB\fP T{ +An array indexed by the names of all global +variables and arrays. May be used to indirectly +set variable and array values.\*(CD +T} \*(CB\*(FCTEXTDOMAIN\fP T{ The internationalization text domain, for finding the localized @@ -14,7 +14,7 @@ . if \w'\(rq' .ds rq "\(rq . \} .\} -.TH GAWK 1 "Aug 09 2012" "Free Software Foundation" "Utility Commands" +.TH GAWK 1 "Oct 02 2012" "Free Software Foundation" "Utility Commands" .SH NAME gawk \- pattern scanning and processing language .SH SYNOPSIS @@ -989,6 +989,12 @@ The input field separator, a space by default. See .BR Fields , above. .TP +.B FUNCTAB +An array whose indices are the names of all the user-defined +or extension functions in the program. +.BR NOTE : +The array values cannot currently be used. +.TP .B IGNORECASE Controls the case-sensitivity of all regular expression and string operations. If @@ -1108,6 +1114,35 @@ or \fB"FIELDWIDTHS"\fP if field splitting with .B FIELDWIDTHS is in effect. .TP +\fBPROCINFO["identifiers"]\fP +A subarray, indexed by the names of all identifiers used in the +text of the AWK program. For each identifier, the value of the element is one of the following: +.RS +.TP +\fB"array"\fR +The identifier is an array. +.TP +\fB"extension"\fR +The identifier is an extension function loaded via +.BR @load . +.TP +\fB"scalar"\fR +The identifier is a scalar. +.TP +\fB"untyped"\fR +The identifier is untyped (could be used as a scalar or array, +.I gawk +doesn't know yet). +.TP +\fB"user"\fR +The identifier is a user-defined function. +.RE +The values indicate what +.I gawk +knows about the identifiers after it has finished parsing the program; they are +.I not +updated while the program runs. +.TP \fBPROCINFO["gid"]\fP the value of the .IR getgid (2) @@ -1236,6 +1271,25 @@ The length of the string matched by The character used to separate multiple subscripts in array elements, by default \fB"\e034"\fR. .TP +.B SYMTAB +An array whose indices are the names of all currently defined +global variables and arrays in the program. The array may be used +for indirect access to read or write the value of a variable: +.PP +.RS +.ft B +foo = 5 +SYMTAB["foo"] = 4 +print foo # prints 4 +.ft R +.RE +.PP +The +.B isarray() +function may be used to test if an element in +.B SYMTAB +is an array. +.TP .B TEXTDOMAIN The text domain of the \*(AK program; used to find the localized translations for the program's strings. diff --git a/doc/gawk.info b/doc/gawk.info index 2d75333d..67fb4a1b 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -9602,6 +9602,11 @@ with a pound sign (`#'). create or remove fields from the current record. *Note Changing Fields::. +`FUNCTAB #' + An array whose indices are the names of all the user-defined or + extension functions in the program. *NOTE*: The array values + cannot currently be used. + `NR' The number of input records `awk' has processed since the beginning of the program's execution (*note Records::). `NR' is @@ -9624,6 +9629,32 @@ with a pound sign (`#'). effect, or `"FPAT"' if field matching with `FPAT' is in effect. + `PROCINFO["identifiers"]' + A subarray, indexed by the names of all identifiers used in + the text of the AWK program. For each identifier, the value + of the element is one of the following: + + `"array"' + The identifier is an array. + + `"extension"' + The identifier is an extension function loaded via + `@load'. + + `"scalar"' + The identifier is a scalar. + + `"untyped"' + The identifier is untyped (could be used as a scalar or + array, `gawk' doesn't know yet). + + `"user"' + The identifier is a user-defined function. + + The values indicate what `gawk' knows about the identifiers + after it has finished parsing the program; they are _not_ + updated while the program runs. + `PROCINFO["gid"]' The value of the `getgid()' system call. @@ -9705,6 +9736,23 @@ with a pound sign (`#'). implementations, or if `gawk' is in compatibility mode (*note Options::), it is not special. +`SYMTAB #' + An array whose indices are the names of all currently defined + global variables and arrays in the program. The array may be used + for indirect access to read or write the value of a variable: + + foo = 5 + SYMTAB["foo"] = 4 + print foo # prints 4 + + The `isarray()' function (*note Type Functions::) may be used to + test if an element in `SYMTAB' is an array. + + NOTE: In order to avoid severe time-travel paradoxes (as well + as to avoid difficult implementation issues), neither + `FUNCTAB' nor `SYMTAB' are available as elements within the + `SYMTAB' array. + Advanced Notes: Changing `NR' and `FNR' --------------------------------------- @@ -25967,7 +26015,7 @@ Index (line 67) * advanced features, data files as single record: Records. (line 180) * advanced features, fixed-width data: Constant Size. (line 9) -* advanced features, FNR/NR variables: Auto-set. (line 225) +* advanced features, FNR/NR variables: Auto-set. (line 273) * advanced features, gawk: Advanced Features. (line 6) * advanced features, gawk, network programming: TCP/IP Networking. (line 6) @@ -26472,7 +26520,7 @@ Index (line 47) * dark corner, FILENAME variable <1>: Auto-set. (line 93) * dark corner, FILENAME variable: Getline Notes. (line 19) -* dark corner, FNR/NR variables: Auto-set. (line 225) +* dark corner, FNR/NR variables: Auto-set. (line 273) * dark corner, format-control characters: Control Letters. (line 18) * dark corner, FS as null string: Single Character Fields. (line 20) @@ -26642,6 +26690,7 @@ Index * differences in awk and gawk, FIELDWIDTHS variable: User-modified. (line 35) * differences in awk and gawk, FPAT variable: User-modified. (line 45) +* differences in awk and gawk, FUNCTAB variable: Auto-set. (line 119) * differences in awk and gawk, function arguments (gawk): Calling Built-in. (line 16) * differences in awk and gawk, getline command: Getline. (line 19) @@ -26666,14 +26715,14 @@ Index (line 6) * differences in awk and gawk, print/printf statements: Format Modifiers. (line 13) -* differences in awk and gawk, PROCINFO array: Auto-set. (line 124) +* differences in awk and gawk, PROCINFO array: Auto-set. (line 129) * differences in awk and gawk, record separators: Records. (line 117) * differences in awk and gawk, regexp constants: Using Constant Regexps. (line 43) * differences in awk and gawk, regular expressions: Case-sensitivity. (line 26) * differences in awk and gawk, RS/RT variables: Records. (line 172) -* differences in awk and gawk, RT variable: Auto-set. (line 214) +* differences in awk and gawk, RT variable: Auto-set. (line 245) * differences in awk and gawk, single-character fields: Single Character Fields. (line 6) * differences in awk and gawk, split() function: String Functions. @@ -26682,6 +26731,7 @@ Index * differences in awk and gawk, strings, storing: Records. (line 192) * differences in awk and gawk, strtonum() function (gawk): String Functions. (line 404) +* differences in awk and gawk, SYMTAB variable: Auto-set. (line 253) * differences in awk and gawk, TEXTDOMAIN variable: User-modified. (line 162) * differences in awk and gawk, trunc-mod operation: Arithmetic Ops. @@ -26952,7 +27002,7 @@ Index * floating-point, numbers: General Arithmetic. (line 6) * FNR variable <1>: Auto-set. (line 103) * FNR variable: Records. (line 6) -* FNR variable, changing: Auto-set. (line 225) +* FNR variable, changing: Auto-set. (line 273) * for statement: For Statement. (line 6) * for statement, in arrays: Scanning an Array. (line 20) * format specifiers, mixing regular with positional specifiers: Printf Ordering. @@ -26995,6 +27045,7 @@ Index * FSF (Free Software Foundation) <1>: Glossary. (line 301) * FSF (Free Software Foundation) <2>: Getting. (line 10) * FSF (Free Software Foundation): Manual History. (line 6) +* FUNCTAB array: Auto-set. (line 119) * function calls: Function Calls. (line 6) * function calls, indirect: Indirect Calls. (line 6) * function pointers: Indirect Calls. (line 6) @@ -27082,6 +27133,7 @@ Index * gawk, FPAT variable in <1>: User-modified. (line 45) * gawk, FPAT variable in: Splitting By Content. (line 26) +* gawk, FUNCTAB array in: Auto-set. (line 119) * gawk, function arguments and: Calling Built-in. (line 16) * gawk, functions, adding: Dynamic Extensions. (line 9) * gawk, hexadecimal numbers and: Nondecimal-numbers. (line 42) @@ -27113,7 +27165,7 @@ Index * gawk, OS/2 version of: PC Using. (line 11) * gawk, PROCINFO array in <1>: Two-way I/O. (line 116) * gawk, PROCINFO array in <2>: Time Functions. (line 46) -* gawk, PROCINFO array in: Auto-set. (line 124) +* gawk, PROCINFO array in: Auto-set. (line 129) * gawk, regexp constants and: Using Constant Regexps. (line 28) * gawk, regular expressions, case sensitivity: Case-sensitivity. @@ -27121,7 +27173,7 @@ Index * gawk, regular expressions, operators: GNU Regexp Operators. (line 6) * gawk, regular expressions, precedence: Regexp Operators. (line 161) -* gawk, RT variable in <1>: Auto-set. (line 214) +* gawk, RT variable in <1>: Auto-set. (line 245) * gawk, RT variable in <2>: Getline/Variable/File. (line 10) * gawk, RT variable in <3>: Multiple Line. (line 129) @@ -27130,6 +27182,7 @@ Index * gawk, source code, obtaining: Getting. (line 6) * gawk, splitting fields and: Constant Size. (line 87) * gawk, string-translation functions: I18N Functions. (line 6) +* gawk, SYMTAB array in: Auto-set. (line 253) * gawk, TEXTDOMAIN variable in: User-modified. (line 162) * gawk, timestamps: Time Functions. (line 6) * gawk, uses for: Preface. (line 36) @@ -27532,9 +27585,9 @@ Index (line 49) * noassign.awk program: Ignoring Assigns. (line 15) * not Boolean-logic operator: Boolean Ops. (line 6) -* NR variable <1>: Auto-set. (line 119) +* NR variable <1>: Auto-set. (line 124) * NR variable: Records. (line 6) -* NR variable, changing: Auto-set. (line 225) +* NR variable, changing: Auto-set. (line 273) * null strings <1>: Basic Data Typing. (line 26) * null strings <2>: Truth Values. (line 6) * null strings <3>: Regexp Field Splitting. @@ -27817,7 +27870,7 @@ Index * PROCINFO array <3>: Passwd Functions. (line 6) * PROCINFO array <4>: Two-way I/O. (line 116) * PROCINFO array <5>: Time Functions. (line 46) -* PROCINFO array <6>: Auto-set. (line 124) +* PROCINFO array <6>: Auto-set. (line 129) * PROCINFO array: Obsolete. (line 11) * profiling awk programs: Profiling. (line 6) * profiling awk programs, dynamically: Profiling. (line 171) @@ -27959,7 +28012,7 @@ Index * right angle bracket (>), >> operator (I/O): Redirection. (line 50) * right shift, bitwise: Bitwise Functions. (line 32) * Ritchie, Dennis: Basic Data Typing. (line 55) -* RLENGTH variable: Auto-set. (line 201) +* RLENGTH variable: Auto-set. (line 232) * RLENGTH variable, match() function and: String Functions. (line 223) * Robbins, Arnold <1>: Future Extensions. (line 6) * Robbins, Arnold <2>: Bugs. (line 32) @@ -27986,9 +28039,9 @@ Index * RS variable: Records. (line 20) * RS variable, multiline records and: Multiple Line. (line 17) * rshift() function (gawk): Bitwise Functions. (line 52) -* RSTART variable: Auto-set. (line 207) +* RSTART variable: Auto-set. (line 238) * RSTART variable, match() function and: String Functions. (line 223) -* RT variable <1>: Auto-set. (line 214) +* RT variable <1>: Auto-set. (line 245) * RT variable <2>: Getline/Variable/File. (line 10) * RT variable <3>: Multiple Line. (line 129) @@ -28180,6 +28233,7 @@ Index * substr() function: String Functions. (line 481) * Sumner, Andrew: Other Versions. (line 55) * switch statement: Switch Statement. (line 6) +* SYMTAB array: Auto-set. (line 253) * syntactic ambiguity: /= operator vs. /=.../ regexp constant: Assignment Ops. (line 148) * system() function: I/O Functions. (line 63) @@ -28613,264 +28667,264 @@ Node: Built-in Variables393879 Node: User-modified394974 Ref: User-modified-Footnote-1403329 Node: Auto-set403391 -Ref: Auto-set-Footnote-1413299 -Node: ARGC and ARGV413504 -Node: Arrays417355 -Node: Array Basics418860 -Node: Array Intro419686 -Node: Reference to Elements424004 -Node: Assigning Elements426274 -Node: Array Example426765 -Node: Scanning an Array428497 -Node: Controlling Scanning430811 -Ref: Controlling Scanning-Footnote-1435744 -Node: Delete436060 -Ref: Delete-Footnote-1438825 -Node: Numeric Array Subscripts438882 -Node: Uninitialized Subscripts441065 -Node: Multi-dimensional442693 -Node: Multi-scanning445787 -Node: Arrays of Arrays447378 -Node: Functions452023 -Node: Built-in452845 -Node: Calling Built-in453923 -Node: Numeric Functions455911 -Ref: Numeric Functions-Footnote-1459743 -Ref: Numeric Functions-Footnote-2460100 -Ref: Numeric Functions-Footnote-3460148 -Node: String Functions460417 -Ref: String Functions-Footnote-1483914 -Ref: String Functions-Footnote-2484043 -Ref: String Functions-Footnote-3484291 -Node: Gory Details484378 -Ref: table-sub-escapes486057 -Ref: table-sub-posix-92487411 -Ref: table-sub-proposed488754 -Ref: table-posix-sub490104 -Ref: table-gensub-escapes491650 -Ref: Gory Details-Footnote-1492857 -Ref: Gory Details-Footnote-2492908 -Node: I/O Functions493059 -Ref: I/O Functions-Footnote-1499714 -Node: Time Functions499861 -Ref: Time Functions-Footnote-1510753 -Ref: Time Functions-Footnote-2510821 -Ref: Time Functions-Footnote-3510979 -Ref: Time Functions-Footnote-4511090 -Ref: Time Functions-Footnote-5511202 -Ref: Time Functions-Footnote-6511429 -Node: Bitwise Functions511695 -Ref: table-bitwise-ops512253 -Ref: Bitwise Functions-Footnote-1516474 -Node: Type Functions516658 -Node: I18N Functions517128 -Node: User-defined518755 -Node: Definition Syntax519559 -Ref: Definition Syntax-Footnote-1524469 -Node: Function Example524538 -Node: Function Caveats527132 -Node: Calling A Function527553 -Node: Variable Scope528668 -Node: Pass By Value/Reference530643 -Node: Return Statement534083 -Node: Dynamic Typing537064 -Node: Indirect Calls537799 -Node: Internationalization547484 -Node: I18N and L10N548910 -Node: Explaining gettext549596 -Ref: Explaining gettext-Footnote-1554662 -Ref: Explaining gettext-Footnote-2554846 -Node: Programmer i18n555011 -Node: Translator i18n559211 -Node: String Extraction560004 -Ref: String Extraction-Footnote-1560965 -Node: Printf Ordering561051 -Ref: Printf Ordering-Footnote-1563835 -Node: I18N Portability563899 -Ref: I18N Portability-Footnote-1566348 -Node: I18N Example566411 -Ref: I18N Example-Footnote-1569046 -Node: Gawk I18N569118 -Node: Advanced Features569735 -Node: Nondecimal Data571248 -Node: Array Sorting572831 -Node: Controlling Array Traversal573528 -Node: Array Sorting Functions581766 -Ref: Array Sorting Functions-Footnote-1585440 -Ref: Array Sorting Functions-Footnote-2585533 -Node: Two-way I/O585727 -Ref: Two-way I/O-Footnote-1591159 -Node: TCP/IP Networking591229 -Node: Profiling594073 -Node: Library Functions601527 -Ref: Library Functions-Footnote-1604534 -Node: Library Names604705 -Ref: Library Names-Footnote-1608176 -Ref: Library Names-Footnote-2608396 -Node: General Functions608482 -Node: Strtonum Function609435 -Node: Assert Function612365 -Node: Round Function615691 -Node: Cliff Random Function617234 -Node: Ordinal Functions618250 -Ref: Ordinal Functions-Footnote-1621320 -Ref: Ordinal Functions-Footnote-2621572 -Node: Join Function621781 -Ref: Join Function-Footnote-1623552 -Node: Getlocaltime Function623752 -Node: Data File Management627467 -Node: Filetrans Function628099 -Node: Rewind Function632238 -Node: File Checking633625 -Node: Empty Files634719 -Node: Ignoring Assigns636949 -Node: Getopt Function638502 -Ref: Getopt Function-Footnote-1649806 -Node: Passwd Functions650009 -Ref: Passwd Functions-Footnote-1658984 -Node: Group Functions659072 -Node: Walking Arrays667156 -Node: Sample Programs668725 -Node: Running Examples669390 -Node: Clones670118 -Node: Cut Program671342 -Node: Egrep Program681187 -Ref: Egrep Program-Footnote-1688960 -Node: Id Program689070 -Node: Split Program692686 -Ref: Split Program-Footnote-1696205 -Node: Tee Program696333 -Node: Uniq Program699136 -Node: Wc Program706565 -Ref: Wc Program-Footnote-1710831 -Ref: Wc Program-Footnote-2711031 -Node: Miscellaneous Programs711123 -Node: Dupword Program712311 -Node: Alarm Program714342 -Node: Translate Program719091 -Ref: Translate Program-Footnote-1723478 -Ref: Translate Program-Footnote-2723706 -Node: Labels Program723840 -Ref: Labels Program-Footnote-1727211 -Node: Word Sorting727295 -Node: History Sorting731179 -Node: Extract Program733018 -Ref: Extract Program-Footnote-1740501 -Node: Simple Sed740629 -Node: Igawk Program743691 -Ref: Igawk Program-Footnote-1758848 -Ref: Igawk Program-Footnote-2759049 -Node: Anagram Program759187 -Node: Signature Program762255 -Node: Debugger763355 -Node: Debugging764321 -Node: Debugging Concepts764754 -Node: Debugging Terms766610 -Node: Awk Debugging769207 -Node: Sample Debugging Session770099 -Node: Debugger Invocation770619 -Node: Finding The Bug771948 -Node: List of Debugger Commands778436 -Node: Breakpoint Control779770 -Node: Debugger Execution Control783434 -Node: Viewing And Changing Data786794 -Node: Execution Stack790150 -Node: Debugger Info791617 -Node: Miscellaneous Debugger Commands795598 -Node: Readline Support801043 -Node: Limitations801874 -Node: Arbitrary Precision Arithmetic804126 -Ref: Arbitrary Precision Arithmetic-Footnote-1805768 -Node: General Arithmetic805916 -Node: Floating Point Issues807636 -Node: String Conversion Precision808517 -Ref: String Conversion Precision-Footnote-1810223 -Node: Unexpected Results810332 -Node: POSIX Floating Point Problems812485 -Ref: POSIX Floating Point Problems-Footnote-1816310 -Node: Integer Programming816348 -Node: Floating-point Programming818101 -Ref: Floating-point Programming-Footnote-1824410 -Node: Floating-point Representation824674 -Node: Floating-point Context825839 -Ref: table-ieee-formats826681 -Node: Rounding Mode828065 -Ref: table-rounding-modes828544 -Ref: Rounding Mode-Footnote-1831548 -Node: Gawk and MPFR831729 -Node: Arbitrary Precision Floats832971 -Ref: Arbitrary Precision Floats-Footnote-1835400 -Node: Setting Precision835711 -Node: Setting Rounding Mode838444 -Ref: table-gawk-rounding-modes838848 -Node: Floating-point Constants840028 -Node: Changing Precision841452 -Ref: Changing Precision-Footnote-1842852 -Node: Exact Arithmetic843026 -Node: Arbitrary Precision Integers846134 -Ref: Arbitrary Precision Integers-Footnote-1849134 -Node: Dynamic Extensions849281 -Node: Plugin License850199 -Node: Sample Library850813 -Node: Internal File Description851497 -Node: Internal File Ops855210 -Ref: Internal File Ops-Footnote-1859773 -Node: Using Internal File Ops859913 -Node: Language History862289 -Node: V7/SVR3.1863811 -Node: SVR4866132 -Node: POSIX867574 -Node: BTL868582 -Node: POSIX/GNU869316 -Node: Common Extensions874851 -Node: Ranges and Locales875958 -Ref: Ranges and Locales-Footnote-1880576 -Ref: Ranges and Locales-Footnote-2880603 -Ref: Ranges and Locales-Footnote-3880863 -Node: Contributors881084 -Node: Installation885380 -Node: Gawk Distribution886274 -Node: Getting886758 -Node: Extracting887584 -Node: Distribution contents889276 -Node: Unix Installation894498 -Node: Quick Installation895115 -Node: Additional Configuration Options897077 -Node: Configuration Philosophy898554 -Node: Non-Unix Installation900896 -Node: PC Installation901354 -Node: PC Binary Installation902653 -Node: PC Compiling904501 -Node: PC Testing907445 -Node: PC Using908621 -Node: Cygwin912806 -Node: MSYS913806 -Node: VMS Installation914320 -Node: VMS Compilation914923 -Ref: VMS Compilation-Footnote-1915930 -Node: VMS Installation Details915988 -Node: VMS Running917623 -Node: VMS Old Gawk919230 -Node: Bugs919704 -Node: Other Versions923556 -Node: Notes928871 -Node: Compatibility Mode929458 -Node: Additions930241 -Node: Accessing The Source931168 -Node: Adding Code932594 -Node: New Ports938636 -Node: Derived Files942771 -Ref: Derived Files-Footnote-1948076 -Ref: Derived Files-Footnote-2948110 -Ref: Derived Files-Footnote-3948710 -Node: Future Extensions948808 -Node: Basic Concepts950295 -Node: Basic High Level950976 -Ref: Basic High Level-Footnote-1955011 -Node: Basic Data Typing955196 -Node: Glossary958551 -Node: Copying983527 -Node: GNU Free Documentation License1021084 -Node: Index1046221 +Ref: Auto-set-Footnote-1414993 +Node: ARGC and ARGV415198 +Node: Arrays419049 +Node: Array Basics420554 +Node: Array Intro421380 +Node: Reference to Elements425698 +Node: Assigning Elements427968 +Node: Array Example428459 +Node: Scanning an Array430191 +Node: Controlling Scanning432505 +Ref: Controlling Scanning-Footnote-1437438 +Node: Delete437754 +Ref: Delete-Footnote-1440519 +Node: Numeric Array Subscripts440576 +Node: Uninitialized Subscripts442759 +Node: Multi-dimensional444387 +Node: Multi-scanning447481 +Node: Arrays of Arrays449072 +Node: Functions453717 +Node: Built-in454539 +Node: Calling Built-in455617 +Node: Numeric Functions457605 +Ref: Numeric Functions-Footnote-1461437 +Ref: Numeric Functions-Footnote-2461794 +Ref: Numeric Functions-Footnote-3461842 +Node: String Functions462111 +Ref: String Functions-Footnote-1485608 +Ref: String Functions-Footnote-2485737 +Ref: String Functions-Footnote-3485985 +Node: Gory Details486072 +Ref: table-sub-escapes487751 +Ref: table-sub-posix-92489105 +Ref: table-sub-proposed490448 +Ref: table-posix-sub491798 +Ref: table-gensub-escapes493344 +Ref: Gory Details-Footnote-1494551 +Ref: Gory Details-Footnote-2494602 +Node: I/O Functions494753 +Ref: I/O Functions-Footnote-1501408 +Node: Time Functions501555 +Ref: Time Functions-Footnote-1512447 +Ref: Time Functions-Footnote-2512515 +Ref: Time Functions-Footnote-3512673 +Ref: Time Functions-Footnote-4512784 +Ref: Time Functions-Footnote-5512896 +Ref: Time Functions-Footnote-6513123 +Node: Bitwise Functions513389 +Ref: table-bitwise-ops513947 +Ref: Bitwise Functions-Footnote-1518168 +Node: Type Functions518352 +Node: I18N Functions518822 +Node: User-defined520449 +Node: Definition Syntax521253 +Ref: Definition Syntax-Footnote-1526163 +Node: Function Example526232 +Node: Function Caveats528826 +Node: Calling A Function529247 +Node: Variable Scope530362 +Node: Pass By Value/Reference532337 +Node: Return Statement535777 +Node: Dynamic Typing538758 +Node: Indirect Calls539493 +Node: Internationalization549178 +Node: I18N and L10N550604 +Node: Explaining gettext551290 +Ref: Explaining gettext-Footnote-1556356 +Ref: Explaining gettext-Footnote-2556540 +Node: Programmer i18n556705 +Node: Translator i18n560905 +Node: String Extraction561698 +Ref: String Extraction-Footnote-1562659 +Node: Printf Ordering562745 +Ref: Printf Ordering-Footnote-1565529 +Node: I18N Portability565593 +Ref: I18N Portability-Footnote-1568042 +Node: I18N Example568105 +Ref: I18N Example-Footnote-1570740 +Node: Gawk I18N570812 +Node: Advanced Features571429 +Node: Nondecimal Data572942 +Node: Array Sorting574525 +Node: Controlling Array Traversal575222 +Node: Array Sorting Functions583460 +Ref: Array Sorting Functions-Footnote-1587134 +Ref: Array Sorting Functions-Footnote-2587227 +Node: Two-way I/O587421 +Ref: Two-way I/O-Footnote-1592853 +Node: TCP/IP Networking592923 +Node: Profiling595767 +Node: Library Functions603221 +Ref: Library Functions-Footnote-1606228 +Node: Library Names606399 +Ref: Library Names-Footnote-1609870 +Ref: Library Names-Footnote-2610090 +Node: General Functions610176 +Node: Strtonum Function611129 +Node: Assert Function614059 +Node: Round Function617385 +Node: Cliff Random Function618928 +Node: Ordinal Functions619944 +Ref: Ordinal Functions-Footnote-1623014 +Ref: Ordinal Functions-Footnote-2623266 +Node: Join Function623475 +Ref: Join Function-Footnote-1625246 +Node: Getlocaltime Function625446 +Node: Data File Management629161 +Node: Filetrans Function629793 +Node: Rewind Function633932 +Node: File Checking635319 +Node: Empty Files636413 +Node: Ignoring Assigns638643 +Node: Getopt Function640196 +Ref: Getopt Function-Footnote-1651500 +Node: Passwd Functions651703 +Ref: Passwd Functions-Footnote-1660678 +Node: Group Functions660766 +Node: Walking Arrays668850 +Node: Sample Programs670419 +Node: Running Examples671084 +Node: Clones671812 +Node: Cut Program673036 +Node: Egrep Program682881 +Ref: Egrep Program-Footnote-1690654 +Node: Id Program690764 +Node: Split Program694380 +Ref: Split Program-Footnote-1697899 +Node: Tee Program698027 +Node: Uniq Program700830 +Node: Wc Program708259 +Ref: Wc Program-Footnote-1712525 +Ref: Wc Program-Footnote-2712725 +Node: Miscellaneous Programs712817 +Node: Dupword Program714005 +Node: Alarm Program716036 +Node: Translate Program720785 +Ref: Translate Program-Footnote-1725172 +Ref: Translate Program-Footnote-2725400 +Node: Labels Program725534 +Ref: Labels Program-Footnote-1728905 +Node: Word Sorting728989 +Node: History Sorting732873 +Node: Extract Program734712 +Ref: Extract Program-Footnote-1742195 +Node: Simple Sed742323 +Node: Igawk Program745385 +Ref: Igawk Program-Footnote-1760542 +Ref: Igawk Program-Footnote-2760743 +Node: Anagram Program760881 +Node: Signature Program763949 +Node: Debugger765049 +Node: Debugging766015 +Node: Debugging Concepts766448 +Node: Debugging Terms768304 +Node: Awk Debugging770901 +Node: Sample Debugging Session771793 +Node: Debugger Invocation772313 +Node: Finding The Bug773642 +Node: List of Debugger Commands780130 +Node: Breakpoint Control781464 +Node: Debugger Execution Control785128 +Node: Viewing And Changing Data788488 +Node: Execution Stack791844 +Node: Debugger Info793311 +Node: Miscellaneous Debugger Commands797292 +Node: Readline Support802737 +Node: Limitations803568 +Node: Arbitrary Precision Arithmetic805820 +Ref: Arbitrary Precision Arithmetic-Footnote-1807462 +Node: General Arithmetic807610 +Node: Floating Point Issues809330 +Node: String Conversion Precision810211 +Ref: String Conversion Precision-Footnote-1811917 +Node: Unexpected Results812026 +Node: POSIX Floating Point Problems814179 +Ref: POSIX Floating Point Problems-Footnote-1818004 +Node: Integer Programming818042 +Node: Floating-point Programming819795 +Ref: Floating-point Programming-Footnote-1826104 +Node: Floating-point Representation826368 +Node: Floating-point Context827533 +Ref: table-ieee-formats828375 +Node: Rounding Mode829759 +Ref: table-rounding-modes830238 +Ref: Rounding Mode-Footnote-1833242 +Node: Gawk and MPFR833423 +Node: Arbitrary Precision Floats834665 +Ref: Arbitrary Precision Floats-Footnote-1837094 +Node: Setting Precision837405 +Node: Setting Rounding Mode840138 +Ref: table-gawk-rounding-modes840542 +Node: Floating-point Constants841722 +Node: Changing Precision843146 +Ref: Changing Precision-Footnote-1844546 +Node: Exact Arithmetic844720 +Node: Arbitrary Precision Integers847828 +Ref: Arbitrary Precision Integers-Footnote-1850828 +Node: Dynamic Extensions850975 +Node: Plugin License851893 +Node: Sample Library852507 +Node: Internal File Description853191 +Node: Internal File Ops856904 +Ref: Internal File Ops-Footnote-1861467 +Node: Using Internal File Ops861607 +Node: Language History863983 +Node: V7/SVR3.1865505 +Node: SVR4867826 +Node: POSIX869268 +Node: BTL870276 +Node: POSIX/GNU871010 +Node: Common Extensions876545 +Node: Ranges and Locales877652 +Ref: Ranges and Locales-Footnote-1882270 +Ref: Ranges and Locales-Footnote-2882297 +Ref: Ranges and Locales-Footnote-3882557 +Node: Contributors882778 +Node: Installation887074 +Node: Gawk Distribution887968 +Node: Getting888452 +Node: Extracting889278 +Node: Distribution contents890970 +Node: Unix Installation896192 +Node: Quick Installation896809 +Node: Additional Configuration Options898771 +Node: Configuration Philosophy900248 +Node: Non-Unix Installation902590 +Node: PC Installation903048 +Node: PC Binary Installation904347 +Node: PC Compiling906195 +Node: PC Testing909139 +Node: PC Using910315 +Node: Cygwin914500 +Node: MSYS915500 +Node: VMS Installation916014 +Node: VMS Compilation916617 +Ref: VMS Compilation-Footnote-1917624 +Node: VMS Installation Details917682 +Node: VMS Running919317 +Node: VMS Old Gawk920924 +Node: Bugs921398 +Node: Other Versions925250 +Node: Notes930565 +Node: Compatibility Mode931152 +Node: Additions931935 +Node: Accessing The Source932862 +Node: Adding Code934288 +Node: New Ports940330 +Node: Derived Files944465 +Ref: Derived Files-Footnote-1949770 +Ref: Derived Files-Footnote-2949804 +Ref: Derived Files-Footnote-3950404 +Node: Future Extensions950502 +Node: Basic Concepts951989 +Node: Basic High Level952670 +Ref: Basic High Level-Footnote-1956705 +Node: Basic Data Typing956890 +Node: Glossary960245 +Node: Copying985221 +Node: GNU Free Documentation License1022778 +Node: Index1047915 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index d9c20831..eb840fff 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -13015,6 +13015,14 @@ assigning a value to @code{NF} has the potential to affect to @code{NF} can be used to create or remove fields from the current record. @xref{Changing Fields}. +@cindex @code{FUNCTAB} array +@cindex @command{gawk}, @code{FUNCTAB} array in +@cindex differences in @command{awk} and @command{gawk}, @code{FUNCTAB} variable +@item FUNCTAB # +An array whose indices are the names of all the user-defined +or extension functions in the program. +@strong{NOTE}: The array values cannot currently be used. + @cindex @code{NR} variable @item NR The number of input records @command{awk} has processed since @@ -13044,6 +13052,34 @@ This is @code{"FIELDWIDTHS"} if field splitting with @code{FIELDWIDTHS} is in effect, or @code{"FPAT"} if field matching with @code{FPAT} is in effect. +@item PROCINFO["identifiers"] +A subarray, indexed by the names of all identifiers used in the +text of the AWK program. For each identifier, the value of the element is one of the following: + +@table @code +@item "array" +The identifier is an array. + +@item "extension" +The identifier is an extension function loaded via +@code{@@load}. + +@item "scalar" +The identifier is a scalar. + +@item "untyped" +The identifier is untyped (could be used as a scalar or array, +@command{gawk} doesn't know yet). + +@item "user" +The identifier is a user-defined function. +@end table + +@noindent +The values indicate what @command{gawk} knows about the identifiers +after it has finished parsing the program; they are @emph{not} updated +while the program runs. + @item PROCINFO["gid"] The value of the @code{getgid()} system call. @@ -13142,6 +13178,30 @@ In other @command{awk} implementations, or if @command{gawk} is in compatibility mode (@pxref{Options}), it is not special. + +@cindex @command{gawk}, @code{SYMTAB} array in +@cindex @code{SYMTAB} array +@cindex differences in @command{awk} and @command{gawk}, @code{SYMTAB} variable +@item SYMTAB # +An array whose indices are the names of all currently defined +global variables and arrays in the program. The array may be used +for indirect access to read or write the value of a variable: + +@example +foo = 5 +SYMTAB["foo"] = 4 +print foo # prints 4 +@end example + +@noindent +The @code{isarray()} function (@pxref{Type Functions}) may be used to test +if an element in @code{SYMTAB} is an array. + +@quotation NOTE +In order to avoid severe time-travel paradoxes (as well as to avoid +difficult implementation issues), neither @code{FUNCTAB} nor @code{SYMTAB} +are available as elements within the @code{SYMTAB} array. +@end quotation @end table @c ENDOFRANGE bvconi @c ENDOFRANGE vbconi @@ -107,6 +107,10 @@ lookup(const char *name) for (i = 0; tables[i] != NULL; i++) { if (tables[i]->table_size == 0) continue; + + if (do_posix && tables[i] == global_table) + continue; + n = in_array(tables[i], tmp); if (n != NULL) { unref(tmp); |