From efbd4b724d239fa3c2d2929dc50e4bb4703489b9 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 8 Feb 2015 08:58:37 +0200 Subject: More edits. Through Chapter 14. --- doc/ChangeLog | 4 + doc/gawk.info | 599 ++++++++++++++++++++++++++++---------------------------- doc/gawk.texi | 146 +++++++------- doc/gawktexi.in | 146 +++++++------- 4 files changed, 445 insertions(+), 450 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 9fc7bdca..319ecb2f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2015-02-08 Arnold D. Robbins + + * gawktexi.in: O'Reilly fixes. + 2015-02-06 Arnold D. Robbins * gawktexi.in: O'Reilly fixes. diff --git a/doc/gawk.info b/doc/gawk.info index 9381b503..5bfdd436 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -20043,7 +20043,7 @@ File: gawk.info, Node: I18N and L10N, Next: Explaining gettext, Up: Internati "Internationalization" means writing (or modifying) a program once, in such a way that it can use multiple languages without requiring further -source-code changes. "Localization" means providing the data necessary +source code changes. "Localization" means providing the data necessary for an internationalized program to work in a particular language. Most typically, these terms refer to features such as the language used for printing error messages, the language used to read responses, and @@ -20057,7 +20057,7 @@ File: gawk.info, Node: Explaining gettext, Next: Programmer i18n, Prev: I18N ================== `gawk' uses GNU `gettext' to provide its internationalization features. -The facilities in GNU `gettext' focus on messages; strings printed by a +The facilities in GNU `gettext' focus on messages: strings printed by a program, either directly or via formatting with `printf' or `sprintf()'.(1) @@ -20186,8 +20186,7 @@ File: gawk.info, Node: Programmer i18n, Next: Translator i18n, Prev: Explaini 13.3 Internationalizing `awk' Programs ====================================== -`gawk' provides the following variables and functions for -internationalization: +`gawk' provides the following variables for internationalization: `TEXTDOMAIN' This variable indicates the application's text domain. For @@ -20199,6 +20198,8 @@ internationalization: for translation at runtime. String constants without a leading underscore are not translated. + `gawk' provides the following functions for internationalization: + ``dcgettext(STRING' [`,' DOMAIN [`,' CATEGORY]]`)'' Return the translation of STRING in text domain DOMAIN for locale category CATEGORY. The default value for DOMAIN is the current @@ -20237,8 +20238,7 @@ internationalization: the null string (`""'), then `bindtextdomain()' returns the current binding for the given DOMAIN. - To use these facilities in your `awk' program, follow the steps -outlined in *note Explaining gettext::, like so: + To use these facilities in your `awk' program, follow these steps: 1. Set the variable `TEXTDOMAIN' to the text domain of your program. This is best done in a `BEGIN' rule (*note BEGIN/END::), or it can @@ -20460,7 +20460,7 @@ actually almost portable, requiring very little change: its value, leaving the original string constant as the result. * By defining "dummy" functions to replace `dcgettext()', - `dcngettext()' and `bindtextdomain()', the `awk' program can be + `dcngettext()', and `bindtextdomain()', the `awk' program can be made to run, but all the messages are output in the original language. For example: @@ -20595,8 +20595,8 @@ File: gawk.info, Node: Gawk I18N, Next: I18N Summary, Prev: I18N Example, Up `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.4 +`gettext' utilities)Top:: gettext, GNU `gettext' utilities.) As of +this writing, the latest version of GNU `gettext' is version 0.19.4 (ftp://ftp.gnu.org/gnu/gettext/gettext-0.19.4.tar.gz). If a translation of `gawk''s messages exists, then `gawk' produces @@ -20609,7 +20609,7 @@ File: gawk.info, Node: I18N Summary, Prev: Gawk I18N, Up: Internationalizatio ============ * Internationalization means writing a program such that it can use - multiple languages without requiring source-code changes. + multiple languages without requiring source code changes. Localization means providing the data necessary for an internationalized program to work in a particular language. @@ -20623,10 +20623,10 @@ File: gawk.info, Node: I18N Summary, Prev: Gawk I18N, Up: Internationalizatio file, and the `.po' files are compiled into `.gmo' files for use at runtime. - * You can use position specifications with `sprintf()' and `printf' - to rearrange the placement of argument values in formatted strings - and output. This is useful for the translations of format control - strings. + * You can use positional specifications with `sprintf()' and + `printf' to rearrange the placement of argument values in formatted + strings and output. This is useful for the translation of format + control strings. * The internationalization features have been designed so that they can be easily worked around in a standard `awk'. @@ -20682,8 +20682,7 @@ File: gawk.info, Node: Debugging Concepts, Next: Debugging Terms, Up: Debuggi --------------------------- (If you have used debuggers in other languages, you may want to skip -ahead to the next section on the specific features of the `gawk' -debugger.) +ahead to *note Awk Debugging::.) Of course, a debugging program cannot remove bugs for you, because it has no way of knowing what you or your users consider a "bug" versus @@ -20770,11 +20769,11 @@ defines terms used throughout the rest of this major node:  File: gawk.info, Node: Awk Debugging, Prev: Debugging Terms, Up: Debugging -14.1.3 Awk Debugging --------------------- +14.1.3 `awk' Debugging +---------------------- Debugging an `awk' program has some specific aspects that are not -shared with other programming languages. +shared with programs written in other languages. First of all, the fact that `awk' programs usually take input line by line from a file or files and operate on those lines using specific @@ -20792,8 +20791,8 @@ commands.  File: gawk.info, Node: Sample Debugging Session, Next: List of Debugger Commands, Prev: Debugging, Up: Debugger -14.2 Sample Debugging Session -============================= +14.2 Sample `gawk' Debugging Session +==================================== In order to illustrate the use of `gawk' as a debugger, let's look at a sample debugging session. We will use the `awk' implementation of the @@ -20812,8 +20811,8 @@ File: gawk.info, Node: Debugger Invocation, Next: Finding The Bug, Up: Sample -------------------------------- Starting the debugger is almost exactly like running `gawk' normally, -except you have to pass an additional option `--debug', or the -corresponding short option `-D'. The file(s) containing the program +except you have to pass an additional option, `--debug', or the +corresponding short option, `-D'. The file(s) containing the program and any supporting code are given on the command line as arguments to one or more `-f' options. (`gawk' is not designed to debug command-line programs, only programs contained in files.) In our case, we invoke @@ -20823,7 +20822,7 @@ the debugger like this: where both `getopt.awk' and `uniq.awk' are in `$AWKPATH'. (Experienced users of GDB or similar debuggers should note that this syntax is -slightly different from what they are used to. With the `gawk' +slightly different from what you are used to. With the `gawk' debugger, you give the arguments for running the program in the command line to the debugger rather than as part of the `run' command at the debugger prompt.) The `-1' is an option to `uniq.awk'. @@ -20947,10 +20946,10 @@ typing `n' (for "next"): -| 66 if (fcount > 0) { This tells us that `gawk' is now ready to execute line 66, which -decides whether to give the lines the special "field skipping" treatment +decides whether to give the lines the special "field-skipping" treatment indicated by the `-1' command-line option. (Notice that we skipped -from where we were before at line 63 to here, because the condition in -line 63 `if (fcount == 0 && charcount == 0)' was false.) +from where we were before, at line 63, to here, because the condition +in line 63, `if (fcount == 0 && charcount == 0)', was false.) Continuing to step, we now get to the splitting of the current and last records: @@ -21008,15 +21007,15 @@ mentioned): Well, here we are at our error (sorry to spoil the suspense). What we had in mind was to join the fields starting from the second one to -make the virtual record to compare, and if the first field was numbered -zero, this would work. Let's look at what we've got: +make the virtual record to compare, and if the first field were +numbered zero, this would work. Let's look at what we've got: gawk> p cline clast -| cline = "gawk is a wonderful program!" -| clast = "awk is a wonderful program!" Hey, those look pretty familiar! They're just our original, -unaltered, input records. A little thinking (the human brain is still +unaltered input records. A little thinking (the human brain is still the best debugging tool), and we realize that we were off by one! We get out of the debugger: @@ -21053,11 +21052,11 @@ categories: * Miscellaneous Each of these are discussed in the following subsections. In the -following descriptions, commands which may be abbreviated show the +following descriptions, commands that may be abbreviated show the abbreviation on a second description line. A debugger command name may also be truncated if that partial name is unambiguous. The debugger has the built-in capability to automatically repeat the previous command -just by hitting . This works for the commands `list', `next', +just by hitting `Enter'. This works for the commands `list', `next', `nexti', `step', `stepi', and `continue' executed without any argument. * Menu: @@ -21097,8 +21096,8 @@ The commands for controlling breakpoints are: Set a breakpoint at entry to (the first instruction of) function FUNCTION. - Each breakpoint is assigned a number which can be used to delete - it from the breakpoint list using the `delete' command. + Each breakpoint is assigned a number that can be used to delete it + from the breakpoint list using the `delete' command. With a breakpoint, you may also supply a condition. This is an `awk' expression (enclosed in double quotes) that the debugger @@ -21136,26 +21135,26 @@ The commands for controlling breakpoints are: `delete' [N1 N2 ...] [N-M] `d' [N1 N2 ...] [N-M] - Delete specified breakpoints or a range of breakpoints. Deletes - all defined breakpoints if no argument is supplied. + Delete specified breakpoints or a range of breakpoints. Delete all + defined breakpoints if no argument is supplied. `disable' [N1 N2 ... | N-M] Disable specified breakpoints or a range of breakpoints. Without - any argument, disables all breakpoints. + any argument, disable all breakpoints. `enable' [`del' | `once'] [N1 N2 ...] [N-M] `e' [`del' | `once'] [N1 N2 ...] [N-M] Enable specified breakpoints or a range of breakpoints. Without - any argument, enables all breakpoints. Optionally, you can - specify how to enable the breakpoint: + any argument, enable all breakpoints. Optionally, you can specify + how to enable the breakpoints: `del' - Enable the breakpoint(s) temporarily, then delete it when the - program stops at the breakpoint. + Enable the breakpoints temporarily, then delete each one when + the program stops at it. `once' - Enable the breakpoint(s) temporarily, then disable it when - the program stops at the breakpoint. + Enable the breakpoints temporarily, then disable each one when + the program stops at it. `ignore' N COUNT Ignore breakpoint number N the next COUNT times it is hit. @@ -21201,7 +21200,7 @@ execution of the program than we saw in our earlier example: `continue' [COUNT] `c' [COUNT] Resume program execution. If continued from a breakpoint and COUNT - is specified, ignores the breakpoint at that location the next + is specified, ignore the breakpoint at that location the next COUNT times before stopping. `finish' @@ -21236,10 +21235,10 @@ execution of the program than we saw in our earlier example: `step' [COUNT] `s' [COUNT] Continue execution until control reaches a different source line - in the current stack frame. `step' steps inside any function - called within the line. If the argument COUNT is supplied, steps - that many times before stopping, unless it encounters a breakpoint - or watchpoint. + in the current stack frame, stepping inside any function called + within the line. If the argument COUNT is supplied, steps that + many times before stopping, unless it encounters a breakpoint or + watchpoint. `stepi' [COUNT] `si' [COUNT] @@ -21320,13 +21319,13 @@ AWK STATEMENTS (`"'...`"'). You can also set special `awk' variables, such as `FS', `NF', - `NR', and son on. + `NR', and so on. `watch' VAR | `$'N [`"EXPRESSION"'] `w' VAR | `$'N [`"EXPRESSION"'] Add variable VAR (or field `$N') to the watch list. The debugger then stops whenever the value of the variable or field changes. - Each watched item is assigned a number which can be used to delete + Each watched item is assigned a number that can be used to delete it from the watch list using the `unwatch' command. With a watchpoint, you may also supply a condition. This is an @@ -21350,11 +21349,11 @@ File: gawk.info, Node: Execution Stack, Next: Debugger Info, Prev: Viewing An 14.3.4 Working with the Stack ----------------------------- -Whenever you run a program which contains any function calls, `gawk' +Whenever you run a program that contains any function calls, `gawk' maintains a stack of all of the function calls leading up to where the program is right now. You can see how you got to where you are, and also move around in the stack to see what the state of things was in the -functions which called the one you are in. The commands for doing this +functions that called the one you are in. The commands for doing this are: `backtrace' [COUNT] @@ -21374,8 +21373,8 @@ are: `frame' [N] `f' [N] Select and print stack frame N. Frame 0 is the currently - executing, or "innermost", frame (function call), frame 1 is the - frame that called the innermost one. The highest numbered frame is + executing, or "innermost", frame (function call); frame 1 is the + frame that called the innermost one. The highest-numbered frame is the one for the main program. The printed information consists of the frame number, function and argument names, source file, and the source line. @@ -21392,7 +21391,7 @@ File: gawk.info, Node: Debugger Info, Next: Miscellaneous Debugger Commands, Besides looking at the values of variables, there is often a need to get other sorts of information about the state of your program and of the -debugging environment itself. The `gawk' debugger has one command which +debugging environment itself. The `gawk' debugger has one command that provides this information, appropriately called `info'. `info' is used with one of a number of arguments that tell it exactly what you want to know: @@ -21449,11 +21448,12 @@ from a file. The commands are: option. The available options are: `history_size' - The maximum number of lines to keep in the history file + Set the maximum number of lines to keep in the history file `./.gawk_history'. The default is 100. `listsize' - The number of lines that `list' prints. The default is 15. + Specify the number of lines that `list' prints. The default + is 15. `outfile' Send `gawk' output to a file; debugger output still goes to @@ -21461,7 +21461,7 @@ from a file. The commands are: standard output. `prompt' - The debugger prompt. The default is `gawk> '. + Change the debugger prompt. The default is `gawk> '. `save_history' [`on' | `off'] Save command history to file `./.gawk_history'. The default @@ -21469,8 +21469,8 @@ from a file. The commands are: `save_options' [`on' | `off'] Save current options to file `./.gawkrc' upon exit. The - default is `on'. Options are read back in to the next - session upon startup. + default is `on'. Options are read back into the next session + upon startup. `trace' [`on' | `off'] Turn instruction tracing on or off. The default is `off'. @@ -21489,7 +21489,7 @@ from a file. The commands are: commands; however, the `gawk' debugger will not source the same file more than once in order to avoid infinite recursion. - In addition to, or instead of the `source' command, you can use + In addition to, or instead of, the `source' command, you can use the `-D FILE' or `--debug=FILE' command-line options to execute commands from a file non-interactively (*note Options::). @@ -21499,13 +21499,13 @@ File: gawk.info, Node: Miscellaneous Debugger Commands, Prev: Debugger Info, 14.3.6 Miscellaneous Commands ----------------------------- -There are a few more commands which do not fit into the previous +There are a few more commands that do not fit into the previous categories, as follows: `dump' [FILENAME] - Dump bytecode of the program to standard output or to the file + Dump byte code of the program to standard output or to the file named in FILENAME. This prints a representation of the internal - instructions which `gawk' executes to implement the `awk' commands + instructions that `gawk' executes to implement the `awk' commands in a program. This can be very enlightening, as the following partial dump of Davide Brini's obfuscated code (*note Signature Program::) demonstrates: @@ -21589,22 +21589,21 @@ categories, as follows: FILENAME. This command may change the current source file. FUNCTION - Print lines centered around beginning of the function + Print lines centered around the beginning of the function FUNCTION. This command may change the current source file. `quit' `q' Exit the debugger. Debugging is great fun, but sometimes we all have to tend to other obligations in life, and sometimes we find - the bug, and are free to go on to the next one! As we saw - earlier, if you are running a program, the debugger warns you if - you accidentally type `q' or `quit', to make sure you really want - to quit. + the bug and are free to go on to the next one! As we saw earlier, + if you are running a program, the debugger warns you when you type + `q' or `quit', to make sure you really want to quit. `trace' [`on' | `off'] - Turn on or off a continuous printing of instructions which are - about to be executed, along with printing the `awk' line which they - implement. The default is `off'. + Turn on or off continuous printing of the instructions that are + about to be executed, along with the `awk' lines they implement. + The default is `off'. It is to be hoped that most of the "opcodes" in these instructions are fairly self-explanatory, and using `stepi' and `nexti' while @@ -21617,7 +21616,7 @@ File: gawk.info, Node: Readline Support, Next: Limitations, Prev: List of Deb 14.4 Readline Support ===================== -If `gawk' is compiled with the `readline' library +If `gawk' is compiled with the GNU Readline library (http://cnswww.cns.cwru.edu/php/chet/readline/readline.html), you can take advantage of that library's command completion and history expansion features. The following types of completion are available: @@ -21647,7 +21646,7 @@ File: gawk.info, Node: Limitations, Next: Debugging Summary, Prev: Readline S We hope you find the `gawk' debugger useful and enjoyable to work with, but as with any program, especially in its early releases, it still has -some limitations. A few which are worth being aware of are: +some limitations. A few that it's worth being aware of are: * At this point, the debugger does not give a detailed explanation of what you did wrong when you type in something it doesn't like. @@ -21658,13 +21657,13 @@ some limitations. A few which are worth being aware of are: Commands:: (or if you are already familiar with `gawk' internals), you will realize that much of the internal manipulation of data in `gawk', as in many interpreters, is done on a stack. `Op_push', - `Op_pop', and the like, are the "bread and butter" of most `gawk' + `Op_pop', and the like are the "bread and butter" of most `gawk' code. Unfortunately, as of now, the `gawk' debugger does not allow you to examine the stack's contents. That is, the intermediate results of expression evaluation are on the stack, but cannot be - printed. Rather, only variables which are defined in the program + printed. Rather, only variables that are defined in the program can be printed. Of course, a workaround for this is to use more explicit variables at the debugging stage and then change back to obscure, perhaps more optimal code later. @@ -21676,12 +21675,12 @@ some limitations. A few which are worth being aware of are: * The `gawk' debugger is designed to be used by running a program (with all its parameters) on the command line, as described in *note Debugger Invocation::. There is no way (as of now) to - attach or "break in" to a running program. This seems reasonable - for a language which is used mainly for quickly executing, short + attach or "break into" a running program. This seems reasonable + for a language that is used mainly for quickly executing, short programs. - * The `gawk' debugger only accepts source supplied with the `-f' - option. + * The `gawk' debugger only accepts source code supplied with the + `-f' option.  File: gawk.info, Node: Debugging Summary, Prev: Limitations, Up: Debugger @@ -21690,8 +21689,8 @@ File: gawk.info, Node: Debugging Summary, Prev: Limitations, Up: Debugger ============ * Programs rarely work correctly the first time. Finding bugs is - "debugging" and a program that helps you find bugs is a - "debugger". `gawk' has a built-in debugger that works very + called debugging, and a program that helps you find bugs is a + debugger. `gawk' has a built-in debugger that works very similarly to the GNU Debugger, GDB. * Debuggers let you step through your program one statement at a @@ -21707,8 +21706,8 @@ File: gawk.info, Node: Debugging Summary, Prev: Limitations, Up: Debugger breakpoints, execution, viewing and changing data, working with the stack, getting information, and other tasks. - * If the `readline' library is available when `gawk' is compiled, it - is used by the debugger to provide command-line history and + * If the GNU Readline library is available when `gawk' is compiled, + it is used by the debugger to provide command-line history and editing. @@ -31575,7 +31574,7 @@ Index * -W option: Options. (line 46) * . (period), regexp operator: Regexp Operators. (line 44) * .gmo files: Explaining gettext. (line 42) -* .gmo files, specifying directory of <1>: Programmer i18n. (line 47) +* .gmo files, specifying directory of <1>: Programmer i18n. (line 48) * .gmo files, specifying directory of: Explaining gettext. (line 54) * .mo files, converting from .po: I18N Example. (line 64) * .po files <1>: Translator i18n. (line 6) @@ -31981,7 +31980,7 @@ Index * Berry, Karl <1>: Ranges and Locales. (line 74) * Berry, Karl: Acknowledgments. (line 33) * binary input/output: User-modified. (line 15) -* bindtextdomain <1>: Programmer i18n. (line 47) +* bindtextdomain <1>: Programmer i18n. (line 48) * bindtextdomain: I18N Functions. (line 12) * bindtextdomain() function (C library): Explaining gettext. (line 50) * bindtextdomain() function (gawk), portability and: I18N Portability. @@ -32315,11 +32314,11 @@ Index * Davies, Stephen <1>: Contributors. (line 74) * Davies, Stephen: Acknowledgments. (line 60) * Day, Robert P.J.: Acknowledgments. (line 78) -* dcgettext <1>: Programmer i18n. (line 19) +* dcgettext <1>: Programmer i18n. (line 20) * dcgettext: I18N Functions. (line 22) * dcgettext() function (gawk), portability and: I18N Portability. (line 33) -* dcngettext <1>: Programmer i18n. (line 36) +* dcngettext <1>: Programmer i18n. (line 37) * dcngettext: I18N Functions. (line 28) * dcngettext() function (gawk), portability and: I18N Portability. (line 33) @@ -32406,7 +32405,7 @@ Index * debugger commands, t (tbreak): Breakpoint Control. (line 90) * debugger commands, tbreak: Breakpoint Control. (line 90) * debugger commands, trace: Miscellaneous Debugger Commands. - (line 108) + (line 107) * debugger commands, u (until): Debugger Execution Control. (line 83) * debugger commands, undisplay: Viewing And Changing Data. @@ -32422,12 +32421,12 @@ Index (line 67) * debugger commands, where (backtrace): Execution Stack. (line 13) * debugger default list amount: Debugger Info. (line 69) -* debugger history file: Debugger Info. (line 80) +* debugger history file: Debugger Info. (line 81) * debugger history size: Debugger Info. (line 65) * debugger options: Debugger Info. (line 57) -* debugger prompt: Debugger Info. (line 77) +* debugger prompt: Debugger Info. (line 78) * debugger, how to start: Debugger Invocation. (line 6) -* debugger, read commands from a file: Debugger Info. (line 96) +* debugger, read commands from a file: Debugger Info. (line 97) * debugging awk programs: Debugger. (line 6) * debugging gawk, bug reports: Bugs. (line 9) * decimal point character, locale specific: Options. (line 272) @@ -32757,7 +32756,7 @@ Index * FILENAME variable, getline, setting with: Getline Notes. (line 19) * filenames, assignments as: Ignoring Assigns. (line 6) * files, .gmo: Explaining gettext. (line 42) -* files, .gmo, specifying directory of <1>: Programmer i18n. (line 47) +* files, .gmo, specifying directory of <1>: Programmer i18n. (line 48) * files, .gmo, specifying directory of: Explaining gettext. (line 54) * files, .mo, converting from .po: I18N Example. (line 64) * files, .po <1>: Translator i18n. (line 6) @@ -32784,7 +32783,7 @@ Index * files, message object, converting from portable object files: I18N Example. (line 64) * files, message object, specifying directory of <1>: Programmer i18n. - (line 47) + (line 48) * files, message object, specifying directory of: Explaining gettext. (line 54) * files, multiple passes over: Other Arguments. (line 56) @@ -33190,7 +33189,7 @@ Index * insomnia, cure for: Alarm Program. (line 6) * installation, VMS: VMS Installation. (line 6) * installing gawk: Installation. (line 6) -* instruction tracing, in debugger: Debugger Info. (line 89) +* instruction tracing, in debugger: Debugger Info. (line 90) * int: Numeric Functions. (line 23) * INT signal (MS-Windows): Profiling. (line 214) * integer array indices: Numeric Array Subscripts. @@ -33211,7 +33210,7 @@ Index * internationalization, localization, locale categories: Explaining gettext. (line 81) * internationalization, localization, marked strings: Programmer i18n. - (line 14) + (line 13) * internationalization, localization, portability and: I18N Portability. (line 6) * internationalizing a program: Explaining gettext. (line 6) @@ -33392,7 +33391,7 @@ Index * message object files, converting from portable object files: I18N Example. (line 64) * message object files, specifying directory of <1>: Programmer i18n. - (line 47) + (line 48) * message object files, specifying directory of: Explaining gettext. (line 54) * messages from extensions: Printing Messages. (line 6) @@ -33836,7 +33835,7 @@ Index * records, terminating: awk split records. (line 125) * records, treating files as: gawk split records. (line 93) * recursive functions: Definition Syntax. (line 88) -* redirect gawk output, in debugger: Debugger Info. (line 72) +* redirect gawk output, in debugger: Debugger Info. (line 73) * redirection of input: Getline/File. (line 6) * redirection of output: Redirection. (line 6) * reference counting, sorting arrays: Array Sorting Functions. @@ -33955,7 +33954,7 @@ Index * sample debugging session: Sample Debugging Session. (line 6) * sandbox mode: Options. (line 288) -* save debugger options: Debugger Info. (line 84) +* save debugger options: Debugger Info. (line 85) * scalar or array: Type Functions. (line 11) * scalar values: Basic Data Typing. (line 13) * scanning arrays: Scanning an Array. (line 6) @@ -34177,7 +34176,7 @@ Index * strings, converting, numbers to: User-modified. (line 30) * strings, empty, See null strings: awk split records. (line 115) * strings, extracting: String Extraction. (line 6) -* strings, for localization: Programmer i18n. (line 14) +* strings, for localization: Programmer i18n. (line 13) * strings, length limitations: Scalar Constants. (line 20) * strings, merging arrays into: Join Function. (line 6) * strings, null: Regexp Field Splitting. @@ -34237,7 +34236,7 @@ Index (line 6) * text, printing: Print. (line 22) * text, printing, unduplicated lines of: Uniq Program. (line 6) -* TEXTDOMAIN variable <1>: Programmer i18n. (line 9) +* TEXTDOMAIN variable <1>: Programmer i18n. (line 8) * TEXTDOMAIN variable: User-modified. (line 152) * TEXTDOMAIN variable, BEGIN pattern and: Programmer i18n. (line 60) * TEXTDOMAIN variable, portability and: I18N Portability. (line 20) @@ -34265,7 +34264,7 @@ Index * toupper: String Functions. (line 530) * tr utility: Translate Program. (line 6) * trace debugger command: Miscellaneous Debugger Commands. - (line 108) + (line 107) * traceback, display in debugger: Execution Stack. (line 13) * translate string: I18N Functions. (line 22) * translate.awk program: Translate Program. (line 55) @@ -34834,203 +34833,203 @@ Node: Explaining gettext811336 Ref: Explaining gettext-Footnote-1816361 Ref: Explaining gettext-Footnote-2816545 Node: Programmer i18n816710 -Ref: Programmer i18n-Footnote-1821576 -Node: Translator i18n821625 -Node: String Extraction822419 -Ref: String Extraction-Footnote-1823550 -Node: Printf Ordering823636 -Ref: Printf Ordering-Footnote-1826422 -Node: I18N Portability826486 -Ref: I18N Portability-Footnote-1828941 -Node: I18N Example829004 -Ref: I18N Example-Footnote-1831807 -Node: Gawk I18N831879 -Node: I18N Summary832517 -Node: Debugger833856 -Node: Debugging834878 -Node: Debugging Concepts835319 -Node: Debugging Terms837172 -Node: Awk Debugging839744 -Node: Sample Debugging Session840638 -Node: Debugger Invocation841158 -Node: Finding The Bug842542 -Node: List of Debugger Commands849017 -Node: Breakpoint Control850350 -Node: Debugger Execution Control854046 -Node: Viewing And Changing Data857410 -Node: Execution Stack860788 -Node: Debugger Info862425 -Node: Miscellaneous Debugger Commands866442 -Node: Readline Support871471 -Node: Limitations872363 -Node: Debugging Summary874477 -Node: Arbitrary Precision Arithmetic875645 -Node: Computer Arithmetic877061 -Ref: table-numeric-ranges880659 -Ref: Computer Arithmetic-Footnote-1881518 -Node: Math Definitions881575 -Ref: table-ieee-formats884863 -Ref: Math Definitions-Footnote-1885467 -Node: MPFR features885572 -Node: FP Math Caution887243 -Ref: FP Math Caution-Footnote-1888293 -Node: Inexactness of computations888662 -Node: Inexact representation889621 -Node: Comparing FP Values890978 -Node: Errors accumulate892060 -Node: Getting Accuracy893493 -Node: Try To Round896155 -Node: Setting precision897054 -Ref: table-predefined-precision-strings897738 -Node: Setting the rounding mode899527 -Ref: table-gawk-rounding-modes899891 -Ref: Setting the rounding mode-Footnote-1903346 -Node: Arbitrary Precision Integers903525 -Ref: Arbitrary Precision Integers-Footnote-1906511 -Node: POSIX Floating Point Problems906660 -Ref: POSIX Floating Point Problems-Footnote-1910533 -Node: Floating point summary910571 -Node: Dynamic Extensions912765 -Node: Extension Intro914317 -Node: Plugin License915583 -Node: Extension Mechanism Outline916380 -Ref: figure-load-extension916808 -Ref: figure-register-new-function918288 -Ref: figure-call-new-function919292 -Node: Extension API Description921278 -Node: Extension API Functions Introduction922728 -Node: General Data Types927552 -Ref: General Data Types-Footnote-1933291 -Node: Memory Allocation Functions933590 -Ref: Memory Allocation Functions-Footnote-1936429 -Node: Constructor Functions936525 -Node: Registration Functions938259 -Node: Extension Functions938944 -Node: Exit Callback Functions941241 -Node: Extension Version String942489 -Node: Input Parsers943154 -Node: Output Wrappers953033 -Node: Two-way processors957548 -Node: Printing Messages959752 -Ref: Printing Messages-Footnote-1960828 -Node: Updating `ERRNO'960980 -Node: Requesting Values961720 -Ref: table-value-types-returned962448 -Node: Accessing Parameters963405 -Node: Symbol Table Access964636 -Node: Symbol table by name965150 -Node: Symbol table by cookie967131 -Ref: Symbol table by cookie-Footnote-1971275 -Node: Cached values971338 -Ref: Cached values-Footnote-1974837 -Node: Array Manipulation974928 -Ref: Array Manipulation-Footnote-1976026 -Node: Array Data Types976063 -Ref: Array Data Types-Footnote-1978718 -Node: Array Functions978810 -Node: Flattening Arrays982664 -Node: Creating Arrays989556 -Node: Extension API Variables994327 -Node: Extension Versioning994963 -Node: Extension API Informational Variables996864 -Node: Extension API Boilerplate997929 -Node: Finding Extensions1001738 -Node: Extension Example1002298 -Node: Internal File Description1003070 -Node: Internal File Ops1007137 -Ref: Internal File Ops-Footnote-11018807 -Node: Using Internal File Ops1018947 -Ref: Using Internal File Ops-Footnote-11021330 -Node: Extension Samples1021603 -Node: Extension Sample File Functions1023129 -Node: Extension Sample Fnmatch1030767 -Node: Extension Sample Fork1032258 -Node: Extension Sample Inplace1033473 -Node: Extension Sample Ord1035148 -Node: Extension Sample Readdir1035984 -Ref: table-readdir-file-types1036860 -Node: Extension Sample Revout1037671 -Node: Extension Sample Rev2way1038261 -Node: Extension Sample Read write array1039001 -Node: Extension Sample Readfile1040941 -Node: Extension Sample Time1042036 -Node: Extension Sample API Tests1043385 -Node: gawkextlib1043876 -Node: Extension summary1046534 -Node: Extension Exercises1050223 -Node: Language History1050945 -Node: V7/SVR3.11052601 -Node: SVR41054782 -Node: POSIX1056227 -Node: BTL1057616 -Node: POSIX/GNU1058350 -Node: Feature History1063914 -Node: Common Extensions1077012 -Node: Ranges and Locales1078336 -Ref: Ranges and Locales-Footnote-11082954 -Ref: Ranges and Locales-Footnote-21082981 -Ref: Ranges and Locales-Footnote-31083215 -Node: Contributors1083436 -Node: History summary1088977 -Node: Installation1090347 -Node: Gawk Distribution1091293 -Node: Getting1091777 -Node: Extracting1092600 -Node: Distribution contents1094235 -Node: Unix Installation1099952 -Node: Quick Installation1100569 -Node: Additional Configuration Options1102993 -Node: Configuration Philosophy1104731 -Node: Non-Unix Installation1107100 -Node: PC Installation1107558 -Node: PC Binary Installation1108877 -Node: PC Compiling1110725 -Ref: PC Compiling-Footnote-11113746 -Node: PC Testing1113855 -Node: PC Using1115031 -Node: Cygwin1119146 -Node: MSYS1119969 -Node: VMS Installation1120469 -Node: VMS Compilation1121261 -Ref: VMS Compilation-Footnote-11122483 -Node: VMS Dynamic Extensions1122541 -Node: VMS Installation Details1124225 -Node: VMS Running1126477 -Node: VMS GNV1129313 -Node: VMS Old Gawk1130047 -Node: Bugs1130517 -Node: Other Versions1134400 -Node: Installation summary1140824 -Node: Notes1141880 -Node: Compatibility Mode1142745 -Node: Additions1143527 -Node: Accessing The Source1144452 -Node: Adding Code1145887 -Node: New Ports1152044 -Node: Derived Files1156526 -Ref: Derived Files-Footnote-11162001 -Ref: Derived Files-Footnote-21162035 -Ref: Derived Files-Footnote-31162631 -Node: Future Extensions1162745 -Node: Implementation Limitations1163351 -Node: Extension Design1164599 -Node: Old Extension Problems1165753 -Ref: Old Extension Problems-Footnote-11167270 -Node: Extension New Mechanism Goals1167327 -Ref: Extension New Mechanism Goals-Footnote-11170687 -Node: Extension Other Design Decisions1170876 -Node: Extension Future Growth1172984 -Node: Old Extension Mechanism1173820 -Node: Notes summary1175582 -Node: Basic Concepts1176768 -Node: Basic High Level1177449 -Ref: figure-general-flow1177721 -Ref: figure-process-flow1178320 -Ref: Basic High Level-Footnote-11181549 -Node: Basic Data Typing1181734 -Node: Glossary1185062 -Node: Copying1216991 -Node: GNU Free Documentation License1254547 -Node: Index1279683 +Ref: Programmer i18n-Footnote-1821586 +Node: Translator i18n821635 +Node: String Extraction822429 +Ref: String Extraction-Footnote-1823560 +Node: Printf Ordering823646 +Ref: Printf Ordering-Footnote-1826432 +Node: I18N Portability826496 +Ref: I18N Portability-Footnote-1828952 +Node: I18N Example829015 +Ref: I18N Example-Footnote-1831818 +Node: Gawk I18N831890 +Node: I18N Summary832534 +Node: Debugger833874 +Node: Debugging834896 +Node: Debugging Concepts835337 +Node: Debugging Terms837147 +Node: Awk Debugging839719 +Node: Sample Debugging Session840625 +Node: Debugger Invocation841159 +Node: Finding The Bug842544 +Node: List of Debugger Commands849023 +Node: Breakpoint Control850355 +Node: Debugger Execution Control854032 +Node: Viewing And Changing Data857391 +Node: Execution Stack860767 +Node: Debugger Info862402 +Node: Miscellaneous Debugger Commands866447 +Node: Readline Support871448 +Node: Limitations872342 +Node: Debugging Summary874457 +Node: Arbitrary Precision Arithmetic875631 +Node: Computer Arithmetic877047 +Ref: table-numeric-ranges880645 +Ref: Computer Arithmetic-Footnote-1881504 +Node: Math Definitions881561 +Ref: table-ieee-formats884849 +Ref: Math Definitions-Footnote-1885453 +Node: MPFR features885558 +Node: FP Math Caution887229 +Ref: FP Math Caution-Footnote-1888279 +Node: Inexactness of computations888648 +Node: Inexact representation889607 +Node: Comparing FP Values890964 +Node: Errors accumulate892046 +Node: Getting Accuracy893479 +Node: Try To Round896141 +Node: Setting precision897040 +Ref: table-predefined-precision-strings897724 +Node: Setting the rounding mode899513 +Ref: table-gawk-rounding-modes899877 +Ref: Setting the rounding mode-Footnote-1903332 +Node: Arbitrary Precision Integers903511 +Ref: Arbitrary Precision Integers-Footnote-1906497 +Node: POSIX Floating Point Problems906646 +Ref: POSIX Floating Point Problems-Footnote-1910519 +Node: Floating point summary910557 +Node: Dynamic Extensions912751 +Node: Extension Intro914303 +Node: Plugin License915569 +Node: Extension Mechanism Outline916366 +Ref: figure-load-extension916794 +Ref: figure-register-new-function918274 +Ref: figure-call-new-function919278 +Node: Extension API Description921264 +Node: Extension API Functions Introduction922714 +Node: General Data Types927538 +Ref: General Data Types-Footnote-1933277 +Node: Memory Allocation Functions933576 +Ref: Memory Allocation Functions-Footnote-1936415 +Node: Constructor Functions936511 +Node: Registration Functions938245 +Node: Extension Functions938930 +Node: Exit Callback Functions941227 +Node: Extension Version String942475 +Node: Input Parsers943140 +Node: Output Wrappers953019 +Node: Two-way processors957534 +Node: Printing Messages959738 +Ref: Printing Messages-Footnote-1960814 +Node: Updating `ERRNO'960966 +Node: Requesting Values961706 +Ref: table-value-types-returned962434 +Node: Accessing Parameters963391 +Node: Symbol Table Access964622 +Node: Symbol table by name965136 +Node: Symbol table by cookie967117 +Ref: Symbol table by cookie-Footnote-1971261 +Node: Cached values971324 +Ref: Cached values-Footnote-1974823 +Node: Array Manipulation974914 +Ref: Array Manipulation-Footnote-1976012 +Node: Array Data Types976049 +Ref: Array Data Types-Footnote-1978704 +Node: Array Functions978796 +Node: Flattening Arrays982650 +Node: Creating Arrays989542 +Node: Extension API Variables994313 +Node: Extension Versioning994949 +Node: Extension API Informational Variables996850 +Node: Extension API Boilerplate997915 +Node: Finding Extensions1001724 +Node: Extension Example1002284 +Node: Internal File Description1003056 +Node: Internal File Ops1007123 +Ref: Internal File Ops-Footnote-11018793 +Node: Using Internal File Ops1018933 +Ref: Using Internal File Ops-Footnote-11021316 +Node: Extension Samples1021589 +Node: Extension Sample File Functions1023115 +Node: Extension Sample Fnmatch1030753 +Node: Extension Sample Fork1032244 +Node: Extension Sample Inplace1033459 +Node: Extension Sample Ord1035134 +Node: Extension Sample Readdir1035970 +Ref: table-readdir-file-types1036846 +Node: Extension Sample Revout1037657 +Node: Extension Sample Rev2way1038247 +Node: Extension Sample Read write array1038987 +Node: Extension Sample Readfile1040927 +Node: Extension Sample Time1042022 +Node: Extension Sample API Tests1043371 +Node: gawkextlib1043862 +Node: Extension summary1046520 +Node: Extension Exercises1050209 +Node: Language History1050931 +Node: V7/SVR3.11052587 +Node: SVR41054768 +Node: POSIX1056213 +Node: BTL1057602 +Node: POSIX/GNU1058336 +Node: Feature History1063900 +Node: Common Extensions1076998 +Node: Ranges and Locales1078322 +Ref: Ranges and Locales-Footnote-11082940 +Ref: Ranges and Locales-Footnote-21082967 +Ref: Ranges and Locales-Footnote-31083201 +Node: Contributors1083422 +Node: History summary1088963 +Node: Installation1090333 +Node: Gawk Distribution1091279 +Node: Getting1091763 +Node: Extracting1092586 +Node: Distribution contents1094221 +Node: Unix Installation1099938 +Node: Quick Installation1100555 +Node: Additional Configuration Options1102979 +Node: Configuration Philosophy1104717 +Node: Non-Unix Installation1107086 +Node: PC Installation1107544 +Node: PC Binary Installation1108863 +Node: PC Compiling1110711 +Ref: PC Compiling-Footnote-11113732 +Node: PC Testing1113841 +Node: PC Using1115017 +Node: Cygwin1119132 +Node: MSYS1119955 +Node: VMS Installation1120455 +Node: VMS Compilation1121247 +Ref: VMS Compilation-Footnote-11122469 +Node: VMS Dynamic Extensions1122527 +Node: VMS Installation Details1124211 +Node: VMS Running1126463 +Node: VMS GNV1129299 +Node: VMS Old Gawk1130033 +Node: Bugs1130503 +Node: Other Versions1134386 +Node: Installation summary1140810 +Node: Notes1141866 +Node: Compatibility Mode1142731 +Node: Additions1143513 +Node: Accessing The Source1144438 +Node: Adding Code1145873 +Node: New Ports1152030 +Node: Derived Files1156512 +Ref: Derived Files-Footnote-11161987 +Ref: Derived Files-Footnote-21162021 +Ref: Derived Files-Footnote-31162617 +Node: Future Extensions1162731 +Node: Implementation Limitations1163337 +Node: Extension Design1164585 +Node: Old Extension Problems1165739 +Ref: Old Extension Problems-Footnote-11167256 +Node: Extension New Mechanism Goals1167313 +Ref: Extension New Mechanism Goals-Footnote-11170673 +Node: Extension Other Design Decisions1170862 +Node: Extension Future Growth1172970 +Node: Old Extension Mechanism1173806 +Node: Notes summary1175568 +Node: Basic Concepts1176754 +Node: Basic High Level1177435 +Ref: figure-general-flow1177707 +Ref: figure-process-flow1178306 +Ref: Basic High Level-Footnote-11181535 +Node: Basic Data Typing1181720 +Node: Glossary1185048 +Node: Copying1216977 +Node: GNU Free Documentation License1254533 +Node: Index1279669  End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 59f11cae..ed7f4610 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -27922,7 +27922,7 @@ a requirement. @cindex localization @dfn{Internationalization} means writing (or modifying) a program once, in such a way that it can use multiple languages without requiring -further source-code changes. +further source code changes. @dfn{Localization} means providing the data necessary for an internationalized program to work in a particular language. Most typically, these terms refer to features such as the language @@ -27937,7 +27937,7 @@ monetary values are printed and read. @cindex @command{gettext} library @command{gawk} uses GNU @command{gettext} to provide its internationalization features. -The facilities in GNU @command{gettext} focus on messages; strings printed +The facilities in GNU @command{gettext} focus on messages: strings printed by a program, either directly or via formatting with @code{printf} or @code{sprintf()}.@footnote{For some operating systems, the @command{gawk} port doesn't support GNU @command{gettext}. @@ -28128,7 +28128,7 @@ All of the above. (Not too useful in the context of @command{gettext}.) @section Internationalizing @command{awk} Programs @cindex @command{awk} programs, internationalizing -@command{gawk} provides the following variables and functions for +@command{gawk} provides the following variables for internationalization: @table @code @@ -28144,7 +28144,12 @@ value is @code{"messages"}. String constants marked with a leading underscore are candidates for translation at runtime. String constants without a leading underscore are not translated. +@end table +@command{gawk} provides the following functions for +internationalization: + +@table @code @cindexgawkfunc{dcgettext} @item @code{dcgettext(@var{string}} [@code{,} @var{domain} [@code{,} @var{category}]]@code{)} Return the translation of @var{string} in @@ -28201,15 +28206,7 @@ If @var{directory} is the null string (@code{""}), then given @var{domain}. @end table -To use these facilities in your @command{awk} program, follow the steps -outlined in -@ifnotinfo -the previous @value{SECTION}, -@end ifnotinfo -@ifinfo -@ref{Explaining gettext}, -@end ifinfo -like so: +To use these facilities in your @command{awk} program, follow these steps: @enumerate @cindex @code{BEGIN} pattern, @code{TEXTDOMAIN} variable and @@ -28492,7 +28489,7 @@ the null string (@code{""}) as its value, leaving the original string constant a the result. @item -By defining ``dummy'' functions to replace @code{dcgettext()}, @code{dcngettext()} +By defining ``dummy'' functions to replace @code{dcgettext()}, @code{dcngettext()}, and @code{bindtextdomain()}, the @command{awk} program can be made to run, but all the messages are output in the original language. For example: @@ -28676,11 +28673,11 @@ using the GNU @command{gettext} package. (GNU @command{gettext} is described in complete detail in @ifinfo -@inforef{Top, , GNU @command{gettext} utilities, gettext, GNU gettext tools}.) +@inforef{Top, , GNU @command{gettext} utilities, gettext, GNU @command{gettext} utilities}.) @end ifinfo @ifnotinfo @uref{http://www.gnu.org/software/gettext/manual/, -@cite{GNU gettext tools}}.) +@cite{GNU @command{gettext} utilities}}.) @end ifnotinfo As of this writing, the latest version of GNU @command{gettext} is @uref{ftp://ftp.gnu.org/gnu/gettext/gettext-0.19.4.tar.gz, @@ -28696,7 +28693,7 @@ and fatal errors in the local language. @itemize @value{BULLET} @item Internationalization means writing a program such that it can use multiple -languages without requiring source-code changes. Localization means +languages without requiring source code changes. Localization means providing the data necessary for an internationalized program to work in a particular language. @@ -28713,9 +28710,9 @@ file, and the @file{.po} files are compiled into @file{.gmo} files for use at runtime. @item -You can use position specifications with @code{sprintf()} and +You can use positional specifications with @code{sprintf()} and @code{printf} to rearrange the placement of argument values in formatted -strings and output. This is useful for the translations of format +strings and output. This is useful for the translation of format control strings. @item @@ -28771,8 +28768,7 @@ the discussion of debugging in @command{gawk}. @subsection Debugging in General (If you have used debuggers in other languages, you may want to skip -ahead to the next section on the specific features of the @command{gawk} -debugger.) +ahead to @ref{Awk Debugging}.) Of course, a debugging program cannot remove bugs for you, because it has no way of knowing what you or your users consider a ``bug'' versus a @@ -28863,10 +28859,10 @@ and usually find the errant code quite quickly. @end table @node Awk Debugging -@subsection Awk Debugging +@subsection @command{awk} Debugging Debugging an @command{awk} program has some specific aspects that are -not shared with other programming languages. +not shared with programs written in other languages. First of all, the fact that @command{awk} programs usually take input line by line from a file or files and operate on those lines using specific @@ -28882,7 +28878,7 @@ to look at the individual primitive instructions carried out by the higher-level @command{awk} commands. @node Sample Debugging Session -@section Sample Debugging Session +@section Sample @command{gawk} Debugging Session @cindex sample debugging session In order to illustrate the use of @command{gawk} as a debugger, let's look at a sample @@ -28901,8 +28897,8 @@ as our example. @cindex debugger, how to start Starting the debugger is almost exactly like running @command{gawk} normally, -except you have to pass an additional option @option{--debug}, or the -corresponding short option @option{-D}. The file(s) containing the +except you have to pass an additional option, @option{--debug}, or the +corresponding short option, @option{-D}. The file(s) containing the program and any supporting code are given on the command line as arguments to one or more @option{-f} options. (@command{gawk} is not designed to debug command-line programs, only programs contained in files.) @@ -28915,7 +28911,7 @@ $ @kbd{gawk -D -f getopt.awk -f join.awk -f uniq.awk -1 inputfile} @noindent where both @file{getopt.awk} and @file{uniq.awk} are in @env{$AWKPATH}. (Experienced users of GDB or similar debuggers should note that -this syntax is slightly different from what they are used to. +this syntax is slightly different from what you are used to. With the @command{gawk} debugger, you give the arguments for running the program in the command line to the debugger rather than as part of the @code{run} command at the debugger prompt.) @@ -29069,10 +29065,10 @@ gawk> @kbd{n} @end example This tells us that @command{gawk} is now ready to execute line 66, which -decides whether to give the lines the special ``field skipping'' treatment +decides whether to give the lines the special ``field-skipping'' treatment indicated by the @option{-1} command-line option. (Notice that we skipped -from where we were before at line 63 to here, because the condition in line 63 -@samp{if (fcount == 0 && charcount == 0)} was false.) +from where we were before, at line 63, to here, because the condition +in line 63, @samp{if (fcount == 0 && charcount == 0)}, was false.) Continuing to step, we now get to the splitting of the current and last records: @@ -29146,7 +29142,7 @@ gawk> @kbd{n} Well, here we are at our error (sorry to spoil the suspense). What we had in mind was to join the fields starting from the second one to make -the virtual record to compare, and if the first field was numbered zero, +the virtual record to compare, and if the first field were numbered zero, this would work. Let's look at what we've got: @example @@ -29155,7 +29151,7 @@ gawk> @kbd{p cline clast} @print{} clast = "awk is a wonderful program!" @end example -Hey, those look pretty familiar! They're just our original, unaltered, +Hey, those look pretty familiar! They're just our original, unaltered input records. A little thinking (the human brain is still the best debugging tool), and we realize that we were off by one! @@ -29205,11 +29201,11 @@ Miscellaneous @end itemize Each of these are discussed in the following subsections. -In the following descriptions, commands which may be abbreviated +In the following descriptions, commands that may be abbreviated show the abbreviation on a second description line. A debugger command name may also be truncated if that partial name is unambiguous. The debugger has the built-in capability to -automatically repeat the previous command just by hitting @key{Enter}. +automatically repeat the previous command just by hitting @kbd{Enter}. This works for the commands @code{list}, @code{next}, @code{nexti}, @code{step}, @code{stepi}, and @code{continue} executed without any argument. @@ -29259,7 +29255,7 @@ Set a breakpoint at entry to (the first instruction of) function @var{function}. @end table -Each breakpoint is assigned a number which can be used to delete it from +Each breakpoint is assigned a number that can be used to delete it from the breakpoint list using the @code{delete} command. With a breakpoint, you may also supply a condition. This is an @@ -29311,7 +29307,7 @@ watchpoint is made unconditional). @cindex breakpoint, delete by number @item @code{delete} [@var{n1 n2} @dots{}] [@var{n}--@var{m}] @itemx @code{d} [@var{n1 n2} @dots{}] [@var{n}--@var{m}] -Delete specified breakpoints or a range of breakpoints. Deletes +Delete specified breakpoints or a range of breakpoints. Delete all defined breakpoints if no argument is supplied. @cindex debugger commands, @code{disable} @@ -29320,7 +29316,7 @@ all defined breakpoints if no argument is supplied. @cindex breakpoint, how to disable or enable @item @code{disable} [@var{n1 n2} @dots{} | @var{n}--@var{m}] Disable specified breakpoints or a range of breakpoints. Without -any argument, disables all breakpoints. +any argument, disable all breakpoints. @cindex debugger commands, @code{e} (@code{enable}) @cindex debugger commands, @code{enable} @@ -29330,18 +29326,18 @@ any argument, disables all breakpoints. @item @code{enable} [@code{del} | @code{once}] [@var{n1 n2} @dots{}] [@var{n}--@var{m}] @itemx @code{e} [@code{del} | @code{once}] [@var{n1 n2} @dots{}] [@var{n}--@var{m}] Enable specified breakpoints or a range of breakpoints. Without -any argument, enables all breakpoints. -Optionally, you can specify how to enable the breakpoint: +any argument, enable all breakpoints. +Optionally, you can specify how to enable the breakpoints: @c nested table @table @code @item del -Enable the breakpoint(s) temporarily, then delete it when -the program stops at the breakpoint. +Enable the breakpoints temporarily, then delete each one when +the program stops at it. @item once -Enable the breakpoint(s) temporarily, then disable it when -the program stops at the breakpoint. +Enable the breakpoints temporarily, then disable each one when +the program stops at it. @end table @cindex debugger commands, @code{ignore} @@ -29409,7 +29405,7 @@ gawk> @item @code{continue} [@var{count}] @itemx @code{c} [@var{count}] Resume program execution. If continued from a breakpoint and @var{count} is -specified, ignores the breakpoint at that location the next @var{count} times +specified, ignore the breakpoint at that location the next @var{count} times before stopping. @cindex debugger commands, @code{finish} @@ -29463,7 +29459,7 @@ automatic display variables, and debugger options. @item @code{step} [@var{count}] @itemx @code{s} [@var{count}] Continue execution until control reaches a different source line in the -current stack frame. @code{step} steps inside any function called within +current stack frame, stepping inside any function called within the line. If the argument @var{count} is supplied, steps that many times before stopping, unless it encounters a breakpoint or watchpoint. @@ -29576,7 +29572,7 @@ or field. String values must be enclosed between double quotes (@code{"}@dots{}@code{"}). You can also set special @command{awk} variables, such as @code{FS}, -@code{NF}, @code{NR}, and son on. +@code{NF}, @code{NR}, and so on. @cindex debugger commands, @code{w} (@code{watch}) @cindex debugger commands, @code{watch} @@ -29588,7 +29584,7 @@ You can also set special @command{awk} variables, such as @code{FS}, Add variable @var{var} (or field @code{$@var{n}}) to the watch list. The debugger then stops whenever the value of the variable or field changes. Each watched item is assigned a -number which can be used to delete it from the watch list using the +number that can be used to delete it from the watch list using the @code{unwatch} command. With a watchpoint, you may also supply a condition. This is an @@ -29616,11 +29612,11 @@ watch list. @node Execution Stack @subsection Working with the Stack -Whenever you run a program which contains any function calls, +Whenever you run a program that contains any function calls, @command{gawk} maintains a stack of all of the function calls leading up to where the program is right now. You can see how you got to where you are, and also move around in the stack to see what the state of things was in the -functions which called the one you are in. The commands for doing this are: +functions that called the one you are in. The commands for doing this are: @table @asis @cindex debugger commands, @code{bt} (@code{backtrace}) @@ -29655,8 +29651,8 @@ Then select and print the frame. @item @code{frame} [@var{n}] @itemx @code{f} [@var{n}] Select and print stack frame @var{n}. Frame 0 is the currently executing, -or @dfn{innermost}, frame (function call), frame 1 is the frame that -called the innermost one. The highest numbered frame is the one for the +or @dfn{innermost}, frame (function call); frame 1 is the frame that +called the innermost one. The highest-numbered frame is the one for the main program. The printed information consists of the frame number, function and argument names, source file, and the source line. @@ -29672,7 +29668,7 @@ Then select and print the frame. Besides looking at the values of variables, there is often a need to get other sorts of information about the state of your program and of the -debugging environment itself. The @command{gawk} debugger has one command which +debugging environment itself. The @command{gawk} debugger has one command that provides this information, appropriately called @code{info}. @code{info} is used with one of a number of arguments that tell it exactly what you want to know: @@ -29760,12 +29756,12 @@ The available options are: @table @asis @item @code{history_size} @cindex debugger history size -The maximum number of lines to keep in the history file @file{./.gawk_history}. -The default is 100. +Set the maximum number of lines to keep in the history file +@file{./.gawk_history}. The default is 100. @item @code{listsize} @cindex debugger default list amount -The number of lines that @code{list} prints. The default is 15. +Specify the number of lines that @code{list} prints. The default is 15. @item @code{outfile} @cindex redirect @command{gawk} output, in debugger @@ -29775,7 +29771,7 @@ standard output. @item @code{prompt} @cindex debugger prompt -The debugger prompt. The default is @samp{@w{gawk> }}. +Change the debugger prompt. The default is @samp{@w{gawk> }}. @item @code{save_history} [@code{on} | @code{off}] @cindex debugger history file @@ -29786,7 +29782,7 @@ The default is @code{on}. @cindex save debugger options Save current options to file @file{./.gawkrc} upon exit. The default is @code{on}. -Options are read back in to the next session upon startup. +Options are read back into the next session upon startup. @item @code{trace} [@code{on} | @code{off}] @cindex instruction tracing, in debugger @@ -29809,7 +29805,7 @@ command in the file. Also, the list of commands may include additional @code{source} commands; however, the @command{gawk} debugger will not source the same file more than once in order to avoid infinite recursion. -In addition to, or instead of the @code{source} command, you can use +In addition to, or instead of, the @code{source} command, you can use the @option{-D @var{file}} or @option{--debug=@var{file}} command-line options to execute commands from a file non-interactively (@pxref{Options}). @@ -29818,16 +29814,16 @@ options to execute commands from a file non-interactively @node Miscellaneous Debugger Commands @subsection Miscellaneous Commands -There are a few more commands which do not fit into the +There are a few more commands that do not fit into the previous categories, as follows: @table @asis @cindex debugger commands, @code{dump} @cindex @code{dump} debugger command @item @code{dump} [@var{filename}] -Dump bytecode of the program to standard output or to the file +Dump byte code of the program to standard output or to the file named in @var{filename}. This prints a representation of the internal -instructions which @command{gawk} executes to implement the @command{awk} +instructions that @command{gawk} executes to implement the @command{awk} commands in a program. This can be very enlightening, as the following partial dump of Davide Brini's obfuscated code (@pxref{Signature Program}) demonstrates: @@ -29924,7 +29920,7 @@ Print lines centered around line number @var{n} in source file @var{filename}. This command may change the current source file. @item @var{function} -Print lines centered around beginning of the +Print lines centered around the beginning of the function @var{function}. This command may change the current source file. @end table @@ -29936,16 +29932,16 @@ function @var{function}. This command may change the current source file. @item @code{quit} @itemx @code{q} Exit the debugger. Debugging is great fun, but sometimes we all have -to tend to other obligations in life, and sometimes we find the bug, +to tend to other obligations in life, and sometimes we find the bug and are free to go on to the next one! As we saw earlier, if you are -running a program, the debugger warns you if you accidentally type +running a program, the debugger warns you when you type @samp{q} or @samp{quit}, to make sure you really want to quit. @cindex debugger commands, @code{trace} @cindex @code{trace} debugger command @item @code{trace} [@code{on} | @code{off}] -Turn on or off a continuous printing of instructions which are about to -be executed, along with printing the @command{awk} line which they +Turn on or off continuous printing of the instructions that are about to +be executed, along with the @command{awk} lines they implement. The default is @code{off}. It is to be hoped that most of the ``opcodes'' in these instructions are @@ -29961,7 +29957,7 @@ fairly self-explanatory, and using @code{stepi} and @code{nexti} while If @command{gawk} is compiled with @uref{http://cnswww.cns.cwru.edu/php/chet/readline/readline.html, -the @code{readline} library}, you can take advantage of that library's +the GNU Readline library}, you can take advantage of that library's command completion and history expansion features. The following types of completion are available: @@ -29998,7 +29994,7 @@ and We hope you find the @command{gawk} debugger useful and enjoyable to work with, but as with any program, especially in its early releases, it still has -some limitations. A few which are worth being aware of are: +some limitations. A few that it's worth being aware of are: @itemize @value{BULLET} @item @@ -30014,13 +30010,13 @@ If you perused the dump of opcodes in @ref{Miscellaneous Debugger Commands} (or if you are already familiar with @command{gawk} internals), you will realize that much of the internal manipulation of data in @command{gawk}, as in many interpreters, is done on a stack. -@code{Op_push}, @code{Op_pop}, and the like, are the ``bread and butter'' of +@code{Op_push}, @code{Op_pop}, and the like are the ``bread and butter'' of most @command{gawk} code. Unfortunately, as of now, the @command{gawk} debugger does not allow you to examine the stack's contents. That is, the intermediate results of expression evaluation are on the -stack, but cannot be printed. Rather, only variables which are defined +stack, but cannot be printed. Rather, only variables that are defined in the program can be printed. Of course, a workaround for this is to use more explicit variables at the debugging stage and then change back to obscure, perhaps more optimal code later. @@ -30034,12 +30030,12 @@ programmer, you are expected to know the meaning of @item The @command{gawk} debugger is designed to be used by running a program (with all its parameters) on the command line, as described in @ref{Debugger Invocation}. -There is no way (as of now) to attach or ``break in'' to a running program. -This seems reasonable for a language which is used mainly for quickly +There is no way (as of now) to attach or ``break into'' a running program. +This seems reasonable for a language that is used mainly for quickly executing, short programs. @item -The @command{gawk} debugger only accepts source supplied with the @option{-f} option. +The @command{gawk} debugger only accepts source code supplied with the @option{-f} option. @end itemize @ignore @@ -30053,8 +30049,8 @@ be added, and of course feel free to try to add them yourself! @itemize @value{BULLET} @item Programs rarely work correctly the first time. Finding bugs -is @dfn{debugging} and a program that helps you find bugs is a -@dfn{debugger}. @command{gawk} has a built-in debugger that works very +is called debugging, and a program that helps you find bugs is a +debugger. @command{gawk} has a built-in debugger that works very similarly to the GNU Debugger, GDB. @item @@ -30074,7 +30070,7 @@ breakpoints, execution, viewing and changing data, working with the stack, getting information, and other tasks. @item -If the @code{readline} library is available when @command{gawk} is +If the GNU Readline library is available when @command{gawk} is compiled, it is used by the debugger to provide command-line history and editing. diff --git a/doc/gawktexi.in b/doc/gawktexi.in index e02318bd..1156ffd5 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -27013,7 +27013,7 @@ a requirement. @cindex localization @dfn{Internationalization} means writing (or modifying) a program once, in such a way that it can use multiple languages without requiring -further source-code changes. +further source code changes. @dfn{Localization} means providing the data necessary for an internationalized program to work in a particular language. Most typically, these terms refer to features such as the language @@ -27028,7 +27028,7 @@ monetary values are printed and read. @cindex @command{gettext} library @command{gawk} uses GNU @command{gettext} to provide its internationalization features. -The facilities in GNU @command{gettext} focus on messages; strings printed +The facilities in GNU @command{gettext} focus on messages: strings printed by a program, either directly or via formatting with @code{printf} or @code{sprintf()}.@footnote{For some operating systems, the @command{gawk} port doesn't support GNU @command{gettext}. @@ -27219,7 +27219,7 @@ All of the above. (Not too useful in the context of @command{gettext}.) @section Internationalizing @command{awk} Programs @cindex @command{awk} programs, internationalizing -@command{gawk} provides the following variables and functions for +@command{gawk} provides the following variables for internationalization: @table @code @@ -27235,7 +27235,12 @@ value is @code{"messages"}. String constants marked with a leading underscore are candidates for translation at runtime. String constants without a leading underscore are not translated. +@end table +@command{gawk} provides the following functions for +internationalization: + +@table @code @cindexgawkfunc{dcgettext} @item @code{dcgettext(@var{string}} [@code{,} @var{domain} [@code{,} @var{category}]]@code{)} Return the translation of @var{string} in @@ -27292,15 +27297,7 @@ If @var{directory} is the null string (@code{""}), then given @var{domain}. @end table -To use these facilities in your @command{awk} program, follow the steps -outlined in -@ifnotinfo -the previous @value{SECTION}, -@end ifnotinfo -@ifinfo -@ref{Explaining gettext}, -@end ifinfo -like so: +To use these facilities in your @command{awk} program, follow these steps: @enumerate @cindex @code{BEGIN} pattern, @code{TEXTDOMAIN} variable and @@ -27583,7 +27580,7 @@ the null string (@code{""}) as its value, leaving the original string constant a the result. @item -By defining ``dummy'' functions to replace @code{dcgettext()}, @code{dcngettext()} +By defining ``dummy'' functions to replace @code{dcgettext()}, @code{dcngettext()}, and @code{bindtextdomain()}, the @command{awk} program can be made to run, but all the messages are output in the original language. For example: @@ -27767,11 +27764,11 @@ using the GNU @command{gettext} package. (GNU @command{gettext} is described in complete detail in @ifinfo -@inforef{Top, , GNU @command{gettext} utilities, gettext, GNU gettext tools}.) +@inforef{Top, , GNU @command{gettext} utilities, gettext, GNU @command{gettext} utilities}.) @end ifinfo @ifnotinfo @uref{http://www.gnu.org/software/gettext/manual/, -@cite{GNU gettext tools}}.) +@cite{GNU @command{gettext} utilities}}.) @end ifnotinfo As of this writing, the latest version of GNU @command{gettext} is @uref{ftp://ftp.gnu.org/gnu/gettext/gettext-0.19.4.tar.gz, @@ -27787,7 +27784,7 @@ and fatal errors in the local language. @itemize @value{BULLET} @item Internationalization means writing a program such that it can use multiple -languages without requiring source-code changes. Localization means +languages without requiring source code changes. Localization means providing the data necessary for an internationalized program to work in a particular language. @@ -27804,9 +27801,9 @@ file, and the @file{.po} files are compiled into @file{.gmo} files for use at runtime. @item -You can use position specifications with @code{sprintf()} and +You can use positional specifications with @code{sprintf()} and @code{printf} to rearrange the placement of argument values in formatted -strings and output. This is useful for the translations of format +strings and output. This is useful for the translation of format control strings. @item @@ -27862,8 +27859,7 @@ the discussion of debugging in @command{gawk}. @subsection Debugging in General (If you have used debuggers in other languages, you may want to skip -ahead to the next section on the specific features of the @command{gawk} -debugger.) +ahead to @ref{Awk Debugging}.) Of course, a debugging program cannot remove bugs for you, because it has no way of knowing what you or your users consider a ``bug'' versus a @@ -27954,10 +27950,10 @@ and usually find the errant code quite quickly. @end table @node Awk Debugging -@subsection Awk Debugging +@subsection @command{awk} Debugging Debugging an @command{awk} program has some specific aspects that are -not shared with other programming languages. +not shared with programs written in other languages. First of all, the fact that @command{awk} programs usually take input line by line from a file or files and operate on those lines using specific @@ -27973,7 +27969,7 @@ to look at the individual primitive instructions carried out by the higher-level @command{awk} commands. @node Sample Debugging Session -@section Sample Debugging Session +@section Sample @command{gawk} Debugging Session @cindex sample debugging session In order to illustrate the use of @command{gawk} as a debugger, let's look at a sample @@ -27992,8 +27988,8 @@ as our example. @cindex debugger, how to start Starting the debugger is almost exactly like running @command{gawk} normally, -except you have to pass an additional option @option{--debug}, or the -corresponding short option @option{-D}. The file(s) containing the +except you have to pass an additional option, @option{--debug}, or the +corresponding short option, @option{-D}. The file(s) containing the program and any supporting code are given on the command line as arguments to one or more @option{-f} options. (@command{gawk} is not designed to debug command-line programs, only programs contained in files.) @@ -28006,7 +28002,7 @@ $ @kbd{gawk -D -f getopt.awk -f join.awk -f uniq.awk -1 inputfile} @noindent where both @file{getopt.awk} and @file{uniq.awk} are in @env{$AWKPATH}. (Experienced users of GDB or similar debuggers should note that -this syntax is slightly different from what they are used to. +this syntax is slightly different from what you are used to. With the @command{gawk} debugger, you give the arguments for running the program in the command line to the debugger rather than as part of the @code{run} command at the debugger prompt.) @@ -28160,10 +28156,10 @@ gawk> @kbd{n} @end example This tells us that @command{gawk} is now ready to execute line 66, which -decides whether to give the lines the special ``field skipping'' treatment +decides whether to give the lines the special ``field-skipping'' treatment indicated by the @option{-1} command-line option. (Notice that we skipped -from where we were before at line 63 to here, because the condition in line 63 -@samp{if (fcount == 0 && charcount == 0)} was false.) +from where we were before, at line 63, to here, because the condition +in line 63, @samp{if (fcount == 0 && charcount == 0)}, was false.) Continuing to step, we now get to the splitting of the current and last records: @@ -28237,7 +28233,7 @@ gawk> @kbd{n} Well, here we are at our error (sorry to spoil the suspense). What we had in mind was to join the fields starting from the second one to make -the virtual record to compare, and if the first field was numbered zero, +the virtual record to compare, and if the first field were numbered zero, this would work. Let's look at what we've got: @example @@ -28246,7 +28242,7 @@ gawk> @kbd{p cline clast} @print{} clast = "awk is a wonderful program!" @end example -Hey, those look pretty familiar! They're just our original, unaltered, +Hey, those look pretty familiar! They're just our original, unaltered input records. A little thinking (the human brain is still the best debugging tool), and we realize that we were off by one! @@ -28296,11 +28292,11 @@ Miscellaneous @end itemize Each of these are discussed in the following subsections. -In the following descriptions, commands which may be abbreviated +In the following descriptions, commands that may be abbreviated show the abbreviation on a second description line. A debugger command name may also be truncated if that partial name is unambiguous. The debugger has the built-in capability to -automatically repeat the previous command just by hitting @key{Enter}. +automatically repeat the previous command just by hitting @kbd{Enter}. This works for the commands @code{list}, @code{next}, @code{nexti}, @code{step}, @code{stepi}, and @code{continue} executed without any argument. @@ -28350,7 +28346,7 @@ Set a breakpoint at entry to (the first instruction of) function @var{function}. @end table -Each breakpoint is assigned a number which can be used to delete it from +Each breakpoint is assigned a number that can be used to delete it from the breakpoint list using the @code{delete} command. With a breakpoint, you may also supply a condition. This is an @@ -28402,7 +28398,7 @@ watchpoint is made unconditional). @cindex breakpoint, delete by number @item @code{delete} [@var{n1 n2} @dots{}] [@var{n}--@var{m}] @itemx @code{d} [@var{n1 n2} @dots{}] [@var{n}--@var{m}] -Delete specified breakpoints or a range of breakpoints. Deletes +Delete specified breakpoints or a range of breakpoints. Delete all defined breakpoints if no argument is supplied. @cindex debugger commands, @code{disable} @@ -28411,7 +28407,7 @@ all defined breakpoints if no argument is supplied. @cindex breakpoint, how to disable or enable @item @code{disable} [@var{n1 n2} @dots{} | @var{n}--@var{m}] Disable specified breakpoints or a range of breakpoints. Without -any argument, disables all breakpoints. +any argument, disable all breakpoints. @cindex debugger commands, @code{e} (@code{enable}) @cindex debugger commands, @code{enable} @@ -28421,18 +28417,18 @@ any argument, disables all breakpoints. @item @code{enable} [@code{del} | @code{once}] [@var{n1 n2} @dots{}] [@var{n}--@var{m}] @itemx @code{e} [@code{del} | @code{once}] [@var{n1 n2} @dots{}] [@var{n}--@var{m}] Enable specified breakpoints or a range of breakpoints. Without -any argument, enables all breakpoints. -Optionally, you can specify how to enable the breakpoint: +any argument, enable all breakpoints. +Optionally, you can specify how to enable the breakpoints: @c nested table @table @code @item del -Enable the breakpoint(s) temporarily, then delete it when -the program stops at the breakpoint. +Enable the breakpoints temporarily, then delete each one when +the program stops at it. @item once -Enable the breakpoint(s) temporarily, then disable it when -the program stops at the breakpoint. +Enable the breakpoints temporarily, then disable each one when +the program stops at it. @end table @cindex debugger commands, @code{ignore} @@ -28500,7 +28496,7 @@ gawk> @item @code{continue} [@var{count}] @itemx @code{c} [@var{count}] Resume program execution. If continued from a breakpoint and @var{count} is -specified, ignores the breakpoint at that location the next @var{count} times +specified, ignore the breakpoint at that location the next @var{count} times before stopping. @cindex debugger commands, @code{finish} @@ -28554,7 +28550,7 @@ automatic display variables, and debugger options. @item @code{step} [@var{count}] @itemx @code{s} [@var{count}] Continue execution until control reaches a different source line in the -current stack frame. @code{step} steps inside any function called within +current stack frame, stepping inside any function called within the line. If the argument @var{count} is supplied, steps that many times before stopping, unless it encounters a breakpoint or watchpoint. @@ -28667,7 +28663,7 @@ or field. String values must be enclosed between double quotes (@code{"}@dots{}@code{"}). You can also set special @command{awk} variables, such as @code{FS}, -@code{NF}, @code{NR}, and son on. +@code{NF}, @code{NR}, and so on. @cindex debugger commands, @code{w} (@code{watch}) @cindex debugger commands, @code{watch} @@ -28679,7 +28675,7 @@ You can also set special @command{awk} variables, such as @code{FS}, Add variable @var{var} (or field @code{$@var{n}}) to the watch list. The debugger then stops whenever the value of the variable or field changes. Each watched item is assigned a -number which can be used to delete it from the watch list using the +number that can be used to delete it from the watch list using the @code{unwatch} command. With a watchpoint, you may also supply a condition. This is an @@ -28707,11 +28703,11 @@ watch list. @node Execution Stack @subsection Working with the Stack -Whenever you run a program which contains any function calls, +Whenever you run a program that contains any function calls, @command{gawk} maintains a stack of all of the function calls leading up to where the program is right now. You can see how you got to where you are, and also move around in the stack to see what the state of things was in the -functions which called the one you are in. The commands for doing this are: +functions that called the one you are in. The commands for doing this are: @table @asis @cindex debugger commands, @code{bt} (@code{backtrace}) @@ -28746,8 +28742,8 @@ Then select and print the frame. @item @code{frame} [@var{n}] @itemx @code{f} [@var{n}] Select and print stack frame @var{n}. Frame 0 is the currently executing, -or @dfn{innermost}, frame (function call), frame 1 is the frame that -called the innermost one. The highest numbered frame is the one for the +or @dfn{innermost}, frame (function call); frame 1 is the frame that +called the innermost one. The highest-numbered frame is the one for the main program. The printed information consists of the frame number, function and argument names, source file, and the source line. @@ -28763,7 +28759,7 @@ Then select and print the frame. Besides looking at the values of variables, there is often a need to get other sorts of information about the state of your program and of the -debugging environment itself. The @command{gawk} debugger has one command which +debugging environment itself. The @command{gawk} debugger has one command that provides this information, appropriately called @code{info}. @code{info} is used with one of a number of arguments that tell it exactly what you want to know: @@ -28851,12 +28847,12 @@ The available options are: @table @asis @item @code{history_size} @cindex debugger history size -The maximum number of lines to keep in the history file @file{./.gawk_history}. -The default is 100. +Set the maximum number of lines to keep in the history file +@file{./.gawk_history}. The default is 100. @item @code{listsize} @cindex debugger default list amount -The number of lines that @code{list} prints. The default is 15. +Specify the number of lines that @code{list} prints. The default is 15. @item @code{outfile} @cindex redirect @command{gawk} output, in debugger @@ -28866,7 +28862,7 @@ standard output. @item @code{prompt} @cindex debugger prompt -The debugger prompt. The default is @samp{@w{gawk> }}. +Change the debugger prompt. The default is @samp{@w{gawk> }}. @item @code{save_history} [@code{on} | @code{off}] @cindex debugger history file @@ -28877,7 +28873,7 @@ The default is @code{on}. @cindex save debugger options Save current options to file @file{./.gawkrc} upon exit. The default is @code{on}. -Options are read back in to the next session upon startup. +Options are read back into the next session upon startup. @item @code{trace} [@code{on} | @code{off}] @cindex instruction tracing, in debugger @@ -28900,7 +28896,7 @@ command in the file. Also, the list of commands may include additional @code{source} commands; however, the @command{gawk} debugger will not source the same file more than once in order to avoid infinite recursion. -In addition to, or instead of the @code{source} command, you can use +In addition to, or instead of, the @code{source} command, you can use the @option{-D @var{file}} or @option{--debug=@var{file}} command-line options to execute commands from a file non-interactively (@pxref{Options}). @@ -28909,16 +28905,16 @@ options to execute commands from a file non-interactively @node Miscellaneous Debugger Commands @subsection Miscellaneous Commands -There are a few more commands which do not fit into the +There are a few more commands that do not fit into the previous categories, as follows: @table @asis @cindex debugger commands, @code{dump} @cindex @code{dump} debugger command @item @code{dump} [@var{filename}] -Dump bytecode of the program to standard output or to the file +Dump byte code of the program to standard output or to the file named in @var{filename}. This prints a representation of the internal -instructions which @command{gawk} executes to implement the @command{awk} +instructions that @command{gawk} executes to implement the @command{awk} commands in a program. This can be very enlightening, as the following partial dump of Davide Brini's obfuscated code (@pxref{Signature Program}) demonstrates: @@ -29015,7 +29011,7 @@ Print lines centered around line number @var{n} in source file @var{filename}. This command may change the current source file. @item @var{function} -Print lines centered around beginning of the +Print lines centered around the beginning of the function @var{function}. This command may change the current source file. @end table @@ -29027,16 +29023,16 @@ function @var{function}. This command may change the current source file. @item @code{quit} @itemx @code{q} Exit the debugger. Debugging is great fun, but sometimes we all have -to tend to other obligations in life, and sometimes we find the bug, +to tend to other obligations in life, and sometimes we find the bug and are free to go on to the next one! As we saw earlier, if you are -running a program, the debugger warns you if you accidentally type +running a program, the debugger warns you when you type @samp{q} or @samp{quit}, to make sure you really want to quit. @cindex debugger commands, @code{trace} @cindex @code{trace} debugger command @item @code{trace} [@code{on} | @code{off}] -Turn on or off a continuous printing of instructions which are about to -be executed, along with printing the @command{awk} line which they +Turn on or off continuous printing of the instructions that are about to +be executed, along with the @command{awk} lines they implement. The default is @code{off}. It is to be hoped that most of the ``opcodes'' in these instructions are @@ -29052,7 +29048,7 @@ fairly self-explanatory, and using @code{stepi} and @code{nexti} while If @command{gawk} is compiled with @uref{http://cnswww.cns.cwru.edu/php/chet/readline/readline.html, -the @code{readline} library}, you can take advantage of that library's +the GNU Readline library}, you can take advantage of that library's command completion and history expansion features. The following types of completion are available: @@ -29089,7 +29085,7 @@ and We hope you find the @command{gawk} debugger useful and enjoyable to work with, but as with any program, especially in its early releases, it still has -some limitations. A few which are worth being aware of are: +some limitations. A few that it's worth being aware of are: @itemize @value{BULLET} @item @@ -29105,13 +29101,13 @@ If you perused the dump of opcodes in @ref{Miscellaneous Debugger Commands} (or if you are already familiar with @command{gawk} internals), you will realize that much of the internal manipulation of data in @command{gawk}, as in many interpreters, is done on a stack. -@code{Op_push}, @code{Op_pop}, and the like, are the ``bread and butter'' of +@code{Op_push}, @code{Op_pop}, and the like are the ``bread and butter'' of most @command{gawk} code. Unfortunately, as of now, the @command{gawk} debugger does not allow you to examine the stack's contents. That is, the intermediate results of expression evaluation are on the -stack, but cannot be printed. Rather, only variables which are defined +stack, but cannot be printed. Rather, only variables that are defined in the program can be printed. Of course, a workaround for this is to use more explicit variables at the debugging stage and then change back to obscure, perhaps more optimal code later. @@ -29125,12 +29121,12 @@ programmer, you are expected to know the meaning of @item The @command{gawk} debugger is designed to be used by running a program (with all its parameters) on the command line, as described in @ref{Debugger Invocation}. -There is no way (as of now) to attach or ``break in'' to a running program. -This seems reasonable for a language which is used mainly for quickly +There is no way (as of now) to attach or ``break into'' a running program. +This seems reasonable for a language that is used mainly for quickly executing, short programs. @item -The @command{gawk} debugger only accepts source supplied with the @option{-f} option. +The @command{gawk} debugger only accepts source code supplied with the @option{-f} option. @end itemize @ignore @@ -29144,8 +29140,8 @@ be added, and of course feel free to try to add them yourself! @itemize @value{BULLET} @item Programs rarely work correctly the first time. Finding bugs -is @dfn{debugging} and a program that helps you find bugs is a -@dfn{debugger}. @command{gawk} has a built-in debugger that works very +is called debugging, and a program that helps you find bugs is a +debugger. @command{gawk} has a built-in debugger that works very similarly to the GNU Debugger, GDB. @item @@ -29165,7 +29161,7 @@ breakpoints, execution, viewing and changing data, working with the stack, getting information, and other tasks. @item -If the @code{readline} library is available when @command{gawk} is +If the GNU Readline library is available when @command{gawk} is compiled, it is used by the debugger to provide command-line history and editing. -- cgit v1.2.3 From 1f6b16d2d233ecc7f99ea2460098d8eeec382942 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 8 Feb 2015 20:50:31 +0200 Subject: O'Reilly fixes. Through chapter 15. --- doc/gawk.info | 429 ++++++++++++++++++++++++++++---------------------------- doc/gawk.texi | 109 ++++++++------ doc/gawktexi.in | 109 ++++++++------ 3 files changed, 348 insertions(+), 299 deletions(-) diff --git a/doc/gawk.info b/doc/gawk.info index 5bfdd436..c56ac89c 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -21768,7 +21768,7 @@ Decimal arithmetic sides) of the decimal point, and the results of a computation are always exact. - Some modern system can do decimal arithmetic in hardware, but + Some modern systems can do decimal arithmetic in hardware, but usually you need a special software library to provide access to these instructions. There are also libraries that do decimal arithmetic entirely in software. @@ -21822,12 +21822,6 @@ Numeric representation Minimum value Maximum value 32-bit unsigned integer 0 4,294,967,295 64-bit signed integer -9,223,372,036,854,775,8089,223,372,036,854,775,807 64-bit unsigned integer 0 18,446,744,073,709,551,615 -Single-precision `1.175494e-38' `3.402823e+38' -floating point -(approximate) -Double-precision `2.225074e-308' `1.797693e+308' -floating point -(approximate) Table 15.1: Value ranges for different numeric representations @@ -21843,7 +21837,7 @@ File: gawk.info, Node: Math Definitions, Next: MPFR features, Prev: Computer The rest of this major node uses a number of terms. Here are some informal definitions that should help you work your way through the -material here. +material here: "Accuracy" A floating-point calculation's accuracy is how close it comes to @@ -21863,7 +21857,7 @@ material here. number and infinity produce infinity. "NaN" - "Not A Number."(1) A special value that results from attempting a + "Not a number."(1) A special value that results from attempting a calculation that has no answer as a real number. In such a case, programs can either receive a floating-point exception, or get `NaN' back as the result. The IEEE 754 standard recommends that @@ -21889,15 +21883,15 @@ material here. PREC = 3.322 * DPS - Here, PREC denotes the binary precision (measured in bits) and DPS - (short for decimal places) is the decimal digits. + Here, _prec_ denotes the binary precision (measured in bits) and + _dps_ (short for decimal places) is the decimal digits. "Rounding mode" How numbers are rounded up or down when necessary. More details are provided later. "Significand" - A floating-point value consists the significand multiplied by 10 + A floating-point value consists of the significand multiplied by 10 to the power of the exponent. For example, in `1.2345e67', the significand is `1.2345'. @@ -21919,7 +21913,7 @@ precision formats to allow greater precisions and larger exponent ranges. (`awk' uses only the 64-bit double-precision format.) *note table-ieee-formats:: lists the precision and exponent field -values for the basic IEEE 754 binary formats: +values for the basic IEEE 754 binary formats. Name Total bits Precision Minimum Maximum exponent exponent @@ -21984,7 +21978,7 @@ File: gawk.info, Node: FP Math Caution, Next: Arbitrary Precision Integers, P Math class is tough! -- Teen Talk Barbie, July 1992 - This minor node provides a high level overview of the issues + This minor node provides a high-level overview of the issues involved when doing lots of floating-point arithmetic.(1) The discussion applies to both hardware and arbitrary-precision floating-point arithmetic. @@ -22005,8 +21999,8 @@ floating-point arithmetic. (1) There is a very nice paper on floating-point arithmetic (http://www.validlab.com/goldberg/paper.pdf) by David Goldberg, "What -Every Computer Scientist Should Know About Floating-point Arithmetic," -`ACM Computing Surveys' *23*, 1 (1991-03), 5-48. This is worth reading +Every Computer Scientist Should Know About Floating-Point Arithmetic," +`ACM Computing Surveys' *23*, 1 (1991-03): 5-48. This is worth reading if you are interested in the details, but it does require a background in computer science. @@ -22060,7 +22054,7 @@ number as you assigned to it: Often the error is so small you do not even notice it, and if you do, you can always specify how much precision you would like in your output. -Usually this is a format string like `"%.15g"', which when used in the +Usually this is a format string like `"%.15g"', which, when used in the previous example, produces an output identical to the input.  @@ -22100,7 +22094,7 @@ File: gawk.info, Node: Errors accumulate, Prev: Comparing FP Values, Up: Inex The loss of accuracy during a single computation with floating-point numbers usually isn't enough to worry about. However, if you compute a -value which is the result of a sequence of floating-point operations, +value that is the result of a sequence of floating-point operations, the error can accumulate and greatly affect the computation itself. Here is an attempt to compute the value of pi using one of its many series representations: @@ -22151,7 +22145,7 @@ easy answers. The standard rules of algebra often do not apply when using floating-point arithmetic. Among other things, the distributive and associative laws do not hold completely, and order of operation may be important for your computation. Rounding error, cumulative precision -loss and underflow are often troublesome. +loss, and underflow are often troublesome. When `gawk' tests the expressions `0.1 + 12.2' and `12.3' for equality using the machine double-precision arithmetic, it decides that @@ -22186,8 +22180,9 @@ illustrated by our earlier attempt to compute the value of pi. Extra precision can greatly enhance the stability and the accuracy of your computation in such cases. - Repeated addition is not necessarily equivalent to multiplication in -floating-point arithmetic. In the example in *note Errors accumulate::: + Additionally, you should understand that repeated addition is not +necessarily equivalent to multiplication in floating-point arithmetic. +In the example in *note Errors accumulate::: $ gawk 'BEGIN { > for (d = 1.1; d <= 1.5; d += 0.1) # loop five times (?) @@ -22242,7 +22237,7 @@ set the value to one of the predefined case-insensitive strings shown in *note table-predefined-precision-strings::, to emulate an IEEE 754 binary format. -`PREC' IEEE 754 Binary Format +`PREC' IEEE 754 binary format --------------------------------------------------- `"half"' 16-bit half-precision `"single"' Basic 32-bit single precision @@ -22275,14 +22270,14 @@ on arithmetic operations: example illustrates the differences among various ways to print a floating-point constant: - $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 0.1) }' - -| 0.1000000000000000055511151 - $ gawk -M -v PREC=113 'BEGIN { printf("%0.25f\n", 0.1) }' - -| 0.1000000000000000000000000 - $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", "0.1") }' - -| 0.1000000000000000000000000 - $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 1/10) }' - -| 0.1000000000000000000000000 + $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 0.1) }' + -| 0.1000000000000000055511151 + $ gawk -M -v PREC=113 'BEGIN { printf("%0.25f\n", 0.1) }' + -| 0.1000000000000000000000000 + $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", "0.1") }' + -| 0.1000000000000000000000000 + $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 1/10) }' + -| 0.1000000000000000000000000  File: gawk.info, Node: Setting the rounding mode, Prev: Setting precision, Up: FP Math Caution @@ -22290,15 +22285,15 @@ File: gawk.info, Node: Setting the rounding mode, Prev: Setting precision, Up 15.4.5 Setting the Rounding Mode -------------------------------- -The `ROUNDMODE' variable provides program level control over the +The `ROUNDMODE' variable provides program-level control over the rounding mode. The correspondence between `ROUNDMODE' and the IEEE rounding modes is shown in *note table-gawk-rounding-modes::. -Rounding Mode IEEE Name `ROUNDMODE' +Rounding mode IEEE name `ROUNDMODE' --------------------------------------------------------------------------- Round to nearest, ties to even `roundTiesToEven' `"N"' or `"n"' -Round toward plus Infinity `roundTowardPositive' `"U"' or `"u"' -Round toward negative Infinity `roundTowardNegative' `"D"' or `"d"' +Round toward positive infinity `roundTowardPositive' `"U"' or `"u"' +Round toward negative infinity `roundTowardNegative' `"D"' or `"d"' Round toward zero `roundTowardZero' `"Z"' or `"z"' Round to nearest, ties away `roundTiesToAway' `"A"' or `"a"' from zero @@ -22349,8 +22344,8 @@ distributes upward and downward rounds of exact halves, which might cause any accumulating round-off error to cancel itself out. This is the default rounding mode for IEEE 754 computing functions and operators. - The other rounding modes are rarely used. Round toward positive -infinity (`roundTowardPositive') and round toward negative infinity + The other rounding modes are rarely used. Rounding toward positive +infinity (`roundTowardPositive') and toward negative infinity (`roundTowardNegative') are often used to implement interval arithmetic, where you adjust the rounding mode to calculate upper and lower bounds for the range of output. The `roundTowardZero' mode can be @@ -22398,7 +22393,7 @@ floating-point values: If instead you were to compute the same value using arbitrary-precision floating-point values, the precision needed for -correct output (using the formula `prec = 3.322 * dps'), would be 3.322 +correct output (using the formula `prec = 3.322 * dps') would be 3.322 x 183231, or 608693. The result from an arithmetic operation with an integer and a @@ -22429,7 +22424,7 @@ interface to process arbitrary-precision integers or mixed-mode numbers as needed by an operation or function. In such a case, the precision is set to the minimum value necessary for exact conversion, and the working precision is not used for this purpose. If this is not what you need or -want, you can employ a subterfuge, and convert the integer to floating +want, you can employ a subterfuge and convert the integer to floating point first, like this: gawk -M 'BEGIN { n = 13; print (n + 0.0) % 2.0 }' @@ -22456,7 +22451,7 @@ File: gawk.info, Node: POSIX Floating Point Problems, Next: Floating point sum 15.6 Standards Versus Existing Practice ======================================= -Historically, `awk' has converted any non-numeric looking string to the +Historically, `awk' has converted any nonnumeric-looking string to the numeric value zero, when required. Furthermore, the original definition of the language and the original POSIX standards specified that `awk' only understands decimal numbers (base 10), and not octal @@ -22470,8 +22465,8 @@ These features are: hexadecimal notation (e.g., `0xDEADBEEF'). (Note: data values, _not_ source code constants.) - * Support for the special IEEE 754 floating-point values "Not A - Number" (NaN), positive Infinity ("inf"), and negative Infinity + * Support for the special IEEE 754 floating-point values "not a + number" (NaN), positive infinity ("inf"), and negative infinity ("-inf"). In particular, the format for these values is as specified by the ISO 1999 C standard, which ignores case and can allow implementation-dependent additional characters after the @@ -22488,21 +22483,21 @@ historical practice: values is also a very severe departure from historical practice. The second problem is that the `gawk' maintainer feels that this -interpretation of the standard, which requires a certain amount of +interpretation of the standard, which required a certain amount of "language lawyering" to arrive at in the first place, was not even -intended by the standard developers. In other words, "we see how you +intended by the standard developers. In other words, "We see how you got where you are, but we don't think that that's where you want to be." Recognizing these issues, but attempting to provide compatibility with the earlier versions of the standard, the 2008 POSIX standard added explicit wording to allow, but not require, that `awk' support -hexadecimal floating-point values and special values for "Not A Number" +hexadecimal floating-point values and special values for "not a number" and infinity. Although the `gawk' maintainer continues to feel that providing those features is inadvisable, nevertheless, on systems that support IEEE floating point, it seems reasonable to provide _some_ way to -support NaN and Infinity values. The solution implemented in `gawk' is +support NaN and infinity values. The solution implemented in `gawk' is as follows: * With the `--posix' command-line option, `gawk' becomes "hands @@ -22517,7 +22512,7 @@ as follows: $ echo 0xDeadBeef | gawk --posix '{ print $1 + 0 }' -| 3735928559 - * Without `--posix', `gawk' interprets the four strings `+inf', + * Without `--posix', `gawk' interprets the four string values `+inf', `-inf', `+nan', and `-nan' specially, producing the corresponding special numeric values. The leading sign acts a signal to `gawk' (and the user) that the value is really numeric. Hexadecimal @@ -22531,7 +22526,7 @@ as follows: $ echo 0xDeadBeef | gawk '{ print $1 + 0 }' -| 0 - `gawk' ignores case in the four special values. Thus `+nan' and + `gawk' ignores case in the four special values. Thus, `+nan' and `+NaN' are the same. ---------- Footnotes ---------- @@ -22548,9 +22543,9 @@ File: gawk.info, Node: Floating point summary, Prev: POSIX Floating Point Prob floating-point values. Standard `awk' uses double-precision floating-point values. - * In the early 1990s, Barbie mistakenly said "Math class is tough!" + * In the early 1990s Barbie mistakenly said, "Math class is tough!" Although math isn't tough, floating-point arithmetic isn't the same - as pencil and paper math, and care must be taken: + as pencil-and-paper math, and care must be taken: - Not all numbers can be represented exactly. @@ -22571,7 +22566,7 @@ File: gawk.info, Node: Floating point summary, Prev: POSIX Floating Point Prob rounding mode. * With `-M', `gawk' performs arbitrary-precision integer arithmetic - using the GMP library. This is faster and more space efficient + using the GMP library. This is faster and more space-efficient than using MPFR for the same calculations. * There are several "dark corners" with respect to floating-point @@ -22582,7 +22577,7 @@ File: gawk.info, Node: Floating point summary, Prev: POSIX Floating Point Prob results from floating-point arithmetic. The lesson to remember is that floating-point arithmetic is always more complex than arithmetic using pencil and paper. In order to take advantage of - the power of computer floating point, you need to know its + the power of floating-point arithmetic, you need to know its limitations and work within them. For most casual use of floating-point arithmetic, you will often get the expected result if you simply round the display of your final results to the @@ -34865,171 +34860,171 @@ Node: Limitations872342 Node: Debugging Summary874457 Node: Arbitrary Precision Arithmetic875631 Node: Computer Arithmetic877047 -Ref: table-numeric-ranges880645 -Ref: Computer Arithmetic-Footnote-1881504 -Node: Math Definitions881561 -Ref: table-ieee-formats884849 -Ref: Math Definitions-Footnote-1885453 -Node: MPFR features885558 -Node: FP Math Caution887229 -Ref: FP Math Caution-Footnote-1888279 -Node: Inexactness of computations888648 -Node: Inexact representation889607 -Node: Comparing FP Values890964 -Node: Errors accumulate892046 -Node: Getting Accuracy893479 -Node: Try To Round896141 -Node: Setting precision897040 -Ref: table-predefined-precision-strings897724 -Node: Setting the rounding mode899513 -Ref: table-gawk-rounding-modes899877 -Ref: Setting the rounding mode-Footnote-1903332 -Node: Arbitrary Precision Integers903511 -Ref: Arbitrary Precision Integers-Footnote-1906497 -Node: POSIX Floating Point Problems906646 -Ref: POSIX Floating Point Problems-Footnote-1910519 -Node: Floating point summary910557 -Node: Dynamic Extensions912751 -Node: Extension Intro914303 -Node: Plugin License915569 -Node: Extension Mechanism Outline916366 -Ref: figure-load-extension916794 -Ref: figure-register-new-function918274 -Ref: figure-call-new-function919278 -Node: Extension API Description921264 -Node: Extension API Functions Introduction922714 -Node: General Data Types927538 -Ref: General Data Types-Footnote-1933277 -Node: Memory Allocation Functions933576 -Ref: Memory Allocation Functions-Footnote-1936415 -Node: Constructor Functions936511 -Node: Registration Functions938245 -Node: Extension Functions938930 -Node: Exit Callback Functions941227 -Node: Extension Version String942475 -Node: Input Parsers943140 -Node: Output Wrappers953019 -Node: Two-way processors957534 -Node: Printing Messages959738 -Ref: Printing Messages-Footnote-1960814 -Node: Updating `ERRNO'960966 -Node: Requesting Values961706 -Ref: table-value-types-returned962434 -Node: Accessing Parameters963391 -Node: Symbol Table Access964622 -Node: Symbol table by name965136 -Node: Symbol table by cookie967117 -Ref: Symbol table by cookie-Footnote-1971261 -Node: Cached values971324 -Ref: Cached values-Footnote-1974823 -Node: Array Manipulation974914 -Ref: Array Manipulation-Footnote-1976012 -Node: Array Data Types976049 -Ref: Array Data Types-Footnote-1978704 -Node: Array Functions978796 -Node: Flattening Arrays982650 -Node: Creating Arrays989542 -Node: Extension API Variables994313 -Node: Extension Versioning994949 -Node: Extension API Informational Variables996850 -Node: Extension API Boilerplate997915 -Node: Finding Extensions1001724 -Node: Extension Example1002284 -Node: Internal File Description1003056 -Node: Internal File Ops1007123 -Ref: Internal File Ops-Footnote-11018793 -Node: Using Internal File Ops1018933 -Ref: Using Internal File Ops-Footnote-11021316 -Node: Extension Samples1021589 -Node: Extension Sample File Functions1023115 -Node: Extension Sample Fnmatch1030753 -Node: Extension Sample Fork1032244 -Node: Extension Sample Inplace1033459 -Node: Extension Sample Ord1035134 -Node: Extension Sample Readdir1035970 -Ref: table-readdir-file-types1036846 -Node: Extension Sample Revout1037657 -Node: Extension Sample Rev2way1038247 -Node: Extension Sample Read write array1038987 -Node: Extension Sample Readfile1040927 -Node: Extension Sample Time1042022 -Node: Extension Sample API Tests1043371 -Node: gawkextlib1043862 -Node: Extension summary1046520 -Node: Extension Exercises1050209 -Node: Language History1050931 -Node: V7/SVR3.11052587 -Node: SVR41054768 -Node: POSIX1056213 -Node: BTL1057602 -Node: POSIX/GNU1058336 -Node: Feature History1063900 -Node: Common Extensions1076998 -Node: Ranges and Locales1078322 -Ref: Ranges and Locales-Footnote-11082940 -Ref: Ranges and Locales-Footnote-21082967 -Ref: Ranges and Locales-Footnote-31083201 -Node: Contributors1083422 -Node: History summary1088963 -Node: Installation1090333 -Node: Gawk Distribution1091279 -Node: Getting1091763 -Node: Extracting1092586 -Node: Distribution contents1094221 -Node: Unix Installation1099938 -Node: Quick Installation1100555 -Node: Additional Configuration Options1102979 -Node: Configuration Philosophy1104717 -Node: Non-Unix Installation1107086 -Node: PC Installation1107544 -Node: PC Binary Installation1108863 -Node: PC Compiling1110711 -Ref: PC Compiling-Footnote-11113732 -Node: PC Testing1113841 -Node: PC Using1115017 -Node: Cygwin1119132 -Node: MSYS1119955 -Node: VMS Installation1120455 -Node: VMS Compilation1121247 -Ref: VMS Compilation-Footnote-11122469 -Node: VMS Dynamic Extensions1122527 -Node: VMS Installation Details1124211 -Node: VMS Running1126463 -Node: VMS GNV1129299 -Node: VMS Old Gawk1130033 -Node: Bugs1130503 -Node: Other Versions1134386 -Node: Installation summary1140810 -Node: Notes1141866 -Node: Compatibility Mode1142731 -Node: Additions1143513 -Node: Accessing The Source1144438 -Node: Adding Code1145873 -Node: New Ports1152030 -Node: Derived Files1156512 -Ref: Derived Files-Footnote-11161987 -Ref: Derived Files-Footnote-21162021 -Ref: Derived Files-Footnote-31162617 -Node: Future Extensions1162731 -Node: Implementation Limitations1163337 -Node: Extension Design1164585 -Node: Old Extension Problems1165739 -Ref: Old Extension Problems-Footnote-11167256 -Node: Extension New Mechanism Goals1167313 -Ref: Extension New Mechanism Goals-Footnote-11170673 -Node: Extension Other Design Decisions1170862 -Node: Extension Future Growth1172970 -Node: Old Extension Mechanism1173806 -Node: Notes summary1175568 -Node: Basic Concepts1176754 -Node: Basic High Level1177435 -Ref: figure-general-flow1177707 -Ref: figure-process-flow1178306 -Ref: Basic High Level-Footnote-11181535 -Node: Basic Data Typing1181720 -Node: Glossary1185048 -Node: Copying1216977 -Node: GNU Free Documentation License1254533 -Node: Index1279669 +Ref: table-numeric-ranges880646 +Ref: Computer Arithmetic-Footnote-1881170 +Node: Math Definitions881227 +Ref: table-ieee-formats884522 +Ref: Math Definitions-Footnote-1885126 +Node: MPFR features885231 +Node: FP Math Caution886902 +Ref: FP Math Caution-Footnote-1887952 +Node: Inexactness of computations888321 +Node: Inexact representation889280 +Node: Comparing FP Values890638 +Node: Errors accumulate891720 +Node: Getting Accuracy893152 +Node: Try To Round895856 +Node: Setting precision896755 +Ref: table-predefined-precision-strings897439 +Node: Setting the rounding mode899268 +Ref: table-gawk-rounding-modes899632 +Ref: Setting the rounding mode-Footnote-1903084 +Node: Arbitrary Precision Integers903263 +Ref: Arbitrary Precision Integers-Footnote-1906247 +Node: POSIX Floating Point Problems906396 +Ref: POSIX Floating Point Problems-Footnote-1910275 +Node: Floating point summary910313 +Node: Dynamic Extensions912509 +Node: Extension Intro914061 +Node: Plugin License915327 +Node: Extension Mechanism Outline916124 +Ref: figure-load-extension916552 +Ref: figure-register-new-function918032 +Ref: figure-call-new-function919036 +Node: Extension API Description921022 +Node: Extension API Functions Introduction922472 +Node: General Data Types927296 +Ref: General Data Types-Footnote-1933035 +Node: Memory Allocation Functions933334 +Ref: Memory Allocation Functions-Footnote-1936173 +Node: Constructor Functions936269 +Node: Registration Functions938003 +Node: Extension Functions938688 +Node: Exit Callback Functions940985 +Node: Extension Version String942233 +Node: Input Parsers942898 +Node: Output Wrappers952777 +Node: Two-way processors957292 +Node: Printing Messages959496 +Ref: Printing Messages-Footnote-1960572 +Node: Updating `ERRNO'960724 +Node: Requesting Values961464 +Ref: table-value-types-returned962192 +Node: Accessing Parameters963149 +Node: Symbol Table Access964380 +Node: Symbol table by name964894 +Node: Symbol table by cookie966875 +Ref: Symbol table by cookie-Footnote-1971019 +Node: Cached values971082 +Ref: Cached values-Footnote-1974581 +Node: Array Manipulation974672 +Ref: Array Manipulation-Footnote-1975770 +Node: Array Data Types975807 +Ref: Array Data Types-Footnote-1978462 +Node: Array Functions978554 +Node: Flattening Arrays982408 +Node: Creating Arrays989300 +Node: Extension API Variables994071 +Node: Extension Versioning994707 +Node: Extension API Informational Variables996608 +Node: Extension API Boilerplate997673 +Node: Finding Extensions1001482 +Node: Extension Example1002042 +Node: Internal File Description1002814 +Node: Internal File Ops1006881 +Ref: Internal File Ops-Footnote-11018551 +Node: Using Internal File Ops1018691 +Ref: Using Internal File Ops-Footnote-11021074 +Node: Extension Samples1021347 +Node: Extension Sample File Functions1022873 +Node: Extension Sample Fnmatch1030511 +Node: Extension Sample Fork1032002 +Node: Extension Sample Inplace1033217 +Node: Extension Sample Ord1034892 +Node: Extension Sample Readdir1035728 +Ref: table-readdir-file-types1036604 +Node: Extension Sample Revout1037415 +Node: Extension Sample Rev2way1038005 +Node: Extension Sample Read write array1038745 +Node: Extension Sample Readfile1040685 +Node: Extension Sample Time1041780 +Node: Extension Sample API Tests1043129 +Node: gawkextlib1043620 +Node: Extension summary1046278 +Node: Extension Exercises1049967 +Node: Language History1050689 +Node: V7/SVR3.11052345 +Node: SVR41054526 +Node: POSIX1055971 +Node: BTL1057360 +Node: POSIX/GNU1058094 +Node: Feature History1063658 +Node: Common Extensions1076756 +Node: Ranges and Locales1078080 +Ref: Ranges and Locales-Footnote-11082698 +Ref: Ranges and Locales-Footnote-21082725 +Ref: Ranges and Locales-Footnote-31082959 +Node: Contributors1083180 +Node: History summary1088721 +Node: Installation1090091 +Node: Gawk Distribution1091037 +Node: Getting1091521 +Node: Extracting1092344 +Node: Distribution contents1093979 +Node: Unix Installation1099696 +Node: Quick Installation1100313 +Node: Additional Configuration Options1102737 +Node: Configuration Philosophy1104475 +Node: Non-Unix Installation1106844 +Node: PC Installation1107302 +Node: PC Binary Installation1108621 +Node: PC Compiling1110469 +Ref: PC Compiling-Footnote-11113490 +Node: PC Testing1113599 +Node: PC Using1114775 +Node: Cygwin1118890 +Node: MSYS1119713 +Node: VMS Installation1120213 +Node: VMS Compilation1121005 +Ref: VMS Compilation-Footnote-11122227 +Node: VMS Dynamic Extensions1122285 +Node: VMS Installation Details1123969 +Node: VMS Running1126221 +Node: VMS GNV1129057 +Node: VMS Old Gawk1129791 +Node: Bugs1130261 +Node: Other Versions1134144 +Node: Installation summary1140568 +Node: Notes1141624 +Node: Compatibility Mode1142489 +Node: Additions1143271 +Node: Accessing The Source1144196 +Node: Adding Code1145631 +Node: New Ports1151788 +Node: Derived Files1156270 +Ref: Derived Files-Footnote-11161745 +Ref: Derived Files-Footnote-21161779 +Ref: Derived Files-Footnote-31162375 +Node: Future Extensions1162489 +Node: Implementation Limitations1163095 +Node: Extension Design1164343 +Node: Old Extension Problems1165497 +Ref: Old Extension Problems-Footnote-11167014 +Node: Extension New Mechanism Goals1167071 +Ref: Extension New Mechanism Goals-Footnote-11170431 +Node: Extension Other Design Decisions1170620 +Node: Extension Future Growth1172728 +Node: Old Extension Mechanism1173564 +Node: Notes summary1175326 +Node: Basic Concepts1176512 +Node: Basic High Level1177193 +Ref: figure-general-flow1177465 +Ref: figure-process-flow1178064 +Ref: Basic High Level-Footnote-11181293 +Node: Basic Data Typing1181478 +Node: Glossary1184806 +Node: Copying1216735 +Node: GNU Free Documentation License1254291 +Node: Index1279427  End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index ed7f4610..8cb24eaa 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -30134,7 +30134,7 @@ paper and pencil (and/or a calculator). In theory, numbers can have an arbitrary number of digits on either side (or both sides) of the decimal point, and the results of a computation are always exact. -Some modern system can do decimal arithmetic in hardware, but usually you +Some modern systems can do decimal arithmetic in hardware, but usually you need a special software library to provide access to these instructions. There are also libraries that do decimal arithmetic entirely in software. @@ -30190,8 +30190,34 @@ signed. The possible ranges of values are shown in @ref{table-numeric-ranges}. @item 32-bit unsigned integer @tab 0 @tab 4,294,967,295 @item 64-bit signed integer @tab @minus{}9,223,372,036,854,775,808 @tab 9,223,372,036,854,775,807 @item 64-bit unsigned integer @tab 0 @tab 18,446,744,073,709,551,615 -@item Single-precision floating point (approximate) @tab @code{1.175494e-38} @tab @code{3.402823e+38} -@item Double-precision floating point (approximate) @tab @code{2.225074e-308} @tab @code{1.797693e+308} +@iftex +@item Single-precision floating point (approximate) @tab @math{1.175494^{-38}} @tab @math{3.402823^{38}} +@item Double-precision floating point (approximate) @tab @math{2.225074^{-308}} @tab @math{1.797693^{308}} +@end iftex +@ifnottex +@ifnotdocbook +@item Single-precision floating point (approximate) @tab 1.175494e-38 @tab 3.402823e38 +@item Double-precision floating point (approximate) @tab 2.225074e-308 @tab 1.797693e308 +@end ifnotdocbook +@end ifnottex +@ifdocbook +@item Single-precision floating point (approximate) @tab +@docbook +1.175494-38 +@end docbook +@tab +@docbook +3.40282338 +@end docbook +@item Double-precision floating point (approximate) @tab +@docbook +2.225074-308 +@end docbook +@tab +@docbook +1.797693308 +@end docbook +@end ifdocbook @end multitable @end float @@ -30200,7 +30226,7 @@ signed. The possible ranges of values are shown in @ref{table-numeric-ranges}. The rest of this @value{CHAPTER} uses a number of terms. Here are some informal definitions that should help you work your way through the material -here. +here: @table @dfn @item Accuracy @@ -30221,7 +30247,7 @@ A special value representing infinity. Operations involving another number and infinity produce infinity. @item NaN -``Not A Number.''@footnote{Thanks to Michael Brennan for this description, +``Not a number.''@footnote{Thanks to Michael Brennan for this description, which we have paraphrased, and for the examples.} A special value that results from attempting a calculation that has no answer as a real number. In such a case, programs can either receive a floating-point exception, @@ -30264,8 +30290,8 @@ formula: @end display @noindent -Here, @var{prec} denotes the binary precision -(measured in bits) and @var{dps} (short for decimal places) +Here, @emph{prec} denotes the binary precision +(measured in bits) and @emph{dps} (short for decimal places) is the decimal digits. @item Rounding mode @@ -30273,7 +30299,7 @@ How numbers are rounded up or down when necessary. More details are provided later. @item Significand -A floating-point value consists the significand multiplied by 10 +A floating-point value consists of the significand multiplied by 10 to the power of the exponent. For example, in @code{1.2345e67}, the significand is @code{1.2345}. @@ -30297,7 +30323,7 @@ to allow greater precisions and larger exponent ranges. (@command{awk} uses only the 64-bit double-precision format.) @ref{table-ieee-formats} lists the precision and exponent -field values for the basic IEEE 754 binary formats: +field values for the basic IEEE 754 binary formats. @float Table,table-ieee-formats @caption{Basic IEEE format values} @@ -30361,12 +30387,12 @@ for more information. @author Teen Talk Barbie, July 1992 @end quotation -This @value{SECTION} provides a high level overview of the issues +This @value{SECTION} provides a high-level overview of the issues involved when doing lots of floating-point arithmetic.@footnote{There is a very nice @uref{http://www.validlab.com/goldberg/paper.pdf, paper on floating-point arithmetic} by David Goldberg, ``What Every -Computer Scientist Should Know About Floating-point Arithmetic,'' -@cite{ACM Computing Surveys} @strong{23}, 1 (1991-03), 5-48. This is +Computer Scientist Should Know About Floating-Point Arithmetic,'' +@cite{ACM Computing Surveys} @strong{23}, 1 (1991-03): 5-48. This is worth reading if you are interested in the details, but it does require a background in computer science.} The discussion applies to both hardware and arbitrary-precision @@ -30435,7 +30461,7 @@ $ @kbd{gawk 'BEGIN @{ x = 0.875; y = 0.425} Often the error is so small you do not even notice it, and if you do, you can always specify how much precision you would like in your output. -Usually this is a format string like @code{"%.15g"}, which when +Usually this is a format string like @code{"%.15g"}, which, when used in the previous example, produces an output identical to the input. @node Comparing FP Values @@ -30474,7 +30500,7 @@ else The loss of accuracy during a single computation with floating-point numbers usually isn't enough to worry about. However, if you compute a -value which is the result of a sequence of floating-point operations, +value that is the result of a sequence of floating-point operations, the error can accumulate and greatly affect the computation itself. Here is an attempt to compute the value of @value{PI} using one of its many series representations: @@ -30527,7 +30553,7 @@ no easy answers. The standard rules of algebra often do not apply when using floating-point arithmetic. Among other things, the distributive and associative laws do not hold completely, and order of operation may be important -for your computation. Rounding error, cumulative precision loss +for your computation. Rounding error, cumulative precision loss, and underflow are often troublesome. When @command{gawk} tests the expressions @samp{0.1 + 12.2} and @@ -30567,7 +30593,8 @@ by our earlier attempt to compute the value of @value{PI}. Extra precision can greatly enhance the stability and the accuracy of your computation in such cases. -Repeated addition is not necessarily equivalent to multiplication +Additionally, you should understand that +repeated addition is not necessarily equivalent to multiplication in floating-point arithmetic. In the example in @ref{Errors accumulate}: @@ -30630,7 +30657,7 @@ to emulate an IEEE 754 binary format. @float Table,table-predefined-precision-strings @caption{Predefined precision strings for @code{PREC}} @multitable {@code{"double"}} {12345678901234567890123456789012345} -@headitem @code{PREC} @tab IEEE 754 Binary Format +@headitem @code{PREC} @tab IEEE 754 binary format @item @code{"half"} @tab 16-bit half-precision @item @code{"single"} @tab Basic 32-bit single precision @item @code{"double"} @tab Basic 64-bit double precision @@ -30662,7 +30689,6 @@ than the default and cannot use a command-line assignment to @code{PREC}, you should either specify the constant as a string, or as a rational number, whenever possible. The following example illustrates the differences among various ways to print a floating-point constant: -@end quotation @example $ @kbd{gawk -M 'BEGIN @{ PREC = 113; printf("%0.25f\n", 0.1) @}'} @@ -30674,22 +30700,23 @@ $ @kbd{gawk -M 'BEGIN @{ PREC = 113; printf("%0.25f\n", "0.1") @}'} $ @kbd{gawk -M 'BEGIN @{ PREC = 113; printf("%0.25f\n", 1/10) @}'} @print{} 0.1000000000000000000000000 @end example +@end quotation @node Setting the rounding mode @subsection Setting the Rounding Mode The @code{ROUNDMODE} variable provides -program level control over the rounding mode. +program-level control over the rounding mode. The correspondence between @code{ROUNDMODE} and the IEEE rounding modes is shown in @ref{table-gawk-rounding-modes}. @float Table,table-gawk-rounding-modes @caption{@command{gawk} rounding modes} @multitable @columnfractions .45 .30 .25 -@headitem Rounding Mode @tab IEEE Name @tab @code{ROUNDMODE} +@headitem Rounding mode @tab IEEE name @tab @code{ROUNDMODE} @item Round to nearest, ties to even @tab @code{roundTiesToEven} @tab @code{"N"} or @code{"n"} -@item Round toward plus Infinity @tab @code{roundTowardPositive} @tab @code{"U"} or @code{"u"} -@item Round toward negative Infinity @tab @code{roundTowardNegative} @tab @code{"D"} or @code{"d"} +@item Round toward positive infinity @tab @code{roundTowardPositive} @tab @code{"U"} or @code{"u"} +@item Round toward negative infinity @tab @code{roundTowardNegative} @tab @code{"D"} or @code{"d"} @item Round toward zero @tab @code{roundTowardZero} @tab @code{"Z"} or @code{"z"} @item Round to nearest, ties away from zero @tab @code{roundTiesToAway} @tab @code{"A"} or @code{"a"} @end multitable @@ -30750,8 +30777,8 @@ distributes upward and downward rounds of exact halves, which might cause any accumulating round-off error to cancel itself out. This is the default rounding mode for IEEE 754 computing functions and operators. -The other rounding modes are rarely used. Round toward positive infinity -(@code{roundTowardPositive}) and round toward negative infinity +The other rounding modes are rarely used. Rounding toward positive infinity +(@code{roundTowardPositive}) and toward negative infinity (@code{roundTowardNegative}) are often used to implement interval arithmetic, where you adjust the rounding mode to calculate upper and lower bounds for the range of output. The @code{roundTowardZero} mode can @@ -30808,17 +30835,17 @@ If instead you were to compute the same value using arbitrary-precision floating-point values, the precision needed for correct output (using the formula @iftex -@math{prec = 3.322 @cdot dps}), +@math{prec = 3.322 @cdot dps}) would be @math{3.322 @cdot 183231}, @end iftex @ifnottex @ifnotdocbook -@samp{prec = 3.322 * dps}), +@samp{prec = 3.322 * dps}) would be 3.322 x 183231, @end ifnotdocbook @end ifnottex @docbook -prec = 3.322 ⋅ dps), +prec = 3.322 ⋅ dps) would be prec = 3.322 ⋅ 183231, @c @end docbook @@ -30856,7 +30883,7 @@ interface to process arbitrary-precision integers or mixed-mode numbers as needed by an operation or function. In such a case, the precision is set to the minimum value necessary for exact conversion, and the working precision is not used for this purpose. If this is not what you need or -want, you can employ a subterfuge, and convert the integer to floating +want, you can employ a subterfuge and convert the integer to floating point first, like this: @example @@ -30880,7 +30907,7 @@ gawk -M 'BEGIN @{ n = 13; print n % 2 @}' @node POSIX Floating Point Problems @section Standards Versus Existing Practice -Historically, @command{awk} has converted any non-numeric looking string +Historically, @command{awk} has converted any nonnumeric-looking string to the numeric value zero, when required. Furthermore, the original definition of the language and the original POSIX standards specified that @command{awk} only understands decimal numbers (base 10), and not octal @@ -30897,8 +30924,8 @@ notation (e.g., @code{0xDEADBEEF}). (Note: data values, @emph{not} source code constants.) @item -Support for the special IEEE 754 floating-point values ``Not A Number'' -(NaN), positive Infinity (``inf''), and negative Infinity (``@minus{}inf''). +Support for the special IEEE 754 floating-point values ``not a number'' +(NaN), positive infinity (``inf''), and negative infinity (``@minus{}inf''). In particular, the format for these values is as specified by the ISO 1999 C standard, which ignores case and can allow implementation-dependent additional characters after the @samp{nan} and allow either @samp{inf} or @samp{infinity}. @@ -30919,21 +30946,21 @@ values is also a very severe departure from historical practice. @end itemize The second problem is that the @command{gawk} maintainer feels that this -interpretation of the standard, which requires a certain amount of +interpretation of the standard, which required a certain amount of ``language lawyering'' to arrive at in the first place, was not even -intended by the standard developers. In other words, ``we see how you +intended by the standard developers. In other words, ``We see how you got where you are, but we don't think that that's where you want to be.'' Recognizing these issues, but attempting to provide compatibility with the earlier versions of the standard, the 2008 POSIX standard added explicit wording to allow, but not require, that @command{awk} support hexadecimal floating-point values and -special values for ``Not A Number'' and infinity. +special values for ``not a number'' and infinity. Although the @command{gawk} maintainer continues to feel that providing those features is inadvisable, nevertheless, on systems that support IEEE floating point, it seems -reasonable to provide @emph{some} way to support NaN and Infinity values. +reasonable to provide @emph{some} way to support NaN and infinity values. The solution implemented in @command{gawk} is as follows: @itemize @value{BULLET} @@ -30953,7 +30980,7 @@ $ @kbd{echo 0xDeadBeef | gawk --posix '@{ print $1 + 0 @}'} @end example @item -Without @option{--posix}, @command{gawk} interprets the four strings +Without @option{--posix}, @command{gawk} interprets the four string values @samp{+inf}, @samp{-inf}, @samp{+nan}, @@ -30975,7 +31002,7 @@ $ @kbd{echo 0xDeadBeef | gawk '@{ print $1 + 0 @}'} @end example @command{gawk} ignores case in the four special values. -Thus @samp{+nan} and @samp{+NaN} are the same. +Thus, @samp{+nan} and @samp{+NaN} are the same. @end itemize @node Floating point summary @@ -30988,9 +31015,9 @@ values. Standard @command{awk} uses double-precision floating-point values. @item -In the early 1990s, Barbie mistakenly said ``Math class is tough!'' +In the early 1990s Barbie mistakenly said, ``Math class is tough!'' Although math isn't tough, floating-point arithmetic isn't the same -as pencil and paper math, and care must be taken: +as pencil-and-paper math, and care must be taken: @c nested list @itemize @value{MINUS} @@ -31023,7 +31050,7 @@ arithmetic. Use @code{PREC} to set the precision in bits, and @item With @option{-M}, @command{gawk} performs arbitrary-precision integer arithmetic using the GMP library. -This is faster and more space efficient than using MPFR for +This is faster and more space-efficient than using MPFR for the same calculations. @item @@ -31035,7 +31062,7 @@ It pays to be aware of them. Overall, there is no need to be unduly suspicious about the results from floating-point arithmetic. The lesson to remember is that floating-point arithmetic is always more complex than arithmetic using pencil and -paper. In order to take advantage of the power of computer floating point, +paper. In order to take advantage of the power of floating-point arithmetic, you need to know its limitations and work within them. For most casual use of floating-point arithmetic, you will often get the expected result if you simply round the display of your final results to the correct number diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 1156ffd5..7c229020 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -29225,7 +29225,7 @@ paper and pencil (and/or a calculator). In theory, numbers can have an arbitrary number of digits on either side (or both sides) of the decimal point, and the results of a computation are always exact. -Some modern system can do decimal arithmetic in hardware, but usually you +Some modern systems can do decimal arithmetic in hardware, but usually you need a special software library to provide access to these instructions. There are also libraries that do decimal arithmetic entirely in software. @@ -29281,8 +29281,34 @@ signed. The possible ranges of values are shown in @ref{table-numeric-ranges}. @item 32-bit unsigned integer @tab 0 @tab 4,294,967,295 @item 64-bit signed integer @tab @minus{}9,223,372,036,854,775,808 @tab 9,223,372,036,854,775,807 @item 64-bit unsigned integer @tab 0 @tab 18,446,744,073,709,551,615 -@item Single-precision floating point (approximate) @tab @code{1.175494e-38} @tab @code{3.402823e+38} -@item Double-precision floating point (approximate) @tab @code{2.225074e-308} @tab @code{1.797693e+308} +@iftex +@item Single-precision floating point (approximate) @tab @math{1.175494^{-38}} @tab @math{3.402823^{38}} +@item Double-precision floating point (approximate) @tab @math{2.225074^{-308}} @tab @math{1.797693^{308}} +@end iftex +@ifnottex +@ifnotdocbook +@item Single-precision floating point (approximate) @tab 1.175494e-38 @tab 3.402823e38 +@item Double-precision floating point (approximate) @tab 2.225074e-308 @tab 1.797693e308 +@end ifnotdocbook +@end ifnottex +@ifdocbook +@item Single-precision floating point (approximate) @tab +@docbook +1.175494-38 +@end docbook +@tab +@docbook +3.40282338 +@end docbook +@item Double-precision floating point (approximate) @tab +@docbook +2.225074-308 +@end docbook +@tab +@docbook +1.797693308 +@end docbook +@end ifdocbook @end multitable @end float @@ -29291,7 +29317,7 @@ signed. The possible ranges of values are shown in @ref{table-numeric-ranges}. The rest of this @value{CHAPTER} uses a number of terms. Here are some informal definitions that should help you work your way through the material -here. +here: @table @dfn @item Accuracy @@ -29312,7 +29338,7 @@ A special value representing infinity. Operations involving another number and infinity produce infinity. @item NaN -``Not A Number.''@footnote{Thanks to Michael Brennan for this description, +``Not a number.''@footnote{Thanks to Michael Brennan for this description, which we have paraphrased, and for the examples.} A special value that results from attempting a calculation that has no answer as a real number. In such a case, programs can either receive a floating-point exception, @@ -29355,8 +29381,8 @@ formula: @end display @noindent -Here, @var{prec} denotes the binary precision -(measured in bits) and @var{dps} (short for decimal places) +Here, @emph{prec} denotes the binary precision +(measured in bits) and @emph{dps} (short for decimal places) is the decimal digits. @item Rounding mode @@ -29364,7 +29390,7 @@ How numbers are rounded up or down when necessary. More details are provided later. @item Significand -A floating-point value consists the significand multiplied by 10 +A floating-point value consists of the significand multiplied by 10 to the power of the exponent. For example, in @code{1.2345e67}, the significand is @code{1.2345}. @@ -29388,7 +29414,7 @@ to allow greater precisions and larger exponent ranges. (@command{awk} uses only the 64-bit double-precision format.) @ref{table-ieee-formats} lists the precision and exponent -field values for the basic IEEE 754 binary formats: +field values for the basic IEEE 754 binary formats. @float Table,table-ieee-formats @caption{Basic IEEE format values} @@ -29452,12 +29478,12 @@ for more information. @author Teen Talk Barbie, July 1992 @end quotation -This @value{SECTION} provides a high level overview of the issues +This @value{SECTION} provides a high-level overview of the issues involved when doing lots of floating-point arithmetic.@footnote{There is a very nice @uref{http://www.validlab.com/goldberg/paper.pdf, paper on floating-point arithmetic} by David Goldberg, ``What Every -Computer Scientist Should Know About Floating-point Arithmetic,'' -@cite{ACM Computing Surveys} @strong{23}, 1 (1991-03), 5-48. This is +Computer Scientist Should Know About Floating-Point Arithmetic,'' +@cite{ACM Computing Surveys} @strong{23}, 1 (1991-03): 5-48. This is worth reading if you are interested in the details, but it does require a background in computer science.} The discussion applies to both hardware and arbitrary-precision @@ -29526,7 +29552,7 @@ $ @kbd{gawk 'BEGIN @{ x = 0.875; y = 0.425} Often the error is so small you do not even notice it, and if you do, you can always specify how much precision you would like in your output. -Usually this is a format string like @code{"%.15g"}, which when +Usually this is a format string like @code{"%.15g"}, which, when used in the previous example, produces an output identical to the input. @node Comparing FP Values @@ -29565,7 +29591,7 @@ else The loss of accuracy during a single computation with floating-point numbers usually isn't enough to worry about. However, if you compute a -value which is the result of a sequence of floating-point operations, +value that is the result of a sequence of floating-point operations, the error can accumulate and greatly affect the computation itself. Here is an attempt to compute the value of @value{PI} using one of its many series representations: @@ -29618,7 +29644,7 @@ no easy answers. The standard rules of algebra often do not apply when using floating-point arithmetic. Among other things, the distributive and associative laws do not hold completely, and order of operation may be important -for your computation. Rounding error, cumulative precision loss +for your computation. Rounding error, cumulative precision loss, and underflow are often troublesome. When @command{gawk} tests the expressions @samp{0.1 + 12.2} and @@ -29658,7 +29684,8 @@ by our earlier attempt to compute the value of @value{PI}. Extra precision can greatly enhance the stability and the accuracy of your computation in such cases. -Repeated addition is not necessarily equivalent to multiplication +Additionally, you should understand that +repeated addition is not necessarily equivalent to multiplication in floating-point arithmetic. In the example in @ref{Errors accumulate}: @@ -29721,7 +29748,7 @@ to emulate an IEEE 754 binary format. @float Table,table-predefined-precision-strings @caption{Predefined precision strings for @code{PREC}} @multitable {@code{"double"}} {12345678901234567890123456789012345} -@headitem @code{PREC} @tab IEEE 754 Binary Format +@headitem @code{PREC} @tab IEEE 754 binary format @item @code{"half"} @tab 16-bit half-precision @item @code{"single"} @tab Basic 32-bit single precision @item @code{"double"} @tab Basic 64-bit double precision @@ -29753,7 +29780,6 @@ than the default and cannot use a command-line assignment to @code{PREC}, you should either specify the constant as a string, or as a rational number, whenever possible. The following example illustrates the differences among various ways to print a floating-point constant: -@end quotation @example $ @kbd{gawk -M 'BEGIN @{ PREC = 113; printf("%0.25f\n", 0.1) @}'} @@ -29765,22 +29791,23 @@ $ @kbd{gawk -M 'BEGIN @{ PREC = 113; printf("%0.25f\n", "0.1") @}'} $ @kbd{gawk -M 'BEGIN @{ PREC = 113; printf("%0.25f\n", 1/10) @}'} @print{} 0.1000000000000000000000000 @end example +@end quotation @node Setting the rounding mode @subsection Setting the Rounding Mode The @code{ROUNDMODE} variable provides -program level control over the rounding mode. +program-level control over the rounding mode. The correspondence between @code{ROUNDMODE} and the IEEE rounding modes is shown in @ref{table-gawk-rounding-modes}. @float Table,table-gawk-rounding-modes @caption{@command{gawk} rounding modes} @multitable @columnfractions .45 .30 .25 -@headitem Rounding Mode @tab IEEE Name @tab @code{ROUNDMODE} +@headitem Rounding mode @tab IEEE name @tab @code{ROUNDMODE} @item Round to nearest, ties to even @tab @code{roundTiesToEven} @tab @code{"N"} or @code{"n"} -@item Round toward plus Infinity @tab @code{roundTowardPositive} @tab @code{"U"} or @code{"u"} -@item Round toward negative Infinity @tab @code{roundTowardNegative} @tab @code{"D"} or @code{"d"} +@item Round toward positive infinity @tab @code{roundTowardPositive} @tab @code{"U"} or @code{"u"} +@item Round toward negative infinity @tab @code{roundTowardNegative} @tab @code{"D"} or @code{"d"} @item Round toward zero @tab @code{roundTowardZero} @tab @code{"Z"} or @code{"z"} @item Round to nearest, ties away from zero @tab @code{roundTiesToAway} @tab @code{"A"} or @code{"a"} @end multitable @@ -29841,8 +29868,8 @@ distributes upward and downward rounds of exact halves, which might cause any accumulating round-off error to cancel itself out. This is the default rounding mode for IEEE 754 computing functions and operators. -The other rounding modes are rarely used. Round toward positive infinity -(@code{roundTowardPositive}) and round toward negative infinity +The other rounding modes are rarely used. Rounding toward positive infinity +(@code{roundTowardPositive}) and toward negative infinity (@code{roundTowardNegative}) are often used to implement interval arithmetic, where you adjust the rounding mode to calculate upper and lower bounds for the range of output. The @code{roundTowardZero} mode can @@ -29899,17 +29926,17 @@ If instead you were to compute the same value using arbitrary-precision floating-point values, the precision needed for correct output (using the formula @iftex -@math{prec = 3.322 @cdot dps}), +@math{prec = 3.322 @cdot dps}) would be @math{3.322 @cdot 183231}, @end iftex @ifnottex @ifnotdocbook -@samp{prec = 3.322 * dps}), +@samp{prec = 3.322 * dps}) would be 3.322 x 183231, @end ifnotdocbook @end ifnottex @docbook -prec = 3.322 ⋅ dps), +prec = 3.322 ⋅ dps) would be prec = 3.322 ⋅ 183231, @c @end docbook @@ -29947,7 +29974,7 @@ interface to process arbitrary-precision integers or mixed-mode numbers as needed by an operation or function. In such a case, the precision is set to the minimum value necessary for exact conversion, and the working precision is not used for this purpose. If this is not what you need or -want, you can employ a subterfuge, and convert the integer to floating +want, you can employ a subterfuge and convert the integer to floating point first, like this: @example @@ -29971,7 +29998,7 @@ gawk -M 'BEGIN @{ n = 13; print n % 2 @}' @node POSIX Floating Point Problems @section Standards Versus Existing Practice -Historically, @command{awk} has converted any non-numeric looking string +Historically, @command{awk} has converted any nonnumeric-looking string to the numeric value zero, when required. Furthermore, the original definition of the language and the original POSIX standards specified that @command{awk} only understands decimal numbers (base 10), and not octal @@ -29988,8 +30015,8 @@ notation (e.g., @code{0xDEADBEEF}). (Note: data values, @emph{not} source code constants.) @item -Support for the special IEEE 754 floating-point values ``Not A Number'' -(NaN), positive Infinity (``inf''), and negative Infinity (``@minus{}inf''). +Support for the special IEEE 754 floating-point values ``not a number'' +(NaN), positive infinity (``inf''), and negative infinity (``@minus{}inf''). In particular, the format for these values is as specified by the ISO 1999 C standard, which ignores case and can allow implementation-dependent additional characters after the @samp{nan} and allow either @samp{inf} or @samp{infinity}. @@ -30010,21 +30037,21 @@ values is also a very severe departure from historical practice. @end itemize The second problem is that the @command{gawk} maintainer feels that this -interpretation of the standard, which requires a certain amount of +interpretation of the standard, which required a certain amount of ``language lawyering'' to arrive at in the first place, was not even -intended by the standard developers. In other words, ``we see how you +intended by the standard developers. In other words, ``We see how you got where you are, but we don't think that that's where you want to be.'' Recognizing these issues, but attempting to provide compatibility with the earlier versions of the standard, the 2008 POSIX standard added explicit wording to allow, but not require, that @command{awk} support hexadecimal floating-point values and -special values for ``Not A Number'' and infinity. +special values for ``not a number'' and infinity. Although the @command{gawk} maintainer continues to feel that providing those features is inadvisable, nevertheless, on systems that support IEEE floating point, it seems -reasonable to provide @emph{some} way to support NaN and Infinity values. +reasonable to provide @emph{some} way to support NaN and infinity values. The solution implemented in @command{gawk} is as follows: @itemize @value{BULLET} @@ -30044,7 +30071,7 @@ $ @kbd{echo 0xDeadBeef | gawk --posix '@{ print $1 + 0 @}'} @end example @item -Without @option{--posix}, @command{gawk} interprets the four strings +Without @option{--posix}, @command{gawk} interprets the four string values @samp{+inf}, @samp{-inf}, @samp{+nan}, @@ -30066,7 +30093,7 @@ $ @kbd{echo 0xDeadBeef | gawk '@{ print $1 + 0 @}'} @end example @command{gawk} ignores case in the four special values. -Thus @samp{+nan} and @samp{+NaN} are the same. +Thus, @samp{+nan} and @samp{+NaN} are the same. @end itemize @node Floating point summary @@ -30079,9 +30106,9 @@ values. Standard @command{awk} uses double-precision floating-point values. @item -In the early 1990s, Barbie mistakenly said ``Math class is tough!'' +In the early 1990s Barbie mistakenly said, ``Math class is tough!'' Although math isn't tough, floating-point arithmetic isn't the same -as pencil and paper math, and care must be taken: +as pencil-and-paper math, and care must be taken: @c nested list @itemize @value{MINUS} @@ -30114,7 +30141,7 @@ arithmetic. Use @code{PREC} to set the precision in bits, and @item With @option{-M}, @command{gawk} performs arbitrary-precision integer arithmetic using the GMP library. -This is faster and more space efficient than using MPFR for +This is faster and more space-efficient than using MPFR for the same calculations. @item @@ -30126,7 +30153,7 @@ It pays to be aware of them. Overall, there is no need to be unduly suspicious about the results from floating-point arithmetic. The lesson to remember is that floating-point arithmetic is always more complex than arithmetic using pencil and -paper. In order to take advantage of the power of computer floating point, +paper. In order to take advantage of the power of floating-point arithmetic, you need to know its limitations and work within them. For most casual use of floating-point arithmetic, you will often get the expected result if you simply round the display of your final results to the correct number -- cgit v1.2.3 From f2e05556f6962e41556c4abb0acc900c82acc672 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 9 Feb 2015 22:56:29 +0200 Subject: Continue O'Reilly edits. --- doc/ChangeLog | 4 + doc/gawk.info | 801 ++++++++++++++++++++++++++++---------------------------- doc/gawk.texi | 28 +- doc/gawktexi.in | 28 +- 4 files changed, 438 insertions(+), 423 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 319ecb2f..b6de5797 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2015-02-09 Arnold D. Robbins + + * gawktexi.in: Restore a lost sentence. O'Reilly fixes. + 2015-02-08 Arnold D. Robbins * gawktexi.in: O'Reilly fixes. diff --git a/doc/gawk.info b/doc/gawk.info index c56ac89c..bf573a8a 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -9071,9 +9071,10 @@ accepts any record with a first field that contains `li': -| 555-5553 -| 555-6699 - pattern. The expression `/li/' has the value one if `li' appears in -the current input record. Thus, as a pattern, `/li/' matches any record -containing `li'. + A regexp constant as a pattern is also a special case of an +expression pattern. The expression `/li/' has the value one if `li' +appears in the current input record. Thus, as a pattern, `/li/' matches +any record containing `li'. Boolean expressions are also commonly used as patterns. Whether the pattern matches an input record depends on whether its subexpressions @@ -22636,7 +22637,7 @@ the rest of this Info file. `gawk''s functionality. For example, they can provide access to system calls (such as `chdir()' to change directory) and to other C library routines that could be of use. As with most software, "the sky is the -limit;" if you can imagine something that you might want to do and can +limit"; if you can imagine something that you might want to do and can write in C or C++, you can write an extension to do it! Extensions are written in C or C++, using the "application @@ -22644,7 +22645,7 @@ programming interface" (API) defined for this purpose by the `gawk' developers. The rest of this major node explains the facilities that the API provides and how to use them, and presents a small example extension. In addition, it documents the sample extensions included in -the `gawk' distribution, and describes the `gawkextlib' project. *Note +the `gawk' distribution and describes the `gawkextlib' project. *Note Extension Design::, for a discussion of the extension mechanism goals and design. @@ -22762,7 +22763,7 @@ Example::) and also in the `testext.c' code for testing the APIs. Some other bits and pieces: * The API provides access to `gawk''s `do_XXX' values, reflecting - command-line options, like `do_lint', `do_profiling' and so on + command-line options, like `do_lint', `do_profiling', and so on (*note Extension API Variables::). These are informational: an extension cannot affect their values inside `gawk'. In addition, attempting to assign to them produces a compile-time error. @@ -22808,8 +22809,8 @@ File: gawk.info, Node: Extension API Functions Introduction, Next: General Dat 16.4.1 Introduction ------------------- -Access to facilities within `gawk' are made available by calling -through function pointers passed into your extension. +Access to facilities within `gawk' is achieved by calling through +function pointers passed into your extension. API function pointers are provided for the following kinds of operations: @@ -22830,7 +22831,7 @@ operations: - Two-way processors - All of these are discussed in detail, later in this major node. + All of these are discussed in detail later in this major node. * Printing fatal, warning, and "lint" warning messages. @@ -22856,7 +22857,7 @@ operations: - Clearing an array - - Flattening an array for easy C style looping over all its + - Flattening an array for easy C-style looping over all its indices and elements Some points about using the API: @@ -22865,7 +22866,7 @@ operations: `gawkapi.h'. For correct use, you must therefore include the corresponding standard header file _before_ including `gawkapi.h': - C Entity Header File + C entity Header file ------------------------------------------- `EOF' `' Values for `errno' `' @@ -22889,13 +22890,13 @@ operations: * Although the API only uses ISO C 90 features, there is an exception; the "constructor" functions use the `inline' keyword. If your compiler does not support this keyword, you should either - place `-Dinline=''' on your command line, or use the GNU Autotools + place `-Dinline=''' on your command line or use the GNU Autotools and include a `config.h' file in your extensions. * All pointers filled in by `gawk' point to memory managed by `gawk' and should be treated by the extension as read-only. Memory for _all_ strings passed into `gawk' from the extension _must_ come - from calling one of `gawk_malloc()', `gawk_calloc()' or + from calling one of `gawk_malloc()', `gawk_calloc()', or `gawk_realloc()', and is managed by `gawk' from then on. * The API defines several simple `struct's that map values as seen @@ -22908,7 +22909,7 @@ operations: multibyte encoding (as defined by `LC_XXX' environment variables) and not using wide characters. This matches how `gawk' stores strings internally and also how characters are - likely to be input and output from files. + likely to be input into and output from files. * When retrieving a value (such as a parameter or that of a global variable or array element), the extension requests a specific type @@ -22945,6 +22946,8 @@ general-purpose use. Additional, more specialized, data structures are introduced in subsequent minor nodes, together with the functions that use them. + The general-purpose types and structures are as follows: + `typedef void *awk_ext_id_t;' A value of this type is received from `gawk' when an extension is loaded. That value must then be passed back to `gawk' as the @@ -22960,7 +22963,7 @@ use them. ` awk_false = 0,' ` awk_true' `} awk_bool_t;' - A simple boolean type. + A simple Boolean type. `typedef struct awk_string {' ` char *str; /* data */' @@ -23004,8 +23007,8 @@ use them. `#define array_cookie u.a' `#define scalar_cookie u.scl' `#define value_cookie u.vc' - These macros make accessing the fields of the `awk_value_t' more - readable. + Using these macros makes accessing the fields of the `awk_value_t' + more readable. `typedef void *awk_scalar_t;' Scalars can be represented as an opaque type. These values are @@ -31951,7 +31954,7 @@ Index * BEGIN pattern, and profiling: Profiling. (line 62) * BEGIN pattern, assert() user-defined function and: Assert Function. (line 83) -* BEGIN pattern, Boolean patterns and: Expression Patterns. (line 69) +* BEGIN pattern, Boolean patterns and: Expression Patterns. (line 70) * BEGIN pattern, exit statement and: Exit Statement. (line 12) * BEGIN pattern, getline and: Getline Notes. (line 19) * BEGIN pattern, headings, adding: Print Examples. (line 43) @@ -31968,7 +31971,7 @@ Index * BEGIN pattern, TEXTDOMAIN variable and: Programmer i18n. (line 60) * BEGINFILE pattern: BEGINFILE/ENDFILE. (line 6) * BEGINFILE pattern, Boolean patterns and: Expression Patterns. - (line 69) + (line 70) * beginfile() user-defined function: Filetrans Function. (line 62) * Bentley, Jon: Glossary. (line 207) * Benzinger, Michael: Contributors. (line 97) @@ -31994,7 +31997,7 @@ Index * body, in actions: Statements. (line 10) * body, in loops: While Statement. (line 14) * Boolean expressions: Boolean Ops. (line 6) -* Boolean expressions, as patterns: Expression Patterns. (line 38) +* Boolean expressions, as patterns: Expression Patterns. (line 39) * Boolean operators, See Boolean expressions: Boolean Ops. (line 6) * Bourne shell, quoting rules for: Quoting. (line 18) * braces ({}): Profiling. (line 142) @@ -32578,7 +32581,7 @@ Index * END pattern, and profiling: Profiling. (line 62) * END pattern, assert() user-defined function and: Assert Function. (line 75) -* END pattern, Boolean patterns and: Expression Patterns. (line 69) +* END pattern, Boolean patterns and: Expression Patterns. (line 70) * END pattern, exit statement and: Exit Statement. (line 12) * END pattern, next/nextfile statements and <1>: Next Statement. (line 44) @@ -32587,7 +32590,7 @@ Index * END pattern, operators and: Using BEGIN/END. (line 17) * END pattern, print statement and: I/O And BEGIN/END. (line 16) * ENDFILE pattern: BEGINFILE/ENDFILE. (line 6) -* ENDFILE pattern, Boolean patterns and: Expression Patterns. (line 69) +* ENDFILE pattern, Boolean patterns and: Expression Patterns. (line 70) * endfile() user-defined function: Filetrans Function. (line 62) * endgrent() function (C library): Group Functions. (line 212) * endgrent() user-defined function: Group Functions. (line 215) @@ -34649,382 +34652,382 @@ Node: Patterns and Actions384448 Node: Pattern Overview385568 Node: Regexp Patterns387247 Node: Expression Patterns387790 -Node: Ranges391499 -Node: BEGIN/END394606 -Node: Using BEGIN/END395367 -Ref: Using BEGIN/END-Footnote-1398103 -Node: I/O And BEGIN/END398209 -Node: BEGINFILE/ENDFILE400524 -Node: Empty403421 -Node: Using Shell Variables403738 -Node: Action Overview406011 -Node: Statements408337 -Node: If Statement410185 -Node: While Statement411680 -Node: Do Statement413708 -Node: For Statement414856 -Node: Switch Statement418014 -Node: Break Statement420396 -Node: Continue Statement422437 -Node: Next Statement424264 -Node: Nextfile Statement426645 -Node: Exit Statement429273 -Node: Built-in Variables431684 -Node: User-modified432817 -Ref: User-modified-Footnote-1440520 -Node: Auto-set440582 -Ref: Auto-set-Footnote-1453634 -Ref: Auto-set-Footnote-2453839 -Node: ARGC and ARGV453895 -Node: Pattern Action Summary458113 -Node: Arrays460546 -Node: Array Basics461875 -Node: Array Intro462719 -Ref: figure-array-elements464653 -Ref: Array Intro-Footnote-1467273 -Node: Reference to Elements467401 -Node: Assigning Elements469863 -Node: Array Example470354 -Node: Scanning an Array472113 -Node: Controlling Scanning475133 -Ref: Controlling Scanning-Footnote-1480527 -Node: Numeric Array Subscripts480843 -Node: Uninitialized Subscripts483028 -Node: Delete484645 -Ref: Delete-Footnote-1487394 -Node: Multidimensional487451 -Node: Multiscanning490548 -Node: Arrays of Arrays492137 -Node: Arrays Summary496891 -Node: Functions498982 -Node: Built-in500021 -Node: Calling Built-in501099 -Node: Numeric Functions503094 -Ref: Numeric Functions-Footnote-1507110 -Ref: Numeric Functions-Footnote-2507467 -Ref: Numeric Functions-Footnote-3507515 -Node: String Functions507787 -Ref: String Functions-Footnote-1531288 -Ref: String Functions-Footnote-2531417 -Ref: String Functions-Footnote-3531665 -Node: Gory Details531752 -Ref: table-sub-escapes533533 -Ref: table-sub-proposed535048 -Ref: table-posix-sub536410 -Ref: table-gensub-escapes537947 -Ref: Gory Details-Footnote-1538780 -Node: I/O Functions538931 -Ref: I/O Functions-Footnote-1546167 -Node: Time Functions546314 -Ref: Time Functions-Footnote-1556823 -Ref: Time Functions-Footnote-2556891 -Ref: Time Functions-Footnote-3557049 -Ref: Time Functions-Footnote-4557160 -Ref: Time Functions-Footnote-5557272 -Ref: Time Functions-Footnote-6557499 -Node: Bitwise Functions557765 -Ref: table-bitwise-ops558327 -Ref: Bitwise Functions-Footnote-1562655 -Node: Type Functions562827 -Node: I18N Functions563979 -Node: User-defined565626 -Node: Definition Syntax566431 -Ref: Definition Syntax-Footnote-1572090 -Node: Function Example572161 -Ref: Function Example-Footnote-1575082 -Node: Function Caveats575104 -Node: Calling A Function575622 -Node: Variable Scope576580 -Node: Pass By Value/Reference579573 -Node: Return Statement583070 -Node: Dynamic Typing586049 -Node: Indirect Calls586978 -Ref: Indirect Calls-Footnote-1598284 -Node: Functions Summary598412 -Node: Library Functions601114 -Ref: Library Functions-Footnote-1604722 -Ref: Library Functions-Footnote-2604865 -Node: Library Names605036 -Ref: Library Names-Footnote-1608494 -Ref: Library Names-Footnote-2608717 -Node: General Functions608803 -Node: Strtonum Function609906 -Node: Assert Function612928 -Node: Round Function616252 -Node: Cliff Random Function617793 -Node: Ordinal Functions618809 -Ref: Ordinal Functions-Footnote-1621872 -Ref: Ordinal Functions-Footnote-2622124 -Node: Join Function622335 -Ref: Join Function-Footnote-1624105 -Node: Getlocaltime Function624305 -Node: Readfile Function628049 -Node: Shell Quoting630021 -Node: Data File Management631422 -Node: Filetrans Function632054 -Node: Rewind Function636150 -Node: File Checking637536 -Ref: File Checking-Footnote-1638869 -Node: Empty Files639070 -Node: Ignoring Assigns641049 -Node: Getopt Function642599 -Ref: Getopt Function-Footnote-1654063 -Node: Passwd Functions654263 -Ref: Passwd Functions-Footnote-1663103 -Node: Group Functions663191 -Ref: Group Functions-Footnote-1671088 -Node: Walking Arrays671293 -Node: Library Functions Summary672893 -Node: Library Exercises674297 -Node: Sample Programs675577 -Node: Running Examples676347 -Node: Clones677075 -Node: Cut Program678299 -Node: Egrep Program688019 -Ref: Egrep Program-Footnote-1695522 -Node: Id Program695632 -Node: Split Program699308 -Ref: Split Program-Footnote-1702762 -Node: Tee Program702890 -Node: Uniq Program705679 -Node: Wc Program713098 -Ref: Wc Program-Footnote-1717348 -Node: Miscellaneous Programs717442 -Node: Dupword Program718655 -Node: Alarm Program720686 -Node: Translate Program725491 -Ref: Translate Program-Footnote-1730054 -Node: Labels Program730324 -Ref: Labels Program-Footnote-1733675 -Node: Word Sorting733759 -Node: History Sorting737829 -Node: Extract Program739664 -Node: Simple Sed747188 -Node: Igawk Program750258 -Ref: Igawk Program-Footnote-1764584 -Ref: Igawk Program-Footnote-2764785 -Ref: Igawk Program-Footnote-3764907 -Node: Anagram Program765022 -Node: Signature Program768083 -Node: Programs Summary769330 -Node: Programs Exercises770551 -Ref: Programs Exercises-Footnote-1774682 -Node: Advanced Features774773 -Node: Nondecimal Data776755 -Node: Array Sorting778345 -Node: Controlling Array Traversal779045 -Ref: Controlling Array Traversal-Footnote-1787411 -Node: Array Sorting Functions787529 -Ref: Array Sorting Functions-Footnote-1791415 -Node: Two-way I/O791611 -Ref: Two-way I/O-Footnote-1796556 -Ref: Two-way I/O-Footnote-2796742 -Node: TCP/IP Networking796824 -Node: Profiling799696 -Node: Advanced Features Summary807237 -Node: Internationalization809170 -Node: I18N and L10N810650 -Node: Explaining gettext811336 -Ref: Explaining gettext-Footnote-1816361 -Ref: Explaining gettext-Footnote-2816545 -Node: Programmer i18n816710 -Ref: Programmer i18n-Footnote-1821586 -Node: Translator i18n821635 -Node: String Extraction822429 -Ref: String Extraction-Footnote-1823560 -Node: Printf Ordering823646 -Ref: Printf Ordering-Footnote-1826432 -Node: I18N Portability826496 -Ref: I18N Portability-Footnote-1828952 -Node: I18N Example829015 -Ref: I18N Example-Footnote-1831818 -Node: Gawk I18N831890 -Node: I18N Summary832534 -Node: Debugger833874 -Node: Debugging834896 -Node: Debugging Concepts835337 -Node: Debugging Terms837147 -Node: Awk Debugging839719 -Node: Sample Debugging Session840625 -Node: Debugger Invocation841159 -Node: Finding The Bug842544 -Node: List of Debugger Commands849023 -Node: Breakpoint Control850355 -Node: Debugger Execution Control854032 -Node: Viewing And Changing Data857391 -Node: Execution Stack860767 -Node: Debugger Info862402 -Node: Miscellaneous Debugger Commands866447 -Node: Readline Support871448 -Node: Limitations872342 -Node: Debugging Summary874457 -Node: Arbitrary Precision Arithmetic875631 -Node: Computer Arithmetic877047 -Ref: table-numeric-ranges880646 -Ref: Computer Arithmetic-Footnote-1881170 -Node: Math Definitions881227 -Ref: table-ieee-formats884522 -Ref: Math Definitions-Footnote-1885126 -Node: MPFR features885231 -Node: FP Math Caution886902 -Ref: FP Math Caution-Footnote-1887952 -Node: Inexactness of computations888321 -Node: Inexact representation889280 -Node: Comparing FP Values890638 -Node: Errors accumulate891720 -Node: Getting Accuracy893152 -Node: Try To Round895856 -Node: Setting precision896755 -Ref: table-predefined-precision-strings897439 -Node: Setting the rounding mode899268 -Ref: table-gawk-rounding-modes899632 -Ref: Setting the rounding mode-Footnote-1903084 -Node: Arbitrary Precision Integers903263 -Ref: Arbitrary Precision Integers-Footnote-1906247 -Node: POSIX Floating Point Problems906396 -Ref: POSIX Floating Point Problems-Footnote-1910275 -Node: Floating point summary910313 -Node: Dynamic Extensions912509 -Node: Extension Intro914061 -Node: Plugin License915327 -Node: Extension Mechanism Outline916124 -Ref: figure-load-extension916552 -Ref: figure-register-new-function918032 -Ref: figure-call-new-function919036 -Node: Extension API Description921022 -Node: Extension API Functions Introduction922472 -Node: General Data Types927296 -Ref: General Data Types-Footnote-1933035 -Node: Memory Allocation Functions933334 -Ref: Memory Allocation Functions-Footnote-1936173 -Node: Constructor Functions936269 -Node: Registration Functions938003 -Node: Extension Functions938688 -Node: Exit Callback Functions940985 -Node: Extension Version String942233 -Node: Input Parsers942898 -Node: Output Wrappers952777 -Node: Two-way processors957292 -Node: Printing Messages959496 -Ref: Printing Messages-Footnote-1960572 -Node: Updating `ERRNO'960724 -Node: Requesting Values961464 -Ref: table-value-types-returned962192 -Node: Accessing Parameters963149 -Node: Symbol Table Access964380 -Node: Symbol table by name964894 -Node: Symbol table by cookie966875 -Ref: Symbol table by cookie-Footnote-1971019 -Node: Cached values971082 -Ref: Cached values-Footnote-1974581 -Node: Array Manipulation974672 -Ref: Array Manipulation-Footnote-1975770 -Node: Array Data Types975807 -Ref: Array Data Types-Footnote-1978462 -Node: Array Functions978554 -Node: Flattening Arrays982408 -Node: Creating Arrays989300 -Node: Extension API Variables994071 -Node: Extension Versioning994707 -Node: Extension API Informational Variables996608 -Node: Extension API Boilerplate997673 -Node: Finding Extensions1001482 -Node: Extension Example1002042 -Node: Internal File Description1002814 -Node: Internal File Ops1006881 -Ref: Internal File Ops-Footnote-11018551 -Node: Using Internal File Ops1018691 -Ref: Using Internal File Ops-Footnote-11021074 -Node: Extension Samples1021347 -Node: Extension Sample File Functions1022873 -Node: Extension Sample Fnmatch1030511 -Node: Extension Sample Fork1032002 -Node: Extension Sample Inplace1033217 -Node: Extension Sample Ord1034892 -Node: Extension Sample Readdir1035728 -Ref: table-readdir-file-types1036604 -Node: Extension Sample Revout1037415 -Node: Extension Sample Rev2way1038005 -Node: Extension Sample Read write array1038745 -Node: Extension Sample Readfile1040685 -Node: Extension Sample Time1041780 -Node: Extension Sample API Tests1043129 -Node: gawkextlib1043620 -Node: Extension summary1046278 -Node: Extension Exercises1049967 -Node: Language History1050689 -Node: V7/SVR3.11052345 -Node: SVR41054526 -Node: POSIX1055971 -Node: BTL1057360 -Node: POSIX/GNU1058094 -Node: Feature History1063658 -Node: Common Extensions1076756 -Node: Ranges and Locales1078080 -Ref: Ranges and Locales-Footnote-11082698 -Ref: Ranges and Locales-Footnote-21082725 -Ref: Ranges and Locales-Footnote-31082959 -Node: Contributors1083180 -Node: History summary1088721 -Node: Installation1090091 -Node: Gawk Distribution1091037 -Node: Getting1091521 -Node: Extracting1092344 -Node: Distribution contents1093979 -Node: Unix Installation1099696 -Node: Quick Installation1100313 -Node: Additional Configuration Options1102737 -Node: Configuration Philosophy1104475 -Node: Non-Unix Installation1106844 -Node: PC Installation1107302 -Node: PC Binary Installation1108621 -Node: PC Compiling1110469 -Ref: PC Compiling-Footnote-11113490 -Node: PC Testing1113599 -Node: PC Using1114775 -Node: Cygwin1118890 -Node: MSYS1119713 -Node: VMS Installation1120213 -Node: VMS Compilation1121005 -Ref: VMS Compilation-Footnote-11122227 -Node: VMS Dynamic Extensions1122285 -Node: VMS Installation Details1123969 -Node: VMS Running1126221 -Node: VMS GNV1129057 -Node: VMS Old Gawk1129791 -Node: Bugs1130261 -Node: Other Versions1134144 -Node: Installation summary1140568 -Node: Notes1141624 -Node: Compatibility Mode1142489 -Node: Additions1143271 -Node: Accessing The Source1144196 -Node: Adding Code1145631 -Node: New Ports1151788 -Node: Derived Files1156270 -Ref: Derived Files-Footnote-11161745 -Ref: Derived Files-Footnote-21161779 -Ref: Derived Files-Footnote-31162375 -Node: Future Extensions1162489 -Node: Implementation Limitations1163095 -Node: Extension Design1164343 -Node: Old Extension Problems1165497 -Ref: Old Extension Problems-Footnote-11167014 -Node: Extension New Mechanism Goals1167071 -Ref: Extension New Mechanism Goals-Footnote-11170431 -Node: Extension Other Design Decisions1170620 -Node: Extension Future Growth1172728 -Node: Old Extension Mechanism1173564 -Node: Notes summary1175326 -Node: Basic Concepts1176512 -Node: Basic High Level1177193 -Ref: figure-general-flow1177465 -Ref: figure-process-flow1178064 -Ref: Basic High Level-Footnote-11181293 -Node: Basic Data Typing1181478 -Node: Glossary1184806 -Node: Copying1216735 -Node: GNU Free Documentation License1254291 -Node: Index1279427 +Node: Ranges391570 +Node: BEGIN/END394677 +Node: Using BEGIN/END395438 +Ref: Using BEGIN/END-Footnote-1398174 +Node: I/O And BEGIN/END398280 +Node: BEGINFILE/ENDFILE400595 +Node: Empty403492 +Node: Using Shell Variables403809 +Node: Action Overview406082 +Node: Statements408408 +Node: If Statement410256 +Node: While Statement411751 +Node: Do Statement413779 +Node: For Statement414927 +Node: Switch Statement418085 +Node: Break Statement420467 +Node: Continue Statement422508 +Node: Next Statement424335 +Node: Nextfile Statement426716 +Node: Exit Statement429344 +Node: Built-in Variables431755 +Node: User-modified432888 +Ref: User-modified-Footnote-1440591 +Node: Auto-set440653 +Ref: Auto-set-Footnote-1453705 +Ref: Auto-set-Footnote-2453910 +Node: ARGC and ARGV453966 +Node: Pattern Action Summary458184 +Node: Arrays460617 +Node: Array Basics461946 +Node: Array Intro462790 +Ref: figure-array-elements464724 +Ref: Array Intro-Footnote-1467344 +Node: Reference to Elements467472 +Node: Assigning Elements469934 +Node: Array Example470425 +Node: Scanning an Array472184 +Node: Controlling Scanning475204 +Ref: Controlling Scanning-Footnote-1480598 +Node: Numeric Array Subscripts480914 +Node: Uninitialized Subscripts483099 +Node: Delete484716 +Ref: Delete-Footnote-1487465 +Node: Multidimensional487522 +Node: Multiscanning490619 +Node: Arrays of Arrays492208 +Node: Arrays Summary496962 +Node: Functions499053 +Node: Built-in500092 +Node: Calling Built-in501170 +Node: Numeric Functions503165 +Ref: Numeric Functions-Footnote-1507181 +Ref: Numeric Functions-Footnote-2507538 +Ref: Numeric Functions-Footnote-3507586 +Node: String Functions507858 +Ref: String Functions-Footnote-1531359 +Ref: String Functions-Footnote-2531488 +Ref: String Functions-Footnote-3531736 +Node: Gory Details531823 +Ref: table-sub-escapes533604 +Ref: table-sub-proposed535119 +Ref: table-posix-sub536481 +Ref: table-gensub-escapes538018 +Ref: Gory Details-Footnote-1538851 +Node: I/O Functions539002 +Ref: I/O Functions-Footnote-1546238 +Node: Time Functions546385 +Ref: Time Functions-Footnote-1556894 +Ref: Time Functions-Footnote-2556962 +Ref: Time Functions-Footnote-3557120 +Ref: Time Functions-Footnote-4557231 +Ref: Time Functions-Footnote-5557343 +Ref: Time Functions-Footnote-6557570 +Node: Bitwise Functions557836 +Ref: table-bitwise-ops558398 +Ref: Bitwise Functions-Footnote-1562726 +Node: Type Functions562898 +Node: I18N Functions564050 +Node: User-defined565697 +Node: Definition Syntax566502 +Ref: Definition Syntax-Footnote-1572161 +Node: Function Example572232 +Ref: Function Example-Footnote-1575153 +Node: Function Caveats575175 +Node: Calling A Function575693 +Node: Variable Scope576651 +Node: Pass By Value/Reference579644 +Node: Return Statement583141 +Node: Dynamic Typing586120 +Node: Indirect Calls587049 +Ref: Indirect Calls-Footnote-1598355 +Node: Functions Summary598483 +Node: Library Functions601185 +Ref: Library Functions-Footnote-1604793 +Ref: Library Functions-Footnote-2604936 +Node: Library Names605107 +Ref: Library Names-Footnote-1608565 +Ref: Library Names-Footnote-2608788 +Node: General Functions608874 +Node: Strtonum Function609977 +Node: Assert Function612999 +Node: Round Function616323 +Node: Cliff Random Function617864 +Node: Ordinal Functions618880 +Ref: Ordinal Functions-Footnote-1621943 +Ref: Ordinal Functions-Footnote-2622195 +Node: Join Function622406 +Ref: Join Function-Footnote-1624176 +Node: Getlocaltime Function624376 +Node: Readfile Function628120 +Node: Shell Quoting630092 +Node: Data File Management631493 +Node: Filetrans Function632125 +Node: Rewind Function636221 +Node: File Checking637607 +Ref: File Checking-Footnote-1638940 +Node: Empty Files639141 +Node: Ignoring Assigns641120 +Node: Getopt Function642670 +Ref: Getopt Function-Footnote-1654134 +Node: Passwd Functions654334 +Ref: Passwd Functions-Footnote-1663174 +Node: Group Functions663262 +Ref: Group Functions-Footnote-1671159 +Node: Walking Arrays671364 +Node: Library Functions Summary672964 +Node: Library Exercises674368 +Node: Sample Programs675648 +Node: Running Examples676418 +Node: Clones677146 +Node: Cut Program678370 +Node: Egrep Program688090 +Ref: Egrep Program-Footnote-1695593 +Node: Id Program695703 +Node: Split Program699379 +Ref: Split Program-Footnote-1702833 +Node: Tee Program702961 +Node: Uniq Program705750 +Node: Wc Program713169 +Ref: Wc Program-Footnote-1717419 +Node: Miscellaneous Programs717513 +Node: Dupword Program718726 +Node: Alarm Program720757 +Node: Translate Program725562 +Ref: Translate Program-Footnote-1730125 +Node: Labels Program730395 +Ref: Labels Program-Footnote-1733746 +Node: Word Sorting733830 +Node: History Sorting737900 +Node: Extract Program739735 +Node: Simple Sed747259 +Node: Igawk Program750329 +Ref: Igawk Program-Footnote-1764655 +Ref: Igawk Program-Footnote-2764856 +Ref: Igawk Program-Footnote-3764978 +Node: Anagram Program765093 +Node: Signature Program768154 +Node: Programs Summary769401 +Node: Programs Exercises770622 +Ref: Programs Exercises-Footnote-1774753 +Node: Advanced Features774844 +Node: Nondecimal Data776826 +Node: Array Sorting778416 +Node: Controlling Array Traversal779116 +Ref: Controlling Array Traversal-Footnote-1787482 +Node: Array Sorting Functions787600 +Ref: Array Sorting Functions-Footnote-1791486 +Node: Two-way I/O791682 +Ref: Two-way I/O-Footnote-1796627 +Ref: Two-way I/O-Footnote-2796813 +Node: TCP/IP Networking796895 +Node: Profiling799767 +Node: Advanced Features Summary807308 +Node: Internationalization809241 +Node: I18N and L10N810721 +Node: Explaining gettext811407 +Ref: Explaining gettext-Footnote-1816432 +Ref: Explaining gettext-Footnote-2816616 +Node: Programmer i18n816781 +Ref: Programmer i18n-Footnote-1821657 +Node: Translator i18n821706 +Node: String Extraction822500 +Ref: String Extraction-Footnote-1823631 +Node: Printf Ordering823717 +Ref: Printf Ordering-Footnote-1826503 +Node: I18N Portability826567 +Ref: I18N Portability-Footnote-1829023 +Node: I18N Example829086 +Ref: I18N Example-Footnote-1831889 +Node: Gawk I18N831961 +Node: I18N Summary832605 +Node: Debugger833945 +Node: Debugging834967 +Node: Debugging Concepts835408 +Node: Debugging Terms837218 +Node: Awk Debugging839790 +Node: Sample Debugging Session840696 +Node: Debugger Invocation841230 +Node: Finding The Bug842615 +Node: List of Debugger Commands849094 +Node: Breakpoint Control850426 +Node: Debugger Execution Control854103 +Node: Viewing And Changing Data857462 +Node: Execution Stack860838 +Node: Debugger Info862473 +Node: Miscellaneous Debugger Commands866518 +Node: Readline Support871519 +Node: Limitations872413 +Node: Debugging Summary874528 +Node: Arbitrary Precision Arithmetic875702 +Node: Computer Arithmetic877118 +Ref: table-numeric-ranges880717 +Ref: Computer Arithmetic-Footnote-1881241 +Node: Math Definitions881298 +Ref: table-ieee-formats884593 +Ref: Math Definitions-Footnote-1885197 +Node: MPFR features885302 +Node: FP Math Caution886973 +Ref: FP Math Caution-Footnote-1888023 +Node: Inexactness of computations888392 +Node: Inexact representation889351 +Node: Comparing FP Values890709 +Node: Errors accumulate891791 +Node: Getting Accuracy893223 +Node: Try To Round895927 +Node: Setting precision896826 +Ref: table-predefined-precision-strings897510 +Node: Setting the rounding mode899339 +Ref: table-gawk-rounding-modes899703 +Ref: Setting the rounding mode-Footnote-1903155 +Node: Arbitrary Precision Integers903334 +Ref: Arbitrary Precision Integers-Footnote-1906318 +Node: POSIX Floating Point Problems906467 +Ref: POSIX Floating Point Problems-Footnote-1910346 +Node: Floating point summary910384 +Node: Dynamic Extensions912580 +Node: Extension Intro914132 +Node: Plugin License915397 +Node: Extension Mechanism Outline916194 +Ref: figure-load-extension916622 +Ref: figure-register-new-function918102 +Ref: figure-call-new-function919106 +Node: Extension API Description921093 +Node: Extension API Functions Introduction922543 +Node: General Data Types927364 +Ref: General Data Types-Footnote-1933171 +Node: Memory Allocation Functions933470 +Ref: Memory Allocation Functions-Footnote-1936309 +Node: Constructor Functions936405 +Node: Registration Functions938139 +Node: Extension Functions938824 +Node: Exit Callback Functions941121 +Node: Extension Version String942369 +Node: Input Parsers943034 +Node: Output Wrappers952913 +Node: Two-way processors957428 +Node: Printing Messages959632 +Ref: Printing Messages-Footnote-1960708 +Node: Updating `ERRNO'960860 +Node: Requesting Values961600 +Ref: table-value-types-returned962328 +Node: Accessing Parameters963285 +Node: Symbol Table Access964516 +Node: Symbol table by name965030 +Node: Symbol table by cookie967011 +Ref: Symbol table by cookie-Footnote-1971155 +Node: Cached values971218 +Ref: Cached values-Footnote-1974717 +Node: Array Manipulation974808 +Ref: Array Manipulation-Footnote-1975906 +Node: Array Data Types975943 +Ref: Array Data Types-Footnote-1978598 +Node: Array Functions978690 +Node: Flattening Arrays982544 +Node: Creating Arrays989436 +Node: Extension API Variables994207 +Node: Extension Versioning994843 +Node: Extension API Informational Variables996744 +Node: Extension API Boilerplate997809 +Node: Finding Extensions1001618 +Node: Extension Example1002178 +Node: Internal File Description1002950 +Node: Internal File Ops1007017 +Ref: Internal File Ops-Footnote-11018687 +Node: Using Internal File Ops1018827 +Ref: Using Internal File Ops-Footnote-11021210 +Node: Extension Samples1021483 +Node: Extension Sample File Functions1023009 +Node: Extension Sample Fnmatch1030647 +Node: Extension Sample Fork1032138 +Node: Extension Sample Inplace1033353 +Node: Extension Sample Ord1035028 +Node: Extension Sample Readdir1035864 +Ref: table-readdir-file-types1036740 +Node: Extension Sample Revout1037551 +Node: Extension Sample Rev2way1038141 +Node: Extension Sample Read write array1038881 +Node: Extension Sample Readfile1040821 +Node: Extension Sample Time1041916 +Node: Extension Sample API Tests1043265 +Node: gawkextlib1043756 +Node: Extension summary1046414 +Node: Extension Exercises1050103 +Node: Language History1050825 +Node: V7/SVR3.11052481 +Node: SVR41054662 +Node: POSIX1056107 +Node: BTL1057496 +Node: POSIX/GNU1058230 +Node: Feature History1063794 +Node: Common Extensions1076892 +Node: Ranges and Locales1078216 +Ref: Ranges and Locales-Footnote-11082834 +Ref: Ranges and Locales-Footnote-21082861 +Ref: Ranges and Locales-Footnote-31083095 +Node: Contributors1083316 +Node: History summary1088857 +Node: Installation1090227 +Node: Gawk Distribution1091173 +Node: Getting1091657 +Node: Extracting1092480 +Node: Distribution contents1094115 +Node: Unix Installation1099832 +Node: Quick Installation1100449 +Node: Additional Configuration Options1102873 +Node: Configuration Philosophy1104611 +Node: Non-Unix Installation1106980 +Node: PC Installation1107438 +Node: PC Binary Installation1108757 +Node: PC Compiling1110605 +Ref: PC Compiling-Footnote-11113626 +Node: PC Testing1113735 +Node: PC Using1114911 +Node: Cygwin1119026 +Node: MSYS1119849 +Node: VMS Installation1120349 +Node: VMS Compilation1121141 +Ref: VMS Compilation-Footnote-11122363 +Node: VMS Dynamic Extensions1122421 +Node: VMS Installation Details1124105 +Node: VMS Running1126357 +Node: VMS GNV1129193 +Node: VMS Old Gawk1129927 +Node: Bugs1130397 +Node: Other Versions1134280 +Node: Installation summary1140704 +Node: Notes1141760 +Node: Compatibility Mode1142625 +Node: Additions1143407 +Node: Accessing The Source1144332 +Node: Adding Code1145767 +Node: New Ports1151924 +Node: Derived Files1156406 +Ref: Derived Files-Footnote-11161881 +Ref: Derived Files-Footnote-21161915 +Ref: Derived Files-Footnote-31162511 +Node: Future Extensions1162625 +Node: Implementation Limitations1163231 +Node: Extension Design1164479 +Node: Old Extension Problems1165633 +Ref: Old Extension Problems-Footnote-11167150 +Node: Extension New Mechanism Goals1167207 +Ref: Extension New Mechanism Goals-Footnote-11170567 +Node: Extension Other Design Decisions1170756 +Node: Extension Future Growth1172864 +Node: Old Extension Mechanism1173700 +Node: Notes summary1175462 +Node: Basic Concepts1176648 +Node: Basic High Level1177329 +Ref: figure-general-flow1177601 +Ref: figure-process-flow1178200 +Ref: Basic High Level-Footnote-11181429 +Node: Basic Data Typing1181614 +Node: Glossary1184942 +Node: Copying1216871 +Node: GNU Free Documentation License1254427 +Node: Index1279563  End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 8cb24eaa..3f2afed3 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -13166,6 +13166,7 @@ $ @kbd{awk '$1 ~ /li/ @{ print $2 @}' mail-list} @cindex regexp constants, as patterns @cindex patterns, regexp constants as +A regexp constant as a pattern is also a special case of an expression pattern. The expression @code{/li/} has the value one if @samp{li} appears in the current input record. Thus, as a pattern, @code{/li/} matches any record containing @samp{li}. @@ -31123,7 +31124,7 @@ Extensions are useful because they allow you (of course) to extend @command{gawk}'s functionality. For example, they can provide access to system calls (such as @code{chdir()} to change directory) and to other C library routines that could be of use. As with most software, -``the sky is the limit;'' if you can imagine something that you might +``the sky is the limit''; if you can imagine something that you might want to do and can write in C or C++, you can write an extension to do it! Extensions are written in C or C++, using the @dfn{application programming @@ -31131,7 +31132,7 @@ interface} (API) defined for this purpose by the @command{gawk} developers. The rest of this @value{CHAPTER} explains the facilities that the API provides and how to use them, and presents a small example extension. In addition, it documents -the sample extensions included in the @command{gawk} distribution, +the sample extensions included in the @command{gawk} distribution and describes the @code{gawkextlib} project. @ifclear FOR_PRINT @xref{Extension Design}, for a discussion of the extension mechanism @@ -31284,7 +31285,7 @@ Some other bits and pieces: @itemize @value{BULLET} @item The API provides access to @command{gawk}'s @code{do_@var{xxx}} values, -reflecting command-line options, like @code{do_lint}, @code{do_profiling} +reflecting command-line options, like @code{do_lint}, @code{do_profiling}, and so on (@pxref{Extension API Variables}). These are informational: an extension cannot affect their values inside @command{gawk}. In addition, attempting to assign to them @@ -31328,7 +31329,7 @@ This (rather large) @value{SECTION} describes the API in detail. @node Extension API Functions Introduction @subsection Introduction -Access to facilities within @command{gawk} are made available +Access to facilities within @command{gawk} is achieved by calling through function pointers passed into your extension. API function pointers are provided for the following kinds of operations: @@ -31356,7 +31357,7 @@ Output wrappers Two-way processors @end itemize -All of these are discussed in detail, later in this @value{CHAPTER}. +All of these are discussed in detail later in this @value{CHAPTER}. @item Printing fatal, warning, and ``lint'' warning messages. @@ -31394,7 +31395,7 @@ Creating a new array Clearing an array @item -Flattening an array for easy C style looping over all its indices and elements +Flattening an array for easy C-style looping over all its indices and elements @end itemize @end itemize @@ -31406,8 +31407,9 @@ The following types, macros, and/or functions are referenced in @file{gawkapi.h}. For correct use, you must therefore include the corresponding standard header file @emph{before} including @file{gawkapi.h}: +@c FIXME: Make this is a float at some point. @multitable {@code{memset()}, @code{memcpy()}} {@code{}} -@headitem C Entity @tab Header File +@headitem C entity @tab Header file @item @code{EOF} @tab @code{} @item Values for @code{errno} @tab @code{} @item @code{FILE} @tab @code{} @@ -31433,7 +31435,7 @@ Doing so, however, is poor coding practice. Although the API only uses ISO C 90 features, there is an exception; the ``constructor'' functions use the @code{inline} keyword. If your compiler does not support this keyword, you should either place -@samp{-Dinline=''} on your command line, or use the GNU Autotools and include a +@samp{-Dinline=''} on your command line or use the GNU Autotools and include a @file{config.h} file in your extensions. @item @@ -31441,7 +31443,7 @@ All pointers filled in by @command{gawk} point to memory managed by @command{gawk} and should be treated by the extension as read-only. Memory for @emph{all} strings passed into @command{gawk} from the extension @emph{must} come from calling one of -@code{gawk_malloc()}, @code{gawk_calloc()} or @code{gawk_realloc()}, +@code{gawk_malloc()}, @code{gawk_calloc()}, or @code{gawk_realloc()}, and is managed by @command{gawk} from then on. @item @@ -31455,7 +31457,7 @@ characters are allowed. By intent, strings are maintained using the current multibyte encoding (as defined by @env{LC_@var{xxx}} environment variables) and not using wide characters. This matches how @command{gawk} stores strings internally -and also how characters are likely to be input and output from files. +and also how characters are likely to be input into and output from files. @end quotation @item @@ -31500,6 +31502,8 @@ general-purpose use. Additional, more specialized, data structures are introduced in subsequent @value{SECTION}s, together with the functions that use them. +The general-purpose types and structures are as follows: + @table @code @item typedef void *awk_ext_id_t; A value of this type is received from @command{gawk} when an extension is loaded. @@ -31516,7 +31520,7 @@ while allowing @command{gawk} to use them as it needs to. @itemx @ @ @ @ awk_false = 0, @itemx @ @ @ @ awk_true @itemx @} awk_bool_t; -A simple boolean type. +A simple Boolean type. @item typedef struct awk_string @{ @itemx @ @ @ @ char *str;@ @ @ @ @ @ /* data */ @@ -31562,7 +31566,7 @@ The @code{val_type} member indicates what kind of value the @itemx #define array_cookie@ @ @ u.a @itemx #define scalar_cookie@ @ u.scl @itemx #define value_cookie@ @ @ u.vc -These macros make accessing the fields of the @code{awk_value_t} more +Using these macros makes accessing the fields of the @code{awk_value_t} more readable. @item typedef void *awk_scalar_t; diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 7c229020..3e97423a 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -12494,6 +12494,7 @@ $ @kbd{awk '$1 ~ /li/ @{ print $2 @}' mail-list} @cindex regexp constants, as patterns @cindex patterns, regexp constants as +A regexp constant as a pattern is also a special case of an expression pattern. The expression @code{/li/} has the value one if @samp{li} appears in the current input record. Thus, as a pattern, @code{/li/} matches any record containing @samp{li}. @@ -30214,7 +30215,7 @@ Extensions are useful because they allow you (of course) to extend @command{gawk}'s functionality. For example, they can provide access to system calls (such as @code{chdir()} to change directory) and to other C library routines that could be of use. As with most software, -``the sky is the limit;'' if you can imagine something that you might +``the sky is the limit''; if you can imagine something that you might want to do and can write in C or C++, you can write an extension to do it! Extensions are written in C or C++, using the @dfn{application programming @@ -30222,7 +30223,7 @@ interface} (API) defined for this purpose by the @command{gawk} developers. The rest of this @value{CHAPTER} explains the facilities that the API provides and how to use them, and presents a small example extension. In addition, it documents -the sample extensions included in the @command{gawk} distribution, +the sample extensions included in the @command{gawk} distribution and describes the @code{gawkextlib} project. @ifclear FOR_PRINT @xref{Extension Design}, for a discussion of the extension mechanism @@ -30375,7 +30376,7 @@ Some other bits and pieces: @itemize @value{BULLET} @item The API provides access to @command{gawk}'s @code{do_@var{xxx}} values, -reflecting command-line options, like @code{do_lint}, @code{do_profiling} +reflecting command-line options, like @code{do_lint}, @code{do_profiling}, and so on (@pxref{Extension API Variables}). These are informational: an extension cannot affect their values inside @command{gawk}. In addition, attempting to assign to them @@ -30419,7 +30420,7 @@ This (rather large) @value{SECTION} describes the API in detail. @node Extension API Functions Introduction @subsection Introduction -Access to facilities within @command{gawk} are made available +Access to facilities within @command{gawk} is achieved by calling through function pointers passed into your extension. API function pointers are provided for the following kinds of operations: @@ -30447,7 +30448,7 @@ Output wrappers Two-way processors @end itemize -All of these are discussed in detail, later in this @value{CHAPTER}. +All of these are discussed in detail later in this @value{CHAPTER}. @item Printing fatal, warning, and ``lint'' warning messages. @@ -30485,7 +30486,7 @@ Creating a new array Clearing an array @item -Flattening an array for easy C style looping over all its indices and elements +Flattening an array for easy C-style looping over all its indices and elements @end itemize @end itemize @@ -30497,8 +30498,9 @@ The following types, macros, and/or functions are referenced in @file{gawkapi.h}. For correct use, you must therefore include the corresponding standard header file @emph{before} including @file{gawkapi.h}: +@c FIXME: Make this is a float at some point. @multitable {@code{memset()}, @code{memcpy()}} {@code{}} -@headitem C Entity @tab Header File +@headitem C entity @tab Header file @item @code{EOF} @tab @code{} @item Values for @code{errno} @tab @code{} @item @code{FILE} @tab @code{} @@ -30524,7 +30526,7 @@ Doing so, however, is poor coding practice. Although the API only uses ISO C 90 features, there is an exception; the ``constructor'' functions use the @code{inline} keyword. If your compiler does not support this keyword, you should either place -@samp{-Dinline=''} on your command line, or use the GNU Autotools and include a +@samp{-Dinline=''} on your command line or use the GNU Autotools and include a @file{config.h} file in your extensions. @item @@ -30532,7 +30534,7 @@ All pointers filled in by @command{gawk} point to memory managed by @command{gawk} and should be treated by the extension as read-only. Memory for @emph{all} strings passed into @command{gawk} from the extension @emph{must} come from calling one of -@code{gawk_malloc()}, @code{gawk_calloc()} or @code{gawk_realloc()}, +@code{gawk_malloc()}, @code{gawk_calloc()}, or @code{gawk_realloc()}, and is managed by @command{gawk} from then on. @item @@ -30546,7 +30548,7 @@ characters are allowed. By intent, strings are maintained using the current multibyte encoding (as defined by @env{LC_@var{xxx}} environment variables) and not using wide characters. This matches how @command{gawk} stores strings internally -and also how characters are likely to be input and output from files. +and also how characters are likely to be input into and output from files. @end quotation @item @@ -30591,6 +30593,8 @@ general-purpose use. Additional, more specialized, data structures are introduced in subsequent @value{SECTION}s, together with the functions that use them. +The general-purpose types and structures are as follows: + @table @code @item typedef void *awk_ext_id_t; A value of this type is received from @command{gawk} when an extension is loaded. @@ -30607,7 +30611,7 @@ while allowing @command{gawk} to use them as it needs to. @itemx @ @ @ @ awk_false = 0, @itemx @ @ @ @ awk_true @itemx @} awk_bool_t; -A simple boolean type. +A simple Boolean type. @item typedef struct awk_string @{ @itemx @ @ @ @ char *str;@ @ @ @ @ @ /* data */ @@ -30653,7 +30657,7 @@ The @code{val_type} member indicates what kind of value the @itemx #define array_cookie@ @ @ u.a @itemx #define scalar_cookie@ @ u.scl @itemx #define value_cookie@ @ @ u.vc -These macros make accessing the fields of the @code{awk_value_t} more +Using these macros makes accessing the fields of the @code{awk_value_t} more readable. @item typedef void *awk_scalar_t; -- cgit v1.2.3 From e59b2439f336e943a5eb7bd6a9926dc18dd974d8 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 10 Feb 2015 19:52:18 +0200 Subject: Add new profile test. --- test/ChangeLog | 5 +++++ test/Makefile.am | 10 +++++++++- test/Makefile.in | 10 +++++++++- test/profile0.awk | 1 + test/profile0.in | 2 ++ test/profile0.ok | 6 ++++++ 6 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 test/profile0.awk create mode 100644 test/profile0.in create mode 100644 test/profile0.ok diff --git a/test/ChangeLog b/test/ChangeLog index 8672cb00..0d6934e9 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2015-02-10 Arnold D. Robbins + + * Makefile.am (profile0): New test. + * profile0.awk, profile0.in, profile0.ok: New files. + 2015-02-01 Arnold D. Robbins * Makefile.am (paramasfunc1, paramasfunc2): Now need --posix. diff --git a/test/Makefile.am b/test/Makefile.am index 3160494e..419265f9 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -710,6 +710,8 @@ EXTRA_DIST = \ prmreuse.ok \ procinfs.awk \ procinfs.ok \ + profile0.awk \ + profile0.ok \ profile2.ok \ profile3.awk \ profile3.ok \ @@ -1039,7 +1041,7 @@ GAWK_EXT_TESTS = \ manyfiles match1 match2 match3 mbstr1 \ nastyparm next nondec nondec2 \ patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \ - profile1 profile2 profile3 profile4 profile5 profile6 profile7 pty1 \ + profile0 profile1 profile2 profile3 profile4 profile5 profile6 profile7 pty1 \ rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin rsstart1 \ rsstart2 rsstart3 rstest6 shadow sortfor sortu split_after_fpat \ splitarg4 strftime \ @@ -1689,6 +1691,12 @@ dumpvars:: @grep -v ENVIRON < awkvars.out | grep -v PROCINFO > _$@; rm awkvars.out @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +profile0: + @echo $@ + @$(AWK) --profile=ap-$@.out -f "$(srcdir)"/$@.awk "$(srcdir)"/$@.in > /dev/null + @sed 1,2d < ap-$@.out > _$@; rm ap-$@.out + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + profile1: @echo $@ @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/xref.awk "$(srcdir)"/dtdgport.awk > _$@.out1 diff --git a/test/Makefile.in b/test/Makefile.in index d1bbf4f8..598285ed 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -967,6 +967,8 @@ EXTRA_DIST = \ prmreuse.ok \ procinfs.awk \ procinfs.ok \ + profile0.awk \ + profile0.ok \ profile2.ok \ profile3.awk \ profile3.ok \ @@ -1295,7 +1297,7 @@ GAWK_EXT_TESTS = \ manyfiles match1 match2 match3 mbstr1 \ nastyparm next nondec nondec2 \ patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \ - profile1 profile2 profile3 profile4 profile5 profile6 profile7 pty1 \ + profile0 profile1 profile2 profile3 profile4 profile5 profile6 profile7 pty1 \ rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin rsstart1 \ rsstart2 rsstart3 rstest6 shadow sortfor sortu split_after_fpat \ splitarg4 strftime \ @@ -2127,6 +2129,12 @@ dumpvars:: @grep -v ENVIRON < awkvars.out | grep -v PROCINFO > _$@; rm awkvars.out @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +profile0: + @echo $@ + @$(AWK) --profile=ap-$@.out -f "$(srcdir)"/$@.awk "$(srcdir)"/$@.in > /dev/null + @sed 1,2d < ap-$@.out > _$@; rm ap-$@.out + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + profile1: @echo $@ @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/xref.awk "$(srcdir)"/dtdgport.awk > _$@.out1 diff --git a/test/profile0.awk b/test/profile0.awk new file mode 100644 index 00000000..a42e94df --- /dev/null +++ b/test/profile0.awk @@ -0,0 +1 @@ +NR == 1 diff --git a/test/profile0.in b/test/profile0.in new file mode 100644 index 00000000..7bba8c8e --- /dev/null +++ b/test/profile0.in @@ -0,0 +1,2 @@ +line 1 +line 2 diff --git a/test/profile0.ok b/test/profile0.ok new file mode 100644 index 00000000..2e3c5728 --- /dev/null +++ b/test/profile0.ok @@ -0,0 +1,6 @@ + # Rule(s) + + 2 NR == 1 { # 1 + 1 print $0 + } + -- cgit v1.2.3 From 9478ffc5b7ae6988bb109a7be9189ed02f3720e8 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 10 Feb 2015 22:17:32 +0200 Subject: Doc fixes. --- doc/ChangeLog | 4 + doc/gawk.info | 1102 ++++++++++++++++++++++++++++--------------------------- doc/gawk.texi | 22 +- doc/gawktexi.in | 22 +- 4 files changed, 583 insertions(+), 567 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index b6de5797..c62d3022 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2015-02-10 Arnold D. Robbins + + * gawktexi.in: Minor fixes, O'Reilly fixes. + 2015-02-09 Arnold D. Robbins * gawktexi.in: Restore a lost sentence. O'Reilly fixes. diff --git a/doc/gawk.info b/doc/gawk.info index bf573a8a..eb8d07b5 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -1374,6 +1374,12 @@ also must acknowledge my gratitude to G-d, for the many opportunities He has sent my way, as well as for the gifts He has given me with which to take advantage of those opportunities. + +Arnold Robbins +Nof Ayalon +Israel +February 2015 +  File: gawk.info, Node: Getting Started, Next: Invoking Gawk, Prev: Preface, Up: Top @@ -23028,8 +23034,8 @@ indicates what is in the `union'. Representing numbers is easy--the API uses a C `double'. Strings require more work. Because `gawk' allows embedded NUL bytes in string -values, a string must be represented as a pair containing a -data-pointer and length. This is the `awk_string_t' type. +values, a string must be represented as a pair containing a data +pointer and length. This is the `awk_string_t' type. Identifiers (i.e., the names of global variables) can be associated with either scalar values or with arrays. In addition, `gawk' provides @@ -23041,12 +23047,12 @@ Manipulation::. of the `union' as if they were fields in a `struct'; this is a common coding practice in C. Such code is easier to write and to read, but it remains _your_ responsibility to make sure that the `val_type' member -correctly reflects the type of the value in the `awk_value_t'. +correctly reflects the type of the value in the `awk_value_t' struct. Conceptually, the first three members of the `union' (number, string, and array) are all that is needed for working with `awk' values. However, because the API provides routines for accessing and changing -the value of global scalar variables only by using the variable's name, +the value of a global scalar variable only by using the variable's name, there is a performance penalty: `gawk' must find the variable each time it is accessed and changed. This turns out to be a real issue, not just a theoretical one. @@ -23055,17 +23061,19 @@ just a theoretical one. reading and/or changing the value of one or more scalar variables, you can obtain a "scalar cookie"(1) object for that variable, and then use the cookie for getting the variable's value or for changing the -variable's value. This is the `awk_scalar_t' type and `scalar_cookie' -macro. Given a scalar cookie, `gawk' can directly retrieve or modify -the value, as required, without having to find it first. +variable's value. The `awk_scalar_t' type holds a scalar cookie, and +the `scalar_cookie' macro provides access to the value of that type in +the `awk_value_t' struct. Given a scalar cookie, `gawk' can directly +retrieve or modify the value, as required, without having to find it +first. The `awk_value_cookie_t' type and `value_cookie' macro are similar. If you know that you wish to use the same numeric or string _value_ for one or more variables, you can create the value once, retaining a "value cookie" for it, and then pass in that value cookie whenever you -wish to set the value of a variable. This saves both storage space -within the running `gawk' process as well as the time needed to create -the value. +wish to set the value of a variable. This both storage space within +the running `gawk' process and reduces the time needed to create the +value. ---------- Footnotes ---------- @@ -34492,542 +34500,542 @@ Ref: Manual History-Footnote-167004 Ref: Manual History-Footnote-267045 Node: How To Contribute67119 Node: Acknowledgments68248 -Node: Getting Started73065 -Node: Running gawk75504 -Node: One-shot76694 -Node: Read Terminal77958 -Node: Long79989 -Node: Executable Scripts81502 -Ref: Executable Scripts-Footnote-184291 -Node: Comments84394 -Node: Quoting86876 -Node: DOS Quoting92394 -Node: Sample Data Files93069 -Node: Very Simple95664 -Node: Two Rules100563 -Node: More Complex102449 -Node: Statements/Lines105311 -Ref: Statements/Lines-Footnote-1109766 -Node: Other Features110031 -Node: When110967 -Ref: When-Footnote-1112721 -Node: Intro Summary112786 -Node: Invoking Gawk113670 -Node: Command Line115184 -Node: Options115982 -Ref: Options-Footnote-1131904 -Ref: Options-Footnote-2132133 -Node: Other Arguments132158 -Node: Naming Standard Input135106 -Node: Environment Variables136199 -Node: AWKPATH Variable136757 -Ref: AWKPATH Variable-Footnote-1140054 -Ref: AWKPATH Variable-Footnote-2140099 -Node: AWKLIBPATH Variable140359 -Node: Other Environment Variables141502 -Node: Exit Status145260 -Node: Include Files145936 -Node: Loading Shared Libraries149525 -Node: Obsolete150952 -Node: Undocumented151644 -Node: Invoking Summary151911 -Node: Regexp153574 -Node: Regexp Usage155028 -Node: Escape Sequences157065 -Node: Regexp Operators163075 -Ref: Regexp Operators-Footnote-1170485 -Ref: Regexp Operators-Footnote-2170632 -Node: Bracket Expressions170730 -Ref: table-char-classes172745 -Node: Leftmost Longest175687 -Node: Computed Regexps176989 -Node: GNU Regexp Operators180418 -Node: Case-sensitivity184090 -Ref: Case-sensitivity-Footnote-1186975 -Ref: Case-sensitivity-Footnote-2187210 -Node: Regexp Summary187318 -Node: Reading Files188785 -Node: Records190878 -Node: awk split records191611 -Node: gawk split records196540 -Ref: gawk split records-Footnote-1201079 -Node: Fields201116 -Ref: Fields-Footnote-1203894 -Node: Nonconstant Fields203980 -Ref: Nonconstant Fields-Footnote-1206218 -Node: Changing Fields206421 -Node: Field Separators212352 -Node: Default Field Splitting215056 -Node: Regexp Field Splitting216173 -Node: Single Character Fields219523 -Node: Command Line Field Separator220582 -Node: Full Line Fields223799 -Ref: Full Line Fields-Footnote-1225320 -Ref: Full Line Fields-Footnote-2225366 -Node: Field Splitting Summary225467 -Node: Constant Size227541 -Node: Splitting By Content232124 -Ref: Splitting By Content-Footnote-1236089 -Node: Multiple Line236252 -Ref: Multiple Line-Footnote-1242133 -Node: Getline242312 -Node: Plain Getline244519 -Node: Getline/Variable247159 -Node: Getline/File248308 -Node: Getline/Variable/File249693 -Ref: Getline/Variable/File-Footnote-1251296 -Node: Getline/Pipe251383 -Node: Getline/Variable/Pipe254061 -Node: Getline/Coprocess255192 -Node: Getline/Variable/Coprocess256456 -Node: Getline Notes257195 -Node: Getline Summary259989 -Ref: table-getline-variants260401 -Node: Read Timeout261230 -Ref: Read Timeout-Footnote-1265067 -Node: Command-line directories265125 -Node: Input Summary266030 -Node: Input Exercises269415 -Node: Printing270143 -Node: Print271920 -Node: Print Examples273377 -Node: Output Separators276156 -Node: OFMT278174 -Node: Printf279529 -Node: Basic Printf280314 -Node: Control Letters281886 -Node: Format Modifiers285871 -Node: Printf Examples291881 -Node: Redirection294367 -Node: Special FD301205 -Ref: Special FD-Footnote-1304371 -Node: Special Files304445 -Node: Other Inherited Files305062 -Node: Special Network306062 -Node: Special Caveats306924 -Node: Close Files And Pipes307873 -Ref: Close Files And Pipes-Footnote-1315064 -Ref: Close Files And Pipes-Footnote-2315212 -Node: Output Summary315362 -Node: Output Exercises316360 -Node: Expressions317040 -Node: Values318229 -Node: Constants318906 -Node: Scalar Constants319597 -Ref: Scalar Constants-Footnote-1320459 -Node: Nondecimal-numbers320709 -Node: Regexp Constants323719 -Node: Using Constant Regexps324245 -Node: Variables327408 -Node: Using Variables328065 -Node: Assignment Options329976 -Node: Conversion331851 -Node: Strings And Numbers332375 -Ref: Strings And Numbers-Footnote-1335440 -Node: Locale influences conversions335549 -Ref: table-locale-affects338295 -Node: All Operators338887 -Node: Arithmetic Ops339516 -Node: Concatenation342021 -Ref: Concatenation-Footnote-1344840 -Node: Assignment Ops344947 -Ref: table-assign-ops349926 -Node: Increment Ops351236 -Node: Truth Values and Conditions354667 -Node: Truth Values355750 -Node: Typing and Comparison356799 -Node: Variable Typing357615 -Node: Comparison Operators361282 -Ref: table-relational-ops361692 -Node: POSIX String Comparison365187 -Ref: POSIX String Comparison-Footnote-1366259 -Node: Boolean Ops366398 -Ref: Boolean Ops-Footnote-1370876 -Node: Conditional Exp370967 -Node: Function Calls372705 -Node: Precedence376585 -Node: Locales380245 -Node: Expressions Summary381877 -Node: Patterns and Actions384448 -Node: Pattern Overview385568 -Node: Regexp Patterns387247 -Node: Expression Patterns387790 -Node: Ranges391570 -Node: BEGIN/END394677 -Node: Using BEGIN/END395438 -Ref: Using BEGIN/END-Footnote-1398174 -Node: I/O And BEGIN/END398280 -Node: BEGINFILE/ENDFILE400595 -Node: Empty403492 -Node: Using Shell Variables403809 -Node: Action Overview406082 -Node: Statements408408 -Node: If Statement410256 -Node: While Statement411751 -Node: Do Statement413779 -Node: For Statement414927 -Node: Switch Statement418085 -Node: Break Statement420467 -Node: Continue Statement422508 -Node: Next Statement424335 -Node: Nextfile Statement426716 -Node: Exit Statement429344 -Node: Built-in Variables431755 -Node: User-modified432888 -Ref: User-modified-Footnote-1440591 -Node: Auto-set440653 -Ref: Auto-set-Footnote-1453705 -Ref: Auto-set-Footnote-2453910 -Node: ARGC and ARGV453966 -Node: Pattern Action Summary458184 -Node: Arrays460617 -Node: Array Basics461946 -Node: Array Intro462790 -Ref: figure-array-elements464724 -Ref: Array Intro-Footnote-1467344 -Node: Reference to Elements467472 -Node: Assigning Elements469934 -Node: Array Example470425 -Node: Scanning an Array472184 -Node: Controlling Scanning475204 -Ref: Controlling Scanning-Footnote-1480598 -Node: Numeric Array Subscripts480914 -Node: Uninitialized Subscripts483099 -Node: Delete484716 -Ref: Delete-Footnote-1487465 -Node: Multidimensional487522 -Node: Multiscanning490619 -Node: Arrays of Arrays492208 -Node: Arrays Summary496962 -Node: Functions499053 -Node: Built-in500092 -Node: Calling Built-in501170 -Node: Numeric Functions503165 -Ref: Numeric Functions-Footnote-1507181 -Ref: Numeric Functions-Footnote-2507538 -Ref: Numeric Functions-Footnote-3507586 -Node: String Functions507858 -Ref: String Functions-Footnote-1531359 -Ref: String Functions-Footnote-2531488 -Ref: String Functions-Footnote-3531736 -Node: Gory Details531823 -Ref: table-sub-escapes533604 -Ref: table-sub-proposed535119 -Ref: table-posix-sub536481 -Ref: table-gensub-escapes538018 -Ref: Gory Details-Footnote-1538851 -Node: I/O Functions539002 -Ref: I/O Functions-Footnote-1546238 -Node: Time Functions546385 -Ref: Time Functions-Footnote-1556894 -Ref: Time Functions-Footnote-2556962 -Ref: Time Functions-Footnote-3557120 -Ref: Time Functions-Footnote-4557231 -Ref: Time Functions-Footnote-5557343 -Ref: Time Functions-Footnote-6557570 -Node: Bitwise Functions557836 -Ref: table-bitwise-ops558398 -Ref: Bitwise Functions-Footnote-1562726 -Node: Type Functions562898 -Node: I18N Functions564050 -Node: User-defined565697 -Node: Definition Syntax566502 -Ref: Definition Syntax-Footnote-1572161 -Node: Function Example572232 -Ref: Function Example-Footnote-1575153 -Node: Function Caveats575175 -Node: Calling A Function575693 -Node: Variable Scope576651 -Node: Pass By Value/Reference579644 -Node: Return Statement583141 -Node: Dynamic Typing586120 -Node: Indirect Calls587049 -Ref: Indirect Calls-Footnote-1598355 -Node: Functions Summary598483 -Node: Library Functions601185 -Ref: Library Functions-Footnote-1604793 -Ref: Library Functions-Footnote-2604936 -Node: Library Names605107 -Ref: Library Names-Footnote-1608565 -Ref: Library Names-Footnote-2608788 -Node: General Functions608874 -Node: Strtonum Function609977 -Node: Assert Function612999 -Node: Round Function616323 -Node: Cliff Random Function617864 -Node: Ordinal Functions618880 -Ref: Ordinal Functions-Footnote-1621943 -Ref: Ordinal Functions-Footnote-2622195 -Node: Join Function622406 -Ref: Join Function-Footnote-1624176 -Node: Getlocaltime Function624376 -Node: Readfile Function628120 -Node: Shell Quoting630092 -Node: Data File Management631493 -Node: Filetrans Function632125 -Node: Rewind Function636221 -Node: File Checking637607 -Ref: File Checking-Footnote-1638940 -Node: Empty Files639141 -Node: Ignoring Assigns641120 -Node: Getopt Function642670 -Ref: Getopt Function-Footnote-1654134 -Node: Passwd Functions654334 -Ref: Passwd Functions-Footnote-1663174 -Node: Group Functions663262 -Ref: Group Functions-Footnote-1671159 -Node: Walking Arrays671364 -Node: Library Functions Summary672964 -Node: Library Exercises674368 -Node: Sample Programs675648 -Node: Running Examples676418 -Node: Clones677146 -Node: Cut Program678370 -Node: Egrep Program688090 -Ref: Egrep Program-Footnote-1695593 -Node: Id Program695703 -Node: Split Program699379 -Ref: Split Program-Footnote-1702833 -Node: Tee Program702961 -Node: Uniq Program705750 -Node: Wc Program713169 -Ref: Wc Program-Footnote-1717419 -Node: Miscellaneous Programs717513 -Node: Dupword Program718726 -Node: Alarm Program720757 -Node: Translate Program725562 -Ref: Translate Program-Footnote-1730125 -Node: Labels Program730395 -Ref: Labels Program-Footnote-1733746 -Node: Word Sorting733830 -Node: History Sorting737900 -Node: Extract Program739735 -Node: Simple Sed747259 -Node: Igawk Program750329 -Ref: Igawk Program-Footnote-1764655 -Ref: Igawk Program-Footnote-2764856 -Ref: Igawk Program-Footnote-3764978 -Node: Anagram Program765093 -Node: Signature Program768154 -Node: Programs Summary769401 -Node: Programs Exercises770622 -Ref: Programs Exercises-Footnote-1774753 -Node: Advanced Features774844 -Node: Nondecimal Data776826 -Node: Array Sorting778416 -Node: Controlling Array Traversal779116 -Ref: Controlling Array Traversal-Footnote-1787482 -Node: Array Sorting Functions787600 -Ref: Array Sorting Functions-Footnote-1791486 -Node: Two-way I/O791682 -Ref: Two-way I/O-Footnote-1796627 -Ref: Two-way I/O-Footnote-2796813 -Node: TCP/IP Networking796895 -Node: Profiling799767 -Node: Advanced Features Summary807308 -Node: Internationalization809241 -Node: I18N and L10N810721 -Node: Explaining gettext811407 -Ref: Explaining gettext-Footnote-1816432 -Ref: Explaining gettext-Footnote-2816616 -Node: Programmer i18n816781 -Ref: Programmer i18n-Footnote-1821657 -Node: Translator i18n821706 -Node: String Extraction822500 -Ref: String Extraction-Footnote-1823631 -Node: Printf Ordering823717 -Ref: Printf Ordering-Footnote-1826503 -Node: I18N Portability826567 -Ref: I18N Portability-Footnote-1829023 -Node: I18N Example829086 -Ref: I18N Example-Footnote-1831889 -Node: Gawk I18N831961 -Node: I18N Summary832605 -Node: Debugger833945 -Node: Debugging834967 -Node: Debugging Concepts835408 -Node: Debugging Terms837218 -Node: Awk Debugging839790 -Node: Sample Debugging Session840696 -Node: Debugger Invocation841230 -Node: Finding The Bug842615 -Node: List of Debugger Commands849094 -Node: Breakpoint Control850426 -Node: Debugger Execution Control854103 -Node: Viewing And Changing Data857462 -Node: Execution Stack860838 -Node: Debugger Info862473 -Node: Miscellaneous Debugger Commands866518 -Node: Readline Support871519 -Node: Limitations872413 -Node: Debugging Summary874528 -Node: Arbitrary Precision Arithmetic875702 -Node: Computer Arithmetic877118 -Ref: table-numeric-ranges880717 -Ref: Computer Arithmetic-Footnote-1881241 -Node: Math Definitions881298 -Ref: table-ieee-formats884593 -Ref: Math Definitions-Footnote-1885197 -Node: MPFR features885302 -Node: FP Math Caution886973 -Ref: FP Math Caution-Footnote-1888023 -Node: Inexactness of computations888392 -Node: Inexact representation889351 -Node: Comparing FP Values890709 -Node: Errors accumulate891791 -Node: Getting Accuracy893223 -Node: Try To Round895927 -Node: Setting precision896826 -Ref: table-predefined-precision-strings897510 -Node: Setting the rounding mode899339 -Ref: table-gawk-rounding-modes899703 -Ref: Setting the rounding mode-Footnote-1903155 -Node: Arbitrary Precision Integers903334 -Ref: Arbitrary Precision Integers-Footnote-1906318 -Node: POSIX Floating Point Problems906467 -Ref: POSIX Floating Point Problems-Footnote-1910346 -Node: Floating point summary910384 -Node: Dynamic Extensions912580 -Node: Extension Intro914132 -Node: Plugin License915397 -Node: Extension Mechanism Outline916194 -Ref: figure-load-extension916622 -Ref: figure-register-new-function918102 -Ref: figure-call-new-function919106 -Node: Extension API Description921093 -Node: Extension API Functions Introduction922543 -Node: General Data Types927364 -Ref: General Data Types-Footnote-1933171 -Node: Memory Allocation Functions933470 -Ref: Memory Allocation Functions-Footnote-1936309 -Node: Constructor Functions936405 -Node: Registration Functions938139 -Node: Extension Functions938824 -Node: Exit Callback Functions941121 -Node: Extension Version String942369 -Node: Input Parsers943034 -Node: Output Wrappers952913 -Node: Two-way processors957428 -Node: Printing Messages959632 -Ref: Printing Messages-Footnote-1960708 -Node: Updating `ERRNO'960860 -Node: Requesting Values961600 -Ref: table-value-types-returned962328 -Node: Accessing Parameters963285 -Node: Symbol Table Access964516 -Node: Symbol table by name965030 -Node: Symbol table by cookie967011 -Ref: Symbol table by cookie-Footnote-1971155 -Node: Cached values971218 -Ref: Cached values-Footnote-1974717 -Node: Array Manipulation974808 -Ref: Array Manipulation-Footnote-1975906 -Node: Array Data Types975943 -Ref: Array Data Types-Footnote-1978598 -Node: Array Functions978690 -Node: Flattening Arrays982544 -Node: Creating Arrays989436 -Node: Extension API Variables994207 -Node: Extension Versioning994843 -Node: Extension API Informational Variables996744 -Node: Extension API Boilerplate997809 -Node: Finding Extensions1001618 -Node: Extension Example1002178 -Node: Internal File Description1002950 -Node: Internal File Ops1007017 -Ref: Internal File Ops-Footnote-11018687 -Node: Using Internal File Ops1018827 -Ref: Using Internal File Ops-Footnote-11021210 -Node: Extension Samples1021483 -Node: Extension Sample File Functions1023009 -Node: Extension Sample Fnmatch1030647 -Node: Extension Sample Fork1032138 -Node: Extension Sample Inplace1033353 -Node: Extension Sample Ord1035028 -Node: Extension Sample Readdir1035864 -Ref: table-readdir-file-types1036740 -Node: Extension Sample Revout1037551 -Node: Extension Sample Rev2way1038141 -Node: Extension Sample Read write array1038881 -Node: Extension Sample Readfile1040821 -Node: Extension Sample Time1041916 -Node: Extension Sample API Tests1043265 -Node: gawkextlib1043756 -Node: Extension summary1046414 -Node: Extension Exercises1050103 -Node: Language History1050825 -Node: V7/SVR3.11052481 -Node: SVR41054662 -Node: POSIX1056107 -Node: BTL1057496 -Node: POSIX/GNU1058230 -Node: Feature History1063794 -Node: Common Extensions1076892 -Node: Ranges and Locales1078216 -Ref: Ranges and Locales-Footnote-11082834 -Ref: Ranges and Locales-Footnote-21082861 -Ref: Ranges and Locales-Footnote-31083095 -Node: Contributors1083316 -Node: History summary1088857 -Node: Installation1090227 -Node: Gawk Distribution1091173 -Node: Getting1091657 -Node: Extracting1092480 -Node: Distribution contents1094115 -Node: Unix Installation1099832 -Node: Quick Installation1100449 -Node: Additional Configuration Options1102873 -Node: Configuration Philosophy1104611 -Node: Non-Unix Installation1106980 -Node: PC Installation1107438 -Node: PC Binary Installation1108757 -Node: PC Compiling1110605 -Ref: PC Compiling-Footnote-11113626 -Node: PC Testing1113735 -Node: PC Using1114911 -Node: Cygwin1119026 -Node: MSYS1119849 -Node: VMS Installation1120349 -Node: VMS Compilation1121141 -Ref: VMS Compilation-Footnote-11122363 -Node: VMS Dynamic Extensions1122421 -Node: VMS Installation Details1124105 -Node: VMS Running1126357 -Node: VMS GNV1129193 -Node: VMS Old Gawk1129927 -Node: Bugs1130397 -Node: Other Versions1134280 -Node: Installation summary1140704 -Node: Notes1141760 -Node: Compatibility Mode1142625 -Node: Additions1143407 -Node: Accessing The Source1144332 -Node: Adding Code1145767 -Node: New Ports1151924 -Node: Derived Files1156406 -Ref: Derived Files-Footnote-11161881 -Ref: Derived Files-Footnote-21161915 -Ref: Derived Files-Footnote-31162511 -Node: Future Extensions1162625 -Node: Implementation Limitations1163231 -Node: Extension Design1164479 -Node: Old Extension Problems1165633 -Ref: Old Extension Problems-Footnote-11167150 -Node: Extension New Mechanism Goals1167207 -Ref: Extension New Mechanism Goals-Footnote-11170567 -Node: Extension Other Design Decisions1170756 -Node: Extension Future Growth1172864 -Node: Old Extension Mechanism1173700 -Node: Notes summary1175462 -Node: Basic Concepts1176648 -Node: Basic High Level1177329 -Ref: figure-general-flow1177601 -Ref: figure-process-flow1178200 -Ref: Basic High Level-Footnote-11181429 -Node: Basic Data Typing1181614 -Node: Glossary1184942 -Node: Copying1216871 -Node: GNU Free Documentation License1254427 -Node: Index1279563 +Node: Getting Started73114 +Node: Running gawk75553 +Node: One-shot76743 +Node: Read Terminal78007 +Node: Long80038 +Node: Executable Scripts81551 +Ref: Executable Scripts-Footnote-184340 +Node: Comments84443 +Node: Quoting86925 +Node: DOS Quoting92443 +Node: Sample Data Files93118 +Node: Very Simple95713 +Node: Two Rules100612 +Node: More Complex102498 +Node: Statements/Lines105360 +Ref: Statements/Lines-Footnote-1109815 +Node: Other Features110080 +Node: When111016 +Ref: When-Footnote-1112770 +Node: Intro Summary112835 +Node: Invoking Gawk113719 +Node: Command Line115233 +Node: Options116031 +Ref: Options-Footnote-1131953 +Ref: Options-Footnote-2132182 +Node: Other Arguments132207 +Node: Naming Standard Input135155 +Node: Environment Variables136248 +Node: AWKPATH Variable136806 +Ref: AWKPATH Variable-Footnote-1140103 +Ref: AWKPATH Variable-Footnote-2140148 +Node: AWKLIBPATH Variable140408 +Node: Other Environment Variables141551 +Node: Exit Status145309 +Node: Include Files145985 +Node: Loading Shared Libraries149574 +Node: Obsolete151001 +Node: Undocumented151693 +Node: Invoking Summary151960 +Node: Regexp153623 +Node: Regexp Usage155077 +Node: Escape Sequences157114 +Node: Regexp Operators163124 +Ref: Regexp Operators-Footnote-1170534 +Ref: Regexp Operators-Footnote-2170681 +Node: Bracket Expressions170779 +Ref: table-char-classes172794 +Node: Leftmost Longest175736 +Node: Computed Regexps177038 +Node: GNU Regexp Operators180467 +Node: Case-sensitivity184139 +Ref: Case-sensitivity-Footnote-1187024 +Ref: Case-sensitivity-Footnote-2187259 +Node: Regexp Summary187367 +Node: Reading Files188834 +Node: Records190927 +Node: awk split records191660 +Node: gawk split records196589 +Ref: gawk split records-Footnote-1201128 +Node: Fields201165 +Ref: Fields-Footnote-1203943 +Node: Nonconstant Fields204029 +Ref: Nonconstant Fields-Footnote-1206267 +Node: Changing Fields206470 +Node: Field Separators212401 +Node: Default Field Splitting215105 +Node: Regexp Field Splitting216222 +Node: Single Character Fields219572 +Node: Command Line Field Separator220631 +Node: Full Line Fields223848 +Ref: Full Line Fields-Footnote-1225369 +Ref: Full Line Fields-Footnote-2225415 +Node: Field Splitting Summary225516 +Node: Constant Size227590 +Node: Splitting By Content232173 +Ref: Splitting By Content-Footnote-1236138 +Node: Multiple Line236301 +Ref: Multiple Line-Footnote-1242182 +Node: Getline242361 +Node: Plain Getline244568 +Node: Getline/Variable247208 +Node: Getline/File248357 +Node: Getline/Variable/File249742 +Ref: Getline/Variable/File-Footnote-1251345 +Node: Getline/Pipe251432 +Node: Getline/Variable/Pipe254110 +Node: Getline/Coprocess255241 +Node: Getline/Variable/Coprocess256505 +Node: Getline Notes257244 +Node: Getline Summary260038 +Ref: table-getline-variants260450 +Node: Read Timeout261279 +Ref: Read Timeout-Footnote-1265116 +Node: Command-line directories265174 +Node: Input Summary266079 +Node: Input Exercises269464 +Node: Printing270192 +Node: Print271969 +Node: Print Examples273426 +Node: Output Separators276205 +Node: OFMT278223 +Node: Printf279578 +Node: Basic Printf280363 +Node: Control Letters281935 +Node: Format Modifiers285920 +Node: Printf Examples291930 +Node: Redirection294416 +Node: Special FD301254 +Ref: Special FD-Footnote-1304420 +Node: Special Files304494 +Node: Other Inherited Files305111 +Node: Special Network306111 +Node: Special Caveats306973 +Node: Close Files And Pipes307922 +Ref: Close Files And Pipes-Footnote-1315113 +Ref: Close Files And Pipes-Footnote-2315261 +Node: Output Summary315411 +Node: Output Exercises316409 +Node: Expressions317089 +Node: Values318278 +Node: Constants318955 +Node: Scalar Constants319646 +Ref: Scalar Constants-Footnote-1320508 +Node: Nondecimal-numbers320758 +Node: Regexp Constants323768 +Node: Using Constant Regexps324294 +Node: Variables327457 +Node: Using Variables328114 +Node: Assignment Options330025 +Node: Conversion331900 +Node: Strings And Numbers332424 +Ref: Strings And Numbers-Footnote-1335489 +Node: Locale influences conversions335598 +Ref: table-locale-affects338344 +Node: All Operators338936 +Node: Arithmetic Ops339565 +Node: Concatenation342070 +Ref: Concatenation-Footnote-1344889 +Node: Assignment Ops344996 +Ref: table-assign-ops349975 +Node: Increment Ops351285 +Node: Truth Values and Conditions354716 +Node: Truth Values355799 +Node: Typing and Comparison356848 +Node: Variable Typing357664 +Node: Comparison Operators361331 +Ref: table-relational-ops361741 +Node: POSIX String Comparison365236 +Ref: POSIX String Comparison-Footnote-1366308 +Node: Boolean Ops366447 +Ref: Boolean Ops-Footnote-1370925 +Node: Conditional Exp371016 +Node: Function Calls372754 +Node: Precedence376634 +Node: Locales380294 +Node: Expressions Summary381926 +Node: Patterns and Actions384497 +Node: Pattern Overview385617 +Node: Regexp Patterns387296 +Node: Expression Patterns387839 +Node: Ranges391619 +Node: BEGIN/END394726 +Node: Using BEGIN/END395487 +Ref: Using BEGIN/END-Footnote-1398223 +Node: I/O And BEGIN/END398329 +Node: BEGINFILE/ENDFILE400644 +Node: Empty403541 +Node: Using Shell Variables403858 +Node: Action Overview406131 +Node: Statements408457 +Node: If Statement410305 +Node: While Statement411800 +Node: Do Statement413828 +Node: For Statement414976 +Node: Switch Statement418134 +Node: Break Statement420516 +Node: Continue Statement422557 +Node: Next Statement424384 +Node: Nextfile Statement426765 +Node: Exit Statement429393 +Node: Built-in Variables431804 +Node: User-modified432937 +Ref: User-modified-Footnote-1440640 +Node: Auto-set440702 +Ref: Auto-set-Footnote-1453754 +Ref: Auto-set-Footnote-2453959 +Node: ARGC and ARGV454015 +Node: Pattern Action Summary458233 +Node: Arrays460666 +Node: Array Basics461995 +Node: Array Intro462839 +Ref: figure-array-elements464773 +Ref: Array Intro-Footnote-1467393 +Node: Reference to Elements467521 +Node: Assigning Elements469983 +Node: Array Example470474 +Node: Scanning an Array472233 +Node: Controlling Scanning475253 +Ref: Controlling Scanning-Footnote-1480647 +Node: Numeric Array Subscripts480963 +Node: Uninitialized Subscripts483148 +Node: Delete484765 +Ref: Delete-Footnote-1487514 +Node: Multidimensional487571 +Node: Multiscanning490668 +Node: Arrays of Arrays492257 +Node: Arrays Summary497011 +Node: Functions499102 +Node: Built-in500141 +Node: Calling Built-in501219 +Node: Numeric Functions503214 +Ref: Numeric Functions-Footnote-1507230 +Ref: Numeric Functions-Footnote-2507587 +Ref: Numeric Functions-Footnote-3507635 +Node: String Functions507907 +Ref: String Functions-Footnote-1531408 +Ref: String Functions-Footnote-2531537 +Ref: String Functions-Footnote-3531785 +Node: Gory Details531872 +Ref: table-sub-escapes533653 +Ref: table-sub-proposed535168 +Ref: table-posix-sub536530 +Ref: table-gensub-escapes538067 +Ref: Gory Details-Footnote-1538900 +Node: I/O Functions539051 +Ref: I/O Functions-Footnote-1546287 +Node: Time Functions546434 +Ref: Time Functions-Footnote-1556943 +Ref: Time Functions-Footnote-2557011 +Ref: Time Functions-Footnote-3557169 +Ref: Time Functions-Footnote-4557280 +Ref: Time Functions-Footnote-5557392 +Ref: Time Functions-Footnote-6557619 +Node: Bitwise Functions557885 +Ref: table-bitwise-ops558447 +Ref: Bitwise Functions-Footnote-1562775 +Node: Type Functions562947 +Node: I18N Functions564099 +Node: User-defined565746 +Node: Definition Syntax566551 +Ref: Definition Syntax-Footnote-1572210 +Node: Function Example572281 +Ref: Function Example-Footnote-1575202 +Node: Function Caveats575224 +Node: Calling A Function575742 +Node: Variable Scope576700 +Node: Pass By Value/Reference579693 +Node: Return Statement583190 +Node: Dynamic Typing586169 +Node: Indirect Calls587098 +Ref: Indirect Calls-Footnote-1598404 +Node: Functions Summary598532 +Node: Library Functions601234 +Ref: Library Functions-Footnote-1604842 +Ref: Library Functions-Footnote-2604985 +Node: Library Names605156 +Ref: Library Names-Footnote-1608614 +Ref: Library Names-Footnote-2608837 +Node: General Functions608923 +Node: Strtonum Function610026 +Node: Assert Function613048 +Node: Round Function616372 +Node: Cliff Random Function617913 +Node: Ordinal Functions618929 +Ref: Ordinal Functions-Footnote-1621992 +Ref: Ordinal Functions-Footnote-2622244 +Node: Join Function622455 +Ref: Join Function-Footnote-1624225 +Node: Getlocaltime Function624425 +Node: Readfile Function628169 +Node: Shell Quoting630141 +Node: Data File Management631542 +Node: Filetrans Function632174 +Node: Rewind Function636270 +Node: File Checking637656 +Ref: File Checking-Footnote-1638989 +Node: Empty Files639190 +Node: Ignoring Assigns641169 +Node: Getopt Function642719 +Ref: Getopt Function-Footnote-1654183 +Node: Passwd Functions654383 +Ref: Passwd Functions-Footnote-1663223 +Node: Group Functions663311 +Ref: Group Functions-Footnote-1671208 +Node: Walking Arrays671413 +Node: Library Functions Summary673013 +Node: Library Exercises674417 +Node: Sample Programs675697 +Node: Running Examples676467 +Node: Clones677195 +Node: Cut Program678419 +Node: Egrep Program688139 +Ref: Egrep Program-Footnote-1695642 +Node: Id Program695752 +Node: Split Program699428 +Ref: Split Program-Footnote-1702882 +Node: Tee Program703010 +Node: Uniq Program705799 +Node: Wc Program713218 +Ref: Wc Program-Footnote-1717468 +Node: Miscellaneous Programs717562 +Node: Dupword Program718775 +Node: Alarm Program720806 +Node: Translate Program725611 +Ref: Translate Program-Footnote-1730174 +Node: Labels Program730444 +Ref: Labels Program-Footnote-1733795 +Node: Word Sorting733879 +Node: History Sorting737949 +Node: Extract Program739784 +Node: Simple Sed747308 +Node: Igawk Program750378 +Ref: Igawk Program-Footnote-1764704 +Ref: Igawk Program-Footnote-2764905 +Ref: Igawk Program-Footnote-3765027 +Node: Anagram Program765142 +Node: Signature Program768203 +Node: Programs Summary769450 +Node: Programs Exercises770671 +Ref: Programs Exercises-Footnote-1774802 +Node: Advanced Features774893 +Node: Nondecimal Data776875 +Node: Array Sorting778465 +Node: Controlling Array Traversal779165 +Ref: Controlling Array Traversal-Footnote-1787531 +Node: Array Sorting Functions787649 +Ref: Array Sorting Functions-Footnote-1791535 +Node: Two-way I/O791731 +Ref: Two-way I/O-Footnote-1796676 +Ref: Two-way I/O-Footnote-2796862 +Node: TCP/IP Networking796944 +Node: Profiling799816 +Node: Advanced Features Summary807357 +Node: Internationalization809290 +Node: I18N and L10N810770 +Node: Explaining gettext811456 +Ref: Explaining gettext-Footnote-1816481 +Ref: Explaining gettext-Footnote-2816665 +Node: Programmer i18n816830 +Ref: Programmer i18n-Footnote-1821706 +Node: Translator i18n821755 +Node: String Extraction822549 +Ref: String Extraction-Footnote-1823680 +Node: Printf Ordering823766 +Ref: Printf Ordering-Footnote-1826552 +Node: I18N Portability826616 +Ref: I18N Portability-Footnote-1829072 +Node: I18N Example829135 +Ref: I18N Example-Footnote-1831938 +Node: Gawk I18N832010 +Node: I18N Summary832654 +Node: Debugger833994 +Node: Debugging835016 +Node: Debugging Concepts835457 +Node: Debugging Terms837267 +Node: Awk Debugging839839 +Node: Sample Debugging Session840745 +Node: Debugger Invocation841279 +Node: Finding The Bug842664 +Node: List of Debugger Commands849143 +Node: Breakpoint Control850475 +Node: Debugger Execution Control854152 +Node: Viewing And Changing Data857511 +Node: Execution Stack860887 +Node: Debugger Info862522 +Node: Miscellaneous Debugger Commands866567 +Node: Readline Support871568 +Node: Limitations872462 +Node: Debugging Summary874577 +Node: Arbitrary Precision Arithmetic875751 +Node: Computer Arithmetic877167 +Ref: table-numeric-ranges880766 +Ref: Computer Arithmetic-Footnote-1881290 +Node: Math Definitions881347 +Ref: table-ieee-formats884642 +Ref: Math Definitions-Footnote-1885246 +Node: MPFR features885351 +Node: FP Math Caution887022 +Ref: FP Math Caution-Footnote-1888072 +Node: Inexactness of computations888441 +Node: Inexact representation889400 +Node: Comparing FP Values890758 +Node: Errors accumulate891840 +Node: Getting Accuracy893272 +Node: Try To Round895976 +Node: Setting precision896875 +Ref: table-predefined-precision-strings897559 +Node: Setting the rounding mode899388 +Ref: table-gawk-rounding-modes899752 +Ref: Setting the rounding mode-Footnote-1903204 +Node: Arbitrary Precision Integers903383 +Ref: Arbitrary Precision Integers-Footnote-1906367 +Node: POSIX Floating Point Problems906516 +Ref: POSIX Floating Point Problems-Footnote-1910395 +Node: Floating point summary910433 +Node: Dynamic Extensions912629 +Node: Extension Intro914181 +Node: Plugin License915446 +Node: Extension Mechanism Outline916243 +Ref: figure-load-extension916671 +Ref: figure-register-new-function918151 +Ref: figure-call-new-function919155 +Node: Extension API Description921142 +Node: Extension API Functions Introduction922592 +Node: General Data Types927413 +Ref: General Data Types-Footnote-1933312 +Node: Memory Allocation Functions933611 +Ref: Memory Allocation Functions-Footnote-1936450 +Node: Constructor Functions936546 +Node: Registration Functions938280 +Node: Extension Functions938965 +Node: Exit Callback Functions941262 +Node: Extension Version String942510 +Node: Input Parsers943175 +Node: Output Wrappers953054 +Node: Two-way processors957569 +Node: Printing Messages959773 +Ref: Printing Messages-Footnote-1960849 +Node: Updating `ERRNO'961001 +Node: Requesting Values961741 +Ref: table-value-types-returned962469 +Node: Accessing Parameters963426 +Node: Symbol Table Access964657 +Node: Symbol table by name965171 +Node: Symbol table by cookie967152 +Ref: Symbol table by cookie-Footnote-1971296 +Node: Cached values971359 +Ref: Cached values-Footnote-1974858 +Node: Array Manipulation974949 +Ref: Array Manipulation-Footnote-1976047 +Node: Array Data Types976084 +Ref: Array Data Types-Footnote-1978739 +Node: Array Functions978831 +Node: Flattening Arrays982685 +Node: Creating Arrays989577 +Node: Extension API Variables994348 +Node: Extension Versioning994984 +Node: Extension API Informational Variables996885 +Node: Extension API Boilerplate997950 +Node: Finding Extensions1001759 +Node: Extension Example1002319 +Node: Internal File Description1003091 +Node: Internal File Ops1007158 +Ref: Internal File Ops-Footnote-11018828 +Node: Using Internal File Ops1018968 +Ref: Using Internal File Ops-Footnote-11021351 +Node: Extension Samples1021624 +Node: Extension Sample File Functions1023150 +Node: Extension Sample Fnmatch1030788 +Node: Extension Sample Fork1032279 +Node: Extension Sample Inplace1033494 +Node: Extension Sample Ord1035169 +Node: Extension Sample Readdir1036005 +Ref: table-readdir-file-types1036881 +Node: Extension Sample Revout1037692 +Node: Extension Sample Rev2way1038282 +Node: Extension Sample Read write array1039022 +Node: Extension Sample Readfile1040962 +Node: Extension Sample Time1042057 +Node: Extension Sample API Tests1043406 +Node: gawkextlib1043897 +Node: Extension summary1046555 +Node: Extension Exercises1050244 +Node: Language History1050966 +Node: V7/SVR3.11052622 +Node: SVR41054803 +Node: POSIX1056248 +Node: BTL1057637 +Node: POSIX/GNU1058371 +Node: Feature History1063935 +Node: Common Extensions1077033 +Node: Ranges and Locales1078357 +Ref: Ranges and Locales-Footnote-11082975 +Ref: Ranges and Locales-Footnote-21083002 +Ref: Ranges and Locales-Footnote-31083236 +Node: Contributors1083457 +Node: History summary1088998 +Node: Installation1090368 +Node: Gawk Distribution1091314 +Node: Getting1091798 +Node: Extracting1092621 +Node: Distribution contents1094256 +Node: Unix Installation1099973 +Node: Quick Installation1100590 +Node: Additional Configuration Options1103014 +Node: Configuration Philosophy1104752 +Node: Non-Unix Installation1107121 +Node: PC Installation1107579 +Node: PC Binary Installation1108898 +Node: PC Compiling1110746 +Ref: PC Compiling-Footnote-11113767 +Node: PC Testing1113876 +Node: PC Using1115052 +Node: Cygwin1119167 +Node: MSYS1119990 +Node: VMS Installation1120490 +Node: VMS Compilation1121282 +Ref: VMS Compilation-Footnote-11122504 +Node: VMS Dynamic Extensions1122562 +Node: VMS Installation Details1124246 +Node: VMS Running1126498 +Node: VMS GNV1129334 +Node: VMS Old Gawk1130068 +Node: Bugs1130538 +Node: Other Versions1134421 +Node: Installation summary1140845 +Node: Notes1141901 +Node: Compatibility Mode1142766 +Node: Additions1143548 +Node: Accessing The Source1144473 +Node: Adding Code1145908 +Node: New Ports1152065 +Node: Derived Files1156547 +Ref: Derived Files-Footnote-11162022 +Ref: Derived Files-Footnote-21162056 +Ref: Derived Files-Footnote-31162652 +Node: Future Extensions1162766 +Node: Implementation Limitations1163372 +Node: Extension Design1164620 +Node: Old Extension Problems1165774 +Ref: Old Extension Problems-Footnote-11167291 +Node: Extension New Mechanism Goals1167348 +Ref: Extension New Mechanism Goals-Footnote-11170708 +Node: Extension Other Design Decisions1170897 +Node: Extension Future Growth1173005 +Node: Old Extension Mechanism1173841 +Node: Notes summary1175603 +Node: Basic Concepts1176789 +Node: Basic High Level1177470 +Ref: figure-general-flow1177742 +Ref: figure-process-flow1178341 +Ref: Basic High Level-Footnote-11181570 +Node: Basic Data Typing1181755 +Node: Glossary1185083 +Node: Copying1217012 +Node: GNU Free Documentation License1254568 +Node: Index1279704  End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 3f2afed3..e7d979d9 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -1300,7 +1300,7 @@ October 2014 Nof Ayalon Israel - December 2014 + February 2015 @end docbook @@ -2284,14 +2284,14 @@ which they raised and educated me. Finally, I also must acknowledge my gratitude to G-d, for the many opportunities He has sent my way, as well as for the gifts He has given me with which to take advantage of those opportunities. -@iftex +@ifnotdocbook @sp 2 @noindent Arnold Robbins @* Nof Ayalon @* Israel @* -December 2014 -@end iftex +February 2015 +@end ifnotdocbook @ifnotinfo @part @value{PART1}The @command{awk} Language @@ -31589,7 +31589,7 @@ indicates what is in the @code{union}. Representing numbers is easy---the API uses a C @code{double}. Strings require more work. Because @command{gawk} allows embedded @sc{nul} bytes in string values, a string must be represented as a pair containing a -data-pointer and length. This is the @code{awk_string_t} type. +data pointer and length. This is the @code{awk_string_t} type. Identifiers (i.e., the names of global variables) can be associated with either scalar values or with arrays. In addition, @command{gawk} @@ -31602,12 +31602,12 @@ of the @code{union} as if they were fields in a @code{struct}; this is a common coding practice in C. Such code is easier to write and to read, but it remains @emph{your} responsibility to make sure that the @code{val_type} member correctly reflects the type of the value in -the @code{awk_value_t}. +the @code{awk_value_t} struct. Conceptually, the first three members of the @code{union} (number, string, and array) are all that is needed for working with @command{awk} values. However, because the API provides routines for accessing and changing -the value of global scalar variables only by using the variable's name, +the value of a global scalar variable only by using the variable's name, there is a performance penalty: @command{gawk} must find the variable each time it is accessed and changed. This turns out to be a real issue, not just a theoretical one. @@ -31625,7 +31625,9 @@ See also the entry for ``Cookie'' in the @ref{Glossary}. object for that variable, and then use the cookie for getting the variable's value or for changing the variable's value. -This is the @code{awk_scalar_t} type and @code{scalar_cookie} macro. +The @code{awk_scalar_t} type holds a scalar cookie, and the +@code{scalar_cookie} macro provides access to the value of that type +in the @code{awk_value_t} struct. Given a scalar cookie, @command{gawk} can directly retrieve or modify the value, as required, without having to find it first. @@ -31634,8 +31636,8 @@ If you know that you wish to use the same numeric or string @emph{value} for one or more variables, you can create the value once, retaining a @dfn{value cookie} for it, and then pass in that value cookie whenever you wish to set the value of a -variable. This saves both storage space within the running @command{gawk} -process as well as the time needed to create the value. +variable. This both storage space within the running @command{gawk} +process and reduces the time needed to create the value. @node Memory Allocation Functions @subsection Memory Allocation Functions and Convenience Macros diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 3e97423a..c41d5a68 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -1295,7 +1295,7 @@ October 2014 Nof Ayalon Israel - December 2014 + February 2015 @end docbook @@ -2251,14 +2251,14 @@ which they raised and educated me. Finally, I also must acknowledge my gratitude to G-d, for the many opportunities He has sent my way, as well as for the gifts He has given me with which to take advantage of those opportunities. -@iftex +@ifnotdocbook @sp 2 @noindent Arnold Robbins @* Nof Ayalon @* Israel @* -December 2014 -@end iftex +February 2015 +@end ifnotdocbook @ifnotinfo @part @value{PART1}The @command{awk} Language @@ -30680,7 +30680,7 @@ indicates what is in the @code{union}. Representing numbers is easy---the API uses a C @code{double}. Strings require more work. Because @command{gawk} allows embedded @sc{nul} bytes in string values, a string must be represented as a pair containing a -data-pointer and length. This is the @code{awk_string_t} type. +data pointer and length. This is the @code{awk_string_t} type. Identifiers (i.e., the names of global variables) can be associated with either scalar values or with arrays. In addition, @command{gawk} @@ -30693,12 +30693,12 @@ of the @code{union} as if they were fields in a @code{struct}; this is a common coding practice in C. Such code is easier to write and to read, but it remains @emph{your} responsibility to make sure that the @code{val_type} member correctly reflects the type of the value in -the @code{awk_value_t}. +the @code{awk_value_t} struct. Conceptually, the first three members of the @code{union} (number, string, and array) are all that is needed for working with @command{awk} values. However, because the API provides routines for accessing and changing -the value of global scalar variables only by using the variable's name, +the value of a global scalar variable only by using the variable's name, there is a performance penalty: @command{gawk} must find the variable each time it is accessed and changed. This turns out to be a real issue, not just a theoretical one. @@ -30716,7 +30716,9 @@ See also the entry for ``Cookie'' in the @ref{Glossary}. object for that variable, and then use the cookie for getting the variable's value or for changing the variable's value. -This is the @code{awk_scalar_t} type and @code{scalar_cookie} macro. +The @code{awk_scalar_t} type holds a scalar cookie, and the +@code{scalar_cookie} macro provides access to the value of that type +in the @code{awk_value_t} struct. Given a scalar cookie, @command{gawk} can directly retrieve or modify the value, as required, without having to find it first. @@ -30725,8 +30727,8 @@ If you know that you wish to use the same numeric or string @emph{value} for one or more variables, you can create the value once, retaining a @dfn{value cookie} for it, and then pass in that value cookie whenever you wish to set the value of a -variable. This saves both storage space within the running @command{gawk} -process as well as the time needed to create the value. +variable. This both storage space within the running @command{gawk} +process and reduces the time needed to create the value. @node Memory Allocation Functions @subsection Memory Allocation Functions and Convenience Macros -- cgit v1.2.3 From b3dcca92ca8160c07dad32617339fc5d3c636425 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 10 Feb 2015 22:22:11 +0200 Subject: Bug fix in profile.c. --- ChangeLog | 5 +++++ profile.c | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index f116265a..026be5e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-02-10 Arnold D. Robbins + + * profile.c (pprint): Restore printing of count for rules. + Bug report by Hermann Peifer. + 2015-02-07 Arnold D. Robbins * regcomp.c, regex.c, regex.h, regex_internal.c, regex_internal.h, diff --git a/profile.c b/profile.c index 233bca0f..2cb9e159 100644 --- a/profile.c +++ b/profile.c @@ -226,6 +226,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header) if (do_profile && ! rule_count[rule]++) fprintf(prof_fp, _("\t# Rule(s)\n\n")); ip1 = pc->nexti; + indent(ip1->exec_count); if (ip1 != (pc + 1)->firsti) { /* non-empty pattern */ pprint(ip1->nexti, (pc + 1)->firsti, false); /* Allow for case where the "pattern" is just a comment */ -- cgit v1.2.3 From 2f49027b6d6b1f03ae07c5cd9625b072465079bd Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 11 Feb 2015 23:21:28 +0200 Subject: O'Reilly edits, through Chapter 16. --- ChangeLog | 4 + doc/ChangeLog | 4 + doc/gawk.info | 575 +++++++++++++++++++++++++------------------------- doc/gawk.texi | 272 ++++++++++++------------ doc/gawktexi.in | 272 ++++++++++++------------ extension/ChangeLog | 4 + extension/filefuncs.c | 2 +- gawkapi.h | 2 +- 8 files changed, 582 insertions(+), 553 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d175372..773afd3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-02-11 Arnold D. Robbins + + * gawkapi.h: Fix spelling error in comment. + 2015-02-07 Arnold D. Robbins * regcomp.c, regex.c, regex.h, regex_internal.c, regex_internal.h, diff --git a/doc/ChangeLog b/doc/ChangeLog index c62d3022..9af9ef06 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2015-02-11 Arnold D. Robbins + + * gawktexi.in: O'Reilly fixes. + 2015-02-10 Arnold D. Robbins * gawktexi.in: Minor fixes, O'Reilly fixes. diff --git a/doc/gawk.info b/doc/gawk.info index eb8d07b5..8061bbd2 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -23071,7 +23071,7 @@ first. If you know that you wish to use the same numeric or string _value_ for one or more variables, you can create the value once, retaining a "value cookie" for it, and then pass in that value cookie whenever you -wish to set the value of a variable. This both storage space within +wish to set the value of a variable. This saves storage space within the running `gawk' process and reduces the time needed to create the value. @@ -23108,7 +23108,7 @@ prototypes, in the way that extension code would use them: `void gawk_free(void *ptr);' Call the correct version of `free()' to release storage that was - allocated with `gawk_malloc()', `gawk_calloc()' or + allocated with `gawk_malloc()', `gawk_calloc()', or `gawk_realloc()'. The API has to provide these functions because it is possible for an @@ -23120,7 +23120,7 @@ version of `malloc()', unexpected behavior would likely result. Two convenience macros may be used for allocating storage from `gawk_malloc()' and `gawk_realloc()'. If the allocation fails, they cause `gawk' to exit with a fatal error message. They should be used -as if they were procedure calls that do not return a value. +as if they were procedure calls that do not return a value: `#define emalloc(pointer, type, size, message) ...' The arguments to this macro are as follows: @@ -23150,13 +23150,13 @@ as if they were procedure calls that do not return a value. make_malloced_string(message, strlen(message), & result); `#define erealloc(pointer, type, size, message) ...' - This is like `emalloc()', but it calls `gawk_realloc()', instead - of `gawk_malloc()'. The arguments are the same as for the + This is like `emalloc()', but it calls `gawk_realloc()' instead of + `gawk_malloc()'. The arguments are the same as for the `emalloc()' macro. ---------- Footnotes ---------- - (1) This is more common on MS-Windows systems, but can happen on + (1) This is more common on MS-Windows systems, but it can happen on Unix-like systems as well.  @@ -23182,7 +23182,7 @@ extension code would use them: This function creates a string value in the `awk_value_t' variable pointed to by `result'. It expects `string' to be a `char *' value pointing to data previously obtained from `gawk_malloc()', - `gawk_calloc()' or `gawk_realloc()'. The idea here is that the + `gawk_calloc()', or `gawk_realloc()'. The idea here is that the data is passed directly to `gawk', which assumes responsibility for it. It returns `result'. @@ -23232,7 +23232,7 @@ Extension functions are described by the following record: The fields are: `const char *name;' - The name of the new function. `awk' level code calls the function + The name of the new function. `awk'-level code calls the function by this name. This is a regular C string. Function names must obey the rules for `awk' identifiers. That is, @@ -23244,7 +23244,7 @@ Extension functions are described by the following record: This is a pointer to the C function that provides the extension's functionality. The function must fill in `*result' with either a number or a string. `gawk' takes ownership of any string memory. - As mentioned earlier, string memory *must* come from one of + As mentioned earlier, string memory _must_ come from one of `gawk_malloc()', `gawk_calloc()', or `gawk_realloc()'. The `num_actual_args' argument tells the C function how many @@ -23291,10 +23291,10 @@ function with `gawk' using the following function: `gawk' intends to pass to the `exit()' system call. `arg0' - A pointer to private data which `gawk' saves in order to pass + A pointer to private data that `gawk' saves in order to pass to the function pointed to by `funcp'. - Exit callback functions are called in last-in-first-out (LIFO) + Exit callback functions are called in last-in, first-out (LIFO) order--that is, in the reverse order in which they are registered with `gawk'. @@ -23304,8 +23304,8 @@ File: gawk.info, Node: Extension Version String, Next: Input Parsers, Prev: E 16.4.5.3 Registering An Extension Version String ................................................ -You can register a version string which indicates the name and version -of your extension, with `gawk', as follows: +You can register a version string that indicates the name and version +of your extension with `gawk', as follows: `void register_ext_version(const char *version);' Register the string pointed to by `version' with `gawk'. Note @@ -23328,7 +23328,7 @@ Files::). Additionally, it sets the value of `RT' (*note Built-in Variables::). If you want, you can provide your own custom input parser. An input -parser's job is to return a record to the `gawk' record processing +parser's job is to return a record to the `gawk' record-processing code, along with indicators for the value and length of the data to be used for `RT', if any. @@ -23345,10 +23345,10 @@ used for `RT', if any. `awk_bool_t XXX_take_control_of(awk_input_buf_t *iobuf);' When `gawk' decides to hand control of the file over to the input parser, it calls this function. This function in turn must fill - in certain fields in the `awk_input_buf_t' structure, and ensure + in certain fields in the `awk_input_buf_t' structure and ensure that certain conditions are true. It should then return true. If - an error of some kind occurs, it should not fill in any fields, - and should return false; then `gawk' will not use the input parser. + an error of some kind occurs, it should not fill in any fields and + should return false; then `gawk' will not use the input parser. The details are presented shortly. Your extension should package these functions inside an @@ -23425,10 +23425,10 @@ the `struct stat', or any combination of these factors. Once `XXX_can_take_file()' has returned true, and `gawk' has decided to use your input parser, it calls `XXX_take_control_of()'. That -function then fills one of either the `get_record' field or the -`read_func' field in the `awk_input_buf_t'. It must also ensure that -`fd' is _not_ set to `INVALID_HANDLE'. The following list describes -the fields that may be filled by `XXX_take_control_of()': +function then fills either the `get_record' field or the `read_func' +field in the `awk_input_buf_t'. It must also ensure that `fd' is _not_ +set to `INVALID_HANDLE'. The following list describes the fields that +may be filled by `XXX_take_control_of()': `void *opaque;' This is used to hold any state information needed by the input @@ -23445,22 +23445,22 @@ the fields that may be filled by `XXX_take_control_of()': Its behavior is described in the text following this list. `ssize_t (*read_func)();' - This function pointer should point to function that has the same + This function pointer should point to a function that has the same behavior as the standard POSIX `read()' system call. It is an alternative to the `get_record' pointer. Its behavior is also described in the text following this list. `void (*close_func)(struct awk_input *iobuf);' This function pointer should point to a function that does the - "tear down." It should release any resources allocated by + "teardown." It should release any resources allocated by `XXX_take_control_of()'. It may also close the file. If it does so, it should set the `fd' field to `INVALID_HANDLE'. If `fd' is still not `INVALID_HANDLE' after the call to this function, `gawk' calls the regular `close()' system call. - Having a "tear down" function is optional. If your input parser - does not need it, do not set this field. Then, `gawk' calls the + Having a "teardown" function is optional. If your input parser does + not need it, do not set this field. Then, `gawk' calls the regular `close()' system call on the file descriptor, so it should be valid. @@ -23468,7 +23468,7 @@ the fields that may be filled by `XXX_take_control_of()': records. The parameters are as follows: `char **out' - This is a pointer to a `char *' variable which is set to point to + This is a pointer to a `char *' variable that is set to point to the record. `gawk' makes its own copy of the data, so the extension must manage this storage. @@ -23517,16 +23517,16 @@ explicitly. NOTE: You must choose one method or the other: either a function that returns a record, or one that returns raw data. In particular, if you supply a function to get a record, `gawk' will - call it, and never call the raw read function. + call it, and will never call the raw read function. `gawk' ships with a sample extension that reads directories, -returning records for each entry in the directory (*note Extension -Sample Readdir::). You may wish to use that code as a guide for writing -your own input parser. +returning records for each entry in a directory (*note Extension Sample +Readdir::). You may wish to use that code as a guide for writing your +own input parser. When writing an input parser, you should think about (and document) how it is expected to interact with `awk' code. You may want it to -always be called, and take effect as appropriate (as the `readdir' +always be called, and to take effect as appropriate (as the `readdir' extension does). Or you may want it to take effect based upon the value of an `awk' variable, as the XML extension from the `gawkextlib' project does (*note gawkextlib::). In the latter case, code in a @@ -23626,17 +23626,17 @@ in the `awk_output_buf_t'. The data members are as follows: These pointers should be set to point to functions that perform the equivalent function as the `' functions do, if appropriate. `gawk' uses these function pointers for all output. - `gawk' initializes the pointers to point to internal, "pass - through" functions that just call the regular `' - functions, so an extension only needs to redefine those functions - that are appropriate for what it does. + `gawk' initializes the pointers to point to internal "pass-through" + functions that just call the regular `' functions, so an + extension only needs to redefine those functions that are + appropriate for what it does. The `XXX_can_take_file()' function should make a decision based upon the `name' and `mode' fields, and any additional state (such as `awk' variable values) that is appropriate. When `gawk' calls `XXX_take_control_of()', that function should fill -in the other fields, as appropriate, except for `fp', which it should +in the other fields as appropriate, except for `fp', which it should just use normally. You register your output wrapper with the following function: @@ -23673,16 +23673,17 @@ structures as described earlier. The name of the two-way processor. `awk_bool_t (*can_take_two_way)(const char *name);' - This function returns true if it wants to take over two-way I/O - for this file name. It should not change any state (variable - values, etc.) within `gawk'. + The function pointed to by this field should return true if it + wants to take over two-way I/O for this file name. It should not + change any state (variable values, etc.) within `gawk'. `awk_bool_t (*take_control_of)(const char *name,' ` awk_input_buf_t *inbuf,' ` awk_output_buf_t *outbuf);' - This function should fill in the `awk_input_buf_t' and - `awk_outut_buf_t' structures pointed to by `inbuf' and `outbuf', - respectively. These structures were described earlier. + The function pointed to by this field should fill in the + `awk_input_buf_t' and `awk_outut_buf_t' structures pointed to by + `inbuf' and `outbuf', respectively. These structures were + described earlier. `awk_const struct two_way_processor *awk_const next;' This is for use by `gawk'; therefore it is marked `awk_const' so @@ -23706,7 +23707,7 @@ File: gawk.info, Node: Printing Messages, Next: Updating `ERRNO', Prev: Regis You can print different kinds of warning messages from your extension, as described here. Note that for these functions, you must pass in the -extension id received from `gawk' when the extension was loaded:(1) +extension ID received from `gawk' when the extension was loaded:(1) `void fatal(awk_ext_id_t id, const char *format, ...);' Print a message and then cause `gawk' to exit immediately. @@ -23762,7 +23763,7 @@ value you expect. If the actual value matches what you requested, the function returns true and fills in the `awk_value_t' result. Otherwise, the function returns false, and the `val_type' member indicates the type of the actual value. You may then print an error -message, or reissue the request for the actual value type, as +message or reissue the request for the actual value type, as appropriate. This behavior is summarized in *note table-value-types-returned::. @@ -23771,15 +23772,15 @@ table-value-types-returned::. String Number Array Undefined ------------------------------------------------------------------------------ - String String String false false - Number Number if can Number false false + String String String False False + Number Number if can Number False False be converted, else false -Type Array false false Array false -Requested Scalar Scalar Scalar false false +Type Array False False Array False +Requested Scalar Scalar Scalar False False Undefined String Number Array Undefined - Value false false false false - Cookie + Value False False False False + cookie Table 16.1: API value types returned @@ -23796,16 +23797,16 @@ your extension function. They are: ` awk_valtype_t wanted,' ` awk_value_t *result);' Fill in the `awk_value_t' structure pointed to by `result' with - the `count''th argument. Return true if the actual type matches - `wanted', false otherwise. In the latter case, `result->val_type' - indicates the actual type (*note Table 16.1: - table-value-types-returned.). Counts are zero based--the first + the `count'th argument. Return true if the actual type matches + `wanted', and false otherwise. In the latter case, + `result->val_type' indicates the actual type (*note Table 16.1: + table-value-types-returned.). Counts are zero-based--the first argument is numbered zero, the second one, and so on. `wanted' indicates the type of value expected. `awk_bool_t set_argument(size_t count, awk_array_t array);' Convert a parameter that was undefined into an array; this provides - call-by-reference for arrays. Return false if `count' is too big, + call by reference for arrays. Return false if `count' is too big, or if the argument's type is not undefined. *Note Array Manipulation::, for more information on creating arrays. @@ -23833,8 +23834,8 @@ File: gawk.info, Node: Symbol table by name, Next: Symbol table by cookie, Up The following routines provide the ability to access and update global `awk'-level variables by name. In compiler terminology, identifiers of different kinds are termed "symbols", thus the "sym" in the routines' -names. The data structure which stores information about symbols is -termed a "symbol table". +names. The data structure that stores information about symbols is +termed a "symbol table". The functions are as follows: `awk_bool_t sym_lookup(const char *name,' ` awk_valtype_t wanted,' @@ -23842,14 +23843,14 @@ termed a "symbol table". Fill in the `awk_value_t' structure pointed to by `result' with the value of the variable named by the string `name', which is a regular C string. `wanted' indicates the type of value expected. - Return true if the actual type matches `wanted', false otherwise. - In the latter case, `result->val_type' indicates the actual type - (*note Table 16.1: table-value-types-returned.). + Return true if the actual type matches `wanted', and false + otherwise. In the latter case, `result->val_type' indicates the + actual type (*note Table 16.1: table-value-types-returned.). `awk_bool_t sym_update(const char *name, awk_value_t *value);' Update the variable named by the string `name', which is a regular C string. The variable is added to `gawk''s symbol table if it is - not there. Return true if everything worked, false otherwise. + not there. Return true if everything worked, and false otherwise. Changing types (scalar to array or vice versa) of an existing variable is _not_ allowed, nor may this routine be used to update @@ -23874,7 +23875,7 @@ File: gawk.info, Node: Symbol table by cookie, Next: Cached values, Prev: Sym A "scalar cookie" is an opaque handle that provides access to a global variable or array. It is an optimization that avoids looking up variables in `gawk''s symbol table every time access is needed. This -was discussed earlier in *note General Data Types::. +was discussed earlier, in *note General Data Types::. The following functions let you work with scalar cookies: @@ -23985,7 +23986,7 @@ File: gawk.info, Node: Cached values, Prev: Symbol table by cookie, Up: Symbo .......................................... The routines in this section allow you to create and release cached -values. As with scalar cookies, in theory, cached values are not +values. Like scalar cookies, in theory, cached values are not necessary. You can create numbers and strings using the functions in *note Constructor Functions::. You can then assign those values to variables using `sym_update()' or `sym_update_scalar()', as you like. @@ -24056,7 +24057,7 @@ Using value cookies in this way saves considerable storage, as all of `VAR1' through `VAR100' share the same value. You might be wondering, "Is this sharing problematic? What happens -if `awk' code assigns a new value to `VAR1', are all the others changed +if `awk' code assigns a new value to `VAR1'; are all the others changed too?" That's a great question. The answer is that no, it's not a problem. @@ -24175,7 +24176,7 @@ File: gawk.info, Node: Array Functions, Next: Flattening Arrays, Prev: Array 16.4.11.2 Array Functions ......................... -The following functions relate to individual array elements. +The following functions relate to individual array elements: `awk_bool_t get_element_count(awk_array_t a_cookie, size_t *count);' For the array represented by `a_cookie', place in `*count' the @@ -24193,13 +24194,14 @@ The following functions relate to individual array elements. (*note Table 16.1: table-value-types-returned.). The value for `index' can be numeric, in which case `gawk' - converts it to a string. Using non-integral values is possible, but + converts it to a string. Using nonintegral values is possible, but requires that you understand how such values are converted to - strings (*note Conversion::); thus using integral values is safest. + strings (*note Conversion::); thus, using integral values is + safest. As with _all_ strings passed into `gawk' from an extension, the string value of `index' must come from `gawk_malloc()', - `gawk_calloc()' or `gawk_realloc()', and `gawk' releases the + `gawk_calloc()', or `gawk_realloc()', and `gawk' releases the storage. `awk_bool_t set_array_element(awk_array_t a_cookie,' @@ -24243,9 +24245,9 @@ The following functions relate to individual array elements. `awk_bool_t release_flattened_array(awk_array_t a_cookie,' ` awk_flat_array_t *data);' When done with a flattened array, release the storage using this - function. You must pass in both the original array cookie, and - the address of the created `awk_flat_array_t' structure. The - function returns true upon success, false otherwise. + function. You must pass in both the original array cookie and the + address of the created `awk_flat_array_t' structure. The function + returns true upon success, false otherwise.  File: gawk.info, Node: Flattening Arrays, Next: Creating Arrays, Prev: Array Functions, Up: Array Manipulation @@ -24255,8 +24257,8 @@ File: gawk.info, Node: Flattening Arrays, Next: Creating Arrays, Prev: Array To "flatten" an array is to create a structure that represents the full array in a fashion that makes it easy for C code to traverse the entire -array. Test code in `extension/testext.c' does this, and also serves -as a nice example showing how to use the APIs. +array. Some of the code in `extension/testext.c' does this, and also +serves as a nice example showing how to use the APIs. We walk through that part of the code one step at a time. First, the `gawk' script that drives the test extension: @@ -24305,9 +24307,8 @@ number of arguments: } The function then proceeds in steps, as follows. First, retrieve the -name of the array, passed as the first argument. Then retrieve the -array itself. If either operation fails, print error messages and -return: +name of the array, passed as the first argument, followed by the array +itself. If either operation fails, print an error message and return: /* get argument named array as flat array and print it */ if (get_argument(0, AWK_STRING, & value)) { @@ -24337,9 +24338,9 @@ count of elements in the array and print it: printf("dump_array_and_delete: incoming size is %lu\n", (unsigned long) count); - The third step is to actually flatten the array, and then to double -check that the count in the `awk_flat_array_t' is the same as the count -just retrieved: + The third step is to actually flatten the array, and then to +double-check that the count in the `awk_flat_array_t' is the same as +the count just retrieved: if (! flatten_array(value2.array_cookie, & flat_array)) { printf("dump_array_and_delete: could not flatten array\n"); @@ -24356,7 +24357,7 @@ just retrieved: The fourth step is to retrieve the index of the element to be deleted, which was passed as the second argument. Remember that -argument counts passed to `get_argument()' are zero-based, thus the +argument counts passed to `get_argument()' are zero-based, and thus the second argument is numbered one: if (! get_argument(1, AWK_STRING, & value3)) { @@ -24369,7 +24370,7 @@ over every element in the array, printing the index and element values. In addition, upon finding the element with the index that is supposed to be deleted, the function sets the `AWK_ELEMENT_DELETE' bit in the `flags' field of the element. When the array is released, `gawk' -traverses the flattened array, and deletes any elements which have this +traverses the flattened array, and deletes any elements that have this flag bit set: for (i = 0; i < flat_array->count; i++) { @@ -24587,10 +24588,10 @@ The API provides both a "major" and a "minor" version number. The API versions are available at compile time as constants: `GAWK_API_MAJOR_VERSION' - The major version of the API. + The major version of the API `GAWK_API_MINOR_VERSION' - The minor version of the API. + The minor version of the API The minor version increases when new functions are added to the API. Such new functions are always added to the end of the API `struct'. @@ -24605,13 +24606,13 @@ For this reason, the major and minor API versions of the running `gawk' are included in the API `struct' as read-only constant integers: `api->major_version' - The major version of the running `gawk'. + The major version of the running `gawk' `api->minor_version' - The minor version of the running `gawk'. + The minor version of the running `gawk' It is up to the extension to decide if there are API -incompatibilities. Typically a check like this is enough: +incompatibilities. Typically, a check like this is enough: if (api->major_version != GAWK_API_MAJOR_VERSION || api->minor_version < GAWK_API_MINOR_VERSION) { @@ -24623,7 +24624,7 @@ incompatibilities. Typically a check like this is enough: } Such code is included in the boilerplate `dl_load_func()' macro -provided in `gawkapi.h' (discussed later, in *note Extension API +provided in `gawkapi.h' (discussed in *note Extension API Boilerplate::).  @@ -24674,7 +24675,7 @@ functions) toward the top of your source file, using predefined names as described here. The boilerplate needed is also provided in comments in the `gawkapi.h' header file: - /* Boiler plate code: */ + /* Boilerplate code: */ int plugin_is_GPL_compatible; static gawk_api_t *const api; @@ -24724,7 +24725,7 @@ in the `gawkapi.h' header file: to point to a string giving the name and version of your extension. `static awk_ext_func_t func_table[] = { ... };' - This is an array of one or more `awk_ext_func_t' structures as + This is an array of one or more `awk_ext_func_t' structures, as described earlier (*note Extension Functions::). It can then be looped over for multiple calls to `add_ext_func()'. @@ -24837,7 +24838,7 @@ appropriate information: `stat()' fails. It fills in the following elements: `"name"' - The name of the file that was `stat()''ed. + The name of the file that was `stat()'ed. `"dev"' `"ino"' @@ -24885,7 +24886,7 @@ appropriate information: The file is a directory. `"fifo"' - The file is a named-pipe (also known as a FIFO). + The file is a named pipe (also known as a FIFO). `"file"' The file is just a regular file. @@ -24905,7 +24906,7 @@ appropriate information: systems, "a priori" knowledge is used to provide a value. Where no value can be determined, it defaults to 512. - Several additional elements may be present depending upon the + Several additional elements may be present, depending upon the operating system and the type of the file. You can test for them in your `awk' program by using the `in' operator (*note Reference to Elements::): @@ -24934,9 +24935,9 @@ File: gawk.info, Node: Internal File Ops, Next: Using Internal File Ops, Prev Here is the C code for these extensions.(1) The file includes a number of standard header files, and then -includes the `gawkapi.h' header file which provides the API definitions. -Those are followed by the necessary variable declarations to make use -of the API macros and boilerplate code (*note Extension API +includes the `gawkapi.h' header file, which provides the API +definitions. Those are followed by the necessary variable declarations +to make use of the API macros and boilerplate code (*note Extension API Boilerplate::): #ifdef HAVE_CONFIG_H @@ -24972,9 +24973,9 @@ Boilerplate::): By convention, for an `awk' function `foo()', the C function that implements it is called `do_foo()'. The function should have two -arguments: the first is an `int' usually called `nargs', that +arguments. The first is an `int', usually called `nargs', that represents the number of actual arguments for the function. The second -is a pointer to an `awk_value_t', usually named `result': +is a pointer to an `awk_value_t' structure, usually named `result': /* do_chdir --- provide dynamically loaded chdir() function for gawk */ @@ -25010,8 +25011,8 @@ is numbered zero. } The `stat()' extension is more involved. First comes a function -that turns a numeric mode into a printable representation (e.g., 644 -becomes `-rw-r--r--'). This is omitted here for brevity: +that turns a numeric mode into a printable representation (e.g., octal +`0644' becomes `-rw-r--r--'). This is omitted here for brevity: /* format_mode --- turn a stat mode field into something readable */ @@ -25061,8 +25062,8 @@ contain the result of the `stat()': The following function does most of the work to fill in the `awk_array_t' result array with values obtained from a valid `struct -stat'. It is done in a separate function to support the `stat()' -function for `gawk' and also to support the `fts()' extension which is +stat'. This work is done in a separate function to support the `stat()' +function for `gawk' and also to support the `fts()' extension, which is included in the same file but whose code is not shown here (*note Extension Sample File Functions::). @@ -25174,8 +25175,8 @@ argument is optional. If present, it causes `do_stat()' to use the `stat()' system call instead of the `lstat()' system call. This is done by using a function pointer: `statfunc'. `statfunc' is initialized to point to `lstat()' (instead of `stat()') to get the file -information, in case the file is a symbolic link. However, if there -were three arguments, `statfunc' is set point to `stat()', instead. +information, in case the file is a symbolic link. However, if the third +argument is included, `statfunc' is set to point to `stat()', instead. Here is the `do_stat()' function, which starts with variable declarations and argument checking: @@ -25224,7 +25225,7 @@ returns: /* always empty out the array */ clear_array(array); - /* stat the file, if error, set ERRNO and return */ + /* stat the file; if error, set ERRNO and return */ ret = statfunc(name, & sbuf); if (ret < 0) { update_ERRNO_int(errno); @@ -25243,7 +25244,8 @@ When done, the function returns the result from `fill_stat_array()': function(s) into `gawk'. The `filefuncs' extension also provides an `fts()' function, which -we omit here. For its sake there is an initialization function: +we omit here (*note Extension Sample File Functions::). For its sake, +there is an initialization function: /* init_filefuncs --- initialization routine */ @@ -25367,9 +25369,9 @@ File: gawk.info, Node: Extension Samples, Next: gawkextlib, Prev: Extension E 16.7 The Sample Extensions in the `gawk' Distribution ===================================================== -This minor node provides brief overviews of the sample extensions that +This minor node provides a brief overview of the sample extensions that come in the `gawk' distribution. Some of them are intended for -production use (e.g., the `filefuncs', `readdir' and `inplace' +production use (e.g., the `filefuncs', `readdir', and `inplace' extensions). Others mainly provide example code that shows how to use the extension API. @@ -25406,13 +25408,13 @@ follows. The usage is: `result = chdir("/some/directory")' The `chdir()' function is a direct hook to the `chdir()' system call to change the current directory. It returns zero upon - success or less than zero upon error. In the latter case, it - updates `ERRNO'. + success or a value less than zero upon error. In the latter case, + it updates `ERRNO'. `result = stat("/some/path", statdata' [`, follow']`)' The `stat()' function provides a hook into the `stat()' system - call. It returns zero upon success or less than zero upon error. - In the latter case, it updates `ERRNO'. + call. It returns zero upon success or a value less than zero upon + error. In the latter case, it updates `ERRNO'. By default, it uses the `lstat()' system call. However, if passed a third argument, it uses `stat()' instead. @@ -25439,23 +25441,23 @@ follows. The usage is: `"minor"' `st_minor' Device files `"blksize"'`st_blksize' All `"pmode"' A human-readable version of the All - mode value, such as printed by - `ls'. For example, - `"-rwxr-xr-x"' + mode value, like that printed by + `ls' (for example, + `"-rwxr-xr-x"') `"linkval"'The value of the symbolic link Symbolic links - `"type"' The type of the file as a string. All - One of `"file"', `"blockdev"', - `"chardev"', `"directory"', - `"socket"', `"fifo"', `"symlink"', - `"door"', or `"unknown"'. Not - all systems support all file - types. + `"type"' The type of the file as a All + string--one of `"file"', + `"blockdev"', `"chardev"', + `"directory"', `"socket"', + `"fifo"', `"symlink"', `"door"', + or `"unknown"' (not all systems + support all file types) `flags = or(FTS_PHYSICAL, ...)' `result = fts(pathlist, flags, filedata)' Walk the file trees provided in `pathlist' and fill in the - `filedata' array as described next. `flags' is the bitwise OR of + `filedata' array, as described next. `flags' is the bitwise OR of several predefined values, also described in a moment. Return zero if there were no errors, otherwise return -1. @@ -25508,10 +25510,11 @@ requested hierarchies. filesystem. `filedata' - The `filedata' array is first cleared. Then, `fts()' creates an - element in `filedata' for every element in `pathlist'. The index - is the name of the directory or file given in `pathlist'. The - element for this index is itself an array. There are two cases: + The `filedata' array holds the results. `fts()' first clears it. + Then it creates an element in `filedata' for every element in + `pathlist'. The index is the name of the directory or file given + in `pathlist'. The element for this index is itself an array. + There are two cases: _The path is a file_ In this case, the array contains two or three elements: @@ -25547,7 +25550,7 @@ requested hierarchies. elements as for a file: `"path"', `"stat"', and `"error"'. The `fts()' function returns zero if there were no errors. -Otherwise it returns -1. +Otherwise, it returns -1. NOTE: The `fts()' extension does not exactly mimic the interface of the C library `fts()' routines, choosing instead to provide an @@ -25586,14 +25589,14 @@ adds one constant (`FNM_NOMATCH'), and an array of flag values named The arguments to `fnmatch()' are: `pattern' - The file name wildcard to match. + The file name wildcard to match `string' - The file name string. + The file name string `flag' Either zero, or the bitwise OR of one or more of the flags in the - `FNM' array. + `FNM' array The flags are as follows: @@ -25627,13 +25630,13 @@ The `fork' extension adds three functions, as follows: `pid = fork()' This function creates a new process. The return value is zero in - the child and the process-ID number of the child in the parent, or + the child and the process ID number of the child in the parent, or -1 upon error. In the latter case, `ERRNO' indicates the problem. In the child, `PROCINFO["pid"]' and `PROCINFO["ppid"]' are updated to reflect the correct values. `ret = waitpid(pid)' - This function takes a numeric argument, which is the process-ID to + This function takes a numeric argument, which is the process ID to wait for. The return value is that of the `waitpid()' system call. `ret = wait()' @@ -25657,8 +25660,8 @@ File: gawk.info, Node: Extension Sample Inplace, Next: Extension Sample Ord, 16.7.4 Enabling In-Place File Editing ------------------------------------- -The `inplace' extension emulates GNU `sed''s `-i' option which performs -"in place" editing of each input file. It uses the bundled +The `inplace' extension emulates GNU `sed''s `-i' option, which +performs "in-place" editing of each input file. It uses the bundled `inplace.awk' include file to invoke the extension properly: # inplace --- load and invoke the inplace extension. @@ -25741,11 +25744,11 @@ returned as a record. The record consists of three fields. The first two are the inode number and the file name, separated by a forward slash character. On systems where the directory entry contains the file type, the record -has a third field (also separated by a slash) which is a single letter +has a third field (also separated by a slash), which is a single letter indicating the type of the file. The letters and their corresponding file types are shown in *note table-readdir-file-types::. -Letter File Type +Letter File type -------------------------------------------------------------------------- `b' Block device `c' Character device @@ -25792,7 +25795,7 @@ unwary. Here is an example: print "don't panic" > "/dev/stdout" } - The output from this program is: `cinap t'nod'. + The output from this program is `cinap t'nod'.  File: gawk.info, Node: Extension Sample Rev2way, Next: Extension Sample Read write array, Prev: Extension Sample Revout, Up: Extension Samples @@ -25840,7 +25843,7 @@ The `rwarray' extension adds two functions, named `writea()' and `reada()' is the inverse of `writea()'; it reads the file named as its first argument, filling in the array named as the second argument. It clears the array first. Here too, the return value - is one on success and zero upon failure. + is one on success, or zero upon failure. The array created by `reada()' is identical to that written by `writea()' in the sense that the contents are the same. However, due to @@ -25924,7 +25927,7 @@ The `time' extension adds two functions, named `gettimeofday()' and Attempt to sleep for SECONDS seconds. If SECONDS is negative, or the attempt to sleep fails, return -1 and set `ERRNO'. Otherwise, return zero after sleeping for the indicated amount of time. Note - that SECONDS may be a floating-point (non-integral) value. + that SECONDS may be a floating-point (nonintegral) value. Implementation details: depending on platform availability, this function tries to use `nanosleep()' or `select()' to implement the delay. @@ -25952,7 +25955,9 @@ provides a number of `gawk' extensions, including one for processing XML files. This is the evolution of the original `xgawk' (XML `gawk') project. - As of this writing, there are six extensions: + As of this writing, there are seven extensions: + + * `errno' extension * GD graphics library extension @@ -25961,7 +25966,7 @@ project. * PostgreSQL extension * MPFR library extension (this provides access to a number of MPFR - functions which `gawk''s native MPFR support does not) + functions that `gawk''s native MPFR support does not) * Redis extension @@ -26002,7 +26007,7 @@ follows. First, build and install `gawk': If you have installed `gawk' in the standard way, then you will likely not need the `--with-gawk' option when configuring `gawkextlib'. -You may also need to use the `sudo' utility to install both `gawk' and +You may need to use the `sudo' utility to install both `gawk' and `gawkextlib', depending upon how your system works. If you write an extension that you wish to share with other `gawk' @@ -26024,7 +26029,7 @@ File: gawk.info, Node: Extension summary, Next: Extension Exercises, Prev: ga a variable named `plugin_is_GPL_compatible'. * Communication between `gawk' and an extension is two-way. `gawk' - passes a `struct' to the extension which contains various data + passes a `struct' to the extension that contains various data fields and function pointers. The extension can then call into `gawk' via the supplied function pointers to accomplish certain tasks. @@ -26035,7 +26040,7 @@ File: gawk.info, Node: Extension summary, Next: Extension Exercises, Prev: ga convention, implementation functions are named `do_XXXX()' for some `awk'-level function `XXXX()'. - * The API is defined in a header file named `gawkpi.h'. You must + * The API is defined in a header file named `gawkapi.h'. You must include a number of standard header files _before_ including it in your source file. @@ -26065,16 +26070,16 @@ File: gawk.info, Node: Extension summary, Next: Extension Exercises, Prev: ga * Manipulating arrays (retrieving, adding, deleting, and modifying elements; getting the count of elements in an array; creating a new array; clearing an array; and flattening an - array for easy C style looping over all its indices and + array for easy C-style looping over all its indices and elements) * The API defines a number of standard data types for representing `awk' values, array elements, and arrays. - * The API provide convenience functions for constructing values. It - also provides memory management functions to ensure compatibility - between memory allocated by `gawk' and memory allocated by an - extension. + * The API provides convenience functions for constructing values. + It also provides memory management functions to ensure + compatibility between memory allocated by `gawk' and memory + allocated by an extension. * _All_ memory passed from `gawk' to an extension must be treated as read-only by the extension. @@ -26092,8 +26097,8 @@ File: gawk.info, Node: Extension summary, Next: Extension Exercises, Prev: ga header file make this easier to do. * The `gawk' distribution includes a number of small but useful - sample extensions. The `gawkextlib' project includes several more, - larger, extensions. If you wish to write an extension and + sample extensions. The `gawkextlib' project includes several more + (larger) extensions. If you wish to write an extension and contribute it to the community of `gawk' users, the `gawkextlib' project is the place to do so. @@ -32657,7 +32662,7 @@ Index (line 99) * exp: Numeric Functions. (line 18) * expand utility: Very Simple. (line 73) -* Expat XML parser library: gawkextlib. (line 33) +* Expat XML parser library: gawkextlib. (line 35) * exponent: Numeric Functions. (line 18) * expressions: Expressions. (line 6) * expressions, as patterns: Expression Patterns. (line 6) @@ -33071,7 +33076,7 @@ Index * git utility <2>: Accessing The Source. (line 10) * git utility <3>: Other Versions. (line 29) -* git utility: gawkextlib. (line 27) +* git utility: gawkextlib. (line 29) * Git, use of for gawk source code: Derived Files. (line 6) * GNITS mailing list: Acknowledgments. (line 52) * GNU awk, See gawk: Preface. (line 51) @@ -34905,137 +34910,137 @@ Ref: figure-call-new-function919155 Node: Extension API Description921142 Node: Extension API Functions Introduction922592 Node: General Data Types927413 -Ref: General Data Types-Footnote-1933312 -Node: Memory Allocation Functions933611 -Ref: Memory Allocation Functions-Footnote-1936450 -Node: Constructor Functions936546 -Node: Registration Functions938280 -Node: Extension Functions938965 -Node: Exit Callback Functions941262 -Node: Extension Version String942510 -Node: Input Parsers943175 -Node: Output Wrappers953054 -Node: Two-way processors957569 -Node: Printing Messages959773 -Ref: Printing Messages-Footnote-1960849 -Node: Updating `ERRNO'961001 -Node: Requesting Values961741 -Ref: table-value-types-returned962469 -Node: Accessing Parameters963426 -Node: Symbol Table Access964657 -Node: Symbol table by name965171 -Node: Symbol table by cookie967152 -Ref: Symbol table by cookie-Footnote-1971296 -Node: Cached values971359 -Ref: Cached values-Footnote-1974858 -Node: Array Manipulation974949 -Ref: Array Manipulation-Footnote-1976047 -Node: Array Data Types976084 -Ref: Array Data Types-Footnote-1978739 -Node: Array Functions978831 -Node: Flattening Arrays982685 -Node: Creating Arrays989577 -Node: Extension API Variables994348 -Node: Extension Versioning994984 -Node: Extension API Informational Variables996885 -Node: Extension API Boilerplate997950 -Node: Finding Extensions1001759 -Node: Extension Example1002319 -Node: Internal File Description1003091 -Node: Internal File Ops1007158 -Ref: Internal File Ops-Footnote-11018828 -Node: Using Internal File Ops1018968 -Ref: Using Internal File Ops-Footnote-11021351 -Node: Extension Samples1021624 -Node: Extension Sample File Functions1023150 -Node: Extension Sample Fnmatch1030788 -Node: Extension Sample Fork1032279 -Node: Extension Sample Inplace1033494 -Node: Extension Sample Ord1035169 -Node: Extension Sample Readdir1036005 -Ref: table-readdir-file-types1036881 -Node: Extension Sample Revout1037692 -Node: Extension Sample Rev2way1038282 -Node: Extension Sample Read write array1039022 -Node: Extension Sample Readfile1040962 -Node: Extension Sample Time1042057 -Node: Extension Sample API Tests1043406 -Node: gawkextlib1043897 -Node: Extension summary1046555 -Node: Extension Exercises1050244 -Node: Language History1050966 -Node: V7/SVR3.11052622 -Node: SVR41054803 -Node: POSIX1056248 -Node: BTL1057637 -Node: POSIX/GNU1058371 -Node: Feature History1063935 -Node: Common Extensions1077033 -Node: Ranges and Locales1078357 -Ref: Ranges and Locales-Footnote-11082975 -Ref: Ranges and Locales-Footnote-21083002 -Ref: Ranges and Locales-Footnote-31083236 -Node: Contributors1083457 -Node: History summary1088998 -Node: Installation1090368 -Node: Gawk Distribution1091314 -Node: Getting1091798 -Node: Extracting1092621 -Node: Distribution contents1094256 -Node: Unix Installation1099973 -Node: Quick Installation1100590 -Node: Additional Configuration Options1103014 -Node: Configuration Philosophy1104752 -Node: Non-Unix Installation1107121 -Node: PC Installation1107579 -Node: PC Binary Installation1108898 -Node: PC Compiling1110746 -Ref: PC Compiling-Footnote-11113767 -Node: PC Testing1113876 -Node: PC Using1115052 -Node: Cygwin1119167 -Node: MSYS1119990 -Node: VMS Installation1120490 -Node: VMS Compilation1121282 -Ref: VMS Compilation-Footnote-11122504 -Node: VMS Dynamic Extensions1122562 -Node: VMS Installation Details1124246 -Node: VMS Running1126498 -Node: VMS GNV1129334 -Node: VMS Old Gawk1130068 -Node: Bugs1130538 -Node: Other Versions1134421 -Node: Installation summary1140845 -Node: Notes1141901 -Node: Compatibility Mode1142766 -Node: Additions1143548 -Node: Accessing The Source1144473 -Node: Adding Code1145908 -Node: New Ports1152065 -Node: Derived Files1156547 -Ref: Derived Files-Footnote-11162022 -Ref: Derived Files-Footnote-21162056 -Ref: Derived Files-Footnote-31162652 -Node: Future Extensions1162766 -Node: Implementation Limitations1163372 -Node: Extension Design1164620 -Node: Old Extension Problems1165774 -Ref: Old Extension Problems-Footnote-11167291 -Node: Extension New Mechanism Goals1167348 -Ref: Extension New Mechanism Goals-Footnote-11170708 -Node: Extension Other Design Decisions1170897 -Node: Extension Future Growth1173005 -Node: Old Extension Mechanism1173841 -Node: Notes summary1175603 -Node: Basic Concepts1176789 -Node: Basic High Level1177470 -Ref: figure-general-flow1177742 -Ref: figure-process-flow1178341 -Ref: Basic High Level-Footnote-11181570 -Node: Basic Data Typing1181755 -Node: Glossary1185083 -Node: Copying1217012 -Node: GNU Free Documentation License1254568 -Node: Index1279704 +Ref: General Data Types-Footnote-1933313 +Node: Memory Allocation Functions933612 +Ref: Memory Allocation Functions-Footnote-1936451 +Node: Constructor Functions936550 +Node: Registration Functions938285 +Node: Extension Functions938970 +Node: Exit Callback Functions941267 +Node: Extension Version String942515 +Node: Input Parsers943178 +Node: Output Wrappers953053 +Node: Two-way processors957566 +Node: Printing Messages959829 +Ref: Printing Messages-Footnote-1960905 +Node: Updating `ERRNO'961057 +Node: Requesting Values961797 +Ref: table-value-types-returned962524 +Node: Accessing Parameters963481 +Node: Symbol Table Access964715 +Node: Symbol table by name965229 +Node: Symbol table by cookie967249 +Ref: Symbol table by cookie-Footnote-1971394 +Node: Cached values971457 +Ref: Cached values-Footnote-1974953 +Node: Array Manipulation975044 +Ref: Array Manipulation-Footnote-1976142 +Node: Array Data Types976179 +Ref: Array Data Types-Footnote-1978834 +Node: Array Functions978926 +Node: Flattening Arrays982785 +Node: Creating Arrays989687 +Node: Extension API Variables994458 +Node: Extension Versioning995094 +Node: Extension API Informational Variables996985 +Node: Extension API Boilerplate998050 +Node: Finding Extensions1001859 +Node: Extension Example1002419 +Node: Internal File Description1003191 +Node: Internal File Ops1007258 +Ref: Internal File Ops-Footnote-11019009 +Node: Using Internal File Ops1019149 +Ref: Using Internal File Ops-Footnote-11021532 +Node: Extension Samples1021805 +Node: Extension Sample File Functions1023333 +Node: Extension Sample Fnmatch1031014 +Node: Extension Sample Fork1032502 +Node: Extension Sample Inplace1033717 +Node: Extension Sample Ord1035393 +Node: Extension Sample Readdir1036229 +Ref: table-readdir-file-types1037106 +Node: Extension Sample Revout1037917 +Node: Extension Sample Rev2way1038506 +Node: Extension Sample Read write array1039246 +Node: Extension Sample Readfile1041186 +Node: Extension Sample Time1042281 +Node: Extension Sample API Tests1043629 +Node: gawkextlib1044120 +Node: Extension summary1046798 +Node: Extension Exercises1050487 +Node: Language History1051209 +Node: V7/SVR3.11052865 +Node: SVR41055046 +Node: POSIX1056491 +Node: BTL1057880 +Node: POSIX/GNU1058614 +Node: Feature History1064178 +Node: Common Extensions1077276 +Node: Ranges and Locales1078600 +Ref: Ranges and Locales-Footnote-11083218 +Ref: Ranges and Locales-Footnote-21083245 +Ref: Ranges and Locales-Footnote-31083479 +Node: Contributors1083700 +Node: History summary1089241 +Node: Installation1090611 +Node: Gawk Distribution1091557 +Node: Getting1092041 +Node: Extracting1092864 +Node: Distribution contents1094499 +Node: Unix Installation1100216 +Node: Quick Installation1100833 +Node: Additional Configuration Options1103257 +Node: Configuration Philosophy1104995 +Node: Non-Unix Installation1107364 +Node: PC Installation1107822 +Node: PC Binary Installation1109141 +Node: PC Compiling1110989 +Ref: PC Compiling-Footnote-11114010 +Node: PC Testing1114119 +Node: PC Using1115295 +Node: Cygwin1119410 +Node: MSYS1120233 +Node: VMS Installation1120733 +Node: VMS Compilation1121525 +Ref: VMS Compilation-Footnote-11122747 +Node: VMS Dynamic Extensions1122805 +Node: VMS Installation Details1124489 +Node: VMS Running1126741 +Node: VMS GNV1129577 +Node: VMS Old Gawk1130311 +Node: Bugs1130781 +Node: Other Versions1134664 +Node: Installation summary1141088 +Node: Notes1142144 +Node: Compatibility Mode1143009 +Node: Additions1143791 +Node: Accessing The Source1144716 +Node: Adding Code1146151 +Node: New Ports1152308 +Node: Derived Files1156790 +Ref: Derived Files-Footnote-11162265 +Ref: Derived Files-Footnote-21162299 +Ref: Derived Files-Footnote-31162895 +Node: Future Extensions1163009 +Node: Implementation Limitations1163615 +Node: Extension Design1164863 +Node: Old Extension Problems1166017 +Ref: Old Extension Problems-Footnote-11167534 +Node: Extension New Mechanism Goals1167591 +Ref: Extension New Mechanism Goals-Footnote-11170951 +Node: Extension Other Design Decisions1171140 +Node: Extension Future Growth1173248 +Node: Old Extension Mechanism1174084 +Node: Notes summary1175846 +Node: Basic Concepts1177032 +Node: Basic High Level1177713 +Ref: figure-general-flow1177985 +Ref: figure-process-flow1178584 +Ref: Basic High Level-Footnote-11181813 +Node: Basic Data Typing1181998 +Node: Glossary1185326 +Node: Copying1217255 +Node: GNU Free Documentation License1254811 +Node: Index1279947  End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index e7d979d9..76d0c546 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -31636,7 +31636,7 @@ If you know that you wish to use the same numeric or string @emph{value} for one or more variables, you can create the value once, retaining a @dfn{value cookie} for it, and then pass in that value cookie whenever you wish to set the value of a -variable. This both storage space within the running @command{gawk} +variable. This saves storage space within the running @command{gawk} process and reduces the time needed to create the value. @node Memory Allocation Functions @@ -31665,13 +31665,13 @@ be passed to @command{gawk}. @item void gawk_free(void *ptr); Call the correct version of @code{free()} to release storage that was -allocated with @code{gawk_malloc()}, @code{gawk_calloc()} or @code{gawk_realloc()}. +allocated with @code{gawk_malloc()}, @code{gawk_calloc()}, or @code{gawk_realloc()}. @end table The API has to provide these functions because it is possible for an extension to be compiled and linked against a different version of the C library than was used for the @command{gawk} -executable.@footnote{This is more common on MS-Windows systems, but +executable.@footnote{This is more common on MS-Windows systems, but it can happen on Unix-like systems as well.} If @command{gawk} were to use its version of @code{free()} when the memory came from an unrelated version of @code{malloc()}, unexpected behavior would @@ -31681,7 +31681,7 @@ Two convenience macros may be used for allocating storage from @code{gawk_malloc()} and @code{gawk_realloc()}. If the allocation fails, they cause @command{gawk} to exit with a fatal error message. They should be used as if they were -procedure calls that do not return a value. +procedure calls that do not return a value: @table @code @item #define emalloc(pointer, type, size, message) @dots{} @@ -31718,7 +31718,7 @@ make_malloced_string(message, strlen(message), & result); @end example @item #define erealloc(pointer, type, size, message) @dots{} -This is like @code{emalloc()}, but it calls @code{gawk_realloc()}, +This is like @code{emalloc()}, but it calls @code{gawk_realloc()} instead of @code{gawk_malloc()}. The arguments are the same as for the @code{emalloc()} macro. @end table @@ -31743,7 +31743,7 @@ for storage in @code{result}. It returns @code{result}. @itemx make_malloced_string(const char *string, size_t length, awk_value_t *result) This function creates a string value in the @code{awk_value_t} variable pointed to by @code{result}. It expects @code{string} to be a @samp{char *} -value pointing to data previously obtained from @code{gawk_malloc()}, @code{gawk_calloc()} or @code{gawk_realloc()}. The idea here +value pointing to data previously obtained from @code{gawk_malloc()}, @code{gawk_calloc()}, or @code{gawk_realloc()}. The idea here is that the data is passed directly to @command{gawk}, which assumes responsibility for it. It returns @code{result}. @@ -31794,7 +31794,7 @@ The fields are: @table @code @item const char *name; The name of the new function. -@command{awk} level code calls the function by this name. +@command{awk}-level code calls the function by this name. This is a regular C string. Function names must obey the rules for @command{awk} @@ -31808,7 +31808,7 @@ This is a pointer to the C function that provides the extension's functionality. The function must fill in @code{*result} with either a number or a string. @command{gawk} takes ownership of any string memory. -As mentioned earlier, string memory @strong{must} come from one of +As mentioned earlier, string memory @emph{must} come from one of @code{gawk_malloc()}, @code{gawk_calloc()}, or @code{gawk_realloc()}. The @code{num_actual_args} argument tells the C function how many @@ -31860,20 +31860,20 @@ The @code{exit_status} parameter is the exit status value that @command{gawk} intends to pass to the @code{exit()} system call. @item arg0 -A pointer to private data which @command{gawk} saves in order to pass to +A pointer to private data that @command{gawk} saves in order to pass to the function pointed to by @code{funcp}. @end table @end table -Exit callback functions are called in last-in-first-out (LIFO) +Exit callback functions are called in last-in, first-out (LIFO) order---that is, in the reverse order in which they are registered with @command{gawk}. @node Extension Version String @subsubsection Registering An Extension Version String -You can register a version string which indicates the name and -version of your extension, with @command{gawk}, as follows: +You can register a version string that indicates the name and +version of your extension with @command{gawk}, as follows: @table @code @item void register_ext_version(const char *version); @@ -31895,7 +31895,7 @@ of @code{RS} to find the end of the record, and then uses @code{FS} Additionally, it sets the value of @code{RT} (@pxref{Built-in Variables}). If you want, you can provide your own custom input parser. An input -parser's job is to return a record to the @command{gawk} record processing +parser's job is to return a record to the @command{gawk} record-processing code, along with indicators for the value and length of the data to be used for @code{RT}, if any. @@ -31913,9 +31913,9 @@ It should not change any state (variable values, etc.) within @command{gawk}. @item awk_bool_t @var{XXX}_take_control_of(awk_input_buf_t *iobuf); When @command{gawk} decides to hand control of the file over to the input parser, it calls this function. This function in turn must fill -in certain fields in the @code{awk_input_buf_t} structure, and ensure +in certain fields in the @code{awk_input_buf_t} structure and ensure that certain conditions are true. It should then return true. If an -error of some kind occurs, it should not fill in any fields, and should +error of some kind occurs, it should not fill in any fields and should return false; then @command{gawk} will not use the input parser. The details are presented shortly. @end table @@ -32008,7 +32008,7 @@ in the @code{struct stat}, or any combination of these factors. Once @code{@var{XXX}_can_take_file()} has returned true, and @command{gawk} has decided to use your input parser, it calls -@code{@var{XXX}_take_control_of()}. That function then fills one of +@code{@var{XXX}_take_control_of()}. That function then fills either the @code{get_record} field or the @code{read_func} field in the @code{awk_input_buf_t}. It must also ensure that @code{fd} is @emph{not} set to @code{INVALID_HANDLE}. The following list describes the fields that @@ -32030,21 +32030,21 @@ records. Said function is the core of the input parser. Its behavior is described in the text following this list. @item ssize_t (*read_func)(); -This function pointer should point to function that has the +This function pointer should point to a function that has the same behavior as the standard POSIX @code{read()} system call. It is an alternative to the @code{get_record} pointer. Its behavior is also described in the text following this list. @item void (*close_func)(struct awk_input *iobuf); This function pointer should point to a function that does -the ``tear down.'' It should release any resources allocated by +the ``teardown.'' It should release any resources allocated by @code{@var{XXX}_take_control_of()}. It may also close the file. If it does so, it should set the @code{fd} field to @code{INVALID_HANDLE}. If @code{fd} is still not @code{INVALID_HANDLE} after the call to this function, @command{gawk} calls the regular @code{close()} system call. -Having a ``tear down'' function is optional. If your input parser does +Having a ``teardown'' function is optional. If your input parser does not need it, do not set this field. Then, @command{gawk} calls the regular @code{close()} system call on the file descriptor, so it should be valid. @@ -32055,7 +32055,7 @@ input records. The parameters are as follows: @table @code @item char **out -This is a pointer to a @code{char *} variable which is set to point +This is a pointer to a @code{char *} variable that is set to point to the record. @command{gawk} makes its own copy of the data, so the extension must manage this storage. @@ -32108,17 +32108,17 @@ set this field explicitly. You must choose one method or the other: either a function that returns a record, or one that returns raw data. In particular, if you supply a function to get a record, @command{gawk} will -call it, and never call the raw read function. +call it, and will never call the raw read function. @end quotation @command{gawk} ships with a sample extension that reads directories, -returning records for each entry in the directory (@pxref{Extension +returning records for each entry in a directory (@pxref{Extension Sample Readdir}). You may wish to use that code as a guide for writing your own input parser. When writing an input parser, you should think about (and document) how it is expected to interact with @command{awk} code. You may want -it to always be called, and take effect as appropriate (as the +it to always be called, and to take effect as appropriate (as the @code{readdir} extension does). Or you may want it to take effect based upon the value of an @command{awk} variable, as the XML extension from the @code{gawkextlib} project does (@pxref{gawkextlib}). @@ -32228,7 +32228,7 @@ a pointer to any private data associated with the file. These pointers should be set to point to functions that perform the equivalent function as the @code{} functions do, if appropriate. @command{gawk} uses these function pointers for all output. -@command{gawk} initializes the pointers to point to internal, ``pass through'' +@command{gawk} initializes the pointers to point to internal ``pass-through'' functions that just call the regular @code{} functions, so an extension only needs to redefine those functions that are appropriate for what it does. @@ -32239,7 +32239,7 @@ upon the @code{name} and @code{mode} fields, and any additional state (such as @command{awk} variable values) that is appropriate. When @command{gawk} calls @code{@var{XXX}_take_control_of()}, that function should fill -in the other fields, as appropriate, except for @code{fp}, which it should just +in the other fields as appropriate, except for @code{fp}, which it should just use normally. You register your output wrapper with the following function: @@ -32279,14 +32279,14 @@ The fields are as follows: The name of the two-way processor. @item awk_bool_t (*can_take_two_way)(const char *name); -This function returns true if it wants to take over two-way I/O for this @value{FN}. +The function pointed to by this field should return true if it wants to take over two-way I/O for this @value{FN}. It should not change any state (variable values, etc.) within @command{gawk}. @item awk_bool_t (*take_control_of)(const char *name, @itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_input_buf_t *inbuf, @itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_output_buf_t *outbuf); -This function should fill in the @code{awk_input_buf_t} and +The function pointed to by this field should fill in the @code{awk_input_buf_t} and @code{awk_outut_buf_t} structures pointed to by @code{inbuf} and @code{outbuf}, respectively. These structures were described earlier. @@ -32315,7 +32315,7 @@ Register the two-way processor pointed to by @code{two_way_processor} with You can print different kinds of warning messages from your extension, as described here. Note that for these functions, -you must pass in the extension id received from @command{gawk} +you must pass in the extension ID received from @command{gawk} when the extension was loaded:@footnote{Because the API uses only ISO C 90 features, it cannot make use of the ISO C 99 variadic macro feature to hide that parameter. More's the pity.} @@ -32368,7 +32368,7 @@ matches what you requested, the function returns true and fills in the @code{awk_value_t} result. Otherwise, the function returns false, and the @code{val_type} member indicates the type of the actual value. You may then -print an error message, or reissue the request for the actual +print an error message or reissue the request for the actual value type, as appropriate. This behavior is summarized in @ref{table-value-types-returned}. @@ -32401,32 +32401,32 @@ value type, as appropriate. This behavior is summarized in String String String - false - false + False + False Number Number if can be converted, else false Number - false - false + False + False Type Array - false - false + False + False Array - false + False Requested Scalar Scalar Scalar - false - false + False + False @@ -32438,11 +32438,11 @@ value type, as appropriate. This behavior is summarized in - Value Cookie - false - false - false - false + Value cookie + False + False + False + False @@ -32460,12 +32460,12 @@ value type, as appropriate. This behavior is summarized in @end tex @multitable @columnfractions .166 .166 .198 .15 .15 .166 @headitem @tab @tab String @tab Number @tab Array @tab Undefined -@item @tab @b{String} @tab String @tab String @tab false @tab false -@item @tab @b{Number} @tab Number if can be converted, else false @tab Number @tab false @tab false -@item @b{Type} @tab @b{Array} @tab false @tab false @tab Array @tab false -@item @b{Requested} @tab @b{Scalar} @tab Scalar @tab Scalar @tab false @tab false +@item @tab @b{String} @tab String @tab String @tab False @tab False +@item @tab @b{Number} @tab Number if can be converted, else false @tab Number @tab False @tab False +@item @b{Type} @tab @b{Array} @tab False @tab False @tab Array @tab False +@item @b{Requested} @tab @b{Scalar} @tab Scalar @tab Scalar @tab False @tab False @item @tab @b{Undefined} @tab String @tab Number @tab Array @tab Undefined -@item @tab @b{Value Cookie} @tab false @tab false @tab false @tab false +@item @tab @b{Value cookie} @tab False @tab False @tab False @tab False @end multitable @end ifnotdocbook @end ifnotplaintext @@ -32476,21 +32476,21 @@ value type, as appropriate. This behavior is summarized in +------------+------------+-----------+-----------+ | String | Number | Array | Undefined | +-----------+-----------+------------+------------+-----------+-----------+ -| | String | String | String | false | false | +| | String | String | String | False | False | | |-----------+------------+------------+-----------+-----------+ -| | Number | Number if | Number | false | false | +| | Number | Number if | Number | False | False | | | | can be | | | | | | | converted, | | | | | | | else false | | | | | |-----------+------------+------------+-----------+-----------+ -| Type | Array | false | false | Array | false | +| Type | Array | False | False | Array | False | | Requested |-----------+------------+------------+-----------+-----------+ -| | Scalar | Scalar | Scalar | false | false | +| | Scalar | Scalar | Scalar | False | False | | |-----------+------------+------------+-----------+-----------+ | | Undefined | String | Number | Array | Undefined | | |-----------+------------+------------+-----------+-----------+ -| | Value | false | false | false | false | -| | Cookie | | | | | +| | Value | False | False | False | False | +| | cookie | | | | | +-----------+-----------+------------+------------+-----------+-----------+ @end example @end ifplaintext @@ -32507,16 +32507,16 @@ passed to your extension function. They are: @itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_valtype_t wanted, @itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_value_t *result); Fill in the @code{awk_value_t} structure pointed to by @code{result} -with the @code{count}'th argument. Return true if the actual -type matches @code{wanted}, false otherwise. In the latter +with the @code{count}th argument. Return true if the actual +type matches @code{wanted}, and false otherwise. In the latter case, @code{result@w{->}val_type} indicates the actual type -(@pxref{table-value-types-returned}). Counts are zero based---the first +(@pxref{table-value-types-returned}). Counts are zero-based---the first argument is numbered zero, the second one, and so on. @code{wanted} indicates the type of value expected. @item awk_bool_t set_argument(size_t count, awk_array_t array); Convert a parameter that was undefined into an array; this provides -call-by-reference for arrays. Return false if @code{count} is too big, +call by reference for arrays. Return false if @code{count} is too big, or if the argument's type is not undefined. @DBXREF{Array Manipulation} for more information on creating arrays. @end table @@ -32540,8 +32540,9 @@ allows you to create and release cached values. The following routines provide the ability to access and update global @command{awk}-level variables by name. In compiler terminology, identifiers of different kinds are termed @dfn{symbols}, thus the ``sym'' -in the routines' names. The data structure which stores information +in the routines' names. The data structure that stores information about symbols is termed a @dfn{symbol table}. +The functions are as follows: @table @code @item awk_bool_t sym_lookup(const char *name, @@ -32550,14 +32551,14 @@ about symbols is termed a @dfn{symbol table}. Fill in the @code{awk_value_t} structure pointed to by @code{result} with the value of the variable named by the string @code{name}, which is a regular C string. @code{wanted} indicates the type of value expected. -Return true if the actual type matches @code{wanted}, false otherwise. +Return true if the actual type matches @code{wanted}, and false otherwise. In the latter case, @code{result->val_type} indicates the actual type (@pxref{table-value-types-returned}). @item awk_bool_t sym_update(const char *name, awk_value_t *value); Update the variable named by the string @code{name}, which is a regular C string. The variable is added to @command{gawk}'s symbol table -if it is not there. Return true if everything worked, false otherwise. +if it is not there. Return true if everything worked, and false otherwise. Changing types (scalar to array or vice versa) of an existing variable is @emph{not} allowed, nor may this routine be used to update an array. @@ -32582,7 +32583,7 @@ populate it. A @dfn{scalar cookie} is an opaque handle that provides access to a global variable or array. It is an optimization that avoids looking up variables in @command{gawk}'s symbol table every time -access is needed. This was discussed earlier in @ref{General Data Types}. +access is needed. This was discussed earlier, in @ref{General Data Types}. The following functions let you work with scalar cookies: @@ -32698,7 +32699,7 @@ and carefully check the return values from the API functions. @subsubsection Creating and Using Cached Values The routines in this section allow you to create and release -cached values. As with scalar cookies, in theory, cached values +cached values. Like scalar cookies, in theory, cached values are not necessary. You can create numbers and strings using the functions in @ref{Constructor Functions}. You can then assign those values to variables using @code{sym_update()} @@ -32776,7 +32777,7 @@ Using value cookies in this way saves considerable storage, as all of @code{VAR1} through @code{VAR100} share the same value. You might be wondering, ``Is this sharing problematic? -What happens if @command{awk} code assigns a new value to @code{VAR1}, +What happens if @command{awk} code assigns a new value to @code{VAR1}; are all the others changed too?'' That's a great question. The answer is that no, it's not a problem. @@ -32880,7 +32881,7 @@ modify them. @node Array Functions @subsubsection Array Functions -The following functions relate to individual array elements. +The following functions relate to individual array elements: @table @code @item awk_bool_t get_element_count(awk_array_t a_cookie, size_t *count); @@ -32899,13 +32900,13 @@ Return false if @code{wanted} does not match the actual type or if @code{index} is not in the array (@pxref{table-value-types-returned}). The value for @code{index} can be numeric, in which case @command{gawk} -converts it to a string. Using non-integral values is possible, but +converts it to a string. Using nonintegral values is possible, but requires that you understand how such values are converted to strings -(@pxref{Conversion}); thus using integral values is safest. +(@pxref{Conversion}); thus, using integral values is safest. As with @emph{all} strings passed into @command{gawk} from an extension, the string value of @code{index} must come from @code{gawk_malloc()}, -@code{gawk_calloc()} or @code{gawk_realloc()}, and +@code{gawk_calloc()}, or @code{gawk_realloc()}, and @command{gawk} releases the storage. @item awk_bool_t set_array_element(awk_array_t a_cookie, @@ -32961,7 +32962,7 @@ flatten an array and work with it. @item awk_bool_t release_flattened_array(awk_array_t a_cookie, @itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_flat_array_t *data); When done with a flattened array, release the storage using this function. -You must pass in both the original array cookie, and the address of +You must pass in both the original array cookie and the address of the created @code{awk_flat_array_t} structure. The function returns true upon success, false otherwise. @end table @@ -32971,7 +32972,7 @@ The function returns true upon success, false otherwise. To @dfn{flatten} an array is to create a structure that represents the full array in a fashion that makes it easy -for C code to traverse the entire array. Test code +for C code to traverse the entire array. Some of the code in @file{extension/testext.c} does this, and also serves as a nice example showing how to use the APIs. @@ -33028,9 +33029,9 @@ dump_array_and_delete(int nargs, awk_value_t *result) @end example The function then proceeds in steps, as follows. First, retrieve -the name of the array, passed as the first argument. Then -retrieve the array itself. If either operation fails, print -error messages and return: +the name of the array, passed as the first argument, followed by +the array itself. If either operation fails, print an +error message and return: @example /* get argument named array as flat array and print it */ @@ -33066,7 +33067,7 @@ and print it: @end example The third step is to actually flatten the array, and then -to double check that the count in the @code{awk_flat_array_t} +to double-check that the count in the @code{awk_flat_array_t} is the same as the count just retrieved: @example @@ -33087,7 +33088,7 @@ is the same as the count just retrieved: The fourth step is to retrieve the index of the element to be deleted, which was passed as the second argument. Remember that argument counts passed to @code{get_argument()} -are zero-based, thus the second argument is numbered one: +are zero-based, and thus the second argument is numbered one: @example if (! get_argument(1, AWK_STRING, & value3)) @{ @@ -33102,7 +33103,7 @@ element values. In addition, upon finding the element with the index that is supposed to be deleted, the function sets the @code{AWK_ELEMENT_DELETE} bit in the @code{flags} field of the element. When the array is released, @command{gawk} -traverses the flattened array, and deletes any elements which +traverses the flattened array, and deletes any elements that have this flag bit set: @example @@ -33390,10 +33391,10 @@ The API versions are available at compile time as constants: @table @code @item GAWK_API_MAJOR_VERSION -The major version of the API. +The major version of the API @item GAWK_API_MINOR_VERSION -The minor version of the API. +The minor version of the API @end table The minor version increases when new functions are added to the API. Such @@ -33411,14 +33412,14 @@ constant integers: @table @code @item api->major_version -The major version of the running @command{gawk}. +The major version of the running @command{gawk} @item api->minor_version -The minor version of the running @command{gawk}. +The minor version of the running @command{gawk} @end table It is up to the extension to decide if there are API incompatibilities. -Typically a check like this is enough: +Typically, a check like this is enough: @example if (api->major_version != GAWK_API_MAJOR_VERSION @@ -33432,7 +33433,7 @@ if (api->major_version != GAWK_API_MAJOR_VERSION @end example Such code is included in the boilerplate @code{dl_load_func()} macro -provided in @file{gawkapi.h} (discussed later, in +provided in @file{gawkapi.h} (discussed in @ref{Extension API Boilerplate}). @node Extension API Informational Variables @@ -33479,7 +33480,7 @@ as described here. The boilerplate needed is also provided in comments in the @file{gawkapi.h} header file: @example -/* Boiler plate code: */ +/* Boilerplate code: */ int plugin_is_GPL_compatible; static gawk_api_t *const api; @@ -33538,7 +33539,7 @@ to @code{NULL}, or to point to a string giving the name and version of your extension. @item static awk_ext_func_t func_table[] = @{ @dots{} @}; -This is an array of one or more @code{awk_ext_func_t} structures +This is an array of one or more @code{awk_ext_func_t} structures, as described earlier (@pxref{Extension Functions}). It can then be looped over for multiple calls to @code{add_ext_func()}. @@ -33669,7 +33670,7 @@ the @code{stat()} fails. It fills in the following elements: @table @code @item "name" -The name of the file that was @code{stat()}'ed. +The name of the file that was @code{stat()}ed. @item "dev" @itemx "ino" @@ -33725,7 +33726,7 @@ interprocess communications). The file is a directory. @item "fifo" -The file is a named-pipe (also known as a FIFO). +The file is a named pipe (also known as a FIFO). @item "file" The file is just a regular file. @@ -33748,7 +33749,7 @@ For some other systems, @dfn{a priori} knowledge is used to provide a value. Where no value can be determined, it defaults to 512. @end table -Several additional elements may be present depending upon the operating +Several additional elements may be present, depending upon the operating system and the type of the file. You can test for them in your @command{awk} program by using the @code{in} operator (@pxref{Reference to Elements}): @@ -33778,7 +33779,7 @@ edited slightly for presentation. See @file{extension/filefuncs.c} in the @command{gawk} distribution for the complete version.} The file includes a number of standard header files, and then includes -the @file{gawkapi.h} header file which provides the API definitions. +the @file{gawkapi.h} header file, which provides the API definitions. Those are followed by the necessary variable declarations to make use of the API macros and boilerplate code (@pxref{Extension API Boilerplate}): @@ -33819,9 +33820,9 @@ int plugin_is_GPL_compatible; @cindex programming conventions, @command{gawk} extensions By convention, for an @command{awk} function @code{foo()}, the C function that implements it is called @code{do_foo()}. The function should have -two arguments: the first is an @code{int} usually called @code{nargs}, +two arguments. The first is an @code{int}, usually called @code{nargs}, that represents the number of actual arguments for the function. -The second is a pointer to an @code{awk_value_t}, usually named +The second is a pointer to an @code{awk_value_t} structure, usually named @code{result}: @example @@ -33867,7 +33868,7 @@ Finally, the function returns the return value to the @command{awk} level: The @code{stat()} extension is more involved. First comes a function that turns a numeric mode into a printable representation -(e.g., 644 becomes @samp{-rw-r--r--}). This is omitted here for brevity: +(e.g., octal @code{0644} becomes @samp{-rw-r--r--}). This is omitted here for brevity: @example /* format_mode --- turn a stat mode field into something readable */ @@ -33923,9 +33924,9 @@ array_set_numeric(awk_array_t array, const char *sub, double num) The following function does most of the work to fill in the @code{awk_array_t} result array with values obtained -from a valid @code{struct stat}. It is done in a separate function +from a valid @code{struct stat}. This work is done in a separate function to support the @code{stat()} function for @command{gawk} and also -to support the @code{fts()} extension which is included in +to support the @code{fts()} extension, which is included in the same file but whose code is not shown here (@pxref{Extension Sample File Functions}). @@ -34046,8 +34047,8 @@ the @code{stat()} system call instead of the @code{lstat()} system call. This is done by using a function pointer: @code{statfunc}. @code{statfunc} is initialized to point to @code{lstat()} (instead of @code{stat()}) to get the file information, in case the file is a -symbolic link. However, if there were three arguments, @code{statfunc} -is set point to @code{stat()}, instead. +symbolic link. However, if the third argument is included, @code{statfunc} +is set to point to @code{stat()}, instead. Here is the @code{do_stat()} function, which starts with variable declarations and argument checking: @@ -34103,7 +34104,7 @@ Next, it gets the information for the file. If the called function /* always empty out the array */ clear_array(array); - /* stat the file, if error, set ERRNO and return */ + /* stat the file; if error, set ERRNO and return */ ret = statfunc(name, & sbuf); if (ret < 0) @{ update_ERRNO_int(errno); @@ -34125,7 +34126,9 @@ Finally, it's necessary to provide the ``glue'' that loads the new function(s) into @command{gawk}. The @code{filefuncs} extension also provides an @code{fts()} -function, which we omit here. For its sake there is an initialization +function, which we omit here +(@pxref{Extension Sample File Functions}). +For its sake, there is an initialization function: @example @@ -34250,9 +34253,9 @@ $ @kbd{AWKLIBPATH=$PWD gawk -f testff.awk} @section The Sample Extensions in the @command{gawk} Distribution @cindex extensions distributed with @command{gawk} -This @value{SECTION} provides brief overviews of the sample extensions +This @value{SECTION} provides a brief overview of the sample extensions that come in the @command{gawk} distribution. Some of them are intended -for production use (e.g., the @code{filefuncs}, @code{readdir} and +for production use (e.g., the @code{filefuncs}, @code{readdir}, and @code{inplace} extensions). Others mainly provide example code that shows how to use the extension API. @@ -34288,14 +34291,14 @@ This is how you load the extension. @item @code{result = chdir("/some/directory")} The @code{chdir()} function is a direct hook to the @code{chdir()} system call to change the current directory. It returns zero -upon success or less than zero upon error. In the latter case, it updates -@code{ERRNO}. +upon success or a value less than zero upon error. +In the latter case, it updates @code{ERRNO}. @cindex @code{stat()} extension function @item @code{result = stat("/some/path", statdata} [@code{, follow}]@code{)} The @code{stat()} function provides a hook into the @code{stat()} system call. -It returns zero upon success or less than zero upon error. +It returns zero upon success or a value less than zero upon error. In the latter case, it updates @code{ERRNO}. By default, it uses the @code{lstat()} system call. However, if passed @@ -34322,10 +34325,10 @@ array with information retrieved from the filesystem, as follows: @item @code{"major"} @tab @code{st_major} @tab Device files @item @code{"minor"} @tab @code{st_minor} @tab Device files @item @code{"blksize"} @tab @code{st_blksize} @tab All -@item @code{"pmode"} @tab A human-readable version of the mode value, such as printed by -@command{ls}. For example, @code{"-rwxr-xr-x"} @tab All +@item @code{"pmode"} @tab A human-readable version of the mode value, like that printed by +@command{ls} (for example, @code{"-rwxr-xr-x"}) @tab All @item @code{"linkval"} @tab The value of the symbolic link @tab Symbolic links -@item @code{"type"} @tab The type of the file as a string. One of +@item @code{"type"} @tab The type of the file as a string---one of @code{"file"}, @code{"blockdev"}, @code{"chardev"}, @@ -34335,15 +34338,15 @@ array with information retrieved from the filesystem, as follows: @code{"symlink"}, @code{"door"}, or -@code{"unknown"}. -Not all systems support all file types. @tab All +@code{"unknown"} +(not all systems support all file types) @tab All @end multitable @cindex @code{fts()} extension function @item @code{flags = or(FTS_PHYSICAL, ...)} @itemx @code{result = fts(pathlist, flags, filedata)} Walk the file trees provided in @code{pathlist} and fill in the -@code{filedata} array as described next. @code{flags} is the bitwise +@code{filedata} array, as described next. @code{flags} is the bitwise OR of several predefined values, also described in a moment. Return zero if there were no errors, otherwise return @minus{}1. @end table @@ -34399,7 +34402,8 @@ During a traversal, do not cross onto a different mounted filesystem. @end table @item filedata -The @code{filedata} array is first cleared. Then, @code{fts()} creates +The @code{filedata} array holds the results. +@code{fts()} first clears it. Then it creates an element in @code{filedata} for every element in @code{pathlist}. The index is the name of the directory or file given in @code{pathlist}. The element for this index is itself an array. There are two cases: @@ -34441,7 +34445,7 @@ for a file: @code{"path"}, @code{"stat"}, and @code{"error"}. @end table The @code{fts()} function returns zero if there were no errors. -Otherwise it returns @minus{}1. +Otherwise, it returns @minus{}1. @quotation NOTE The @code{fts()} extension does not exactly mimic the @@ -34483,14 +34487,14 @@ The arguments to @code{fnmatch()} are: @table @code @item pattern -The @value{FN} wildcard to match. +The @value{FN} wildcard to match @item string -The @value{FN} string. +The @value{FN} string @item flag Either zero, or the bitwise OR of one or more of the -flags in the @code{FNM} array. +flags in the @code{FNM} array @end table The flags are as follows: @@ -34527,14 +34531,14 @@ This is how you load the extension. @cindex @code{fork()} extension function @item pid = fork() This function creates a new process. The return value is zero in the -child and the process-ID number of the child in the parent, or @minus{}1 +child and the process ID number of the child in the parent, or @minus{}1 upon error. In the latter case, @code{ERRNO} indicates the problem. In the child, @code{PROCINFO["pid"]} and @code{PROCINFO["ppid"]} are updated to reflect the correct values. @cindex @code{waitpid()} extension function @item ret = waitpid(pid) -This function takes a numeric argument, which is the process-ID to +This function takes a numeric argument, which is the process ID to wait for. The return value is that of the @code{waitpid()} system call. @@ -34562,8 +34566,8 @@ else @subsection Enabling In-Place File Editing @cindex @code{inplace} extension -The @code{inplace} extension emulates GNU @command{sed}'s @option{-i} option -which performs ``in place'' editing of each input file. +The @code{inplace} extension emulates GNU @command{sed}'s @option{-i} option, +which performs ``in-place'' editing of each input file. It uses the bundled @file{inplace.awk} include file to invoke the extension properly: @@ -34659,14 +34663,14 @@ they are read, with each entry returned as a record. The record consists of three fields. The first two are the inode number and the @value{FN}, separated by a forward slash character. On systems where the directory entry contains the file type, the record -has a third field (also separated by a slash) which is a single letter +has a third field (also separated by a slash), which is a single letter indicating the type of the file. The letters and their corresponding file types are shown in @ref{table-readdir-file-types}. @float Table,table-readdir-file-types @caption{File types returned by the @code{readdir} extension} @multitable @columnfractions .1 .9 -@headitem Letter @tab File Type +@headitem Letter @tab File type @item @code{b} @tab Block device @item @code{c} @tab Character device @item @code{d} @tab Directory @@ -34694,7 +34698,7 @@ Here is an example: @@load "readdir" @dots{} BEGIN @{ FS = "/" @} -@{ print "file name is", $2 @} +@{ print "@value{FN} is", $2 @} @end example @node Extension Sample Revout @@ -34715,8 +34719,7 @@ BEGIN @{ @} @end example -The output from this program is: -@samp{cinap t'nod}. +The output from this program is @samp{cinap t'nod}. @node Extension Sample Rev2way @subsection Two-Way I/O Example @@ -34771,7 +34774,7 @@ success, or zero upon failure. @code{reada()} is the inverse of @code{writea()}; it reads the file named as its first argument, filling in the array named as the second argument. It clears the array first. -Here too, the return value is one on success and zero upon failure. +Here too, the return value is one on success, or zero upon failure. @end table The array created by @code{reada()} is identical to that written by @@ -34859,7 +34862,7 @@ it tries to use @code{GetSystemTimeAsFileTime()}. Attempt to sleep for @var{seconds} seconds. If @var{seconds} is negative, or the attempt to sleep fails, return @minus{}1 and set @code{ERRNO}. Otherwise, return zero after sleeping for the indicated amount of time. -Note that @var{seconds} may be a floating-point (non-integral) value. +Note that @var{seconds} may be a floating-point (nonintegral) value. Implementation details: depending on platform availability, this function tries to use @code{nanosleep()} or @code{select()} to implement the delay. @end table @@ -34886,9 +34889,12 @@ project provides a number of @command{gawk} extensions, including one for processing XML files. This is the evolution of the original @command{xgawk} (XML @command{gawk}) project. -As of this writing, there are six extensions: +As of this writing, there are seven extensions: @itemize @value{BULLET} +@item +@code{errno} extension + @item GD graphics library extension @@ -34900,7 +34906,7 @@ PostgreSQL extension @item MPFR library extension -(this provides access to a number of MPFR functions which @command{gawk}'s +(this provides access to a number of MPFR functions that @command{gawk}'s native MPFR support does not) @item @@ -34954,7 +34960,7 @@ make install @ii{Install the extensions} If you have installed @command{gawk} in the standard way, then you will likely not need the @option{--with-gawk} option when configuring -@code{gawkextlib}. You may also need to use the @command{sudo} utility +@code{gawkextlib}. You may need to use the @command{sudo} utility to install both @command{gawk} and @code{gawkextlib}, depending upon how your system works. @@ -34979,7 +34985,7 @@ named @code{plugin_is_GPL_compatible}. @item Communication between @command{gawk} and an extension is two-way. -@command{gawk} passes a @code{struct} to the extension which contains +@command{gawk} passes a @code{struct} to the extension that contains various data fields and function pointers. The extension can then call into @command{gawk} via the supplied function pointers to accomplish certain tasks. @@ -34992,7 +34998,7 @@ By convention, implementation functions are named @code{do_@var{XXXX}()} for some @command{awk}-level function @code{@var{XXXX}()}. @item -The API is defined in a header file named @file{gawkpi.h}. You must include +The API is defined in a header file named @file{gawkapi.h}. You must include a number of standard header files @emph{before} including it in your source file. @item @@ -35037,7 +35043,7 @@ getting the count of elements in an array; creating a new array; clearing an array; and -flattening an array for easy C style looping over all its indices and elements) +flattening an array for easy C-style looping over all its indices and elements) @end itemize @item @@ -35045,7 +35051,7 @@ The API defines a number of standard data types for representing @command{awk} values, array elements, and arrays. @item -The API provide convenience functions for constructing values. +The API provides convenience functions for constructing values. It also provides memory management functions to ensure compatibility between memory allocated by @command{gawk} and memory allocated by an extension. @@ -35071,8 +35077,8 @@ file make this easier to do. @item The @command{gawk} distribution includes a number of small but useful -sample extensions. The @code{gawkextlib} project includes several more, -larger, extensions. If you wish to write an extension and contribute it +sample extensions. The @code{gawkextlib} project includes several more +(larger) extensions. If you wish to write an extension and contribute it to the community of @command{gawk} users, the @code{gawkextlib} project is the place to do so. diff --git a/doc/gawktexi.in b/doc/gawktexi.in index c41d5a68..16847eb2 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -30727,7 +30727,7 @@ If you know that you wish to use the same numeric or string @emph{value} for one or more variables, you can create the value once, retaining a @dfn{value cookie} for it, and then pass in that value cookie whenever you wish to set the value of a -variable. This both storage space within the running @command{gawk} +variable. This saves storage space within the running @command{gawk} process and reduces the time needed to create the value. @node Memory Allocation Functions @@ -30756,13 +30756,13 @@ be passed to @command{gawk}. @item void gawk_free(void *ptr); Call the correct version of @code{free()} to release storage that was -allocated with @code{gawk_malloc()}, @code{gawk_calloc()} or @code{gawk_realloc()}. +allocated with @code{gawk_malloc()}, @code{gawk_calloc()}, or @code{gawk_realloc()}. @end table The API has to provide these functions because it is possible for an extension to be compiled and linked against a different version of the C library than was used for the @command{gawk} -executable.@footnote{This is more common on MS-Windows systems, but +executable.@footnote{This is more common on MS-Windows systems, but it can happen on Unix-like systems as well.} If @command{gawk} were to use its version of @code{free()} when the memory came from an unrelated version of @code{malloc()}, unexpected behavior would @@ -30772,7 +30772,7 @@ Two convenience macros may be used for allocating storage from @code{gawk_malloc()} and @code{gawk_realloc()}. If the allocation fails, they cause @command{gawk} to exit with a fatal error message. They should be used as if they were -procedure calls that do not return a value. +procedure calls that do not return a value: @table @code @item #define emalloc(pointer, type, size, message) @dots{} @@ -30809,7 +30809,7 @@ make_malloced_string(message, strlen(message), & result); @end example @item #define erealloc(pointer, type, size, message) @dots{} -This is like @code{emalloc()}, but it calls @code{gawk_realloc()}, +This is like @code{emalloc()}, but it calls @code{gawk_realloc()} instead of @code{gawk_malloc()}. The arguments are the same as for the @code{emalloc()} macro. @end table @@ -30834,7 +30834,7 @@ for storage in @code{result}. It returns @code{result}. @itemx make_malloced_string(const char *string, size_t length, awk_value_t *result) This function creates a string value in the @code{awk_value_t} variable pointed to by @code{result}. It expects @code{string} to be a @samp{char *} -value pointing to data previously obtained from @code{gawk_malloc()}, @code{gawk_calloc()} or @code{gawk_realloc()}. The idea here +value pointing to data previously obtained from @code{gawk_malloc()}, @code{gawk_calloc()}, or @code{gawk_realloc()}. The idea here is that the data is passed directly to @command{gawk}, which assumes responsibility for it. It returns @code{result}. @@ -30885,7 +30885,7 @@ The fields are: @table @code @item const char *name; The name of the new function. -@command{awk} level code calls the function by this name. +@command{awk}-level code calls the function by this name. This is a regular C string. Function names must obey the rules for @command{awk} @@ -30899,7 +30899,7 @@ This is a pointer to the C function that provides the extension's functionality. The function must fill in @code{*result} with either a number or a string. @command{gawk} takes ownership of any string memory. -As mentioned earlier, string memory @strong{must} come from one of +As mentioned earlier, string memory @emph{must} come from one of @code{gawk_malloc()}, @code{gawk_calloc()}, or @code{gawk_realloc()}. The @code{num_actual_args} argument tells the C function how many @@ -30951,20 +30951,20 @@ The @code{exit_status} parameter is the exit status value that @command{gawk} intends to pass to the @code{exit()} system call. @item arg0 -A pointer to private data which @command{gawk} saves in order to pass to +A pointer to private data that @command{gawk} saves in order to pass to the function pointed to by @code{funcp}. @end table @end table -Exit callback functions are called in last-in-first-out (LIFO) +Exit callback functions are called in last-in, first-out (LIFO) order---that is, in the reverse order in which they are registered with @command{gawk}. @node Extension Version String @subsubsection Registering An Extension Version String -You can register a version string which indicates the name and -version of your extension, with @command{gawk}, as follows: +You can register a version string that indicates the name and +version of your extension with @command{gawk}, as follows: @table @code @item void register_ext_version(const char *version); @@ -30986,7 +30986,7 @@ of @code{RS} to find the end of the record, and then uses @code{FS} Additionally, it sets the value of @code{RT} (@pxref{Built-in Variables}). If you want, you can provide your own custom input parser. An input -parser's job is to return a record to the @command{gawk} record processing +parser's job is to return a record to the @command{gawk} record-processing code, along with indicators for the value and length of the data to be used for @code{RT}, if any. @@ -31004,9 +31004,9 @@ It should not change any state (variable values, etc.) within @command{gawk}. @item awk_bool_t @var{XXX}_take_control_of(awk_input_buf_t *iobuf); When @command{gawk} decides to hand control of the file over to the input parser, it calls this function. This function in turn must fill -in certain fields in the @code{awk_input_buf_t} structure, and ensure +in certain fields in the @code{awk_input_buf_t} structure and ensure that certain conditions are true. It should then return true. If an -error of some kind occurs, it should not fill in any fields, and should +error of some kind occurs, it should not fill in any fields and should return false; then @command{gawk} will not use the input parser. The details are presented shortly. @end table @@ -31099,7 +31099,7 @@ in the @code{struct stat}, or any combination of these factors. Once @code{@var{XXX}_can_take_file()} has returned true, and @command{gawk} has decided to use your input parser, it calls -@code{@var{XXX}_take_control_of()}. That function then fills one of +@code{@var{XXX}_take_control_of()}. That function then fills either the @code{get_record} field or the @code{read_func} field in the @code{awk_input_buf_t}. It must also ensure that @code{fd} is @emph{not} set to @code{INVALID_HANDLE}. The following list describes the fields that @@ -31121,21 +31121,21 @@ records. Said function is the core of the input parser. Its behavior is described in the text following this list. @item ssize_t (*read_func)(); -This function pointer should point to function that has the +This function pointer should point to a function that has the same behavior as the standard POSIX @code{read()} system call. It is an alternative to the @code{get_record} pointer. Its behavior is also described in the text following this list. @item void (*close_func)(struct awk_input *iobuf); This function pointer should point to a function that does -the ``tear down.'' It should release any resources allocated by +the ``teardown.'' It should release any resources allocated by @code{@var{XXX}_take_control_of()}. It may also close the file. If it does so, it should set the @code{fd} field to @code{INVALID_HANDLE}. If @code{fd} is still not @code{INVALID_HANDLE} after the call to this function, @command{gawk} calls the regular @code{close()} system call. -Having a ``tear down'' function is optional. If your input parser does +Having a ``teardown'' function is optional. If your input parser does not need it, do not set this field. Then, @command{gawk} calls the regular @code{close()} system call on the file descriptor, so it should be valid. @@ -31146,7 +31146,7 @@ input records. The parameters are as follows: @table @code @item char **out -This is a pointer to a @code{char *} variable which is set to point +This is a pointer to a @code{char *} variable that is set to point to the record. @command{gawk} makes its own copy of the data, so the extension must manage this storage. @@ -31199,17 +31199,17 @@ set this field explicitly. You must choose one method or the other: either a function that returns a record, or one that returns raw data. In particular, if you supply a function to get a record, @command{gawk} will -call it, and never call the raw read function. +call it, and will never call the raw read function. @end quotation @command{gawk} ships with a sample extension that reads directories, -returning records for each entry in the directory (@pxref{Extension +returning records for each entry in a directory (@pxref{Extension Sample Readdir}). You may wish to use that code as a guide for writing your own input parser. When writing an input parser, you should think about (and document) how it is expected to interact with @command{awk} code. You may want -it to always be called, and take effect as appropriate (as the +it to always be called, and to take effect as appropriate (as the @code{readdir} extension does). Or you may want it to take effect based upon the value of an @command{awk} variable, as the XML extension from the @code{gawkextlib} project does (@pxref{gawkextlib}). @@ -31319,7 +31319,7 @@ a pointer to any private data associated with the file. These pointers should be set to point to functions that perform the equivalent function as the @code{} functions do, if appropriate. @command{gawk} uses these function pointers for all output. -@command{gawk} initializes the pointers to point to internal, ``pass through'' +@command{gawk} initializes the pointers to point to internal ``pass-through'' functions that just call the regular @code{} functions, so an extension only needs to redefine those functions that are appropriate for what it does. @@ -31330,7 +31330,7 @@ upon the @code{name} and @code{mode} fields, and any additional state (such as @command{awk} variable values) that is appropriate. When @command{gawk} calls @code{@var{XXX}_take_control_of()}, that function should fill -in the other fields, as appropriate, except for @code{fp}, which it should just +in the other fields as appropriate, except for @code{fp}, which it should just use normally. You register your output wrapper with the following function: @@ -31370,14 +31370,14 @@ The fields are as follows: The name of the two-way processor. @item awk_bool_t (*can_take_two_way)(const char *name); -This function returns true if it wants to take over two-way I/O for this @value{FN}. +The function pointed to by this field should return true if it wants to take over two-way I/O for this @value{FN}. It should not change any state (variable values, etc.) within @command{gawk}. @item awk_bool_t (*take_control_of)(const char *name, @itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_input_buf_t *inbuf, @itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_output_buf_t *outbuf); -This function should fill in the @code{awk_input_buf_t} and +The function pointed to by this field should fill in the @code{awk_input_buf_t} and @code{awk_outut_buf_t} structures pointed to by @code{inbuf} and @code{outbuf}, respectively. These structures were described earlier. @@ -31406,7 +31406,7 @@ Register the two-way processor pointed to by @code{two_way_processor} with You can print different kinds of warning messages from your extension, as described here. Note that for these functions, -you must pass in the extension id received from @command{gawk} +you must pass in the extension ID received from @command{gawk} when the extension was loaded:@footnote{Because the API uses only ISO C 90 features, it cannot make use of the ISO C 99 variadic macro feature to hide that parameter. More's the pity.} @@ -31459,7 +31459,7 @@ matches what you requested, the function returns true and fills in the @code{awk_value_t} result. Otherwise, the function returns false, and the @code{val_type} member indicates the type of the actual value. You may then -print an error message, or reissue the request for the actual +print an error message or reissue the request for the actual value type, as appropriate. This behavior is summarized in @ref{table-value-types-returned}. @@ -31492,32 +31492,32 @@ value type, as appropriate. This behavior is summarized in String String String - false - false + False + False Number Number if can be converted, else false Number - false - false + False + False Type Array - false - false + False + False Array - false + False Requested Scalar Scalar Scalar - false - false + False + False @@ -31529,11 +31529,11 @@ value type, as appropriate. This behavior is summarized in - Value Cookie - false - false - false - false + Value cookie + False + False + False + False @@ -31551,12 +31551,12 @@ value type, as appropriate. This behavior is summarized in @end tex @multitable @columnfractions .166 .166 .198 .15 .15 .166 @headitem @tab @tab String @tab Number @tab Array @tab Undefined -@item @tab @b{String} @tab String @tab String @tab false @tab false -@item @tab @b{Number} @tab Number if can be converted, else false @tab Number @tab false @tab false -@item @b{Type} @tab @b{Array} @tab false @tab false @tab Array @tab false -@item @b{Requested} @tab @b{Scalar} @tab Scalar @tab Scalar @tab false @tab false +@item @tab @b{String} @tab String @tab String @tab False @tab False +@item @tab @b{Number} @tab Number if can be converted, else false @tab Number @tab False @tab False +@item @b{Type} @tab @b{Array} @tab False @tab False @tab Array @tab False +@item @b{Requested} @tab @b{Scalar} @tab Scalar @tab Scalar @tab False @tab False @item @tab @b{Undefined} @tab String @tab Number @tab Array @tab Undefined -@item @tab @b{Value Cookie} @tab false @tab false @tab false @tab false +@item @tab @b{Value cookie} @tab False @tab False @tab False @tab False @end multitable @end ifnotdocbook @end ifnotplaintext @@ -31567,21 +31567,21 @@ value type, as appropriate. This behavior is summarized in +------------+------------+-----------+-----------+ | String | Number | Array | Undefined | +-----------+-----------+------------+------------+-----------+-----------+ -| | String | String | String | false | false | +| | String | String | String | False | False | | |-----------+------------+------------+-----------+-----------+ -| | Number | Number if | Number | false | false | +| | Number | Number if | Number | False | False | | | | can be | | | | | | | converted, | | | | | | | else false | | | | | |-----------+------------+------------+-----------+-----------+ -| Type | Array | false | false | Array | false | +| Type | Array | False | False | Array | False | | Requested |-----------+------------+------------+-----------+-----------+ -| | Scalar | Scalar | Scalar | false | false | +| | Scalar | Scalar | Scalar | False | False | | |-----------+------------+------------+-----------+-----------+ | | Undefined | String | Number | Array | Undefined | | |-----------+------------+------------+-----------+-----------+ -| | Value | false | false | false | false | -| | Cookie | | | | | +| | Value | False | False | False | False | +| | cookie | | | | | +-----------+-----------+------------+------------+-----------+-----------+ @end example @end ifplaintext @@ -31598,16 +31598,16 @@ passed to your extension function. They are: @itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_valtype_t wanted, @itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_value_t *result); Fill in the @code{awk_value_t} structure pointed to by @code{result} -with the @code{count}'th argument. Return true if the actual -type matches @code{wanted}, false otherwise. In the latter +with the @code{count}th argument. Return true if the actual +type matches @code{wanted}, and false otherwise. In the latter case, @code{result@w{->}val_type} indicates the actual type -(@pxref{table-value-types-returned}). Counts are zero based---the first +(@pxref{table-value-types-returned}). Counts are zero-based---the first argument is numbered zero, the second one, and so on. @code{wanted} indicates the type of value expected. @item awk_bool_t set_argument(size_t count, awk_array_t array); Convert a parameter that was undefined into an array; this provides -call-by-reference for arrays. Return false if @code{count} is too big, +call by reference for arrays. Return false if @code{count} is too big, or if the argument's type is not undefined. @DBXREF{Array Manipulation} for more information on creating arrays. @end table @@ -31631,8 +31631,9 @@ allows you to create and release cached values. The following routines provide the ability to access and update global @command{awk}-level variables by name. In compiler terminology, identifiers of different kinds are termed @dfn{symbols}, thus the ``sym'' -in the routines' names. The data structure which stores information +in the routines' names. The data structure that stores information about symbols is termed a @dfn{symbol table}. +The functions are as follows: @table @code @item awk_bool_t sym_lookup(const char *name, @@ -31641,14 +31642,14 @@ about symbols is termed a @dfn{symbol table}. Fill in the @code{awk_value_t} structure pointed to by @code{result} with the value of the variable named by the string @code{name}, which is a regular C string. @code{wanted} indicates the type of value expected. -Return true if the actual type matches @code{wanted}, false otherwise. +Return true if the actual type matches @code{wanted}, and false otherwise. In the latter case, @code{result->val_type} indicates the actual type (@pxref{table-value-types-returned}). @item awk_bool_t sym_update(const char *name, awk_value_t *value); Update the variable named by the string @code{name}, which is a regular C string. The variable is added to @command{gawk}'s symbol table -if it is not there. Return true if everything worked, false otherwise. +if it is not there. Return true if everything worked, and false otherwise. Changing types (scalar to array or vice versa) of an existing variable is @emph{not} allowed, nor may this routine be used to update an array. @@ -31673,7 +31674,7 @@ populate it. A @dfn{scalar cookie} is an opaque handle that provides access to a global variable or array. It is an optimization that avoids looking up variables in @command{gawk}'s symbol table every time -access is needed. This was discussed earlier in @ref{General Data Types}. +access is needed. This was discussed earlier, in @ref{General Data Types}. The following functions let you work with scalar cookies: @@ -31789,7 +31790,7 @@ and carefully check the return values from the API functions. @subsubsection Creating and Using Cached Values The routines in this section allow you to create and release -cached values. As with scalar cookies, in theory, cached values +cached values. Like scalar cookies, in theory, cached values are not necessary. You can create numbers and strings using the functions in @ref{Constructor Functions}. You can then assign those values to variables using @code{sym_update()} @@ -31867,7 +31868,7 @@ Using value cookies in this way saves considerable storage, as all of @code{VAR1} through @code{VAR100} share the same value. You might be wondering, ``Is this sharing problematic? -What happens if @command{awk} code assigns a new value to @code{VAR1}, +What happens if @command{awk} code assigns a new value to @code{VAR1}; are all the others changed too?'' That's a great question. The answer is that no, it's not a problem. @@ -31971,7 +31972,7 @@ modify them. @node Array Functions @subsubsection Array Functions -The following functions relate to individual array elements. +The following functions relate to individual array elements: @table @code @item awk_bool_t get_element_count(awk_array_t a_cookie, size_t *count); @@ -31990,13 +31991,13 @@ Return false if @code{wanted} does not match the actual type or if @code{index} is not in the array (@pxref{table-value-types-returned}). The value for @code{index} can be numeric, in which case @command{gawk} -converts it to a string. Using non-integral values is possible, but +converts it to a string. Using nonintegral values is possible, but requires that you understand how such values are converted to strings -(@pxref{Conversion}); thus using integral values is safest. +(@pxref{Conversion}); thus, using integral values is safest. As with @emph{all} strings passed into @command{gawk} from an extension, the string value of @code{index} must come from @code{gawk_malloc()}, -@code{gawk_calloc()} or @code{gawk_realloc()}, and +@code{gawk_calloc()}, or @code{gawk_realloc()}, and @command{gawk} releases the storage. @item awk_bool_t set_array_element(awk_array_t a_cookie, @@ -32052,7 +32053,7 @@ flatten an array and work with it. @item awk_bool_t release_flattened_array(awk_array_t a_cookie, @itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_flat_array_t *data); When done with a flattened array, release the storage using this function. -You must pass in both the original array cookie, and the address of +You must pass in both the original array cookie and the address of the created @code{awk_flat_array_t} structure. The function returns true upon success, false otherwise. @end table @@ -32062,7 +32063,7 @@ The function returns true upon success, false otherwise. To @dfn{flatten} an array is to create a structure that represents the full array in a fashion that makes it easy -for C code to traverse the entire array. Test code +for C code to traverse the entire array. Some of the code in @file{extension/testext.c} does this, and also serves as a nice example showing how to use the APIs. @@ -32119,9 +32120,9 @@ dump_array_and_delete(int nargs, awk_value_t *result) @end example The function then proceeds in steps, as follows. First, retrieve -the name of the array, passed as the first argument. Then -retrieve the array itself. If either operation fails, print -error messages and return: +the name of the array, passed as the first argument, followed by +the array itself. If either operation fails, print an +error message and return: @example /* get argument named array as flat array and print it */ @@ -32157,7 +32158,7 @@ and print it: @end example The third step is to actually flatten the array, and then -to double check that the count in the @code{awk_flat_array_t} +to double-check that the count in the @code{awk_flat_array_t} is the same as the count just retrieved: @example @@ -32178,7 +32179,7 @@ is the same as the count just retrieved: The fourth step is to retrieve the index of the element to be deleted, which was passed as the second argument. Remember that argument counts passed to @code{get_argument()} -are zero-based, thus the second argument is numbered one: +are zero-based, and thus the second argument is numbered one: @example if (! get_argument(1, AWK_STRING, & value3)) @{ @@ -32193,7 +32194,7 @@ element values. In addition, upon finding the element with the index that is supposed to be deleted, the function sets the @code{AWK_ELEMENT_DELETE} bit in the @code{flags} field of the element. When the array is released, @command{gawk} -traverses the flattened array, and deletes any elements which +traverses the flattened array, and deletes any elements that have this flag bit set: @example @@ -32481,10 +32482,10 @@ The API versions are available at compile time as constants: @table @code @item GAWK_API_MAJOR_VERSION -The major version of the API. +The major version of the API @item GAWK_API_MINOR_VERSION -The minor version of the API. +The minor version of the API @end table The minor version increases when new functions are added to the API. Such @@ -32502,14 +32503,14 @@ constant integers: @table @code @item api->major_version -The major version of the running @command{gawk}. +The major version of the running @command{gawk} @item api->minor_version -The minor version of the running @command{gawk}. +The minor version of the running @command{gawk} @end table It is up to the extension to decide if there are API incompatibilities. -Typically a check like this is enough: +Typically, a check like this is enough: @example if (api->major_version != GAWK_API_MAJOR_VERSION @@ -32523,7 +32524,7 @@ if (api->major_version != GAWK_API_MAJOR_VERSION @end example Such code is included in the boilerplate @code{dl_load_func()} macro -provided in @file{gawkapi.h} (discussed later, in +provided in @file{gawkapi.h} (discussed in @ref{Extension API Boilerplate}). @node Extension API Informational Variables @@ -32570,7 +32571,7 @@ as described here. The boilerplate needed is also provided in comments in the @file{gawkapi.h} header file: @example -/* Boiler plate code: */ +/* Boilerplate code: */ int plugin_is_GPL_compatible; static gawk_api_t *const api; @@ -32629,7 +32630,7 @@ to @code{NULL}, or to point to a string giving the name and version of your extension. @item static awk_ext_func_t func_table[] = @{ @dots{} @}; -This is an array of one or more @code{awk_ext_func_t} structures +This is an array of one or more @code{awk_ext_func_t} structures, as described earlier (@pxref{Extension Functions}). It can then be looped over for multiple calls to @code{add_ext_func()}. @@ -32760,7 +32761,7 @@ the @code{stat()} fails. It fills in the following elements: @table @code @item "name" -The name of the file that was @code{stat()}'ed. +The name of the file that was @code{stat()}ed. @item "dev" @itemx "ino" @@ -32816,7 +32817,7 @@ interprocess communications). The file is a directory. @item "fifo" -The file is a named-pipe (also known as a FIFO). +The file is a named pipe (also known as a FIFO). @item "file" The file is just a regular file. @@ -32839,7 +32840,7 @@ For some other systems, @dfn{a priori} knowledge is used to provide a value. Where no value can be determined, it defaults to 512. @end table -Several additional elements may be present depending upon the operating +Several additional elements may be present, depending upon the operating system and the type of the file. You can test for them in your @command{awk} program by using the @code{in} operator (@pxref{Reference to Elements}): @@ -32869,7 +32870,7 @@ edited slightly for presentation. See @file{extension/filefuncs.c} in the @command{gawk} distribution for the complete version.} The file includes a number of standard header files, and then includes -the @file{gawkapi.h} header file which provides the API definitions. +the @file{gawkapi.h} header file, which provides the API definitions. Those are followed by the necessary variable declarations to make use of the API macros and boilerplate code (@pxref{Extension API Boilerplate}): @@ -32910,9 +32911,9 @@ int plugin_is_GPL_compatible; @cindex programming conventions, @command{gawk} extensions By convention, for an @command{awk} function @code{foo()}, the C function that implements it is called @code{do_foo()}. The function should have -two arguments: the first is an @code{int} usually called @code{nargs}, +two arguments. The first is an @code{int}, usually called @code{nargs}, that represents the number of actual arguments for the function. -The second is a pointer to an @code{awk_value_t}, usually named +The second is a pointer to an @code{awk_value_t} structure, usually named @code{result}: @example @@ -32958,7 +32959,7 @@ Finally, the function returns the return value to the @command{awk} level: The @code{stat()} extension is more involved. First comes a function that turns a numeric mode into a printable representation -(e.g., 644 becomes @samp{-rw-r--r--}). This is omitted here for brevity: +(e.g., octal @code{0644} becomes @samp{-rw-r--r--}). This is omitted here for brevity: @example /* format_mode --- turn a stat mode field into something readable */ @@ -33014,9 +33015,9 @@ array_set_numeric(awk_array_t array, const char *sub, double num) The following function does most of the work to fill in the @code{awk_array_t} result array with values obtained -from a valid @code{struct stat}. It is done in a separate function +from a valid @code{struct stat}. This work is done in a separate function to support the @code{stat()} function for @command{gawk} and also -to support the @code{fts()} extension which is included in +to support the @code{fts()} extension, which is included in the same file but whose code is not shown here (@pxref{Extension Sample File Functions}). @@ -33137,8 +33138,8 @@ the @code{stat()} system call instead of the @code{lstat()} system call. This is done by using a function pointer: @code{statfunc}. @code{statfunc} is initialized to point to @code{lstat()} (instead of @code{stat()}) to get the file information, in case the file is a -symbolic link. However, if there were three arguments, @code{statfunc} -is set point to @code{stat()}, instead. +symbolic link. However, if the third argument is included, @code{statfunc} +is set to point to @code{stat()}, instead. Here is the @code{do_stat()} function, which starts with variable declarations and argument checking: @@ -33194,7 +33195,7 @@ Next, it gets the information for the file. If the called function /* always empty out the array */ clear_array(array); - /* stat the file, if error, set ERRNO and return */ + /* stat the file; if error, set ERRNO and return */ ret = statfunc(name, & sbuf); if (ret < 0) @{ update_ERRNO_int(errno); @@ -33216,7 +33217,9 @@ Finally, it's necessary to provide the ``glue'' that loads the new function(s) into @command{gawk}. The @code{filefuncs} extension also provides an @code{fts()} -function, which we omit here. For its sake there is an initialization +function, which we omit here +(@pxref{Extension Sample File Functions}). +For its sake, there is an initialization function: @example @@ -33341,9 +33344,9 @@ $ @kbd{AWKLIBPATH=$PWD gawk -f testff.awk} @section The Sample Extensions in the @command{gawk} Distribution @cindex extensions distributed with @command{gawk} -This @value{SECTION} provides brief overviews of the sample extensions +This @value{SECTION} provides a brief overview of the sample extensions that come in the @command{gawk} distribution. Some of them are intended -for production use (e.g., the @code{filefuncs}, @code{readdir} and +for production use (e.g., the @code{filefuncs}, @code{readdir}, and @code{inplace} extensions). Others mainly provide example code that shows how to use the extension API. @@ -33379,14 +33382,14 @@ This is how you load the extension. @item @code{result = chdir("/some/directory")} The @code{chdir()} function is a direct hook to the @code{chdir()} system call to change the current directory. It returns zero -upon success or less than zero upon error. In the latter case, it updates -@code{ERRNO}. +upon success or a value less than zero upon error. +In the latter case, it updates @code{ERRNO}. @cindex @code{stat()} extension function @item @code{result = stat("/some/path", statdata} [@code{, follow}]@code{)} The @code{stat()} function provides a hook into the @code{stat()} system call. -It returns zero upon success or less than zero upon error. +It returns zero upon success or a value less than zero upon error. In the latter case, it updates @code{ERRNO}. By default, it uses the @code{lstat()} system call. However, if passed @@ -33413,10 +33416,10 @@ array with information retrieved from the filesystem, as follows: @item @code{"major"} @tab @code{st_major} @tab Device files @item @code{"minor"} @tab @code{st_minor} @tab Device files @item @code{"blksize"} @tab @code{st_blksize} @tab All -@item @code{"pmode"} @tab A human-readable version of the mode value, such as printed by -@command{ls}. For example, @code{"-rwxr-xr-x"} @tab All +@item @code{"pmode"} @tab A human-readable version of the mode value, like that printed by +@command{ls} (for example, @code{"-rwxr-xr-x"}) @tab All @item @code{"linkval"} @tab The value of the symbolic link @tab Symbolic links -@item @code{"type"} @tab The type of the file as a string. One of +@item @code{"type"} @tab The type of the file as a string---one of @code{"file"}, @code{"blockdev"}, @code{"chardev"}, @@ -33426,15 +33429,15 @@ array with information retrieved from the filesystem, as follows: @code{"symlink"}, @code{"door"}, or -@code{"unknown"}. -Not all systems support all file types. @tab All +@code{"unknown"} +(not all systems support all file types) @tab All @end multitable @cindex @code{fts()} extension function @item @code{flags = or(FTS_PHYSICAL, ...)} @itemx @code{result = fts(pathlist, flags, filedata)} Walk the file trees provided in @code{pathlist} and fill in the -@code{filedata} array as described next. @code{flags} is the bitwise +@code{filedata} array, as described next. @code{flags} is the bitwise OR of several predefined values, also described in a moment. Return zero if there were no errors, otherwise return @minus{}1. @end table @@ -33490,7 +33493,8 @@ During a traversal, do not cross onto a different mounted filesystem. @end table @item filedata -The @code{filedata} array is first cleared. Then, @code{fts()} creates +The @code{filedata} array holds the results. +@code{fts()} first clears it. Then it creates an element in @code{filedata} for every element in @code{pathlist}. The index is the name of the directory or file given in @code{pathlist}. The element for this index is itself an array. There are two cases: @@ -33532,7 +33536,7 @@ for a file: @code{"path"}, @code{"stat"}, and @code{"error"}. @end table The @code{fts()} function returns zero if there were no errors. -Otherwise it returns @minus{}1. +Otherwise, it returns @minus{}1. @quotation NOTE The @code{fts()} extension does not exactly mimic the @@ -33574,14 +33578,14 @@ The arguments to @code{fnmatch()} are: @table @code @item pattern -The @value{FN} wildcard to match. +The @value{FN} wildcard to match @item string -The @value{FN} string. +The @value{FN} string @item flag Either zero, or the bitwise OR of one or more of the -flags in the @code{FNM} array. +flags in the @code{FNM} array @end table The flags are as follows: @@ -33618,14 +33622,14 @@ This is how you load the extension. @cindex @code{fork()} extension function @item pid = fork() This function creates a new process. The return value is zero in the -child and the process-ID number of the child in the parent, or @minus{}1 +child and the process ID number of the child in the parent, or @minus{}1 upon error. In the latter case, @code{ERRNO} indicates the problem. In the child, @code{PROCINFO["pid"]} and @code{PROCINFO["ppid"]} are updated to reflect the correct values. @cindex @code{waitpid()} extension function @item ret = waitpid(pid) -This function takes a numeric argument, which is the process-ID to +This function takes a numeric argument, which is the process ID to wait for. The return value is that of the @code{waitpid()} system call. @@ -33653,8 +33657,8 @@ else @subsection Enabling In-Place File Editing @cindex @code{inplace} extension -The @code{inplace} extension emulates GNU @command{sed}'s @option{-i} option -which performs ``in place'' editing of each input file. +The @code{inplace} extension emulates GNU @command{sed}'s @option{-i} option, +which performs ``in-place'' editing of each input file. It uses the bundled @file{inplace.awk} include file to invoke the extension properly: @@ -33750,14 +33754,14 @@ they are read, with each entry returned as a record. The record consists of three fields. The first two are the inode number and the @value{FN}, separated by a forward slash character. On systems where the directory entry contains the file type, the record -has a third field (also separated by a slash) which is a single letter +has a third field (also separated by a slash), which is a single letter indicating the type of the file. The letters and their corresponding file types are shown in @ref{table-readdir-file-types}. @float Table,table-readdir-file-types @caption{File types returned by the @code{readdir} extension} @multitable @columnfractions .1 .9 -@headitem Letter @tab File Type +@headitem Letter @tab File type @item @code{b} @tab Block device @item @code{c} @tab Character device @item @code{d} @tab Directory @@ -33785,7 +33789,7 @@ Here is an example: @@load "readdir" @dots{} BEGIN @{ FS = "/" @} -@{ print "file name is", $2 @} +@{ print "@value{FN} is", $2 @} @end example @node Extension Sample Revout @@ -33806,8 +33810,7 @@ BEGIN @{ @} @end example -The output from this program is: -@samp{cinap t'nod}. +The output from this program is @samp{cinap t'nod}. @node Extension Sample Rev2way @subsection Two-Way I/O Example @@ -33862,7 +33865,7 @@ success, or zero upon failure. @code{reada()} is the inverse of @code{writea()}; it reads the file named as its first argument, filling in the array named as the second argument. It clears the array first. -Here too, the return value is one on success and zero upon failure. +Here too, the return value is one on success, or zero upon failure. @end table The array created by @code{reada()} is identical to that written by @@ -33950,7 +33953,7 @@ it tries to use @code{GetSystemTimeAsFileTime()}. Attempt to sleep for @var{seconds} seconds. If @var{seconds} is negative, or the attempt to sleep fails, return @minus{}1 and set @code{ERRNO}. Otherwise, return zero after sleeping for the indicated amount of time. -Note that @var{seconds} may be a floating-point (non-integral) value. +Note that @var{seconds} may be a floating-point (nonintegral) value. Implementation details: depending on platform availability, this function tries to use @code{nanosleep()} or @code{select()} to implement the delay. @end table @@ -33977,9 +33980,12 @@ project provides a number of @command{gawk} extensions, including one for processing XML files. This is the evolution of the original @command{xgawk} (XML @command{gawk}) project. -As of this writing, there are six extensions: +As of this writing, there are seven extensions: @itemize @value{BULLET} +@item +@code{errno} extension + @item GD graphics library extension @@ -33991,7 +33997,7 @@ PostgreSQL extension @item MPFR library extension -(this provides access to a number of MPFR functions which @command{gawk}'s +(this provides access to a number of MPFR functions that @command{gawk}'s native MPFR support does not) @item @@ -34045,7 +34051,7 @@ make install @ii{Install the extensions} If you have installed @command{gawk} in the standard way, then you will likely not need the @option{--with-gawk} option when configuring -@code{gawkextlib}. You may also need to use the @command{sudo} utility +@code{gawkextlib}. You may need to use the @command{sudo} utility to install both @command{gawk} and @code{gawkextlib}, depending upon how your system works. @@ -34070,7 +34076,7 @@ named @code{plugin_is_GPL_compatible}. @item Communication between @command{gawk} and an extension is two-way. -@command{gawk} passes a @code{struct} to the extension which contains +@command{gawk} passes a @code{struct} to the extension that contains various data fields and function pointers. The extension can then call into @command{gawk} via the supplied function pointers to accomplish certain tasks. @@ -34083,7 +34089,7 @@ By convention, implementation functions are named @code{do_@var{XXXX}()} for some @command{awk}-level function @code{@var{XXXX}()}. @item -The API is defined in a header file named @file{gawkpi.h}. You must include +The API is defined in a header file named @file{gawkapi.h}. You must include a number of standard header files @emph{before} including it in your source file. @item @@ -34128,7 +34134,7 @@ getting the count of elements in an array; creating a new array; clearing an array; and -flattening an array for easy C style looping over all its indices and elements) +flattening an array for easy C-style looping over all its indices and elements) @end itemize @item @@ -34136,7 +34142,7 @@ The API defines a number of standard data types for representing @command{awk} values, array elements, and arrays. @item -The API provide convenience functions for constructing values. +The API provides convenience functions for constructing values. It also provides memory management functions to ensure compatibility between memory allocated by @command{gawk} and memory allocated by an extension. @@ -34162,8 +34168,8 @@ file make this easier to do. @item The @command{gawk} distribution includes a number of small but useful -sample extensions. The @code{gawkextlib} project includes several more, -larger, extensions. If you wish to write an extension and contribute it +sample extensions. The @code{gawkextlib} project includes several more +(larger) extensions. If you wish to write an extension and contribute it to the community of @command{gawk} users, the @code{gawkextlib} project is the place to do so. diff --git a/extension/ChangeLog b/extension/ChangeLog index e30ad593..22eee5e4 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,7 @@ +2015-02-11 Arnold D. Robbins + + * filefuncs.c: Punctuation fix. + 2015-01-24 Arnold D. Robbins Infrastructure updates. diff --git a/extension/filefuncs.c b/extension/filefuncs.c index a20e9ff7..ddb1ecda 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -490,7 +490,7 @@ do_stat(int nargs, awk_value_t *result) /* always empty out the array */ clear_array(array); - /* stat the file, if error, set ERRNO and return */ + /* stat the file; if error, set ERRNO and return */ ret = statfunc(name, & sbuf); if (ret < 0) { update_ERRNO_int(errno); diff --git a/gawkapi.h b/gawkapi.h index d8215450..7a58bd4a 100644 --- a/gawkapi.h +++ b/gawkapi.h @@ -846,7 +846,7 @@ make_number(double num, awk_value_t *result) extern int dl_load(const gawk_api_t *const api_p, awk_ext_id_t id); #if 0 -/* Boiler plate code: */ +/* Boilerplate code: */ int plugin_is_GPL_compatible; static gawk_api_t *const api; -- cgit v1.2.3 From 7620bc316c7e5bfd18f19c8e2fb09637d9eb8dee Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 12 Feb 2015 23:24:04 +0200 Subject: Update POSIX.STD. --- ChangeLog | 4 ++++ POSIX.STD | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 773afd3b..aaee6219 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-02-12 Arnold D. Robbins + + * POSIX.STD: Update with info about function parameters. + 2015-02-11 Arnold D. Robbins * gawkapi.h: Fix spelling error in comment. diff --git a/POSIX.STD b/POSIX.STD index 1555d7be..c48dfb42 100644 --- a/POSIX.STD +++ b/POSIX.STD @@ -5,7 +5,7 @@ are permitted in any medium without royalty provided the copyright notice and this notice are preserved. -------------------------------------------------------------------------- -Thu Mar 31 22:31:57 IST 2011 +Thu Feb 12 08:51:22 IST 2015 ============================ This file documents several things related to the 2008 POSIX standard that I noted after reviewing it. @@ -30,6 +30,19 @@ that I noted after reviewing it. sequence into account. By default gawk doesn't do this. Rather, gawk will do this only if --posix is in effect. +4. According to POSIX, the function parameters of one function may not have + the same name as another function, making this invalid: + + function foo() { ... } + function bar(foo) { ...} + + Or even: + + function bar(foo) { ...} + function foo() { ... } + + Gawk enforces this only with --posix. + The following things aren't described by POSIX but ought to be: 1. The value of $0 in an END rule -- cgit v1.2.3 From dea37a9bcb88cf1ba65c7ad5c439425352a01f40 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 12 Feb 2015 23:24:48 +0200 Subject: Remove check for dbug library in configure.ac. --- ChangeLog | 1 + configure | 6 +----- configure.ac | 6 +----- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index aaee6219..cf2a25f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2015-02-12 Arnold D. Robbins * POSIX.STD: Update with info about function parameters. + * configure.ac: Remove test for / use of dbug library. 2015-02-11 Arnold D. Robbins diff --git a/configure b/configure index dd62a431..f4597b70 100755 --- a/configure +++ b/configure @@ -5837,11 +5837,7 @@ if test -f $srcdir/.developing then # add other debug flags as appropriate, save GAWKDEBUG for emergencies CFLAGS="$CFLAGS -DARRAYDEBUG -DYYDEBUG -DLOCALEDEBUG" - if grep dbug $srcdir/.developing - then - CFLAGS="$CFLAGS -DDBUG" - LIBS="$LIBS dbug/libdbug.a" - fi + # turn on compiler warnings if we're doing development # enable debugging using macros also if test "$GCC" = yes diff --git a/configure.ac b/configure.ac index 1df240c7..f6322bf2 100644 --- a/configure.ac +++ b/configure.ac @@ -88,11 +88,7 @@ if test -f $srcdir/.developing then # add other debug flags as appropriate, save GAWKDEBUG for emergencies CFLAGS="$CFLAGS -DARRAYDEBUG -DYYDEBUG -DLOCALEDEBUG" - if grep dbug $srcdir/.developing - then - CFLAGS="$CFLAGS -DDBUG" - LIBS="$LIBS dbug/libdbug.a" - fi + # turn on compiler warnings if we're doing development # enable debugging using macros also if test "$GCC" = yes -- cgit v1.2.3 From 1d4fd43cb95fed18c9885ba5b30b28eb1f8f713b Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 13 Feb 2015 09:40:28 +0200 Subject: Improve regexp collection on Solaris, maybe others. --- ChangeLog | 8 ++++++++ awkgram.c | 10 +++++----- awkgram.y | 10 +++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf2a25f5..18e7e900 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2015-02-13 Arnold D. Robbins + + * awkgram.y (yylex): Be more careful about passing true to + nextc() when collecting a regexp. Some systems' iscntrl() + are not as forgiving as GLIBC's. E.g., Solaris. + Thanks to Dagobert Michelsen for + the bug report and access to systems to check the fix. + 2015-02-12 Arnold D. Robbins * POSIX.STD: Update with info about function parameters. diff --git a/awkgram.c b/awkgram.c index 20d3506a..b3283eb2 100644 --- a/awkgram.c +++ b/awkgram.c @@ -5337,7 +5337,7 @@ yylex(void) if (lasttok == LEX_EOF) /* error earlier in current source, must give up !! */ return 0; - c = nextc(true); + c = nextc(! want_regexp); if (c == END_SRC) return 0; if (c == END_FILE) @@ -5379,12 +5379,12 @@ yylex(void) want_regexp = false; tok = tokstart; for (;;) { - c = nextc(true); + c = nextc(false); if (gawk_mb_cur_max == 1 || nextc_is_1stbyte) switch (c) { case '[': /* one day check for `.' and `=' too */ - if (nextc(true) == ':' || in_brack == 0) + if (nextc(false) == ':' || in_brack == 0) in_brack++; pushback(); break; @@ -5396,7 +5396,7 @@ yylex(void) in_brack--; break; case '\\': - if ((c = nextc(true)) == END_FILE) { + if ((c = nextc(false)) == END_FILE) { pushback(); yyerror(_("unterminated regexp ends with `\\' at end of file")); goto end_regexp; /* kludge */ @@ -5596,7 +5596,7 @@ retry: return lasttok = '*'; case '/': - if (nextc(true) == '=') { + if (nextc(false) == '=') { pushback(); return lasttok = SLASH_BEFORE_EQUAL; } diff --git a/awkgram.y b/awkgram.y index ef7c139a..0df72b42 100644 --- a/awkgram.y +++ b/awkgram.y @@ -2998,7 +2998,7 @@ yylex(void) if (lasttok == LEX_EOF) /* error earlier in current source, must give up !! */ return 0; - c = nextc(true); + c = nextc(! want_regexp); if (c == END_SRC) return 0; if (c == END_FILE) @@ -3040,12 +3040,12 @@ yylex(void) want_regexp = false; tok = tokstart; for (;;) { - c = nextc(true); + c = nextc(false); if (gawk_mb_cur_max == 1 || nextc_is_1stbyte) switch (c) { case '[': /* one day check for `.' and `=' too */ - if (nextc(true) == ':' || in_brack == 0) + if (nextc(false) == ':' || in_brack == 0) in_brack++; pushback(); break; @@ -3057,7 +3057,7 @@ yylex(void) in_brack--; break; case '\\': - if ((c = nextc(true)) == END_FILE) { + if ((c = nextc(false)) == END_FILE) { pushback(); yyerror(_("unterminated regexp ends with `\\' at end of file")); goto end_regexp; /* kludge */ @@ -3257,7 +3257,7 @@ retry: return lasttok = '*'; case '/': - if (nextc(true) == '=') { + if (nextc(false) == '=') { pushback(); return lasttok = SLASH_BEFORE_EQUAL; } -- cgit v1.2.3 From cde238397af273f91deeaadf7e87713fbcb8ffbb Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 13 Feb 2015 11:19:17 +0200 Subject: Through QC1 review of doc! --- doc/ChangeLog | 4 + doc/gawk.info | 528 ++++++++++++++++++++++++++++---------------------------- doc/gawk.texi | 306 ++++++++++++++++---------------- doc/gawktexi.in | 306 ++++++++++++++++---------------- 4 files changed, 578 insertions(+), 566 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 9af9ef06..53dc566e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2015-02-13 Arnold D. Robbins + + * gawktexi.in: O'Reilly fixes. Through QC1 review. + 2015-02-11 Arnold D. Robbins * gawktexi.in: O'Reilly fixes. diff --git a/doc/gawk.info b/doc/gawk.info index 8061bbd2..44fbd8db 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -26168,56 +26168,56 @@ available in System V Release 3.1 (1987). This minor node summarizes the changes, with cross-references to further details: * The requirement for `;' to separate rules on a line (*note - Statements/Lines::). + Statements/Lines::) * User-defined functions and the `return' statement (*note - User-defined::). + User-defined::) * The `delete' statement (*note Delete::). - * The `do'-`while' statement (*note Do Statement::). + * The `do'-`while' statement (*note Do Statement::) * The built-in functions `atan2()', `cos()', `sin()', `rand()', and - `srand()' (*note Numeric Functions::). + `srand()' (*note Numeric Functions::) * The built-in functions `gsub()', `sub()', and `match()' (*note - String Functions::). + String Functions::) * The built-in functions `close()' and `system()' (*note I/O - Functions::). + Functions::) * The `ARGC', `ARGV', `FNR', `RLENGTH', `RSTART', and `SUBSEP' - predefined variables (*note Built-in Variables::). + predefined variables (*note Built-in Variables::) - * Assignable `$0' (*note Changing Fields::). + * Assignable `$0' (*note Changing Fields::) * The conditional expression using the ternary operator `?:' (*note - Conditional Exp::). + Conditional Exp::) - * The expression `INDEX-VARIABLE in ARRAY' outside of `for' - statements (*note Reference to Elements::). + * The expression `INDX in ARRAY' outside of `for' statements (*note + Reference to Elements::) * The exponentiation operator `^' (*note Arithmetic Ops::) and its - assignment operator form `^=' (*note Assignment Ops::). + assignment operator form `^=' (*note Assignment Ops::) * C-compatible operator precedence, which breaks some old `awk' - programs (*note Precedence::). + programs (*note Precedence::) * Regexps as the value of `FS' (*note Field Separators::) and as the third argument to the `split()' function (*note String - Functions::), rather than using only the first character of `FS'. + Functions::), rather than using only the first character of `FS' * Dynamic regexps as operands of the `~' and `!~' operators (*note - Computed Regexps::). + Computed Regexps::) * The escape sequences `\b', `\f', and `\r' (*note Escape - Sequences::). + Sequences::) - * Redirection of input for the `getline' function (*note Getline::). + * Redirection of input for the `getline' function (*note Getline::) - * Multiple `BEGIN' and `END' rules (*note BEGIN/END::). + * Multiple `BEGIN' and `END' rules (*note BEGIN/END::) - * Multidimensional arrays (*note Multidimensional::). + * Multidimensional arrays (*note Multidimensional::)  File: gawk.info, Node: SVR4, Next: POSIX, Prev: V7/SVR3.1, Up: Language History @@ -26228,37 +26228,37 @@ A.2 Changes Between SVR3.1 and SVR4 The System V Release 4 (1989) version of Unix `awk' added these features (some of which originated in `gawk'): - * The `ENVIRON' array (*note Built-in Variables::). + * The `ENVIRON' array (*note Built-in Variables::) - * Multiple `-f' options on the command line (*note Options::). + * Multiple `-f' options on the command line (*note Options::) * The `-v' option for assigning variables before program execution - begins (*note Options::). + begins (*note Options::) - * The `--' signal for terminating command-line options. + * The `--' signal for terminating command-line options * The `\a', `\v', and `\x' escape sequences (*note Escape - Sequences::). + Sequences::) * A defined return value for the `srand()' built-in function (*note - Numeric Functions::). + Numeric Functions::) * The `toupper()' and `tolower()' built-in string functions for case - translation (*note String Functions::). + translation (*note String Functions::) * A cleaner specification for the `%c' format-control letter in the - `printf' function (*note Control Letters::). + `printf' function (*note Control Letters::) * The ability to dynamically pass the field width and precision (`"%*.*d"') in the argument list of `printf' and `sprintf()' - (*note Control Letters::). + (*note Control Letters::) * The use of regexp constants, such as `/foo/', as expressions, where they are equivalent to using the matching operator, as in `$0 ~ - /foo/' (*note Using Constant Regexps::). + /foo/' (*note Using Constant Regexps::) * Processing of escape sequences inside command-line variable - assignments (*note Assignment Options::). + assignments (*note Assignment Options::)  File: gawk.info, Node: POSIX, Next: BTL, Prev: SVR4, Up: Language History @@ -26270,30 +26270,30 @@ The POSIX Command Language and Utilities standard for `awk' (1992) introduced the following changes into the language: * The use of `-W' for implementation-specific options (*note - Options::). + Options::) * The use of `CONVFMT' for controlling the conversion of numbers to - strings (*note Conversion::). + strings (*note Conversion::) * The concept of a numeric string and tighter comparison rules to go - with it (*note Typing and Comparison::). + with it (*note Typing and Comparison::) * The use of predefined variables as function parameter names is - forbidden (*note Definition Syntax::). + forbidden (*note Definition Syntax::) * More complete documentation of many of the previously undocumented - features of the language. + features of the language In 2012, a number of extensions that had been commonly available for many years were finally added to POSIX. They are: * The `fflush()' built-in function for flushing buffered output - (*note I/O Functions::). + (*note I/O Functions::) - * The `nextfile' statement (*note Nextfile Statement::). + * The `nextfile' statement (*note Nextfile Statement::) * The ability to delete all of an array at once with `delete ARRAY' - (*note Delete::). + (*note Delete::) *Note Common Extensions::, for a list of common extensions not @@ -26315,13 +26315,13 @@ Other Versions::). in his version of `awk': * The `**' and `**=' operators (*note Arithmetic Ops:: and *note - Assignment Ops::). + Assignment Ops::) * The use of `func' as an abbreviation for `function' (*note - Definition Syntax::). + Definition Syntax::) * The `fflush()' built-in function for flushing buffered output - (*note I/O Functions::). + (*note I/O Functions::) *Note Common Extensions::, for a full list of the extensions @@ -26343,104 +26343,102 @@ the current version of `gawk'. * Additional predefined variables: - - The `ARGIND' `BINMODE', `ERRNO', `FIELDWIDTHS', `FPAT', + - The `ARGIND', `BINMODE', `ERRNO', `FIELDWIDTHS', `FPAT', `IGNORECASE', `LINT', `PROCINFO', `RT', and `TEXTDOMAIN' - variables (*note Built-in Variables::). + variables (*note Built-in Variables::) * Special files in I/O redirections: - - The `/dev/stdin', `/dev/stdout', `/dev/stderr' and - `/dev/fd/N' special file names (*note Special Files::). + - The `/dev/stdin', `/dev/stdout', `/dev/stderr', and + `/dev/fd/N' special file names (*note Special Files::) - The `/inet', `/inet4', and `/inet6' special files for TCP/IP networking using `|&' to specify which version of the IP - protocol to use (*note TCP/IP Networking::). + protocol to use (*note TCP/IP Networking::) * Changes and/or additions to the language: - - The `\x' escape sequence (*note Escape Sequences::). + - The `\x' escape sequence (*note Escape Sequences::) - - Full support for both POSIX and GNU regexps (*note Regexp::). + - Full support for both POSIX and GNU regexps (*note Regexp::) - The ability for `FS' and for the third argument to `split()' - to be null strings (*note Single Character Fields::). + to be null strings (*note Single Character Fields::) - - The ability for `RS' to be a regexp (*note Records::). + - The ability for `RS' to be a regexp (*note Records::) - The ability to use octal and hexadecimal constants in `awk' - program source code (*note Nondecimal-numbers::). + program source code (*note Nondecimal-numbers::) - The `|&' operator for two-way I/O to a coprocess (*note - Two-way I/O::). + Two-way I/O::) - - Indirect function calls (*note Indirect Calls::). + - Indirect function calls (*note Indirect Calls::) - Directories on the command line produce a warning and are - skipped (*note Command-line directories::). + skipped (*note Command-line directories::) * New keywords: - The `BEGINFILE' and `ENDFILE' special patterns (*note - BEGINFILE/ENDFILE::). + BEGINFILE/ENDFILE::) - - The `switch' statement (*note Switch Statement::). + - The `switch' statement (*note Switch Statement::) * Changes to standard `awk' functions: - The optional second argument to `close()' that allows closing - one end of a two-way pipe to a coprocess (*note Two-way - I/O::). + one end of a two-way pipe to a coprocess (*note Two-way I/O::) - - POSIX compliance for `gsub()' and `sub()' with `--posix'. + - POSIX compliance for `gsub()' and `sub()' with `--posix' - The `length()' function accepts an array argument and returns - the number of elements in the array (*note String - Functions::). + the number of elements in the array (*note String Functions::) - The optional third argument to the `match()' function for capturing text-matching subexpressions within a regexp (*note - String Functions::). + String Functions::) - Positional specifiers in `printf' formats for making - translations easier (*note Printf Ordering::). + translations easier (*note Printf Ordering::) - - The `split()' function's additional optional fourth argument + - The `split()' function's additional optional fourth argument, which is an array to hold the text of the field separators - (*note String Functions::). + (*note String Functions::) * Additional functions only in `gawk': - The `gensub()', `patsplit()', and `strtonum()' functions for - more powerful text manipulation (*note String Functions::). + more powerful text manipulation (*note String Functions::) - The `asort()' and `asorti()' functions for sorting arrays - (*note Array Sorting::). + (*note Array Sorting::) - The `mktime()', `systime()', and `strftime()' functions for - working with timestamps (*note Time Functions::). + working with timestamps (*note Time Functions::) - The `and()', `compl()', `lshift()', `or()', `rshift()', and `xor()' functions for bit manipulation (*note Bitwise - Functions::). + Functions::) - The `isarray()' function to check if a variable is an array - or not (*note Type Functions::). + or not (*note Type Functions::) - - The `bindtextdomain()', `dcgettext()' and `dcngettext()' - functions for internationalization (*note Programmer i18n::). + - The `bindtextdomain()', `dcgettext()', and `dcngettext()' + functions for internationalization (*note Programmer i18n::) * Changes and/or additions in the command-line options: - The `AWKPATH' environment variable for specifying a path - search for the `-f' command-line option (*note Options::). + search for the `-f' command-line option (*note Options::) - The `AWKLIBPATH' environment variable for specifying a path - search for the `-l' command-line option (*note Options::). + search for the `-l' command-line option (*note Options::) - The `-b', `-c', `-C', `-d', `-D', `-e', `-E', `-g', `-h', `-i', `-l', `-L', `-M', `-n', `-N', `-o', `-O', `-p', `-P', `-r', `-S', `-t', and `-V' short options. Also, the ability - to use GNU-style long-named options that start with `--' and + to use GNU-style long-named options that start with `--', and the `--assign', `--bignum', `--characters-as-bytes', `--copyright', `--debug', `--dump-variables', `--exec', `--field-separator', `--file', `--gen-pot', `--help', @@ -26478,8 +26476,8 @@ the current version of `gawk'. - GCC for VAX and Alpha has not been tested for a while. - * Support for the following obsolete systems was removed from the - code for `gawk' version 4.1: + * Support for the following obsolete system was removed from the code + for `gawk' version 4.1: - Ultrix @@ -26879,22 +26877,22 @@ The following table summarizes the common extensions supported by `gawk', Brian Kernighan's `awk', and `mawk', the three most widely used freely available versions of `awk' (*note Other Versions::). -Feature BWK Awk Mawk GNU Awk Now standard ------------------------------------------------------------------------ -`\x' Escape sequence X X X -`FS' as null string X X X -`/dev/stdin' special file X X X -`/dev/stdout' special file X X X -`/dev/stderr' special file X X X -`delete' without subscript X X X X -`fflush()' function X X X X -`length()' of an array X X X -`nextfile' statement X X X X -`**' and `**=' operators X X -`func' keyword X X -`BINMODE' variable X X -`RS' as regexp X X -Time-related functions X X +Feature BWK `awk' `mawk' `gawk' Now standard +-------------------------------------------------------------------------- +`\x' escape sequence X X X +`FS' as null string X X X +`/dev/stdin' special file X X X +`/dev/stdout' special file X X X +`/dev/stderr' special file X X X +`delete' without subscript X X X X +`fflush()' function X X X X +`length()' of an array X X X +`nextfile' statement X X X X +`**' and `**=' operators X X +`func' keyword X X +`BINMODE' variable X X +`RS' as regexp X X +Time-related functions X X  File: gawk.info, Node: Ranges and Locales, Next: Contributors, Prev: Common Extensions, Up: Language History @@ -26914,7 +26912,7 @@ in the machine's native character set. Thus, on ASCII-based systems, `[a-z]' matched all the lowercase letters, and only the lowercase letters, as the numeric values for the letters from `a' through `z' were contiguous. (On an EBCDIC system, the range `[a-z]' includes -additional, non-alphabetic characters as well.) +additional nonalphabetic characters as well.) Almost all introductory Unix literature explained range expressions as working in this fashion, and in particular, would teach that the @@ -26938,7 +26936,7 @@ outside those locales, the ordering was defined to be based on What does that mean? In many locales, `A' and `a' are both less than `B'. In other words, these locales sort characters in dictionary order, and `[a-dx-z]' is typically not equivalent to `[abcdxyz]'; -instead it might be equivalent to `[ABCXYabcdxyz]', for example. +instead, it might be equivalent to `[ABCXYabcdxyz]', for example. This point needs to be emphasized: much literature teaches that you should use `[a-z]' to match a lowercase character. But on systems with @@ -26962,17 +26960,17 @@ is perfectly valid in ASCII, but is not valid in many Unicode locales, such as `en_US.UTF-8'. Early versions of `gawk' used regexp matching code that was not -locale aware, so ranges had their traditional interpretation. +locale-aware, so ranges had their traditional interpretation. When `gawk' switched to using locale-aware regexp matchers, the problems began; especially as both GNU/Linux and commercial Unix vendors started implementing non-ASCII locales, _and making them the default_. Perhaps the most frequently asked question became something -like "why does `[A-Z]' match lowercase letters?!?" +like, "Why does `[A-Z]' match lowercase letters?!?" This situation existed for close to 10 years, if not more, and the `gawk' maintainer grew weary of trying to explain that `gawk' was being -nicely standards compliant, and that the issue was in the user's +nicely standards-compliant, and that the issue was in the user's locale. During the development of version 4.0, he modified `gawk' to always treat ranges in the original, pre-POSIX fashion, unless `--posix' was used (*note Options::).(2) @@ -26984,18 +26982,18 @@ of range expressions was _undefined_.(3) By using this lovely technical term, the standard gives license to implementors to implement ranges in whatever way they choose. The -`gawk' maintainer chose to apply the pre-POSIX meaning in all cases: -the default regexp matching; with `--traditional' and with `--posix'; -in all cases, `gawk' remains POSIX compliant. +`gawk' maintainer chose to apply the pre-POSIX meaning both with the +default regexp matching and when `--traditional' or `--posix' are used. +In all cases `gawk' remains POSIX-compliant. ---------- Footnotes ---------- (1) And Life was good. (2) And thus was born the Campaign for Rational Range Interpretation -(or RRI). A number of GNU tools have either implemented this change, or -will soon. Thanks to Karl Berry for coining the phrase "Rational Range -Interpretation." +(or RRI). A number of GNU tools have already implemented this change, +or will soon. Thanks to Karl Berry for coining the phrase "Rational +Range Interpretation." (3) See the standard (http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05) @@ -27027,7 +27025,7 @@ Info file, in approximate chronological order: * Richard Stallman helped finish the implementation and the initial draft of this Info file. He is also the founder of the FSF and - the GNU project. + the GNU Project. * John Woods contributed parts of the code (mostly fixes) in the initial version of `gawk'. @@ -27113,22 +27111,22 @@ Info file, in approximate chronological order: * John Haque made the following contributions: - The modifications to convert `gawk' into a byte-code - interpreter, including the debugger. + interpreter, including the debugger - - The addition of true arrays of arrays. + - The addition of true arrays of arrays - The additional modifications for support of - arbitrary-precision arithmetic. + arbitrary-precision arithmetic - - The initial text of *note Arbitrary Precision Arithmetic::. + - The initial text of *note Arbitrary Precision Arithmetic:: - The work to merge the three versions of `gawk' into one, for - the 4.1 release. + the 4.1 release - - Improved array internals for arrays indexed by integers. + - Improved array internals for arrays indexed by integers - - The improved array sorting features were driven by John - together with Pat Rankin. + - The improved array sorting features were also driven by John, + together with Pat Rankin * Panos Papadopoulos contributed the original text for *note Include Files::. @@ -27157,11 +27155,11 @@ A.10 Summary ============ * The `awk' language has evolved over time. The first release was - with V7 Unix circa 1978. In 1987, for System V Release 3.1, major - additions, including user-defined functions, were made to the - language. Additional changes were made for System V Release 4, in - 1989. Since then, further minor changes happen under the auspices - of the POSIX standard. + with V7 Unix, circa 1978. In 1987, for System V Release 3.1, + major additions, including user-defined functions, were made to + the language. Additional changes were made for System V Release + 4, in 1989. Since then, further minor changes have happened under + the auspices of the POSIX standard. * Brian Kernighan's `awk' provides a small number of extensions that are implemented in common with other versions of `awk'. @@ -27174,7 +27172,7 @@ A.10 Summary been confusing over the years. Today, `gawk' implements Rational Range Interpretation, where ranges of the form `[a-z]' match _only_ the characters numerically between `a' through `z' in the - machine's native character set. Usually this is ASCII but it can + machine's native character set. Usually this is ASCII, but it can be EBCDIC on IBM S/390 systems. * Many people have contributed to `gawk' development over the years. @@ -27252,7 +27250,7 @@ B.1.2 Extracting the Distribution `gawk' is distributed as several `tar' files compressed with different compression programs: `gzip', `bzip2', and `xz'. For simplicity, the rest of these instructions assume you are using the one compressed with -the GNU Zip program, `gzip'. +the GNU Gzip program (`gzip'). Once you have the distribution (e.g., `gawk-4.1.2.tar.gz'), use `gzip' to expand the file and then use `tar' to extract it. You can @@ -27292,10 +27290,10 @@ files, subdirectories, and files related to the configuration process to different non-Unix operating systems: Various `.c', `.y', and `.h' files - The actual `gawk' source code. + These files contain the actual `gawk' source code. `ABOUT-NLS' - Information about GNU `gettext' and translations. + A file containing information about GNU `gettext' and translations. `AUTHORS' A file with some information about the authorship of `gawk'. It @@ -27327,7 +27325,7 @@ Various `.c', `.y', and `.h' files The GNU General Public License. `POSIX.STD' - A description of behaviors in the POSIX standard for `awk' which + A description of behaviors in the POSIX standard for `awk' that are left undefined, or where `gawk' may not comply fully, as well as a list of things that the POSIX standard should describe but does not. @@ -27548,14 +27546,16 @@ command line when compiling `gawk' from scratch, including: do nothing. Similarly, setting the `LINT' variable (*note User-modified::) has no effect on the running `awk' program. - When used with GCC's automatic dead-code-elimination, this option - cuts almost 23K bytes off the size of the `gawk' executable on - GNU/Linux x86_64 systems. Results on other systems and with other - compilers are likely to vary. Using this option may bring you - some slight performance improvement. + When used with the GNU Compiler Collection's (GCC's) automatic + dead-code-elimination, this option cuts almost 23K bytes off the + size of the `gawk' executable on GNU/Linux x86_64 systems. + Results on other systems and with other compilers are likely to + vary. Using this option may bring you some slight performance + improvement. - Using this option will cause some of the tests in the test suite - to fail. This option may be removed at a later date. + CAUTION: Using this option will cause some of the tests in + the test suite to fail. This option may be removed at a + later date. `--disable-nls' Disable all message-translation facilities. This is usually not @@ -27639,10 +27639,10 @@ B.3.1 Installation on PC Operating Systems This minor node covers installation and usage of `gawk' on Intel architecture machines running MS-DOS, any version of MS-Windows, or OS/2. In this minor node, the term "Windows32" refers to any of -Microsoft Windows-95/98/ME/NT/2000/XP/Vista/7/8. +Microsoft Windows 95/98/ME/NT/2000/XP/Vista/7/8. The limitations of MS-DOS (and MS-DOS shells under the other -operating systems) has meant that various "DOS extenders" are often +operating systems) have meant that various "DOS extenders" are often used with programs such as `gawk'. The varying capabilities of Microsoft Windows 3.1 and Windows32 can add to the confusion. For an overview of the considerations, refer to `README_d/README.pc' in the @@ -27837,7 +27837,7 @@ The DJGPP collection of tools includes an MS-DOS port of Bash, and several shells are available for OS/2, including `ksh'. Under MS-Windows, OS/2 and MS-DOS, `gawk' (and many other text -programs) silently translate end-of-line `\r\n' to `\n' on input and +programs) silently translates end-of-line `\r\n' to `\n' on input and `\n' to `\r\n' on output. A special `BINMODE' variable (c.e.) allows control over these translations and is interpreted as follows: @@ -27859,7 +27859,7 @@ The modes for standard input and standard output are set one time only program). Setting `BINMODE' for standard input or standard output is accomplished by using an appropriate `-v BINMODE=N' option on the command line. `BINMODE' is set at the time a file or pipe is opened -and cannot be changed mid-stream. +and cannot be changed midstream. The name `BINMODE' was chosen to match `mawk' (*note Other Versions::). `mawk' and `gawk' handle `BINMODE' similarly; however, @@ -27903,10 +27903,9 @@ B.3.1.5 Using `gawk' In The Cygwin Environment `gawk' can be built and used "out of the box" under MS-Windows if you are using the Cygwin environment (http://www.cygwin.com). This -environment provides an excellent simulation of GNU/Linux, using the -GNU tools, such as Bash, the GNU Compiler Collection (GCC), GNU Make, -and other GNU programs. Compilation and installation for Cygwin is the -same as for a Unix system: +environment provides an excellent simulation of GNU/Linux, using Bash, +GCC, GNU Make, and other GNU programs. Compilation and installation +for Cygwin is the same as for a Unix system: tar -xvpzf gawk-4.1.2.tar.gz cd gawk-4.1.2 @@ -27924,7 +27923,7 @@ B.3.1.6 Using `gawk' In The MSYS Environment ............................................ In the MSYS environment under MS-Windows, `gawk' automatically uses -binary mode for reading and writing files. Thus there is no need to +binary mode for reading and writing files. Thus, there is no need to use the `BINMODE' variable. This can cause problems with other Unix-like components that have @@ -27979,9 +27978,9 @@ available from `https://github.com/endlesssoftware/mmk'. target parameter may need to be exact. `gawk' has been tested under VAX/VMS 7.3 and Alpha/VMS 7.3-1 using -Compaq C V6.4, and Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS 8.3. -The most recent builds used HP C V7.3 on Alpha VMS 8.3 and both Alpha -and IA64 VMS 8.4 used HP C 7.3.(1) +Compaq C V6.4, and under Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS +8.3. The most recent builds used HP C V7.3 on Alpha VMS 8.3 and both +Alpha and IA64 VMS 8.4 used HP C 7.3.(1) *Note VMS GNV::, for information on building `gawk' as a PCSI kit that is compatible with the GNV product. @@ -28024,7 +28023,7 @@ than 32 bits. /name=(as_is,short) - Compile time macros need to be defined before the first VMS-supplied + Compile-time macros need to be defined before the first VMS-supplied header file is included, as follows: #if (__CRTL_VER >= 70200000) && !defined (__VAX) @@ -28068,14 +28067,14 @@ directory tree, the program will be known as `GNV$GNU:[vms_help]gawk.hlp'. The PCSI kit also installs a `GNV$GNU:[vms_bin]gawk_verb.cld' file -which can be used to add `gawk' and `awk' as DCL commands. +that can be used to add `gawk' and `awk' as DCL commands. For just the current process you can use: $ set command gnv$gnu:[vms_bin]gawk_verb.cld Or the system manager can use `GNV$GNU:[vms_bin]gawk_verb.cld' to -add the `gawk' and `awk' to the system wide `DCLTABLES'. +add the `gawk' and `awk' to the system-wide `DCLTABLES'. The DCL syntax is documented in the `gawk.hlp' file. @@ -28135,14 +28134,14 @@ process) are present, there is no ambiguity and `--' can be omitted. status value when the program exits. The VMS severity bits will be set based on the `exit' value. A -failure is indicated by 1 and VMS sets the `ERROR' status. A fatal -error is indicated by 2 and VMS sets the `FATAL' status. All other +failure is indicated by 1, and VMS sets the `ERROR' status. A fatal +error is indicated by 2, and VMS sets the `FATAL' status. All other values will have the `SUCCESS' status. The exit value is encoded to comply with VMS coding standards and will have the `C_FACILITY_NO' of `0x350000' with the constant `0xA000' added to the number shifted over by 3 bits to make room for the severity codes. - To extract the actual `gawk' exit code from the VMS status use: + To extract the actual `gawk' exit code from the VMS status, use: unix_status = (vms_status .and. &x7f8) / 8 @@ -28158,7 +28157,7 @@ Function::. VMS reports time values in GMT unless one of the `SYS$TIMEZONE_RULE' or `TZ' logical names is set. Older versions of VMS, such as VAX/VMS -7.3 do not set these logical names. +7.3, do not set these logical names. The default search path, when looking for `awk' program files specified by the `-f' option, is `"SYS$DISK:[],AWK_LIBRARY:"'. The @@ -28175,7 +28174,7 @@ B.3.2.5 The VMS GNV Project The VMS GNV package provides a build environment similar to POSIX with ports of a collection of open source tools. The `gawk' found in the GNV -base kit is an older port. Currently the GNV project is being +base kit is an older port. Currently, the GNV project is being reorganized to supply individual PCSI packages for each component. See `https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/'. @@ -28209,7 +28208,7 @@ B.4 Reporting Problems and Bugs Douglas Adams, `The Hitchhiker's Guide to the Galaxy' If you have problems with `gawk' or think that you have found a bug, -report it to the developers; we cannot promise to do anything but we +report it to the developers; we cannot promise to do anything, but we might well want to fix it. Before reporting a bug, make sure you have really found a genuine @@ -28220,7 +28219,7 @@ documentation! Before reporting a bug or trying to fix it yourself, try to isolate it to the smallest possible `awk' program and input data file that -reproduces the problem. Then send us the program and data file, some +reproduce the problem. Then send us the program and data file, some idea of what kind of Unix system you're using, the compiler you used to compile `gawk', and the exact results `gawk' gave you. Also say what you expected to occur; this helps us decide whether the problem is @@ -28232,7 +28231,7 @@ You can get this information with the command `gawk --version'. Once you have a precise problem description, send email to . - The `gawk' maintainers subscribe to this address and thus they will + The `gawk' maintainers subscribe to this address, and thus they will receive your bug report. Although you can send mail to the maintainers directly, the bug reporting address is preferred because the email list is archived at the GNU Project. _All email must be in English. This is @@ -28253,8 +28252,8 @@ the only language understood in common by all the maintainers._ forward bug reports "upstream" to the GNU mailing list, many don't, so there is a good chance that the `gawk' maintainers won't even see the bug report! Second, mail to the GNU list is - archived, and having everything at the GNU project keeps things - self-contained and not dependant on other organizations. + archived, and having everything at the GNU Project keeps things + self-contained and not dependent on other organizations. Non-bug suggestions are always welcome as well. If you have questions about things that are unclear in the documentation or are @@ -28263,18 +28262,19 @@ if we can. If you find bugs in one of the non-Unix ports of `gawk', send an email to the bug list, with a copy to the person who maintains that -port. They are named in the following list, as well as in the `README' -file in the `gawk' distribution. Information in the `README' file -should be considered authoritative if it conflicts with this Info file. +port. The maintainers are named in the following list, as well as in +the `README' file in the `gawk' distribution. Information in the +`README' file should be considered authoritative if it conflicts with +this Info file. The people maintaining the various `gawk' ports are: -Unix and POSIX systems Arnold Robbins, . -MS-DOS with DJGPP Scott Deifik, . -MS-Windows with MinGW Eli Zaretskii, . -OS/2 Andreas Buening, . -VMS John Malmberg, . -z/OS (OS/390) Dave Pitts, . +Unix and POSIX systems Arnold Robbins, +MS-DOS with DJGPP Scott Deifik, +MS-Windows with MinGW Eli Zaretskii, +OS/2 Andreas Buening, +VMS John Malmberg, +z/OS (OS/390) Dave Pitts, If your bug is also reproducible under Unix, send a copy of your report to the email list as well. @@ -28285,7 +28285,7 @@ File: gawk.info, Node: Other Versions, Next: Installation summary, Prev: Bugs B.5 Other Freely Available `awk' Implementations ================================================ - It's kind of fun to put comments like this in your awk code. + It's kind of fun to put comments like this in your awk code: `// Do C++ comments work? answer: yes! of course' -- Michael Brennan @@ -28308,7 +28308,7 @@ Unix `awk' Zip file `http://www.cs.princeton.edu/~bwk/btl.mirror/awk.zip' - You can also retrieve it from Git Hub: + You can also retrieve it from GitHub: git clone git://github.com/onetrueawk/awk bwkawk @@ -28350,7 +28350,7 @@ Unix `awk' `awka' Written by Andrew Sumner, `awka' translates `awk' programs into C, compiles them, and links them with a library of functions that - provides the core `awk' functionality. It also has a number of + provide the core `awk' functionality. It also has a number of extensions. The `awk' translator is released under the GPL, and the library is @@ -28364,14 +28364,14 @@ Unix `awk' `pawk' Nelson H.F. Beebe at the University of Utah has modified BWK `awk' to provide timing and profiling information. It is different from - `gawk' with the `--profile' option (*note Profiling::), in that it + `gawk' with the `--profile' option (*note Profiling::) in that it uses CPU-based profiling, not line-count profiling. You may find it at either `ftp://ftp.math.utah.edu/pub/pawk/pawk-20030606.tar.gz' or `http://www.math.utah.edu/pub/pawk/pawk-20030606.tar.gz'. -Busybox Awk - Busybox is a GPL-licensed program providing small versions of many +BusyBox `awk' + BusyBox is a GPL-licensed program providing small versions of many applications within a single executable. It is aimed at embedded systems. It includes a full implementation of POSIX `awk'. When building it, be careful not to do `make install' as it will @@ -28381,7 +28381,7 @@ Busybox Awk The OpenSolaris POSIX `awk' The versions of `awk' in `/usr/xpg4/bin' and `/usr/xpg6/bin' on - Solaris are more-or-less POSIX-compliant. They are based on the + Solaris are more or less POSIX-compliant. They are based on the `awk' from Mortice Kern Systems for PCs. We were able to make this code compile and work under GNU/Linux with 1-2 hours of work. Making it more generally portable (using GNU Autoconf and/or @@ -28413,7 +28413,7 @@ Libmawk information. (This is not related to Nelson Beebe's modified version of BWK `awk', described earlier.) -QSE Awk +QSE `awk' This is an embeddable `awk' interpreter. For more information, see `http://code.google.com/p/qse/' and `http://awk.info/?tools/qse'. @@ -28431,7 +28431,7 @@ Other versions See also the "Versions and implementations" section of the Wikipedia article (http://en.wikipedia.org/wiki/Awk_language#Versions_and_implementations) - for information on additional versions. + on `awk' for information on additional versions.  @@ -28440,7 +28440,7 @@ File: gawk.info, Node: Installation summary, Prev: Other Versions, Up: Instal B.6 Summary =========== - * The `gawk' distribution is available from GNU project's main + * The `gawk' distribution is available from the GNU Project's main distribution site, `ftp.gnu.org'. The canonical build recipe is: wget http://ftp.gnu.org/gnu/gawk/gawk-4.1.2.tar.gz @@ -28449,17 +28449,17 @@ B.6 Summary ./configure && make && make check * `gawk' may be built on non-POSIX systems as well. The currently - supported systems are MS-Windows using DJGPP, MSYS, MinGW and + supported systems are MS-Windows using DJGPP, MSYS, MinGW, and Cygwin, OS/2 using EMX, and both Vax/VMS and OpenVMS. Instructions for each system are included in this major node. * Bug reports should be sent via email to . Bug - reports should be in English, and should include the version of + reports should be in English and should include the version of `gawk', how it was compiled, and a short program and data file - which demonstrate the problem. + that demonstrate the problem. * There are a number of other freely available `awk' - implementations. Many are POSIX compliant; others are less so. + implementations. Many are POSIX-compliant; others are less so.  @@ -31511,7 +31511,7 @@ Index * --disable-lint configuration option: Additional Configuration Options. (line 15) * --disable-nls configuration option: Additional Configuration Options. - (line 30) + (line 32) * --dump-variables option: Options. (line 93) * --dump-variables option, using for library functions: Library Names. (line 45) @@ -31549,7 +31549,7 @@ Index * --use-lc-numeric option: Options. (line 220) * --version option: Options. (line 302) * --with-whiny-user-strftime configuration option: Additional Configuration Options. - (line 35) + (line 37) * -b option: Options. (line 68) * -C option: Options. (line 88) * -c option: Options. (line 81) @@ -32070,7 +32070,7 @@ Index * Brown, Martin: Contributors. (line 82) * BSD-based operating systems: Glossary. (line 753) * bt debugger command (alias for backtrace): Execution Stack. (line 13) -* Buening, Andreas <1>: Bugs. (line 70) +* Buening, Andreas <1>: Bugs. (line 71) * Buening, Andreas <2>: Contributors. (line 92) * Buening, Andreas: Acknowledgments. (line 60) * buffering, input/output <1>: Two-way I/O. (line 52) @@ -32083,7 +32083,7 @@ Index * bug-gawk@gnu.org bug reporting address: Bugs. (line 30) * built-in functions: Functions. (line 6) * built-in functions, evaluation order: Calling Built-in. (line 30) -* Busybox Awk: Other Versions. (line 92) +* BusyBox Awk: Other Versions. (line 92) * c.e., See common extensions: Conventions. (line 51) * call by reference: Pass By Value/Reference. (line 44) @@ -32215,9 +32215,9 @@ Index * configuration option, --disable-lint: Additional Configuration Options. (line 15) * configuration option, --disable-nls: Additional Configuration Options. - (line 30) + (line 32) * configuration option, --with-whiny-user-strftime: Additional Configuration Options. - (line 35) + (line 37) * configuration options, gawk: Additional Configuration Options. (line 6) * constant regexps: Regexp Usage. (line 57) @@ -32443,7 +32443,7 @@ Index * decimal point character, locale specific: Options. (line 272) * decrement operators: Increment Ops. (line 35) * default keyword: Switch Statement. (line 6) -* Deifik, Scott <1>: Bugs. (line 70) +* Deifik, Scott <1>: Bugs. (line 71) * Deifik, Scott <2>: Contributors. (line 53) * Deifik, Scott: Acknowledgments. (line 60) * delete ARRAY: Delete. (line 39) @@ -33374,7 +33374,7 @@ Index * mail-list file: Sample Data Files. (line 6) * mailing labels, printing: Labels Program. (line 6) * mailing list, GNITS: Acknowledgments. (line 52) -* Malmberg, John <1>: Bugs. (line 70) +* Malmberg, John <1>: Bugs. (line 71) * Malmberg, John: Acknowledgments. (line 60) * Malmberg, John E.: Contributors. (line 137) * mark parity: Ordinal Functions. (line 45) @@ -33613,7 +33613,7 @@ Index (line 6) * pipe, input: Getline/Pipe. (line 9) * pipe, output: Redirection. (line 57) -* Pitts, Dave <1>: Bugs. (line 70) +* Pitts, Dave <1>: Bugs. (line 71) * Pitts, Dave: Acknowledgments. (line 60) * Plauger, P.J.: Library Functions. (line 12) * plug-in: Extension Intro. (line 6) @@ -33791,7 +33791,7 @@ Index * pwcat program: Passwd Functions. (line 23) * q debugger command (alias for quit): Miscellaneous Debugger Commands. (line 99) -* QSE Awk: Other Versions. (line 135) +* QSE awk: Other Versions. (line 135) * Quanstrom, Erik: Alarm Program. (line 8) * question mark (?), ?: operator: Precedence. (line 92) * question mark (?), regexp operator <1>: GNU Regexp Operators. @@ -33926,7 +33926,7 @@ Index * RLENGTH variable: Auto-set. (line 252) * RLENGTH variable, match() function and: String Functions. (line 228) * Robbins, Arnold <1>: Future Extensions. (line 6) -* Robbins, Arnold <2>: Bugs. (line 70) +* Robbins, Arnold <2>: Bugs. (line 71) * Robbins, Arnold <3>: Contributors. (line 144) * Robbins, Arnold <4>: General Data Types. (line 6) * Robbins, Arnold <5>: Alarm Program. (line 6) @@ -34117,7 +34117,7 @@ Index (line 94) * source code, awka: Other Versions. (line 68) * source code, Brian Kernighan's awk: Other Versions. (line 13) -* source code, Busybox Awk: Other Versions. (line 92) +* source code, BusyBox Awk: Other Versions. (line 92) * source code, gawk: Gawk Distribution. (line 6) * source code, Illumos awk: Other Versions. (line 109) * source code, jawk: Other Versions. (line 117) @@ -34126,7 +34126,7 @@ Index * source code, mixing: Options. (line 117) * source code, pawk: Other Versions. (line 82) * source code, pawk (Python version): Other Versions. (line 129) -* source code, QSE Awk: Other Versions. (line 135) +* source code, QSE awk: Other Versions. (line 135) * source code, QuikTrim Awk: Other Versions. (line 139) * source code, Solaris awk: Other Versions. (line 100) * source files, search path for: Programs Exercises. (line 70) @@ -34455,7 +34455,7 @@ Index * xor: Bitwise Functions. (line 56) * XOR bitwise operation: Bitwise Functions. (line 6) * Yawitz, Efraim: Contributors. (line 131) -* Zaretskii, Eli <1>: Bugs. (line 70) +* Zaretskii, Eli <1>: Bugs. (line 71) * Zaretskii, Eli <2>: Contributors. (line 55) * Zaretskii, Eli: Acknowledgments. (line 60) * zerofile.awk program: Empty Files. (line 21) @@ -34970,77 +34970,77 @@ Node: Extension summary1046798 Node: Extension Exercises1050487 Node: Language History1051209 Node: V7/SVR3.11052865 -Node: SVR41055046 -Node: POSIX1056491 -Node: BTL1057880 -Node: POSIX/GNU1058614 -Node: Feature History1064178 -Node: Common Extensions1077276 -Node: Ranges and Locales1078600 -Ref: Ranges and Locales-Footnote-11083218 -Ref: Ranges and Locales-Footnote-21083245 -Ref: Ranges and Locales-Footnote-31083479 -Node: Contributors1083700 -Node: History summary1089241 -Node: Installation1090611 -Node: Gawk Distribution1091557 -Node: Getting1092041 -Node: Extracting1092864 -Node: Distribution contents1094499 -Node: Unix Installation1100216 -Node: Quick Installation1100833 -Node: Additional Configuration Options1103257 -Node: Configuration Philosophy1104995 -Node: Non-Unix Installation1107364 -Node: PC Installation1107822 -Node: PC Binary Installation1109141 -Node: PC Compiling1110989 -Ref: PC Compiling-Footnote-11114010 -Node: PC Testing1114119 -Node: PC Using1115295 -Node: Cygwin1119410 -Node: MSYS1120233 -Node: VMS Installation1120733 -Node: VMS Compilation1121525 -Ref: VMS Compilation-Footnote-11122747 -Node: VMS Dynamic Extensions1122805 -Node: VMS Installation Details1124489 -Node: VMS Running1126741 -Node: VMS GNV1129577 -Node: VMS Old Gawk1130311 -Node: Bugs1130781 -Node: Other Versions1134664 -Node: Installation summary1141088 -Node: Notes1142144 -Node: Compatibility Mode1143009 -Node: Additions1143791 -Node: Accessing The Source1144716 -Node: Adding Code1146151 -Node: New Ports1152308 -Node: Derived Files1156790 -Ref: Derived Files-Footnote-11162265 -Ref: Derived Files-Footnote-21162299 -Ref: Derived Files-Footnote-31162895 -Node: Future Extensions1163009 -Node: Implementation Limitations1163615 -Node: Extension Design1164863 -Node: Old Extension Problems1166017 -Ref: Old Extension Problems-Footnote-11167534 -Node: Extension New Mechanism Goals1167591 -Ref: Extension New Mechanism Goals-Footnote-11170951 -Node: Extension Other Design Decisions1171140 -Node: Extension Future Growth1173248 -Node: Old Extension Mechanism1174084 -Node: Notes summary1175846 -Node: Basic Concepts1177032 -Node: Basic High Level1177713 -Ref: figure-general-flow1177985 -Ref: figure-process-flow1178584 -Ref: Basic High Level-Footnote-11181813 -Node: Basic Data Typing1181998 -Node: Glossary1185326 -Node: Copying1217255 -Node: GNU Free Documentation License1254811 -Node: Index1279947 +Node: SVR41055018 +Node: POSIX1056452 +Node: BTL1057833 +Node: POSIX/GNU1058564 +Node: Feature History1064085 +Node: Common Extensions1077183 +Node: Ranges and Locales1078555 +Ref: Ranges and Locales-Footnote-11083174 +Ref: Ranges and Locales-Footnote-21083201 +Ref: Ranges and Locales-Footnote-31083436 +Node: Contributors1083657 +Node: History summary1089197 +Node: Installation1090576 +Node: Gawk Distribution1091522 +Node: Getting1092006 +Node: Extracting1092829 +Node: Distribution contents1094466 +Node: Unix Installation1100220 +Node: Quick Installation1100837 +Node: Additional Configuration Options1103261 +Node: Configuration Philosophy1105064 +Node: Non-Unix Installation1107433 +Node: PC Installation1107891 +Node: PC Binary Installation1109211 +Node: PC Compiling1111059 +Ref: PC Compiling-Footnote-11114080 +Node: PC Testing1114189 +Node: PC Using1115365 +Node: Cygwin1119480 +Node: MSYS1120250 +Node: VMS Installation1120751 +Node: VMS Compilation1121543 +Ref: VMS Compilation-Footnote-11122772 +Node: VMS Dynamic Extensions1122830 +Node: VMS Installation Details1124514 +Node: VMS Running1126765 +Node: VMS GNV1129605 +Node: VMS Old Gawk1130340 +Node: Bugs1130810 +Node: Other Versions1134699 +Node: Installation summary1141133 +Node: Notes1142192 +Node: Compatibility Mode1143057 +Node: Additions1143839 +Node: Accessing The Source1144764 +Node: Adding Code1146199 +Node: New Ports1152356 +Node: Derived Files1156838 +Ref: Derived Files-Footnote-11162313 +Ref: Derived Files-Footnote-21162347 +Ref: Derived Files-Footnote-31162943 +Node: Future Extensions1163057 +Node: Implementation Limitations1163663 +Node: Extension Design1164911 +Node: Old Extension Problems1166065 +Ref: Old Extension Problems-Footnote-11167582 +Node: Extension New Mechanism Goals1167639 +Ref: Extension New Mechanism Goals-Footnote-11170999 +Node: Extension Other Design Decisions1171188 +Node: Extension Future Growth1173296 +Node: Old Extension Mechanism1174132 +Node: Notes summary1175894 +Node: Basic Concepts1177080 +Node: Basic High Level1177761 +Ref: figure-general-flow1178033 +Ref: figure-process-flow1178632 +Ref: Basic High Level-Footnote-11181861 +Node: Basic Data Typing1182046 +Node: Glossary1185374 +Node: Copying1217303 +Node: GNU Free Documentation License1254859 +Node: Index1279995  End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 76d0c546..1ca68804 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -35206,81 +35206,81 @@ cross-references to further details: @itemize @value{BULLET} @item The requirement for @samp{;} to separate rules on a line -(@pxref{Statements/Lines}). +(@pxref{Statements/Lines}) @item User-defined functions and the @code{return} statement -(@pxref{User-defined}). +(@pxref{User-defined}) @item The @code{delete} statement (@pxref{Delete}). @item The @code{do}-@code{while} statement -(@pxref{Do Statement}). +(@pxref{Do Statement}) @item The built-in functions @code{atan2()}, @code{cos()}, @code{sin()}, @code{rand()}, and -@code{srand()} (@pxref{Numeric Functions}). +@code{srand()} (@pxref{Numeric Functions}) @item The built-in functions @code{gsub()}, @code{sub()}, and @code{match()} -(@pxref{String Functions}). +(@pxref{String Functions}) @item The built-in functions @code{close()} and @code{system()} -(@pxref{I/O Functions}). +(@pxref{I/O Functions}) @item The @code{ARGC}, @code{ARGV}, @code{FNR}, @code{RLENGTH}, @code{RSTART}, -and @code{SUBSEP} predefined variables (@pxref{Built-in Variables}). +and @code{SUBSEP} predefined variables (@pxref{Built-in Variables}) @item -Assignable @code{$0} (@pxref{Changing Fields}). +Assignable @code{$0} (@pxref{Changing Fields}) @item The conditional expression using the ternary operator @samp{?:} -(@pxref{Conditional Exp}). +(@pxref{Conditional Exp}) @item -The expression @samp{@var{index-variable} in @var{array}} outside of @code{for} -statements (@pxref{Reference to Elements}). +The expression @samp{@var{indx} in @var{array}} outside of @code{for} +statements (@pxref{Reference to Elements}) @item The exponentiation operator @samp{^} (@pxref{Arithmetic Ops}) and its assignment operator -form @samp{^=} (@pxref{Assignment Ops}). +form @samp{^=} (@pxref{Assignment Ops}) @item C-compatible operator precedence, which breaks some old @command{awk} -programs (@pxref{Precedence}). +programs (@pxref{Precedence}) @item Regexps as the value of @code{FS} (@pxref{Field Separators}) and as the third argument to the @code{split()} function (@pxref{String Functions}), rather than using only the first character -of @code{FS}. +of @code{FS} @item Dynamic regexps as operands of the @samp{~} and @samp{!~} operators -(@pxref{Computed Regexps}). +(@pxref{Computed Regexps}) @item The escape sequences @samp{\b}, @samp{\f}, and @samp{\r} -(@pxref{Escape Sequences}). +(@pxref{Escape Sequences}) @item Redirection of input for the @code{getline} function -(@pxref{Getline}). +(@pxref{Getline}) @item Multiple @code{BEGIN} and @code{END} rules -(@pxref{BEGIN/END}). +(@pxref{BEGIN/END}) @item Multidimensional arrays -(@pxref{Multidimensional}). +(@pxref{Multidimensional}) @end itemize @node SVR4 @@ -35292,54 +35292,54 @@ The System V Release 4 (1989) version of Unix @command{awk} added these features @itemize @value{BULLET} @item -The @code{ENVIRON} array (@pxref{Built-in Variables}). +The @code{ENVIRON} array (@pxref{Built-in Variables}) @c gawk and MKS awk @item Multiple @option{-f} options on the command line -(@pxref{Options}). +(@pxref{Options}) @c MKS awk @item The @option{-v} option for assigning variables before program execution begins -(@pxref{Options}). +(@pxref{Options}) @c GNU, Bell Laboratories & MKS together @item -The @option{--} signal for terminating command-line options. +The @option{--} signal for terminating command-line options @item The @samp{\a}, @samp{\v}, and @samp{\x} escape sequences -(@pxref{Escape Sequences}). +(@pxref{Escape Sequences}) @c GNU, for ANSI C compat @item A defined return value for the @code{srand()} built-in function -(@pxref{Numeric Functions}). +(@pxref{Numeric Functions}) @item The @code{toupper()} and @code{tolower()} built-in string functions for case translation -(@pxref{String Functions}). +(@pxref{String Functions}) @item A cleaner specification for the @samp{%c} format-control letter in the @code{printf} function -(@pxref{Control Letters}). +(@pxref{Control Letters}) @item The ability to dynamically pass the field width and precision (@code{"%*.*d"}) in the argument list of @code{printf} and @code{sprintf()} -(@pxref{Control Letters}). +(@pxref{Control Letters}) @item The use of regexp constants, such as @code{/foo/}, as expressions, where they are equivalent to using the matching operator, as in @samp{$0 ~ /foo/} -(@pxref{Using Constant Regexps}). +(@pxref{Using Constant Regexps}) @item Processing of escape sequences inside command-line variable assignments -(@pxref{Assignment Options}). +(@pxref{Assignment Options}) @end itemize @node POSIX @@ -35353,23 +35353,23 @@ introduced the following changes into the language: @itemize @value{BULLET} @item The use of @option{-W} for implementation-specific options -(@pxref{Options}). +(@pxref{Options}) @item The use of @code{CONVFMT} for controlling the conversion of numbers -to strings (@pxref{Conversion}). +to strings (@pxref{Conversion}) @item The concept of a numeric string and tighter comparison rules to go -with it (@pxref{Typing and Comparison}). +with it (@pxref{Typing and Comparison}) @item The use of predefined variables as function parameter names is forbidden -(@pxref{Definition Syntax}). +(@pxref{Definition Syntax}) @item More complete documentation of many of the previously undocumented -features of the language. +features of the language @end itemize In 2012, a number of extensions that had been commonly available for @@ -35378,15 +35378,15 @@ many years were finally added to POSIX. They are: @itemize @value{BULLET} @item The @code{fflush()} built-in function for flushing buffered output -(@pxref{I/O Functions}). +(@pxref{I/O Functions}) @item The @code{nextfile} statement -(@pxref{Nextfile Statement}). +(@pxref{Nextfile Statement}) @item The ability to delete all of an array at once with @samp{delete @var{array}} -(@pxref{Delete}). +(@pxref{Delete}) @end itemize @@ -35416,22 +35416,22 @@ originally appeared in his version of @command{awk}: The @samp{**} and @samp{**=} operators (@pxref{Arithmetic Ops} and -@ref{Assignment Ops}). +@ref{Assignment Ops}) @item The use of @code{func} as an abbreviation for @code{function} -(@pxref{Definition Syntax}). +(@pxref{Definition Syntax}) @item The @code{fflush()} built-in function for flushing buffered output -(@pxref{I/O Functions}). +(@pxref{I/O Functions}) @ignore @item The @code{SYMTAB} array, that allows access to @command{awk}'s internal symbol table. This feature was never documented for his @command{awk}, largely because it is somewhat shakily implemented. For instance, you cannot access arrays -or array elements through it. +or array elements through it @end ignore @end itemize @@ -35461,7 +35461,7 @@ Additional predefined variables: @itemize @value{MINUS} @item The -@code{ARGIND} +@code{ARGIND}, @code{BINMODE}, @code{ERRNO}, @code{FIELDWIDTHS}, @@ -35473,7 +35473,7 @@ The and @code{TEXTDOMAIN} variables -(@pxref{Built-in Variables}). +(@pxref{Built-in Variables}) @end itemize @item @@ -35481,15 +35481,15 @@ Special files in I/O redirections: @itemize @value{MINUS} @item -The @file{/dev/stdin}, @file{/dev/stdout}, @file{/dev/stderr} and +The @file{/dev/stdin}, @file{/dev/stdout}, @file{/dev/stderr}, and @file{/dev/fd/@var{N}} special @value{FN}s -(@pxref{Special Files}). +(@pxref{Special Files}) @item The @file{/inet}, @file{/inet4}, and @samp{/inet6} special files for TCP/IP networking using @samp{|&} to specify which version of the IP protocol to use -(@pxref{TCP/IP Networking}). +(@pxref{TCP/IP Networking}) @end itemize @item @@ -35498,37 +35498,37 @@ Changes and/or additions to the language: @itemize @value{MINUS} @item The @samp{\x} escape sequence -(@pxref{Escape Sequences}). +(@pxref{Escape Sequences}) @item Full support for both POSIX and GNU regexps -(@pxref{Regexp}). +(@pxref{Regexp}) @item The ability for @code{FS} and for the third argument to @code{split()} to be null strings -(@pxref{Single Character Fields}). +(@pxref{Single Character Fields}) @item The ability for @code{RS} to be a regexp -(@pxref{Records}). +(@pxref{Records}) @item The ability to use octal and hexadecimal constants in @command{awk} program source code -(@pxref{Nondecimal-numbers}). +(@pxref{Nondecimal-numbers}) @item The @samp{|&} operator for two-way I/O to a coprocess -(@pxref{Two-way I/O}). +(@pxref{Two-way I/O}) @item Indirect function calls -(@pxref{Indirect Calls}). +(@pxref{Indirect Calls}) @item Directories on the command line produce a warning and are skipped -(@pxref{Command-line directories}). +(@pxref{Command-line directories}) @end itemize @item @@ -35537,11 +35537,11 @@ New keywords: @itemize @value{MINUS} @item The @code{BEGINFILE} and @code{ENDFILE} special patterns -(@pxref{BEGINFILE/ENDFILE}). +(@pxref{BEGINFILE/ENDFILE}) @item The @code{switch} statement -(@pxref{Switch Statement}). +(@pxref{Switch Statement}) @end itemize @item @@ -35551,30 +35551,30 @@ Changes to standard @command{awk} functions: @item The optional second argument to @code{close()} that allows closing one end of a two-way pipe to a coprocess -(@pxref{Two-way I/O}). +(@pxref{Two-way I/O}) @item -POSIX compliance for @code{gsub()} and @code{sub()} with @option{--posix}. +POSIX compliance for @code{gsub()} and @code{sub()} with @option{--posix} @item The @code{length()} function accepts an array argument and returns the number of elements in the array -(@pxref{String Functions}). +(@pxref{String Functions}) @item The optional third argument to the @code{match()} function for capturing text-matching subexpressions within a regexp -(@pxref{String Functions}). +(@pxref{String Functions}) @item Positional specifiers in @code{printf} formats for making translations easier -(@pxref{Printf Ordering}). +(@pxref{Printf Ordering}) @item The @code{split()} function's additional optional fourth -argument which is an array to hold the text of the field separators -(@pxref{String Functions}). +argument, which is an array to hold the text of the field separators +(@pxref{String Functions}) @end itemize @item @@ -35584,16 +35584,16 @@ Additional functions only in @command{gawk}: @item The @code{gensub()}, @code{patsplit()}, and @code{strtonum()} functions for more powerful text manipulation -(@pxref{String Functions}). +(@pxref{String Functions}) @item The @code{asort()} and @code{asorti()} functions for sorting arrays -(@pxref{Array Sorting}). +(@pxref{Array Sorting}) @item The @code{mktime()}, @code{systime()}, and @code{strftime()} functions for working with timestamps -(@pxref{Time Functions}). +(@pxref{Time Functions}) @item The @@ -35605,17 +35605,17 @@ The and @code{xor()} functions for bit manipulation -(@pxref{Bitwise Functions}). +(@pxref{Bitwise Functions}) @c In 4.1, and(), or() and xor() grew the ability to take > 2 arguments @item The @code{isarray()} function to check if a variable is an array or not -(@pxref{Type Functions}). +(@pxref{Type Functions}) @item -The @code{bindtextdomain()}, @code{dcgettext()} and @code{dcngettext()} +The @code{bindtextdomain()}, @code{dcgettext()}, and @code{dcngettext()} functions for internationalization -(@pxref{Programmer i18n}). +(@pxref{Programmer i18n}) @end itemize @item @@ -35625,12 +35625,12 @@ Changes and/or additions in the command-line options: @item The @env{AWKPATH} environment variable for specifying a path search for the @option{-f} command-line option -(@pxref{Options}). +(@pxref{Options}) @item The @env{AWKLIBPATH} environment variable for specifying a path search for the @option{-l} command-line option -(@pxref{Options}). +(@pxref{Options}) @item The @@ -35659,7 +35659,7 @@ The and @option{-V} short options. Also, the -ability to use GNU-style long-named options that start with @option{--} +ability to use GNU-style long-named options that start with @option{--}, and the @option{--assign}, @option{--bignum}, @@ -35739,7 +35739,7 @@ GCC for VAX and Alpha has not been tested for a while. @end itemize @item -Support for the following obsolete systems was removed from the code +Support for the following obsolete system was removed from the code for @command{gawk} @value{PVERSION} 4.1: @c nested table @@ -36375,9 +36375,9 @@ by @command{gawk}, Brian Kernighan's @command{awk}, and @command{mawk}, the three most widely used freely available versions of @command{awk} (@pxref{Other Versions}). -@multitable {@file{/dev/stderr} special file} {BWK Awk} {Mawk} {GNU Awk} {Now standard} -@headitem Feature @tab BWK Awk @tab Mawk @tab GNU Awk @tab Now standard -@item @samp{\x} Escape sequence @tab X @tab X @tab X @tab +@multitable {@file{/dev/stderr} special file} {BWK @command{awk}} {@command{mawk}} {@command{gawk}} {Now standard} +@headitem Feature @tab BWK @command{awk} @tab @command{mawk} @tab @command{gawk} @tab Now standard +@item @samp{\x} escape sequence @tab X @tab X @tab X @tab @item @code{FS} as null string @tab X @tab X @tab X @tab @item @file{/dev/stdin} special file @tab X @tab X @tab X @tab @item @file{/dev/stdout} special file @tab X @tab X @tab X @tab @@ -36408,7 +36408,7 @@ in the machine's native character set. Thus, on ASCII-based systems, @samp{[a-z]} matched all the lowercase letters, and only the lowercase letters, as the numeric values for the letters from @samp{a} through @samp{z} were contiguous. (On an EBCDIC system, the range @samp{[a-z]} -includes additional, non-alphabetic characters as well.) +includes additional nonalphabetic characters as well.) Almost all introductory Unix literature explained range expressions as working in this fashion, and in particular, would teach that the @@ -36433,7 +36433,7 @@ What does that mean? In many locales, @samp{A} and @samp{a} are both less than @samp{B}. In other words, these locales sort characters in dictionary order, and @samp{[a-dx-z]} is typically not equivalent to @samp{[abcdxyz]}; -instead it might be equivalent to @samp{[ABCXYabcdxyz]}, for example. +instead, it might be equivalent to @samp{[ABCXYabcdxyz]}, for example. This point needs to be emphasized: much literature teaches that you should use @samp{[a-z]} to match a lowercase character. But on systems with @@ -36462,23 +36462,23 @@ is perfectly valid in ASCII, but is not valid in many Unicode locales, such as @code{en_US.UTF-8}. Early versions of @command{gawk} used regexp matching code that was not -locale aware, so ranges had their traditional interpretation. +locale-aware, so ranges had their traditional interpretation. When @command{gawk} switched to using locale-aware regexp matchers, the problems began; especially as both GNU/Linux and commercial Unix vendors started implementing non-ASCII locales, @emph{and making them the default}. Perhaps the most frequently asked question became something -like ``why does @samp{[A-Z]} match lowercase letters?!?'' +like, ``Why does @samp{[A-Z]} match lowercase letters?!?'' @cindex Berry, Karl This situation existed for close to 10 years, if not more, and the @command{gawk} maintainer grew weary of trying to explain that -@command{gawk} was being nicely standards compliant, and that the issue +@command{gawk} was being nicely standards-compliant, and that the issue was in the user's locale. During the development of @value{PVERSION} 4.0, he modified @command{gawk} to always treat ranges in the original, pre-POSIX fashion, unless @option{--posix} was used (@pxref{Options}).@footnote{And thus was born the Campaign for Rational Range Interpretation (or -RRI). A number of GNU tools have either implemented this change, +RRI). A number of GNU tools have already implemented this change, or will soon. Thanks to Karl Berry for coining the phrase ``Rational Range Interpretation.''} @@ -36492,9 +36492,10 @@ and By using this lovely technical term, the standard gives license to implementors to implement ranges in whatever way they choose. -The @command{gawk} maintainer chose to apply the pre-POSIX meaning in all -cases: the default regexp matching; with @option{--traditional} and with -@option{--posix}; in all cases, @command{gawk} remains POSIX compliant. +The @command{gawk} maintainer chose to apply the pre-POSIX meaning +both with the default regexp matching and when @option{--traditional} or +@option{--posix} are used. +In all cases @command{gawk} remains POSIX-compliant. @node Contributors @appendixsec Major Contributors to @command{gawk} @@ -36540,7 +36541,7 @@ to around 90 pages. Richard Stallman helped finish the implementation and the initial draft of this @value{DOCUMENT}. -He is also the founder of the FSF and the GNU project. +He is also the founder of the FSF and the GNU Project. @item @cindex Woods, John @@ -36704,28 +36705,28 @@ John Haque made the following contributions: @itemize @value{MINUS} @item The modifications to convert @command{gawk} -into a byte-code interpreter, including the debugger. +into a byte-code interpreter, including the debugger @item -The addition of true arrays of arrays. +The addition of true arrays of arrays @item -The additional modifications for support of arbitrary-precision arithmetic. +The additional modifications for support of arbitrary-precision arithmetic @item The initial text of -@ref{Arbitrary Precision Arithmetic}. +@ref{Arbitrary Precision Arithmetic} @item The work to merge the three versions of @command{gawk} -into one, for the 4.1 release. +into one, for the 4.1 release @item -Improved array internals for arrays indexed by integers. +Improved array internals for arrays indexed by integers @item -The improved array sorting features were driven by John together -with Pat Rankin. +The improved array sorting features were also driven by John, together +with Pat Rankin @end itemize @cindex Papadopoulos, Panos @@ -36766,10 +36767,10 @@ helping David Trueman, and as the primary maintainer since around 1994. @itemize @value{BULLET} @item The @command{awk} language has evolved over time. The first release -was with V7 Unix circa 1978. In 1987, for System V Release 3.1, +was with V7 Unix, circa 1978. In 1987, for System V Release 3.1, major additions, including user-defined functions, were made to the language. Additional changes were made for System V Release 4, in 1989. -Since then, further minor changes happen under the auspices of the +Since then, further minor changes have happened under the auspices of the POSIX standard. @item @@ -36785,7 +36786,7 @@ options. The interaction of POSIX locales and regexp matching in @command{gawk} has been confusing over the years. Today, @command{gawk} implements Rational Range Interpretation, where ranges of the form @samp{[a-z]} match @emph{only} the characters numerically between -@samp{a} through @samp{z} in the machine's native character set. Usually this is ASCII +@samp{a} through @samp{z} in the machine's native character set. Usually this is ASCII, but it can be EBCDIC on IBM S/390 systems. @item @@ -36870,7 +36871,7 @@ will be less busy, and you can usually find one closer to your site. @command{gawk} is distributed as several @code{tar} files compressed with different compression programs: @command{gzip}, @command{bzip2}, and @command{xz}. For simplicity, the rest of these instructions assume -you are using the one compressed with the GNU Zip program, @code{gzip}. +you are using the one compressed with the GNU Gzip program (@command{gzip}). Once you have the distribution (e.g., @file{gawk-@value{VERSION}.@value{PATCHLEVEL}.tar.gz}), @@ -36921,12 +36922,12 @@ operating systems: @table @asis @item Various @samp{.c}, @samp{.y}, and @samp{.h} files -The actual @command{gawk} source code. +These files contain the actual @command{gawk} source code. @end table @table @file @item ABOUT-NLS -Information about GNU @command{gettext} and translations. +A file containing information about GNU @command{gettext} and translations. @item AUTHORS A file with some information about the authorship of @command{gawk}. @@ -36956,7 +36957,7 @@ An older list of changes to @command{gawk}. The GNU General Public License. @item POSIX.STD -A description of behaviors in the POSIX standard for @command{awk} which +A description of behaviors in the POSIX standard for @command{awk} that are left undefined, or where @command{gawk} may not comply fully, as well as a list of things that the POSIX standard should describe but does not. @@ -37221,14 +37222,17 @@ Similarly, setting the @code{LINT} variable (@pxref{User-modified}) has no effect on the running @command{awk} program. -When used with GCC's automatic dead-code-elimination, this option +When used with the GNU Compiler Collection's (GCC's) +automatic dead-code-elimination, this option cuts almost 23K bytes off the size of the @command{gawk} executable on GNU/Linux x86_64 systems. Results on other systems and with other compilers are likely to vary. Using this option may bring you some slight performance improvement. +@quotation CAUTION Using this option will cause some of the tests in the test suite to fail. This option may be removed at a later date. +@end quotation @cindex @option{--disable-nls} configuration option @cindex configuration option, @code{--disable-nls} @@ -37325,10 +37329,10 @@ running MS-DOS, any version of MS-Windows, or OS/2. running MS-DOS and any version of MS-Windows. @end ifset In this @value{SECTION}, the term ``Windows32'' -refers to any of Microsoft Windows-95/98/ME/NT/2000/XP/Vista/7/8. +refers to any of Microsoft Windows 95/98/ME/NT/2000/XP/Vista/7/8. The limitations of MS-DOS (and MS-DOS shells under the other operating -systems) has meant that various ``DOS extenders'' are often used with +systems) have meant that various ``DOS extenders'' are often used with programs such as @command{gawk}. The varying capabilities of Microsoft Windows 3.1 and Windows32 can add to the confusion. For an overview of the considerations, refer to @file{README_d/README.pc} in @@ -37587,7 +37591,7 @@ Under MS-Windows, OS/2 and MS-DOS, Under MS-Windows and MS-DOS, @end ifset @command{gawk} (and many other text programs) silently -translate end-of-line @samp{\r\n} to @samp{\n} on input and @samp{\n} +translates end-of-line @samp{\r\n} to @samp{\n} on input and @samp{\n} to @samp{\r\n} on output. A special @code{BINMODE} variable @value{COMMONEXT} allows control over these translations and is interpreted as follows: @@ -37621,7 +37625,7 @@ Setting @code{BINMODE} for standard input or standard output is accomplished by using an appropriate @samp{-v BINMODE=@var{N}} option on the command line. @code{BINMODE} is set at the time a file or pipe is opened and cannot be -changed mid-stream. +changed midstream. The name @code{BINMODE} was chosen to match @command{mawk} (@pxref{Other Versions}). @@ -37677,8 +37681,8 @@ moved into the @code{BEGIN} rule. @command{gawk} can be built and used ``out of the box'' under MS-Windows if you are using the @uref{http://www.cygwin.com, Cygwin environment}. -This environment provides an excellent simulation of GNU/Linux, using the -GNU tools, such as Bash, the GNU Compiler Collection (GCC), GNU Make, +This environment provides an excellent simulation of GNU/Linux, using +Bash, GCC, GNU Make, and other GNU programs. Compilation and installation for Cygwin is the same as for a Unix system: @@ -37697,7 +37701,7 @@ and then the @samp{make} proceeds as usual. @appendixsubsubsec Using @command{gawk} In The MSYS Environment In the MSYS environment under MS-Windows, @command{gawk} automatically -uses binary mode for reading and writing files. Thus there is no +uses binary mode for reading and writing files. Thus, there is no need to use the @code{BINMODE} variable. This can cause problems with other Unix-like components that have @@ -37761,7 +37765,7 @@ With ODS-5 volumes and extended parsing enabled, the case of the target parameter may need to be exact. @command{gawk} has been tested under VAX/VMS 7.3 and Alpha/VMS 7.3-1 -using Compaq C V6.4, and Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS 8.3. +using Compaq C V6.4, and under Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS 8.3. The most recent builds used HP C V7.3 on Alpha VMS 8.3 and both Alpha and IA64 VMS 8.4 used HP C 7.3.@footnote{The IA64 architecture is also known as ``Itanium.''} @@ -37809,7 +37813,7 @@ For VAX: /name=(as_is,short) @end example -Compile time macros need to be defined before the first VMS-supplied +Compile-time macros need to be defined before the first VMS-supplied header file is included, as follows: @example @@ -37856,7 +37860,7 @@ If your @command{gawk} was installed by a PCSI kit into the @file{GNV$GNU:[vms_help]gawk.hlp}. The PCSI kit also installs a @file{GNV$GNU:[vms_bin]gawk_verb.cld} file -which can be used to add @command{gawk} and @command{awk} as DCL commands. +that can be used to add @command{gawk} and @command{awk} as DCL commands. For just the current process you can use: @@ -37865,7 +37869,7 @@ $ @kbd{set command gnv$gnu:[vms_bin]gawk_verb.cld} @end example Or the system manager can use @file{GNV$GNU:[vms_bin]gawk_verb.cld} to -add the @command{gawk} and @command{awk} to the system wide @samp{DCLTABLES}. +add the @command{gawk} and @command{awk} to the system-wide @samp{DCLTABLES}. The DCL syntax is documented in the @file{gawk.hlp} file. @@ -37931,14 +37935,14 @@ The @code{exit} value is a Unix-style value and is encoded into a VMS exit status value when the program exits. The VMS severity bits will be set based on the @code{exit} value. -A failure is indicated by 1 and VMS sets the @code{ERROR} status. -A fatal error is indicated by 2 and VMS sets the @code{FATAL} status. +A failure is indicated by 1, and VMS sets the @code{ERROR} status. +A fatal error is indicated by 2, and VMS sets the @code{FATAL} status. All other values will have the @code{SUCCESS} status. The exit value is encoded to comply with VMS coding standards and will have the @code{C_FACILITY_NO} of @code{0x350000} with the constant @code{0xA000} added to the number shifted over by 3 bits to make room for the severity codes. -To extract the actual @command{gawk} exit code from the VMS status use: +To extract the actual @command{gawk} exit code from the VMS status, use: @example unix_status = (vms_status .and. &x7f8) / 8 @@ -37957,7 +37961,7 @@ VAX/VMS floating point uses unbiased rounding. @xref{Round Function}. VMS reports time values in GMT unless one of the @code{SYS$TIMEZONE_RULE} or @code{TZ} logical names is set. Older versions of VMS, such as VAX/VMS -7.3 do not set these logical names. +7.3, do not set these logical names. @c @cindex directory search @c @cindex path, search @@ -37975,7 +37979,7 @@ translation and not a multitranslation @code{RMS} searchlist. The VMS GNV package provides a build environment similar to POSIX with ports of a collection of open source tools. The @command{gawk} found in the GNV -base kit is an older port. Currently the GNV project is being reorganized +base kit is an older port. Currently, the GNV project is being reorganized to supply individual PCSI packages for each component. See @w{@uref{https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/}.} @@ -38048,7 +38052,7 @@ recommend compiling and using the current version. @cindex debugging @command{gawk}, bug reports @cindex troubleshooting, @command{gawk}, bug reports If you have problems with @command{gawk} or think that you have found a bug, -report it to the developers; we cannot promise to do anything +report it to the developers; we cannot promise to do anything, but we might well want to fix it. Before reporting a bug, make sure you have really found a genuine bug. @@ -38058,7 +38062,7 @@ to do something or not, report that too; it's a bug in the documentation! Before reporting a bug or trying to fix it yourself, try to isolate it to the smallest possible @command{awk} program and input @value{DF} that -reproduces the problem. Then send us the program and @value{DF}, +reproduce the problem. Then send us the program and @value{DF}, some idea of what kind of Unix system you're using, the compiler you used to compile @command{gawk}, and the exact results @command{gawk} gave you. Also say what you expected to occur; this helps @@ -38073,7 +38077,7 @@ You can get this information with the command @samp{gawk --version}. Once you have a precise problem description, send email to @EMAIL{bug-gawk@@gnu.org,bug-gawk at gnu dot org}. -The @command{gawk} maintainers subscribe to this address and +The @command{gawk} maintainers subscribe to this address, and thus they will receive your bug report. Although you can send mail to the maintainers directly, the bug reporting address is preferred because the @@ -38100,8 +38104,8 @@ bug reporting system, you should also send a copy to This is for two reasons. First, although some distributions forward bug reports ``upstream'' to the GNU mailing list, many don't, so there is a good chance that the @command{gawk} maintainers won't even see the bug report! Second, -mail to the GNU list is archived, and having everything at the GNU project -keeps things self-contained and not dependant on other organizations. +mail to the GNU list is archived, and having everything at the GNU Project +keeps things self-contained and not dependent on other organizations. @end quotation Non-bug suggestions are always welcome as well. If you have questions @@ -38110,7 +38114,7 @@ features, ask on the bug list; we will try to help you out if we can. If you find bugs in one of the non-Unix ports of @command{gawk}, send an email to the bug list, with a copy to the -person who maintains that port. They are named in the following list, +person who maintains that port. The maintainers are named in the following list, as well as in the @file{README} file in the @command{gawk} distribution. Information in the @file{README} file should be considered authoritative if it conflicts with this @value{DOCUMENT}. @@ -38125,19 +38129,19 @@ The people maintaining the various @command{gawk} ports are: @cindex Robbins, Arnold @cindex Zaretskii, Eli @multitable {MS-Windows with MinGW} {123456789012345678901234567890123456789001234567890} -@item Unix and POSIX systems @tab Arnold Robbins, @EMAIL{arnold@@skeeve.com,arnold at skeeve dot com}. +@item Unix and POSIX systems @tab Arnold Robbins, @EMAIL{arnold@@skeeve.com,arnold at skeeve dot com} -@item MS-DOS with DJGPP @tab Scott Deifik, @EMAIL{scottd.mail@@sbcglobal.net,scottd dot mail at sbcglobal dot net}. +@item MS-DOS with DJGPP @tab Scott Deifik, @EMAIL{scottd.mail@@sbcglobal.net,scottd dot mail at sbcglobal dot net} -@item MS-Windows with MinGW @tab Eli Zaretskii, @EMAIL{eliz@@gnu.org,eliz at gnu dot org}. +@item MS-Windows with MinGW @tab Eli Zaretskii, @EMAIL{eliz@@gnu.org,eliz at gnu dot org} @c Leave this in the print version on purpose. @c OS/2 is not mentioned anywhere else in the print version though. -@item OS/2 @tab Andreas Buening, @EMAIL{andreas.buening@@nexgo.de,andreas dot buening at nexgo dot de}. +@item OS/2 @tab Andreas Buening, @EMAIL{andreas.buening@@nexgo.de,andreas dot buening at nexgo dot de} -@item VMS @tab John Malmberg, @EMAIL{wb8tyw@@qsl.net,wb8tyw at qsl.net}. +@item VMS @tab John Malmberg, @EMAIL{wb8tyw@@qsl.net,wb8tyw at qsl.net} -@item z/OS (OS/390) @tab Dave Pitts, @EMAIL{dpitts@@cozx.com,dpitts at cozx dot com}. +@item z/OS (OS/390) @tab Dave Pitts, @EMAIL{dpitts@@cozx.com,dpitts at cozx dot com} @end multitable If your bug is also reproducible under Unix, send a copy of your @@ -38156,7 +38160,7 @@ Date: Wed, 4 Sep 1996 08:11:48 -0700 (PDT) @cindex Brennan, Michael @ifnotdocbook @quotation -@i{It's kind of fun to put comments like this in your awk code.}@* +@i{It's kind of fun to put comments like this in your awk code:}@* @ @ @ @ @ @ @code{// Do C++ comments work? answer: yes! of course} @author Michael Brennan @end quotation @@ -38197,7 +38201,7 @@ It is available in several archive formats: @end table @cindex @command{git} utility -You can also retrieve it from Git Hub: +You can also retrieve it from GitHub: @example git clone git://github.com/onetrueawk/awk bwkawk @@ -38257,7 +38261,7 @@ for a list of extensions in @command{mawk} that are not in POSIX @command{awk}. @item @command{awka} Written by Andrew Sumner, @command{awka} translates @command{awk} programs into C, compiles them, -and links them with a library of functions that provides the core +and links them with a library of functions that provide the core @command{awk} functionality. It also has a number of extensions. @@ -38278,17 +38282,17 @@ since approximately 2001. Nelson H.F.@: Beebe at the University of Utah has modified BWK @command{awk} to provide timing and profiling information. It is different from @command{gawk} with the @option{--profile} option -(@pxref{Profiling}), +(@pxref{Profiling}) in that it uses CPU-based profiling, not line-count profiling. You may find it at either @uref{ftp://ftp.math.utah.edu/pub/pawk/pawk-20030606.tar.gz} or @uref{http://www.math.utah.edu/pub/pawk/pawk-20030606.tar.gz}. -@item Busybox Awk -@cindex Busybox Awk -@cindex source code, Busybox Awk -Busybox is a GPL-licensed program providing small versions of many +@item BusyBox @command{awk} +@cindex BusyBox Awk +@cindex source code, BusyBox Awk +BusyBox is a GPL-licensed program providing small versions of many applications within a single executable. It is aimed at embedded systems. It includes a full implementation of POSIX @command{awk}. When building it, be careful not to do @samp{make install} as it will overwrite @@ -38300,7 +38304,7 @@ information, see the @uref{http://busybox.net, project's home page}. @cindex source code, Solaris @command{awk} @item The OpenSolaris POSIX @command{awk} The versions of @command{awk} in @file{/usr/xpg4/bin} and -@file{/usr/xpg6/bin} on Solaris are more-or-less POSIX-compliant. +@file{/usr/xpg6/bin} on Solaris are more or less POSIX-compliant. They are based on the @command{awk} from Mortice Kern Systems for PCs. We were able to make this code compile and work under GNU/Linux with 1--2 hours of work. Making it more generally portable (using @@ -38341,9 +38345,9 @@ features to Python. See @uref{https://github.com/alecthomas/pawk} for more information. (This is not related to Nelson Beebe's modified version of BWK @command{awk}, described earlier.) -@item @w{QSE Awk} -@cindex QSE Awk -@cindex source code, QSE Awk +@item @w{QSE @command{awk}} +@cindex QSE @command{awk} +@cindex source code, QSE @command{awk} This is an embeddable @command{awk} interpreter. For more information, see @uref{http://code.google.com/p/qse/} and @uref{http://awk.info/?tools/qse}. @@ -38362,7 +38366,7 @@ since approximately 2008. @item Other versions See also the ``Versions and implementations'' section of the @uref{http://en.wikipedia.org/wiki/Awk_language#Versions_and_implementations, -Wikipedia article} for information on additional versions. +Wikipedia article} on @command{awk} for information on additional versions. @end table @@ -38371,7 +38375,7 @@ Wikipedia article} for information on additional versions. @itemize @value{BULLET} @item -The @command{gawk} distribution is available from GNU project's main +The @command{gawk} distribution is available from the GNU Project's main distribution site, @code{ftp.gnu.org}. The canonical build recipe is: @example @@ -38383,22 +38387,22 @@ cd gawk-@value{VERSION}.@value{PATCHLEVEL} @item @command{gawk} may be built on non-POSIX systems as well. The currently -supported systems are MS-Windows using DJGPP, MSYS, MinGW and Cygwin, +supported systems are MS-Windows using DJGPP, MSYS, MinGW, and Cygwin, @ifclear FOR_PRINT OS/2 using EMX, @end ifclear and both Vax/VMS and OpenVMS. -Instructions for each system are included in this @value{CHAPTER}. +Instructions for each system are included in this @value{APPENDIX}. @item Bug reports should be sent via email to @email{bug-gawk@@gnu.org}. -Bug reports should be in English, and should include the version of @command{gawk}, -how it was compiled, and a short program and @value{DF} which demonstrate +Bug reports should be in English and should include the version of @command{gawk}, +how it was compiled, and a short program and @value{DF} that demonstrate the problem. @item There are a number of other freely available @command{awk} -implementations. Many are POSIX compliant; others are less so. +implementations. Many are POSIX-compliant; others are less so. @end itemize diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 16847eb2..724a559a 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -34297,81 +34297,81 @@ cross-references to further details: @itemize @value{BULLET} @item The requirement for @samp{;} to separate rules on a line -(@pxref{Statements/Lines}). +(@pxref{Statements/Lines}) @item User-defined functions and the @code{return} statement -(@pxref{User-defined}). +(@pxref{User-defined}) @item The @code{delete} statement (@pxref{Delete}). @item The @code{do}-@code{while} statement -(@pxref{Do Statement}). +(@pxref{Do Statement}) @item The built-in functions @code{atan2()}, @code{cos()}, @code{sin()}, @code{rand()}, and -@code{srand()} (@pxref{Numeric Functions}). +@code{srand()} (@pxref{Numeric Functions}) @item The built-in functions @code{gsub()}, @code{sub()}, and @code{match()} -(@pxref{String Functions}). +(@pxref{String Functions}) @item The built-in functions @code{close()} and @code{system()} -(@pxref{I/O Functions}). +(@pxref{I/O Functions}) @item The @code{ARGC}, @code{ARGV}, @code{FNR}, @code{RLENGTH}, @code{RSTART}, -and @code{SUBSEP} predefined variables (@pxref{Built-in Variables}). +and @code{SUBSEP} predefined variables (@pxref{Built-in Variables}) @item -Assignable @code{$0} (@pxref{Changing Fields}). +Assignable @code{$0} (@pxref{Changing Fields}) @item The conditional expression using the ternary operator @samp{?:} -(@pxref{Conditional Exp}). +(@pxref{Conditional Exp}) @item -The expression @samp{@var{index-variable} in @var{array}} outside of @code{for} -statements (@pxref{Reference to Elements}). +The expression @samp{@var{indx} in @var{array}} outside of @code{for} +statements (@pxref{Reference to Elements}) @item The exponentiation operator @samp{^} (@pxref{Arithmetic Ops}) and its assignment operator -form @samp{^=} (@pxref{Assignment Ops}). +form @samp{^=} (@pxref{Assignment Ops}) @item C-compatible operator precedence, which breaks some old @command{awk} -programs (@pxref{Precedence}). +programs (@pxref{Precedence}) @item Regexps as the value of @code{FS} (@pxref{Field Separators}) and as the third argument to the @code{split()} function (@pxref{String Functions}), rather than using only the first character -of @code{FS}. +of @code{FS} @item Dynamic regexps as operands of the @samp{~} and @samp{!~} operators -(@pxref{Computed Regexps}). +(@pxref{Computed Regexps}) @item The escape sequences @samp{\b}, @samp{\f}, and @samp{\r} -(@pxref{Escape Sequences}). +(@pxref{Escape Sequences}) @item Redirection of input for the @code{getline} function -(@pxref{Getline}). +(@pxref{Getline}) @item Multiple @code{BEGIN} and @code{END} rules -(@pxref{BEGIN/END}). +(@pxref{BEGIN/END}) @item Multidimensional arrays -(@pxref{Multidimensional}). +(@pxref{Multidimensional}) @end itemize @node SVR4 @@ -34383,54 +34383,54 @@ The System V Release 4 (1989) version of Unix @command{awk} added these features @itemize @value{BULLET} @item -The @code{ENVIRON} array (@pxref{Built-in Variables}). +The @code{ENVIRON} array (@pxref{Built-in Variables}) @c gawk and MKS awk @item Multiple @option{-f} options on the command line -(@pxref{Options}). +(@pxref{Options}) @c MKS awk @item The @option{-v} option for assigning variables before program execution begins -(@pxref{Options}). +(@pxref{Options}) @c GNU, Bell Laboratories & MKS together @item -The @option{--} signal for terminating command-line options. +The @option{--} signal for terminating command-line options @item The @samp{\a}, @samp{\v}, and @samp{\x} escape sequences -(@pxref{Escape Sequences}). +(@pxref{Escape Sequences}) @c GNU, for ANSI C compat @item A defined return value for the @code{srand()} built-in function -(@pxref{Numeric Functions}). +(@pxref{Numeric Functions}) @item The @code{toupper()} and @code{tolower()} built-in string functions for case translation -(@pxref{String Functions}). +(@pxref{String Functions}) @item A cleaner specification for the @samp{%c} format-control letter in the @code{printf} function -(@pxref{Control Letters}). +(@pxref{Control Letters}) @item The ability to dynamically pass the field width and precision (@code{"%*.*d"}) in the argument list of @code{printf} and @code{sprintf()} -(@pxref{Control Letters}). +(@pxref{Control Letters}) @item The use of regexp constants, such as @code{/foo/}, as expressions, where they are equivalent to using the matching operator, as in @samp{$0 ~ /foo/} -(@pxref{Using Constant Regexps}). +(@pxref{Using Constant Regexps}) @item Processing of escape sequences inside command-line variable assignments -(@pxref{Assignment Options}). +(@pxref{Assignment Options}) @end itemize @node POSIX @@ -34444,23 +34444,23 @@ introduced the following changes into the language: @itemize @value{BULLET} @item The use of @option{-W} for implementation-specific options -(@pxref{Options}). +(@pxref{Options}) @item The use of @code{CONVFMT} for controlling the conversion of numbers -to strings (@pxref{Conversion}). +to strings (@pxref{Conversion}) @item The concept of a numeric string and tighter comparison rules to go -with it (@pxref{Typing and Comparison}). +with it (@pxref{Typing and Comparison}) @item The use of predefined variables as function parameter names is forbidden -(@pxref{Definition Syntax}). +(@pxref{Definition Syntax}) @item More complete documentation of many of the previously undocumented -features of the language. +features of the language @end itemize In 2012, a number of extensions that had been commonly available for @@ -34469,15 +34469,15 @@ many years were finally added to POSIX. They are: @itemize @value{BULLET} @item The @code{fflush()} built-in function for flushing buffered output -(@pxref{I/O Functions}). +(@pxref{I/O Functions}) @item The @code{nextfile} statement -(@pxref{Nextfile Statement}). +(@pxref{Nextfile Statement}) @item The ability to delete all of an array at once with @samp{delete @var{array}} -(@pxref{Delete}). +(@pxref{Delete}) @end itemize @@ -34507,22 +34507,22 @@ originally appeared in his version of @command{awk}: The @samp{**} and @samp{**=} operators (@pxref{Arithmetic Ops} and -@ref{Assignment Ops}). +@ref{Assignment Ops}) @item The use of @code{func} as an abbreviation for @code{function} -(@pxref{Definition Syntax}). +(@pxref{Definition Syntax}) @item The @code{fflush()} built-in function for flushing buffered output -(@pxref{I/O Functions}). +(@pxref{I/O Functions}) @ignore @item The @code{SYMTAB} array, that allows access to @command{awk}'s internal symbol table. This feature was never documented for his @command{awk}, largely because it is somewhat shakily implemented. For instance, you cannot access arrays -or array elements through it. +or array elements through it @end ignore @end itemize @@ -34552,7 +34552,7 @@ Additional predefined variables: @itemize @value{MINUS} @item The -@code{ARGIND} +@code{ARGIND}, @code{BINMODE}, @code{ERRNO}, @code{FIELDWIDTHS}, @@ -34564,7 +34564,7 @@ The and @code{TEXTDOMAIN} variables -(@pxref{Built-in Variables}). +(@pxref{Built-in Variables}) @end itemize @item @@ -34572,15 +34572,15 @@ Special files in I/O redirections: @itemize @value{MINUS} @item -The @file{/dev/stdin}, @file{/dev/stdout}, @file{/dev/stderr} and +The @file{/dev/stdin}, @file{/dev/stdout}, @file{/dev/stderr}, and @file{/dev/fd/@var{N}} special @value{FN}s -(@pxref{Special Files}). +(@pxref{Special Files}) @item The @file{/inet}, @file{/inet4}, and @samp{/inet6} special files for TCP/IP networking using @samp{|&} to specify which version of the IP protocol to use -(@pxref{TCP/IP Networking}). +(@pxref{TCP/IP Networking}) @end itemize @item @@ -34589,37 +34589,37 @@ Changes and/or additions to the language: @itemize @value{MINUS} @item The @samp{\x} escape sequence -(@pxref{Escape Sequences}). +(@pxref{Escape Sequences}) @item Full support for both POSIX and GNU regexps -(@pxref{Regexp}). +(@pxref{Regexp}) @item The ability for @code{FS} and for the third argument to @code{split()} to be null strings -(@pxref{Single Character Fields}). +(@pxref{Single Character Fields}) @item The ability for @code{RS} to be a regexp -(@pxref{Records}). +(@pxref{Records}) @item The ability to use octal and hexadecimal constants in @command{awk} program source code -(@pxref{Nondecimal-numbers}). +(@pxref{Nondecimal-numbers}) @item The @samp{|&} operator for two-way I/O to a coprocess -(@pxref{Two-way I/O}). +(@pxref{Two-way I/O}) @item Indirect function calls -(@pxref{Indirect Calls}). +(@pxref{Indirect Calls}) @item Directories on the command line produce a warning and are skipped -(@pxref{Command-line directories}). +(@pxref{Command-line directories}) @end itemize @item @@ -34628,11 +34628,11 @@ New keywords: @itemize @value{MINUS} @item The @code{BEGINFILE} and @code{ENDFILE} special patterns -(@pxref{BEGINFILE/ENDFILE}). +(@pxref{BEGINFILE/ENDFILE}) @item The @code{switch} statement -(@pxref{Switch Statement}). +(@pxref{Switch Statement}) @end itemize @item @@ -34642,30 +34642,30 @@ Changes to standard @command{awk} functions: @item The optional second argument to @code{close()} that allows closing one end of a two-way pipe to a coprocess -(@pxref{Two-way I/O}). +(@pxref{Two-way I/O}) @item -POSIX compliance for @code{gsub()} and @code{sub()} with @option{--posix}. +POSIX compliance for @code{gsub()} and @code{sub()} with @option{--posix} @item The @code{length()} function accepts an array argument and returns the number of elements in the array -(@pxref{String Functions}). +(@pxref{String Functions}) @item The optional third argument to the @code{match()} function for capturing text-matching subexpressions within a regexp -(@pxref{String Functions}). +(@pxref{String Functions}) @item Positional specifiers in @code{printf} formats for making translations easier -(@pxref{Printf Ordering}). +(@pxref{Printf Ordering}) @item The @code{split()} function's additional optional fourth -argument which is an array to hold the text of the field separators -(@pxref{String Functions}). +argument, which is an array to hold the text of the field separators +(@pxref{String Functions}) @end itemize @item @@ -34675,16 +34675,16 @@ Additional functions only in @command{gawk}: @item The @code{gensub()}, @code{patsplit()}, and @code{strtonum()} functions for more powerful text manipulation -(@pxref{String Functions}). +(@pxref{String Functions}) @item The @code{asort()} and @code{asorti()} functions for sorting arrays -(@pxref{Array Sorting}). +(@pxref{Array Sorting}) @item The @code{mktime()}, @code{systime()}, and @code{strftime()} functions for working with timestamps -(@pxref{Time Functions}). +(@pxref{Time Functions}) @item The @@ -34696,17 +34696,17 @@ The and @code{xor()} functions for bit manipulation -(@pxref{Bitwise Functions}). +(@pxref{Bitwise Functions}) @c In 4.1, and(), or() and xor() grew the ability to take > 2 arguments @item The @code{isarray()} function to check if a variable is an array or not -(@pxref{Type Functions}). +(@pxref{Type Functions}) @item -The @code{bindtextdomain()}, @code{dcgettext()} and @code{dcngettext()} +The @code{bindtextdomain()}, @code{dcgettext()}, and @code{dcngettext()} functions for internationalization -(@pxref{Programmer i18n}). +(@pxref{Programmer i18n}) @end itemize @item @@ -34716,12 +34716,12 @@ Changes and/or additions in the command-line options: @item The @env{AWKPATH} environment variable for specifying a path search for the @option{-f} command-line option -(@pxref{Options}). +(@pxref{Options}) @item The @env{AWKLIBPATH} environment variable for specifying a path search for the @option{-l} command-line option -(@pxref{Options}). +(@pxref{Options}) @item The @@ -34750,7 +34750,7 @@ The and @option{-V} short options. Also, the -ability to use GNU-style long-named options that start with @option{--} +ability to use GNU-style long-named options that start with @option{--}, and the @option{--assign}, @option{--bignum}, @@ -34830,7 +34830,7 @@ GCC for VAX and Alpha has not been tested for a while. @end itemize @item -Support for the following obsolete systems was removed from the code +Support for the following obsolete system was removed from the code for @command{gawk} @value{PVERSION} 4.1: @c nested table @@ -35466,9 +35466,9 @@ by @command{gawk}, Brian Kernighan's @command{awk}, and @command{mawk}, the three most widely used freely available versions of @command{awk} (@pxref{Other Versions}). -@multitable {@file{/dev/stderr} special file} {BWK Awk} {Mawk} {GNU Awk} {Now standard} -@headitem Feature @tab BWK Awk @tab Mawk @tab GNU Awk @tab Now standard -@item @samp{\x} Escape sequence @tab X @tab X @tab X @tab +@multitable {@file{/dev/stderr} special file} {BWK @command{awk}} {@command{mawk}} {@command{gawk}} {Now standard} +@headitem Feature @tab BWK @command{awk} @tab @command{mawk} @tab @command{gawk} @tab Now standard +@item @samp{\x} escape sequence @tab X @tab X @tab X @tab @item @code{FS} as null string @tab X @tab X @tab X @tab @item @file{/dev/stdin} special file @tab X @tab X @tab X @tab @item @file{/dev/stdout} special file @tab X @tab X @tab X @tab @@ -35499,7 +35499,7 @@ in the machine's native character set. Thus, on ASCII-based systems, @samp{[a-z]} matched all the lowercase letters, and only the lowercase letters, as the numeric values for the letters from @samp{a} through @samp{z} were contiguous. (On an EBCDIC system, the range @samp{[a-z]} -includes additional, non-alphabetic characters as well.) +includes additional nonalphabetic characters as well.) Almost all introductory Unix literature explained range expressions as working in this fashion, and in particular, would teach that the @@ -35524,7 +35524,7 @@ What does that mean? In many locales, @samp{A} and @samp{a} are both less than @samp{B}. In other words, these locales sort characters in dictionary order, and @samp{[a-dx-z]} is typically not equivalent to @samp{[abcdxyz]}; -instead it might be equivalent to @samp{[ABCXYabcdxyz]}, for example. +instead, it might be equivalent to @samp{[ABCXYabcdxyz]}, for example. This point needs to be emphasized: much literature teaches that you should use @samp{[a-z]} to match a lowercase character. But on systems with @@ -35553,23 +35553,23 @@ is perfectly valid in ASCII, but is not valid in many Unicode locales, such as @code{en_US.UTF-8}. Early versions of @command{gawk} used regexp matching code that was not -locale aware, so ranges had their traditional interpretation. +locale-aware, so ranges had their traditional interpretation. When @command{gawk} switched to using locale-aware regexp matchers, the problems began; especially as both GNU/Linux and commercial Unix vendors started implementing non-ASCII locales, @emph{and making them the default}. Perhaps the most frequently asked question became something -like ``why does @samp{[A-Z]} match lowercase letters?!?'' +like, ``Why does @samp{[A-Z]} match lowercase letters?!?'' @cindex Berry, Karl This situation existed for close to 10 years, if not more, and the @command{gawk} maintainer grew weary of trying to explain that -@command{gawk} was being nicely standards compliant, and that the issue +@command{gawk} was being nicely standards-compliant, and that the issue was in the user's locale. During the development of @value{PVERSION} 4.0, he modified @command{gawk} to always treat ranges in the original, pre-POSIX fashion, unless @option{--posix} was used (@pxref{Options}).@footnote{And thus was born the Campaign for Rational Range Interpretation (or -RRI). A number of GNU tools have either implemented this change, +RRI). A number of GNU tools have already implemented this change, or will soon. Thanks to Karl Berry for coining the phrase ``Rational Range Interpretation.''} @@ -35583,9 +35583,10 @@ and By using this lovely technical term, the standard gives license to implementors to implement ranges in whatever way they choose. -The @command{gawk} maintainer chose to apply the pre-POSIX meaning in all -cases: the default regexp matching; with @option{--traditional} and with -@option{--posix}; in all cases, @command{gawk} remains POSIX compliant. +The @command{gawk} maintainer chose to apply the pre-POSIX meaning +both with the default regexp matching and when @option{--traditional} or +@option{--posix} are used. +In all cases @command{gawk} remains POSIX-compliant. @node Contributors @appendixsec Major Contributors to @command{gawk} @@ -35631,7 +35632,7 @@ to around 90 pages. Richard Stallman helped finish the implementation and the initial draft of this @value{DOCUMENT}. -He is also the founder of the FSF and the GNU project. +He is also the founder of the FSF and the GNU Project. @item @cindex Woods, John @@ -35795,28 +35796,28 @@ John Haque made the following contributions: @itemize @value{MINUS} @item The modifications to convert @command{gawk} -into a byte-code interpreter, including the debugger. +into a byte-code interpreter, including the debugger @item -The addition of true arrays of arrays. +The addition of true arrays of arrays @item -The additional modifications for support of arbitrary-precision arithmetic. +The additional modifications for support of arbitrary-precision arithmetic @item The initial text of -@ref{Arbitrary Precision Arithmetic}. +@ref{Arbitrary Precision Arithmetic} @item The work to merge the three versions of @command{gawk} -into one, for the 4.1 release. +into one, for the 4.1 release @item -Improved array internals for arrays indexed by integers. +Improved array internals for arrays indexed by integers @item -The improved array sorting features were driven by John together -with Pat Rankin. +The improved array sorting features were also driven by John, together +with Pat Rankin @end itemize @cindex Papadopoulos, Panos @@ -35857,10 +35858,10 @@ helping David Trueman, and as the primary maintainer since around 1994. @itemize @value{BULLET} @item The @command{awk} language has evolved over time. The first release -was with V7 Unix circa 1978. In 1987, for System V Release 3.1, +was with V7 Unix, circa 1978. In 1987, for System V Release 3.1, major additions, including user-defined functions, were made to the language. Additional changes were made for System V Release 4, in 1989. -Since then, further minor changes happen under the auspices of the +Since then, further minor changes have happened under the auspices of the POSIX standard. @item @@ -35876,7 +35877,7 @@ options. The interaction of POSIX locales and regexp matching in @command{gawk} has been confusing over the years. Today, @command{gawk} implements Rational Range Interpretation, where ranges of the form @samp{[a-z]} match @emph{only} the characters numerically between -@samp{a} through @samp{z} in the machine's native character set. Usually this is ASCII +@samp{a} through @samp{z} in the machine's native character set. Usually this is ASCII, but it can be EBCDIC on IBM S/390 systems. @item @@ -35961,7 +35962,7 @@ will be less busy, and you can usually find one closer to your site. @command{gawk} is distributed as several @code{tar} files compressed with different compression programs: @command{gzip}, @command{bzip2}, and @command{xz}. For simplicity, the rest of these instructions assume -you are using the one compressed with the GNU Zip program, @code{gzip}. +you are using the one compressed with the GNU Gzip program (@command{gzip}). Once you have the distribution (e.g., @file{gawk-@value{VERSION}.@value{PATCHLEVEL}.tar.gz}), @@ -36012,12 +36013,12 @@ operating systems: @table @asis @item Various @samp{.c}, @samp{.y}, and @samp{.h} files -The actual @command{gawk} source code. +These files contain the actual @command{gawk} source code. @end table @table @file @item ABOUT-NLS -Information about GNU @command{gettext} and translations. +A file containing information about GNU @command{gettext} and translations. @item AUTHORS A file with some information about the authorship of @command{gawk}. @@ -36047,7 +36048,7 @@ An older list of changes to @command{gawk}. The GNU General Public License. @item POSIX.STD -A description of behaviors in the POSIX standard for @command{awk} which +A description of behaviors in the POSIX standard for @command{awk} that are left undefined, or where @command{gawk} may not comply fully, as well as a list of things that the POSIX standard should describe but does not. @@ -36312,14 +36313,17 @@ Similarly, setting the @code{LINT} variable (@pxref{User-modified}) has no effect on the running @command{awk} program. -When used with GCC's automatic dead-code-elimination, this option +When used with the GNU Compiler Collection's (GCC's) +automatic dead-code-elimination, this option cuts almost 23K bytes off the size of the @command{gawk} executable on GNU/Linux x86_64 systems. Results on other systems and with other compilers are likely to vary. Using this option may bring you some slight performance improvement. +@quotation CAUTION Using this option will cause some of the tests in the test suite to fail. This option may be removed at a later date. +@end quotation @cindex @option{--disable-nls} configuration option @cindex configuration option, @code{--disable-nls} @@ -36416,10 +36420,10 @@ running MS-DOS, any version of MS-Windows, or OS/2. running MS-DOS and any version of MS-Windows. @end ifset In this @value{SECTION}, the term ``Windows32'' -refers to any of Microsoft Windows-95/98/ME/NT/2000/XP/Vista/7/8. +refers to any of Microsoft Windows 95/98/ME/NT/2000/XP/Vista/7/8. The limitations of MS-DOS (and MS-DOS shells under the other operating -systems) has meant that various ``DOS extenders'' are often used with +systems) have meant that various ``DOS extenders'' are often used with programs such as @command{gawk}. The varying capabilities of Microsoft Windows 3.1 and Windows32 can add to the confusion. For an overview of the considerations, refer to @file{README_d/README.pc} in @@ -36678,7 +36682,7 @@ Under MS-Windows, OS/2 and MS-DOS, Under MS-Windows and MS-DOS, @end ifset @command{gawk} (and many other text programs) silently -translate end-of-line @samp{\r\n} to @samp{\n} on input and @samp{\n} +translates end-of-line @samp{\r\n} to @samp{\n} on input and @samp{\n} to @samp{\r\n} on output. A special @code{BINMODE} variable @value{COMMONEXT} allows control over these translations and is interpreted as follows: @@ -36712,7 +36716,7 @@ Setting @code{BINMODE} for standard input or standard output is accomplished by using an appropriate @samp{-v BINMODE=@var{N}} option on the command line. @code{BINMODE} is set at the time a file or pipe is opened and cannot be -changed mid-stream. +changed midstream. The name @code{BINMODE} was chosen to match @command{mawk} (@pxref{Other Versions}). @@ -36768,8 +36772,8 @@ moved into the @code{BEGIN} rule. @command{gawk} can be built and used ``out of the box'' under MS-Windows if you are using the @uref{http://www.cygwin.com, Cygwin environment}. -This environment provides an excellent simulation of GNU/Linux, using the -GNU tools, such as Bash, the GNU Compiler Collection (GCC), GNU Make, +This environment provides an excellent simulation of GNU/Linux, using +Bash, GCC, GNU Make, and other GNU programs. Compilation and installation for Cygwin is the same as for a Unix system: @@ -36788,7 +36792,7 @@ and then the @samp{make} proceeds as usual. @appendixsubsubsec Using @command{gawk} In The MSYS Environment In the MSYS environment under MS-Windows, @command{gawk} automatically -uses binary mode for reading and writing files. Thus there is no +uses binary mode for reading and writing files. Thus, there is no need to use the @code{BINMODE} variable. This can cause problems with other Unix-like components that have @@ -36852,7 +36856,7 @@ With ODS-5 volumes and extended parsing enabled, the case of the target parameter may need to be exact. @command{gawk} has been tested under VAX/VMS 7.3 and Alpha/VMS 7.3-1 -using Compaq C V6.4, and Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS 8.3. +using Compaq C V6.4, and under Alpha/VMS 7.3, Alpha/VMS 7.3-2, and IA64/VMS 8.3. The most recent builds used HP C V7.3 on Alpha VMS 8.3 and both Alpha and IA64 VMS 8.4 used HP C 7.3.@footnote{The IA64 architecture is also known as ``Itanium.''} @@ -36900,7 +36904,7 @@ For VAX: /name=(as_is,short) @end example -Compile time macros need to be defined before the first VMS-supplied +Compile-time macros need to be defined before the first VMS-supplied header file is included, as follows: @example @@ -36947,7 +36951,7 @@ If your @command{gawk} was installed by a PCSI kit into the @file{GNV$GNU:[vms_help]gawk.hlp}. The PCSI kit also installs a @file{GNV$GNU:[vms_bin]gawk_verb.cld} file -which can be used to add @command{gawk} and @command{awk} as DCL commands. +that can be used to add @command{gawk} and @command{awk} as DCL commands. For just the current process you can use: @@ -36956,7 +36960,7 @@ $ @kbd{set command gnv$gnu:[vms_bin]gawk_verb.cld} @end example Or the system manager can use @file{GNV$GNU:[vms_bin]gawk_verb.cld} to -add the @command{gawk} and @command{awk} to the system wide @samp{DCLTABLES}. +add the @command{gawk} and @command{awk} to the system-wide @samp{DCLTABLES}. The DCL syntax is documented in the @file{gawk.hlp} file. @@ -37022,14 +37026,14 @@ The @code{exit} value is a Unix-style value and is encoded into a VMS exit status value when the program exits. The VMS severity bits will be set based on the @code{exit} value. -A failure is indicated by 1 and VMS sets the @code{ERROR} status. -A fatal error is indicated by 2 and VMS sets the @code{FATAL} status. +A failure is indicated by 1, and VMS sets the @code{ERROR} status. +A fatal error is indicated by 2, and VMS sets the @code{FATAL} status. All other values will have the @code{SUCCESS} status. The exit value is encoded to comply with VMS coding standards and will have the @code{C_FACILITY_NO} of @code{0x350000} with the constant @code{0xA000} added to the number shifted over by 3 bits to make room for the severity codes. -To extract the actual @command{gawk} exit code from the VMS status use: +To extract the actual @command{gawk} exit code from the VMS status, use: @example unix_status = (vms_status .and. &x7f8) / 8 @@ -37048,7 +37052,7 @@ VAX/VMS floating point uses unbiased rounding. @xref{Round Function}. VMS reports time values in GMT unless one of the @code{SYS$TIMEZONE_RULE} or @code{TZ} logical names is set. Older versions of VMS, such as VAX/VMS -7.3 do not set these logical names. +7.3, do not set these logical names. @c @cindex directory search @c @cindex path, search @@ -37066,7 +37070,7 @@ translation and not a multitranslation @code{RMS} searchlist. The VMS GNV package provides a build environment similar to POSIX with ports of a collection of open source tools. The @command{gawk} found in the GNV -base kit is an older port. Currently the GNV project is being reorganized +base kit is an older port. Currently, the GNV project is being reorganized to supply individual PCSI packages for each component. See @w{@uref{https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/}.} @@ -37139,7 +37143,7 @@ recommend compiling and using the current version. @cindex debugging @command{gawk}, bug reports @cindex troubleshooting, @command{gawk}, bug reports If you have problems with @command{gawk} or think that you have found a bug, -report it to the developers; we cannot promise to do anything +report it to the developers; we cannot promise to do anything, but we might well want to fix it. Before reporting a bug, make sure you have really found a genuine bug. @@ -37149,7 +37153,7 @@ to do something or not, report that too; it's a bug in the documentation! Before reporting a bug or trying to fix it yourself, try to isolate it to the smallest possible @command{awk} program and input @value{DF} that -reproduces the problem. Then send us the program and @value{DF}, +reproduce the problem. Then send us the program and @value{DF}, some idea of what kind of Unix system you're using, the compiler you used to compile @command{gawk}, and the exact results @command{gawk} gave you. Also say what you expected to occur; this helps @@ -37164,7 +37168,7 @@ You can get this information with the command @samp{gawk --version}. Once you have a precise problem description, send email to @EMAIL{bug-gawk@@gnu.org,bug-gawk at gnu dot org}. -The @command{gawk} maintainers subscribe to this address and +The @command{gawk} maintainers subscribe to this address, and thus they will receive your bug report. Although you can send mail to the maintainers directly, the bug reporting address is preferred because the @@ -37191,8 +37195,8 @@ bug reporting system, you should also send a copy to This is for two reasons. First, although some distributions forward bug reports ``upstream'' to the GNU mailing list, many don't, so there is a good chance that the @command{gawk} maintainers won't even see the bug report! Second, -mail to the GNU list is archived, and having everything at the GNU project -keeps things self-contained and not dependant on other organizations. +mail to the GNU list is archived, and having everything at the GNU Project +keeps things self-contained and not dependent on other organizations. @end quotation Non-bug suggestions are always welcome as well. If you have questions @@ -37201,7 +37205,7 @@ features, ask on the bug list; we will try to help you out if we can. If you find bugs in one of the non-Unix ports of @command{gawk}, send an email to the bug list, with a copy to the -person who maintains that port. They are named in the following list, +person who maintains that port. The maintainers are named in the following list, as well as in the @file{README} file in the @command{gawk} distribution. Information in the @file{README} file should be considered authoritative if it conflicts with this @value{DOCUMENT}. @@ -37216,19 +37220,19 @@ The people maintaining the various @command{gawk} ports are: @cindex Robbins, Arnold @cindex Zaretskii, Eli @multitable {MS-Windows with MinGW} {123456789012345678901234567890123456789001234567890} -@item Unix and POSIX systems @tab Arnold Robbins, @EMAIL{arnold@@skeeve.com,arnold at skeeve dot com}. +@item Unix and POSIX systems @tab Arnold Robbins, @EMAIL{arnold@@skeeve.com,arnold at skeeve dot com} -@item MS-DOS with DJGPP @tab Scott Deifik, @EMAIL{scottd.mail@@sbcglobal.net,scottd dot mail at sbcglobal dot net}. +@item MS-DOS with DJGPP @tab Scott Deifik, @EMAIL{scottd.mail@@sbcglobal.net,scottd dot mail at sbcglobal dot net} -@item MS-Windows with MinGW @tab Eli Zaretskii, @EMAIL{eliz@@gnu.org,eliz at gnu dot org}. +@item MS-Windows with MinGW @tab Eli Zaretskii, @EMAIL{eliz@@gnu.org,eliz at gnu dot org} @c Leave this in the print version on purpose. @c OS/2 is not mentioned anywhere else in the print version though. -@item OS/2 @tab Andreas Buening, @EMAIL{andreas.buening@@nexgo.de,andreas dot buening at nexgo dot de}. +@item OS/2 @tab Andreas Buening, @EMAIL{andreas.buening@@nexgo.de,andreas dot buening at nexgo dot de} -@item VMS @tab John Malmberg, @EMAIL{wb8tyw@@qsl.net,wb8tyw at qsl.net}. +@item VMS @tab John Malmberg, @EMAIL{wb8tyw@@qsl.net,wb8tyw at qsl.net} -@item z/OS (OS/390) @tab Dave Pitts, @EMAIL{dpitts@@cozx.com,dpitts at cozx dot com}. +@item z/OS (OS/390) @tab Dave Pitts, @EMAIL{dpitts@@cozx.com,dpitts at cozx dot com} @end multitable If your bug is also reproducible under Unix, send a copy of your @@ -37247,7 +37251,7 @@ Date: Wed, 4 Sep 1996 08:11:48 -0700 (PDT) @cindex Brennan, Michael @ifnotdocbook @quotation -@i{It's kind of fun to put comments like this in your awk code.}@* +@i{It's kind of fun to put comments like this in your awk code:}@* @ @ @ @ @ @ @code{// Do C++ comments work? answer: yes! of course} @author Michael Brennan @end quotation @@ -37288,7 +37292,7 @@ It is available in several archive formats: @end table @cindex @command{git} utility -You can also retrieve it from Git Hub: +You can also retrieve it from GitHub: @example git clone git://github.com/onetrueawk/awk bwkawk @@ -37348,7 +37352,7 @@ for a list of extensions in @command{mawk} that are not in POSIX @command{awk}. @item @command{awka} Written by Andrew Sumner, @command{awka} translates @command{awk} programs into C, compiles them, -and links them with a library of functions that provides the core +and links them with a library of functions that provide the core @command{awk} functionality. It also has a number of extensions. @@ -37369,17 +37373,17 @@ since approximately 2001. Nelson H.F.@: Beebe at the University of Utah has modified BWK @command{awk} to provide timing and profiling information. It is different from @command{gawk} with the @option{--profile} option -(@pxref{Profiling}), +(@pxref{Profiling}) in that it uses CPU-based profiling, not line-count profiling. You may find it at either @uref{ftp://ftp.math.utah.edu/pub/pawk/pawk-20030606.tar.gz} or @uref{http://www.math.utah.edu/pub/pawk/pawk-20030606.tar.gz}. -@item Busybox Awk -@cindex Busybox Awk -@cindex source code, Busybox Awk -Busybox is a GPL-licensed program providing small versions of many +@item BusyBox @command{awk} +@cindex BusyBox Awk +@cindex source code, BusyBox Awk +BusyBox is a GPL-licensed program providing small versions of many applications within a single executable. It is aimed at embedded systems. It includes a full implementation of POSIX @command{awk}. When building it, be careful not to do @samp{make install} as it will overwrite @@ -37391,7 +37395,7 @@ information, see the @uref{http://busybox.net, project's home page}. @cindex source code, Solaris @command{awk} @item The OpenSolaris POSIX @command{awk} The versions of @command{awk} in @file{/usr/xpg4/bin} and -@file{/usr/xpg6/bin} on Solaris are more-or-less POSIX-compliant. +@file{/usr/xpg6/bin} on Solaris are more or less POSIX-compliant. They are based on the @command{awk} from Mortice Kern Systems for PCs. We were able to make this code compile and work under GNU/Linux with 1--2 hours of work. Making it more generally portable (using @@ -37432,9 +37436,9 @@ features to Python. See @uref{https://github.com/alecthomas/pawk} for more information. (This is not related to Nelson Beebe's modified version of BWK @command{awk}, described earlier.) -@item @w{QSE Awk} -@cindex QSE Awk -@cindex source code, QSE Awk +@item @w{QSE @command{awk}} +@cindex QSE @command{awk} +@cindex source code, QSE @command{awk} This is an embeddable @command{awk} interpreter. For more information, see @uref{http://code.google.com/p/qse/} and @uref{http://awk.info/?tools/qse}. @@ -37453,7 +37457,7 @@ since approximately 2008. @item Other versions See also the ``Versions and implementations'' section of the @uref{http://en.wikipedia.org/wiki/Awk_language#Versions_and_implementations, -Wikipedia article} for information on additional versions. +Wikipedia article} on @command{awk} for information on additional versions. @end table @@ -37462,7 +37466,7 @@ Wikipedia article} for information on additional versions. @itemize @value{BULLET} @item -The @command{gawk} distribution is available from GNU project's main +The @command{gawk} distribution is available from the GNU Project's main distribution site, @code{ftp.gnu.org}. The canonical build recipe is: @example @@ -37474,22 +37478,22 @@ cd gawk-@value{VERSION}.@value{PATCHLEVEL} @item @command{gawk} may be built on non-POSIX systems as well. The currently -supported systems are MS-Windows using DJGPP, MSYS, MinGW and Cygwin, +supported systems are MS-Windows using DJGPP, MSYS, MinGW, and Cygwin, @ifclear FOR_PRINT OS/2 using EMX, @end ifclear and both Vax/VMS and OpenVMS. -Instructions for each system are included in this @value{CHAPTER}. +Instructions for each system are included in this @value{APPENDIX}. @item Bug reports should be sent via email to @email{bug-gawk@@gnu.org}. -Bug reports should be in English, and should include the version of @command{gawk}, -how it was compiled, and a short program and @value{DF} which demonstrate +Bug reports should be in English and should include the version of @command{gawk}, +how it was compiled, and a short program and @value{DF} that demonstrate the problem. @item There are a number of other freely available @command{awk} -implementations. Many are POSIX compliant; others are less so. +implementations. Many are POSIX-compliant; others are less so. @end itemize -- cgit v1.2.3