diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-02-19 08:02:10 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-02-19 08:02:10 +0200 |
commit | 1da41261fba4cd03a32362d44c8634f599ae64db (patch) | |
tree | 4135b1d39ba5380a0e05e2aa813428d4eae85e9f | |
parent | 19e83a019f11d7ad1a199b7c6842f6184b59755b (diff) | |
parent | c116a3b0b2b2731fe44372b1c3aa6535717b4dc1 (diff) | |
download | egawk-1da41261fba4cd03a32362d44c8634f599ae64db.tar.gz egawk-1da41261fba4cd03a32362d44c8634f599ae64db.tar.bz2 egawk-1da41261fba4cd03a32362d44c8634f599ae64db.zip |
Merge branch 'gawk-4.1-stable'
-rw-r--r-- | doc/ChangeLog | 4 | ||||
-rw-r--r-- | doc/gawk.info | 880 | ||||
-rw-r--r-- | doc/gawk.texi | 137 | ||||
-rw-r--r-- | doc/gawktexi.in | 137 |
4 files changed, 582 insertions, 576 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index 93441078..70fa1abd 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 d299f965..012d95a9 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -10184,15 +10184,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 @@ -14318,61 +14317,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. @@ -16349,6 +16294,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 @@ -16383,7 +16383,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 @@ -32674,7 +32674,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. @@ -32699,7 +32699,7 @@ Index (line 77) * differences in awk and gawk, SYMTAB variable: Auto-set. (line 283) * 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. @@ -33162,7 +33162,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) @@ -33188,7 +33188,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 283) -* 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 300) @@ -33392,7 +33392,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. @@ -33502,7 +33502,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) @@ -33512,7 +33512,7 @@ Index (line 339) * 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) @@ -33684,11 +33684,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) @@ -33741,7 +33741,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. @@ -33881,7 +33881,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 339) -* 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) @@ -33896,7 +33896,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) @@ -34011,7 +34011,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. @@ -34123,8 +34123,8 @@ Index * round to nearest integer: Numeric Functions. (line 38) * 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) @@ -34181,12 +34181,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) @@ -34318,7 +34318,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 92) @@ -34380,7 +34380,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) @@ -34388,7 +34388,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) @@ -34427,7 +34427,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) @@ -34866,361 +34866,361 @@ Node: Nextfile Statement426905 Node: Exit Statement429533 Node: Built-in Variables431944 Node: User-modified433077 -Ref: User-modified-Footnote-1440780 -Node: Auto-set440842 -Ref: Auto-set-Footnote-1454551 -Ref: Auto-set-Footnote-2454756 -Node: ARGC and ARGV454812 -Node: Pattern Action Summary459030 -Node: Arrays461463 -Node: Array Basics462792 -Node: Array Intro463636 -Ref: figure-array-elements465570 -Ref: Array Intro-Footnote-1468190 -Node: Reference to Elements468318 -Node: Assigning Elements470780 -Node: Array Example471271 -Node: Scanning an Array473030 -Node: Controlling Scanning476050 -Ref: Controlling Scanning-Footnote-1481444 -Node: Numeric Array Subscripts481760 -Node: Uninitialized Subscripts483945 -Node: Delete485562 -Ref: Delete-Footnote-1488311 -Node: Multidimensional488368 -Node: Multiscanning491465 -Node: Arrays of Arrays493054 -Node: Arrays Summary497808 -Node: Functions499899 -Node: Built-in500938 -Node: Calling Built-in502016 -Node: Numeric Functions504011 -Ref: Numeric Functions-Footnote-1508829 -Ref: Numeric Functions-Footnote-2509186 -Ref: Numeric Functions-Footnote-3509234 -Node: String Functions509506 -Ref: String Functions-Footnote-1533007 -Ref: String Functions-Footnote-2533136 -Ref: String Functions-Footnote-3533384 -Node: Gory Details533471 -Ref: table-sub-escapes535252 -Ref: table-sub-proposed536767 -Ref: table-posix-sub538129 -Ref: table-gensub-escapes539666 -Ref: Gory Details-Footnote-1540499 -Node: I/O Functions540650 -Ref: I/O Functions-Footnote-1547886 -Node: Time Functions548033 -Ref: Time Functions-Footnote-1558542 -Ref: Time Functions-Footnote-2558610 -Ref: Time Functions-Footnote-3558768 -Ref: Time Functions-Footnote-4558879 -Ref: Time Functions-Footnote-5558991 -Ref: Time Functions-Footnote-6559218 -Node: Bitwise Functions559484 -Ref: table-bitwise-ops560046 -Ref: Bitwise Functions-Footnote-1564374 -Node: Type Functions564546 -Node: I18N Functions565698 -Node: User-defined567345 -Node: Definition Syntax568150 -Ref: Definition Syntax-Footnote-1573809 -Node: Function Example573880 -Ref: Function Example-Footnote-1576801 -Node: Function Caveats576823 -Node: Calling A Function577341 -Node: Variable Scope578299 -Node: Pass By Value/Reference581292 -Node: Return Statement584789 -Node: Dynamic Typing587768 -Node: Indirect Calls588697 -Ref: Indirect Calls-Footnote-1600003 -Node: Functions Summary600131 -Node: Library Functions602833 -Ref: Library Functions-Footnote-1606441 -Ref: Library Functions-Footnote-2606584 -Node: Library Names606755 -Ref: Library Names-Footnote-1610213 -Ref: Library Names-Footnote-2610436 -Node: General Functions610522 -Node: Strtonum Function611625 -Node: Assert Function614647 -Node: Round Function617971 -Node: Cliff Random Function619512 -Node: Ordinal Functions620528 -Ref: Ordinal Functions-Footnote-1623591 -Ref: Ordinal Functions-Footnote-2623843 -Node: Join Function624054 -Ref: Join Function-Footnote-1625824 -Node: Getlocaltime Function626024 -Node: Readfile Function629768 -Node: Shell Quoting631740 -Node: Data File Management633141 -Node: Filetrans Function633773 -Node: Rewind Function637869 -Node: File Checking639255 -Ref: File Checking-Footnote-1640588 -Node: Empty Files640789 -Node: Ignoring Assigns642768 -Node: Getopt Function644318 -Ref: Getopt Function-Footnote-1655782 -Node: Passwd Functions655982 -Ref: Passwd Functions-Footnote-1664822 -Node: Group Functions664910 -Ref: Group Functions-Footnote-1672807 -Node: Walking Arrays673012 -Node: Library Functions Summary674612 -Node: Library Exercises676016 -Node: Sample Programs677296 -Node: Running Examples678066 -Node: Clones678794 -Node: Cut Program680018 -Node: Egrep Program689738 -Ref: Egrep Program-Footnote-1697241 -Node: Id Program697351 -Node: Split Program701027 -Ref: Split Program-Footnote-1704481 -Node: Tee Program704609 -Node: Uniq Program707398 -Node: Wc Program714817 -Ref: Wc Program-Footnote-1719067 -Node: Miscellaneous Programs719161 -Node: Dupword Program720374 -Node: Alarm Program722405 -Node: Translate Program727210 -Ref: Translate Program-Footnote-1731773 -Node: Labels Program732043 -Ref: Labels Program-Footnote-1735394 -Node: Word Sorting735478 -Node: History Sorting739548 -Node: Extract Program741383 -Node: Simple Sed748907 -Node: Igawk Program751977 -Ref: Igawk Program-Footnote-1766303 -Ref: Igawk Program-Footnote-2766504 -Ref: Igawk Program-Footnote-3766626 -Node: Anagram Program766741 -Node: Signature Program769802 -Node: Programs Summary771049 -Node: Programs Exercises772270 -Ref: Programs Exercises-Footnote-1776401 -Node: Advanced Features776492 -Node: Nondecimal Data778474 -Node: Array Sorting780064 -Node: Controlling Array Traversal780764 -Ref: Controlling Array Traversal-Footnote-1789130 -Node: Array Sorting Functions789248 -Ref: Array Sorting Functions-Footnote-1793134 -Node: Two-way I/O793330 -Ref: Two-way I/O-Footnote-1798275 -Ref: Two-way I/O-Footnote-2798461 -Node: TCP/IP Networking798543 -Node: Profiling801415 -Node: Advanced Features Summary809686 -Node: Internationalization811619 -Node: I18N and L10N813099 -Node: Explaining gettext813785 -Ref: Explaining gettext-Footnote-1818810 -Ref: Explaining gettext-Footnote-2818994 -Node: Programmer i18n819159 -Ref: Programmer i18n-Footnote-1824035 -Node: Translator i18n824084 -Node: String Extraction824878 -Ref: String Extraction-Footnote-1826009 -Node: Printf Ordering826095 -Ref: Printf Ordering-Footnote-1828881 -Node: I18N Portability828945 -Ref: I18N Portability-Footnote-1831401 -Node: I18N Example831464 -Ref: I18N Example-Footnote-1834267 -Node: Gawk I18N834339 -Node: I18N Summary834983 -Node: Debugger836323 -Node: Debugging837345 -Node: Debugging Concepts837786 -Node: Debugging Terms839596 -Node: Awk Debugging842168 -Node: Sample Debugging Session843074 -Node: Debugger Invocation843608 -Node: Finding The Bug844993 -Node: List of Debugger Commands851472 -Node: Breakpoint Control852804 -Node: Debugger Execution Control856481 -Node: Viewing And Changing Data859840 -Node: Execution Stack863216 -Node: Debugger Info864851 -Node: Miscellaneous Debugger Commands868896 -Node: Readline Support873897 -Node: Limitations874791 -Node: Debugging Summary876906 -Node: Arbitrary Precision Arithmetic878080 -Node: Computer Arithmetic879496 -Ref: table-numeric-ranges883095 -Ref: Computer Arithmetic-Footnote-1883619 -Node: Math Definitions883676 -Ref: table-ieee-formats886971 -Ref: Math Definitions-Footnote-1887575 -Node: MPFR features887680 -Node: FP Math Caution889351 -Ref: FP Math Caution-Footnote-1890401 -Node: Inexactness of computations890770 -Node: Inexact representation891729 -Node: Comparing FP Values893087 -Node: Errors accumulate894169 -Node: Getting Accuracy895601 -Node: Try To Round898305 -Node: Setting precision899204 -Ref: table-predefined-precision-strings899888 -Node: Setting the rounding mode901717 -Ref: table-gawk-rounding-modes902081 -Ref: Setting the rounding mode-Footnote-1905533 -Node: Arbitrary Precision Integers905712 -Ref: Arbitrary Precision Integers-Footnote-1910610 -Node: POSIX Floating Point Problems910759 -Ref: POSIX Floating Point Problems-Footnote-1914638 -Node: Floating point summary914676 -Node: Dynamic Extensions916872 -Node: Extension Intro918424 -Node: Plugin License919689 -Node: Extension Mechanism Outline920486 -Ref: figure-load-extension920914 -Ref: figure-register-new-function922394 -Ref: figure-call-new-function923398 -Node: Extension API Description925385 -Node: Extension API Functions Introduction926835 -Node: General Data Types931656 -Ref: General Data Types-Footnote-1937556 -Node: Memory Allocation Functions937855 -Ref: Memory Allocation Functions-Footnote-1940694 -Node: Constructor Functions940793 -Node: Registration Functions942532 -Node: Extension Functions943217 -Node: Exit Callback Functions945514 -Node: Extension Version String946762 -Node: Input Parsers947425 -Node: Output Wrappers957300 -Node: Two-way processors961813 -Node: Printing Messages964076 -Ref: Printing Messages-Footnote-1965152 -Node: Updating `ERRNO'965304 -Node: Requesting Values966044 -Ref: table-value-types-returned966771 -Node: Accessing Parameters967728 -Node: Symbol Table Access968962 -Node: Symbol table by name969476 -Node: Symbol table by cookie971496 -Ref: Symbol table by cookie-Footnote-1975641 -Node: Cached values975704 -Ref: Cached values-Footnote-1979200 -Node: Array Manipulation979291 -Ref: Array Manipulation-Footnote-1980389 -Node: Array Data Types980426 -Ref: Array Data Types-Footnote-1983081 -Node: Array Functions983173 -Node: Flattening Arrays987032 -Node: Creating Arrays993934 -Node: Extension API Variables998705 -Node: Extension Versioning999341 -Node: Extension API Informational Variables1001232 -Node: Extension API Boilerplate1002297 -Node: Finding Extensions1006106 -Node: Extension Example1006666 -Node: Internal File Description1007438 -Node: Internal File Ops1011505 -Ref: Internal File Ops-Footnote-11023256 -Node: Using Internal File Ops1023396 -Ref: Using Internal File Ops-Footnote-11025779 -Node: Extension Samples1026052 -Node: Extension Sample File Functions1027580 -Node: Extension Sample Fnmatch1035261 -Node: Extension Sample Fork1036749 -Node: Extension Sample Inplace1037964 -Node: Extension Sample Ord1039640 -Node: Extension Sample Readdir1040476 -Ref: table-readdir-file-types1041353 -Node: Extension Sample Revout1042164 -Node: Extension Sample Rev2way1042753 -Node: Extension Sample Read write array1043493 -Node: Extension Sample Readfile1045433 -Node: Extension Sample Time1046528 -Node: Extension Sample API Tests1047876 -Node: gawkextlib1048367 -Node: Extension summary1051045 -Node: Extension Exercises1054734 -Node: Language History1055456 -Node: V7/SVR3.11057112 -Node: SVR41059265 -Node: POSIX1060699 -Node: BTL1062080 -Node: POSIX/GNU1062811 -Node: Feature History1068556 -Node: Common Extensions1082282 -Node: Ranges and Locales1083654 -Ref: Ranges and Locales-Footnote-11088273 -Ref: Ranges and Locales-Footnote-21088300 -Ref: Ranges and Locales-Footnote-31088535 -Node: Contributors1088756 -Node: History summary1094296 -Node: Installation1095675 -Node: Gawk Distribution1096621 -Node: Getting1097105 -Node: Extracting1097928 -Node: Distribution contents1099565 -Node: Unix Installation1105667 -Node: Quick Installation1106350 -Node: Shell Startup Files1108761 -Node: Additional Configuration Options1109840 -Node: Configuration Philosophy1111644 -Node: Non-Unix Installation1114013 -Node: PC Installation1114471 -Node: PC Binary Installation1115791 -Node: PC Compiling1117639 -Ref: PC Compiling-Footnote-11120660 -Node: PC Testing1120769 -Node: PC Using1121945 -Node: Cygwin1126060 -Node: MSYS1126830 -Node: VMS Installation1127331 -Node: VMS Compilation1128123 -Ref: VMS Compilation-Footnote-11129352 -Node: VMS Dynamic Extensions1129410 -Node: VMS Installation Details1131094 -Node: VMS Running1133345 -Node: VMS GNV1136185 -Node: VMS Old Gawk1136920 -Node: Bugs1137390 -Node: Other Versions1141279 -Node: Installation summary1147713 -Node: Notes1148772 -Node: Compatibility Mode1149637 -Node: Additions1150419 -Node: Accessing The Source1151344 -Node: Adding Code1152779 -Node: New Ports1158936 -Node: Derived Files1163418 -Ref: Derived Files-Footnote-11168893 -Ref: Derived Files-Footnote-21168927 -Ref: Derived Files-Footnote-31169523 -Node: Future Extensions1169637 -Node: Implementation Limitations1170243 -Node: Extension Design1171491 -Node: Old Extension Problems1172645 -Ref: Old Extension Problems-Footnote-11174162 -Node: Extension New Mechanism Goals1174219 -Ref: Extension New Mechanism Goals-Footnote-11177579 -Node: Extension Other Design Decisions1177768 -Node: Extension Future Growth1179876 -Node: Old Extension Mechanism1180712 -Node: Notes summary1182474 -Node: Basic Concepts1183660 -Node: Basic High Level1184341 -Ref: figure-general-flow1184613 -Ref: figure-process-flow1185212 -Ref: Basic High Level-Footnote-11188441 -Node: Basic Data Typing1188626 -Node: Glossary1191954 -Node: Copying1223883 -Node: GNU Free Documentation License1261439 -Node: Index1286575 +Ref: User-modified-Footnote-1440711 +Node: Auto-set440773 +Ref: Auto-set-Footnote-1454482 +Ref: Auto-set-Footnote-2454687 +Node: ARGC and ARGV454743 +Node: Pattern Action Summary458961 +Node: Arrays461394 +Node: Array Basics462723 +Node: Array Intro463567 +Ref: figure-array-elements465501 +Ref: Array Intro-Footnote-1468121 +Node: Reference to Elements468249 +Node: Assigning Elements470711 +Node: Array Example471202 +Node: Scanning an Array472961 +Node: Controlling Scanning475981 +Ref: Controlling Scanning-Footnote-1481375 +Node: Numeric Array Subscripts481691 +Node: Uninitialized Subscripts483876 +Node: Delete485493 +Ref: Delete-Footnote-1488242 +Node: Multidimensional488299 +Node: Multiscanning491396 +Node: Arrays of Arrays492985 +Node: Arrays Summary497739 +Node: Functions499830 +Node: Built-in500869 +Node: Calling Built-in501947 +Node: Numeric Functions503942 +Ref: Numeric Functions-Footnote-1508760 +Ref: Numeric Functions-Footnote-2509117 +Ref: Numeric Functions-Footnote-3509165 +Node: String Functions509437 +Ref: String Functions-Footnote-1532938 +Ref: String Functions-Footnote-2533067 +Ref: String Functions-Footnote-3533315 +Node: Gory Details533402 +Ref: table-sub-escapes535183 +Ref: table-sub-proposed536698 +Ref: table-posix-sub538060 +Ref: table-gensub-escapes539597 +Ref: Gory Details-Footnote-1540430 +Node: I/O Functions540581 +Ref: I/O Functions-Footnote-1547817 +Node: Time Functions547964 +Ref: Time Functions-Footnote-1558473 +Ref: Time Functions-Footnote-2558541 +Ref: Time Functions-Footnote-3558699 +Ref: Time Functions-Footnote-4558810 +Ref: Time Functions-Footnote-5558922 +Ref: Time Functions-Footnote-6559149 +Node: Bitwise Functions559415 +Ref: table-bitwise-ops559977 +Ref: Bitwise Functions-Footnote-1564305 +Node: Type Functions564477 +Node: I18N Functions565629 +Node: User-defined567276 +Node: Definition Syntax568081 +Ref: Definition Syntax-Footnote-1573740 +Node: Function Example573811 +Ref: Function Example-Footnote-1576732 +Node: Function Caveats576754 +Node: Calling A Function577272 +Node: Variable Scope578230 +Node: Pass By Value/Reference581223 +Node: Return Statement584720 +Node: Dynamic Typing587699 +Node: Indirect Calls588628 +Ref: Indirect Calls-Footnote-1598493 +Node: Functions Summary598621 +Node: Library Functions601323 +Ref: Library Functions-Footnote-1604931 +Ref: Library Functions-Footnote-2605074 +Node: Library Names605245 +Ref: Library Names-Footnote-1608703 +Ref: Library Names-Footnote-2608926 +Node: General Functions609012 +Node: Strtonum Function610115 +Node: Assert Function613137 +Node: Round Function616461 +Node: Cliff Random Function618002 +Node: Ordinal Functions619018 +Ref: Ordinal Functions-Footnote-1622081 +Ref: Ordinal Functions-Footnote-2622333 +Node: Join Function622544 +Ref: Join Function-Footnote-1624314 +Node: Getlocaltime Function624514 +Node: Readfile Function628258 +Node: Shell Quoting630230 +Node: Data File Management631631 +Node: Filetrans Function632263 +Node: Rewind Function636359 +Node: File Checking637745 +Ref: File Checking-Footnote-1639078 +Node: Empty Files639279 +Node: Ignoring Assigns641258 +Node: Getopt Function642808 +Ref: Getopt Function-Footnote-1654272 +Node: Passwd Functions654472 +Ref: Passwd Functions-Footnote-1663312 +Node: Group Functions663400 +Ref: Group Functions-Footnote-1671297 +Node: Walking Arrays671502 +Node: Library Functions Summary674508 +Node: Library Exercises675910 +Node: Sample Programs677190 +Node: Running Examples677960 +Node: Clones678688 +Node: Cut Program679912 +Node: Egrep Program689632 +Ref: Egrep Program-Footnote-1697135 +Node: Id Program697245 +Node: Split Program700921 +Ref: Split Program-Footnote-1704375 +Node: Tee Program704503 +Node: Uniq Program707292 +Node: Wc Program714711 +Ref: Wc Program-Footnote-1718961 +Node: Miscellaneous Programs719055 +Node: Dupword Program720268 +Node: Alarm Program722299 +Node: Translate Program727104 +Ref: Translate Program-Footnote-1731667 +Node: Labels Program731937 +Ref: Labels Program-Footnote-1735288 +Node: Word Sorting735372 +Node: History Sorting739442 +Node: Extract Program741277 +Node: Simple Sed748801 +Node: Igawk Program751871 +Ref: Igawk Program-Footnote-1766197 +Ref: Igawk Program-Footnote-2766398 +Ref: Igawk Program-Footnote-3766520 +Node: Anagram Program766635 +Node: Signature Program769696 +Node: Programs Summary770943 +Node: Programs Exercises772164 +Ref: Programs Exercises-Footnote-1776295 +Node: Advanced Features776386 +Node: Nondecimal Data778368 +Node: Array Sorting779958 +Node: Controlling Array Traversal780658 +Ref: Controlling Array Traversal-Footnote-1789024 +Node: Array Sorting Functions789142 +Ref: Array Sorting Functions-Footnote-1793028 +Node: Two-way I/O793224 +Ref: Two-way I/O-Footnote-1798169 +Ref: Two-way I/O-Footnote-2798355 +Node: TCP/IP Networking798437 +Node: Profiling801309 +Node: Advanced Features Summary809580 +Node: Internationalization811513 +Node: I18N and L10N812993 +Node: Explaining gettext813679 +Ref: Explaining gettext-Footnote-1818704 +Ref: Explaining gettext-Footnote-2818888 +Node: Programmer i18n819053 +Ref: Programmer i18n-Footnote-1823929 +Node: Translator i18n823978 +Node: String Extraction824772 +Ref: String Extraction-Footnote-1825903 +Node: Printf Ordering825989 +Ref: Printf Ordering-Footnote-1828775 +Node: I18N Portability828839 +Ref: I18N Portability-Footnote-1831295 +Node: I18N Example831358 +Ref: I18N Example-Footnote-1834161 +Node: Gawk I18N834233 +Node: I18N Summary834877 +Node: Debugger836217 +Node: Debugging837239 +Node: Debugging Concepts837680 +Node: Debugging Terms839490 +Node: Awk Debugging842062 +Node: Sample Debugging Session842968 +Node: Debugger Invocation843502 +Node: Finding The Bug844887 +Node: List of Debugger Commands851366 +Node: Breakpoint Control852698 +Node: Debugger Execution Control856375 +Node: Viewing And Changing Data859734 +Node: Execution Stack863110 +Node: Debugger Info864745 +Node: Miscellaneous Debugger Commands868790 +Node: Readline Support873791 +Node: Limitations874685 +Node: Debugging Summary876800 +Node: Arbitrary Precision Arithmetic877974 +Node: Computer Arithmetic879390 +Ref: table-numeric-ranges882989 +Ref: Computer Arithmetic-Footnote-1883513 +Node: Math Definitions883570 +Ref: table-ieee-formats886865 +Ref: Math Definitions-Footnote-1887469 +Node: MPFR features887574 +Node: FP Math Caution889245 +Ref: FP Math Caution-Footnote-1890295 +Node: Inexactness of computations890664 +Node: Inexact representation891623 +Node: Comparing FP Values892981 +Node: Errors accumulate894063 +Node: Getting Accuracy895495 +Node: Try To Round898199 +Node: Setting precision899098 +Ref: table-predefined-precision-strings899782 +Node: Setting the rounding mode901611 +Ref: table-gawk-rounding-modes901975 +Ref: Setting the rounding mode-Footnote-1905427 +Node: Arbitrary Precision Integers905606 +Ref: Arbitrary Precision Integers-Footnote-1910504 +Node: POSIX Floating Point Problems910653 +Ref: POSIX Floating Point Problems-Footnote-1914532 +Node: Floating point summary914570 +Node: Dynamic Extensions916766 +Node: Extension Intro918318 +Node: Plugin License919583 +Node: Extension Mechanism Outline920380 +Ref: figure-load-extension920808 +Ref: figure-register-new-function922288 +Ref: figure-call-new-function923292 +Node: Extension API Description925279 +Node: Extension API Functions Introduction926729 +Node: General Data Types931550 +Ref: General Data Types-Footnote-1937450 +Node: Memory Allocation Functions937749 +Ref: Memory Allocation Functions-Footnote-1940588 +Node: Constructor Functions940687 +Node: Registration Functions942426 +Node: Extension Functions943111 +Node: Exit Callback Functions945408 +Node: Extension Version String946656 +Node: Input Parsers947319 +Node: Output Wrappers957194 +Node: Two-way processors961707 +Node: Printing Messages963970 +Ref: Printing Messages-Footnote-1965046 +Node: Updating `ERRNO'965198 +Node: Requesting Values965938 +Ref: table-value-types-returned966665 +Node: Accessing Parameters967622 +Node: Symbol Table Access968856 +Node: Symbol table by name969370 +Node: Symbol table by cookie971390 +Ref: Symbol table by cookie-Footnote-1975535 +Node: Cached values975598 +Ref: Cached values-Footnote-1979094 +Node: Array Manipulation979185 +Ref: Array Manipulation-Footnote-1980283 +Node: Array Data Types980320 +Ref: Array Data Types-Footnote-1982975 +Node: Array Functions983067 +Node: Flattening Arrays986926 +Node: Creating Arrays993828 +Node: Extension API Variables998599 +Node: Extension Versioning999235 +Node: Extension API Informational Variables1001126 +Node: Extension API Boilerplate1002191 +Node: Finding Extensions1006000 +Node: Extension Example1006560 +Node: Internal File Description1007332 +Node: Internal File Ops1011399 +Ref: Internal File Ops-Footnote-11023150 +Node: Using Internal File Ops1023290 +Ref: Using Internal File Ops-Footnote-11025673 +Node: Extension Samples1025946 +Node: Extension Sample File Functions1027474 +Node: Extension Sample Fnmatch1035155 +Node: Extension Sample Fork1036643 +Node: Extension Sample Inplace1037858 +Node: Extension Sample Ord1039534 +Node: Extension Sample Readdir1040370 +Ref: table-readdir-file-types1041247 +Node: Extension Sample Revout1042058 +Node: Extension Sample Rev2way1042647 +Node: Extension Sample Read write array1043387 +Node: Extension Sample Readfile1045327 +Node: Extension Sample Time1046422 +Node: Extension Sample API Tests1047770 +Node: gawkextlib1048261 +Node: Extension summary1050939 +Node: Extension Exercises1054628 +Node: Language History1055350 +Node: V7/SVR3.11057006 +Node: SVR41059159 +Node: POSIX1060593 +Node: BTL1061974 +Node: POSIX/GNU1062705 +Node: Feature History1068450 +Node: Common Extensions1082176 +Node: Ranges and Locales1083548 +Ref: Ranges and Locales-Footnote-11088167 +Ref: Ranges and Locales-Footnote-21088194 +Ref: Ranges and Locales-Footnote-31088429 +Node: Contributors1088650 +Node: History summary1094190 +Node: Installation1095569 +Node: Gawk Distribution1096515 +Node: Getting1096999 +Node: Extracting1097822 +Node: Distribution contents1099459 +Node: Unix Installation1105561 +Node: Quick Installation1106244 +Node: Shell Startup Files1108655 +Node: Additional Configuration Options1109734 +Node: Configuration Philosophy1111538 +Node: Non-Unix Installation1113907 +Node: PC Installation1114365 +Node: PC Binary Installation1115685 +Node: PC Compiling1117533 +Ref: PC Compiling-Footnote-11120554 +Node: PC Testing1120663 +Node: PC Using1121839 +Node: Cygwin1125954 +Node: MSYS1126724 +Node: VMS Installation1127225 +Node: VMS Compilation1128017 +Ref: VMS Compilation-Footnote-11129246 +Node: VMS Dynamic Extensions1129304 +Node: VMS Installation Details1130988 +Node: VMS Running1133239 +Node: VMS GNV1136079 +Node: VMS Old Gawk1136814 +Node: Bugs1137284 +Node: Other Versions1141173 +Node: Installation summary1147607 +Node: Notes1148666 +Node: Compatibility Mode1149531 +Node: Additions1150313 +Node: Accessing The Source1151238 +Node: Adding Code1152673 +Node: New Ports1158830 +Node: Derived Files1163312 +Ref: Derived Files-Footnote-11168787 +Ref: Derived Files-Footnote-21168821 +Ref: Derived Files-Footnote-31169417 +Node: Future Extensions1169531 +Node: Implementation Limitations1170137 +Node: Extension Design1171385 +Node: Old Extension Problems1172539 +Ref: Old Extension Problems-Footnote-11174056 +Node: Extension New Mechanism Goals1174113 +Ref: Extension New Mechanism Goals-Footnote-11177473 +Node: Extension Other Design Decisions1177662 +Node: Extension Future Growth1179770 +Node: Old Extension Mechanism1180606 +Node: Notes summary1182368 +Node: Basic Concepts1183554 +Node: Basic High Level1184235 +Ref: figure-general-flow1184507 +Ref: figure-process-flow1185106 +Ref: Basic High Level-Footnote-11188335 +Node: Basic Data Typing1188520 +Node: Glossary1191848 +Node: Copying1223777 +Node: GNU Free Documentation License1261333 +Node: Index1286469 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index f603ca52..d9e19ba1 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -14592,12 +14592,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. @@ -20358,67 +20359,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. @@ -23049,6 +22990,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 @@ -23087,7 +23088,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 accb1a2a..2a24a374 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -13920,12 +13920,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. @@ -19479,67 +19480,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. @@ -22140,6 +22081,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 @@ -22178,7 +22179,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 |