diff options
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | awk.h | 2 | ||||
-rw-r--r-- | awkgram.c | 21 | ||||
-rw-r--r-- | awkgram.y | 21 | ||||
-rw-r--r-- | doc/ChangeLog | 9 | ||||
-rw-r--r-- | doc/gawk.1 | 7 | ||||
-rw-r--r-- | doc/gawk.info | 776 | ||||
-rw-r--r-- | doc/gawk.texi | 7 | ||||
-rw-r--r-- | doc/gawktexi.in | 7 | ||||
-rw-r--r-- | eval.c | 1 | ||||
-rw-r--r-- | interpret.h | 7 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | symbol.c | 15 | ||||
-rw-r--r-- | test/ChangeLog | 1 | ||||
-rw-r--r-- | test/id.ok | 81 |
15 files changed, 549 insertions, 424 deletions
@@ -1,3 +1,19 @@ +2014-09-05 Arnold D. Robbins <arnold@skeeve.com> + + Add builtin functions to FUNCTAB for consistency. + + * awk.h (Node_builtin_func): New node type. + (install_builtins): Declare new function. + * awkgram.y [DEBUG_USE]: New flag value for debug functions; they + don't go into FUNCTAB. + (install_builtins): New function. + * eval.c (nodetypes): Add Node_builtin_func. + * interpret.h (r_interpret): Rework indirect calls of built-ins + since they're now in the symbol table. + * main.c (main): Call `install_builtins'. + * symbol.c (install): Adjust for Node_builtin_func. + (load_symbols): Ditto. + 2014-09-04 Arnold D. Robbins <arnold@skeeve.com> * profile.c (pprint): Case Op_K_for: Improve printing of @@ -297,6 +297,7 @@ typedef enum nodevals { Node_func, /* lnode is param. list, rnode is body */ Node_ext_func, /* extension function, code_ptr is builtin code */ Node_old_ext_func, /* extension function, code_ptr is builtin code */ + Node_builtin_func, /* built-in function, main use is for FUNCTAB */ Node_array_ref, /* array passed by ref as parameter */ Node_array_tree, /* Hashed array tree (HAT) */ @@ -1380,6 +1381,7 @@ extern void valinfo(NODE *n, Func_print print_func, FILE *fp); extern void negate_num(NODE *n); typedef NODE *(*builtin_func_t)(int); /* function that implements a built-in */ extern builtin_func_t lookup_builtin(const char *name); +extern void install_builtins(void); /* builtin.c */ extern double double_to_int(double d); extern NODE *do_exp(int nargs); @@ -4144,6 +4144,7 @@ struct token { # define GAWKX 0x0400 /* gawk extension */ # define BREAK 0x0800 /* break allowed inside */ # define CONTINUE 0x1000 /* continue allowed inside */ +# define DEBUG_USE 0x2000 /* for use by developers */ NODE *(*ptr)(int); /* function that implements this keyword */ NODE *(*ptr2)(int); /* alternate arbitrary-precision function */ @@ -4182,7 +4183,7 @@ static const struct token tokentab[] = { {"END", Op_rule, LEX_END, 0, 0, 0}, {"ENDFILE", Op_rule, LEX_ENDFILE, GAWKX, 0, 0}, #ifdef ARRAYDEBUG -{"adump", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2), do_adump, 0}, +{"adump", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|DEBUG_USE, do_adump, 0}, #endif {"and", Op_builtin, LEX_BUILTIN, GAWKX, do_and, MPF(and)}, {"asort", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3), do_asort, 0}, @@ -4242,7 +4243,7 @@ static const struct token tokentab[] = { {"sqrt", Op_builtin, LEX_BUILTIN, A(1), do_sqrt, MPF(sqrt)}, {"srand", Op_builtin, LEX_BUILTIN, NOT_OLD|A(0)|A(1), do_srand, MPF(srand)}, #if defined(GAWKDEBUG) || defined(ARRAYDEBUG) /* || ... */ -{"stopme", Op_builtin, LEX_BUILTIN, GAWKX|A(0), stopme, 0}, +{"stopme", Op_builtin, LEX_BUILTIN, GAWKX|A(0)|DEBUG_USE, stopme, 0}, #endif {"strftime", Op_builtin, LEX_BUILTIN, GAWKX|A(0)|A(1)|A(2)|A(3), do_strftime, 0}, {"strtonum", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_strtonum, MPF(strtonum)}, @@ -8070,3 +8071,19 @@ lookup_builtin(const char *name) return tokentab[mid].ptr; } + +/* install_builtins --- add built-in functions to FUNCTAB */ + +void +install_builtins(void) +{ + int i, j; + + j = sizeof(tokentab) / sizeof(tokentab[0]); + for (i = 0; i < j; i++) { + if ( tokentab[i].class == LEX_BUILTIN + && (tokentab[i].flags & DEBUG_USE) == 0) { + (void) install_symbol(tokentab[i].operator, Node_builtin_func); + } + } +} @@ -1805,6 +1805,7 @@ struct token { # define GAWKX 0x0400 /* gawk extension */ # define BREAK 0x0800 /* break allowed inside */ # define CONTINUE 0x1000 /* continue allowed inside */ +# define DEBUG_USE 0x2000 /* for use by developers */ NODE *(*ptr)(int); /* function that implements this keyword */ NODE *(*ptr2)(int); /* alternate arbitrary-precision function */ @@ -1843,7 +1844,7 @@ static const struct token tokentab[] = { {"END", Op_rule, LEX_END, 0, 0, 0}, {"ENDFILE", Op_rule, LEX_ENDFILE, GAWKX, 0, 0}, #ifdef ARRAYDEBUG -{"adump", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2), do_adump, 0}, +{"adump", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|DEBUG_USE, do_adump, 0}, #endif {"and", Op_builtin, LEX_BUILTIN, GAWKX, do_and, MPF(and)}, {"asort", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3), do_asort, 0}, @@ -1903,7 +1904,7 @@ static const struct token tokentab[] = { {"sqrt", Op_builtin, LEX_BUILTIN, A(1), do_sqrt, MPF(sqrt)}, {"srand", Op_builtin, LEX_BUILTIN, NOT_OLD|A(0)|A(1), do_srand, MPF(srand)}, #if defined(GAWKDEBUG) || defined(ARRAYDEBUG) /* || ... */ -{"stopme", Op_builtin, LEX_BUILTIN, GAWKX|A(0), stopme, 0}, +{"stopme", Op_builtin, LEX_BUILTIN, GAWKX|A(0)|DEBUG_USE, stopme, 0}, #endif {"strftime", Op_builtin, LEX_BUILTIN, GAWKX|A(0)|A(1)|A(2)|A(3), do_strftime, 0}, {"strtonum", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_strtonum, MPF(strtonum)}, @@ -5731,3 +5732,19 @@ lookup_builtin(const char *name) return tokentab[mid].ptr; } + +/* install_builtins --- add built-in functions to FUNCTAB */ + +void +install_builtins(void) +{ + int i, j; + + j = sizeof(tokentab) / sizeof(tokentab[0]); + for (i = 0; i < j; i++) { + if ( tokentab[i].class == LEX_BUILTIN + && (tokentab[i].flags & DEBUG_USE) == 0) { + (void) install_symbol(tokentab[i].operator, Node_builtin_func); + } + } +} diff --git a/doc/ChangeLog b/doc/ChangeLog index 95327540..26e27b91 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2014-09-05 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in: Document builtin functions in FUNCTAB and in + PROCINFO["identifiers"]. + * gawk.1: Ditto. + 2014-09-04 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Document that indirect calls now work on built-in @@ -11,8 +17,7 @@ 2014-09-02 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Corrections to walkthrough in debugger chapter. - Thanks to David "bamber" Ward <dlward134@gmail.com> for - the problem report. + Thanks to David Ward <dlward134@gmail.com> for the problem report. 2014-09-01 Arnold D. Robbins <arnold@skeeve.com> @@ -1132,9 +1132,14 @@ For each identifier, the value of the element is one of the following: \fB"array"\fR The identifier is an array. .TP +\fB"builtin"\fR +The identifier is a built-in function. +.TP \fB"extension"\fR The identifier is an extension function loaded via -.BR @load . +.B @load +or +.BR \-l . .TP \fB"scalar"\fR The identifier is a scalar. diff --git a/doc/gawk.info b/doc/gawk.info index 1d8022f0..4a283786 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -10272,7 +10272,8 @@ Options::), they are not special. `FUNCTAB #' An array whose indices and corresponding values are the names of - all the user-defined or extension functions in the program. + all the built-in, user-defined and extension functions in the + program. NOTE: Attempting to use the `delete' statement with the `FUNCTAB' array causes a fatal error. Any attempt to assign @@ -10308,9 +10309,12 @@ Options::), they are not special. `"array"' The identifier is an array. + `"builtin"' + The identifier is a built-in function. + `"extension"' The identifier is an extension function loaded via - `@load'. + `@load' or `-l'. `"scalar"' The identifier is a scalar. @@ -31880,7 +31884,7 @@ Index (line 46) * dark corner, FILENAME variable <1>: Auto-set. (line 98) * dark corner, FILENAME variable: Getline Notes. (line 19) -* dark corner, FNR/NR variables: Auto-set. (line 309) +* dark corner, FNR/NR variables: Auto-set. (line 313) * dark corner, format-control characters: Control Letters. (line 18) * dark corner, FS as null string: Single Character Fields. (line 20) @@ -32094,7 +32098,7 @@ Index (line 260) * differences in awk and gawk, print/printf statements: Format Modifiers. (line 13) -* differences in awk and gawk, PROCINFO array: Auto-set. (line 136) +* differences in awk and gawk, PROCINFO array: Auto-set. (line 137) * differences in awk and gawk, read timeouts: Read Timeout. (line 6) * differences in awk and gawk, record separators: awk split records. (line 124) @@ -32104,7 +32108,7 @@ Index (line 26) * differences in awk and gawk, RS/RT variables: gawk split records. (line 58) -* differences in awk and gawk, RT variable: Auto-set. (line 265) +* differences in awk and gawk, RT variable: Auto-set. (line 269) * differences in awk and gawk, single-character fields: Single Character Fields. (line 6) * differences in awk and gawk, split() function: String Functions. @@ -32112,7 +32116,7 @@ Index * differences in awk and gawk, strings: Scalar Constants. (line 20) * differences in awk and gawk, strings, storing: gawk split records. (line 77) -* differences in awk and gawk, SYMTAB variable: Auto-set. (line 269) +* differences in awk and gawk, SYMTAB variable: Auto-set. (line 273) * differences in awk and gawk, TEXTDOMAIN variable: User-modified. (line 152) * differences in awk and gawk, trunc-mod operation: Arithmetic Ops. @@ -32152,8 +32156,8 @@ Index * dynamically loaded extensions: Dynamic Extensions. (line 6) * e debugger command (alias for enable): Breakpoint Control. (line 73) * EBCDIC: Ordinal Functions. (line 45) -* effective group ID of gawk user: Auto-set. (line 141) -* effective user ID of gawk user: Auto-set. (line 145) +* effective group ID of gawk user: Auto-set. (line 142) +* effective user ID of gawk user: Auto-set. (line 146) * egrep utility <1>: Egrep Program. (line 6) * egrep utility: Bracket Expressions. (line 26) * egrep.awk program: Egrep Program. (line 54) @@ -32268,7 +32272,7 @@ Index (line 6) * extension API version: Extension Versioning. (line 6) -* extension API, version number: Auto-set. (line 232) +* extension API, version number: Auto-set. (line 236) * extension example: Extension Example. (line 6) * extension registration: Registration Functions. (line 6) @@ -32420,7 +32424,7 @@ Index (line 12) * FNR variable <1>: Auto-set. (line 107) * FNR variable: Records. (line 6) -* FNR variable, changing: Auto-set. (line 309) +* FNR variable, changing: Auto-set. (line 313) * for statement: For Statement. (line 6) * for statement, looping over arrays: Scanning an Array. (line 20) * fork() extension function: Extension Sample Fork. @@ -32521,7 +32525,7 @@ Index * G-d: Acknowledgments. (line 92) * Garfinkle, Scott: Contributors. (line 34) * gawk program, dynamic profiling: Profiling. (line 179) -* gawk version: Auto-set. (line 207) +* gawk version: Auto-set. (line 211) * gawk, ARGIND variable in: Other Arguments. (line 12) * gawk, awk and <1>: This Manual. (line 14) * gawk, awk and: Preface. (line 21) @@ -32590,7 +32594,7 @@ Index * gawk, OS/2 version of: PC Using. (line 16) * gawk, PROCINFO array in <1>: Two-way I/O. (line 99) * gawk, PROCINFO array in <2>: Time Functions. (line 47) -* gawk, PROCINFO array in: Auto-set. (line 136) +* gawk, PROCINFO array in: Auto-set. (line 137) * gawk, regexp constants and: Using Constant Regexps. (line 28) * gawk, regular expressions, case sensitivity: Case-sensitivity. @@ -32598,14 +32602,14 @@ 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 265) +* gawk, RT variable in <1>: Auto-set. (line 269) * gawk, RT variable in <2>: Multiple Line. (line 129) * gawk, RT variable in: awk split records. (line 124) * gawk, See Also awk: Preface. (line 34) * gawk, source code, obtaining: Getting. (line 6) * gawk, splitting fields and: Constant Size. (line 88) * gawk, string-translation functions: I18N Functions. (line 6) -* gawk, SYMTAB array in: Auto-set. (line 269) +* gawk, SYMTAB array in: Auto-set. (line 273) * gawk, TEXTDOMAIN variable in: User-modified. (line 152) * gawk, timestamps: Time Functions. (line 6) * gawk, uses for: Preface. (line 34) @@ -32691,7 +32695,7 @@ Index * Grigera, Juan: Contributors. (line 57) * group database, reading: Group Functions. (line 6) * group file: Group Functions. (line 6) -* group ID of gawk user: Auto-set. (line 180) +* group ID of gawk user: Auto-set. (line 184) * groups, information about: Group Functions. (line 6) * gsub <1>: String Functions. (line 139) * gsub: Using Constant Regexps. @@ -32985,7 +32989,7 @@ Index * mawk utility <3>: Concatenation. (line 36) * mawk utility <4>: Getline/Pipe. (line 62) * mawk utility: Escape Sequences. (line 132) -* maximum precision supported by MPFR library: Auto-set. (line 221) +* maximum precision supported by MPFR library: Auto-set. (line 225) * McIlroy, Doug: Glossary. (line 149) * McPhee, Patrick: Contributors. (line 100) * message object files: Explaining gettext. (line 42) @@ -32998,7 +33002,7 @@ Index * messages from extensions: Printing Messages. (line 6) * metacharacters in regular expressions: Regexp Operators. (line 6) * metacharacters, escape sequences for: Escape Sequences. (line 138) -* minimum precision supported by MPFR library: Auto-set. (line 224) +* minimum precision supported by MPFR library: Auto-set. (line 228) * mktime: Time Functions. (line 25) * modifiers, in format specifiers: Format Modifiers. (line 6) * monetary information, localization: Explaining gettext. (line 104) @@ -33058,9 +33062,9 @@ Index * non-existent array elements: Reference to Elements. (line 23) * not Boolean-logic operator: Boolean Ops. (line 6) -* NR variable <1>: Auto-set. (line 131) +* NR variable <1>: Auto-set. (line 132) * NR variable: Records. (line 6) -* NR variable, changing: Auto-set. (line 309) +* NR variable, changing: Auto-set. (line 313) * null strings <1>: Basic Data Typing. (line 26) * null strings <2>: Truth Values. (line 6) * null strings <3>: Regexp Field Splitting. @@ -33174,7 +33178,7 @@ Index * p debugger command (alias for print): Viewing And Changing Data. (line 36) * Papadopoulos, Panos: Contributors. (line 128) -* parent process ID of gawk process: Auto-set. (line 189) +* parent process ID of gawk process: Auto-set. (line 193) * parentheses (), in a profile: Profiling. (line 146) * parentheses (), regexp operator: Regexp Operators. (line 81) * password file: Passwd Functions. (line 16) @@ -33337,24 +33341,24 @@ Index * printing, unduplicated lines of text: Uniq Program. (line 6) * printing, user information: Id Program. (line 6) * private variables: Library Names. (line 11) -* process group idIDof gawk process: Auto-set. (line 183) -* process ID of gawk process: Auto-set. (line 186) +* process group idIDof gawk process: Auto-set. (line 187) +* process ID of gawk process: Auto-set. (line 190) * processes, two-way communications with: Two-way I/O. (line 6) * processing data: Basic High Level. (line 6) * PROCINFO array <1>: Passwd Functions. (line 6) * PROCINFO array <2>: Time Functions. (line 47) -* PROCINFO array: Auto-set. (line 136) +* PROCINFO array: Auto-set. (line 137) * PROCINFO array, and communications via ptys: Two-way I/O. (line 99) * PROCINFO array, and group membership: Group Functions. (line 6) * PROCINFO array, and user and group ID numbers: Id Program. (line 15) * PROCINFO array, testing the field splitting: Passwd Functions. (line 161) -* PROCINFO array, uses: Auto-set. (line 242) +* PROCINFO array, uses: Auto-set. (line 246) * PROCINFO, values of sorted_in: Controlling Scanning. (line 26) * profiling awk programs: Profiling. (line 6) * profiling awk programs, dynamically: Profiling. (line 179) -* program identifiers: Auto-set. (line 154) +* program identifiers: Auto-set. (line 155) * program, definition of: Getting Started. (line 21) * programming conventions, --non-decimal-data option: Nondecimal Data. (line 36) @@ -33513,7 +33517,7 @@ Index * right shift: Bitwise Functions. (line 52) * right shift, bitwise: Bitwise Functions. (line 32) * Ritchie, Dennis: Basic Data Typing. (line 54) -* RLENGTH variable: Auto-set. (line 252) +* RLENGTH variable: Auto-set. (line 256) * RLENGTH variable, match() function and: String Functions. (line 224) * Robbins, Arnold <1>: Future Extensions. (line 6) * Robbins, Arnold <2>: Bugs. (line 32) @@ -33539,9 +33543,9 @@ Index * RS variable: awk split records. (line 12) * RS variable, multiline records and: Multiple Line. (line 17) * rshift: Bitwise Functions. (line 52) -* RSTART variable: Auto-set. (line 258) +* RSTART variable: Auto-set. (line 262) * RSTART variable, match() function and: String Functions. (line 224) -* RT variable <1>: Auto-set. (line 265) +* RT variable <1>: Auto-set. (line 269) * RT variable <2>: Multiple Line. (line 129) * RT variable: awk split records. (line 124) * Rubin, Paul <1>: Contributors. (line 15) @@ -33561,7 +33565,7 @@ Index * scanning arrays: Scanning an Array. (line 6) * scanning multidimensional arrays: Multiscanning. (line 11) * Schorr, Andrew <1>: Contributors. (line 133) -* Schorr, Andrew <2>: Auto-set. (line 292) +* Schorr, Andrew <2>: Auto-set. (line 296) * Schorr, Andrew: Acknowledgments. (line 60) * Schreiber, Bert: Acknowledgments. (line 38) * Schreiber, Rita: Acknowledgments. (line 38) @@ -33645,7 +33649,7 @@ Index (line 118) * sidebar, Changing FS Does Not Affect the Fields: Field Splitting Summary. (line 38) -* sidebar, Changing NR and FNR: Auto-set. (line 307) +* sidebar, Changing NR and FNR: Auto-set. (line 311) * sidebar, Controlling Output Buffering with system(): I/O Functions. (line 138) * sidebar, Escape Sequences for Metacharacters: Escape Sequences. @@ -33808,9 +33812,9 @@ Index * substr: String Functions. (line 479) * substring: String Functions. (line 479) * Sumner, Andrew: Other Versions. (line 64) -* supplementary groups of gawk process: Auto-set. (line 237) +* supplementary groups of gawk process: Auto-set. (line 241) * switch statement: Switch Statement. (line 6) -* SYMTAB array: Auto-set. (line 269) +* SYMTAB array: Auto-set. (line 273) * syntactic ambiguity: /= operator vs. /=.../ regexp constant: Assignment Ops. (line 148) * system: I/O Functions. (line 75) @@ -33988,10 +33992,10 @@ Index * variables, uninitialized, as array subscripts: Uninitialized Subscripts. (line 6) * variables, user-defined: Variables. (line 6) -* version of gawk: Auto-set. (line 207) -* version of gawk extension API: Auto-set. (line 232) -* version of GNU MP library: Auto-set. (line 218) -* version of GNU MPFR library: Auto-set. (line 214) +* version of gawk: Auto-set. (line 211) +* version of gawk extension API: Auto-set. (line 236) +* version of GNU MP library: Auto-set. (line 222) +* version of GNU MPFR library: Auto-set. (line 218) * vertical bar (|): Regexp Operators. (line 70) * vertical bar (|), | operator (I/O) <1>: Precedence. (line 65) * vertical bar (|), | operator (I/O): Getline/Pipe. (line 9) @@ -34276,355 +34280,355 @@ Node: Built-in Variables426246 Node: User-modified427373 Ref: User-modified-Footnote-1435062 Node: Auto-set435124 -Ref: Auto-set-Footnote-1448043 -Ref: Auto-set-Footnote-2448248 -Node: ARGC and ARGV448304 -Node: Pattern Action Summary452208 -Node: Arrays454431 -Node: Array Basics455980 -Node: Array Intro456806 -Ref: figure-array-elements458779 -Ref: Array Intro-Footnote-1461303 -Node: Reference to Elements461431 -Node: Assigning Elements463881 -Node: Array Example464372 -Node: Scanning an Array466104 -Node: Controlling Scanning469105 -Ref: Controlling Scanning-Footnote-1474278 -Node: Delete474594 -Ref: Delete-Footnote-1477345 -Node: Numeric Array Subscripts477402 -Node: Uninitialized Subscripts479585 -Node: Multidimensional481212 -Node: Multiscanning484325 -Node: Arrays of Arrays485914 -Node: Arrays Summary490577 -Node: Functions492682 -Node: Built-in493555 -Node: Calling Built-in494633 -Node: Numeric Functions496621 -Ref: Numeric Functions-Footnote-1501457 -Ref: Numeric Functions-Footnote-2501814 -Ref: Numeric Functions-Footnote-3501862 -Node: String Functions502131 -Ref: String Functions-Footnote-1525128 -Ref: String Functions-Footnote-2525257 -Ref: String Functions-Footnote-3525505 -Node: Gory Details525592 -Ref: table-sub-escapes527365 -Ref: table-sub-proposed528885 -Ref: table-posix-sub530249 -Ref: table-gensub-escapes531789 -Ref: Gory Details-Footnote-1532965 -Node: I/O Functions533116 -Ref: I/O Functions-Footnote-1540226 -Node: Time Functions540373 -Ref: Time Functions-Footnote-1550837 -Ref: Time Functions-Footnote-2550905 -Ref: Time Functions-Footnote-3551063 -Ref: Time Functions-Footnote-4551174 -Ref: Time Functions-Footnote-5551286 -Ref: Time Functions-Footnote-6551513 -Node: Bitwise Functions551779 -Ref: table-bitwise-ops552341 -Ref: Bitwise Functions-Footnote-1556586 -Node: Type Functions556770 -Node: I18N Functions557912 -Node: User-defined559557 -Node: Definition Syntax560361 -Ref: Definition Syntax-Footnote-1565674 -Node: Function Example565743 -Ref: Function Example-Footnote-1568383 -Node: Function Caveats568405 -Node: Calling A Function568923 -Node: Variable Scope569878 -Node: Pass By Value/Reference572866 -Node: Return Statement576376 -Node: Dynamic Typing579360 -Node: Indirect Calls580289 -Ref: Indirect Calls-Footnote-1590005 -Node: Functions Summary590133 -Node: Library Functions592783 -Ref: Library Functions-Footnote-1596401 -Ref: Library Functions-Footnote-2596544 -Node: Library Names596715 -Ref: Library Names-Footnote-1600188 -Ref: Library Names-Footnote-2600408 -Node: General Functions600494 -Node: Strtonum Function601522 -Node: Assert Function604396 -Node: Round Function607722 -Node: Cliff Random Function609263 -Node: Ordinal Functions610279 -Ref: Ordinal Functions-Footnote-1613344 -Ref: Ordinal Functions-Footnote-2613596 -Node: Join Function613807 -Ref: Join Function-Footnote-1615578 -Node: Getlocaltime Function615778 -Node: Readfile Function619514 -Node: Data File Management621353 -Node: Filetrans Function621985 -Node: Rewind Function626054 -Node: File Checking627612 -Ref: File Checking-Footnote-1628744 -Node: Empty Files628945 -Node: Ignoring Assigns630924 -Node: Getopt Function632478 -Ref: Getopt Function-Footnote-1643742 -Node: Passwd Functions643945 -Ref: Passwd Functions-Footnote-1652924 -Node: Group Functions653012 -Ref: Group Functions-Footnote-1660943 -Node: Walking Arrays661156 -Node: Library Functions Summary662759 -Node: Library Exercises664147 -Node: Sample Programs665427 -Node: Running Examples666197 -Node: Clones666925 -Node: Cut Program668149 -Node: Egrep Program678007 -Ref: Egrep Program-Footnote-1685594 -Node: Id Program685704 -Node: Split Program689358 -Ref: Split Program-Footnote-1692896 -Node: Tee Program693024 -Node: Uniq Program695811 -Node: Wc Program703234 -Ref: Wc Program-Footnote-1707499 -Node: Miscellaneous Programs707591 -Node: Dupword Program708804 -Node: Alarm Program710835 -Node: Translate Program715639 -Ref: Translate Program-Footnote-1720030 -Ref: Translate Program-Footnote-2720300 -Node: Labels Program720439 -Ref: Labels Program-Footnote-1723800 -Node: Word Sorting723884 -Node: History Sorting727927 -Node: Extract Program729763 -Node: Simple Sed737299 -Node: Igawk Program740361 -Ref: Igawk Program-Footnote-1754665 -Ref: Igawk Program-Footnote-2754866 -Node: Anagram Program755004 -Node: Signature Program758072 -Node: Programs Summary759319 -Node: Programs Exercises760534 -Ref: Programs Exercises-Footnote-1764921 -Node: Advanced Features765012 -Node: Nondecimal Data766960 -Node: Array Sorting768537 -Node: Controlling Array Traversal769234 -Node: Array Sorting Functions777514 -Ref: Array Sorting Functions-Footnote-1781421 -Node: Two-way I/O781615 -Ref: Two-way I/O-Footnote-1786559 -Ref: Two-way I/O-Footnote-2786738 -Node: TCP/IP Networking786820 -Node: Profiling789665 -Node: Advanced Features Summary797216 -Node: Internationalization799080 -Node: I18N and L10N800560 -Node: Explaining gettext801246 -Ref: Explaining gettext-Footnote-1806272 -Ref: Explaining gettext-Footnote-2806456 -Node: Programmer i18n806621 -Ref: Programmer i18n-Footnote-1811415 -Node: Translator i18n811464 -Node: String Extraction812258 -Ref: String Extraction-Footnote-1813391 -Node: Printf Ordering813477 -Ref: Printf Ordering-Footnote-1816259 -Node: I18N Portability816323 -Ref: I18N Portability-Footnote-1818772 -Node: I18N Example818835 -Ref: I18N Example-Footnote-1821541 -Node: Gawk I18N821613 -Node: I18N Summary822251 -Node: Debugger823590 -Node: Debugging824612 -Node: Debugging Concepts825053 -Node: Debugging Terms826909 -Node: Awk Debugging829506 -Node: Sample Debugging Session830398 -Node: Debugger Invocation830918 -Node: Finding The Bug832254 -Node: List of Debugger Commands838733 -Node: Breakpoint Control840065 -Node: Debugger Execution Control843729 -Node: Viewing And Changing Data847089 -Node: Execution Stack850447 -Node: Debugger Info851960 -Node: Miscellaneous Debugger Commands855954 -Node: Readline Support861138 -Node: Limitations862030 -Node: Debugging Summary864303 -Node: Arbitrary Precision Arithmetic865471 -Node: Computer Arithmetic866958 -Ref: Computer Arithmetic-Footnote-1871345 -Node: Math Definitions871402 -Ref: table-ieee-formats874691 -Ref: Math Definitions-Footnote-1875231 -Node: MPFR features875334 -Node: FP Math Caution876951 -Ref: FP Math Caution-Footnote-1878001 -Node: Inexactness of computations878370 -Node: Inexact representation879318 -Node: Comparing FP Values880673 -Node: Errors accumulate881637 -Node: Getting Accuracy883070 -Node: Try To Round885729 -Node: Setting precision886628 -Ref: table-predefined-precision-strings887310 -Node: Setting the rounding mode889103 -Ref: table-gawk-rounding-modes889467 -Ref: Setting the rounding mode-Footnote-1892921 -Node: Arbitrary Precision Integers893100 -Ref: Arbitrary Precision Integers-Footnote-1896873 -Node: POSIX Floating Point Problems897022 -Ref: POSIX Floating Point Problems-Footnote-1900898 -Node: Floating point summary900936 -Node: Dynamic Extensions903140 -Node: Extension Intro904692 -Node: Plugin License905957 -Node: Extension Mechanism Outline906642 -Ref: figure-load-extension907066 -Ref: figure-load-new-function908551 -Ref: figure-call-new-function909553 -Node: Extension API Description911537 -Node: Extension API Functions Introduction912987 -Node: General Data Types917854 -Ref: General Data Types-Footnote-1923547 -Node: Requesting Values923846 -Ref: table-value-types-returned924583 -Node: Memory Allocation Functions925541 -Ref: Memory Allocation Functions-Footnote-1928288 -Node: Constructor Functions928384 -Node: Registration Functions930142 -Node: Extension Functions930827 -Node: Exit Callback Functions933129 -Node: Extension Version String934377 -Node: Input Parsers935027 -Node: Output Wrappers944841 -Node: Two-way processors949357 -Node: Printing Messages951561 -Ref: Printing Messages-Footnote-1952638 -Node: Updating `ERRNO'952790 -Node: Accessing Parameters953529 -Node: Symbol Table Access954759 -Node: Symbol table by name955273 -Node: Symbol table by cookie957249 -Ref: Symbol table by cookie-Footnote-1961382 -Node: Cached values961445 -Ref: Cached values-Footnote-1964949 -Node: Array Manipulation965040 -Ref: Array Manipulation-Footnote-1966138 -Node: Array Data Types966177 -Ref: Array Data Types-Footnote-1968880 -Node: Array Functions968972 -Node: Flattening Arrays972846 -Node: Creating Arrays979698 -Node: Extension API Variables984429 -Node: Extension Versioning985065 -Node: Extension API Informational Variables986966 -Node: Extension API Boilerplate988052 -Node: Finding Extensions991856 -Node: Extension Example992416 -Node: Internal File Description993146 -Node: Internal File Ops997237 -Ref: Internal File Ops-Footnote-11008669 -Node: Using Internal File Ops1008809 -Ref: Using Internal File Ops-Footnote-11011156 -Node: Extension Samples1011424 -Node: Extension Sample File Functions1012948 -Node: Extension Sample Fnmatch1020516 -Node: Extension Sample Fork1021998 -Node: Extension Sample Inplace1023211 -Node: Extension Sample Ord1024886 -Node: Extension Sample Readdir1025722 -Ref: table-readdir-file-types1026578 -Node: Extension Sample Revout1027377 -Node: Extension Sample Rev2way1027968 -Node: Extension Sample Read write array1028709 -Node: Extension Sample Readfile1030588 -Node: Extension Sample API Tests1031688 -Node: Extension Sample Time1032213 -Node: gawkextlib1033528 -Node: Extension summary1036341 -Node: Extension Exercises1040034 -Node: Language History1040756 -Node: V7/SVR3.11042399 -Node: SVR41044719 -Node: POSIX1046161 -Node: BTL1047547 -Node: POSIX/GNU1048281 -Node: Feature History1054057 -Node: Common Extensions1067148 -Node: Ranges and Locales1068460 -Ref: Ranges and Locales-Footnote-11073077 -Ref: Ranges and Locales-Footnote-21073104 -Ref: Ranges and Locales-Footnote-31073338 -Node: Contributors1073559 -Node: History summary1078984 -Node: Installation1080353 -Node: Gawk Distribution1081304 -Node: Getting1081788 -Node: Extracting1082612 -Node: Distribution contents1084254 -Node: Unix Installation1090024 -Node: Quick Installation1090641 -Node: Additional Configuration Options1093083 -Node: Configuration Philosophy1094821 -Node: Non-Unix Installation1097172 -Node: PC Installation1097630 -Node: PC Binary Installation1098941 -Node: PC Compiling1100789 -Ref: PC Compiling-Footnote-11103788 -Node: PC Testing1103893 -Node: PC Using1105069 -Node: Cygwin1109221 -Node: MSYS1110030 -Node: VMS Installation1110544 -Node: VMS Compilation1111340 -Ref: VMS Compilation-Footnote-11112562 -Node: VMS Dynamic Extensions1112620 -Node: VMS Installation Details1113993 -Node: VMS Running1116245 -Node: VMS GNV1119079 -Node: VMS Old Gawk1119802 -Node: Bugs1120272 -Node: Other Versions1124276 -Node: Installation summary1130503 -Node: Notes1131559 -Node: Compatibility Mode1132424 -Node: Additions1133206 -Node: Accessing The Source1134131 -Node: Adding Code1135567 -Node: New Ports1141745 -Node: Derived Files1146226 -Ref: Derived Files-Footnote-11151307 -Ref: Derived Files-Footnote-21151341 -Ref: Derived Files-Footnote-31151937 -Node: Future Extensions1152051 -Node: Implementation Limitations1152657 -Node: Extension Design1153905 -Node: Old Extension Problems1155059 -Ref: Old Extension Problems-Footnote-11156576 -Node: Extension New Mechanism Goals1156633 -Ref: Extension New Mechanism Goals-Footnote-11159993 -Node: Extension Other Design Decisions1160182 -Node: Extension Future Growth1162288 -Node: Old Extension Mechanism1163124 -Node: Notes summary1164886 -Node: Basic Concepts1166072 -Node: Basic High Level1166753 -Ref: figure-general-flow1167025 -Ref: figure-process-flow1167624 -Ref: Basic High Level-Footnote-11170853 -Node: Basic Data Typing1171038 -Node: Glossary1174366 -Node: Copying1199518 -Node: GNU Free Documentation License1237074 -Node: Index1262210 +Ref: Auto-set-Footnote-1448143 +Ref: Auto-set-Footnote-2448348 +Node: ARGC and ARGV448404 +Node: Pattern Action Summary452308 +Node: Arrays454531 +Node: Array Basics456080 +Node: Array Intro456906 +Ref: figure-array-elements458879 +Ref: Array Intro-Footnote-1461403 +Node: Reference to Elements461531 +Node: Assigning Elements463981 +Node: Array Example464472 +Node: Scanning an Array466204 +Node: Controlling Scanning469205 +Ref: Controlling Scanning-Footnote-1474378 +Node: Delete474694 +Ref: Delete-Footnote-1477445 +Node: Numeric Array Subscripts477502 +Node: Uninitialized Subscripts479685 +Node: Multidimensional481312 +Node: Multiscanning484425 +Node: Arrays of Arrays486014 +Node: Arrays Summary490677 +Node: Functions492782 +Node: Built-in493655 +Node: Calling Built-in494733 +Node: Numeric Functions496721 +Ref: Numeric Functions-Footnote-1501557 +Ref: Numeric Functions-Footnote-2501914 +Ref: Numeric Functions-Footnote-3501962 +Node: String Functions502231 +Ref: String Functions-Footnote-1525228 +Ref: String Functions-Footnote-2525357 +Ref: String Functions-Footnote-3525605 +Node: Gory Details525692 +Ref: table-sub-escapes527465 +Ref: table-sub-proposed528985 +Ref: table-posix-sub530349 +Ref: table-gensub-escapes531889 +Ref: Gory Details-Footnote-1533065 +Node: I/O Functions533216 +Ref: I/O Functions-Footnote-1540326 +Node: Time Functions540473 +Ref: Time Functions-Footnote-1550937 +Ref: Time Functions-Footnote-2551005 +Ref: Time Functions-Footnote-3551163 +Ref: Time Functions-Footnote-4551274 +Ref: Time Functions-Footnote-5551386 +Ref: Time Functions-Footnote-6551613 +Node: Bitwise Functions551879 +Ref: table-bitwise-ops552441 +Ref: Bitwise Functions-Footnote-1556686 +Node: Type Functions556870 +Node: I18N Functions558012 +Node: User-defined559657 +Node: Definition Syntax560461 +Ref: Definition Syntax-Footnote-1565774 +Node: Function Example565843 +Ref: Function Example-Footnote-1568483 +Node: Function Caveats568505 +Node: Calling A Function569023 +Node: Variable Scope569978 +Node: Pass By Value/Reference572966 +Node: Return Statement576476 +Node: Dynamic Typing579460 +Node: Indirect Calls580389 +Ref: Indirect Calls-Footnote-1590105 +Node: Functions Summary590233 +Node: Library Functions592883 +Ref: Library Functions-Footnote-1596501 +Ref: Library Functions-Footnote-2596644 +Node: Library Names596815 +Ref: Library Names-Footnote-1600288 +Ref: Library Names-Footnote-2600508 +Node: General Functions600594 +Node: Strtonum Function601622 +Node: Assert Function604496 +Node: Round Function607822 +Node: Cliff Random Function609363 +Node: Ordinal Functions610379 +Ref: Ordinal Functions-Footnote-1613444 +Ref: Ordinal Functions-Footnote-2613696 +Node: Join Function613907 +Ref: Join Function-Footnote-1615678 +Node: Getlocaltime Function615878 +Node: Readfile Function619614 +Node: Data File Management621453 +Node: Filetrans Function622085 +Node: Rewind Function626154 +Node: File Checking627712 +Ref: File Checking-Footnote-1628844 +Node: Empty Files629045 +Node: Ignoring Assigns631024 +Node: Getopt Function632578 +Ref: Getopt Function-Footnote-1643842 +Node: Passwd Functions644045 +Ref: Passwd Functions-Footnote-1653024 +Node: Group Functions653112 +Ref: Group Functions-Footnote-1661043 +Node: Walking Arrays661256 +Node: Library Functions Summary662859 +Node: Library Exercises664247 +Node: Sample Programs665527 +Node: Running Examples666297 +Node: Clones667025 +Node: Cut Program668249 +Node: Egrep Program678107 +Ref: Egrep Program-Footnote-1685694 +Node: Id Program685804 +Node: Split Program689458 +Ref: Split Program-Footnote-1692996 +Node: Tee Program693124 +Node: Uniq Program695911 +Node: Wc Program703334 +Ref: Wc Program-Footnote-1707599 +Node: Miscellaneous Programs707691 +Node: Dupword Program708904 +Node: Alarm Program710935 +Node: Translate Program715739 +Ref: Translate Program-Footnote-1720130 +Ref: Translate Program-Footnote-2720400 +Node: Labels Program720539 +Ref: Labels Program-Footnote-1723900 +Node: Word Sorting723984 +Node: History Sorting728027 +Node: Extract Program729863 +Node: Simple Sed737399 +Node: Igawk Program740461 +Ref: Igawk Program-Footnote-1754765 +Ref: Igawk Program-Footnote-2754966 +Node: Anagram Program755104 +Node: Signature Program758172 +Node: Programs Summary759419 +Node: Programs Exercises760634 +Ref: Programs Exercises-Footnote-1765021 +Node: Advanced Features765112 +Node: Nondecimal Data767060 +Node: Array Sorting768637 +Node: Controlling Array Traversal769334 +Node: Array Sorting Functions777614 +Ref: Array Sorting Functions-Footnote-1781521 +Node: Two-way I/O781715 +Ref: Two-way I/O-Footnote-1786659 +Ref: Two-way I/O-Footnote-2786838 +Node: TCP/IP Networking786920 +Node: Profiling789765 +Node: Advanced Features Summary797316 +Node: Internationalization799180 +Node: I18N and L10N800660 +Node: Explaining gettext801346 +Ref: Explaining gettext-Footnote-1806372 +Ref: Explaining gettext-Footnote-2806556 +Node: Programmer i18n806721 +Ref: Programmer i18n-Footnote-1811515 +Node: Translator i18n811564 +Node: String Extraction812358 +Ref: String Extraction-Footnote-1813491 +Node: Printf Ordering813577 +Ref: Printf Ordering-Footnote-1816359 +Node: I18N Portability816423 +Ref: I18N Portability-Footnote-1818872 +Node: I18N Example818935 +Ref: I18N Example-Footnote-1821641 +Node: Gawk I18N821713 +Node: I18N Summary822351 +Node: Debugger823690 +Node: Debugging824712 +Node: Debugging Concepts825153 +Node: Debugging Terms827009 +Node: Awk Debugging829606 +Node: Sample Debugging Session830498 +Node: Debugger Invocation831018 +Node: Finding The Bug832354 +Node: List of Debugger Commands838833 +Node: Breakpoint Control840165 +Node: Debugger Execution Control843829 +Node: Viewing And Changing Data847189 +Node: Execution Stack850547 +Node: Debugger Info852060 +Node: Miscellaneous Debugger Commands856054 +Node: Readline Support861238 +Node: Limitations862130 +Node: Debugging Summary864403 +Node: Arbitrary Precision Arithmetic865571 +Node: Computer Arithmetic867058 +Ref: Computer Arithmetic-Footnote-1871445 +Node: Math Definitions871502 +Ref: table-ieee-formats874791 +Ref: Math Definitions-Footnote-1875331 +Node: MPFR features875434 +Node: FP Math Caution877051 +Ref: FP Math Caution-Footnote-1878101 +Node: Inexactness of computations878470 +Node: Inexact representation879418 +Node: Comparing FP Values880773 +Node: Errors accumulate881737 +Node: Getting Accuracy883170 +Node: Try To Round885829 +Node: Setting precision886728 +Ref: table-predefined-precision-strings887410 +Node: Setting the rounding mode889203 +Ref: table-gawk-rounding-modes889567 +Ref: Setting the rounding mode-Footnote-1893021 +Node: Arbitrary Precision Integers893200 +Ref: Arbitrary Precision Integers-Footnote-1896973 +Node: POSIX Floating Point Problems897122 +Ref: POSIX Floating Point Problems-Footnote-1900998 +Node: Floating point summary901036 +Node: Dynamic Extensions903240 +Node: Extension Intro904792 +Node: Plugin License906057 +Node: Extension Mechanism Outline906742 +Ref: figure-load-extension907166 +Ref: figure-load-new-function908651 +Ref: figure-call-new-function909653 +Node: Extension API Description911637 +Node: Extension API Functions Introduction913087 +Node: General Data Types917954 +Ref: General Data Types-Footnote-1923647 +Node: Requesting Values923946 +Ref: table-value-types-returned924683 +Node: Memory Allocation Functions925641 +Ref: Memory Allocation Functions-Footnote-1928388 +Node: Constructor Functions928484 +Node: Registration Functions930242 +Node: Extension Functions930927 +Node: Exit Callback Functions933229 +Node: Extension Version String934477 +Node: Input Parsers935127 +Node: Output Wrappers944941 +Node: Two-way processors949457 +Node: Printing Messages951661 +Ref: Printing Messages-Footnote-1952738 +Node: Updating `ERRNO'952890 +Node: Accessing Parameters953629 +Node: Symbol Table Access954859 +Node: Symbol table by name955373 +Node: Symbol table by cookie957349 +Ref: Symbol table by cookie-Footnote-1961482 +Node: Cached values961545 +Ref: Cached values-Footnote-1965049 +Node: Array Manipulation965140 +Ref: Array Manipulation-Footnote-1966238 +Node: Array Data Types966277 +Ref: Array Data Types-Footnote-1968980 +Node: Array Functions969072 +Node: Flattening Arrays972946 +Node: Creating Arrays979798 +Node: Extension API Variables984529 +Node: Extension Versioning985165 +Node: Extension API Informational Variables987066 +Node: Extension API Boilerplate988152 +Node: Finding Extensions991956 +Node: Extension Example992516 +Node: Internal File Description993246 +Node: Internal File Ops997337 +Ref: Internal File Ops-Footnote-11008769 +Node: Using Internal File Ops1008909 +Ref: Using Internal File Ops-Footnote-11011256 +Node: Extension Samples1011524 +Node: Extension Sample File Functions1013048 +Node: Extension Sample Fnmatch1020616 +Node: Extension Sample Fork1022098 +Node: Extension Sample Inplace1023311 +Node: Extension Sample Ord1024986 +Node: Extension Sample Readdir1025822 +Ref: table-readdir-file-types1026678 +Node: Extension Sample Revout1027477 +Node: Extension Sample Rev2way1028068 +Node: Extension Sample Read write array1028809 +Node: Extension Sample Readfile1030688 +Node: Extension Sample API Tests1031788 +Node: Extension Sample Time1032313 +Node: gawkextlib1033628 +Node: Extension summary1036441 +Node: Extension Exercises1040134 +Node: Language History1040856 +Node: V7/SVR3.11042499 +Node: SVR41044819 +Node: POSIX1046261 +Node: BTL1047647 +Node: POSIX/GNU1048381 +Node: Feature History1054157 +Node: Common Extensions1067248 +Node: Ranges and Locales1068560 +Ref: Ranges and Locales-Footnote-11073177 +Ref: Ranges and Locales-Footnote-21073204 +Ref: Ranges and Locales-Footnote-31073438 +Node: Contributors1073659 +Node: History summary1079084 +Node: Installation1080453 +Node: Gawk Distribution1081404 +Node: Getting1081888 +Node: Extracting1082712 +Node: Distribution contents1084354 +Node: Unix Installation1090124 +Node: Quick Installation1090741 +Node: Additional Configuration Options1093183 +Node: Configuration Philosophy1094921 +Node: Non-Unix Installation1097272 +Node: PC Installation1097730 +Node: PC Binary Installation1099041 +Node: PC Compiling1100889 +Ref: PC Compiling-Footnote-11103888 +Node: PC Testing1103993 +Node: PC Using1105169 +Node: Cygwin1109321 +Node: MSYS1110130 +Node: VMS Installation1110644 +Node: VMS Compilation1111440 +Ref: VMS Compilation-Footnote-11112662 +Node: VMS Dynamic Extensions1112720 +Node: VMS Installation Details1114093 +Node: VMS Running1116345 +Node: VMS GNV1119179 +Node: VMS Old Gawk1119902 +Node: Bugs1120372 +Node: Other Versions1124376 +Node: Installation summary1130603 +Node: Notes1131659 +Node: Compatibility Mode1132524 +Node: Additions1133306 +Node: Accessing The Source1134231 +Node: Adding Code1135667 +Node: New Ports1141845 +Node: Derived Files1146326 +Ref: Derived Files-Footnote-11151407 +Ref: Derived Files-Footnote-21151441 +Ref: Derived Files-Footnote-31152037 +Node: Future Extensions1152151 +Node: Implementation Limitations1152757 +Node: Extension Design1154005 +Node: Old Extension Problems1155159 +Ref: Old Extension Problems-Footnote-11156676 +Node: Extension New Mechanism Goals1156733 +Ref: Extension New Mechanism Goals-Footnote-11160093 +Node: Extension Other Design Decisions1160282 +Node: Extension Future Growth1162388 +Node: Old Extension Mechanism1163224 +Node: Notes summary1164986 +Node: Basic Concepts1166172 +Node: Basic High Level1166853 +Ref: figure-general-flow1167125 +Ref: figure-process-flow1167724 +Ref: Basic High Level-Footnote-11170953 +Node: Basic Data Typing1171138 +Node: Glossary1174466 +Node: Copying1199618 +Node: GNU Free Documentation License1237174 +Node: Index1262310 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 7fc342c3..95747864 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -14726,7 +14726,7 @@ current record. @xref{Changing Fields}. @cindex differences in @command{awk} and @command{gawk}, @code{FUNCTAB} variable @item @code{FUNCTAB #} An array whose indices and corresponding values are the names of all -the user-defined or extension functions in the program. +the built-in, user-defined and extension functions in the program. @quotation NOTE Attempting to use the @code{delete} statement with the @code{FUNCTAB} @@ -14774,9 +14774,12 @@ text of the AWK program. For each identifier, the value of the element is one o @item "array" The identifier is an array. +@item "builtin" +The identifier is a built-in function. + @item "extension" The identifier is an extension function loaded via -@code{@@load}. +@code{@@load} or @option{-l}. @item "scalar" The identifier is a scalar. diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 9bef7907..2c1bee3e 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -14060,7 +14060,7 @@ current record. @xref{Changing Fields}. @cindex differences in @command{awk} and @command{gawk}, @code{FUNCTAB} variable @item @code{FUNCTAB #} An array whose indices and corresponding values are the names of all -the user-defined or extension functions in the program. +the built-in, user-defined and extension functions in the program. @quotation NOTE Attempting to use the @code{delete} statement with the @code{FUNCTAB} @@ -14108,9 +14108,12 @@ text of the AWK program. For each identifier, the value of the element is one o @item "array" The identifier is an array. +@item "builtin" +The identifier is a built-in function. + @item "extension" The identifier is an extension function loaded via -@code{@@load}. +@code{@@load} or @option{-l}. @item "scalar" The identifier is a scalar. @@ -241,6 +241,7 @@ static const char *const nodetypes[] = { "Node_func", "Node_ext_func", "Node_old_ext_func", + "Node_builtin_func", "Node_array_ref", "Node_array_tree", "Node_array_leaf", diff --git a/interpret.h b/interpret.h index fee8136e..28804330 100644 --- a/interpret.h +++ b/interpret.h @@ -1039,12 +1039,13 @@ match_re: } if (f == NULL) { + fatal(_("`%s' is not a function, so it cannot be called indirectly"), + t1->stptr); + } else if (f->type == Node_builtin_func) { int arg_count = (pc + 1)->expr_count; builtin_func_t the_func = lookup_builtin(t1->stptr); - if (the_func == NULL) - fatal(_("`%s' is not a user-defined function, so it cannot be called indirectly"), - t1->stptr); + assert(the_func != NULL); /* call it */ r = the_func(arg_count); @@ -694,6 +694,8 @@ out: if (do_intl) exit(EXIT_SUCCESS); + install_builtins(); + if (do_lint) shadow_funcs(); @@ -307,7 +307,9 @@ install(char *name, NODE *parm, NODETYPE type) if (type == Node_param_list) { table = param_table; - } else if (type == Node_func || type == Node_ext_func) { + } else if ( type == Node_func + || type == Node_ext_func + || type == Node_builtin_func) { table = func_table; } else if (installing_specials) { table = global_table; @@ -320,7 +322,7 @@ install(char *name, NODE *parm, NODETYPE type) r = make_symbol(name, type); if (type == Node_func) func_count++; - if (type != Node_ext_func && table != global_table) + if (type != Node_ext_func && type != Node_builtin_func && table != global_table) var_count++; /* total, includes Node_func */ } @@ -393,7 +395,7 @@ get_symbols(SYMBOL_TYPE what, bool sort) for (i = count = 0; i < max; i += 2) { r = list[i+1]; - if (r->type == Node_ext_func) + if (r->type == Node_ext_func || r->type == Node_builtin_func) continue; assert(r->type == Node_func); table[count++] = r; @@ -539,7 +541,7 @@ load_symbols() NODE *sym_array; NODE **aptr; long i, j, max; - NODE *user, *extension, *untyped, *scalar, *array; + NODE *user, *extension, *untyped, *scalar, *array, *built_in; NODE **list; NODE *tables[4]; @@ -570,6 +572,7 @@ load_symbols() scalar = make_string("scalar", 6); untyped = make_string("untyped", 7); array = make_string("array", 5); + built_in = make_string("builtin", 7); for (i = 0; tables[i] != NULL; i++) { list = assoc_list(tables[i], "@unsorted", ASORTI); @@ -580,6 +583,7 @@ load_symbols() r = list[j+1]; if ( r->type == Node_ext_func || r->type == Node_func + || r->type == Node_builtin_func || r->type == Node_var || r->type == Node_var_array || r->type == Node_var_new) { @@ -594,6 +598,9 @@ load_symbols() case Node_func: *aptr = dupnode(user); break; + case Node_builtin_func: + *aptr = dupnode(built_in); + break; case Node_var: *aptr = dupnode(scalar); break; diff --git a/test/ChangeLog b/test/ChangeLog index 96bd37e9..68cc18e6 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -7,6 +7,7 @@ Sort of related: * indirectcall2.awk, indirectcall2.ok: New files. + * id.ok: Updated. 2014-09-04 Arnold D. Robbins <arnold@skeeve.com> @@ -1,32 +1,73 @@ -FUNCTAB -> array -ARGV -> array -SYMTAB -> array -ORS -> scalar -ROUNDMODE -> scalar -i -> untyped OFS -> scalar +rand -> builtin +ARGC -> scalar +dcgettext -> builtin +gsub -> builtin +PREC -> scalar +match -> builtin +ARGIND -> scalar +int -> builtin ERRNO -> scalar +ARGV -> array +log -> builtin +sprintf -> builtin +ROUNDMODE -> scalar +strftime -> builtin +systime -> builtin +and -> builtin +srand -> builtin FNR -> scalar +asort -> builtin +atan2 -> builtin +cos -> builtin +TEXTDOMAIN -> scalar +ORS -> scalar +split -> builtin +div -> builtin +RSTART -> scalar +compl -> builtin +bindtextdomain -> builtin +exp -> builtin +or -> builtin +fflush -> builtin +gensub -> builtin LINT -> scalar +dcngettext -> builtin +index -> builtin IGNORECASE -> scalar -NR -> scalar -function1 -> user -ARGIND -> scalar -NF -> scalar -TEXTDOMAIN -> scalar +system -> builtin CONVFMT -> scalar +sqrt -> builtin +rshift -> builtin +tolower -> builtin +FS -> scalar +BINMODE -> scalar +sin -> builtin +asorti -> builtin FIELDWIDTHS -> scalar -ARGC -> scalar +function1 -> user +FILENAME -> scalar +close -> builtin +mktime -> builtin +FUNCTAB -> array +NF -> scalar +isarray -> builtin an_array -> untyped -PROCINFO -> array -PREC -> scalar +patsplit -> builtin +NR -> scalar SUBSEP -> scalar -FPAT -> scalar -RS -> scalar -FS -> scalar +extension -> builtin +i -> untyped +sub -> builtin OFMT -> scalar RLENGTH -> scalar +substr -> builtin +FPAT -> scalar +RS -> scalar +xor -> builtin RT -> scalar -BINMODE -> scalar -FILENAME -> scalar -RSTART -> scalar +PROCINFO -> array +lshift -> builtin +SYMTAB -> array +strtonum -> builtin +toupper -> builtin |