diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-02-19 07:58:34 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-02-19 07:58:34 +0200 |
commit | c116a3b0b2b2731fe44372b1c3aa6535717b4dc1 (patch) | |
tree | 2abcc4879673abd8e92b5db01469375438de02ce | |
parent | 1e593610891a14187d0f44bec56520dfa118a95b (diff) | |
download | egawk-c116a3b0b2b2731fe44372b1c3aa6535717b4dc1.tar.gz egawk-c116a3b0b2b2731fe44372b1c3aa6535717b4dc1.tar.bz2 egawk-c116a3b0b2b2731fe44372b1c3aa6535717b4dc1.zip |
More edits.
-rw-r--r-- | doc/ChangeLog | 4 | ||||
-rw-r--r-- | doc/gawk.info | 878 | ||||
-rw-r--r-- | doc/gawk.texi | 137 | ||||
-rw-r--r-- | doc/gawktexi.in | 137 |
4 files changed, 581 insertions, 575 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index 8f2c1b7b..42508ab1 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2015-02-19 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in: More O'Reilly fixes. + 2015-02-17 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: A few minor formatting fixes to sync with O'Reilly diff --git a/doc/gawk.info b/doc/gawk.info index a6eecfdd..717e6659 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -10183,15 +10183,14 @@ description of each variable.) `IGNORECASE #' If `IGNORECASE' is nonzero or non-null, then all string comparisons - and all regular expression matching are case-independent. Thus, - regexp matching with `~' and `!~', as well as the `gensub()', + and all regular expression matching are case-independent. This + applies to regexp matching with `~' and `!~', the `gensub()', `gsub()', `index()', `match()', `patsplit()', `split()', and `sub()' functions, record termination with `RS', and field - splitting with `FS' and `FPAT', all ignore case when doing their - particular regexp operations. However, the value of `IGNORECASE' - does _not_ affect array subscripting and it does not affect field - splitting when using a single-character field separator. *Note - Case-sensitivity::. + splitting with `FS' and `FPAT'. However, the value of + `IGNORECASE' does _not_ affect array subscripting and it does not + affect field splitting when using a single-character field + separator. *Note Case-sensitivity::. `LINT #' When this variable is true (nonzero or non-null), `gawk' behaves @@ -14288,61 +14287,7 @@ names of the two comparison functions: -| rsort: <100.0 95.6 93.4 87.1> Another example where indirect functions calls are useful can be -found in processing arrays. *note Walking Arrays::, presented a simple -function for "walking" an array of arrays. That function simply -printed the name and value of each scalar array element. However, it is -easy to generalize that function, by passing in the name of a function -to call when walking an array. The modified function looks like this: - - function process_array(arr, name, process, do_arrays, i, new_name) - { - for (i in arr) { - new_name = (name "[" i "]") - if (isarray(arr[i])) { - if (do_arrays) - @process(new_name, arr[i]) - process_array(arr[i], new_name, process, do_arrays) - } else - @process(new_name, arr[i]) - } - } - - The arguments are as follows: - -`arr' - The array. - -`name' - The name of the array (a string). - -`process' - The name of the function to call. - -`do_arrays' - If this is true, the function can handle elements that are - subarrays. - - If subarrays are to be processed, that is done before walking them -further. - - When run with the following scaffolding, the function produces the -same results as does the earlier `walk_array()' function: - - BEGIN { - a[1] = 1 - a[2][1] = 21 - a[2][2] = 22 - a[3] = 3 - a[4][1][1] = 411 - a[4][2] = 42 - - process_array(a, "a", "do_print", 0) - } - - function do_print(name, element) - { - printf "%s = %s\n", name, element - } +found in processing arrays. This is described in *note Walking Arrays::. Remember that you must supply a leading `@' in front of an indirect function call. @@ -16319,6 +16264,61 @@ value. Here is a main program to demonstrate: -| a[4][1][1] = 411 -| a[4][2] = 42 + The function just presented simply prints the name and value of each +scalar array element. However, it is easy to generalize it, by passing +in the name of a function to call when walking an array. The modified +function looks like this: + + function process_array(arr, name, process, do_arrays, i, new_name) + { + for (i in arr) { + new_name = (name "[" i "]") + if (isarray(arr[i])) { + if (do_arrays) + @process(new_name, arr[i]) + process_array(arr[i], new_name, process, do_arrays) + } else + @process(new_name, arr[i]) + } + } + + The arguments are as follows: + +`arr' + The array. + +`name' + The name of the array (a string). + +`process' + The name of the function to call. + +`do_arrays' + If this is true, the function can handle elements that are + subarrays. + + If subarrays are to be processed, that is done before walking them +further. + + When run with the following scaffolding, the function produces the +same results as does the earlier version of `walk_array()': + + BEGIN { + a[1] = 1 + a[2][1] = 21 + a[2][2] = 22 + a[3] = 3 + a[4][1][1] = 411 + a[4][2] = 42 + + process_array(a, "a", "do_print", 0) + } + + function do_print(name, element) + { + printf "%s = %s\n", name, element + } + File: gawk.info, Node: Library Functions Summary, Next: Library Exercises, Prev: Walking Arrays, Up: Library Functions @@ -16353,7 +16353,7 @@ File: gawk.info, Node: Library Functions Summary, Next: Library Exercises, Pr Two sets of routines that parallel the C library versions Traversing arrays of arrays - A simple function to traverse an array of arrays to any depth + Two functions that traverse an array of arrays to any depth @@ -32502,7 +32502,7 @@ Index (line 6) * differences in awk and gawk, line continuations: Conditional Exp. (line 34) -* differences in awk and gawk, LINT variable: User-modified. (line 88) +* differences in awk and gawk, LINT variable: User-modified. (line 87) * differences in awk and gawk, match() function: String Functions. (line 263) * differences in awk and gawk, print/printf statements: Format Modifiers. @@ -32527,7 +32527,7 @@ Index (line 77) * differences in awk and gawk, SYMTAB variable: Auto-set. (line 269) * differences in awk and gawk, TEXTDOMAIN variable: User-modified. - (line 152) + (line 151) * differences in awk and gawk, trunc-mod operation: Arithmetic Ops. (line 66) * directories, command-line: Command-line directories. @@ -32989,7 +32989,7 @@ Index (line 6) * gawk, interval expressions and: Regexp Operators. (line 139) * gawk, line continuation in: Conditional Exp. (line 34) -* gawk, LINT variable in: User-modified. (line 88) +* gawk, LINT variable in: User-modified. (line 87) * gawk, list of contributors to: Contributors. (line 6) * gawk, MS-DOS version of: PC Using. (line 10) * gawk, MS-Windows version of: PC Using. (line 10) @@ -33015,7 +33015,7 @@ Index * gawk, splitting fields and: Constant Size. (line 87) * gawk, string-translation functions: I18N Functions. (line 6) * gawk, SYMTAB array in: Auto-set. (line 269) -* gawk, TEXTDOMAIN variable in: User-modified. (line 152) +* gawk, TEXTDOMAIN variable in: User-modified. (line 151) * gawk, timestamps: Time Functions. (line 6) * gawk, uses for: Preface. (line 34) * gawk, versions of, information about, printing: Options. (line 302) @@ -33213,7 +33213,7 @@ Index * internationalization: I18N Functions. (line 6) * internationalization, localization <1>: Internationalization. (line 13) -* internationalization, localization: User-modified. (line 152) +* internationalization, localization: User-modified. (line 151) * internationalization, localization, character classes: Bracket Expressions. (line 101) * internationalization, localization, gawk and: Internationalization. @@ -33323,7 +33323,7 @@ Index * lines, duplicate, removing: History Sorting. (line 6) * lines, matching ranges of: Ranges. (line 6) * lines, skipping between markers: Ranges. (line 43) -* lint checking: User-modified. (line 88) +* lint checking: User-modified. (line 87) * lint checking, array elements: Delete. (line 34) * lint checking, array subscripts: Uninitialized Subscripts. (line 43) @@ -33333,7 +33333,7 @@ Index (line 341) * lint checking, undefined functions: Pass By Value/Reference. (line 85) -* LINT variable: User-modified. (line 88) +* LINT variable: User-modified. (line 87) * Linux <1>: Glossary. (line 753) * Linux <2>: I18N Example. (line 55) * Linux: Manual History. (line 28) @@ -33505,11 +33505,11 @@ Index * obsolete features: Obsolete. (line 6) * octal numbers: Nondecimal-numbers. (line 6) * octal values, enabling interpretation of: Options. (line 211) -* OFMT variable <1>: User-modified. (line 105) +* OFMT variable <1>: User-modified. (line 104) * OFMT variable <2>: Strings And Numbers. (line 57) * OFMT variable: OFMT. (line 15) * OFMT variable, POSIX awk and: OFMT. (line 27) -* OFS variable <1>: User-modified. (line 114) +* OFS variable <1>: User-modified. (line 113) * OFS variable <2>: Output Separators. (line 6) * OFS variable: Changing Fields. (line 64) * OpenBSD: Glossary. (line 753) @@ -33562,7 +33562,7 @@ Index (line 12) * ord() user-defined function: Ordinal Functions. (line 16) * order of evaluation, concatenation: Concatenation. (line 41) -* ORS variable <1>: User-modified. (line 119) +* ORS variable <1>: User-modified. (line 118) * ORS variable: Output Separators. (line 21) * output field separator, See OFS variable: Changing Fields. (line 64) * output record separator, See ORS variable: Output Separators. @@ -33702,7 +33702,7 @@ Index * POSIX, gawk extensions not included in: POSIX/GNU. (line 6) * POSIX, programs, implementing in awk: Clones. (line 6) * POSIXLY_CORRECT environment variable: Options. (line 341) -* PREC variable: User-modified. (line 124) +* PREC variable: User-modified. (line 123) * precedence <1>: Precedence. (line 6) * precedence: Increment Ops. (line 60) * precedence, regexp operators: Regexp Operators. (line 156) @@ -33717,7 +33717,7 @@ Index * print statement, commas, omitting: Print Examples. (line 31) * print statement, I/O operators in: Precedence. (line 71) * print statement, line continuations and: Print Examples. (line 76) -* print statement, OFMT variable and: User-modified. (line 114) +* print statement, OFMT variable and: User-modified. (line 113) * print statement, See Also redirection, of output: Redirection. (line 17) * print statement, sprintf() function and: Round Function. (line 6) @@ -33832,7 +33832,7 @@ Index * readfile() user-defined function: Readfile Function. (line 30) * reading input files: Reading Files. (line 6) * recipe for a programming language: History. (line 6) -* record separators <1>: User-modified. (line 133) +* record separators <1>: User-modified. (line 132) * record separators: awk split records. (line 6) * record separators, changing: awk split records. (line 85) * record separators, regular expressions as: awk split records. @@ -33944,8 +33944,8 @@ Index * round to nearest integer: Numeric Functions. (line 23) * round() user-defined function: Round Function. (line 16) * rounding numbers: Round Function. (line 6) -* ROUNDMODE variable: User-modified. (line 128) -* RS variable <1>: User-modified. (line 133) +* ROUNDMODE variable: User-modified. (line 127) +* RS variable <1>: User-modified. (line 132) * RS variable: awk split records. (line 12) * RS variable, multiline records and: Multiple Line. (line 17) * rshift: Bitwise Functions. (line 53) @@ -34002,12 +34002,12 @@ Index * separators, field, FIELDWIDTHS variable and: User-modified. (line 37) * separators, field, FPAT variable and: User-modified. (line 43) * separators, field, POSIX and: Fields. (line 6) -* separators, for records <1>: User-modified. (line 133) +* separators, for records <1>: User-modified. (line 132) * separators, for records: awk split records. (line 6) * separators, for records, regular expressions as: awk split records. (line 125) * separators, for statements in actions: Action Overview. (line 19) -* separators, subscript: User-modified. (line 146) +* separators, subscript: User-modified. (line 145) * set breakpoint: Breakpoint Control. (line 11) * set debugger command: Viewing And Changing Data. (line 59) @@ -34139,7 +34139,7 @@ Index * split.awk program: Split Program. (line 30) * sprintf <1>: String Functions. (line 384) * sprintf: OFMT. (line 15) -* sprintf() function, OFMT variable and: User-modified. (line 114) +* sprintf() function, OFMT variable and: User-modified. (line 113) * sprintf() function, print/printf statements and: Round Function. (line 6) * sqrt: Numeric Functions. (line 77) @@ -34201,7 +34201,7 @@ Index (line 43) * sub() function, arguments of: String Functions. (line 463) * sub() function, escape processing: Gory Details. (line 6) -* subscript separators: User-modified. (line 146) +* subscript separators: User-modified. (line 145) * subscripts in arrays, multidimensional: Multidimensional. (line 10) * subscripts in arrays, multidimensional, scanning: Multiscanning. (line 11) @@ -34209,7 +34209,7 @@ Index (line 6) * subscripts in arrays, uninitialized variables as: Uninitialized Subscripts. (line 6) -* SUBSEP variable: User-modified. (line 146) +* SUBSEP variable: User-modified. (line 145) * SUBSEP variable, and multidimensional arrays: Multidimensional. (line 16) * substitute in string: String Functions. (line 90) @@ -34248,7 +34248,7 @@ Index * text, printing: Print. (line 22) * text, printing, unduplicated lines of: Uniq Program. (line 6) * TEXTDOMAIN variable <1>: Programmer i18n. (line 8) -* TEXTDOMAIN variable: User-modified. (line 152) +* TEXTDOMAIN variable: User-modified. (line 151) * TEXTDOMAIN variable, BEGIN pattern and: Programmer i18n. (line 60) * TEXTDOMAIN variable, portability and: I18N Portability. (line 20) * textdomain() function (C library): Explaining gettext. (line 28) @@ -34687,360 +34687,360 @@ Node: Nextfile Statement426761 Node: Exit Statement429389 Node: Built-in Variables431800 Node: User-modified432933 -Ref: User-modified-Footnote-1440636 -Node: Auto-set440698 -Ref: Auto-set-Footnote-1453750 -Ref: Auto-set-Footnote-2453955 -Node: ARGC and ARGV454011 -Node: Pattern Action Summary458229 -Node: Arrays460662 -Node: Array Basics461991 -Node: Array Intro462835 -Ref: figure-array-elements464769 -Ref: Array Intro-Footnote-1467389 -Node: Reference to Elements467517 -Node: Assigning Elements469979 -Node: Array Example470470 -Node: Scanning an Array472229 -Node: Controlling Scanning475249 -Ref: Controlling Scanning-Footnote-1480643 -Node: Numeric Array Subscripts480959 -Node: Uninitialized Subscripts483144 -Node: Delete484761 -Ref: Delete-Footnote-1487510 -Node: Multidimensional487567 -Node: Multiscanning490664 -Node: Arrays of Arrays492253 -Node: Arrays Summary497007 -Node: Functions499098 -Node: Built-in500137 -Node: Calling Built-in501215 -Node: Numeric Functions503210 -Ref: Numeric Functions-Footnote-1507226 -Ref: Numeric Functions-Footnote-2507583 -Ref: Numeric Functions-Footnote-3507631 -Node: String Functions507903 -Ref: String Functions-Footnote-1531404 -Ref: String Functions-Footnote-2531533 -Ref: String Functions-Footnote-3531781 -Node: Gory Details531868 -Ref: table-sub-escapes533649 -Ref: table-sub-proposed535164 -Ref: table-posix-sub536526 -Ref: table-gensub-escapes538063 -Ref: Gory Details-Footnote-1538896 -Node: I/O Functions539047 -Ref: I/O Functions-Footnote-1546283 -Node: Time Functions546430 -Ref: Time Functions-Footnote-1556939 -Ref: Time Functions-Footnote-2557007 -Ref: Time Functions-Footnote-3557165 -Ref: Time Functions-Footnote-4557276 -Ref: Time Functions-Footnote-5557388 -Ref: Time Functions-Footnote-6557615 -Node: Bitwise Functions557881 -Ref: table-bitwise-ops558443 -Ref: Bitwise Functions-Footnote-1562771 -Node: Type Functions562943 -Node: I18N Functions564095 -Node: User-defined565742 -Node: Definition Syntax566547 -Ref: Definition Syntax-Footnote-1572206 -Node: Function Example572277 -Ref: Function Example-Footnote-1575198 -Node: Function Caveats575220 -Node: Calling A Function575738 -Node: Variable Scope576696 -Node: Pass By Value/Reference579689 -Node: Return Statement583186 -Node: Dynamic Typing586165 -Node: Indirect Calls587094 -Ref: Indirect Calls-Footnote-1598400 -Node: Functions Summary598528 -Node: Library Functions601230 -Ref: Library Functions-Footnote-1604838 -Ref: Library Functions-Footnote-2604981 -Node: Library Names605152 -Ref: Library Names-Footnote-1608610 -Ref: Library Names-Footnote-2608833 -Node: General Functions608919 -Node: Strtonum Function610022 -Node: Assert Function613044 -Node: Round Function616368 -Node: Cliff Random Function617909 -Node: Ordinal Functions618925 -Ref: Ordinal Functions-Footnote-1621988 -Ref: Ordinal Functions-Footnote-2622240 -Node: Join Function622451 -Ref: Join Function-Footnote-1624221 -Node: Getlocaltime Function624421 -Node: Readfile Function628165 -Node: Shell Quoting630137 -Node: Data File Management631538 -Node: Filetrans Function632170 -Node: Rewind Function636266 -Node: File Checking637652 -Ref: File Checking-Footnote-1638985 -Node: Empty Files639186 -Node: Ignoring Assigns641165 -Node: Getopt Function642715 -Ref: Getopt Function-Footnote-1654179 -Node: Passwd Functions654379 -Ref: Passwd Functions-Footnote-1663219 -Node: Group Functions663307 -Ref: Group Functions-Footnote-1671204 -Node: Walking Arrays671409 -Node: Library Functions Summary673009 -Node: Library Exercises674413 -Node: Sample Programs675693 -Node: Running Examples676463 -Node: Clones677191 -Node: Cut Program678415 -Node: Egrep Program688135 -Ref: Egrep Program-Footnote-1695638 -Node: Id Program695748 -Node: Split Program699424 -Ref: Split Program-Footnote-1702878 -Node: Tee Program703006 -Node: Uniq Program705795 -Node: Wc Program713214 -Ref: Wc Program-Footnote-1717464 -Node: Miscellaneous Programs717558 -Node: Dupword Program718771 -Node: Alarm Program720802 -Node: Translate Program725607 -Ref: Translate Program-Footnote-1730170 -Node: Labels Program730440 -Ref: Labels Program-Footnote-1733791 -Node: Word Sorting733875 -Node: History Sorting737945 -Node: Extract Program739780 -Node: Simple Sed747304 -Node: Igawk Program750374 -Ref: Igawk Program-Footnote-1764700 -Ref: Igawk Program-Footnote-2764901 -Ref: Igawk Program-Footnote-3765023 -Node: Anagram Program765138 -Node: Signature Program768199 -Node: Programs Summary769446 -Node: Programs Exercises770667 -Ref: Programs Exercises-Footnote-1774798 -Node: Advanced Features774889 -Node: Nondecimal Data776871 -Node: Array Sorting778461 -Node: Controlling Array Traversal779161 -Ref: Controlling Array Traversal-Footnote-1787527 -Node: Array Sorting Functions787645 -Ref: Array Sorting Functions-Footnote-1791531 -Node: Two-way I/O791727 -Ref: Two-way I/O-Footnote-1796672 -Ref: Two-way I/O-Footnote-2796858 -Node: TCP/IP Networking796940 -Node: Profiling799812 -Node: Advanced Features Summary807353 -Node: Internationalization809286 -Node: I18N and L10N810766 -Node: Explaining gettext811452 -Ref: Explaining gettext-Footnote-1816477 -Ref: Explaining gettext-Footnote-2816661 -Node: Programmer i18n816826 -Ref: Programmer i18n-Footnote-1821702 -Node: Translator i18n821751 -Node: String Extraction822545 -Ref: String Extraction-Footnote-1823676 -Node: Printf Ordering823762 -Ref: Printf Ordering-Footnote-1826548 -Node: I18N Portability826612 -Ref: I18N Portability-Footnote-1829068 -Node: I18N Example829131 -Ref: I18N Example-Footnote-1831934 -Node: Gawk I18N832006 -Node: I18N Summary832650 -Node: Debugger833990 -Node: Debugging835012 -Node: Debugging Concepts835453 -Node: Debugging Terms837263 -Node: Awk Debugging839835 -Node: Sample Debugging Session840741 -Node: Debugger Invocation841275 -Node: Finding The Bug842660 -Node: List of Debugger Commands849139 -Node: Breakpoint Control850471 -Node: Debugger Execution Control854148 -Node: Viewing And Changing Data857507 -Node: Execution Stack860883 -Node: Debugger Info862518 -Node: Miscellaneous Debugger Commands866563 -Node: Readline Support871564 -Node: Limitations872458 -Node: Debugging Summary874573 -Node: Arbitrary Precision Arithmetic875747 -Node: Computer Arithmetic877163 -Ref: table-numeric-ranges880762 -Ref: Computer Arithmetic-Footnote-1881286 -Node: Math Definitions881343 -Ref: table-ieee-formats884638 -Ref: Math Definitions-Footnote-1885242 -Node: MPFR features885347 -Node: FP Math Caution887018 -Ref: FP Math Caution-Footnote-1888068 -Node: Inexactness of computations888437 -Node: Inexact representation889396 -Node: Comparing FP Values890754 -Node: Errors accumulate891836 -Node: Getting Accuracy893268 -Node: Try To Round895972 -Node: Setting precision896871 -Ref: table-predefined-precision-strings897555 -Node: Setting the rounding mode899384 -Ref: table-gawk-rounding-modes899748 -Ref: Setting the rounding mode-Footnote-1903200 -Node: Arbitrary Precision Integers903379 -Ref: Arbitrary Precision Integers-Footnote-1906363 -Node: POSIX Floating Point Problems906512 -Ref: POSIX Floating Point Problems-Footnote-1910391 -Node: Floating point summary910429 -Node: Dynamic Extensions912625 -Node: Extension Intro914177 -Node: Plugin License915442 -Node: Extension Mechanism Outline916239 -Ref: figure-load-extension916667 -Ref: figure-register-new-function918147 -Ref: figure-call-new-function919151 -Node: Extension API Description921138 -Node: Extension API Functions Introduction922588 -Node: General Data Types927409 -Ref: General Data Types-Footnote-1933309 -Node: Memory Allocation Functions933608 -Ref: Memory Allocation Functions-Footnote-1936447 -Node: Constructor Functions936546 -Node: Registration Functions938285 -Node: Extension Functions938970 -Node: Exit Callback Functions941267 -Node: Extension Version String942515 -Node: Input Parsers943178 -Node: Output Wrappers953053 -Node: Two-way processors957566 -Node: Printing Messages959829 -Ref: Printing Messages-Footnote-1960905 -Node: Updating `ERRNO'961057 -Node: Requesting Values961797 -Ref: table-value-types-returned962524 -Node: Accessing Parameters963481 -Node: Symbol Table Access964715 -Node: Symbol table by name965229 -Node: Symbol table by cookie967249 -Ref: Symbol table by cookie-Footnote-1971394 -Node: Cached values971457 -Ref: Cached values-Footnote-1974953 -Node: Array Manipulation975044 -Ref: Array Manipulation-Footnote-1976142 -Node: Array Data Types976179 -Ref: Array Data Types-Footnote-1978834 -Node: Array Functions978926 -Node: Flattening Arrays982785 -Node: Creating Arrays989687 -Node: Extension API Variables994458 -Node: Extension Versioning995094 -Node: Extension API Informational Variables996985 -Node: Extension API Boilerplate998050 -Node: Finding Extensions1001859 -Node: Extension Example1002419 -Node: Internal File Description1003191 -Node: Internal File Ops1007258 -Ref: Internal File Ops-Footnote-11019009 -Node: Using Internal File Ops1019149 -Ref: Using Internal File Ops-Footnote-11021532 -Node: Extension Samples1021805 -Node: Extension Sample File Functions1023333 -Node: Extension Sample Fnmatch1031014 -Node: Extension Sample Fork1032502 -Node: Extension Sample Inplace1033717 -Node: Extension Sample Ord1035393 -Node: Extension Sample Readdir1036229 -Ref: table-readdir-file-types1037106 -Node: Extension Sample Revout1037917 -Node: Extension Sample Rev2way1038506 -Node: Extension Sample Read write array1039246 -Node: Extension Sample Readfile1041186 -Node: Extension Sample Time1042281 -Node: Extension Sample API Tests1043629 -Node: gawkextlib1044120 -Node: Extension summary1046798 -Node: Extension Exercises1050487 -Node: Language History1051209 -Node: V7/SVR3.11052865 -Node: SVR41055018 -Node: POSIX1056452 -Node: BTL1057833 -Node: POSIX/GNU1058564 -Node: Feature History1064085 -Node: Common Extensions1077183 -Node: Ranges and Locales1078555 -Ref: Ranges and Locales-Footnote-11083174 -Ref: Ranges and Locales-Footnote-21083201 -Ref: Ranges and Locales-Footnote-31083436 -Node: Contributors1083657 -Node: History summary1089197 -Node: Installation1090576 -Node: Gawk Distribution1091522 -Node: Getting1092006 -Node: Extracting1092829 -Node: Distribution contents1094466 -Node: Unix Installation1100220 -Node: Quick Installation1100837 -Node: Additional Configuration Options1103261 -Node: Configuration Philosophy1105064 -Node: Non-Unix Installation1107433 -Node: PC Installation1107891 -Node: PC Binary Installation1109211 -Node: PC Compiling1111059 -Ref: PC Compiling-Footnote-11114080 -Node: PC Testing1114189 -Node: PC Using1115365 -Node: Cygwin1119480 -Node: MSYS1120250 -Node: VMS Installation1120751 -Node: VMS Compilation1121543 -Ref: VMS Compilation-Footnote-11122772 -Node: VMS Dynamic Extensions1122830 -Node: VMS Installation Details1124514 -Node: VMS Running1126765 -Node: VMS GNV1129605 -Node: VMS Old Gawk1130340 -Node: Bugs1130810 -Node: Other Versions1134699 -Node: Installation summary1141133 -Node: Notes1142192 -Node: Compatibility Mode1143057 -Node: Additions1143839 -Node: Accessing The Source1144764 -Node: Adding Code1146199 -Node: New Ports1152356 -Node: Derived Files1156838 -Ref: Derived Files-Footnote-11162313 -Ref: Derived Files-Footnote-21162347 -Ref: Derived Files-Footnote-31162943 -Node: Future Extensions1163057 -Node: Implementation Limitations1163663 -Node: Extension Design1164911 -Node: Old Extension Problems1166065 -Ref: Old Extension Problems-Footnote-11167582 -Node: Extension New Mechanism Goals1167639 -Ref: Extension New Mechanism Goals-Footnote-11170999 -Node: Extension Other Design Decisions1171188 -Node: Extension Future Growth1173296 -Node: Old Extension Mechanism1174132 -Node: Notes summary1175894 -Node: Basic Concepts1177080 -Node: Basic High Level1177761 -Ref: figure-general-flow1178033 -Ref: figure-process-flow1178632 -Ref: Basic High Level-Footnote-11181861 -Node: Basic Data Typing1182046 -Node: Glossary1185374 -Node: Copying1217303 -Node: GNU Free Documentation License1254859 -Node: Index1279995 +Ref: User-modified-Footnote-1440567 +Node: Auto-set440629 +Ref: Auto-set-Footnote-1453681 +Ref: Auto-set-Footnote-2453886 +Node: ARGC and ARGV453942 +Node: Pattern Action Summary458160 +Node: Arrays460593 +Node: Array Basics461922 +Node: Array Intro462766 +Ref: figure-array-elements464700 +Ref: Array Intro-Footnote-1467320 +Node: Reference to Elements467448 +Node: Assigning Elements469910 +Node: Array Example470401 +Node: Scanning an Array472160 +Node: Controlling Scanning475180 +Ref: Controlling Scanning-Footnote-1480574 +Node: Numeric Array Subscripts480890 +Node: Uninitialized Subscripts483075 +Node: Delete484692 +Ref: Delete-Footnote-1487441 +Node: Multidimensional487498 +Node: Multiscanning490595 +Node: Arrays of Arrays492184 +Node: Arrays Summary496938 +Node: Functions499029 +Node: Built-in500068 +Node: Calling Built-in501146 +Node: Numeric Functions503141 +Ref: Numeric Functions-Footnote-1507157 +Ref: Numeric Functions-Footnote-2507514 +Ref: Numeric Functions-Footnote-3507562 +Node: String Functions507834 +Ref: String Functions-Footnote-1531335 +Ref: String Functions-Footnote-2531464 +Ref: String Functions-Footnote-3531712 +Node: Gory Details531799 +Ref: table-sub-escapes533580 +Ref: table-sub-proposed535095 +Ref: table-posix-sub536457 +Ref: table-gensub-escapes537994 +Ref: Gory Details-Footnote-1538827 +Node: I/O Functions538978 +Ref: I/O Functions-Footnote-1546214 +Node: Time Functions546361 +Ref: Time Functions-Footnote-1556870 +Ref: Time Functions-Footnote-2556938 +Ref: Time Functions-Footnote-3557096 +Ref: Time Functions-Footnote-4557207 +Ref: Time Functions-Footnote-5557319 +Ref: Time Functions-Footnote-6557546 +Node: Bitwise Functions557812 +Ref: table-bitwise-ops558374 +Ref: Bitwise Functions-Footnote-1562702 +Node: Type Functions562874 +Node: I18N Functions564026 +Node: User-defined565673 +Node: Definition Syntax566478 +Ref: Definition Syntax-Footnote-1572137 +Node: Function Example572208 +Ref: Function Example-Footnote-1575129 +Node: Function Caveats575151 +Node: Calling A Function575669 +Node: Variable Scope576627 +Node: Pass By Value/Reference579620 +Node: Return Statement583117 +Node: Dynamic Typing586096 +Node: Indirect Calls587025 +Ref: Indirect Calls-Footnote-1596890 +Node: Functions Summary597018 +Node: Library Functions599720 +Ref: Library Functions-Footnote-1603328 +Ref: Library Functions-Footnote-2603471 +Node: Library Names603642 +Ref: Library Names-Footnote-1607100 +Ref: Library Names-Footnote-2607323 +Node: General Functions607409 +Node: Strtonum Function608512 +Node: Assert Function611534 +Node: Round Function614858 +Node: Cliff Random Function616399 +Node: Ordinal Functions617415 +Ref: Ordinal Functions-Footnote-1620478 +Ref: Ordinal Functions-Footnote-2620730 +Node: Join Function620941 +Ref: Join Function-Footnote-1622711 +Node: Getlocaltime Function622911 +Node: Readfile Function626655 +Node: Shell Quoting628627 +Node: Data File Management630028 +Node: Filetrans Function630660 +Node: Rewind Function634756 +Node: File Checking636142 +Ref: File Checking-Footnote-1637475 +Node: Empty Files637676 +Node: Ignoring Assigns639655 +Node: Getopt Function641205 +Ref: Getopt Function-Footnote-1652669 +Node: Passwd Functions652869 +Ref: Passwd Functions-Footnote-1661709 +Node: Group Functions661797 +Ref: Group Functions-Footnote-1669694 +Node: Walking Arrays669899 +Node: Library Functions Summary672905 +Node: Library Exercises674307 +Node: Sample Programs675587 +Node: Running Examples676357 +Node: Clones677085 +Node: Cut Program678309 +Node: Egrep Program688029 +Ref: Egrep Program-Footnote-1695532 +Node: Id Program695642 +Node: Split Program699318 +Ref: Split Program-Footnote-1702772 +Node: Tee Program702900 +Node: Uniq Program705689 +Node: Wc Program713108 +Ref: Wc Program-Footnote-1717358 +Node: Miscellaneous Programs717452 +Node: Dupword Program718665 +Node: Alarm Program720696 +Node: Translate Program725501 +Ref: Translate Program-Footnote-1730064 +Node: Labels Program730334 +Ref: Labels Program-Footnote-1733685 +Node: Word Sorting733769 +Node: History Sorting737839 +Node: Extract Program739674 +Node: Simple Sed747198 +Node: Igawk Program750268 +Ref: Igawk Program-Footnote-1764594 +Ref: Igawk Program-Footnote-2764795 +Ref: Igawk Program-Footnote-3764917 +Node: Anagram Program765032 +Node: Signature Program768093 +Node: Programs Summary769340 +Node: Programs Exercises770561 +Ref: Programs Exercises-Footnote-1774692 +Node: Advanced Features774783 +Node: Nondecimal Data776765 +Node: Array Sorting778355 +Node: Controlling Array Traversal779055 +Ref: Controlling Array Traversal-Footnote-1787421 +Node: Array Sorting Functions787539 +Ref: Array Sorting Functions-Footnote-1791425 +Node: Two-way I/O791621 +Ref: Two-way I/O-Footnote-1796566 +Ref: Two-way I/O-Footnote-2796752 +Node: TCP/IP Networking796834 +Node: Profiling799706 +Node: Advanced Features Summary807247 +Node: Internationalization809180 +Node: I18N and L10N810660 +Node: Explaining gettext811346 +Ref: Explaining gettext-Footnote-1816371 +Ref: Explaining gettext-Footnote-2816555 +Node: Programmer i18n816720 +Ref: Programmer i18n-Footnote-1821596 +Node: Translator i18n821645 +Node: String Extraction822439 +Ref: String Extraction-Footnote-1823570 +Node: Printf Ordering823656 +Ref: Printf Ordering-Footnote-1826442 +Node: I18N Portability826506 +Ref: I18N Portability-Footnote-1828962 +Node: I18N Example829025 +Ref: I18N Example-Footnote-1831828 +Node: Gawk I18N831900 +Node: I18N Summary832544 +Node: Debugger833884 +Node: Debugging834906 +Node: Debugging Concepts835347 +Node: Debugging Terms837157 +Node: Awk Debugging839729 +Node: Sample Debugging Session840635 +Node: Debugger Invocation841169 +Node: Finding The Bug842554 +Node: List of Debugger Commands849033 +Node: Breakpoint Control850365 +Node: Debugger Execution Control854042 +Node: Viewing And Changing Data857401 +Node: Execution Stack860777 +Node: Debugger Info862412 +Node: Miscellaneous Debugger Commands866457 +Node: Readline Support871458 +Node: Limitations872352 +Node: Debugging Summary874467 +Node: Arbitrary Precision Arithmetic875641 +Node: Computer Arithmetic877057 +Ref: table-numeric-ranges880656 +Ref: Computer Arithmetic-Footnote-1881180 +Node: Math Definitions881237 +Ref: table-ieee-formats884532 +Ref: Math Definitions-Footnote-1885136 +Node: MPFR features885241 +Node: FP Math Caution886912 +Ref: FP Math Caution-Footnote-1887962 +Node: Inexactness of computations888331 +Node: Inexact representation889290 +Node: Comparing FP Values890648 +Node: Errors accumulate891730 +Node: Getting Accuracy893162 +Node: Try To Round895866 +Node: Setting precision896765 +Ref: table-predefined-precision-strings897449 +Node: Setting the rounding mode899278 +Ref: table-gawk-rounding-modes899642 +Ref: Setting the rounding mode-Footnote-1903094 +Node: Arbitrary Precision Integers903273 +Ref: Arbitrary Precision Integers-Footnote-1906257 +Node: POSIX Floating Point Problems906406 +Ref: POSIX Floating Point Problems-Footnote-1910285 +Node: Floating point summary910323 +Node: Dynamic Extensions912519 +Node: Extension Intro914071 +Node: Plugin License915336 +Node: Extension Mechanism Outline916133 +Ref: figure-load-extension916561 +Ref: figure-register-new-function918041 +Ref: figure-call-new-function919045 +Node: Extension API Description921032 +Node: Extension API Functions Introduction922482 +Node: General Data Types927303 +Ref: General Data Types-Footnote-1933203 +Node: Memory Allocation Functions933502 +Ref: Memory Allocation Functions-Footnote-1936341 +Node: Constructor Functions936440 +Node: Registration Functions938179 +Node: Extension Functions938864 +Node: Exit Callback Functions941161 +Node: Extension Version String942409 +Node: Input Parsers943072 +Node: Output Wrappers952947 +Node: Two-way processors957460 +Node: Printing Messages959723 +Ref: Printing Messages-Footnote-1960799 +Node: Updating `ERRNO'960951 +Node: Requesting Values961691 +Ref: table-value-types-returned962418 +Node: Accessing Parameters963375 +Node: Symbol Table Access964609 +Node: Symbol table by name965123 +Node: Symbol table by cookie967143 +Ref: Symbol table by cookie-Footnote-1971288 +Node: Cached values971351 +Ref: Cached values-Footnote-1974847 +Node: Array Manipulation974938 +Ref: Array Manipulation-Footnote-1976036 +Node: Array Data Types976073 +Ref: Array Data Types-Footnote-1978728 +Node: Array Functions978820 +Node: Flattening Arrays982679 +Node: Creating Arrays989581 +Node: Extension API Variables994352 +Node: Extension Versioning994988 +Node: Extension API Informational Variables996879 +Node: Extension API Boilerplate997944 +Node: Finding Extensions1001753 +Node: Extension Example1002313 +Node: Internal File Description1003085 +Node: Internal File Ops1007152 +Ref: Internal File Ops-Footnote-11018903 +Node: Using Internal File Ops1019043 +Ref: Using Internal File Ops-Footnote-11021426 +Node: Extension Samples1021699 +Node: Extension Sample File Functions1023227 +Node: Extension Sample Fnmatch1030908 +Node: Extension Sample Fork1032396 +Node: Extension Sample Inplace1033611 +Node: Extension Sample Ord1035287 +Node: Extension Sample Readdir1036123 +Ref: table-readdir-file-types1037000 +Node: Extension Sample Revout1037811 +Node: Extension Sample Rev2way1038400 +Node: Extension Sample Read write array1039140 +Node: Extension Sample Readfile1041080 +Node: Extension Sample Time1042175 +Node: Extension Sample API Tests1043523 +Node: gawkextlib1044014 +Node: Extension summary1046692 +Node: Extension Exercises1050381 +Node: Language History1051103 +Node: V7/SVR3.11052759 +Node: SVR41054912 +Node: POSIX1056346 +Node: BTL1057727 +Node: POSIX/GNU1058458 +Node: Feature History1063979 +Node: Common Extensions1077077 +Node: Ranges and Locales1078449 +Ref: Ranges and Locales-Footnote-11083068 +Ref: Ranges and Locales-Footnote-21083095 +Ref: Ranges and Locales-Footnote-31083330 +Node: Contributors1083551 +Node: History summary1089091 +Node: Installation1090470 +Node: Gawk Distribution1091416 +Node: Getting1091900 +Node: Extracting1092723 +Node: Distribution contents1094360 +Node: Unix Installation1100114 +Node: Quick Installation1100731 +Node: Additional Configuration Options1103155 +Node: Configuration Philosophy1104958 +Node: Non-Unix Installation1107327 +Node: PC Installation1107785 +Node: PC Binary Installation1109105 +Node: PC Compiling1110953 +Ref: PC Compiling-Footnote-11113974 +Node: PC Testing1114083 +Node: PC Using1115259 +Node: Cygwin1119374 +Node: MSYS1120144 +Node: VMS Installation1120645 +Node: VMS Compilation1121437 +Ref: VMS Compilation-Footnote-11122666 +Node: VMS Dynamic Extensions1122724 +Node: VMS Installation Details1124408 +Node: VMS Running1126659 +Node: VMS GNV1129499 +Node: VMS Old Gawk1130234 +Node: Bugs1130704 +Node: Other Versions1134593 +Node: Installation summary1141027 +Node: Notes1142086 +Node: Compatibility Mode1142951 +Node: Additions1143733 +Node: Accessing The Source1144658 +Node: Adding Code1146093 +Node: New Ports1152250 +Node: Derived Files1156732 +Ref: Derived Files-Footnote-11162207 +Ref: Derived Files-Footnote-21162241 +Ref: Derived Files-Footnote-31162837 +Node: Future Extensions1162951 +Node: Implementation Limitations1163557 +Node: Extension Design1164805 +Node: Old Extension Problems1165959 +Ref: Old Extension Problems-Footnote-11167476 +Node: Extension New Mechanism Goals1167533 +Ref: Extension New Mechanism Goals-Footnote-11170893 +Node: Extension Other Design Decisions1171082 +Node: Extension Future Growth1173190 +Node: Old Extension Mechanism1174026 +Node: Notes summary1175788 +Node: Basic Concepts1176974 +Node: Basic High Level1177655 +Ref: figure-general-flow1177927 +Ref: figure-process-flow1178526 +Ref: Basic High Level-Footnote-11181755 +Node: Basic Data Typing1181940 +Node: Glossary1185268 +Node: Copying1217197 +Node: GNU Free Documentation License1254753 +Node: Index1279889 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index a04cef48..2c0bf958 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -14591,12 +14591,13 @@ is to simply say @samp{FS = FS}, perhaps with an explanatory comment. @cindex regular expressions, case sensitivity @item IGNORECASE # If @code{IGNORECASE} is nonzero or non-null, then all string comparisons -and all regular expression matching are case-independent. Thus, regexp -matching with @samp{~} and @samp{!~}, as well as the @code{gensub()}, -@code{gsub()}, @code{index()}, @code{match()}, @code{patsplit()}, -@code{split()}, and @code{sub()} -functions, record termination with @code{RS}, and field splitting with -@code{FS} and @code{FPAT}, all ignore case when doing their particular regexp operations. +and all regular expression matching are case-independent. +This applies to +regexp matching with @samp{~} and @samp{!~}, +the @code{gensub()}, @code{gsub()}, @code{index()}, @code{match()}, +@code{patsplit()}, @code{split()}, and @code{sub()} functions, +record termination with @code{RS}, and field splitting with +@code{FS} and @code{FPAT}. However, the value of @code{IGNORECASE} does @emph{not} affect array subscripting and it does not affect field splitting when using a single-character field separator. @@ -20326,67 +20327,7 @@ $ @kbd{gawk -f quicksort.awk -f indirectcall.awk class_data2} @end example Another example where indirect functions calls are useful can be found in -processing arrays. @DBREF{Walking Arrays} presented a simple function -for ``walking'' an array of arrays. That function simply printed the -name and value of each scalar array element. However, it is easy to -generalize that function, by passing in the name of a function to call -when walking an array. The modified function looks like this: - -@example -@c file eg/lib/processarray.awk -function process_array(arr, name, process, do_arrays, i, new_name) -@{ - for (i in arr) @{ - new_name = (name "[" i "]") - if (isarray(arr[i])) @{ - if (do_arrays) - @@process(new_name, arr[i]) - process_array(arr[i], new_name, process, do_arrays) - @} else - @@process(new_name, arr[i]) - @} -@} -@c endfile -@end example - -The arguments are as follows: - -@table @code -@item arr -The array. - -@item name -The name of the array (a string). - -@item process -The name of the function to call. - -@item do_arrays -If this is true, the function can handle elements that are subarrays. -@end table - -If subarrays are to be processed, that is done before walking them further. - -When run with the following scaffolding, the function produces the same -results as does the earlier @code{walk_array()} function: - -@example -BEGIN @{ - a[1] = 1 - a[2][1] = 21 - a[2][2] = 22 - a[3] = 3 - a[4][1][1] = 411 - a[4][2] = 42 - - process_array(a, "a", "do_print", 0) -@} - -function do_print(name, element) -@{ - printf "%s = %s\n", name, element -@} -@end example +processing arrays. This is described in @ref{Walking Arrays}. Remember that you must supply a leading @samp{@@} in front of an indirect function call. @@ -23017,6 +22958,66 @@ $ @kbd{gawk -f walk_array.awk} @print{} a[4][2] = 42 @end example +The function just presented simply prints the +name and value of each scalar array element. However, it is easy to +generalize it, by passing in the name of a function to call +when walking an array. The modified function looks like this: + +@example +@c file eg/lib/processarray.awk +function process_array(arr, name, process, do_arrays, i, new_name) +@{ + for (i in arr) @{ + new_name = (name "[" i "]") + if (isarray(arr[i])) @{ + if (do_arrays) + @@process(new_name, arr[i]) + process_array(arr[i], new_name, process, do_arrays) + @} else + @@process(new_name, arr[i]) + @} +@} +@c endfile +@end example + +The arguments are as follows: + +@table @code +@item arr +The array. + +@item name +The name of the array (a string). + +@item process +The name of the function to call. + +@item do_arrays +If this is true, the function can handle elements that are subarrays. +@end table + +If subarrays are to be processed, that is done before walking them further. + +When run with the following scaffolding, the function produces the same +results as does the earlier version of @code{walk_array()}: + +@example +BEGIN @{ + a[1] = 1 + a[2][1] = 21 + a[2][2] = 22 + a[3] = 3 + a[4][1][1] = 411 + a[4][2] = 42 + + process_array(a, "a", "do_print", 0) +@} + +function do_print(name, element) +@{ + printf "%s = %s\n", name, element +@} +@end example @node Library Functions Summary @section Summary @@ -23055,7 +23056,7 @@ An @command{awk} version of the standard C @code{getopt()} function Two sets of routines that parallel the C library versions @item Traversing arrays of arrays -A simple function to traverse an array of arrays to any depth +Two functions that traverse an array of arrays to any depth @end table @c end nested list diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 1a5be1b8..7c13dcb1 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -13919,12 +13919,13 @@ is to simply say @samp{FS = FS}, perhaps with an explanatory comment. @cindex regular expressions, case sensitivity @item IGNORECASE # If @code{IGNORECASE} is nonzero or non-null, then all string comparisons -and all regular expression matching are case-independent. Thus, regexp -matching with @samp{~} and @samp{!~}, as well as the @code{gensub()}, -@code{gsub()}, @code{index()}, @code{match()}, @code{patsplit()}, -@code{split()}, and @code{sub()} -functions, record termination with @code{RS}, and field splitting with -@code{FS} and @code{FPAT}, all ignore case when doing their particular regexp operations. +and all regular expression matching are case-independent. +This applies to +regexp matching with @samp{~} and @samp{!~}, +the @code{gensub()}, @code{gsub()}, @code{index()}, @code{match()}, +@code{patsplit()}, @code{split()}, and @code{sub()} functions, +record termination with @code{RS}, and field splitting with +@code{FS} and @code{FPAT}. However, the value of @code{IGNORECASE} does @emph{not} affect array subscripting and it does not affect field splitting when using a single-character field separator. @@ -19447,67 +19448,7 @@ $ @kbd{gawk -f quicksort.awk -f indirectcall.awk class_data2} @end example Another example where indirect functions calls are useful can be found in -processing arrays. @DBREF{Walking Arrays} presented a simple function -for ``walking'' an array of arrays. That function simply printed the -name and value of each scalar array element. However, it is easy to -generalize that function, by passing in the name of a function to call -when walking an array. The modified function looks like this: - -@example -@c file eg/lib/processarray.awk -function process_array(arr, name, process, do_arrays, i, new_name) -@{ - for (i in arr) @{ - new_name = (name "[" i "]") - if (isarray(arr[i])) @{ - if (do_arrays) - @@process(new_name, arr[i]) - process_array(arr[i], new_name, process, do_arrays) - @} else - @@process(new_name, arr[i]) - @} -@} -@c endfile -@end example - -The arguments are as follows: - -@table @code -@item arr -The array. - -@item name -The name of the array (a string). - -@item process -The name of the function to call. - -@item do_arrays -If this is true, the function can handle elements that are subarrays. -@end table - -If subarrays are to be processed, that is done before walking them further. - -When run with the following scaffolding, the function produces the same -results as does the earlier @code{walk_array()} function: - -@example -BEGIN @{ - a[1] = 1 - a[2][1] = 21 - a[2][2] = 22 - a[3] = 3 - a[4][1][1] = 411 - a[4][2] = 42 - - process_array(a, "a", "do_print", 0) -@} - -function do_print(name, element) -@{ - printf "%s = %s\n", name, element -@} -@end example +processing arrays. This is described in @ref{Walking Arrays}. Remember that you must supply a leading @samp{@@} in front of an indirect function call. @@ -22108,6 +22049,66 @@ $ @kbd{gawk -f walk_array.awk} @print{} a[4][2] = 42 @end example +The function just presented simply prints the +name and value of each scalar array element. However, it is easy to +generalize it, by passing in the name of a function to call +when walking an array. The modified function looks like this: + +@example +@c file eg/lib/processarray.awk +function process_array(arr, name, process, do_arrays, i, new_name) +@{ + for (i in arr) @{ + new_name = (name "[" i "]") + if (isarray(arr[i])) @{ + if (do_arrays) + @@process(new_name, arr[i]) + process_array(arr[i], new_name, process, do_arrays) + @} else + @@process(new_name, arr[i]) + @} +@} +@c endfile +@end example + +The arguments are as follows: + +@table @code +@item arr +The array. + +@item name +The name of the array (a string). + +@item process +The name of the function to call. + +@item do_arrays +If this is true, the function can handle elements that are subarrays. +@end table + +If subarrays are to be processed, that is done before walking them further. + +When run with the following scaffolding, the function produces the same +results as does the earlier version of @code{walk_array()}: + +@example +BEGIN @{ + a[1] = 1 + a[2][1] = 21 + a[2][2] = 22 + a[3] = 3 + a[4][1][1] = 411 + a[4][2] = 42 + + process_array(a, "a", "do_print", 0) +@} + +function do_print(name, element) +@{ + printf "%s = %s\n", name, element +@} +@end example @node Library Functions Summary @section Summary @@ -22146,7 +22147,7 @@ An @command{awk} version of the standard C @code{getopt()} function Two sets of routines that parallel the C library versions @item Traversing arrays of arrays -A simple function to traverse an array of arrays to any depth +Two functions that traverse an array of arrays to any depth @end table @c end nested list |