diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2014-06-11 20:28:49 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2014-06-11 20:28:49 +0300 |
commit | b6c937359a778e40a5d532c2a3aed8b21b89b3be (patch) | |
tree | c6618f6ea0eccb2ccb8f28c4e4592bc8d15098ba /doc | |
parent | e52651945d6a0c66063aefa10438ba6aedf558c0 (diff) | |
download | egawk-b6c937359a778e40a5d532c2a3aed8b21b89b3be.tar.gz egawk-b6c937359a778e40a5d532c2a3aed8b21b89b3be.tar.bz2 egawk-b6c937359a778e40a5d532c2a3aed8b21b89b3be.zip |
More summaries. Through chapter 10.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/ChangeLog | 4 | ||||
-rw-r--r-- | doc/gawk.info | 836 | ||||
-rw-r--r-- | doc/gawk.texi | 173 | ||||
-rw-r--r-- | doc/gawktexi.in | 173 |
4 files changed, 838 insertions, 348 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index 026be8aa..bb9d4f29 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2014-06-11 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in: More "Summary" sections. Through chapter 10. + 2014-06-10 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Update docbook figure markup. diff --git a/doc/gawk.info b/doc/gawk.info index 9d472b67..ff50955b 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -10522,6 +10522,7 @@ cannot have a variable and an array with the same name in the same * Multidimensional:: Emulating multidimensional arrays in `awk'. * Arrays of Arrays:: True multidimensional arrays. +* Arrays Summary:: Summary of arrays. File: gawk.info, Node: Array Basics, Next: Delete, Up: Arrays @@ -11312,7 +11313,7 @@ The result is to set `separate[1]' to `"1"' and `separate[2]' to recovered. -File: gawk.info, Node: Arrays of Arrays, Prev: Multidimensional, Up: Arrays +File: gawk.info, Node: Arrays of Arrays, Next: Arrays Summary, Prev: Multidimensional, Up: Arrays 8.6 Arrays of Arrays ==================== @@ -11434,6 +11435,54 @@ by creating an arbitrary index: -| a +File: gawk.info, Node: Arrays Summary, Prev: Arrays of Arrays, Up: Arrays + +8.7 Summary +=========== + + * Standard `awk' provides one-dimensional associative arrays (arrays + indexed by string values). All arrays are associative; numeric + indices are converted automatically to strings. + + * Array elements are referenced as `ARRAY[INDX]'. Referencing an + element creates it if it did not exist previously. + + * The proper way to see if an array has an element with a given index + is to use the `in' operator: `INDX in ARRAY'. + + * Use `for (INDX in ARRAY) ...' to scan through all the individual + elements of an array. In the body of the loop, INDX takes on the + value of each element's index in turn. + + * The order in which a `for (INDX in ARRAY)' loop traverses an array + is undefined in POSIX `awk' and varies among implementations. + `gawk' lets you control the order by assigning special predefined + values to `PROCINFO["sorted_in"]'. + + * Use `delete ARRAY[INDX]' to delete an individual element. You may + also use `delete ARRAY' to delete all of the elements in the + array. This latter feature has been a common extension for many + years and is now standard, but may not be supported by all + commercial versions of `awk'. + + * Standard `awk' simulates multidimensional arrays by separating + subscript values with a comma. The values are concatenated into a + single string, separated by the value of `SUBSEP'. The fact that + such a subscript was created in this way is not retained; thus + changing `SUBSEP' may have unexpected consequences. You can use + `(SUB1, SUB2, ...) in ARRAY' to see if such a multidimensional + subscript exists in ARRAY. + + * `gawk' provides true arrays of arrays. You use a separate set of + square brackets for each dimension in such an array: + `data[row][col]', for example. Array elements may thus be either + scalar values (number or string) or another array. + + * Use the `isarray()' built-in function to determine if an array + element is itself a subarray. + + + File: gawk.info, Node: Functions, Next: Library Functions, Prev: Arrays, Up: Top 9 Functions @@ -11453,6 +11502,7 @@ major node describes these "user-defined" functions. * Built-in:: Summarizes the built-in functions. * User-defined:: Describes User-defined functions in detail. * Indirect Calls:: Choosing the function to call at runtime. +* Functions Summary:: Summary of functions. File: gawk.info, Node: Built-in, Next: User-defined, Up: Functions @@ -13652,7 +13702,7 @@ call, though, then `awk' does report the second error. of them. -File: gawk.info, Node: Indirect Calls, Prev: User-defined, Up: Functions +File: gawk.info, Node: Indirect Calls, Next: Functions Summary, Prev: User-defined, Up: Functions 9.3 Indirect Function Calls =========================== @@ -13940,6 +13990,63 @@ example, in the following case: `gawk' will look up the actual function to call only once. +File: gawk.info, Node: Functions Summary, Prev: Indirect Calls, Up: Functions + +9.4 Summary +=========== + + * `awk' provides built-in functions and lets you define your own + functions. + + * POSIX `awk' provides three kinds of built-in functions: numeric, + string, and I/O. `gawk' provides functions that work with values + representing time, do bit manipulation, sort arrays, and + internationalize and localize programs. `gawk' also provides + several extensions to some of standard functions, typically in the + form of additional arguments. + + * Functions accept zero or more arguments and return a value. The + expressions that provide the argument values are comnpletely + evaluated before the function is called. Order of evaluation is + not defined. The return value can be ignored. + + * The handling of backslash in `sub()' and `gsub()' is not simple. + It is more straightforward in `gawk''s `gensub()' function, but + that function still requires care in its use. + + * User-defined functions provide important capabilities but come + with some syntactic inelegancies. In a function call, there cannot + be any space between the function name and the opening left + parethesis of the argument list. Also, there is no provision for + local variables, so the convention is to add extra parameters, and + to separate them visually from the real parameters by extra + whitespace. + + * User-defined functions may call other user-defined (and built-in) + functions and may call themselves recursively. Function parameters + "hide" any global variables of the same names. + + * Scalar values are passed to user-defined functions by value. Array + parameters are passed by reference; any changes made by the + function to array parameters are thus visible after the function + has returned. + + * Use the `return' statement to return from a user-defined function. + An optional expression becomes the function's return value. Only + scalar values may be returned by a function. + + * If a variable that has never been used is passed to a user-defined + function, how that function treats the variable can set its + nature: either scalar or array. + + * `gawk' provides indirect function calls using a special syntax. + By setting a variable to the name of a user-defined function, you + can determine at runtime what function will be called at that + point in the program. This is equivalent to function pointers in C + and C++. + + + File: gawk.info, Node: Library Functions, Next: Sample Programs, Prev: Functions, Up: Top 10 A Library of `awk' Functions @@ -14015,6 +14122,7 @@ for different implementations of `awk' is pretty straightforward. * Passwd Functions:: Functions for getting user information. * Group Functions:: Functions for getting group information. * Walking Arrays:: A function to walk arrays of arrays. +* Library Functions Summary:: Summary of library functions. ---------- Footnotes ---------- @@ -14912,8 +15020,8 @@ intervening value in `ARGV' is a variable assignment. File: gawk.info, Node: Ignoring Assigns, Prev: Empty Files, Up: Data File Management -10.3.5 Treating Assignments as File Name ----------------------------------------- +10.3.5 Treating Assignments as File Names +----------------------------------------- Occasionally, you might not want `awk' to process command-line variable assignments (*note Assignment Options::). In particular, if you have a @@ -15727,7 +15835,7 @@ Suppose that the first time there were no names. This code adds the names with a leading comma. It also doesn't check that there is a `$4'. -File: gawk.info, Node: Walking Arrays, Prev: Group Functions, Up: Library Functions +File: gawk.info, Node: Walking Arrays, Next: Library Functions Summary, Prev: Group Functions, Up: Library Functions 10.7 Traversing Arrays of Arrays ================================ @@ -15790,6 +15898,43 @@ user-defined function that expects to receive an index and a value, and then processes the element. +File: gawk.info, Node: Library Functions Summary, Prev: Walking Arrays, Up: Library Functions + +10.8 Summary +============ + + * Reading programs is an excellent way to learn Good Programming. + The functions provided in this major node and the next are intended + to serve that purpose. + + * When writing general-purpose library functions, put some thought + into how to name any global variables so that they won't conflict + with variables from a user's program. + + * The functions presented here fit into the following categories: + + General problems + Number to string conversion, assertions, rounding, random + number generation, converting characters to numbers, joining + strings, getting easily usable time-of-day information, and + reading a whole file in one shot. + + Managing data files + Noting data file boundaries, rereading the current file, + checking for readable files, checking for zero-length files, + and treating assignments as file names. + + Processing command-line options + An `awk' version of the standard C `getopt()' function. + + Reading the user and group databases + 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. + + + File: gawk.info, Node: Sample Programs, Next: Advanced Features, Prev: Library Functions, Up: Top 11 Practical `awk' Programs @@ -19868,8 +20013,8 @@ File: gawk.info, Node: Gawk I18N, Prev: I18N Example, Up: Internationalizatio `gawk' itself has been internationalized using the GNU `gettext' package. (GNU `gettext' is described in complete detail in *note (GNU `gettext' utilities)Top:: gettext, GNU gettext tools.) As of this -writing, the latest version of GNU `gettext' is version 0.19 -(ftp://ftp.gnu.org/gnu/gettext/gettext-0.19.tar.gz). +writing, the latest version of GNU `gettext' is version 0.19.1 +(ftp://ftp.gnu.org/gnu/gettext/gettext-0.19.1.tar.gz). If a translation of `gawk''s messages exists, then `gawk' produces usage messages, warnings, and fatal errors in the local language. @@ -33737,342 +33882,345 @@ Ref: Auto-set-Footnote-2441927 Node: ARGC and ARGV441983 Node: Pattern Action Summary445822 Node: Arrays448045 -Node: Array Basics449543 -Node: Array Intro450369 -Ref: figure-array-elements452342 -Node: Reference to Elements454749 -Node: Assigning Elements457022 -Node: Array Example457513 -Node: Scanning an Array459245 -Node: Controlling Scanning462260 -Ref: Controlling Scanning-Footnote-1467433 -Node: Delete467749 -Ref: Delete-Footnote-1470514 -Node: Numeric Array Subscripts470571 -Node: Uninitialized Subscripts472754 -Node: Multidimensional474379 -Node: Multiscanning477472 -Node: Arrays of Arrays479061 -Node: Functions483701 -Node: Built-in484520 -Node: Calling Built-in485598 -Node: Numeric Functions487586 -Ref: Numeric Functions-Footnote-1491420 -Ref: Numeric Functions-Footnote-2491777 -Ref: Numeric Functions-Footnote-3491825 -Node: String Functions492094 -Ref: String Functions-Footnote-1515105 -Ref: String Functions-Footnote-2515234 -Ref: String Functions-Footnote-3515482 -Node: Gory Details515569 -Ref: table-sub-escapes517238 -Ref: table-sub-posix-92518592 -Ref: table-sub-proposed519943 -Ref: table-posix-sub521297 -Ref: table-gensub-escapes522842 -Ref: Gory Details-Footnote-1524018 -Ref: Gory Details-Footnote-2524069 -Node: I/O Functions524220 -Ref: I/O Functions-Footnote-1531343 -Node: Time Functions531490 -Ref: Time Functions-Footnote-1541954 -Ref: Time Functions-Footnote-2542022 -Ref: Time Functions-Footnote-3542180 -Ref: Time Functions-Footnote-4542291 -Ref: Time Functions-Footnote-5542403 -Ref: Time Functions-Footnote-6542630 -Node: Bitwise Functions542896 -Ref: table-bitwise-ops543458 -Ref: Bitwise Functions-Footnote-1547703 -Node: Type Functions547887 -Node: I18N Functions549029 -Node: User-defined550674 -Node: Definition Syntax551478 -Ref: Definition Syntax-Footnote-1556403 -Node: Function Example556472 -Ref: Function Example-Footnote-1559116 -Node: Function Caveats559138 -Node: Calling A Function559656 -Node: Variable Scope560611 -Node: Pass By Value/Reference563599 -Node: Return Statement567107 -Node: Dynamic Typing570091 -Node: Indirect Calls571020 -Node: Library Functions580707 -Ref: Library Functions-Footnote-1584220 -Ref: Library Functions-Footnote-2584363 -Node: Library Names584534 -Ref: Library Names-Footnote-1588007 -Ref: Library Names-Footnote-2588227 -Node: General Functions588313 -Node: Strtonum Function589341 -Node: Assert Function592271 -Node: Round Function595597 -Node: Cliff Random Function597138 -Node: Ordinal Functions598154 -Ref: Ordinal Functions-Footnote-1601231 -Ref: Ordinal Functions-Footnote-2601483 -Node: Join Function601694 -Ref: Join Function-Footnote-1603465 -Node: Getlocaltime Function603665 -Node: Readfile Function607401 -Node: Data File Management609240 -Node: Filetrans Function609872 -Node: Rewind Function613927 -Node: File Checking615314 -Ref: File Checking-Footnote-1616446 -Node: Empty Files616647 -Node: Ignoring Assigns618870 -Node: Getopt Function620401 -Ref: Getopt Function-Footnote-1631697 -Node: Passwd Functions631900 -Ref: Passwd Functions-Footnote-1640879 -Node: Group Functions640967 -Ref: Group Functions-Footnote-1648909 -Node: Walking Arrays649122 -Node: Sample Programs651258 -Node: Running Examples651932 -Node: Clones652660 -Node: Cut Program653884 -Node: Egrep Program663745 -Ref: Egrep Program-Footnote-1671674 -Node: Id Program671784 -Node: Split Program675448 -Ref: Split Program-Footnote-1678979 -Node: Tee Program679107 -Node: Uniq Program681914 -Node: Wc Program689344 -Ref: Wc Program-Footnote-1693612 -Ref: Wc Program-Footnote-2693812 -Node: Miscellaneous Programs693904 -Node: Dupword Program695092 -Node: Alarm Program697123 -Node: Translate Program701937 -Ref: Translate Program-Footnote-1706328 -Ref: Translate Program-Footnote-2706598 -Node: Labels Program706732 -Ref: Labels Program-Footnote-1710103 -Node: Word Sorting710187 -Node: History Sorting714230 -Node: Extract Program716066 -Ref: Extract Program-Footnote-1723641 -Node: Simple Sed723770 -Node: Igawk Program726832 -Ref: Igawk Program-Footnote-1742008 -Ref: Igawk Program-Footnote-2742209 -Node: Anagram Program742347 -Node: Signature Program745415 -Node: Advanced Features746662 -Node: Nondecimal Data748548 -Node: Array Sorting750125 -Node: Controlling Array Traversal750822 -Node: Array Sorting Functions759102 -Ref: Array Sorting Functions-Footnote-1763009 -Node: Two-way I/O763203 -Ref: Two-way I/O-Footnote-1768719 -Node: TCP/IP Networking768801 -Node: Profiling771645 -Node: Internationalization779153 -Node: I18N and L10N780578 -Node: Explaining gettext781264 -Ref: Explaining gettext-Footnote-1786404 -Ref: Explaining gettext-Footnote-2786588 -Node: Programmer i18n786753 -Node: Translator i18n790978 -Node: String Extraction791772 -Ref: String Extraction-Footnote-1792733 -Node: Printf Ordering792819 -Ref: Printf Ordering-Footnote-1795601 -Node: I18N Portability795665 -Ref: I18N Portability-Footnote-1798114 -Node: I18N Example798177 -Ref: I18N Example-Footnote-1800899 -Node: Gawk I18N800971 -Node: Debugger801584 -Node: Debugging802555 -Node: Debugging Concepts802996 -Node: Debugging Terms804852 -Node: Awk Debugging807449 -Node: Sample Debugging Session808341 -Node: Debugger Invocation808861 -Node: Finding The Bug810194 -Node: List of Debugger Commands816676 -Node: Breakpoint Control818008 -Node: Debugger Execution Control821672 -Node: Viewing And Changing Data825032 -Node: Execution Stack828390 -Node: Debugger Info829903 -Node: Miscellaneous Debugger Commands833897 -Node: Readline Support839081 -Node: Limitations839973 -Node: Arbitrary Precision Arithmetic842221 -Ref: Arbitrary Precision Arithmetic-Footnote-1843870 -Node: General Arithmetic844018 -Node: Floating Point Issues845738 -Node: String Conversion Precision846619 -Ref: String Conversion Precision-Footnote-1848324 -Node: Unexpected Results848433 -Node: POSIX Floating Point Problems850586 -Ref: POSIX Floating Point Problems-Footnote-1854407 -Node: Integer Programming854445 -Node: Floating-point Programming856256 -Ref: Floating-point Programming-Footnote-1862584 -Ref: Floating-point Programming-Footnote-2862854 -Node: Floating-point Representation863118 -Node: Floating-point Context864283 -Ref: table-ieee-formats865122 -Node: Rounding Mode866506 -Ref: table-rounding-modes866985 -Ref: Rounding Mode-Footnote-1870000 -Node: Gawk and MPFR870179 -Node: Arbitrary Precision Floats871588 -Ref: Arbitrary Precision Floats-Footnote-1874031 -Node: Setting Precision874352 -Ref: table-predefined-precision-strings875036 -Node: Setting Rounding Mode877181 -Ref: table-gawk-rounding-modes877585 -Node: Floating-point Constants878772 -Node: Changing Precision880224 -Ref: Changing Precision-Footnote-1881616 -Node: Exact Arithmetic881790 -Node: Arbitrary Precision Integers884924 -Ref: Arbitrary Precision Integers-Footnote-1887939 -Node: Dynamic Extensions888086 -Node: Extension Intro889544 -Node: Plugin License890809 -Node: Extension Mechanism Outline891494 -Ref: figure-load-extension891918 -Ref: figure-load-new-function893403 -Ref: figure-call-new-function894405 -Node: Extension API Description896389 -Node: Extension API Functions Introduction897839 -Node: General Data Types902705 -Ref: General Data Types-Footnote-1908398 -Node: Requesting Values908697 -Ref: table-value-types-returned909434 -Node: Memory Allocation Functions910392 -Ref: Memory Allocation Functions-Footnote-1913139 -Node: Constructor Functions913235 -Node: Registration Functions914993 -Node: Extension Functions915678 -Node: Exit Callback Functions917980 -Node: Extension Version String919230 -Node: Input Parsers919880 -Node: Output Wrappers929683 -Node: Two-way processors934199 -Node: Printing Messages936403 -Ref: Printing Messages-Footnote-1937480 -Node: Updating `ERRNO'937632 -Node: Accessing Parameters938371 -Node: Symbol Table Access939601 -Node: Symbol table by name940115 -Node: Symbol table by cookie942091 -Ref: Symbol table by cookie-Footnote-1946224 -Node: Cached values946287 -Ref: Cached values-Footnote-1949792 -Node: Array Manipulation949883 -Ref: Array Manipulation-Footnote-1950981 -Node: Array Data Types951020 -Ref: Array Data Types-Footnote-1953723 -Node: Array Functions953815 -Node: Flattening Arrays957689 -Node: Creating Arrays964541 -Node: Extension API Variables969272 -Node: Extension Versioning969908 -Node: Extension API Informational Variables971809 -Node: Extension API Boilerplate972895 -Node: Finding Extensions976699 -Node: Extension Example977259 -Node: Internal File Description977989 -Node: Internal File Ops982080 -Ref: Internal File Ops-Footnote-1993626 -Node: Using Internal File Ops993766 -Ref: Using Internal File Ops-Footnote-1996113 -Node: Extension Samples996381 -Node: Extension Sample File Functions997905 -Node: Extension Sample Fnmatch1005473 -Node: Extension Sample Fork1006940 -Node: Extension Sample Inplace1008153 -Node: Extension Sample Ord1009919 -Node: Extension Sample Readdir1010755 -Ref: table-readdir-file-types1011604 -Node: Extension Sample Revout1012403 -Node: Extension Sample Rev2way1012994 -Node: Extension Sample Read write array1013735 -Node: Extension Sample Readfile1015614 -Node: Extension Sample API Tests1016714 -Node: Extension Sample Time1017239 -Node: gawkextlib1018554 -Node: Language History1021341 -Node: V7/SVR3.11022935 -Node: SVR41025255 -Node: POSIX1026697 -Node: BTL1028083 -Node: POSIX/GNU1028817 -Node: Feature History1034416 -Node: Common Extensions1047528 -Node: Ranges and Locales1048840 -Ref: Ranges and Locales-Footnote-11053457 -Ref: Ranges and Locales-Footnote-21053484 -Ref: Ranges and Locales-Footnote-31053718 -Node: Contributors1053939 -Node: Installation1059377 -Node: Gawk Distribution1060271 -Node: Getting1060755 -Node: Extracting1061581 -Node: Distribution contents1063223 -Node: Unix Installation1068940 -Node: Quick Installation1069557 -Node: Additional Configuration Options1071999 -Node: Configuration Philosophy1073737 -Node: Non-Unix Installation1076088 -Node: PC Installation1076546 -Node: PC Binary Installation1077857 -Node: PC Compiling1079705 -Ref: PC Compiling-Footnote-11082704 -Node: PC Testing1082809 -Node: PC Using1083985 -Node: Cygwin1088143 -Node: MSYS1088952 -Node: VMS Installation1089466 -Node: VMS Compilation1090262 -Ref: VMS Compilation-Footnote-11091477 -Node: VMS Dynamic Extensions1091535 -Node: VMS Installation Details1092908 -Node: VMS Running1095154 -Node: VMS GNV1097988 -Node: VMS Old Gawk1098711 -Node: Bugs1099181 -Node: Other Versions1103185 -Node: Notes1109410 -Node: Compatibility Mode1110210 -Node: Additions1110992 -Node: Accessing The Source1111917 -Node: Adding Code1113353 -Node: New Ports1119531 -Node: Derived Files1124012 -Ref: Derived Files-Footnote-11129093 -Ref: Derived Files-Footnote-21129127 -Ref: Derived Files-Footnote-31129723 -Node: Future Extensions1129837 -Node: Implementation Limitations1130443 -Node: Extension Design1131691 -Node: Old Extension Problems1132845 -Ref: Old Extension Problems-Footnote-11134362 -Node: Extension New Mechanism Goals1134419 -Ref: Extension New Mechanism Goals-Footnote-11137780 -Node: Extension Other Design Decisions1137969 -Node: Extension Future Growth1140075 -Node: Old Extension Mechanism1140911 -Node: Basic Concepts1142651 -Node: Basic High Level1143332 -Ref: figure-general-flow1143604 -Ref: figure-process-flow1144203 -Ref: Basic High Level-Footnote-11147432 -Node: Basic Data Typing1147617 -Node: Glossary1150944 -Node: Copying1176096 -Node: GNU Free Documentation License1213652 -Node: Index1238788 +Node: Array Basics449594 +Node: Array Intro450420 +Ref: figure-array-elements452393 +Node: Reference to Elements454800 +Node: Assigning Elements457073 +Node: Array Example457564 +Node: Scanning an Array459296 +Node: Controlling Scanning462311 +Ref: Controlling Scanning-Footnote-1467484 +Node: Delete467800 +Ref: Delete-Footnote-1470565 +Node: Numeric Array Subscripts470622 +Node: Uninitialized Subscripts472805 +Node: Multidimensional474430 +Node: Multiscanning477523 +Node: Arrays of Arrays479112 +Node: Arrays Summary483775 +Node: Functions485880 +Node: Built-in486753 +Node: Calling Built-in487831 +Node: Numeric Functions489819 +Ref: Numeric Functions-Footnote-1493653 +Ref: Numeric Functions-Footnote-2494010 +Ref: Numeric Functions-Footnote-3494058 +Node: String Functions494327 +Ref: String Functions-Footnote-1517338 +Ref: String Functions-Footnote-2517467 +Ref: String Functions-Footnote-3517715 +Node: Gory Details517802 +Ref: table-sub-escapes519471 +Ref: table-sub-posix-92520825 +Ref: table-sub-proposed522176 +Ref: table-posix-sub523530 +Ref: table-gensub-escapes525075 +Ref: Gory Details-Footnote-1526251 +Ref: Gory Details-Footnote-2526302 +Node: I/O Functions526453 +Ref: I/O Functions-Footnote-1533576 +Node: Time Functions533723 +Ref: Time Functions-Footnote-1544187 +Ref: Time Functions-Footnote-2544255 +Ref: Time Functions-Footnote-3544413 +Ref: Time Functions-Footnote-4544524 +Ref: Time Functions-Footnote-5544636 +Ref: Time Functions-Footnote-6544863 +Node: Bitwise Functions545129 +Ref: table-bitwise-ops545691 +Ref: Bitwise Functions-Footnote-1549936 +Node: Type Functions550120 +Node: I18N Functions551262 +Node: User-defined552907 +Node: Definition Syntax553711 +Ref: Definition Syntax-Footnote-1558636 +Node: Function Example558705 +Ref: Function Example-Footnote-1561349 +Node: Function Caveats561371 +Node: Calling A Function561889 +Node: Variable Scope562844 +Node: Pass By Value/Reference565832 +Node: Return Statement569340 +Node: Dynamic Typing572324 +Node: Indirect Calls573253 +Node: Functions Summary582966 +Node: Library Functions585505 +Ref: Library Functions-Footnote-1589080 +Ref: Library Functions-Footnote-2589223 +Node: Library Names589394 +Ref: Library Names-Footnote-1592867 +Ref: Library Names-Footnote-2593087 +Node: General Functions593173 +Node: Strtonum Function594201 +Node: Assert Function597131 +Node: Round Function600457 +Node: Cliff Random Function601998 +Node: Ordinal Functions603014 +Ref: Ordinal Functions-Footnote-1606091 +Ref: Ordinal Functions-Footnote-2606343 +Node: Join Function606554 +Ref: Join Function-Footnote-1608325 +Node: Getlocaltime Function608525 +Node: Readfile Function612261 +Node: Data File Management614100 +Node: Filetrans Function614732 +Node: Rewind Function618787 +Node: File Checking620174 +Ref: File Checking-Footnote-1621306 +Node: Empty Files621507 +Node: Ignoring Assigns623730 +Node: Getopt Function625263 +Ref: Getopt Function-Footnote-1636559 +Node: Passwd Functions636762 +Ref: Passwd Functions-Footnote-1645741 +Node: Group Functions645829 +Ref: Group Functions-Footnote-1653771 +Node: Walking Arrays653984 +Node: Library Functions Summary656154 +Node: Sample Programs657516 +Node: Running Examples658190 +Node: Clones658918 +Node: Cut Program660142 +Node: Egrep Program670003 +Ref: Egrep Program-Footnote-1677932 +Node: Id Program678042 +Node: Split Program681706 +Ref: Split Program-Footnote-1685237 +Node: Tee Program685365 +Node: Uniq Program688172 +Node: Wc Program695602 +Ref: Wc Program-Footnote-1699870 +Ref: Wc Program-Footnote-2700070 +Node: Miscellaneous Programs700162 +Node: Dupword Program701350 +Node: Alarm Program703381 +Node: Translate Program708195 +Ref: Translate Program-Footnote-1712586 +Ref: Translate Program-Footnote-2712856 +Node: Labels Program712990 +Ref: Labels Program-Footnote-1716361 +Node: Word Sorting716445 +Node: History Sorting720488 +Node: Extract Program722324 +Ref: Extract Program-Footnote-1729899 +Node: Simple Sed730028 +Node: Igawk Program733090 +Ref: Igawk Program-Footnote-1748266 +Ref: Igawk Program-Footnote-2748467 +Node: Anagram Program748605 +Node: Signature Program751673 +Node: Advanced Features752920 +Node: Nondecimal Data754806 +Node: Array Sorting756383 +Node: Controlling Array Traversal757080 +Node: Array Sorting Functions765360 +Ref: Array Sorting Functions-Footnote-1769267 +Node: Two-way I/O769461 +Ref: Two-way I/O-Footnote-1774977 +Node: TCP/IP Networking775059 +Node: Profiling777903 +Node: Internationalization785411 +Node: I18N and L10N786836 +Node: Explaining gettext787522 +Ref: Explaining gettext-Footnote-1792662 +Ref: Explaining gettext-Footnote-2792846 +Node: Programmer i18n793011 +Node: Translator i18n797236 +Node: String Extraction798030 +Ref: String Extraction-Footnote-1798991 +Node: Printf Ordering799077 +Ref: Printf Ordering-Footnote-1801859 +Node: I18N Portability801923 +Ref: I18N Portability-Footnote-1804372 +Node: I18N Example804435 +Ref: I18N Example-Footnote-1807157 +Node: Gawk I18N807229 +Node: Debugger807846 +Node: Debugging808817 +Node: Debugging Concepts809258 +Node: Debugging Terms811114 +Node: Awk Debugging813711 +Node: Sample Debugging Session814603 +Node: Debugger Invocation815123 +Node: Finding The Bug816456 +Node: List of Debugger Commands822938 +Node: Breakpoint Control824270 +Node: Debugger Execution Control827934 +Node: Viewing And Changing Data831294 +Node: Execution Stack834652 +Node: Debugger Info836165 +Node: Miscellaneous Debugger Commands840159 +Node: Readline Support845343 +Node: Limitations846235 +Node: Arbitrary Precision Arithmetic848483 +Ref: Arbitrary Precision Arithmetic-Footnote-1850132 +Node: General Arithmetic850280 +Node: Floating Point Issues852000 +Node: String Conversion Precision852881 +Ref: String Conversion Precision-Footnote-1854586 +Node: Unexpected Results854695 +Node: POSIX Floating Point Problems856848 +Ref: POSIX Floating Point Problems-Footnote-1860669 +Node: Integer Programming860707 +Node: Floating-point Programming862518 +Ref: Floating-point Programming-Footnote-1868846 +Ref: Floating-point Programming-Footnote-2869116 +Node: Floating-point Representation869380 +Node: Floating-point Context870545 +Ref: table-ieee-formats871384 +Node: Rounding Mode872768 +Ref: table-rounding-modes873247 +Ref: Rounding Mode-Footnote-1876262 +Node: Gawk and MPFR876441 +Node: Arbitrary Precision Floats877850 +Ref: Arbitrary Precision Floats-Footnote-1880293 +Node: Setting Precision880614 +Ref: table-predefined-precision-strings881298 +Node: Setting Rounding Mode883443 +Ref: table-gawk-rounding-modes883847 +Node: Floating-point Constants885034 +Node: Changing Precision886486 +Ref: Changing Precision-Footnote-1887878 +Node: Exact Arithmetic888052 +Node: Arbitrary Precision Integers891186 +Ref: Arbitrary Precision Integers-Footnote-1894201 +Node: Dynamic Extensions894348 +Node: Extension Intro895806 +Node: Plugin License897071 +Node: Extension Mechanism Outline897756 +Ref: figure-load-extension898180 +Ref: figure-load-new-function899665 +Ref: figure-call-new-function900667 +Node: Extension API Description902651 +Node: Extension API Functions Introduction904101 +Node: General Data Types908967 +Ref: General Data Types-Footnote-1914660 +Node: Requesting Values914959 +Ref: table-value-types-returned915696 +Node: Memory Allocation Functions916654 +Ref: Memory Allocation Functions-Footnote-1919401 +Node: Constructor Functions919497 +Node: Registration Functions921255 +Node: Extension Functions921940 +Node: Exit Callback Functions924242 +Node: Extension Version String925492 +Node: Input Parsers926142 +Node: Output Wrappers935945 +Node: Two-way processors940461 +Node: Printing Messages942665 +Ref: Printing Messages-Footnote-1943742 +Node: Updating `ERRNO'943894 +Node: Accessing Parameters944633 +Node: Symbol Table Access945863 +Node: Symbol table by name946377 +Node: Symbol table by cookie948353 +Ref: Symbol table by cookie-Footnote-1952486 +Node: Cached values952549 +Ref: Cached values-Footnote-1956054 +Node: Array Manipulation956145 +Ref: Array Manipulation-Footnote-1957243 +Node: Array Data Types957282 +Ref: Array Data Types-Footnote-1959985 +Node: Array Functions960077 +Node: Flattening Arrays963951 +Node: Creating Arrays970803 +Node: Extension API Variables975534 +Node: Extension Versioning976170 +Node: Extension API Informational Variables978071 +Node: Extension API Boilerplate979157 +Node: Finding Extensions982961 +Node: Extension Example983521 +Node: Internal File Description984251 +Node: Internal File Ops988342 +Ref: Internal File Ops-Footnote-1999888 +Node: Using Internal File Ops1000028 +Ref: Using Internal File Ops-Footnote-11002375 +Node: Extension Samples1002643 +Node: Extension Sample File Functions1004167 +Node: Extension Sample Fnmatch1011735 +Node: Extension Sample Fork1013202 +Node: Extension Sample Inplace1014415 +Node: Extension Sample Ord1016181 +Node: Extension Sample Readdir1017017 +Ref: table-readdir-file-types1017866 +Node: Extension Sample Revout1018665 +Node: Extension Sample Rev2way1019256 +Node: Extension Sample Read write array1019997 +Node: Extension Sample Readfile1021876 +Node: Extension Sample API Tests1022976 +Node: Extension Sample Time1023501 +Node: gawkextlib1024816 +Node: Language History1027603 +Node: V7/SVR3.11029197 +Node: SVR41031517 +Node: POSIX1032959 +Node: BTL1034345 +Node: POSIX/GNU1035079 +Node: Feature History1040678 +Node: Common Extensions1053790 +Node: Ranges and Locales1055102 +Ref: Ranges and Locales-Footnote-11059719 +Ref: Ranges and Locales-Footnote-21059746 +Ref: Ranges and Locales-Footnote-31059980 +Node: Contributors1060201 +Node: Installation1065639 +Node: Gawk Distribution1066533 +Node: Getting1067017 +Node: Extracting1067843 +Node: Distribution contents1069485 +Node: Unix Installation1075202 +Node: Quick Installation1075819 +Node: Additional Configuration Options1078261 +Node: Configuration Philosophy1079999 +Node: Non-Unix Installation1082350 +Node: PC Installation1082808 +Node: PC Binary Installation1084119 +Node: PC Compiling1085967 +Ref: PC Compiling-Footnote-11088966 +Node: PC Testing1089071 +Node: PC Using1090247 +Node: Cygwin1094405 +Node: MSYS1095214 +Node: VMS Installation1095728 +Node: VMS Compilation1096524 +Ref: VMS Compilation-Footnote-11097739 +Node: VMS Dynamic Extensions1097797 +Node: VMS Installation Details1099170 +Node: VMS Running1101416 +Node: VMS GNV1104250 +Node: VMS Old Gawk1104973 +Node: Bugs1105443 +Node: Other Versions1109447 +Node: Notes1115672 +Node: Compatibility Mode1116472 +Node: Additions1117254 +Node: Accessing The Source1118179 +Node: Adding Code1119615 +Node: New Ports1125793 +Node: Derived Files1130274 +Ref: Derived Files-Footnote-11135355 +Ref: Derived Files-Footnote-21135389 +Ref: Derived Files-Footnote-31135985 +Node: Future Extensions1136099 +Node: Implementation Limitations1136705 +Node: Extension Design1137953 +Node: Old Extension Problems1139107 +Ref: Old Extension Problems-Footnote-11140624 +Node: Extension New Mechanism Goals1140681 +Ref: Extension New Mechanism Goals-Footnote-11144042 +Node: Extension Other Design Decisions1144231 +Node: Extension Future Growth1146337 +Node: Old Extension Mechanism1147173 +Node: Basic Concepts1148913 +Node: Basic High Level1149594 +Ref: figure-general-flow1149866 +Ref: figure-process-flow1150465 +Ref: Basic High Level-Footnote-11153694 +Node: Basic Data Typing1153879 +Node: Glossary1157206 +Node: Copying1182358 +Node: GNU Free Documentation License1219914 +Node: Index1245050 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index badfe5ac..c4e17b2b 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -15023,6 +15023,7 @@ same @command{awk} program. * Multidimensional:: Emulating multidimensional arrays in @command{awk}. * Arrays of Arrays:: True multidimensional arrays. +* Arrays Summary:: Summary of arrays. @end menu @node Array Basics @@ -16305,6 +16306,64 @@ creating an arbitrary index: $ @kbd{gawk 'BEGIN @{ b[1][1] = ""; split("a b c d", b[1]); print b[1][1] @}'} @print{} a @end example + +@node Arrays Summary +@section Summary + +@itemize @value{BULLET} +@item +Standard @command{awk} provides one-dimensional associative arrays (arrays +indexed by string values). All arrays are associative; numeric indices +are converted automatically to strings. + +@item +Array elements are referenced as @code{@var{array}[@var{indx}]}. +Referencing an element creates it if it did not exist previously. + +@item +The proper way to see if an array has an element with a given index +is to use the @code{in} operator: @samp{@var{indx} in @var{array}}. + +@item +Use @samp{for (@var{indx} in @var{array}) @dots{}} to scan through all the +individual elements of an array. In the body of the loop, @var{indx} takes +on the value of each element's index in turn. + +@item +The order in which a +@samp{for (@var{indx} in @var{array})} loop traverses an array is +undefined in POSIX @command{awk} and varies among implementations. +@command{gawk} lets you control the order by assigning special predefined +values to @code{PROCINFO["sorted_in"]}. + +@item +Use @samp{delete @var{array}[@var{indx}]} to delete an +individual element. You may also use @samp{delete @var{array}} +to delete all of the elements in the array. This latter feature +has been a common extension for many years and is now standard, but +may not be supported by all commercial versions of @command{awk}. + +@item +Standard @command{awk} simulates multidimensional arrays by separating +subscript values with a comma. The values are concatenated into a +single string, separated by the value of @code{SUBSEP}. The fact that +such a subscript was created in this way is not retained; thus changing +@code{SUBSEP} may have unexpected consequences. +You can use @samp{(@var{sub1}, @var{sub2}, @dots{}) in @var{array}} +to see if such a multidimensional subscript exists in @var{array}. + +@item +@command{gawk} provides true arrays of arrays. You use a separate +set of square brackets for each dimension in such an array: +@code{data[row][col]}, for example. Array elements may thus be either +scalar values (number or string) or another array. + +@item +Use the @code{isarray()} built-in function to determine if an +array element is itself a subarray. + +@end itemize + @c ENDOFRANGE arrs @node Functions @@ -16329,6 +16388,7 @@ The second half of this @value{CHAPTER} describes these * Built-in:: Summarizes the built-in functions. * User-defined:: Describes User-defined functions in detail. * Indirect Calls:: Choosing the function to call at runtime. +* Functions Summary:: Summary of functions. @end menu @node Built-in @@ -19887,6 +19947,68 @@ for (i = 1; i <= n; i++) @noindent @code{gawk} will look up the actual function to call only once. +@node Functions Summary +@section Summary + +@itemize @value{BULLET} +@item +@command{awk} provides built-in functions and lets you define your own +functions. + +@item +POSIX @command{awk} provides three kinds of built-in functions: numeric, string, +and I/O. @command{gawk} provides functions that work with values +representing time, do bit manipulation, sort arrays, and internationalize +and localize programs. +@command{gawk} also provides several extensions to some of standard functions, +typically in the form of additional arguments. + +@item +Functions accept zero or more arguments and return a value. +The expressions that provide the argument values are comnpletely evaluated +before the function is called. Order of evaluation is not defined. +The return value can be ignored. + +@item +The handling of backslash in @code{sub()} and @code{gsub()} is +not simple. It is more straightforward in @command{gawk}'s @code{gensub()} +function, but that function still requires care in its use. + +@item +User-defined functions provide important capabilities but come with some +syntactic inelegancies. In a function call, there cannot be any space +between the function name and the opening left parethesis of the argument +list. Also, there is no provision for local variables, so the convention +is to add extra parameters, and to separate them visually from the real +parameters by extra whitespace. + +@item +User-defined functions may call other user-defined (and built-in) functions +and may call themselves recursively. Function parameters ``hide'' any global +variables of the same names. + +@item +Scalar values are passed to user-defined functions by value. Array parameters +are passed by reference; any changes made by the function to array parameters +are thus visible after the function has returned. + +@item +Use the @code{return} statement to return from a user-defined function. +An optional expression becomes the function's return value. +Only scalar values may be returned by a function. + +@item +If a variable that has never been used is passed to a user-defined function, +how that function treats the variable can set its nature: either scalar or array. + +@item +@command{gawk} provides indirect function calls using a special syntax. +By setting a variable to the name of a user-defined function, you can +determine at runtime what function will be called at that point in the +program. This is equivalent to function pointers in C and C++. + +@end itemize + @c ENDOFRANGE funcud @ifnotinfo @@ -20012,6 +20134,7 @@ comparisons use only lowercase letters. * Passwd Functions:: Functions for getting user information. * Group Functions:: Functions for getting group information. * Walking Arrays:: A function to walk arrays of arrays. +* Library Functions Summary:: Summary of library functions. @end menu @node Library Names @@ -21215,7 +21338,7 @@ END @{ @end ignore @node Ignoring Assigns -@subsection Treating Assignments as @value{FFN} +@subsection Treating Assignments as @value{FFN}s @cindex assignments as filenames @cindex filenames, assignments as @@ -22422,6 +22545,7 @@ $ @kbd{gawk -f walk_array.awk} @print{} a[3] = 3 @end example +@c exercise! Walking an array and processing each element is a general-purpose operation. You might want to consider generalizing the @code{walk_array()} function by adding an additional parameter named @code{process}. @@ -22440,6 +22564,50 @@ the element. @c ENDOFRANGE flibgdata @c ENDOFRANGE gdatar @c ENDOFRANGE libf + +@node Library Functions Summary +@section Summary + +@itemize @value{BULLET} +@item +Reading programs is an excellent way to learn Good Programming. +The functions provided in this @value{CHAPTER} and the next are intended +to serve that purpose. + +@item +When writing general-purpose library functions, put some thought into +how to name any global variables so that they won't conflict with +variables from a user's program. + +@item +The functions presented here fit into the following categories: + +@c nested list +@table @asis +@item General problems +Number to string conversion, assertions, rounding, random number generation, +converting characters to numbers, joining strings, getting easily usable +time-of-day information, and reading a whole file in one shot. + +@item Managing @value{DF}s +Noting @value{DF} boundaries, rereading the current file, checking for +readable files, checking for zero-length files, and treating assignments +as @value{FN}s. + +@item Processing command-line options +An @command{awk} version of the standard C @code{getopt()} function. + +@item Reading the user and group databases +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. +@end table +@c end nested list + +@end itemize + + @c ENDOFRANGE flib @c ENDOFRANGE fudlib @c ENDOFRANGE datagr @@ -27924,7 +28092,8 @@ complete detail in @cite{GNU gettext tools}}.) @end ifnotinfo As of this writing, the latest version of GNU @command{gettext} is -@uref{ftp://ftp.gnu.org/gnu/gettext/gettext-0.19.tar.gz, @value{PVERSION} 0.19}. +@uref{ftp://ftp.gnu.org/gnu/gettext/gettext-0.19.1.tar.gz, +@value{PVERSION} 0.19.1}. If a translation of @command{gawk}'s messages exists, then @command{gawk} produces usage messages, warnings, diff --git a/doc/gawktexi.in b/doc/gawktexi.in index b6c3c3b7..e2d10da9 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -14357,6 +14357,7 @@ same @command{awk} program. * Multidimensional:: Emulating multidimensional arrays in @command{awk}. * Arrays of Arrays:: True multidimensional arrays. +* Arrays Summary:: Summary of arrays. @end menu @node Array Basics @@ -15639,6 +15640,64 @@ creating an arbitrary index: $ @kbd{gawk 'BEGIN @{ b[1][1] = ""; split("a b c d", b[1]); print b[1][1] @}'} @print{} a @end example + +@node Arrays Summary +@section Summary + +@itemize @value{BULLET} +@item +Standard @command{awk} provides one-dimensional associative arrays (arrays +indexed by string values). All arrays are associative; numeric indices +are converted automatically to strings. + +@item +Array elements are referenced as @code{@var{array}[@var{indx}]}. +Referencing an element creates it if it did not exist previously. + +@item +The proper way to see if an array has an element with a given index +is to use the @code{in} operator: @samp{@var{indx} in @var{array}}. + +@item +Use @samp{for (@var{indx} in @var{array}) @dots{}} to scan through all the +individual elements of an array. In the body of the loop, @var{indx} takes +on the value of each element's index in turn. + +@item +The order in which a +@samp{for (@var{indx} in @var{array})} loop traverses an array is +undefined in POSIX @command{awk} and varies among implementations. +@command{gawk} lets you control the order by assigning special predefined +values to @code{PROCINFO["sorted_in"]}. + +@item +Use @samp{delete @var{array}[@var{indx}]} to delete an +individual element. You may also use @samp{delete @var{array}} +to delete all of the elements in the array. This latter feature +has been a common extension for many years and is now standard, but +may not be supported by all commercial versions of @command{awk}. + +@item +Standard @command{awk} simulates multidimensional arrays by separating +subscript values with a comma. The values are concatenated into a +single string, separated by the value of @code{SUBSEP}. The fact that +such a subscript was created in this way is not retained; thus changing +@code{SUBSEP} may have unexpected consequences. +You can use @samp{(@var{sub1}, @var{sub2}, @dots{}) in @var{array}} +to see if such a multidimensional subscript exists in @var{array}. + +@item +@command{gawk} provides true arrays of arrays. You use a separate +set of square brackets for each dimension in such an array: +@code{data[row][col]}, for example. Array elements may thus be either +scalar values (number or string) or another array. + +@item +Use the @code{isarray()} built-in function to determine if an +array element is itself a subarray. + +@end itemize + @c ENDOFRANGE arrs @node Functions @@ -15663,6 +15722,7 @@ The second half of this @value{CHAPTER} describes these * Built-in:: Summarizes the built-in functions. * User-defined:: Describes User-defined functions in detail. * Indirect Calls:: Choosing the function to call at runtime. +* Functions Summary:: Summary of functions. @end menu @node Built-in @@ -19060,6 +19120,68 @@ for (i = 1; i <= n; i++) @noindent @code{gawk} will look up the actual function to call only once. +@node Functions Summary +@section Summary + +@itemize @value{BULLET} +@item +@command{awk} provides built-in functions and lets you define your own +functions. + +@item +POSIX @command{awk} provides three kinds of built-in functions: numeric, string, +and I/O. @command{gawk} provides functions that work with values +representing time, do bit manipulation, sort arrays, and internationalize +and localize programs. +@command{gawk} also provides several extensions to some of standard functions, +typically in the form of additional arguments. + +@item +Functions accept zero or more arguments and return a value. +The expressions that provide the argument values are comnpletely evaluated +before the function is called. Order of evaluation is not defined. +The return value can be ignored. + +@item +The handling of backslash in @code{sub()} and @code{gsub()} is +not simple. It is more straightforward in @command{gawk}'s @code{gensub()} +function, but that function still requires care in its use. + +@item +User-defined functions provide important capabilities but come with some +syntactic inelegancies. In a function call, there cannot be any space +between the function name and the opening left parethesis of the argument +list. Also, there is no provision for local variables, so the convention +is to add extra parameters, and to separate them visually from the real +parameters by extra whitespace. + +@item +User-defined functions may call other user-defined (and built-in) functions +and may call themselves recursively. Function parameters ``hide'' any global +variables of the same names. + +@item +Scalar values are passed to user-defined functions by value. Array parameters +are passed by reference; any changes made by the function to array parameters +are thus visible after the function has returned. + +@item +Use the @code{return} statement to return from a user-defined function. +An optional expression becomes the function's return value. +Only scalar values may be returned by a function. + +@item +If a variable that has never been used is passed to a user-defined function, +how that function treats the variable can set its nature: either scalar or array. + +@item +@command{gawk} provides indirect function calls using a special syntax. +By setting a variable to the name of a user-defined function, you can +determine at runtime what function will be called at that point in the +program. This is equivalent to function pointers in C and C++. + +@end itemize + @c ENDOFRANGE funcud @ifnotinfo @@ -19185,6 +19307,7 @@ comparisons use only lowercase letters. * Passwd Functions:: Functions for getting user information. * Group Functions:: Functions for getting group information. * Walking Arrays:: A function to walk arrays of arrays. +* Library Functions Summary:: Summary of library functions. @end menu @node Library Names @@ -20359,7 +20482,7 @@ END @{ @end ignore @node Ignoring Assigns -@subsection Treating Assignments as @value{FFN} +@subsection Treating Assignments as @value{FFN}s @cindex assignments as filenames @cindex filenames, assignments as @@ -21566,6 +21689,7 @@ $ @kbd{gawk -f walk_array.awk} @print{} a[3] = 3 @end example +@c exercise! Walking an array and processing each element is a general-purpose operation. You might want to consider generalizing the @code{walk_array()} function by adding an additional parameter named @code{process}. @@ -21584,6 +21708,50 @@ the element. @c ENDOFRANGE flibgdata @c ENDOFRANGE gdatar @c ENDOFRANGE libf + +@node Library Functions Summary +@section Summary + +@itemize @value{BULLET} +@item +Reading programs is an excellent way to learn Good Programming. +The functions provided in this @value{CHAPTER} and the next are intended +to serve that purpose. + +@item +When writing general-purpose library functions, put some thought into +how to name any global variables so that they won't conflict with +variables from a user's program. + +@item +The functions presented here fit into the following categories: + +@c nested list +@table @asis +@item General problems +Number to string conversion, assertions, rounding, random number generation, +converting characters to numbers, joining strings, getting easily usable +time-of-day information, and reading a whole file in one shot. + +@item Managing @value{DF}s +Noting @value{DF} boundaries, rereading the current file, checking for +readable files, checking for zero-length files, and treating assignments +as @value{FN}s. + +@item Processing command-line options +An @command{awk} version of the standard C @code{getopt()} function. + +@item Reading the user and group databases +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. +@end table +@c end nested list + +@end itemize + + @c ENDOFRANGE flib @c ENDOFRANGE fudlib @c ENDOFRANGE datagr @@ -27068,7 +27236,8 @@ complete detail in @cite{GNU gettext tools}}.) @end ifnotinfo As of this writing, the latest version of GNU @command{gettext} is -@uref{ftp://ftp.gnu.org/gnu/gettext/gettext-0.19.tar.gz, @value{PVERSION} 0.19}. +@uref{ftp://ftp.gnu.org/gnu/gettext/gettext-0.19.1.tar.gz, +@value{PVERSION} 0.19.1}. If a translation of @command{gawk}'s messages exists, then @command{gawk} produces usage messages, warnings, |