diff options
Diffstat (limited to 'doc/gawk.info')
-rw-r--r-- | doc/gawk.info | 4971 |
1 files changed, 3012 insertions, 1959 deletions
diff --git a/doc/gawk.info b/doc/gawk.info index 878a03fc..b97acf46 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -94,13 +94,17 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) * Library Functions:: A Library of `awk' Functions. * Sample Programs:: Many `awk' programs with complete explanations. -* Debugger:: The `dgawk' debugger. +* Debugger:: The `gawk' debugger. +* Arbitrary Precision Arithmetic:: Arbitrary precision arithmetic with + `gawk'. +* Dynamic Extensions:: Adding new built-in functions to + `gawk'. * Language History:: The evolution of the `awk' language. * Installation:: Installing `gawk' under various operating systems. -* Notes:: Notes about `gawk' extensions and - possible future work. +* Notes:: Notes about adding things to `gawk' + and possible future work. * Basic Concepts:: A very quick introduction to programming concepts. * Glossary:: An explanation of some unfamiliar terms. @@ -154,9 +158,12 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) uses. * AWKPATH Variable:: Searching directories for `awk' programs. +* AWKLIBPATH Variable:: Searching directories for `awk' + shared libraries. * Other Environment Variables:: The environment variables. * Exit Status:: `gawk''s exit status. * Include Files:: Including other files into your program. +* Loading Shared Libraries:: Loading shared libraries into your program. * Obsolete:: Obsolete Options and/or features. * Undocumented:: Undocumented Options and Features. * Regexp Usage:: How to Use Regular Expressions. @@ -196,6 +203,7 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) * Getline Notes:: Important things to know about `getline'. * Getline Summary:: Summary of `getline' Variants. +* Read Timeout:: Reading input with a timeout. * Command line directories:: What happens if you put a directory on the command line. * Print:: The `print' statement. @@ -377,7 +385,7 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) * Ordinal Functions:: Functions for using characters as numbers and vice versa. * Join Function:: A function to join an array into a string. -* Gettimeofday Function:: A function to get formatted times. +* Getlocaltime Function:: A function to get formatted times. * Data File Management:: Functions for managing command-line data files. * Filetrans Function:: A function for handling data file @@ -417,23 +425,51 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) * Anagram Program:: Finding anagrams from a dictionary. * Signature Program:: People do amazing things with too much time on their hands. -* Debugging:: Introduction to `dgawk'. -* Debugging Concepts:: Debugging In General. +* Debugging:: Introduction to `gawk' debugger. +* Debugging Concepts:: Debugging in General. * Debugging Terms:: Additional Debugging Concepts. * Awk Debugging:: Awk Debugging. -* Sample dgawk session:: Sample `dgawk' session. -* dgawk invocation:: `dgawk' Invocation. -* Finding The Bug:: Finding The Bug. -* List of Debugger Commands:: Main `dgawk' Commands. -* Breakpoint Control:: Control of breakpoints. -* Dgawk Execution Control:: Control of execution. -* Viewing And Changing Data:: Viewing and changing data. -* Dgawk Stack:: Dealing with the stack. -* Dgawk Info:: Obtaining information about the program and - the debugger state. -* Miscellaneous Dgawk Commands:: Miscellaneous Commands. -* Readline Support:: Readline Support. -* Dgawk Limitations:: Limitations and future plans. +* Sample Debugging Session:: Sample debugging session. +* Debugger Invocation:: How to Start the Debugger. +* Finding The Bug:: Finding the Bug. +* List of Debugger Commands:: Main debugger commands. +* Breakpoint Control:: Control of Breakpoints. +* Debugger Execution Control:: Control of Execution. +* Viewing And Changing Data:: Viewing and Changing Data. +* Execution Stack:: Dealing with the Stack. +* Debugger Info:: Obtaining Information about the Program and + the Debugger State. +* Miscellaneous Debugger Commands:: Miscellaneous Commands. +* Readline Support:: Readline support. +* Limitations:: Limitations and future plans. +* General Arithmetic:: An introduction to computer arithmetic. +* Floating Point Issues:: Stuff to know about floating-point numbers. +* String Conversion Precision:: The String Value Can Lie. +* Unexpected Results:: Floating Point Numbers Are Not Abstract + Numbers. +* POSIX Floating Point Problems:: Standards Versus Existing Practice. +* Integer Programming:: Effective integer programming. +* Floating-point Programming:: Effective Floating-point Programming. +* Floating-point Representation:: Binary floating-point representation. +* Floating-point Context:: Floating-point context. +* Rounding Mode:: Floating-point rounding mode. +* Gawk and MPFR:: How `gawk' provides + arbitrary-precision arithmetic. +* Arbitrary Precision Floats:: Arbitrary Precision Floating-point + Arithmetic with `gawk'. +* Setting Precision:: Setting the working precision. +* Setting Rounding Mode:: Setting the rounding mode. +* Floating-point Constants:: Representing floating-point constants. +* Changing Precision:: Changing the precision of a number. +* Exact Arithmetic:: Exact arithmetic with floating-point + numbers. +* Arbitrary Precision Integers:: Arbitrary Precision Integer Arithmetic with + `gawk'. +* Plugin License:: A note about licensing. +* Sample Library:: A example of new functions. +* Internal File Description:: What the new functions will do. +* Internal File Ops:: The code for internal file operations. +* Using Internal File Ops:: How to use an external extension. * V7/SVR3.1:: The major changes between V7 and System V Release 3.1. * SVR4:: Minor changes between System V Releases 3.1 @@ -484,24 +520,12 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) `gawk'. * New Ports:: Porting `gawk' to a new operating system. -* Dynamic Extensions:: Adding new built-in functions to - `gawk'. -* Internals:: A brief look at some `gawk' - internals. -* Plugin License:: A note about licensing. -* Sample Library:: A example of new functions. -* Internal File Description:: What the new functions will do. -* Internal File Ops:: The code for internal file operations. -* Using Internal File Ops:: How to use an external extension. +* Derived Files:: Why derived files are kept in the + `git' repository. * Future Extensions:: New features that may be implemented one day. * Basic High Level:: The high level view. * Basic Data Typing:: A very quick intro to data types. -* Floating Point Issues:: Stuff to know about floating-point numbers. -* String Conversion Precision:: The String Value Can Lie. -* Unexpected Results:: Floating Point Numbers Are Not Abstract - Numbers. -* POSIX Floating Point Problems:: Standards Versus Existing Practice. To Miriam, for making me complete. @@ -849,7 +873,13 @@ and profile your `awk' programs. sample `awk' programs. Reading them allows you to see `awk' solving real problems. - *note Debugger::, describes the `awk' debugger, `dgawk'. + *note Debugger::, describes the `awk' debugger. + + *note Arbitrary Precision Arithmetic::, describes advanced +arithmetic facilities provided by `gawk'. + + *note Dynamic Extensions::, describes how to add new variables and +functions to `gawk' by writing extensions in C. *note Language History::, describes how the `awk' language has evolved since its first release to present. It also describes how @@ -861,8 +891,8 @@ non-POSIX systems. It also describes how to report bugs in `gawk' and where to get other freely available `awk' implementations. *note Notes::, describes how to disable `gawk''s extensions, as well -as how to contribute new code to `gawk', how to write extension -libraries, and some possible future directions for `gawk' development. +as how to contribute new code to `gawk', and some possible future +directions for `gawk' development. *note Basic Concepts::, provides some very cursory background material for those who are completely unfamiliar with computer @@ -1100,10 +1130,12 @@ it is today. It has been and continues to be a pleasure working with this team of fine people. John Haque contributed the modifications to convert `gawk' into a -byte-code interpreter, including the debugger. Stephen Davies -contributed to the effort to bring the byte-code changes into the -mainstream code base. Efraim Yawitz contributed the initial text of -*note Debugger::. +byte-code interpreter, including the debugger, and the additional +modifications for support of arbitrary precision arithmetic. Stephen +Davies contributed to the effort to bring the byte-code changes into +the mainstream code base. Efraim Yawitz contributed the initial text +of *note Debugger::. John Haque contributed the initial text of *note +Arbitrary Precision Arithmetic::. I would like to thank Brian Kernighan for invaluable assistance during the testing and debugging of `gawk', and for ongoing help and @@ -2086,6 +2118,7 @@ this major node that don't interest you right now. * Environment Variables:: The environment variables `gawk' uses. * Exit Status:: `gawk''s exit status. * Include Files:: Including other files into your program. +* Loading Shared Libraries:: Loading shared libraries into your program. * Obsolete:: Obsolete Options and/or features. * Undocumented:: Undocumented Options and Features. @@ -2143,6 +2176,20 @@ The following list describes options mandated by the POSIX standard: `awk' program consists of the concatenation the contents of each specified SOURCE-FILE. +`-i SOURCE-FILE' +`--include SOURCE-FILE' + Read `awk' source library from SOURCE-FILE. This option is + completely equivalent to using the `@include' directive inside + your program. This option is very similar to the `-f' option, but + there are two important differences. First, when `-i' is used, + the program source will not be loaded if it has been previously + loaded, whereas the `-f' will always load the file. Second, + because this option is intended to be used with code libraries, the + `awk' command does not recognize such files as constituting main + program input. Thus, after processing an `-i' argument, we still + expect to find the main source code via the `-f' option or on the + command-line. + `-v VAR=VAL' `--assign VAR=VAL' Set the variable VAR to the value VAL _before_ execution of the @@ -2219,6 +2266,15 @@ The following list describes options mandated by the POSIX standard: particularly easy mistake to make with simple variable names like `i', `j', etc.) +`-D[FILE]' +`--debug=[FILE]' + Enable debugging of `awk' programs (*note Debugging::). By + default, the debugger reads commands interactively from the + terminal. The optional FILE argument allows you to specify a file + with a list of commands for the debugger to execute + non-interactively. No space is allowed between the `-D' and FILE, + if FILE is supplied. + `-e PROGRAM-TEXT' `--source PROGRAM-TEXT' Provide program source code in the PROGRAM-TEXT. This option @@ -2261,6 +2317,15 @@ The following list describes options mandated by the POSIX standard: Print a "usage" message summarizing the short and long style options that `gawk' accepts and then exit. +`-l LIB' +`--load LIB' + Load a shared library LIB. This searches for the library using the + `AWKLIBPATH' environment variable. The correct library suffix for + your platform will be supplied by default, so it need not be + specified in the library name. The library initialization routine + should be named `dl_load()'. An alternative is to use the `@load' + keyword inside the program to load a shared library. + `-L [value]' `--lint[=value]' Warn about constructs that are dubious or nonportable to other @@ -2280,6 +2345,12 @@ The following list describes options mandated by the POSIX standard: inappropriate construct. As `awk' programs are usually short, doing so is not burdensome. +`-M' +`--bignum' + Force arbitrary precision arithmetic on numbers. This option has + no effect if `gawk' is not compiled to use the GNU MPFR and MP + libraries (*note Arbitrary Precision Arithmetic::). + `-n' `--non-decimal-data' Enable automatic interpretation of octal and hexadecimal values in @@ -2293,6 +2364,14 @@ The following list describes options mandated by the POSIX standard: Force the use of the locale's decimal point character when parsing numeric input data (*note Locales::). +`-o[FILE]' +`--pretty-print[=FILE]' + Enable pretty-printing of `awk' programs. By default, output + program is created in a file named `awkprof.out'. The optional + FILE argument allows you to specify a different file name for the + output. No space is allowed between the `-o' and FILE, if FILE is + supplied. + `-O' `--optimize' Enable some optimizations on the internal representation of the @@ -2308,10 +2387,9 @@ The following list describes options mandated by the POSIX standard: for the profile file. No space is allowed between the `-p' and FILE, if FILE is supplied. - When run with `gawk', the profile is just a "pretty printed" - version of the program. When run with `pgawk', the profile - contains execution counts for each statement in the program in the - left margin, and function call counts for each function. + The profile contains execution counts for each statement in the + program in the left margin, and function call counts for each + function. `-P' `--posix' @@ -2345,11 +2423,6 @@ The following list describes options mandated by the POSIX standard: remains both for backward compatibility, and for use in combination with the `--traditional' option. -`-R FILE' -`--command=FILE' - `dgawk' only. Read `dgawk' debugger options and commands from - FILE. *Note Dgawk Info::, for more information. - `-S' `--sandbox' Disable the `system()' function, input redirections with `getline', @@ -2529,10 +2602,12 @@ A number of environment variables influence how `gawk' behaves. * AWKPATH Variable:: Searching directories for `awk' programs. +* AWKLIBPATH Variable:: Searching directories for `awk' shared + libraries. * Other Environment Variables:: The environment variables. -File: gawk.info, Node: AWKPATH Variable, Next: Other Environment Variables, Up: Environment Variables +File: gawk.info, Node: AWKPATH Variable, Next: AWKLIBPATH Variable, Up: Environment Variables 2.5.1 The `AWKPATH' Environment Variable ---------------------------------------- @@ -2541,9 +2616,9 @@ The previous minor node described how `awk' program files can be named on the command-line with the `-f' option. In most `awk' implementations, you must supply a precise path name for each program file, unless the file is in the current directory. But in `gawk', if -the file name supplied to the `-f' option does not contain a `/', then -`gawk' searches a list of directories (called the "search path"), one -by one, looking for a file with the specified name. +the file name supplied to the `-f' or `-i' options does not contain a +`/', then `gawk' searches a list of directories (called the "search +path"), one by one, looking for a file with the specified name. The search path is a string consisting of directory names separated by colons. `gawk' gets its search path from the `AWKPATH' environment @@ -2556,11 +2631,15 @@ standard directory in the default path and then specified on the command line with a short file name. Otherwise, the full file name would have to be typed for each file. - By using both the `--source' and `-f' options, your command-line -`awk' programs can use facilities in `awk' library files (*note Library -Functions::). Path searching is not done if `gawk' is in compatibility -mode. This is true for both `--traditional' and `--posix'. *Note -Options::. + By using the `-i' option, or the `--source' and `-f' options, your +command-line `awk' programs can use facilities in `awk' library files +(*note Library Functions::). Path searching is not done if `gawk' is +in compatibility mode. This is true for both `--traditional' and +`--posix'. *Note Options::. + + If the source code is not found after the initial search, the path +is searched again after adding the default `.awk' suffix to the +filename. NOTE: To include the current directory in the path, either place `.' explicitly in the path or write a null entry in the path. (A @@ -2591,9 +2670,22 @@ the value of `$(datadir)' generated when `gawk' was configured. You probably don't need to worry about this, though. -File: gawk.info, Node: Other Environment Variables, Prev: AWKPATH Variable, Up: Environment Variables +File: gawk.info, Node: AWKLIBPATH Variable, Next: Other Environment Variables, Prev: AWKPATH Variable, Up: Environment Variables -2.5.2 Other Environment Variables +2.5.2 The `AWKLIBPATH' Environment Variable +------------------------------------------- + +The `AWKLIBPATH' environment variable is similar to the `AWKPATH' +variable, but it is used to search for shared libraries specified with +the `-l' option rather than for source files. If the library is not +found, the path is searched again after adding the appropriate shared +library suffix for the platform. For example, on GNU/Linux systems, +the suffix `.so' is used. + + +File: gawk.info, Node: Other Environment Variables, Prev: AWKLIBPATH Variable, Up: Environment Variables + +2.5.3 Other Environment Variables --------------------------------- A number of other environment variables affect `gawk''s behavior, but @@ -2614,6 +2706,10 @@ used by regular users. milliseconds. On systems that do not support the `usleep()' system call, the value is rounded up to an integral number of seconds. +`GAWK_READ_TIMEOUT' + Specifies the time, in milliseconds, for `gawk' to wait for input + before returning with an error. *Note Read Timeout::. + The environment variables in the following list are meant for use by the `gawk' developers for testing and tuning. They are subject to change. The variables are: @@ -2668,7 +2764,7 @@ with the value of the C constant `EXIT_SUCCESS'. This is usually zero. non-POSIX systems, this value may be mapped to `EXIT_FAILURE'. -File: gawk.info, Node: Include Files, Next: Obsolete, Prev: Exit Status, Up: Invoking Gawk +File: gawk.info, Node: Include Files, Next: Loading Shared Libraries, Prev: Exit Status, Up: Invoking Gawk 2.7 Including Other Files Into Your Program =========================================== @@ -2682,7 +2778,8 @@ into smaller, more manageable pieces, and also lets you reuse common together `awk' functions, used to carry out specific tasks, into external files. These files can be used just like function libraries, using the `@include' keyword in conjunction with the `AWKPATH' -environment variable. +environment variable. Note that source files may also be included +using the `-i' option. Let's see an example. We'll start with two (trivial) `awk' scripts, namely `test1' and `test2'. Here is the `test1' script: @@ -2764,9 +2861,41 @@ always searched first for source files, before searching in `AWKPATH', and this also applies to files named with `@include'. -File: gawk.info, Node: Obsolete, Next: Undocumented, Prev: Include Files, Up: Invoking Gawk +File: gawk.info, Node: Loading Shared Libraries, Next: Obsolete, Prev: Include Files, Up: Invoking Gawk + +2.8 Loading Shared Libraries Into Your Program +============================================== + +This minor node describes a feature that is specific to `gawk'. + + The `@load' keyword can be used to read external `awk' shared +libraries. This allows you to link in compiled code that may offer +superior performance and/or give you access to extended capabilities +not supported by the `awk' language. The `AWKLIBPATH' variable is used +to search for the shared library. Using `@load' is completely +equivalent to using the `-l' command-line option. + + If the shared library is not initially found in `AWKLIBPATH', another +search is conducted after appending the platform's default shared +library suffix to the filename. For example, on GNU/Linux systems, the +suffix `.so' is used. -2.8 Obsolete Options and/or Features + $ gawk '@load "ordchr"; BEGIN {print chr(65)}' + -| A + +This is equivalent to the following example: + + $ gawk -lordchr 'BEGIN {print chr(65)}' + -| A + +For command-line usage, the `-l' option is more convenient, but `@load' +is useful for embedding inside an `awk' source file that requires +access to a shared library. + + +File: gawk.info, Node: Obsolete, Next: Undocumented, Prev: Loading Shared Libraries, Up: Invoking Gawk + +2.9 Obsolete Options and/or Features ==================================== This minor node describes features and/or command-line options from @@ -2782,8 +2911,8 @@ worked. As of version 4.0, they are no longer interpreted specially by File: gawk.info, Node: Undocumented, Prev: Obsolete, Up: Invoking Gawk -2.9 Undocumented Options and Features -===================================== +2.10 Undocumented Options and Features +====================================== Use the Source, Luke! Obi-Wan @@ -3615,6 +3744,7 @@ have to be named on the `awk' command line (*note Getline::). * Multiple Line:: Reading multi-line records. * Getline:: Reading files under explicit program control using the `getline' function. +* Read Timeout:: Reading input with a timeout. * Command line directories:: What happens if you put a directory on the command line. @@ -4807,7 +4937,7 @@ feature of `RS' does not apply. It does apply to the default field separator of a single space: `FS = " "'. -File: gawk.info, Node: Getline, Next: Command line directories, Prev: Multiple Line, Up: Reading Files +File: gawk.info, Node: Getline, Next: Read Timeout, Prev: Multiple Line, Up: Reading Files 4.9 Explicit Input with `getline' ================================= @@ -5233,7 +5363,8 @@ File: gawk.info, Node: Getline Summary, Prev: Getline Notes, Up: Getline *note table-getline-variants:: summarizes the eight variants of `getline', listing which built-in variables are set by each one, and -whether the variant is standard or a `gawk' extension. +whether the variant is standard or a `gawk' extension. Note: for each +variant, `gawk' sets the `RT' built-in variable. Variant Effect Standard / Extension @@ -5252,9 +5383,101 @@ VAR Table 4.1: getline Variants and What They Set -File: gawk.info, Node: Command line directories, Prev: Getline, Up: Reading Files +File: gawk.info, Node: Read Timeout, Next: Command line directories, Prev: Getline, Up: Reading Files + +4.10 Reading Input With A Timeout +================================= + +You may specify a timeout in milliseconds for reading input from a +terminal, pipe or two-way communication including, TCP/IP sockets. This +can be done on a per input, command or connection basis, by setting a +special element in the `PROCINFO' array: + + PROCINFO["input_name", "READ_TIMEOUT"] = TIMEOUT IN MILLISECONDS + + When set, this will cause `gawk' to time out and return failure if +no data is available to read within the specified timeout period. For +example, a TCP client can decide to give up on receiving any response +from the server after a certain amount of time: + + Service = "/inet/tcp/0/localhost/daytime" + PROCINFO[Service, "READ_TIMEOUT"] = 100 + if ((Service |& getline) > 0) + print $0 + else if (ERRNO != "") + print ERRNO + + Here is how to read interactively from the terminal(1) without +waiting for more than five seconds: + + PROCINFO["/dev/stdin", "READ_TIMEOUT"] = 5000 + while ((getline < "/dev/stdin") > 0) + print $0 + + `gawk' will terminate the read operation if input does not arrive +after waiting for the timeout period, return failure and set the +`ERRNO' variable to an appropriate string value. A negative or zero +value for the timeout is the same as specifying no timeout at all. + + A timeout can also be set for reading from the terminal in the +implicit loop that reads input records and matches them against +patterns, like so: + + $ gawk 'BEGIN { PROCINFO["-", "READ_TIMEOUT"] = 5000 } + > { print "You entered: " $0 }' + gawk + -| You entered: gawk + + In this case, failure to respond within five seconds results in the +following error message: + + error--> gawk: cmd. line:2: (FILENAME=- FNR=1) fatal: error reading input file `-': Connection timed out + + The timeout can be set or changed at any time, and will take effect +on the next attempt to read from the input device. In the following +example, we start with a timeout value of one second, and progressively +reduce it by one-tenth of a second until we wait indefinitely for the +input to arrive: + + PROCINFO[Service, "READ_TIMEOUT"] = 1000 + while ((Service |& getline) > 0) { + print $0 + PROCINFO[S, "READ_TIMEOUT"] -= 100 + } + + NOTE: You should not assume that the read operation will block + exactly after the tenth record has been printed. It is possible + that `gawk' will read and buffer more than one record's worth of + data the first time. Because of this, changing the value of + timeout like in the above example is not very useful. + + If the `PROCINFO' element is not present and the environment +variable `GAWK_READ_TIMEOUT' exists, `gawk' uses its value to +initialize the timeout value. The exclusive use of the environment +variable to specify timeout has the disadvantage of not being able to +control it on a per command or connection basis. + + `gawk' considers a timeout event to be an error even though the +attempt to read from the underlying device may succeed in a later +attempt. This is a limitation, and it also means that you cannot use +this to multiplex input from two or more sources. + + Assigning a timeout value prevents read operations from blocking +indefinitely. But bear in mind that there are other ways `gawk' can +stall waiting for an input device to be ready. A network client can +sometimes take a long time to establish a connection before it can +start reading any data, or the attempt to open a FIFO special file for +reading can block indefinitely until some other process opens it for +writing. + + ---------- Footnotes ---------- + + (1) This assumes that standard input is the keyboard + + +File: gawk.info, Node: Command line directories, Prev: Read Timeout, Up: Reading Files -4.10 Directories On The Command Line +4.11 Directories On The Command Line ==================================== According to the POSIX standard, files named on the `awk' command line @@ -8329,10 +8552,10 @@ would otherwise be difficult or impossible to perform: entirely. Otherwise, `gawk' exits with the usual fatal error. * If you have written extensions that modify the record handling (by - inserting an "open hook"), you can invoke them at this point, + inserting an "input parser"), you can invoke them at this point, before `gawk' has started processing the file. (This is a _very_ - advanced feature, currently used only by the XMLgawk project - (http://xmlgawk.sourceforge.net).) + advanced feature, currently used only by the `gawkextlib' project + (http://gawkextlib.sourceforge.net).) The `ENDFILE' rule is called when `gawk' has finished processing the last record in an input file. For the last input file, it will be @@ -9216,6 +9439,15 @@ specific to `gawk' are marked with a pound sign (`#'). every `print' statement. Its default value is `"\n"', the newline character. (*Note Output Separators::.) +`PREC #' + The working precision of arbitrary precision floating-point + numbers, 53 by default (*note Setting Precision::). + +`ROUNDMODE #' + The rounding mode to use for arbitrary precision arithmetic on + numbers, by default `"N"' (`roundTiesToEven' in the IEEE-754 + standard) (*note Setting Rounding Mode::). + `RS' This is `awk''s input record separator. Its default value is a string containing a single newline character, which means that an @@ -9321,7 +9553,8 @@ with a pound sign (`#'). Some operating systems may not have environment variables. On such systems, the `ENVIRON' array is empty (except for - `ENVIRON["AWKPATH"]', *note AWKPATH Variable::). + `ENVIRON["AWKPATH"]', *note AWKPATH Variable:: and + `ENVIRON["AWKLIBPATH"]', *note AWKLIBPATH Variable::). `ERRNO #' If a system error occurs during a redirection for `getline', @@ -9369,6 +9602,12 @@ with a pound sign (`#'). create or remove fields from the current record. *Note Changing Fields::. +`FUNCTAB #' + An array whose indices are the names of all the user-defined or + extension functions in the program. *NOTE*: The array values + cannot currently be used. Also, you may not use the `delete' + statement with the `FUNCTAB' array. + `NR' The number of input records `awk' has processed since the beginning of the program's execution (*note Records::). `NR' is @@ -9391,6 +9630,32 @@ with a pound sign (`#'). effect, or `"FPAT"' if field matching with `FPAT' is in effect. + `PROCINFO["identifiers"]' + A subarray, indexed by the names of all identifiers used in + the text of the AWK program. For each identifier, the value + of the element is one of the following: + + `"array"' + The identifier is an array. + + `"extension"' + The identifier is an extension function loaded via + `@load'. + + `"scalar"' + The identifier is a scalar. + + `"untyped"' + The identifier is untyped (could be used as a scalar or + array, `gawk' doesn't know yet). + + `"user"' + The identifier is a user-defined function. + + The values indicate what `gawk' knows about the identifiers + after it has finished parsing the program; they are _not_ + updated while the program runs. + `PROCINFO["gid"]' The value of the `getgid()' system call. @@ -9421,6 +9686,23 @@ with a pound sign (`#'). `PROCINFO["version"]' The version of `gawk'. + The following additional elements in the array are available to + provide information about the MPFR and GMP libraries if your + version of `gawk' supports arbitrary precision numbers (*note + Arbitrary Precision Arithmetic::): + + `PROCINFO["mpfr_version"]' + The version of the GNU MPFR library. + + `PROCINFO["gmp_version"]' + The version of the GNU MP library. + + `PROCINFO["prec_max"]' + The maximum precision supported by MPFR. + + `PROCINFO["prec_min"]' + The minimum precision required by MPFR. + On some systems, there may be elements in the array, `"group1"' through `"groupN"' for some N. N is the number of supplementary groups that the process has. Use the `in' operator to test for @@ -9455,6 +9737,44 @@ with a pound sign (`#'). implementations, or if `gawk' is in compatibility mode (*note Options::), it is not special. +`SYMTAB #' + An array whose indices are the names of all currently defined + global variables and arrays in the program. The array may be used + for indirect access to read or write the value of a variable: + + foo = 5 + SYMTAB["foo"] = 4 + print foo # prints 4 + + The `isarray()' function (*note Type Functions::) may be used to + test if an element in `SYMTAB' is an array. Also, you may not use + the `delete' statement with the `SYMTAB' array. + + You may use an index for `SYMTAB' that is not a predefined + identifer: + + SYMTAB["xxx"] = 5 + print SYMTAB["xxx"] + + This works as expected: in this case `SYMTAB' acts just like a + regular array. The only difference is that you can't then delete + `SYMTAB["xxx"]'. + + The `SYMTAB' array is more interesting than it looks. Andrew Schorr + points out that it effectively gives `awk' data pointers. Consider + his example: + + # Indirect multiply of any variable by amount, return result + + function multiply(variable, amount) + { + return SYMTAB[variable] *= amount + } + + NOTE: In order to avoid severe time-travel paradoxes(2), + neither `FUNCTAB' nor `SYMTAB' are available as elements + within the `SYMTAB' array. + Advanced Notes: Changing `NR' and `FNR' --------------------------------------- @@ -9484,6 +9804,8 @@ file by resetting `NR' to zero when `FILENAME' changed. to `"-"', even if there were data files to be processed. This behavior was incorrect and should not be relied upon in your programs. + (2) Not to mention difficult implementation issues. + File: gawk.info, Node: ARGC and ARGV, Prev: Auto-set, Up: Built-in Variables @@ -11968,8 +12290,9 @@ again with `10111001' and shift it left by three bits, you end up with `11001000'. `gawk' provides built-in functions that implement the bitwise operations just described. They are: -`and(V1, V2)' - Return the bitwise AND of the values provided by V1 and V2. +`and(V1, V2 [, ...])' + Return the bitwise AND of the arguments. There must be at least + two. `compl(VAL)' Return the bitwise complement of VAL. @@ -11977,14 +12300,15 @@ bitwise operations just described. They are: `lshift(VAL, COUNT)' Return the value of VAL, shifted left by COUNT bits. -`or(V1, V2)' - Return the bitwise OR of the values provided by V1 and V2. +`or(V1, V2 [, ...])' + Return the bitwise OR of the arguments. There must be at least two. `rshift(VAL, COUNT)' Return the value of VAL, shifted right by COUNT bits. -`xor(V1, V2)' - Return the bitwise XOR of the values provided by V1 and V2. +`xor(V1, V2 [, ...])' + Return the bitwise XOR of the arguments. There must be at least + two. For all of these functions, first the double precision floating-point value is converted to the widest C unsigned integer @@ -13775,7 +14099,7 @@ login name, and the fields are separated by colons. Each record defines a subarray, with each field as an element in the subarray. Running the program produces the following output: - $ gawk -vPOS=1 -F: -f sort.awk /etc/passwd + $ gawk -v POS=1 -F: -f sort.awk /etc/passwd -| adm:x:3:4:adm:/var/adm:/sbin/nologin -| apache:x:48:48:Apache:/var/www:/sbin/nologin -| avahi:x:70:70:Avahi daemon:/:/sbin/nologin @@ -14156,25 +14480,22 @@ File: gawk.info, Node: Profiling, Prev: TCP/IP Networking, Up: Advanced Featu ================================== You may produce execution traces of your `awk' programs. This is done -with a specially compiled version of `gawk', called `pgawk' ("profiling -`gawk'"). - - `pgawk' is identical in every way to `gawk', except that when it has -finished running, it creates a profile of your program in a file named -`awkprof.out'. Because it is profiling, it also executes up to 45% +by passing the option `--profile' to `gawk'. When `gawk' has finished +running, it creates a profile of your program in a file named +`awkprof.out'. Because it is profiling, it also executes up to 45% slower than `gawk' normally does. As shown in the following example, the `--profile' option can be -used to change the name of the file where `pgawk' will write the -profile: +used to change the name of the file where `gawk' will write the profile: - pgawk --profile=myprog.prof -f myprog.awk data1 data2 + gawk --profile=myprog.prof -f myprog.awk data1 data2 -In the above example, `pgawk' places the profile in `myprog.prof' +In the above example, `gawk' places the profile in `myprog.prof' instead of in `awkprof.out'. Here is a sample session showing a simple `awk' program, its input -data, and the results from running `pgawk'. First, the `awk' program: +data, and the results from running `gawk' with the `--profile' option. +First, the `awk' program: BEGIN { print "First BEGIN rule" } @@ -14210,9 +14531,9 @@ data, and the results from running `pgawk'. First, the `awk' program: foo junk - Here is the `awkprof.out' that results from running `pgawk' on this -program and data (this example also illustrates that `awk' programmers -sometimes have to work late): + Here is the `awkprof.out' that results from running the `gawk' +profiler on this program and data (this example also illustrates that +`awk' programmers sometimes have to work late): # gawk profile, created Sun Aug 13 00:00:15 2000 @@ -14301,14 +14622,14 @@ output. They are as follows: redirection. Similarly, if the target of a redirection isn't a scalar, it gets parenthesized. - * `pgawk' supplies leading comments in front of the `BEGIN' and - `END' rules, the pattern/action rules, and the functions. + * `gawk' supplies leading comments in front of the `BEGIN' and `END' + rules, the pattern/action rules, and the functions. The profiled version of your program may not look exactly like what -you typed when you wrote it. This is because `pgawk' creates the +you typed when you wrote it. This is because `gawk' creates the profiled version by "pretty printing" its internal representation of -the program. The advantage to this is that `pgawk' can produce a +the program. The advantage to this is that `gawk' can produce a standard representation. The disadvantage is that all source-code comments are lost, as are the distinctions among multiple `BEGIN', `END', `BEGINFILE', and `ENDFILE' rules. Also, things such as: @@ -14323,21 +14644,23 @@ come out as: which is correct, but possibly surprising. - Besides creating profiles when a program has completed, `pgawk' can + Besides creating profiles when a program has completed, `gawk' can produce a profile while it is running. This is useful if your `awk' program goes into an infinite loop and you want to see what has been -executed. To use this feature, run `pgawk' in the background: +executed. To use this feature, run `gawk' with the `--profile' option +in the background: - $ pgawk -f myprog & + $ gawk --profile -f myprog & [1] 13992 The shell prints a job number and process ID number; in this case, -13992. Use the `kill' command to send the `USR1' signal to `pgawk': +13992. Use the `kill' command to send the `USR1' signal to `gawk': $ kill -USR1 13992 As usual, the profiled version of the program is written to -`awkprof.out', or to a different file if you use the `--profile' option. +`awkprof.out', or to a different file if one specified with the +`--profile' option. Along with the regular profile, as shown earlier, the profile includes a trace of any active functions: @@ -14349,22 +14672,22 @@ includes a trace of any active functions: # 1. foo # -- main -- - You may send `pgawk' the `USR1' signal as many times as you like. + You may send `gawk' the `USR1' signal as many times as you like. Each time, the profile and function call trace are appended to the output profile file. - If you use the `HUP' signal instead of the `USR1' signal, `pgawk' + If you use the `HUP' signal instead of the `USR1' signal, `gawk' produces the profile and the function call trace and then exits. - When `pgawk' runs on MS-Windows systems, it uses the `INT' and -`QUIT' signals for producing the profile and, in the case of the `INT' -signal, `pgawk' exits. This is because these systems don't support the -`kill' command, so the only signals you can deliver to a program are -those generated by the keyboard. The `INT' signal is generated by the + When `gawk' runs on MS-Windows systems, it uses the `INT' and `QUIT' +signals for producing the profile and, in the case of the `INT' signal, +`gawk' exits. This is because these systems don't support the `kill' +command, so the only signals you can deliver to a program are those +generated by the keyboard. The `INT' signal is generated by the `Ctrl-<C>' or `Ctrl-<BREAK>' key, while the `QUIT' signal is generated by the `Ctrl-<\>' key. - Finally, regular `gawk' also accepts the `--profile' option. When + Finally, `gawk' also accepts another option `--pretty-print'. When called this way, `gawk' "pretty prints" the program into `awkprof.out', without any execution counts. @@ -14541,7 +14864,7 @@ programming use. * Ordinal Functions:: Functions for using characters as numbers and vice versa. * Join Function:: A function to join an array into a string. -* Gettimeofday Function:: A function to get formatted times. +* Getlocaltime Function:: A function to get formatted times. File: gawk.info, Node: Strtonum Function, Next: Assert Function, Up: General Functions @@ -14887,7 +15210,7 @@ tests such as used here prohibitively expensive. extensions, you can simplify `_ord_init' to loop from 0 to 255. -File: gawk.info, Node: Join Function, Next: Gettimeofday Function, Prev: Ordinal Functions, Up: General Functions +File: gawk.info, Node: Join Function, Next: Getlocaltime Function, Prev: Ordinal Functions, Up: General Functions 12.2.6 Merging an Array into a String ------------------------------------- @@ -14934,7 +15257,7 @@ concatenation. The lack of an explicit operator for concatenation makes string operations more difficult than they really need to be. -File: gawk.info, Node: Gettimeofday Function, Prev: Join Function, Up: General Functions +File: gawk.info, Node: Getlocaltime Function, Prev: Join Function, Up: General Functions 12.2.7 Managing the Time of Day ------------------------------- @@ -14945,11 +15268,11 @@ with the time of day in human readable form. While `strftime()' is extensive, the control formats are not necessarily easy to remember or intuitively obvious when reading a program. - The following function, `gettimeofday()', populates a user-supplied + The following function, `getlocaltime()', populates a user-supplied array with preformatted time information. It returns a string with the current time formatted in the same way as the `date' utility: - # gettimeofday.awk --- get the time of day in a usable format + # getlocaltime.awk --- get the time of day in a usable format # Returns a string in the format of output of date(1) # Populates the array argument time with individual values: @@ -14973,7 +15296,7 @@ current time formatted in the same way as the `date' utility: # time["weeknum"] -- week number, Sunday first day # time["altweeknum"] -- week number, Monday first day - function gettimeofday(time, ret, now, i) + function getlocaltime(time, ret, now, i) { # get time once, avoids unnecessary system calls now = systime() @@ -15012,7 +15335,7 @@ current time formatted in the same way as the `date' utility: The string indices are easier to use and read than the various formats required by `strftime()'. The `alarm' program presented in *note Alarm Program::, uses this function. A more general design for -the `gettimeofday()' function would have allowed the user to supply an +the `getlocaltime()' function would have allowed the user to supply an optional timestamp value to use instead of the current time. @@ -17443,8 +17766,8 @@ prints the message on the standard output. In addition, you can give it the number of times to repeat the message as well as a delay between repetitions. - This program uses the `gettimeofday()' function from *note -Gettimeofday Function::. + This program uses the `getlocaltime()' function from *note +Getlocaltime Function::. All the work is done in the `BEGIN' rule. The first part is argument checking and setting of defaults: the delay, the count, and the message @@ -17459,7 +17782,7 @@ Statement::), but the processing could be done with a series of # alarm.awk --- set an alarm # - # Requires gettimeofday() library function + # Requires getlocaltime() library function # usage: alarm time [ "message" [ count [ delay ] ] ] BEGIN \ @@ -17515,7 +17838,7 @@ alarm: minute = atime[2] + 0 # force numeric # get current broken down time - gettimeofday(now) + getlocaltime(now) # if time given is 12-hour hours and it's after that # hour, e.g., `alarm 5:30' at 9 a.m. means 5:30 p.m., @@ -18741,47 +19064,48 @@ supplies the following copyright terms: We leave it to you to determine what the program does. -File: gawk.info, Node: Debugger, Next: Language History, Prev: Sample Programs, Up: Top +File: gawk.info, Node: Debugger, Next: Arbitrary Precision Arithmetic, Prev: Sample Programs, Up: Top -14 `dgawk': The `awk' Debugger -****************************** +14 Debugging `awk' Programs +*************************** It would be nice if computer programs worked perfectly the first time they were run, but in real life, this rarely happens for programs of any complexity. Thus, most programming languages have facilities available for "debugging" programs, and now `awk' is no exception. - The `dgawk' debugger is purposely modeled after the GNU Debugger + The `gawk' debugger is purposely modeled after the GNU Debugger (GDB) (http://www.gnu.org/software/gdb/) command-line debugger. If you -are familiar with GDB, learning `dgawk' is easy. +are familiar with GDB, learning how to use `gawk' for debugging your +program is easy. * Menu: -* Debugging:: Introduction to `dgawk'. -* Sample dgawk session:: Sample `dgawk' session. -* List of Debugger Commands:: Main `dgawk' Commands. -* Readline Support:: Readline Support. -* Dgawk Limitations:: Limitations and future plans. +* Debugging:: Introduction to `gawk' debugger. +* Sample Debugging Session:: Sample debugging session. +* List of Debugger Commands:: Main debugger commands. +* Readline Support:: Readline support. +* Limitations:: Limitations and future plans. -File: gawk.info, Node: Debugging, Next: Sample dgawk session, Up: Debugger +File: gawk.info, Node: Debugging, Next: Sample Debugging Session, Up: Debugger -14.1 Introduction to `dgawk' -============================ +14.1 Introduction to `gawk' Debugger +==================================== This minor node introduces debugging in general and begins the discussion of debugging in `gawk'. * Menu: -* Debugging Concepts:: Debugging In General. +* Debugging Concepts:: Debugging in General. * Debugging Terms:: Additional Debugging Concepts. * Awk Debugging:: Awk Debugging. File: gawk.info, Node: Debugging Concepts, Next: Debugging Terms, Up: Debugging -14.1.1 Debugging In General +14.1.1 Debugging in General --------------------------- (If you have used debuggers in other languages, you may want to skip @@ -18825,9 +19149,8 @@ File: gawk.info, Node: Debugging Terms, Next: Awk Debugging, Prev: Debugging ------------------------------------ Before diving in to the details, we need to introduce several important -concepts that apply to just about all debuggers, including `dgawk'. -The following list defines terms used throughout the rest of this -major node. +concepts that apply to just about all debuggers. The following list +defines terms used throughout the rest of this major node. "Stack Frame" Programs generally call functions during the course of their @@ -18845,11 +19168,11 @@ major node. needed to manage the call stack. This data area is termed a "stack frame". - `gawk' also follows this model, and `dgawk' gives you access to - the call stack and to each stack frame. You can see the call - stack, as well as from where each function on the stack was - invoked. Commands that print the call stack print information about - each stack frame (as detailed later on). + `gawk' also follows this model, and gives you access to the call + stack and to each stack frame. You can see the call stack, as well + as from where each function on the stack was invoked. Commands + that print the call stack print information about each stack frame + (as detailed later on). "Breakpoint" During debugging, you often wish to let the program run until it @@ -18894,54 +19217,57 @@ individual primitive instructions carried out by the higher-level `awk' commands. -File: gawk.info, Node: Sample dgawk session, Next: List of Debugger Commands, Prev: Debugging, Up: Debugger +File: gawk.info, Node: Sample Debugging Session, Next: List of Debugger Commands, Prev: Debugging, Up: Debugger -14.2 Sample `dgawk' session -=========================== +14.2 Sample Debugging Session +============================= -In order to illustrate the use of `dgawk', let's look at a sample -debugging session. We will use the `awk' implementation of the POSIX -`uniq' command described earlier (*note Uniq Program::) as our example. +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 +POSIX `uniq' command described earlier (*note Uniq Program::) as our +example. * Menu: -* dgawk invocation:: `dgawk' Invocation. -* Finding The Bug:: Finding The Bug. +* Debugger Invocation:: How to Start the Debugger. +* Finding The Bug:: Finding the Bug. -File: gawk.info, Node: dgawk invocation, Next: Finding The Bug, Up: Sample dgawk session +File: gawk.info, Node: Debugger Invocation, Next: Finding The Bug, Up: Sample Debugging Session -14.2.1 `dgawk' Invocation -------------------------- +14.2.1 How to Start the Debugger +-------------------------------- -Starting `dgawk' is exactly like running `awk'. The file(s) containing -the program and any supporting code are given on the command line as -arguments to one or more `-f' options. (`dgawk' is not designed to -debug command-line programs, only programs contained in files.) In our -case, we call `dgawk' like this: +Starting the debugger is almost exactly like running `awk', 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 the debugger like +this: - $ dgawk -f getopt.awk -f join.awk -f uniq.awk inputfile + $ gawk -D -f getopt.awk -f join.awk -f uniq.awk inputfile 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 `dgawk', the -arguments for running the program are given in the command line to the -debugger rather than as part of the `run' command at the debugger +slightly different from what they are used to. With `gawk' debugger, +the arguments for running the program are given in the command line to +the debugger rather than as part of the `run' command at the debugger prompt.) Instead of immediately running the program on `inputfile', as `gawk' -would ordinarily do, `dgawk' merely loads all the program source files, -compiles them internally, and then gives us a prompt: +would ordinarily do, the debugger merely loads all the program source +files, compiles them internally, and then gives us a prompt: - dgawk> + gawk> from which we can issue commands to the debugger. At this point, no code has been executed. -File: gawk.info, Node: Finding The Bug, Prev: dgawk invocation, Up: Sample dgawk session +File: gawk.info, Node: Finding The Bug, Prev: Debugger Invocation, Up: Sample Debugging Session -14.2.2 Finding The Bug +14.2.2 Finding the Bug ---------------------- Let's say that we are having a problem using (a faulty version of) @@ -18971,27 +19297,27 @@ for a breakpoint in `uniq.awk' is at the beginning of the function `are_equal()', which compares the current line with the previous one. To set the breakpoint, use the `b' (breakpoint) command: - dgawk> b are_equal + gawk> b are_equal -| Breakpoint 1 set at file `awklib/eg/prog/uniq.awk', line 64 The debugger tells us the file and line number where the breakpoint is. Now type `r' or `run' and the program runs until it hits the breakpoint for the first time: - dgawk> r + gawk> r -| Starting program: -| Stopping in Rule ... -| Breakpoint 1, are_equal(n, m, clast, cline, alast, aline) at `awklib/eg/prog/uniq.awk':64 -| 64 if (fcount == 0 && charcount == 0) - dgawk> + gawk> Now we can look at what's going on inside our program. First of all, let's see how we got to where we are. At the prompt, we type `bt' -(short for "backtrace"), and `dgawk' responds with a listing of the -current stack frames: +(short for "backtrace"), and the debugger responds with a listing of +the current stack frames: - dgawk> bt + gawk> bt -| #0 are_equal(n, m, clast, cline, alast, aline) at `awklib/eg/prog/uniq.awk':69 -| #1 in main() at `awklib/eg/prog/uniq.awk':89 @@ -19005,9 +19331,9 @@ the key to finding the source of the problem.) Now that we're in `are_equal()', we can start looking at the values of some variables. Let's say we type `p n' (`p' is short for "print"). We would expect to see the value of `n', a parameter to `are_equal()'. -Actually, `dgawk' gives us: +Actually, the debugger gives us: - dgawk> p n + gawk> p n -| n = untyped variable In this case, `n' is an uninitialized local variable, since the @@ -19015,13 +19341,13 @@ function was called without arguments (*note Function Calls::). A more useful variable to display might be the current record: - dgawk> p $0 + gawk> p $0 -| $0 = string ("gawk is a wonderful program!") This might be a bit puzzling at first since this is the second line of our test input above. Let's look at `NR': - dgawk> p NR + gawk> p NR -| NR = number (2) So we can see that `are_equal()' was only called for the second record @@ -19035,7 +19361,7 @@ for `NR == 1': OK, let's just check that that rule worked correctly: - dgawk> p last + gawk> p last -| last = string ("awk is a wonderful program!") Everything we have done so far has verified that the program has @@ -19044,7 +19370,7 @@ the problem must be inside this function. To investigate further, we must begin "stepping through" the lines of `are_equal()'. We start by typing `n' (for "next"): - dgawk> n + gawk> n -| 67 if (fcount > 0) { This tells us that `gawk' is now ready to execute line 67, which @@ -19060,15 +19386,15 @@ was false.) Continuing to step, we now get to the splitting of the current and last records: - dgawk> n + gawk> n -| 68 n = split(last, alast) - dgawk> n + gawk> n -| 69 m = split($0, aline) At this point, we should be curious to see what our records were split into, so we try to look: - dgawk> p n m alast aline + gawk> p n m alast aline -| n = number (5) -| m = number (5) -| alast = array, 5 elements @@ -19084,19 +19410,19 @@ want to see inside the array? The first choice would be to use subscripts: - dgawk> p alast[0] + gawk> p alast[0] -| "0" not in array `alast' Oops! - dgawk> p alast[1] + gawk> p alast[1] -| alast["1"] = string ("awk") - This would be kind of slow for a 100-member array, though, so -`dgawk' provides a shortcut (reminiscent of another language not to be + This would be kind of slow for a 100-member array, though, so `gawk' +provides a shortcut (reminiscent of another language not to be mentioned): - dgawk> p @alast + gawk> p @alast -| alast["1"] = string ("awk") -| alast["2"] = string ("is") -| alast["3"] = string ("a") @@ -19105,9 +19431,9 @@ mentioned): It looks like we got this far OK. Let's take another step or two: - dgawk> n + gawk> n -| 70 clast = join(alast, fcount, n) - dgawk> n + gawk> n -| 71 cline = join(aline, fcount, m) Well, here we are at our error (sorry to spoil the suspense). What @@ -19115,7 +19441,7 @@ 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: - dgawk> p cline clast + gawk> p cline clast -| cline = string ("gawk is a wonderful program!") -| clast = string ("awk is a wonderful program!") @@ -19123,9 +19449,9 @@ zero, this would work. Let's look at what we've got: 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 `dgawk': + We get out of the debugger: - dgawk> q + gawk> q -| The program is running. Exit anyway (y/n)? y Then we get into an editor: @@ -19136,12 +19462,13 @@ Then we get into an editor: and problem solved! -File: gawk.info, Node: List of Debugger Commands, Next: Readline Support, Prev: Sample dgawk session, Up: Debugger +File: gawk.info, Node: List of Debugger Commands, Next: Readline Support, Prev: Sample Debugging Session, Up: Debugger -14.3 Main `dgawk' Commands -========================== +14.3 Main Debugger Commands +=========================== -The `dgawk' command set can be divided into the following categories: +The `gawk' debugger command set can be divided into the following +categories: * Breakpoint control @@ -19157,26 +19484,26 @@ The `dgawk' command set can be divided into the following categories: Each of these are discussed in the following subsections. In the following descriptions, commands which may be abbreviated show the -abbreviation on a second description line. A `dgawk' command name may -also be truncated if that partial name is unambiguous. `dgawk' has the -built-in capability to automatically repeat the previous command when -just hitting <Enter>. This works for the commands `list', `next', +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 +when just hitting <Enter>. This works for the commands `list', `next', `nexti', `step', `stepi' and `continue' executed without any argument. * Menu: -* Breakpoint Control:: Control of breakpoints. -* Dgawk Execution Control:: Control of execution. -* Viewing And Changing Data:: Viewing and changing data. -* Dgawk Stack:: Dealing with the stack. -* Dgawk Info:: Obtaining information about the program and - the debugger state. -* Miscellaneous Dgawk Commands:: Miscellaneous Commands. +* Breakpoint Control:: Control of Breakpoints. +* Debugger Execution Control:: Control of Execution. +* Viewing And Changing Data:: Viewing and Changing Data. +* Execution Stack:: Dealing with the Stack. +* Debugger Info:: Obtaining Information about the Program and + the Debugger State. +* Miscellaneous Debugger Commands:: Miscellaneous Commands. -File: gawk.info, Node: Breakpoint Control, Next: Dgawk Execution Control, Up: List of Debugger Commands +File: gawk.info, Node: Breakpoint Control, Next: Debugger Execution Control, Up: List of Debugger Commands -14.3.1 Control Of Breakpoints +14.3.1 Control of Breakpoints ----------------------------- As we saw above, the first thing you probably want to do in a debugging @@ -19204,10 +19531,10 @@ controlling breakpoints are: 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 `dgawk' + `awk' expression (enclosed in double quotes) that the debugger evaluates whenever the breakpoint is reached. If the condition is - true, then `dgawk' stops execution and prompts for a command. - Otherwise, `dgawk' continues executing the program. + true, then the debugger stops execution and prompts for a command. + Otherwise, it continues executing the program. `clear' [[FILENAME`:']N | FUNCTION] Without any argument, delete any breakpoint at the next instruction @@ -19229,12 +19556,13 @@ controlling breakpoints are: `condition' N `"EXPRESSION"' Add a condition to existing breakpoint or watchpoint N. The - condition is an `awk' expression that `dgawk' evaluates whenever - the breakpoint or watchpoint is reached. If the condition is true, - then `dgawk' stops execution and prompts for a command. Otherwise, - `dgawk' continues executing the program. If the condition - expression is not specified, any existing condition is removed; - i.e., the breakpoint or watchpoint is made unconditional. + condition is an `awk' expression that the debugger evaluates + whenever the breakpoint or watchpoint is reached. If the condition + is true, then the debugger stops execution and prompts for a + command. Otherwise, the debugger continues executing the program. + If the condition expression is not specified, any existing + condition is removed; i.e., the breakpoint or watchpoint is made + unconditional. `delete' [N1 N2 ...] [N-M] `d' [N1 N2 ...] [N-M] @@ -19268,7 +19596,7 @@ controlling breakpoints are: arguments are the same as for `break'. -File: gawk.info, Node: Dgawk Execution Control, Next: Viewing And Changing Data, Prev: Breakpoint Control, Up: List of Debugger Commands +File: gawk.info, Node: Debugger Execution Control, Next: Viewing And Changing Data, Prev: Breakpoint Control, Up: List of Debugger Commands 14.3.2 Control of Execution --------------------------- @@ -19291,14 +19619,14 @@ execution of the program than we saw in our earlier example: `continue') terminates the list (an implicit `end'), and subsequent commands are ignored. For example: - dgawk> commands + gawk> commands > silent > printf "A silent breakpoint; i = %d\n", i > info locals > set i = 10 > continue > end - dgawk> + gawk> `continue' [COUNT] `c' [COUNT] @@ -19331,9 +19659,9 @@ execution of the program than we saw in our earlier example: `run' `r' - Start/restart execution of the program. When restarting, `dgawk' - retains the current breakpoints, watchpoints, command history, - automatic display variables, and debugger options. + Start/restart execution of the program. When restarting, the + debugger retains the current breakpoints, watchpoints, command + history, automatic display variables, and debugger options. `step' [COUNT] `s' [COUNT] @@ -19348,7 +19676,7 @@ execution of the program than we saw in our earlier example: Execute one (or COUNT) instruction(s), stepping inside function calls. (For illustration of what is meant by an "instruction" in `gawk', see the output shown under `dump' in *note Miscellaneous - Dgawk Commands::.) + Debugger Commands::.) `until' [[FILENAME`:']N | FUNCTION] `u' [[FILENAME`:']N | FUNCTION] @@ -19358,7 +19686,7 @@ execution of the program than we saw in our earlier example: current stack frame returns. -File: gawk.info, Node: Viewing And Changing Data, Next: Dgawk Stack, Prev: Dgawk Execution Control, Up: List of Debugger Commands +File: gawk.info, Node: Viewing And Changing Data, Next: Execution Stack, Prev: Debugger Execution Control, Up: List of Debugger Commands 14.3.3 Viewing and Changing Data -------------------------------- @@ -19370,7 +19698,7 @@ The commands for viewing and changing variables inside of `gawk' are: of the variable or field is displayed each time the program stops. Each variable added to the list is identified by a unique number: - dgawk> display x + gawk> display x -| 10: x = 1 displays the assigned item number, the variable name and its @@ -19398,7 +19726,7 @@ AWK STATEMENTS Print the value of a `gawk' variable or field. Fields must be referenced by constants: - dgawk> print $3 + gawk> print $3 This prints the third field in the input record (if the specified field does not exist, it prints `Null field'). A variable can be @@ -19426,16 +19754,16 @@ AWK STATEMENTS `watch' VAR | `$'N [`"EXPRESSION"'] `w' VAR | `$'N [`"EXPRESSION"'] - Add variable VAR (or field `$N') to the watch list. `dgawk' 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 `unwatch' command. + 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 + it from the watch list using the `unwatch' command. With a watchpoint, you may also supply a condition. This is an - `awk' expression (enclosed in double quotes) that `dgawk' + `awk' expression (enclosed in double quotes) that the debugger evaluates whenever the watchpoint is reached. If the condition is - true, then `dgawk' stops execution and prompts for a command. - Otherwise, `dgawk' continues executing the program. + true, then the debugger stops execution and prompts for a command. + Otherwise, `gawk' continues executing the program. `undisplay' [N] Remove item number N (or all items, if no argument) from the @@ -19447,9 +19775,9 @@ AWK STATEMENTS -File: gawk.info, Node: Dgawk Stack, Next: Dgawk Info, Prev: Viewing And Changing Data, Up: List of Debugger Commands +File: gawk.info, Node: Execution Stack, Next: Debugger Info, Prev: Viewing And Changing Data, Up: List of Debugger Commands -14.3.4 Dealing With The Stack +14.3.4 Dealing with the Stack ----------------------------- Whenever you run a program which contains any function calls, `gawk' @@ -19484,16 +19812,17 @@ are: frame. Then select and print the frame. -File: gawk.info, Node: Dgawk Info, Next: Miscellaneous Dgawk Commands, Prev: Dgawk Stack, Up: List of Debugger Commands +File: gawk.info, Node: Debugger Info, Next: Miscellaneous Debugger Commands, Prev: Execution Stack, Up: List of Debugger Commands -14.3.5 Obtaining Information About The Program and The Debugger State +14.3.5 Obtaining Information about the Program and the Debugger State --------------------------------------------------------------------- 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. `dgawk' has one command which 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: +debugging environment itself. The `gawk' debugger has one command which +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: `info' WHAT `i' WHAT @@ -19521,10 +19850,10 @@ of a number of arguments that tell it exactly what you want to know: `source' The name of the current source file. Each time the program stops, the current source file is the file containing the - current instruction. When `dgawk' first starts, the current - source file is the first file included via the `-f' option. - The `list FILENAME:LINENO' command can be used at any time to - change the current source. + current instruction. When the debugger first starts, the + current source file is the first file included via the `-f' + option. The `list FILENAME:LINENO' command can be used at any + time to change the current source. `sources' List all program sources. @@ -19548,7 +19877,7 @@ from a file. The commands are: `history_size' The maximum number of lines to keep in the history file - `./.dgawk_history'. The default is 100. + `./.gawk_history'. The default is 100. `listsize' The number of lines that `list' prints. The default is 15. @@ -19559,14 +19888,14 @@ from a file. The commands are: standard output. `prompt' - The debugger prompt. The default is `dgawk> '. + The debugger prompt. The default is `gawk> '. `save_history [on | off]' - Save command history to file `./.dgawk_history'. The default + Save command history to file `./.gawk_history'. The default is `on'. `save_options [on | off]' - Save current options to file `./.dgawkrc' upon exit. The + Save current options to file `./.gawkrc' upon exit. The default is `on'. Options are read back in to the next session upon startup. @@ -19584,15 +19913,15 @@ from a file. The commands are: ignored; they do _not_ repeat the last command. You can't restart the program by having more than one `run' command in the file. Also, the list of commands may include additional `source' - commands; however, `dgawk' will not source the same file more than - once in order to avoid infinite recursion. + 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 - the `-R FILE' or `--command=FILE' command-line options to execute + the `-D FILE' or `--debug=FILE' command-line options to execute commands from a file non-interactively (*note Options::. -File: gawk.info, Node: Miscellaneous Dgawk Commands, Prev: Dgawk Info, Up: List of Debugger Commands +File: gawk.info, Node: Miscellaneous Debugger Commands, Prev: Debugger Info, Up: List of Debugger Commands 14.3.6 Miscellaneous Commands ----------------------------- @@ -19608,7 +19937,7 @@ categories, as follows: partial dump of Davide Brini's obfuscated code (*note Signature Program::) demonstrates: - dgawk> dump + gawk> dump -| # BEGIN -| -| [ 2:0x89faef4] Op_rule : [in_rule = BEGIN] [source_file = brini.awk] @@ -19657,13 +19986,13 @@ categories, as follows: -| [ :0x89fa3b0] Op_after_beginfile : -| [ :0x89fa388] Op_no_op : -| [ :0x89fa3c4] Op_after_endfile : - dgawk> + gawk> `help' `h' - Print a list of all of the `dgawk' commands with a short summary - of their usage. `help COMMAND' prints the information about the - command COMMAND. + Print a list of all of the `gawk' debugger commands with a short + summary of their usage. `help COMMAND' prints the information + about the command COMMAND. `list' [`-' | `+' | N | FILENAME`:'N | N-M | FUNCTION] `l' [`-' | `+' | N | FILENAME`:'N | N-M | FUNCTION] @@ -19697,7 +20026,7 @@ categories, as follows: 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 above, - if you are running a program, `dgawk' warns you if you + 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. @@ -19712,12 +20041,12 @@ categories, as follows: -File: gawk.info, Node: Readline Support, Next: Dgawk Limitations, Prev: List of Debugger Commands, Up: Debugger +File: gawk.info, Node: Readline Support, Next: Limitations, Prev: List of Debugger Commands, Up: Debugger 14.4 Readline Support ===================== -If `dgawk' is compiled with the `readline' library, you can take +If `gawk' is compiled with the `readline' library, you can take advantage of that library's command completion and history expansion features. The following types of completion are available: @@ -19739,27 +20068,27 @@ Variable name completion -File: gawk.info, Node: Dgawk Limitations, Prev: Readline Support, Up: Debugger +File: gawk.info, Node: Limitations, Prev: Readline Support, Up: Debugger 14.5 Limitations and Future Plans ================================= -We hope you find `dgawk' 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: +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: - * At this point, `dgawk' does not give a detailed explanation of + * 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. Rather, it just responds `syntax error'. When you do figure out what your mistake was, though, you'll feel like a real guru. - * If you perused the dump of opcodes in *note Miscellaneous Dgawk + * If you perused the dump of opcodes in *note Miscellaneous Debugger 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', etc., are the "bread and butter" of most `gawk' code. - Unfortunately, as of now, `dgawk' does not allow you to examine - the stack's contents. + 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 @@ -19772,20 +20101,1474 @@ limitations. A few which are worth being aware of are: expressions to see if you got it right. As an `awk' programmer, you are expected to know what `/[^[:alnum:][:blank:]]/' means. - * `dgawk' is designed to be used by running a program (with all its - parameters) on the command line, as described in *note dgawk - 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 programs. + * 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 + programs. - * `dgawk' only accepts source supplied with the `-f' option. + * The `gawk' debugger only accepts source supplied with the `-f' + option. Look forward to a future release when these and other missing features may be added, and of course feel free to try to add them yourself! -File: gawk.info, Node: Language History, Next: Installation, Prev: Debugger, Up: Top +File: gawk.info, Node: Arbitrary Precision Arithmetic, Next: Dynamic Extensions, Prev: Debugger, Up: Top + +15 Arithmetic and Arbitrary Precision Arithmetic with `gawk' +************************************************************ + + There's a credibility gap: We don't know how much of the + computer's answers to believe. Novice computer users solve this + problem by implicitly trusting in the computer as an infallible + authority; they tend to believe that all digits of a printed + answer are significant. Disillusioned computer users have just the + opposite approach; they are constantly afraid that their answers + are almost meaningless. + Donald Knuth(1) + + This major node discusses issues that you may encounter when +performing arithmetic. It begins by discussing some of the general +attributes of computer arithmetic, along with how this can influence +what you see when running `awk' programs. This discussion applies to +all versions of `awk'. + + Then the major node moves on to "arbitrary precision arithmetic", a +feature which is specific to `gawk'. + +* Menu: + +* General Arithmetic:: An introduction to computer arithmetic. +* Floating-point Programming:: Effective Floating-point Programming. +* Gawk and MPFR:: How `gawk' provides + arbitrary-precision arithmetic. +* Arbitrary Precision Floats:: Arbitrary Precision Floating-point Arithmetic + with `gawk'. +* Arbitrary Precision Integers:: Arbitrary Precision Integer Arithmetic with + `gawk'. + + ---------- Footnotes ---------- + + (1) Donald E. Knuth. `The Art of Computer Programming'. Volume 2, +`Seminumerical Algorithms', third edition, 1998, ISBN 0-201-89683-4, p. +229. + + +File: gawk.info, Node: General Arithmetic, Next: Floating-point Programming, Up: Arbitrary Precision Arithmetic + +15.1 A General Description of Computer Arithmetic +================================================= + +Within computers, there are two kinds of numeric values: "integers" and +"floating-point". In school, integer values were referred to as +"whole" numbers--that is, numbers without any fractional part, such as +1, 42, or -17. The advantage to integer numbers is that they represent +values exactly. The disadvantage is that their range is limited. On +most systems, this range is -2,147,483,648 to 2,147,483,647. However, +many systems now support a range from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807. + + Integer values come in two flavors: "signed" and "unsigned". Signed +values may be negative or positive, with the range of values just +described. Unsigned values are always positive. On most systems, the +range is from 0 to 4,294,967,295. However, many systems now support a +range from 0 to 18,446,744,073,709,551,615. + + Floating-point numbers represent what are called "real" numbers; +i.e., those that do have a fractional part, such as 3.1415927. The +advantage to floating-point numbers is that they can represent a much +larger range of values. The disadvantage is that there are numbers +that they cannot represent exactly. `awk' uses "double precision" +floating-point numbers, which can hold more digits than "single +precision" floating-point numbers. + + There a several important issues to be aware of, described next. + +* Menu: + +* Floating Point Issues:: Stuff to know about floating-point numbers. +* Integer Programming:: Effective integer programming. + + +File: gawk.info, Node: Floating Point Issues, Next: Integer Programming, Up: General Arithmetic + +15.1.1 Floating-Point Number Caveats +------------------------------------ + +This minor node describes some of the issues involved in using +floating-point numbers. + + 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 +if you are interested in the details, but it does require a background +in computer science. + +* Menu: + +* String Conversion Precision:: The String Value Can Lie. +* Unexpected Results:: Floating Point Numbers Are Not Abstract + Numbers. +* POSIX Floating Point Problems:: Standards Versus Existing Practice. + + +File: gawk.info, Node: String Conversion Precision, Next: Unexpected Results, Up: Floating Point Issues + +15.1.1.1 The String Value Can Lie +................................. + +Internally, `awk' keeps both the numeric value (double precision +floating-point) and the string value for a variable. Separately, `awk' +keeps track of what type the variable has (*note Typing and +Comparison::), which plays a role in how variables are used in +comparisons. + + It is important to note that the string value for a number may not +reflect the full value (all the digits) that the numeric value actually +contains. The following program (`values.awk') illustrates this: + + { + sum = $1 + $2 + # see it for what it is + printf("sum = %.12g\n", sum) + # use CONVFMT + a = "<" sum ">" + print "a =", a + # use OFMT + print "sum =", sum + } + +This program shows the full value of the sum of `$1' and `$2' using +`printf', and then prints the string values obtained from both +automatic conversion (via `CONVFMT') and from printing (via `OFMT'). + + Here is what happens when the program is run: + + $ echo 3.654321 1.2345678 | awk -f values.awk + -| sum = 4.8888888 + -| a = <4.88889> + -| sum = 4.88889 + + This makes it clear that the full numeric value is different from +what the default string representations show. + + `CONVFMT''s default value is `"%.6g"', which yields a value with at +least six significant digits. For some applications, you might want to +change it to specify more precision. On most modern machines, most of +the time, 17 digits is enough to capture a floating-point number's +value exactly.(1) + + ---------- Footnotes ---------- + + (1) Pathological cases can require up to 752 digits (!), but we +doubt that you need to worry about this. + + +File: gawk.info, Node: Unexpected Results, Next: POSIX Floating Point Problems, Prev: String Conversion Precision, Up: Floating Point Issues + +15.1.1.2 Floating Point Numbers Are Not Abstract Numbers +........................................................ + +Unlike numbers in the abstract sense (such as what you studied in high +school or college arithmetic), numbers stored in computers are limited +in certain ways. They cannot represent an infinite number of digits, +nor can they always represent things exactly. In particular, +floating-point numbers cannot always represent values exactly. Here is +an example: + + $ awk '{ printf("%010d\n", $1 * 100) }' + 515.79 + -| 0000051579 + 515.80 + -| 0000051579 + 515.81 + -| 0000051580 + 515.82 + -| 0000051582 + Ctrl-d + +This shows that some values can be represented exactly, whereas others +are only approximated. This is not a "bug" in `awk', but simply an +artifact of how computers represent numbers. + + NOTE: It cannot be emphasized enough that the behavior just + described is fundamental to modern computers. You will see this + kind of thing happen in _any_ programming language using hardware + floating-point numbers. It is _not_ a bug in `gawk', nor is it + something that can be "just fixed." + + Another peculiarity of floating-point numbers on modern systems is +that they often have more than one representation for the number zero! +In particular, it is possible to represent "minus zero" as well as +regular, or "positive" zero. + + This example shows that negative and positive zero are distinct +values when stored internally, but that they are in fact equal to each +other, as well as to "regular" zero: + + $ gawk 'BEGIN { mz = -0 ; pz = 0 + > printf "-0 = %g, +0 = %g, (-0 == +0) -> %d\n", mz, pz, mz == pz + > printf "mz == 0 -> %d, pz == 0 -> %d\n", mz == 0, pz == 0 + > }' + -| -0 = -0, +0 = 0, (-0 == +0) -> 1 + -| mz == 0 -> 1, pz == 0 -> 1 + + It helps to keep this in mind should you process numeric data that +contains negative zero values; the fact that the zero is negative is +noted and can affect comparisons. + + +File: gawk.info, Node: POSIX Floating Point Problems, Prev: Unexpected Results, Up: Floating Point Issues + +15.1.1.3 Standards Versus Existing Practice +........................................... + +Historically, `awk' has converted any non-numeric 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 +(base 8) or hexadecimal numbers (base 16). + + Changes in the language of the 2001 and 2004 POSIX standards can be +interpreted to imply that `awk' should support additional features. +These features are: + + * Interpretation of floating point data values specified in + hexadecimal notation (`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 + ("-inf"). In particular, the format for these values is as + specified by the ISO 1999 C standard, which ignores case and can + allow machine-dependent additional characters after the `nan' and + allow either `inf' or `infinity'. + + The first problem is that both of these are clear changes to +historical practice: + + * The `gawk' maintainer feels that supporting hexadecimal floating + point values, in particular, is ugly, and was never intended by the + original designers to be part of the language. + + * Allowing completely alphabetic strings to have valid numeric + 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 +"language lawyering" to arrive at in the first place, was not even +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 the above 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" +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 +as follows: + + * With the `--posix' command-line option, `gawk' becomes "hands + off." String values are passed directly to the system library's + `strtod()' function, and if it successfully returns a numeric + value, that is what's used.(1) By definition, the results are not + portable across different systems. They are also a little + surprising: + + $ echo nanny | gawk --posix '{ print $1 + 0 }' + -| nan + $ echo 0xDeadBeef | gawk --posix '{ print $1 + 0 }' + -| 3735928559 + + * Without `--posix', `gawk' interprets the four strings `+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 + floating point is not supported (unless you also use + `--non-decimal-data', which is _not_ recommended). For example: + + $ echo nanny | gawk '{ print $1 + 0 }' + -| 0 + $ echo +nan | gawk '{ print $1 + 0 }' + -| nan + $ echo 0xDeadBeef | gawk '{ print $1 + 0 }' + -| 0 + + `gawk' does ignore case in the four special values. Thus `+nan' + and `+NaN' are the same. + + ---------- Footnotes ---------- + + (1) You asked for it, you got it. + + +File: gawk.info, Node: Integer Programming, Prev: Floating Point Issues, Up: General Arithmetic + +15.1.2 Mixing Integers And Floating-point +----------------------------------------- + +As has been mentioned already, `gawk' ordinarily uses hardware double +precision with 64-bit IEEE binary floating-point representation for +numbers on most systems. A large integer like 9,007,199,254,740,997 has +a binary representation that, although finite, is more than 53 bits +long; it must also be rounded to 53 bits. The biggest integer that can +be stored in a C `double' is usually the same as the largest possible +value of a `double'. If your system `double' is an IEEE 64-bit +`double', this largest possible value is an integer and can be +represented precisely. What more should one know about integers? + + If you want to know what is the largest integer, such that it and +all smaller integers can be stored in 64-bit doubles without losing +precision, then the answer is 2^53. The next representable number is +the even number 2^53 + 2, meaning it is unlikely that you will be able +to make `gawk' print 2^53 + 1 in integer format. The range of integers +exactly representable by a 64-bit double is [-2^53, 2^53]. If you ever +see an integer outside this range in `gawk' using 64-bit doubles, you +have reason to be very suspicious about the accuracy of the output. +Here is a simple program with erroneous output: + + $ gawk 'BEGIN { i = 2^53 - 1; for (j = 0; j < 4; j++) print i + j }' + -| 9007199254740991 + -| 9007199254740992 + -| 9007199254740992 + -| 9007199254740994 + + The lesson is to not assume that any large integer printed by `gawk' +represents an exact result from your computation, especially if it wraps +around on your screen. + + +File: gawk.info, Node: Floating-point Programming, Next: Gawk and MPFR, Prev: General Arithmetic, Up: Arbitrary Precision Arithmetic + +15.2 Understanding Floating-point Programming +============================================= + +Numerical programming is an extensive area; if you need to develop +sophisticated numerical algorithms then `gawk' may not be the ideal +tool, and this documentation may not be sufficient. It might require +digesting a book or two to really internalize how to compute with ideal +accuracy and precision, and the result often depends on the particular +application. + + NOTE: A floating-point calculation's "accuracy" is how close it + comes to the real value. This is as opposed to the "precision", + which usually refers to the number of bits used to represent the + number (see the Wikipedia article + (http://en.wikipedia.org/wiki/Accuracy_and_precision) for more + information). + + There are two options for doing floating-point calculations: +hardware floating-point (as used by standard `awk' and the default for +`gawk'), and "arbitrary-precision" floating-point, which is software +based. From this point forward, this major node aims to provide enough +information to understand both, and then will focus on `gawk''s +facilities for the latter.(1) + + Binary floating-point representations and arithmetic are inexact. +Simple values like 0.1 cannot be precisely represented using binary +floating-point numbers, and the limited precision of floating-point +numbers means that slight changes in the order of operations or the +precision of intermediate storage can change the result. To make +matters worse, with arbitrary precision floating-point, you can set the +precision before starting a computation, but then you cannot be sure of +the number of significant decimal places in the final result. + + Sometimes, before you start to write any code, you should think more +about what you really want and what's really happening. Consider the +two numbers in the following example: + + x = 0.875 # 1/2 + 1/4 + 1/8 + y = 0.425 + + Unlike the number in `y', the number stored in `x' is exactly +representable in binary since it can be written as a finite sum of one +or more fractions whose denominators are all powers of two. When +`gawk' reads a floating-point number from program source, it +automatically rounds that number to whatever precision your machine +supports. If you try to print the numeric content of a variable using +an output format string of `"%.17g"', it may not produce the same +number as you assigned to it: + + $ gawk 'BEGIN { x = 0.875; y = 0.425 + > printf("%0.17g, %0.17g\n", x, y) }' + -| 0.875, 0.42499999999999999 + + 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 +previous example, produces an output identical to the input. + + Because the underlying representation can be a little bit off from +the exact value, comparing floating-point values to see if they are +equal is generally not a good idea. Here is an example where it does +not work like you expect: + + $ gawk 'BEGIN { print (0.1 + 12.2 == 12.3) }' + -| 0 + + 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, +the error can accumulate and greatly affect the computation itself. +Here is an attempt to compute the value of the constant pi using one of +its many series representations: + + BEGIN { + x = 1.0 / sqrt(3.0) + n = 6 + for (i = 1; i < 30; i++) { + n = n * 2.0 + x = (sqrt(x * x + 1) - 1) / x + printf("%.15f\n", n * x) + } + } + + When run, the early errors propagating through later computations +cause the loop to terminate prematurely after an attempt to divide by +zero. + + $ gawk -f pi.awk + -| 3.215390309173475 + -| 3.159659942097510 + -| 3.146086215131467 + -| 3.142714599645573 + ... + -| 3.224515243534819 + -| 2.791117213058638 + -| 0.000000000000000 + error--> gawk: pi.awk:6: fatal: division by zero attempted + + Here is an additional example where the inaccuracies in internal +representations yield an unexpected result: + + $ gawk 'BEGIN { + > for (d = 1.1; d <= 1.5; d += 0.1) + > i++ + > print i + > }' + -| 4 + + Can computation using arbitrary precision help with the previous +examples? If you are impatient to know, see *note Exact Arithmetic::. + + Instead of arbitrary precision floating-point arithmetic, often all +you need is an adjustment of your logic or a different order for the +operations in your calculation. The stability and the accuracy of the +computation of the constant pi in the previous example can be enhanced +by using the following simple algebraic transformation: + + (sqrt(x * x + 1) - 1) / x = x / (sqrt(x * x + 1) + 1) + +After making this, change the program does converge to pi in under 30 +iterations: + + $ gawk -f /tmp/pi2.awk + -| 3.215390309173473 + -| 3.159659942097501 + -| 3.146086215131436 + -| 3.142714599645370 + -| 3.141873049979825 + ... + -| 3.141592653589797 + -| 3.141592653589797 + + 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, 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 in the end if you simply round the display of your +final results to the correct number of significant decimal digits. + + As general advice, avoid presenting numerical data in a manner that +implies better precision than is actually the case. + +* Menu: + +* Floating-point Representation:: Binary floating-point representation. +* Floating-point Context:: Floating-point context. +* Rounding Mode:: Floating-point rounding mode. + + ---------- Footnotes ---------- + + (1) If you are interested in other tools that perform arbitrary +precision arithmetic, you may want to investigate the POSIX `bc' tool. +See the POSIX specification for it +(http://pubs.opengroup.org/onlinepubs/009695399/utilities/bc.html), for +more information. + + +File: gawk.info, Node: Floating-point Representation, Next: Floating-point Context, Up: Floating-point Programming + +15.2.1 Binary Floating-point Representation +------------------------------------------- + +Although floating-point representations vary from machine to machine, +the most commonly encountered representation is that defined by the +IEEE 754 Standard. An IEEE-754 format value has three components: + + * A sign bit telling whether the number is positive or negative. + + * An "exponent", E, giving its order of magnitude. + + * A "significand", S, specifying the actual digits of the number. + + The value of the number is then S * 2^E. The first bit of a +non-zero binary significand is always one, so the significand in an +IEEE-754 format only includes the fractional part, leaving the leading +one implicit. The significand is stored in "normalized" format, which +means that the first bit is always a one. + + Three of the standard IEEE-754 types are 32-bit single precision, +64-bit double precision and 128-bit quadruple precision. The standard +also specifies extended precision formats to allow greater precisions +and larger exponent ranges. + + +File: gawk.info, Node: Floating-point Context, Next: Rounding Mode, Prev: Floating-point Representation, Up: Floating-point Programming + +15.2.2 Floating-point Context +----------------------------- + +A floating-point "context" defines the environment for arithmetic +operations. It governs precision, sets rules for rounding, and limits +the range for exponents. The context has the following primary +components: + +"Precision" + Precision of the floating-point format in bits. + +"emax" + Maximum exponent allowed for this format. + +"emin" + Minimum exponent allowed for this format. + +"Underflow behavior" + The format may or may not support gradual underflow. + +"Rounding" + The rounding mode of this context. + + *note table-ieee-formats:: lists the precision and exponent field +values for the basic IEEE-754 binary formats: + +Name Total bits Precision emin emax +--------------------------------------------------------------------------- +Single 32 24 -126 +127 +Double 64 53 -1022 +1023 +Quadruple 128 113 -16382 +16383 + +Table 15.1: Basic IEEE Format Context Values + + NOTE: The precision numbers include the implied leading one that + gives them one extra bit of significand. + + A floating-point context can also determine which signals are treated +as exceptions, and can set rules for arithmetic with special values. +Please consult the IEEE-754 standard or other resources for details. + + `gawk' ordinarily uses the hardware double precision representation +for numbers. On most systems, this is IEEE-754 floating-point format, +corresponding to 64-bit binary with 53 bits of precision. + + NOTE: In case an underflow occurs, the standard allows, but does + not require, the result from an arithmetic operation to be a + number smaller than the smallest nonzero normalized number. Such + numbers do not have as many significant digits as normal numbers, + and are called "denormals" or "subnormals". The alternative, + simply returning a zero, is called "flush to zero". The basic + IEEE-754 binary formats support subnormal numbers. + + +File: gawk.info, Node: Rounding Mode, Prev: Floating-point Context, Up: Floating-point Programming + +15.2.3 Floating-point Rounding Mode +----------------------------------- + +The "rounding mode" specifies the behavior for the results of numerical +operations when discarding extra precision. Each rounding mode indicates +how the least significant returned digit of a rounded result is to be +calculated. *note table-rounding-modes:: lists the IEEE-754 defined +rounding modes: + +Rounding Mode IEEE Name +-------------------------------------------------------------------------- +Round to nearest, ties to even `roundTiesToEven' +Round toward plus Infinity `roundTowardPositive' +Round toward negative Infinity `roundTowardNegative' +Round toward zero `roundTowardZero' +Round to nearest, ties away `roundTiesToAway' +from zero + +Table 15.2: IEEE 754 Rounding Modes + + The default mode `roundTiesToEven' is the most preferred, but the +least intuitive. This method does the obvious thing for most values, by +rounding them up or down to the nearest digit. For example, rounding +1.132 to two digits yields 1.13, and rounding 1.157 yields 1.16. + + However, when it comes to rounding a value that is exactly halfway +between, things do not work the way you probably learned in school. In +this case, the number is rounded to the nearest even digit. So +rounding 0.125 to two digits rounds down to 0.12, but rounding 0.6875 +to three digits rounds up to 0.688. You probably have already +encountered this rounding mode when using the `printf' routine to +format floating-point numbers. For example: + + BEGIN { + x = -4.5 + for (i = 1; i < 10; i++) { + x += 1.0 + printf("%4.1f => %2.0f\n", x, x) + } + } + +produces the following output when run:(1) + + -3.5 => -4 + -2.5 => -2 + -1.5 => -2 + -0.5 => 0 + 0.5 => 0 + 1.5 => 2 + 2.5 => 2 + 3.5 => 4 + 4.5 => 4 + + The theory behind the rounding mode `roundTiesToEven' is that it +more or less evenly distributes upward and downward rounds of exact +halves, which might cause the round-off error to cancel itself out. +This is the default rounding mode used in IEEE-754 computing functions +and operators. + + The other rounding modes are rarely used. Round toward positive +infinity (`roundTowardPositive') and round 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 used for +converting floating-point numbers to integers. The rounding mode +`roundTiesToAway' rounds the result to the nearest number and selects +the number with the larger magnitude if a tie occurs. + + Some numerical analysts will tell you that your choice of rounding +style has tremendous impact on the final outcome, and advise you to +wait until final output for any rounding. Instead, you can often avoid +round-off error problems by setting the precision initially to some +value sufficiently larger than the final desired precision, so that the +accumulation of round-off error does not influence the outcome. If you +suspect that results from your computation are sensitive to +accumulation of round-off error, one way to be sure is to look for a +significant difference in output when you change the rounding mode. + + ---------- Footnotes ---------- + + (1) It is possible for the output to be completely different if the +C library in your system does not use the IEEE-754 even-rounding rule +to round halfway cases for `printf()'. + + +File: gawk.info, Node: Gawk and MPFR, Next: Arbitrary Precision Floats, Prev: Floating-point Programming, Up: Arbitrary Precision Arithmetic + +15.3 `gawk' + MPFR = Powerful Arithmetic +======================================== + +The rest of this major node describes how to use the arbitrary precision +(also known as "multiple precision" or "infinite precision") numeric +capabilities in `gawk' to produce maximally accurate results when you +need it. + + But first you should check if your version of `gawk' supports +arbitrary precision arithmetic. The easiest way to find out is to look +at the output of the following command: + + $ gawk --version + -| GNU Awk 4.1.0 (GNU MPFR 3.1.0, GNU MP 5.0.3) + -| Copyright (C) 1989, 1991-2012 Free Software Foundation. + ... + + `gawk' uses the GNU MPFR (http://www.mpfr.org) and GNU MP +(http://gmplib.org) (GMP) libraries for arbitrary precision arithmetic +on numbers. So if you do not see the names of these libraries in the +output, then your version of `gawk' does not support arbitrary +precision arithmetic. + + Additionally, there are a few elements available in the `PROCINFO' +array to provide information about the MPFR and GMP libraries. *Note +Auto-set::, for more information. + + +File: gawk.info, Node: Arbitrary Precision Floats, Next: Arbitrary Precision Integers, Prev: Gawk and MPFR, Up: Arbitrary Precision Arithmetic + +15.4 Arbitrary Precision Floating-point Arithmetic with `gawk' +============================================================== + +`gawk' uses the GNU MPFR library for arbitrary precision floating-point +arithmetic. The MPFR library provides precise control over precisions +and rounding modes, and gives correctly rounded, reproducible, +platform-independent results. With the command-line option `--bignum' +or `-M', all floating-point arithmetic operators and numeric functions +can yield results to any desired precision level supported by MPFR. +Two built-in variables, `PREC' and `ROUNDMODE', provide control over +the working precision and the rounding mode (*note Setting Precision::, +and *note Setting Rounding Mode::). The precision and the rounding +mode are set globally for every operation to follow. + + The default working precision for arbitrary precision floating-point +values is 53, and the default value for `ROUNDMODE' is `"N"', which +selects the IEEE-754 `roundTiesToEven' rounding mode (*note Rounding +Mode::).(1) `gawk' uses the default exponent range in MPFR (EMAX = 2^30 +- 1, EMIN = -EMAX) for all floating-point contexts. There is no +explicit mechanism to adjust the exponent range. MPFR does not +implement subnormal numbers by default, and this behavior cannot be +changed in `gawk'. + + NOTE: When emulating an IEEE-754 format (*note Setting + Precision::), `gawk' internally adjusts the exponent range to the + value defined for the format and also performs computations needed + for gradual underflow (subnormal numbers). + + NOTE: MPFR numbers are variable-size entities, consuming only as + much space as needed to store the significant digits. Since the + performance using MPFR numbers pales in comparison to doing + arithmetic using the underlying machine types, you should consider + using only as much precision as needed by your program. + +* Menu: + +* Setting Precision:: Setting the working precision. +* Setting Rounding Mode:: Setting the rounding mode. +* Floating-point Constants:: Representing floating-point constants. +* Changing Precision:: Changing the precision of a number. +* Exact Arithmetic:: Exact arithmetic with floating-point numbers. + + ---------- Footnotes ---------- + + (1) The default precision is 53, since according to the MPFR +documentation, the library should be able to exactly reproduce all +computations with double-precision machine floating-point numbers +(`double' type in C), except the default exponent range is much wider +and subnormal numbers are not implemented. + + +File: gawk.info, Node: Setting Precision, Next: Setting Rounding Mode, Up: Arbitrary Precision Floats + +15.4.1 Setting the Working Precision +------------------------------------ + +`gawk' uses a global working precision; it does not keep track of the +precision or accuracy of individual numbers. Performing an arithmetic +operation or calling a built-in function rounds the result to the +current working precision. The default working precision is 53, which +can be modified using the built-in variable `PREC'. You can also set the +value to one of the following pre-defined case-insensitive strings to +emulate an IEEE-754 binary format: + +`PREC' IEEE-754 Binary Format +--------------------------------------------------- +`"half"' 16-bit half-precision. +`"single"' Basic 32-bit single precision. +`"double"' Basic 64-bit double precision. +`"quad"' Basic 128-bit quadruple precision. +`"oct"' 256-bit octuple precision. + + The following example illustrates the effects of changing precision +on arithmetic operations: + + $ gawk -M -v PREC=100 'BEGIN { x = 1.0e-400; print x + 0; \ + > PREC = "double"; print x + 0 }' + -| 1e-400 + -| 0 + + Binary and decimal precisions are related approximately, according +to the formula: + + PREC = 3.322 * DPS + +Here, PREC denotes the binary precision (measured in bits) and DPS +(short for decimal places) is the decimal digits. We can easily +calculate how many decimal digits the 53-bit significand of an IEEE +double is equivalent to: 53 / 3.332 which is equal to about 15.95. But +what does 15.95 digits actually mean? It depends whether you are +concerned about how many digits you can rely on, or how many digits you +need. + + It is important to know how many bits it takes to uniquely identify +a double-precision value (the C type `double'). If you want to convert +from `double' to decimal and back to `double' (e.g., saving a `double' +representing an intermediate result to a file, and later reading it +back to restart the computation), then a few more decimal digits are +required. 17 digits is generally enough for a `double'. + + It can also be important to know what decimal numbers can be uniquely +represented with a `double'. If you want to convert from decimal to +`double' and back again, 15 digits is the most that you can get. Stated +differently, you should not present the numbers from your +floating-point computations with more than 15 significant digits in +them. + + Conversely, it takes a precision of 332 bits to hold an approximation +of the constant pi that is accurate to 100 decimal places. + + You should always add some extra bits in order to avoid the +confusing round-off issues that occur because numbers are stored +internally in binary. + + +File: gawk.info, Node: Setting Rounding Mode, Next: Floating-point Constants, Prev: Setting Precision, Up: Arbitrary Precision Floats + +15.4.2 Setting the Rounding Mode +-------------------------------- + +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' +--------------------------------------------------------------------------- +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 zero `roundTowardZero' `"Z"' or `"z"' +Round to nearest, ties away `roundTiesToAway' `"A"' or `"a"' +from zero + +Table 15.3: `gawk' Rounding Modes + + `ROUNDMODE' has the default value `"N"', which selects the IEEE-754 +rounding mode `roundTiesToEven'. *note Table 15.3: +table-gawk-rounding-modes, lists `"A"' to select the IEEE-754 mode +`roundTiesToAway'. This is only available if your version of the MPFR +library supports it; otherwise setting `ROUNDMODE' to this value has no +effect. *Note Rounding Mode::, for the meanings of the various rounding +modes. + + Here is an example of how to change the default rounding behavior of +`printf''s output: + + $ gawk -M -v ROUNDMODE="Z" 'BEGIN { printf("%.2f\n", 1.378) }' + -| 1.37 + + +File: gawk.info, Node: Floating-point Constants, Next: Changing Precision, Prev: Setting Rounding Mode, Up: Arbitrary Precision Floats + +15.4.3 Representing Floating-point Constants +-------------------------------------------- + +Be wary of floating-point constants! When reading a floating-point +constant from program source code, `gawk' uses the default precision, +unless overridden by an assignment to the special variable `PREC' on +the command line, to store it internally as a MPFR number. Changing +the precision using `PREC' in the program text does _not_ change the +precision of a constant. If you need to represent a floating-point +constant at a higher precision than the default and cannot use a +command line assignment to `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: + + $ 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 + + In the first case, the number is stored with the default precision +of 53. + + +File: gawk.info, Node: Changing Precision, Next: Exact Arithmetic, Prev: Floating-point Constants, Up: Arbitrary Precision Floats + +15.4.4 Changing the Precision of a Number +----------------------------------------- + + The point is that in any variable-precision package, a decision is + made on how to treat numbers given as data, or arising in + intermediate results, which are represented in floating-point + format to a precision lower than working precision. Do we promote + them to full membership of the high-precision club, or do we treat + them and all their associates as second-class citizens? Sometimes + the first course is proper, sometimes the second, and it takes + careful analysis to tell which. + + Dirk Laurie(1) + + `gawk' does not implicitly modify the precision of any previously +computed results when the working precision is changed with an +assignment to `PREC'. The precision of a number is always the one that +was used at the time of its creation, and there is no way for the user +to explicitly change it afterwards. However, since the result of a +floating-point arithmetic operation is always an arbitrary precision +floating-point value--with a precision set by the value of `PREC'--one +of the following workarounds effectively accomplishes the desired +behavior: + + x = x + 0.0 + +or: + + x += 0.0 + + ---------- Footnotes ---------- + + (1) Dirk Laurie. `Variable-precision Arithmetic Considered Perilous +-- A Detective Story'. Electronic Transactions on Numerical Analysis. +Volume 28, pp. 168-173, 2008. + + +File: gawk.info, Node: Exact Arithmetic, Prev: Changing Precision, Up: Arbitrary Precision Floats + +15.4.5 Exact Arithmetic with Floating-point Numbers +--------------------------------------------------- + + CAUTION: Never depend on the exactness of floating-point + arithmetic, even for apparently simple expressions! + + Can arbitrary precision arithmetic give exact results? There are 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 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 +they are not equal! (*Note Floating-point Programming::.) You can get +the result you want by increasing the precision; 56 in this case will +get the job done: + + $ gawk -M -v PREC=56 'BEGIN { print (0.1 + 12.2 == 12.3) }' + -| 1 + + If adding more bits is good, perhaps adding even more bits of +precision is better? Here is what happens if we use an even larger +value of `PREC': + + $ gawk -M -v PREC=201 'BEGIN { print (0.1 + 12.2 == 12.3) }' + -| 0 + + This is not a bug in `gawk' or in the MPFR library. It is easy to +forget that the finite number of bits used to store the value is often +just an approximation after proper rounding. The test for equality +succeeds if and only if _all_ bits in the two operands are exactly the +same. Since this is not necessarily true after floating-point +computations with a particular precision and effective rounding rule, a +straight test for equality may not work. + + So, don't assume that floating-point values can be compared for +equality. You should also exercise caution when using other forms of +comparisons. The standard way to compare between floating-point +numbers is to determine how much error (or "tolerance") you will allow +in a comparison and check to see if one value is within this error +range of the other. + + In applications where 15 or fewer decimal places suffice, hardware +double precision arithmetic can be adequate, and is usually much faster. +But you do need to keep in mind that every floating-point operation can +suffer a new rounding error with catastrophic consequences as +illustrated by our earlier attempt to compute the value of the constant +pi (*note Floating-point Programming::). 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 Floating-point +Programming::: + + $ gawk 'BEGIN { + > for (d = 1.1; d <= 1.5; d += 0.1) + > i++ + > print i + > }' + -| 4 + +you may or may not succeed in getting the correct result by choosing an +arbitrarily large value for `PREC'. Reformulation of the problem at +hand is often the correct approach in such situations. + + +File: gawk.info, Node: Arbitrary Precision Integers, Prev: Arbitrary Precision Floats, Up: Arbitrary Precision Arithmetic + +15.5 Arbitrary Precision Integer Arithmetic with `gawk' +======================================================= + +If the option `--bignum' or `-M' is specified, `gawk' performs all +integer arithmetic using GMP arbitrary precision integers. Any number +that looks like an integer in a program source or data file is stored +as an arbitrary precision integer. The size of the integer is limited +only by your computer's memory. The current floating-point context has +no effect on operations involving integers. For example, the following +computes 5^4^3^2, the result of which is beyond the limits of ordinary +`gawk' numbers: + + $ gawk -M 'BEGIN { + > x = 5^4^3^2 + > print "# of digits =", length(x) + > print substr(x, 1, 20), "...", substr(x, length(x) - 19, 20) + > }' + -| # of digits = 183231 + -| 62060698786608744707 ... 92256259918212890625 + + If you were to compute the same value using arbitrary precision +floating-point values instead, the precision needed for 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 +floating-point value is a floating-point value with a precision equal +to the working precision. The following program calculates the eighth +term in Sylvester's sequence(1) using a recurrence: + + $ gawk -M 'BEGIN { + > s = 2.0 + > for (i = 1; i <= 7; i++) + > s = s * (s - 1) + 1 + > print s + > }' + -| 113423713055421845118910464 + + The output differs from the actual number, +113,423,713,055,421,844,361,000,443, because the default precision of +53 is not enough to represent the floating-point results exactly. You +can either increase the precision (100 is enough in this case), or +replace the floating-point constant `2.0' with an integer, to perform +all computations using integer arithmetic to get the correct output. + + It will sometimes be necessary for `gawk' to implicitly convert an +arbitrary precision integer into an arbitrary precision floating-point +value. This is primarily because the MPFR library does not always +provide the relevant 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 like +this: + + gawk -M 'BEGIN { n = 13; print (n + 0.0) % 2.0 }' + + You can avoid this issue altogether by specifying the number as a +floating-point value to begin with: + + gawk -M 'BEGIN { n = 13.0; print n % 2.0 }' + + Note that for the particular example above, there is likely best to +just use the following: + + gawk -M 'BEGIN { n = 13; print n % 2 }' + + ---------- Footnotes ---------- + + (1) Weisstein, Eric W. `Sylvester's Sequence'. From MathWorld--A +Wolfram Web Resource. +`http://mathworld.wolfram.com/SylvestersSequence.html' + + +File: gawk.info, Node: Dynamic Extensions, Next: Language History, Prev: Arbitrary Precision Arithmetic, Up: Top + +16 Writing Extensions for `gawk' +******************************** + +This chapter is a placeholder, pending a rewrite for the new API. Some +of the old bits remain, since they can be partially reused. + + It is possible to add new built-in functions to `gawk' using +dynamically loaded libraries. This facility is available on systems +(such as GNU/Linux) that support the C `dlopen()' and `dlsym()' +functions. This major node describes how to write and use dynamically +loaded extensions for `gawk'. Experience with programming in C or C++ +is necessary when reading this minor node. + + NOTE: When `--sandbox' is specified, extensions are disabled + (*note Options::. + +* Menu: + +* Plugin License:: A note about licensing. +* Sample Library:: A example of new functions. + + +File: gawk.info, Node: Plugin License, Next: Sample Library, Up: Dynamic Extensions + +16.1 Extension Licensing +======================== + +Every dynamic extension should define the global symbol +`plugin_is_GPL_compatible' to assert that it has been licensed under a +GPL-compatible license. If this symbol does not exist, `gawk' will +emit a fatal error and exit. + + The declared type of the symbol should be `int'. It does not need +to be in any allocated section, though. The code merely asserts that +the symbol exists in the global scope. Something like this is enough: + + int plugin_is_GPL_compatible; + + +File: gawk.info, Node: Sample Library, Prev: Plugin License, Up: Dynamic Extensions + +16.2 Example: Directory and File Operation Built-ins +==================================================== + +Two useful functions that are not in `awk' are `chdir()' (so that an +`awk' program can change its directory) and `stat()' (so that an `awk' +program can gather information about a file). This minor node +implements these functions for `gawk' in an external extension library. + +* Menu: + +* Internal File Description:: What the new functions will do. +* Internal File Ops:: The code for internal file operations. +* Using Internal File Ops:: How to use an external extension. + + +File: gawk.info, Node: Internal File Description, Next: Internal File Ops, Up: Sample Library + +16.2.1 Using `chdir()' and `stat()' +----------------------------------- + +This minor node shows how to use the new functions at the `awk' level +once they've been integrated into the running `gawk' interpreter. +Using `chdir()' is very straightforward. It takes one argument, the new +directory to change to: + + ... + newdir = "/home/arnold/funstuff" + ret = chdir(newdir) + if (ret < 0) { + printf("could not change to %s: %s\n", + newdir, ERRNO) > "/dev/stderr" + exit 1 + } + ... + + The return value is negative if the `chdir' failed, and `ERRNO' +(*note Built-in Variables::) is set to a string indicating the error. + + Using `stat()' is a bit more complicated. The C `stat()' function +fills in a structure that has a fair amount of information. The right +way to model this in `awk' is to fill in an associative array with the +appropriate information: + + file = "/home/arnold/.profile" + fdata[1] = "x" # force `fdata' to be an array + ret = stat(file, fdata) + if (ret < 0) { + printf("could not stat %s: %s\n", + file, ERRNO) > "/dev/stderr" + exit 1 + } + printf("size of %s is %d bytes\n", file, fdata["size"]) + + The `stat()' function always clears the data array, even if the +`stat()' fails. It fills in the following elements: + +`"name"' + The name of the file that was `stat()''ed. + +`"dev"' +`"ino"' + The file's device and inode numbers, respectively. + +`"mode"' + The file's mode, as a numeric value. This includes both the file's + type and its permissions. + +`"nlink"' + The number of hard links (directory entries) the file has. + +`"uid"' +`"gid"' + The numeric user and group ID numbers of the file's owner. + +`"size"' + The size in bytes of the file. + +`"blocks"' + The number of disk blocks the file actually occupies. This may not + be a function of the file's size if the file has holes. + +`"atime"' +`"mtime"' +`"ctime"' + The file's last access, modification, and inode update times, + respectively. These are numeric timestamps, suitable for + formatting with `strftime()' (*note Built-in::). + +`"pmode"' + The file's "printable mode." This is a string representation of + the file's type and permissions, such as what is produced by `ls + -l'--for example, `"drwxr-xr-x"'. + +`"type"' + A printable string representation of the file's type. The value + is one of the following: + + `"blockdev"' + `"chardev"' + The file is a block or character device ("special file"). + + `"directory"' + The file is a directory. + + `"fifo"' + The file is a named-pipe (also known as a FIFO). + + `"file"' + The file is just a regular file. + + `"socket"' + The file is an `AF_UNIX' ("Unix domain") socket in the + filesystem. + + `"symlink"' + The file is a symbolic link. + + 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::): + +`"blksize"' + The preferred block size for I/O to the file. This field is not + present on all POSIX-like systems in the C `stat' structure. + +`"linkval"' + If the file is a symbolic link, this element is the name of the + file the link points to (i.e., the value of the link). + +`"rdev"' +`"major"' +`"minor"' + If the file is a block or character device file, then these values + represent the numeric device number and the major and minor + components of that number, respectively. + + +File: gawk.info, Node: Internal File Ops, Next: Using Internal File Ops, Prev: Internal File Description, Up: Sample Library + +16.2.2 C Code for `chdir()' and `stat()' +---------------------------------------- + +Here is the C code for these extensions. They were written for +GNU/Linux. The code needs some more work for complete portability to +other POSIX-compliant systems:(1) + + #include "awk.h" + + #include <sys/sysmacros.h> + + int plugin_is_GPL_compatible; + + /* do_chdir --- provide dynamically loaded chdir() builtin for gawk */ + + static NODE * + do_chdir(int nargs) + { + NODE *newdir; + int ret = -1; + + if (do_lint && nargs != 1) + lintwarn("chdir: called with incorrect number of arguments"); + + newdir = get_scalar_argument(0, FALSE); + + The file includes the `"awk.h"' header file for definitions for the +`gawk' internals. It includes `<sys/sysmacros.h>' for access to the +`major()' and `minor'() macros. + + By convention, for an `awk' function `foo', the function that +implements it is called `do_foo'. The function should take a `int' +argument, usually called `nargs', that represents the number of defined +arguments for the function. The `newdir' variable represents the new +directory to change to, retrieved with `get_scalar_argument()'. Note +that the first argument is numbered zero. + + This code actually accomplishes the `chdir()'. It first forces the +argument to be a string and passes the string value to the `chdir()' +system call. If the `chdir()' fails, `ERRNO' is updated. + + (void) force_string(newdir); + ret = chdir(newdir->stptr); + if (ret < 0) + update_ERRNO_int(errno); + + Finally, the function returns the return value to the `awk' level: + + return make_number((AWKNUM) ret); + } + + The `stat()' built-in 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: + + /* format_mode --- turn a stat mode field into something readable */ + + static char * + format_mode(unsigned long fmode) + { + ... + } + + Next comes the `do_stat()' function. It starts with variable +declarations and argument checking: + + /* do_stat --- provide a stat() function for gawk */ + + static NODE * + do_stat(int nargs) + { + NODE *file, *array, *tmp; + struct stat sbuf; + int ret; + NODE **aptr; + char *pmode; /* printable mode */ + char *type = "unknown"; + + if (do_lint && nargs > 2) + lintwarn("stat: called with too many arguments"); + + Then comes the actual work. First, the function gets the arguments. +Then, it always clears the array. The code use `lstat()' (instead of +`stat()') to get the file information, in case the file is a symbolic +link. If there's an error, it sets `ERRNO' and returns: + + /* file is first arg, array to hold results is second */ + file = get_scalar_argument(0, FALSE); + array = get_array_argument(1, FALSE); + + /* empty out the array */ + assoc_clear(array); + + /* lstat the file, if error, set ERRNO and return */ + (void) force_string(file); + ret = lstat(file->stptr, & sbuf); + if (ret < 0) { + update_ERRNO_int(errno); + return make_number((AWKNUM) ret); + } + + Now comes the tedious part: filling in the array. Only a few of the +calls are shown here, since they all follow the same pattern: + + /* fill in the array */ + aptr = assoc_lookup(array, tmp = make_string("name", 4)); + *aptr = dupnode(file); + unref(tmp); + + aptr = assoc_lookup(array, tmp = make_string("mode", 4)); + *aptr = make_number((AWKNUM) sbuf.st_mode); + unref(tmp); + + aptr = assoc_lookup(array, tmp = make_string("pmode", 5)); + pmode = format_mode(sbuf.st_mode); + *aptr = make_string(pmode, strlen(pmode)); + unref(tmp); + + When done, return the `lstat()' return value: + + + return make_number((AWKNUM) ret); + } + + Finally, it's necessary to provide the "glue" that loads the new +function(s) into `gawk'. By convention, each library has a routine +named `dl_load()' that does the job. The simplest way is to use the +`dl_load_func' macro in `gawkapi.h'. + + And that's it! As an exercise, consider adding functions to +implement system calls such as `chown()', `chmod()', and `umask()'. + + ---------- Footnotes ---------- + + (1) This version is edited slightly for presentation. See +`extension/filefuncs.c' in the `gawk' distribution for the complete +version. + + +File: gawk.info, Node: Using Internal File Ops, Prev: Internal File Ops, Up: Sample Library + +16.2.3 Integrating the Extensions +--------------------------------- + +Now that the code is written, it must be possible to add it at runtime +to the running `gawk' interpreter. First, the code must be compiled. +Assuming that the functions are in a file named `filefuncs.c', and IDIR +is the location of the `gawk' include files, the following steps create +a GNU/Linux shared library: + + $ gcc -fPIC -shared -DHAVE_CONFIG_H -c -O -g -IIDIR filefuncs.c + $ ld -o filefuncs.so -shared filefuncs.o + + Once the library exists, it is loaded by calling the `extension()' +built-in function. This function takes two arguments: the name of the +library to load and the name of a function to call when the library is +first loaded. This function adds the new functions to `gawk'. It +returns the value returned by the initialization function within the +shared library: + + # file testff.awk + BEGIN { + extension("./filefuncs.so", "dl_load") + + chdir(".") # no-op + + data[1] = 1 # force `data' to be an array + print "Info for testff.awk" + ret = stat("testff.awk", data) + print "ret =", ret + for (i in data) + printf "data[\"%s\"] = %s\n", i, data[i] + print "testff.awk modified:", + strftime("%m %d %y %H:%M:%S", data["mtime"]) + + print "\nInfo for JUNK" + ret = stat("JUNK", data) + print "ret =", ret + for (i in data) + printf "data[\"%s\"] = %s\n", i, data[i] + print "JUNK modified:", strftime("%m %d %y %H:%M:%S", data["mtime"]) + } + + Here are the results of running the program: + + $ gawk -f testff.awk + -| Info for testff.awk + -| ret = 0 + -| data["size"] = 607 + -| data["ino"] = 14945891 + -| data["name"] = testff.awk + -| data["pmode"] = -rw-rw-r-- + -| data["nlink"] = 1 + -| data["atime"] = 1293993369 + -| data["mtime"] = 1288520752 + -| data["mode"] = 33204 + -| data["blksize"] = 4096 + -| data["dev"] = 2054 + -| data["type"] = file + -| data["gid"] = 500 + -| data["uid"] = 500 + -| data["blocks"] = 8 + -| data["ctime"] = 1290113572 + -| testff.awk modified: 10 31 10 12:25:52 + -| + -| Info for JUNK + -| ret = -1 + -| JUNK modified: 01 01 70 02:00:00 + + +File: gawk.info, Node: Language History, Next: Installation, Prev: Dynamic Extensions, Up: Top Appendix A The Evolution of the `awk' Language ********************************************** @@ -20074,9 +21857,6 @@ the current version of `gawk'. - The `bindtextdomain()', `dcgettext()' and `dcngettext()' functions for internationalization (*note Programmer i18n::). - - The `extension()' built-in function and the ability to add - new functions dynamically (*note Dynamic Extensions::). - - The `fflush()' function from Brian Kernighan's version of `awk' (*note I/O Functions::). @@ -20091,12 +21871,21 @@ the current version of `gawk'. - The `AWKPATH' environment variable for specifying a path search for the `-f' command-line option (*note Options::). - - The ability to use GNU-style long-named options that start - with `--' and the `--characters-as-bytes', `--compat', - `--dump-variables', `--exec', `--gen-pot', `--lint', - `--lint-old', `--non-decimal-data', `--posix', `--profile', - `--re-interval', `--sandbox', `--source', `--traditional', and - `--use-lc-numeric' options (*note Options::). + - The `AWKLIBPATH' environment variable for specifying a path + 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 + the `--assign', `--bignum', `--characters-as-bytes', + `--copyright', `--debug', `--dump-variables', `--execle', + `--field-separator', `--file', `--gen-pot', `--help', + `--include', `--lint', `--lint-old', `--load', + `--non-decimal-data', `--optimize', `--posix', + `--pretty-print', `--profile', `--re-interval', `--sandbox', + `--source', `--traditional', `--use-lc-numeric', and + `--version' long options (*note Options::). * Support for the following obsolete systems was removed from the code and the documentation for `gawk' version 4.0: @@ -20140,7 +21929,7 @@ Feature BWK Awk Mawk GNU Awk `\x' Escape sequence X X X `RS' as regexp X X `FS' as null string X X X -`/dev/stdin' special file X X X +`/dev/stdin' special file X X `/dev/stdout' special file X X X `/dev/stderr' special file X X X `**' and `**=' operators X X @@ -20325,7 +22114,7 @@ Info file, in approximate chronological order: various PC platforms. * Christos Zoulas provided the `extension()' built-in function for - dynamically adding new modules. + dynamically adding new modules. (This was removed at `gawk' 4.1.) * Ju"rgen Kahrs contributed the initial version of the TCP/IP networking code and documentation, and motivated the inclusion of @@ -20361,7 +22150,7 @@ Info file, in approximate chronological order: Windows32 environments. (This is no longer supported) * John Haque reworked the `gawk' internals to use a byte-code engine, - providing the `dgawk' debugger for `awk' programs. + providing the `gawk' debugger for `awk' programs. * Efraim Yawitz contributed the original text for *note Debugger::. @@ -20856,10 +22645,6 @@ not overwrite it!_ Instead enter the following commands at your prompt The binary distribution may contain a separate file containing additional or more detailed installation instructions. - As of April, 2012, up to date `gawk' binaries for MS Windows are -available from Eli Zaretskii's ports project -(http://sourceforge.net/projects/ezwinports/files/). - File: gawk.info, Node: PC Compiling, Next: PC Testing, Prev: PC Binary Installation, Up: PC Installation @@ -21382,9 +23167,10 @@ Unix `awk' `pawk' Nelson H.F. Beebe at the University of Utah has modified Brian Kernighan's `awk' to provide timing and profiling information. It - is different from `pgawk' (*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 + is different from `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 @@ -21451,8 +23237,6 @@ and maintainers of `gawk'. Everything in it applies specifically to * Compatibility Mode:: How to disable certain `gawk' extensions. * Additions:: Making Additions To `gawk'. -* Dynamic Extensions:: Adding new built-in functions to - `gawk'. * Future Extensions:: New features that may be implemented one day. @@ -21479,7 +23263,7 @@ for the casual user. It probably has not even been compiled into your version of `gawk', since it slows down execution. -File: gawk.info, Node: Additions, Next: Dynamic Extensions, Prev: Compatibility Mode, Up: Notes +File: gawk.info, Node: Additions, Next: Future Extensions, Prev: Compatibility Mode, Up: Notes C.2 Making Additions to `gawk' ============================== @@ -21499,6 +23283,8 @@ as well as any considerations you should bear in mind. `gawk'. * New Ports:: Porting `gawk' to a new operating system. +* Derived Files:: Why derived files are kept in the + `git' repository. File: gawk.info, Node: Accessing The Source, Next: Adding Code, Up: Additions @@ -21526,8 +23312,8 @@ access the repository using: git clone http://git.savannah.gnu.org/r/gawk.git Once you have made changes, you can use `git diff' to produce a -patch, and send that to the `gawk' maintainer; see *note Bugs:: for how -to do that. +patch, and send that to the `gawk' maintainer; see *note Bugs::, for +how to do that. Finally, if you cannot install Git (e.g., if it hasn't been ported yet to your operating system), you can use the Git-CVS gateway to check @@ -21610,9 +23396,9 @@ possible to include your changes: of `switch' statements, instead of just the plain pointer or character value. - * Use the `TRUE', `FALSE' and `NULL' symbolic constants and the - character constant `'\0'' where appropriate, instead of `1' - and `0'. + * Use `true', `false' for `bool' values, the `NULL' symbolic + constant for pointer values, and the character constant + `'\0'' where appropriate, instead of `1' and `0'. * Provide one-line descriptive comments for each function. @@ -21648,9 +23434,10 @@ possible to include your changes: 7. Submit changes as unified diffs. Use `diff -u -r -N' to compare the original `gawk' source tree with your version. I recommend - using the GNU version of `diff'. Send the output produced by - either run of `diff' to me when you submit your changes. (*Note - Bugs::, for the electronic mail information.) + using the GNU version of `diff', or best of all, `git diff' or + `git format-patch'. Send the output produced by `diff' to me when + you submit your changes. (*Note Bugs::, for the electronic mail + information.) Using this format makes it easy for me to apply your changes to the master version of the `gawk' source code (using `patch'). If I @@ -21667,7 +23454,7 @@ isn't possible for me to do that with a minimum of extra work, then I probably will not. -File: gawk.info, Node: New Ports, Prev: Adding Code, Up: Additions +File: gawk.info, Node: New Ports, Next: Derived Files, Prev: Adding Code, Up: Additions C.2.3 Porting `gawk' to a New Operating System ---------------------------------------------- @@ -21749,627 +23536,152 @@ code that is already there. style and brace layout that suits your taste. -File: gawk.info, Node: Dynamic Extensions, Next: Future Extensions, Prev: Additions, Up: Notes - -C.3 Adding New Built-in Functions to `gawk' -=========================================== - - Danger Will Robinson! Danger!! - Warning! Warning! - The Robot - - It is possible to add new built-in functions to `gawk' using -dynamically loaded libraries. This facility is available on systems -(such as GNU/Linux) that support the C `dlopen()' and `dlsym()' -functions. This minor node describes how to write and use dynamically -loaded extensions for `gawk'. Experience with programming in C or C++ -is necessary when reading this minor node. - - CAUTION: The facilities described in this minor node are very much - subject to change in a future `gawk' release. Be aware that you - may have to re-do everything, at some future time. - - If you have written your own dynamic extensions, be sure to - recompile them for each new `gawk' release. There is no guarantee - of binary compatibility between different releases, nor will there - ever be such a guarantee. - - NOTE: When `--sandbox' is specified, extensions are disabled - (*note Options::. - -* Menu: - -* Internals:: A brief look at some `gawk' internals. -* Plugin License:: A note about licensing. -* Sample Library:: A example of new functions. - - -File: gawk.info, Node: Internals, Next: Plugin License, Up: Dynamic Extensions - -C.3.1 A Minimal Introduction to `gawk' Internals ------------------------------------------------- - -The truth is that `gawk' was not designed for simple extensibility. -The facilities for adding functions using shared libraries work, but -are something of a "bag on the side." Thus, this tour is brief and -simplistic; would-be `gawk' hackers are encouraged to spend some time -reading the source code before trying to write extensions based on the -material presented here. Of particular note are the files `awk.h', -`builtin.c', and `eval.c'. Reading `awkgram.y' in order to see how the -parse tree is built would also be of use. - - With the disclaimers out of the way, the following types, structure -members, functions, and macros are declared in `awk.h' and are of use -when writing extensions. The next minor node shows how they are used: - -`AWKNUM' - An `AWKNUM' is the internal type of `awk' floating-point numbers. - Typically, it is a C `double'. - -`NODE' - Just about everything is done using objects of type `NODE'. These - contain both strings and numbers, as well as variables and arrays. - -`AWKNUM force_number(NODE *n)' - This macro forces a value to be numeric. It returns the actual - numeric value contained in the node. It may end up calling an - internal `gawk' function. - -`void force_string(NODE *n)' - This macro guarantees that a `NODE''s string value is current. It - may end up calling an internal `gawk' function. It also - guarantees that the string is zero-terminated. - -`void force_wstring(NODE *n)' - Similarly, this macro guarantees that a `NODE''s wide-string value - is current. It may end up calling an internal `gawk' function. - It also guarantees that the wide string is zero-terminated. - -`size_t get_curfunc_arg_count(void)' - This function returns the actual number of parameters passed to - the current function. Inside the code of an extension this can be - used to determine the maximum index which is safe to use with - `get_actual_argument'. If this value is greater than `nargs', the - function was called incorrectly from the `awk' program. - -`nargs' - Inside an extension function, this is the maximum number of - expected parameters, as set by the `make_builtin()' function. - -`n->stptr' -`n->stlen' - The data and length of a `NODE''s string value, respectively. The - string is _not_ guaranteed to be zero-terminated. If you need to - pass the string value to a C library function, save the value in - `n->stptr[n->stlen]', assign `'\0'' to it, call the routine, and - then restore the value. - -`n->wstptr' -`n->wstlen' - The data and length of a `NODE''s wide-string value, respectively. - Use `force_wstring()' to make sure these values are current. - -`n->type' - The type of the `NODE'. This is a C `enum'. Values should be one - of `Node_var', `Node_var_new', or `Node_var_array' for function - parameters. - -`n->vname' - The "variable name" of a node. This is not of much use inside - externally written extensions. - -`void assoc_clear(NODE *n)' - Clears the associative array pointed to by `n'. Make sure that - `n->type == Node_var_array' first. - -`NODE **assoc_lookup(NODE *symbol, NODE *subs, int reference)' - Finds, and installs if necessary, array elements. `symbol' is the - array, `subs' is the subscript. This is usually a value created - with `make_string()' (see below). `reference' should be `TRUE' if - it is an error to use the value before it is created. Typically, - `FALSE' is the correct value to use from extension functions. - -`NODE *make_string(char *s, size_t len)' - Take a C string and turn it into a pointer to a `NODE' that can be - stored appropriately. This is permanent storage; understanding of - `gawk' memory management is helpful. - -`NODE *make_number(AWKNUM val)' - Take an `AWKNUM' and turn it into a pointer to a `NODE' that can - be stored appropriately. This is permanent storage; understanding - of `gawk' memory management is helpful. - -`NODE *dupnode(NODE *n)' - Duplicate a node. In most cases, this increments an internal - reference count instead of actually duplicating the entire `NODE'; - understanding of `gawk' memory management is helpful. - -`void unref(NODE *n)' - This macro releases the memory associated with a `NODE' allocated - with `make_string()' or `make_number()'. Understanding of `gawk' - memory management is helpful. - -`void make_builtin(const char *name, NODE *(*func)(NODE *), int count)' - Register a C function pointed to by `func' as new built-in - function `name'. `name' is a regular C string. `count' is the - maximum number of arguments that the function takes. The function - should be written in the following manner: - - /* do_xxx --- do xxx function for gawk */ - - NODE * - do_xxx(int nargs) - { - ... - } - -`NODE *get_argument(int i)' - This function is called from within a C extension function to get - the `i'-th argument from the function call. The first argument is - argument zero. - -`NODE *get_actual_argument(int i,' -` int optional, int wantarray);' - This function retrieves a particular argument `i'. `wantarray' is - `TRUE' if the argument should be an array, `FALSE' otherwise. If - `optional' is `TRUE', the argument need not have been supplied. - If it wasn't, the return value is `NULL'. It is a fatal error if - `optional' is `TRUE' but the argument was not provided. - -`get_scalar_argument(i, opt)' - This is a convenience macro that calls `get_actual_argument()'. - -`get_array_argument(i, opt)' - This is a convenience macro that calls `get_actual_argument()'. - -`void update_ERRNO(void)' - This function is called from within a C extension function to set - the value of `gawk''s `ERRNO' variable, based on the current value - of the C `errno' global variable. It is provided as a convenience. - -`void update_ERRNO_saved(int errno_saved)' - This function is called from within a C extension function to set - the value of `gawk''s `ERRNO' variable, based on the error value - provided as the argument. It is provided as a convenience. - -`void register_deferred_variable(const char *name, NODE *(*load_func)(void))' - This function is called to register a function to be called when a - reference to an undefined variable with the given name is - encountered. The callback function will never be called if the - variable exists already, so, unless the calling code is running at - program startup, it should first check whether a variable of the - given name already exists. The argument function must return a - pointer to a `NODE' containing the newly created variable. This - function is used to implement the builtin `ENVIRON' and `PROCINFO' - arrays, so you can refer to them for examples. - -`void register_open_hook(void *(*open_func)(IOBUF *))' - This function is called to register a function to be called - whenever a new data file is opened, leading to the creation of an - `IOBUF' structure in `iop_alloc()'. After creating the new - `IOBUF', `iop_alloc()' will call (in reverse order of - registration, so the last function registered is called first) - each open hook until one returns non-`NULL'. If any hook returns - a non-`NULL' value, that value is assigned to the `IOBUF''s - `opaque' field (which will presumably point to a structure - containing additional state associated with the input processing), - and no further open hooks are called. - - The function called will most likely want to set the `IOBUF''s - `get_record' method to indicate that future input records should - be retrieved by calling that method instead of using the standard - `gawk' input processing. - - And the function will also probably want to set the `IOBUF''s - `close_func' method to be called when the file is closed to clean - up any state associated with the input. - - Finally, hook functions should be prepared to receive an `IOBUF' - structure where the `fd' field is set to `INVALID_HANDLE', meaning - that `gawk' was not able to open the file itself. In this case, - the hook function must be able to successfully open the file and - place a valid file descriptor there. - - Currently, for example, the hook function facility is used to - implement the XML parser shared library extension. For more info, - please look in `awk.h' and in `io.c'. - - An argument that is supposed to be an array needs to be handled with -some extra code, in case the array being passed in is actually from a -function parameter. - - The following boilerplate code shows how to do this: - - NODE *the_arg; - - /* assume need 3rd arg, 0-based */ - the_arg = get_array_argument(2, FALSE); - - Again, you should spend time studying the `gawk' internals; don't -just blindly copy this code. - - -File: gawk.info, Node: Plugin License, Next: Sample Library, Prev: Internals, Up: Dynamic Extensions - -C.3.2 Extension Licensing -------------------------- - -Every dynamic extension should define the global symbol -`plugin_is_GPL_compatible' to assert that it has been licensed under a -GPL-compatible license. If this symbol does not exist, `gawk' will -emit a fatal error and exit. - - The declared type of the symbol should be `int'. It does not need -to be in any allocated section, though. The code merely asserts that -the symbol exists in the global scope. Something like this is enough: +File: gawk.info, Node: Derived Files, Prev: New Ports, Up: Additions - int plugin_is_GPL_compatible; - - -File: gawk.info, Node: Sample Library, Prev: Plugin License, Up: Dynamic Extensions - -C.3.3 Example: Directory and File Operation Built-ins ------------------------------------------------------ - -Two useful functions that are not in `awk' are `chdir()' (so that an -`awk' program can change its directory) and `stat()' (so that an `awk' -program can gather information about a file). This minor node -implements these functions for `gawk' in an external extension library. - -* Menu: - -* Internal File Description:: What the new functions will do. -* Internal File Ops:: The code for internal file operations. -* Using Internal File Ops:: How to use an external extension. - - -File: gawk.info, Node: Internal File Description, Next: Internal File Ops, Up: Sample Library - -C.3.3.1 Using `chdir()' and `stat()' -.................................... - -This minor node shows how to use the new functions at the `awk' level -once they've been integrated into the running `gawk' interpreter. -Using `chdir()' is very straightforward. It takes one argument, the new -directory to change to: - - ... - newdir = "/home/arnold/funstuff" - ret = chdir(newdir) - if (ret < 0) { - printf("could not change to %s: %s\n", - newdir, ERRNO) > "/dev/stderr" - exit 1 - } - ... - - The return value is negative if the `chdir' failed, and `ERRNO' -(*note Built-in Variables::) is set to a string indicating the error. - - Using `stat()' is a bit more complicated. The C `stat()' function -fills in a structure that has a fair amount of information. The right -way to model this in `awk' is to fill in an associative array with the -appropriate information: - - file = "/home/arnold/.profile" - fdata[1] = "x" # force `fdata' to be an array - ret = stat(file, fdata) - if (ret < 0) { - printf("could not stat %s: %s\n", - file, ERRNO) > "/dev/stderr" - exit 1 - } - printf("size of %s is %d bytes\n", file, fdata["size"]) - - The `stat()' function always clears the data array, even if the -`stat()' fails. It fills in the following elements: - -`"name"' - The name of the file that was `stat()''ed. - -`"dev"' -`"ino"' - The file's device and inode numbers, respectively. - -`"mode"' - The file's mode, as a numeric value. This includes both the file's - type and its permissions. - -`"nlink"' - The number of hard links (directory entries) the file has. - -`"uid"' -`"gid"' - The numeric user and group ID numbers of the file's owner. - -`"size"' - The size in bytes of the file. - -`"blocks"' - The number of disk blocks the file actually occupies. This may not - be a function of the file's size if the file has holes. - -`"atime"' -`"mtime"' -`"ctime"' - The file's last access, modification, and inode update times, - respectively. These are numeric timestamps, suitable for - formatting with `strftime()' (*note Built-in::). - -`"pmode"' - The file's "printable mode." This is a string representation of - the file's type and permissions, such as what is produced by `ls - -l'--for example, `"drwxr-xr-x"'. +C.2.4 Why Generated Files Are Kept In `git' +------------------------------------------- -`"type"' - A printable string representation of the file's type. The value - is one of the following: +If you look at the `gawk' source in the `git' repository, you will +notice that it includes files that are automatically generated by GNU +infrastructure tools, such as `Makefile.in' from `automake' and even +`configure' from `autoconf'. - `"blockdev"' - `"chardev"' - The file is a block or character device ("special file"). + This is different from many Free Software projects that do not store +the derived files, because that keeps the repository less cluttered, +and it is easier to see the substantive changes when comparing versions +and trying to understand what changed between commits. - `"directory"' - The file is a directory. + However, there are two reasons why the `gawk' maintainer likes to +have everything in the repository. - `"fifo"' - The file is a named-pipe (also known as a FIFO). + First, because it is then easy to reproduce any given version +completely, without relying upon the availability of (older, likely +obsolete, and maybe even impossible to find) other tools. - `"file"' - The file is just a regular file. + As an extreme example, if you ever even think about trying to +compile, oh, say, the V7 `awk', you will discover that not only do you +have to bootstrap the V7 `yacc' to do so, but you also need the V7 +`lex'. And the latter is pretty much impossible to bring up on a +modern GNU/Linux system.(1) - `"socket"' - The file is an `AF_UNIX' ("Unix domain") socket in the - filesystem. + (Or, let's say `gawk' 1.2 required `bison' whatever-it-was in 1989 +and that there was no `awkgram.c' file in the repository. Is there a +guarantee that we could find that `bison' version? Or that _it_ would +build?) - `"symlink"' - The file is a symbolic link. - - 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::): + If the repository has all the generated files, then it's easy to +just check them out and build. (Or _easier_, depending upon how far +back we go. `:-)') -`"blksize"' - The preferred block size for I/O to the file. This field is not - present on all POSIX-like systems in the C `stat' structure. + And that brings us to the second (and stronger) reason why all the +files really need to be in `git'. It boils down to who do you cater +to--the `gawk' developer(s), or the user who just wants to check out a +version and try it out? -`"linkval"' - If the file is a symbolic link, this element is the name of the - file the link points to (i.e., the value of the link). + The `gawk' maintainer wants it to be possible for any interested +`awk' user in the world to just clone the repository, check out the +branch of interest and build it. Without their having to have the +correct version(s) of the autotools.(2) That is the point of the +`bootstrap.sh' file. It touches the various other files in the right +order such that -`"rdev"' -`"major"' -`"minor"' - If the file is a block or character device file, then these values - represent the numeric device number and the major and minor - components of that number, respectively. + # The canonical incantation for building GNU software: + ./bootstrap.sh && ./configure && make - -File: gawk.info, Node: Internal File Ops, Next: Using Internal File Ops, Prev: Internal File Description, Up: Sample Library +will _just work_. -C.3.3.2 C Code for `chdir()' and `stat()' -......................................... + This is extremely important for the `master' and `gawk-X.Y-stable' +branches. -Here is the C code for these extensions. They were written for -GNU/Linux. The code needs some more work for complete portability to -other POSIX-compliant systems:(1) + Further, the `gawk' maintainer would argue that it's also important +for the `gawk' developers. When he tried to check out the `xgawk' +branch(3) to build it, he couldn't. (No `ltmain.sh' file, and he had no +idea how to create it, and that was not the only problem.) - #include "awk.h" + He felt _extremely_ frustrated. With respect to that branch, the +maintainer is no different than Jane User who wants to try to build +`gawk-4.0-stable' or `master' from the repository. - #include <sys/sysmacros.h> + Thus, the maintainer thinks that it's not just important, but +critical, that for any given branch, the above incantation _just works_. - int plugin_is_GPL_compatible; + What are some of the consequences and/or actions to take? - /* do_chdir --- provide dynamically loaded chdir() builtin for gawk */ + 1. We don't mind that there are differing files in the different + branches as a result of different versions of the autotools. - static NODE * - do_chdir(int nargs) - { - NODE *newdir; - int ret = -1; + A. It's the maintainer's job to merge them and he will deal with + it. - if (do_lint && get_curfunc_arg_count() != 1) - lintwarn("chdir: called with incorrect number of arguments"); + B. He is really good at `git diff x y > /tmp/diff1 ; gvim + /tmp/diff1' to remove the diffs that aren't of interest in + order to review code. `:-)' - newdir = get_scalar_argument(0, FALSE); + 2. It would certainly help if everyone used the same versions of the + GNU tools as he does, which in general are the latest released + versions of `automake', `autoconf', `bison', and `gettext'. - The file includes the `"awk.h"' header file for definitions for the -`gawk' internals. It includes `<sys/sysmacros.h>' for access to the -`major()' and `minor'() macros. + A. Installing from source is quite easy. It's how the maintainer + worked for years under Fedora. He had `/usr/local/bin' at + the front of hs `PATH' and just did: - By convention, for an `awk' function `foo', the function that -implements it is called `do_foo'. The function should take a `int' -argument, usually called `nargs', that represents the number of defined -arguments for the function. The `newdir' variable represents the new -directory to change to, retrieved with `get_scalar_argument()'. Note -that the first argument is numbered zero. + wget http://ftp.gnu.org/gnu/PACKAGE/PACKAGE-X.Y.Z.tar.gz + tar -xpzvf PACKAGE-X.Y.Z.tar.gz + cd PACKAGE-X.Y.Z + ./configure && make && make check + make install # as root - This code actually accomplishes the `chdir()'. It first forces the -argument to be a string and passes the string value to the `chdir()' -system call. If the `chdir()' fails, `ERRNO' is updated. + B. These days the maintainer uses Ubuntu 10.11 which is medium + current, but he is already doing the above for `autoconf' and + `bison'. - (void) force_string(newdir); - ret = chdir(newdir->stptr); - if (ret < 0) - update_ERRNO(); - Finally, the function returns the return value to the `awk' level: - return make_number((AWKNUM) ret); - } + Most of the above was originally written by the maintainer to other +`gawk' developers. It raised the objection from one of the developers +"... that anybody pulling down the source from `git' is not an end +user." - The `stat()' built-in 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: + However, this is not true. There are "power `awk' users" who can +build `gawk' (using the magic incantation shown previously) but who +can't program in C. Thus, the major branches should be kept buildable +all the time. - /* format_mode --- turn a stat mode field into something readable */ + It was then suggested that there be a `cron' job to create nightly +tarballs of "the source." Here, the problem is that there are source +trees, corresponding to the various branches! So, nightly tar balls +aren't the answer, especially as the repository can go for weeks +without significant change being introduced. - static char * - format_mode(unsigned long fmode) - { - ... - } + Fortunately, the `git' server can meet this need. For any given +branch named BRANCHNAME, use: - Next comes the `do_stat()' function. It starts with variable -declarations and argument checking: + wget http://git.savannah.gnu.org/cgit/gawk.git/snapshot/gawk-BRANCHNAME.tar.gz - /* do_stat --- provide a stat() function for gawk */ - - static NODE * - do_stat(int nargs) - { - NODE *file, *array, *tmp; - struct stat sbuf; - int ret; - NODE **aptr; - char *pmode; /* printable mode */ - char *type = "unknown"; - - if (do_lint && get_curfunc_arg_count() > 2) - lintwarn("stat: called with too many arguments"); - - Then comes the actual work. First, the function gets the arguments. -Then, it always clears the array. The code use `lstat()' (instead of -`stat()') to get the file information, in case the file is a symbolic -link. If there's an error, it sets `ERRNO' and returns: - - /* file is first arg, array to hold results is second */ - file = get_scalar_argument(0, FALSE); - array = get_array_argument(1, FALSE); - - /* empty out the array */ - assoc_clear(array); - - /* lstat the file, if error, set ERRNO and return */ - (void) force_string(file); - ret = lstat(file->stptr, & sbuf); - if (ret < 0) { - update_ERRNO(); - return make_number((AWKNUM) ret); - } - - Now comes the tedious part: filling in the array. Only a few of the -calls are shown here, since they all follow the same pattern: - - /* fill in the array */ - aptr = assoc_lookup(array, tmp = make_string("name", 4), FALSE); - *aptr = dupnode(file); - unref(tmp); - - aptr = assoc_lookup(array, tmp = make_string("mode", 4), FALSE); - *aptr = make_number((AWKNUM) sbuf.st_mode); - unref(tmp); - - aptr = assoc_lookup(array, tmp = make_string("pmode", 5), FALSE); - pmode = format_mode(sbuf.st_mode); - *aptr = make_string(pmode, strlen(pmode)); - unref(tmp); - - When done, return the `lstat()' return value: - - - return make_number((AWKNUM) ret); - } - - Finally, it's necessary to provide the "glue" that loads the new -function(s) into `gawk'. By convention, each library has a routine -named `dlload()' that does the job: - - /* dlload --- load new builtins in this library */ - - NODE * - dlload(NODE *tree, void *dl) - { - make_builtin("chdir", do_chdir, 1); - make_builtin("stat", do_stat, 2); - return make_number((AWKNUM) 0); - } - - And that's it! As an exercise, consider adding functions to -implement system calls such as `chown()', `chmod()', and `umask()'. +to retrieve a snapshot of the given branch. ---------- Footnotes ---------- - (1) This version is edited slightly for presentation. See -`extension/filefuncs.c' in the `gawk' distribution for the complete -version. - - -File: gawk.info, Node: Using Internal File Ops, Prev: Internal File Ops, Up: Sample Library - -C.3.3.3 Integrating the Extensions -.................................. - -Now that the code is written, it must be possible to add it at runtime -to the running `gawk' interpreter. First, the code must be compiled. -Assuming that the functions are in a file named `filefuncs.c', and IDIR -is the location of the `gawk' include files, the following steps create -a GNU/Linux shared library: - - $ gcc -fPIC -shared -DHAVE_CONFIG_H -c -O -g -IIDIR filefuncs.c - $ ld -o filefuncs.so -shared filefuncs.o - - Once the library exists, it is loaded by calling the `extension()' -built-in function. This function takes two arguments: the name of the -library to load and the name of a function to call when the library is -first loaded. This function adds the new functions to `gawk'. It -returns the value returned by the initialization function within the -shared library: + (1) We tried. It was painful. - # file testff.awk - BEGIN { - extension("./filefuncs.so", "dlload") + (2) There is one GNU program that is (in our opinion) severely +difficult to bootstrap from the `git' repository. For example, on the +author's old (but still working) PowerPC macintosh with Mac OS X 10.5, +it was necessary to bootstrap a ton of software, starting with `git' +itself, in order to try to work with the latest code. It's not +pleasant, and especially on older systems, it's a big waste of time. - chdir(".") # no-op + Starting with the latest tarball was no picnic either. The +maintainers had dropped `.gz' and `.bz2' files and only distribute +`.tar.xz' files. It was necessary to bootstrap `xz' first! - data[1] = 1 # force `data' to be an array - print "Info for testff.awk" - ret = stat("testff.awk", data) - print "ret =", ret - for (i in data) - printf "data[\"%s\"] = %s\n", i, data[i] - print "testff.awk modified:", - strftime("%m %d %y %H:%M:%S", data["mtime"]) - - print "\nInfo for JUNK" - ret = stat("JUNK", data) - print "ret =", ret - for (i in data) - printf "data[\"%s\"] = %s\n", i, data[i] - print "JUNK modified:", strftime("%m %d %y %H:%M:%S", data["mtime"]) - } - - Here are the results of running the program: - - $ gawk -f testff.awk - -| Info for testff.awk - -| ret = 0 - -| data["size"] = 607 - -| data["ino"] = 14945891 - -| data["name"] = testff.awk - -| data["pmode"] = -rw-rw-r-- - -| data["nlink"] = 1 - -| data["atime"] = 1293993369 - -| data["mtime"] = 1288520752 - -| data["mode"] = 33204 - -| data["blksize"] = 4096 - -| data["dev"] = 2054 - -| data["type"] = file - -| data["gid"] = 500 - -| data["uid"] = 500 - -| data["blocks"] = 8 - -| data["ctime"] = 1290113572 - -| testff.awk modified: 10 31 10 12:25:52 - -| - -| Info for JUNK - -| ret = -1 - -| JUNK modified: 01 01 70 02:00:00 + (3) A branch created by one of the other developers that did not +include the generated files. -File: gawk.info, Node: Future Extensions, Prev: Dynamic Extensions, Up: Notes +File: gawk.info, Node: Future Extensions, Prev: Additions, Up: Notes -C.4 Probable Future Extensions +C.3 Probable Future Extensions ============================== AWK is a language similar to PERL, only considerably more elegant. @@ -22386,12 +23698,9 @@ well. Following is a list of probable future changes visible at the `awk' language level: -Loadable module interface - It is not clear that the `awk'-level interface to the modules - facility is as good as it should be. The interface needs to be - redesigned, particularly taking namespace issues into account, as - well as possibly including issues such as library search path order - and versioning. +Databases + It may be possible to map a GDBM/NDBM/SDBM file into an `awk' + array. `RECLEN' variable for fixed-length records Along with `FIELDWIDTHS', this would speed up the processing of @@ -22399,30 +23708,12 @@ Loadable module interface `"RECLEN"', depending upon which kind of record processing is in effect. -Databases - It may be possible to map a GDBM/NDBM/SDBM file into an `awk' - array. - More `lint' warnings There are more things that could be checked for portability. Following is a list of probable improvements that will make `gawk''s source code easier to work with: -Loadable module mechanics - The current extension mechanism works (*note Dynamic Extensions::), - but is rather primitive. It requires a fair amount of manual work - to create and integrate a loadable module. Nor is the current - mechanism as portable as might be desired. The GNU `libtool' - package provides a number of features that would make using - loadable modules much easier. `gawk' should be changed to use - `libtool'. - -Loadable module internals - The API to its internals that `gawk' "exports" should be revised. - Too many things are needlessly exposed. A new API should be - designed and implemented to make module writing easier. - Better array subscript management `gawk''s management of array subscript storage could use revamping, so that using the same value to index multiple arrays only stores @@ -22451,7 +23742,6 @@ introductory texts that you should refer to instead.) * Basic High Level:: The high level view. * Basic Data Typing:: A very quick intro to data types. -* Floating Point Issues:: Stuff to know about floating-point numbers. File: gawk.info, Node: Basic High Level, Next: Basic Data Typing, Up: Basic Concepts @@ -22550,7 +23840,7 @@ such as C, C++, or Ada, and then translated, or "compiled", into a form that the computer can execute directly. -File: gawk.info, Node: Basic Data Typing, Next: Floating Point Issues, Prev: Basic High Level, Up: Basic Concepts +File: gawk.info, Node: Basic Data Typing, Prev: Basic High Level, Up: Basic Concepts D.2 Data Values in a Computer ============================= @@ -22570,34 +23860,10 @@ characters that comprise them. Individual variables, as well as numeric and string variables, are referred to as "scalar" values. Groups of values, such as arrays, are not scalars. - Within computers, there are two kinds of numeric values: "integers" -and "floating-point". In school, integer values were referred to as -"whole" numbers--that is, numbers without any fractional part, such as -1, 42, or -17. The advantage to integer numbers is that they represent -values exactly. The disadvantage is that their range is limited. On -most systems, this range is -2,147,483,648 to 2,147,483,647. However, -many systems now support a range from -9,223,372,036,854,775,808 to -9,223,372,036,854,775,807. - - Integer values come in two flavors: "signed" and "unsigned". Signed -values may be negative or positive, with the range of values just -described. Unsigned values are always positive. On most systems, the -range is from 0 to 4,294,967,295. However, many systems now support a -range from 0 to 18,446,744,073,709,551,615. - - Floating-point numbers represent what are called "real" numbers; -i.e., those that do have a fractional part, such as 3.1415927. The -advantage to floating-point numbers is that they can represent a much -larger range of values. The disadvantage is that there are numbers -that they cannot represent exactly. `awk' uses "double precision" -floating-point numbers, which can hold more digits than "single -precision" floating-point numbers. Floating-point issues are discussed -more fully in *note Floating Point Issues::. - - At the very lowest level, computers store values as groups of binary -digits, or "bits". Modern computers group bits into groups of eight, -called "bytes". Advanced applications sometimes have to manipulate -bits directly, and `gawk' provides functions for doing so. + *note General Arithmetic::, provided a basic introduction to numeric +types (integer and floating-point) and how they are used in a computer. +Please review that information, including a number of caveats that were +presented. While you are probably used to the idea of a number without a value (i.e., zero), it takes a bit more getting used to the idea of @@ -22618,6 +23884,11 @@ represents 1 times 8, plus 0 times 4, plus 1 times 2, plus 0 times 1, or decimal 10. Octal and hexadecimal are discussed more in *note Nondecimal-numbers::. + At the very lowest level, computers store values as groups of binary +digits, or "bits". Modern computers group bits into groups of eight, +called "bytes". Advanced applications sometimes have to manipulate +bits directly, and `gawk' provides functions for doing so. + Programs are written in programming languages. Hundreds, if not thousands, of programming languages exist. One of the most popular is the C programming language. The C language had a very strong influence @@ -22635,218 +23906,6 @@ In 1999, a revised ISO C standard was approved and released. Where it makes sense, POSIX `awk' is compatible with 1999 ISO C. -File: gawk.info, Node: Floating Point Issues, Prev: Basic Data Typing, Up: Basic Concepts - -D.3 Floating-Point Number Caveats -================================= - -As mentioned earlier, floating-point numbers represent what are called -"real" numbers, i.e., those that have a fractional part. `awk' uses -double precision floating-point numbers to represent all numeric -values. This minor node describes some of the issues involved in using -floating-point numbers. - - 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 -if you are interested in the details, but it does require a background -in computer science. - -* Menu: - -* String Conversion Precision:: The String Value Can Lie. -* Unexpected Results:: Floating Point Numbers Are Not Abstract - Numbers. -* POSIX Floating Point Problems:: Standards Versus Existing Practice. - - -File: gawk.info, Node: String Conversion Precision, Next: Unexpected Results, Up: Floating Point Issues - -D.3.1 The String Value Can Lie ------------------------------- - -Internally, `awk' keeps both the numeric value (double precision -floating-point) and the string value for a variable. Separately, `awk' -keeps track of what type the variable has (*note Typing and -Comparison::), which plays a role in how variables are used in -comparisons. - - It is important to note that the string value for a number may not -reflect the full value (all the digits) that the numeric value actually -contains. The following program (`values.awk') illustrates this: - - { - sum = $1 + $2 - # see it for what it is - printf("sum = %.12g\n", sum) - # use CONVFMT - a = "<" sum ">" - print "a =", a - # use OFMT - print "sum =", sum - } - -This program shows the full value of the sum of `$1' and `$2' using -`printf', and then prints the string values obtained from both -automatic conversion (via `CONVFMT') and from printing (via `OFMT'). - - Here is what happens when the program is run: - - $ echo 3.654321 1.2345678 | awk -f values.awk - -| sum = 4.8888888 - -| a = <4.88889> - -| sum = 4.88889 - - This makes it clear that the full numeric value is different from -what the default string representations show. - - `CONVFMT''s default value is `"%.6g"', which yields a value with at -least six significant digits. For some applications, you might want to -change it to specify more precision. On most modern machines, most of -the time, 17 digits is enough to capture a floating-point number's -value exactly.(1) - - ---------- Footnotes ---------- - - (1) Pathological cases can require up to 752 digits (!), but we -doubt that you need to worry about this. - - -File: gawk.info, Node: Unexpected Results, Next: POSIX Floating Point Problems, Prev: String Conversion Precision, Up: Floating Point Issues - -D.3.2 Floating Point Numbers Are Not Abstract Numbers ------------------------------------------------------ - -Unlike numbers in the abstract sense (such as what you studied in high -school or college math), numbers stored in computers are limited in -certain ways. They cannot represent an infinite number of digits, nor -can they always represent things exactly. In particular, -floating-point numbers cannot always represent values exactly. Here is -an example: - - $ awk '{ printf("%010d\n", $1 * 100) }' - 515.79 - -| 0000051579 - 515.80 - -| 0000051579 - 515.81 - -| 0000051580 - 515.82 - -| 0000051582 - Ctrl-d - -This shows that some values can be represented exactly, whereas others -are only approximated. This is not a "bug" in `awk', but simply an -artifact of how computers represent numbers. - - Another peculiarity of floating-point numbers on modern systems is -that they often have more than one representation for the number zero! -In particular, it is possible to represent "minus zero" as well as -regular, or "positive" zero. - - This example shows that negative and positive zero are distinct -values when stored internally, but that they are in fact equal to each -other, as well as to "regular" zero: - - $ gawk 'BEGIN { mz = -0 ; pz = 0 - > printf "-0 = %g, +0 = %g, (-0 == +0) -> %d\n", mz, pz, mz == pz - > printf "mz == 0 -> %d, pz == 0 -> %d\n", mz == 0, pz == 0 - > }' - -| -0 = -0, +0 = 0, (-0 == +0) -> 1 - -| mz == 0 -> 1, pz == 0 -> 1 - - It helps to keep this in mind should you process numeric data that -contains negative zero values; the fact that the zero is negative is -noted and can affect comparisons. - - -File: gawk.info, Node: POSIX Floating Point Problems, Prev: Unexpected Results, Up: Floating Point Issues - -D.3.3 Standards Versus Existing Practice ----------------------------------------- - -Historically, `awk' has converted any non-numeric 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 -(base 8) or hexadecimal numbers (base 16). - - Changes in the language of the 2001 and 2004 POSIX standard can be -interpreted to imply that `awk' should support additional features. -These features are: - - * Interpretation of floating point data values specified in - hexadecimal notation (`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 - ("-inf"). In particular, the format for these values is as - specified by the ISO 1999 C standard, which ignores case and can - allow machine-dependent additional characters after the `nan' and - allow either `inf' or `infinity'. - - The first problem is that both of these are clear changes to -historical practice: - - * The `gawk' maintainer feels that supporting hexadecimal floating - point values, in particular, is ugly, and was never intended by the - original designers to be part of the language. - - * Allowing completely alphabetic strings to have valid numeric - 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 -"language lawyering" to arrive at in the first place, was not even -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." - - 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" 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 -as follows: - - * With the `--posix' command-line option, `gawk' becomes "hands - off." String values are passed directly to the system library's - `strtod()' function, and if it successfully returns a numeric - value, that is what's used.(1) By definition, the results are not - portable across different systems. They are also a little - surprising: - - $ echo nanny | gawk --posix '{ print $1 + 0 }' - -| nan - $ echo 0xDeadBeef | gawk --posix '{ print $1 + 0 }' - -| 3735928559 - - * Without `--posix', `gawk' interprets the four strings `+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 - floating point is not supported (unless you also use - `--non-decimal-data', which is _not_ recommended). For example: - - $ echo nanny | gawk '{ print $1 + 0 }' - -| 0 - $ echo +nan | gawk '{ print $1 + 0 }' - -| nan - $ echo 0xDeadBeef | gawk '{ print $1 + 0 }' - -| 0 - - `gawk' does ignore case in the four special values. Thus `+nan' - and `+NaN' are the same. - - ---------- Footnotes ---------- - - (1) You asked for it, you got it. - - File: gawk.info, Node: Glossary, Next: Copying, Prev: Basic Concepts, Up: Top Glossary @@ -24740,8 +25799,8 @@ Index * ' (single quote): One-shot. (line 15) * ' (single quote), vs. apostrophe: Comments. (line 27) * ' (single quote), with double quotes: Quoting. (line 53) +* () (parentheses) <1>: Profiling. (line 138) * () (parentheses): Regexp Operators. (line 79) -* () (parentheses), pgawk program: Profiling. (line 141) * * (asterisk), * operator, as multiplication operator: Precedence. (line 55) * * (asterisk), * operator, as regexp operator: Regexp Operators. @@ -24768,79 +25827,86 @@ Index * - (hyphen), -- operator: Increment Ops. (line 48) * - (hyphen), -= operator <1>: Precedence. (line 95) * - (hyphen), -= operator: Assignment Ops. (line 129) -* - (hyphen), filenames beginning with: Options. (line 59) +* - (hyphen), filenames beginning with: Options. (line 73) * - (hyphen), in bracket expressions: Bracket Expressions. (line 17) -* --assign option: Options. (line 32) -* --c option: Options. (line 81) -* --characters-as-bytes option: Options. (line 68) -* --command option: Options. (line 234) -* --copyright option: Options. (line 88) +* --assign option: Options. (line 46) +* --bignum option: Options. (line 201) +* --c option: Options. (line 95) +* --characters-as-bytes option: Options. (line 82) +* --copyright option: Options. (line 102) +* --debug option: Options. (line 122) * --disable-lint configuration option: Additional Configuration Options. (line 9) * --disable-nls configuration option: Additional Configuration Options. (line 24) * --dump-variables option <1>: Library Names. (line 45) -* --dump-variables option: Options. (line 93) -* --exec option: Options. (line 116) +* --dump-variables option: Options. (line 107) +* --exec option: Options. (line 139) * --field-separator option: Options. (line 21) * --file option: Options. (line 25) * --gen-pot option <1>: String Extraction. (line 6) -* --gen-pot option: Options. (line 138) -* --help option: Options. (line 145) -* --L option: Options. (line 248) -* --lint option <1>: Options. (line 150) +* --gen-pot option: Options. (line 161) +* --help option: Options. (line 168) +* --include option: Options. (line 32) +* --L option: Options. (line 288) +* --lint option <1>: Options. (line 182) * --lint option: Command Line. (line 20) -* --lint-old option: Options. (line 248) +* --lint-old option: Options. (line 288) +* --load option: Options. (line 173) * --non-decimal-data option <1>: Nondecimal Data. (line 6) -* --non-decimal-data option: Options. (line 169) +* --non-decimal-data option: Options. (line 207) * --non-decimal-data option, strtonum() function and: Nondecimal Data. (line 36) -* --optimize option: Options. (line 182) -* --posix option: Options. (line 202) -* --posix option, --traditional option and: Options. (line 221) -* --profile option <1>: Profiling. (line 15) -* --profile option: Options. (line 189) -* --re-interval option: Options. (line 227) -* --sandbox option: Options. (line 239) +* --optimize option: Options. (line 228) +* --posix option: Options. (line 247) +* --posix option, --traditional option and: Options. (line 266) +* --pretty-print option: Options. (line 220) +* --profile option <1>: Profiling. (line 12) +* --profile option: Options. (line 235) +* --re-interval option: Options. (line 272) +* --sandbox option: Options. (line 279) * --sandbox option, disabling system() function: I/O Functions. (line 85) * --sandbox option, input redirection with getline: Getline. (line 19) * --sandbox option, output redirection with print, printf: Redirection. (line 6) -* --source option: Options. (line 108) -* --traditional option: Options. (line 81) -* --traditional option, --posix option and: Options. (line 221) -* --use-lc-numeric option: Options. (line 177) -* --version option: Options. (line 253) +* --source option: Options. (line 131) +* --traditional option: Options. (line 95) +* --traditional option, --posix option and: Options. (line 266) +* --use-lc-numeric option: Options. (line 215) +* --version option: Options. (line 293) * --with-whiny-user-strftime configuration option: Additional Configuration Options. (line 29) -* -b option: Options. (line 68) -* -C option: Options. (line 88) -* -d option: Options. (line 93) -* -E option: Options. (line 116) -* -e option: Options. (line 108) +* -b option: Options. (line 82) +* -C option: Options. (line 102) +* -D option: Options. (line 122) +* -d option: Options. (line 107) +* -E option: Options. (line 139) +* -e option: Options. (line 131) * -F option: Command Line Field Separator. (line 6) * -f option: Options. (line 25) * -F option: Options. (line 21) * -f option: Long. (line 12) -* -F option, -Ft sets FS to TAB: Options. (line 261) -* -f option, on command line: Options. (line 266) -* -g option: Options. (line 138) -* -h option: Options. (line 145) -* -l option: Options. (line 150) -* -N option: Options. (line 177) -* -n option: Options. (line 169) -* -O option: Options. (line 182) -* -P option: Options. (line 202) -* -p option: Options. (line 189) -* -R option: Options. (line 234) -* -r option: Options. (line 227) -* -S option: Options. (line 239) -* -V option: Options. (line 253) -* -v option: Options. (line 32) +* -F option, -Ft sets FS to TAB: Options. (line 301) +* -f option, on command line: Options. (line 306) +* -g option: Options. (line 161) +* -h option: Options. (line 168) +* -i option: Options. (line 32) +* -l option: Options. (line 173) +* -M option: Options. (line 201) +* -N option: Options. (line 215) +* -n option: Options. (line 207) +* -O option: Options. (line 228) +* -o option: Options. (line 220) +* -P option: Options. (line 247) +* -p option: Options. (line 235) +* -r option: Options. (line 272) +* -S option: Options. (line 279) +* -V option: Options. (line 293) +* -v option: Options. (line 46) * -v option, variables, assigning: Assignment Options. (line 12) -* -W option: Options. (line 46) +* -W option: Options. (line 60) * . (period): Regexp Operators. (line 43) * .mo files: Explaining gettext. (line 41) * .mo files, converting from .po: I18N Example. (line 62) @@ -24969,7 +26035,7 @@ Index * Ada programming language: Glossary. (line 20) * adding, features to gawk: Adding Code. (line 6) * adding, fields: Changing Fields. (line 53) -* adding, functions to gawk: Dynamic Extensions. (line 10) +* adding, functions to gawk: Dynamic Extensions. (line 9) * advanced features, buffering: I/O Functions. (line 98) * advanced features, close() function: Close Files And Pipes. (line 131) @@ -24977,7 +26043,7 @@ Index (line 67) * advanced features, data files as single record: Records. (line 180) * advanced features, fixed-width data: Constant Size. (line 9) -* advanced features, FNR/NR variables: Auto-set. (line 207) +* advanced features, FNR/NR variables: Auto-set. (line 295) * advanced features, gawk: Advanced Features. (line 6) * advanced features, gawk, network programming: TCP/IP Networking. (line 6) @@ -25012,6 +26078,8 @@ Index * and Boolean-logic operator: Boolean Ops. (line 6) * and() function (gawk): Bitwise Functions. (line 39) * ANSI: Glossary. (line 35) +* arbitrary precision: Arbitrary Precision Arithmetic. + (line 6) * archeologists: Bugs. (line 6) * ARGC/ARGV variables <1>: ARGC and ARGV. (line 6) * ARGC/ARGV variables: Auto-set. (line 11) @@ -25026,18 +26094,15 @@ Index * arguments, command-line, invoking awk: Command Line. (line 6) * arguments, in function calls: Function Calls. (line 16) * arguments, processing: Getopt Function. (line 6) -* arguments, retrieving: Internals. (line 120) * arithmetic operators: Arithmetic Ops. (line 6) * arrays: Arrays. (line 6) * arrays, as parameters to functions: Pass By Value/Reference. (line 47) * arrays, associative: Array Intro. (line 50) -* arrays, associative, clearing: Internals. (line 75) * arrays, associative, library functions and: Library Names. (line 57) * arrays, deleting entire contents: Delete. (line 39) * arrays, elements, assigning: Assigning Elements. (line 6) * arrays, elements, deleting: Delete. (line 6) -* arrays, elements, installing: Internals. (line 79) * arrays, elements, order of: Scanning an Array. (line 48) * arrays, elements, referencing: Reference to Elements. (line 6) @@ -25076,8 +26141,6 @@ Index * assignment operators, evaluation order: Assignment Ops. (line 111) * assignment operators, lvalues/rvalues: Assignment Ops. (line 32) * assignments as filenames: Ignoring Assigns. (line 6) -* assoc_clear() internal function: Internals. (line 75) -* assoc_lookup() internal function: Internals. (line 79) * associative arrays: Array Intro. (line 50) * asterisk (*), * operator, as multiplication operator: Precedence. (line 55) @@ -25093,7 +26156,10 @@ Index * asterisk (*), *= operator: Assignment Ops. (line 129) * atan2() function: Numeric Functions. (line 11) * awf (amazingly workable formatter) program: Glossary. (line 25) +* awk debugging, enabling: Options. (line 122) +* awk enabling: Options. (line 220) * awk language, POSIX version: Assignment Ops. (line 136) +* awk profiling, enabling: Options. (line 235) * awk programs <1>: Two Rules. (line 6) * awk programs <2>: Executable Scripts. (line 6) * awk programs: Getting Started. (line 12) @@ -25109,7 +26175,6 @@ Index * awk programs, location of: Options. (line 25) * awk programs, one-line examples: Very Simple. (line 45) * awk programs, profiling: Profiling. (line 6) -* awk programs, profiling, enabling: Options. (line 189) * awk programs, running <1>: Long. (line 6) * awk programs, running: Running gawk. (line 6) * awk programs, running, from shell scripts: One-shot. (line 22) @@ -25144,14 +26209,13 @@ Index * awk, versions of, See Also Brian Kernighan's awk <1>: Other Versions. (line 13) * awk, versions of, See Also Brian Kernighan's awk: BTL. (line 6) -* awk.h file (internal): Internals. (line 15) * awka compiler for awk: Other Versions. (line 55) -* AWKNUM internal type: Internals. (line 19) +* AWKLIBPATH environment variable: AWKLIBPATH Variable. (line 6) * AWKPATH environment variable <1>: PC Using. (line 11) * AWKPATH environment variable: AWKPATH Variable. (line 6) -* awkprof.out file: Profiling. (line 10) +* awkprof.out file: Profiling. (line 6) * awksed.awk program: Simple Sed. (line 25) -* awkvars.out file: Options. (line 93) +* awkvars.out file: Options. (line 107) * b debugger command (alias for break): Breakpoint Control. (line 11) * backslash (\) <1>: Regexp Operators. (line 18) * backslash (\) <2>: Quoting. (line 31) @@ -25203,12 +26267,13 @@ Index * backslash (\), in escape sequences, POSIX and: Escape Sequences. (line 113) * backslash (\), regexp constants: Computed Regexps. (line 28) -* backtrace debugger command: Dgawk Stack. (line 13) +* backtrace debugger command: Execution Stack. (line 13) * BBS-list file: Sample Data Files. (line 6) * Beebe, Nelson <1>: Other Versions. (line 69) * Beebe, Nelson: Acknowledgments. (line 60) -* BEGIN pattern <1>: BEGIN/END. (line 6) -* BEGIN pattern <2>: Field Separators. (line 44) +* BEGIN pattern <1>: Profiling. (line 62) +* BEGIN pattern <2>: BEGIN/END. (line 6) +* BEGIN pattern <3>: Field Separators. (line 44) * BEGIN pattern: Records. (line 29) * BEGIN pattern, assert() user-defined function and: Assert Function. (line 83) @@ -25223,7 +26288,6 @@ Index * BEGIN pattern, OFS/ORS variables, assigning values to: Output Separators. (line 20) * BEGIN pattern, operators and: Using BEGIN/END. (line 17) -* BEGIN pattern, pgawk program: Profiling. (line 65) * BEGIN pattern, print statement and: I/O And BEGIN/END. (line 16) * BEGIN pattern, pwcat program: Passwd Functions. (line 143) * BEGIN pattern, running awk programs and: Cut Program. (line 68) @@ -25242,7 +26306,7 @@ Index (line 33) * BINMODE variable <1>: PC Using. (line 34) * BINMODE variable: User-modified. (line 10) -* bits2str() user-defined function: Bitwise Functions. (line 68) +* bits2str() user-defined function: Bitwise Functions. (line 70) * bitwise, complement: Bitwise Functions. (line 25) * bitwise, operations: Bitwise Functions. (line 6) * bitwise, shift: Bitwise Functions. (line 32) @@ -25252,8 +26316,8 @@ Index * Boolean expressions, as patterns: Expression Patterns. (line 41) * Boolean operators, See Boolean expressions: Boolean Ops. (line 6) * Bourne shell, quoting rules for: Quoting. (line 18) +* braces ({}): Profiling. (line 134) * braces ({}), actions and: Action Overview. (line 19) -* braces ({}), pgawk program: Profiling. (line 137) * braces ({}), statements, grouping: Statements. (line 10) * bracket expressions <1>: Bracket Expressions. (line 6) * bracket expressions: Regexp Operators. (line 55) @@ -25280,7 +26344,7 @@ Index * Broder, Alan J.: Contributors. (line 88) * Brown, Martin: Contributors. (line 82) * BSD-based operating systems: Glossary. (line 615) -* bt debugger command (alias for backtrace): Dgawk Stack. (line 13) +* bt debugger command (alias for backtrace): Execution Stack. (line 13) * Buening, Andreas <1>: Bugs. (line 71) * Buening, Andreas <2>: Contributors. (line 92) * Buening, Andreas: Acknowledgments. (line 60) @@ -25295,10 +26359,10 @@ Index * built-in functions: Functions. (line 6) * built-in functions, evaluation order: Calling Built-in. (line 30) * built-in variables: Built-in Variables. (line 6) -* built-in variables, -v option, setting with: Options. (line 40) +* built-in variables, -v option, setting with: Options. (line 54) * built-in variables, conveying information: Auto-set. (line 6) * built-in variables, user-modifiable: User-modified. (line 6) -* Busybox Awk: Other Versions. (line 78) +* Busybox Awk: Other Versions. (line 79) * call by reference: Pass By Value/Reference. (line 47) * call by value: Pass By Value/Reference. @@ -25318,7 +26382,7 @@ Index * case sensitivity, regexps and <1>: User-modified. (line 82) * case sensitivity, regexps and: Case-sensitivity. (line 6) * case sensitivity, string comparisons and: User-modified. (line 82) -* CGI, awk scripts for: Options. (line 116) +* CGI, awk scripts for: Options. (line 139) * character lists, See bracket expressions: Regexp Operators. (line 55) * character sets (machine character encodings) <1>: Glossary. (line 141) * character sets (machine character encodings): Ordinal Functions. @@ -25348,7 +26412,6 @@ Index * close() function, two-way pipes and: Two-way I/O. (line 77) * Close, Diane <1>: Contributors. (line 21) * Close, Diane: Manual History. (line 41) -* close_func() input method: Internals. (line 160) * collating elements: Bracket Expressions. (line 69) * collating symbols: Bracket Expressions. (line 76) * Colombo, Antonio: Acknowledgments. (line 60) @@ -25368,11 +26431,11 @@ Index (line 6) * command line, options <2>: Options. (line 6) * command line, options: Long. (line 12) -* command line, options, end of: Options. (line 54) +* command line, options, end of: Options. (line 68) * command line, variables, assigning on: Assignment Options. (line 6) * command-line options, processing: Getopt Function. (line 6) * command-line options, string extraction: String Extraction. (line 6) -* commands debugger command: Dgawk Execution Control. +* commands debugger command: Debugger Execution Control. (line 10) * commenting: Comments. (line 6) * commenting, backslash continuation and: Statements/Lines. (line 76) @@ -25404,14 +26467,14 @@ Index (line 60) * compatibility mode (gawk), octal numbers: Nondecimal-numbers. (line 60) -* compatibility mode (gawk), specifying: Options. (line 81) +* compatibility mode (gawk), specifying: Options. (line 95) * compiled programs <1>: Glossary. (line 161) * compiled programs: Basic High Level. (line 14) * compiling gawk for Cygwin: Cygwin. (line 6) * compiling gawk for MS-DOS and MS-Windows: PC Compiling. (line 13) * compiling gawk for VMS: VMS Compilation. (line 6) * compiling gawk with EMX for OS/2: PC Compiling. (line 28) -* compl() function (gawk): Bitwise Functions. (line 42) +* compl() function (gawk): Bitwise Functions. (line 43) * complement, bitwise: Bitwise Functions. (line 25) * compound statements, control statements and: Statements. (line 10) * concatenating: Concatenation. (line 9) @@ -25425,17 +26488,21 @@ Index (line 29) * configuration options, gawk: Additional Configuration Options. (line 6) +* constants, floating-point: Floating-point Constants. + (line 6) * constants, nondecimal: Nondecimal Data. (line 6) * constants, types of: Constants. (line 6) +* context, floating-point: Floating-point Context. + (line 6) * continue statement: Continue Statement. (line 6) * control statements: Statements. (line 6) * converting, case: String Functions. (line 522) * converting, dates to timestamps: Time Functions. (line 74) * converting, during subscripting: Numeric Array Subscripts. (line 31) -* converting, numbers to strings <1>: Bitwise Functions. (line 107) +* converting, numbers to strings <1>: Bitwise Functions. (line 109) * converting, numbers to strings: Conversion. (line 6) -* converting, strings to numbers <1>: Bitwise Functions. (line 107) +* converting, strings to numbers <1>: Bitwise Functions. (line 109) * converting, strings to numbers: Conversion. (line 6) * CONVFMT variable <1>: User-modified. (line 28) * CONVFMT variable: Conversion. (line 29) @@ -25449,7 +26516,7 @@ Index * cos() function: Numeric Functions. (line 15) * counting: Wc Program. (line 6) * csh utility: Statements/Lines. (line 44) -* csh utility, POSIXLY_CORRECT environment variable: Options. (line 308) +* csh utility, POSIXLY_CORRECT environment variable: Options. (line 348) * csh utility, |& operator, comparison with: Two-way I/O. (line 44) * ctime() user-defined function: Function Example. (line 72) * currency symbols, localization: Explaining gettext. (line 103) @@ -25457,7 +26524,7 @@ Index (line 30) * cut utility: Cut Program. (line 6) * cut.awk program: Cut Program. (line 45) -* d debugger command (alias for delete): Breakpoint Control. (line 63) +* d debugger command (alias for delete): Breakpoint Control. (line 64) * d.c., See dark corner: Conventions. (line 38) * dark corner <1>: Glossary. (line 193) * dark corner <2>: Truth Values. (line 24) @@ -25479,9 +26546,9 @@ Index * dark corner, exit statement: Exit Statement. (line 30) * dark corner, field separators: Field Splitting Summary. (line 47) -* dark corner, FILENAME variable <1>: Auto-set. (line 92) +* dark corner, FILENAME variable <1>: Auto-set. (line 93) * dark corner, FILENAME variable: Getline Notes. (line 19) -* dark corner, FNR/NR variables: Auto-set. (line 207) +* dark corner, FNR/NR variables: Auto-set. (line 295) * dark corner, format-control characters: Control Letters. (line 18) * dark corner, FS as null string: Single Character Fields. (line 20) @@ -25521,119 +26588,121 @@ Index (line 33) * deadlocks: Two-way I/O. (line 70) * debugger commands, b (break): Breakpoint Control. (line 11) -* debugger commands, backtrace: Dgawk Stack. (line 13) +* debugger commands, backtrace: Execution Stack. (line 13) * debugger commands, break: Breakpoint Control. (line 11) -* debugger commands, bt (backtrace): Dgawk Stack. (line 13) -* debugger commands, c (continue): Dgawk Execution Control. +* debugger commands, bt (backtrace): Execution Stack. (line 13) +* debugger commands, c (continue): Debugger Execution Control. (line 33) * debugger commands, clear: Breakpoint Control. (line 36) -* debugger commands, commands: Dgawk Execution Control. +* debugger commands, commands: Debugger Execution Control. (line 10) * debugger commands, condition: Breakpoint Control. (line 54) -* debugger commands, continue: Dgawk Execution Control. +* debugger commands, continue: Debugger Execution Control. (line 33) -* debugger commands, d (delete): Breakpoint Control. (line 63) -* debugger commands, delete: Breakpoint Control. (line 63) -* debugger commands, disable: Breakpoint Control. (line 68) +* debugger commands, d (delete): Breakpoint Control. (line 64) +* debugger commands, delete: Breakpoint Control. (line 64) +* debugger commands, disable: Breakpoint Control. (line 69) * debugger commands, display: Viewing And Changing Data. (line 8) -* debugger commands, down: Dgawk Stack. (line 21) -* debugger commands, dump: Miscellaneous Dgawk Commands. +* debugger commands, down: Execution Stack. (line 21) +* debugger commands, dump: Miscellaneous Debugger Commands. (line 9) -* debugger commands, e (enable): Breakpoint Control. (line 72) -* debugger commands, enable: Breakpoint Control. (line 72) -* debugger commands, end: Dgawk Execution Control. +* debugger commands, e (enable): Breakpoint Control. (line 73) +* debugger commands, enable: Breakpoint Control. (line 73) +* debugger commands, end: Debugger Execution Control. (line 10) * debugger commands, eval: Viewing And Changing Data. (line 23) -* debugger commands, f (frame): Dgawk Stack. (line 25) -* debugger commands, finish: Dgawk Execution Control. +* debugger commands, f (frame): Execution Stack. (line 25) +* debugger commands, finish: Debugger Execution Control. (line 39) -* debugger commands, frame: Dgawk Stack. (line 25) -* debugger commands, h (help): Miscellaneous Dgawk Commands. +* debugger commands, frame: Execution Stack. (line 25) +* debugger commands, h (help): Miscellaneous Debugger Commands. (line 68) -* debugger commands, help: Miscellaneous Dgawk Commands. +* debugger commands, help: Miscellaneous Debugger Commands. (line 68) -* debugger commands, i (info): Dgawk Info. (line 12) -* debugger commands, ignore: Breakpoint Control. (line 86) -* debugger commands, info: Dgawk Info. (line 12) -* debugger commands, l (list): Miscellaneous Dgawk Commands. +* debugger commands, i (info): Debugger Info. (line 13) +* debugger commands, ignore: Breakpoint Control. (line 87) +* debugger commands, info: Debugger Info. (line 13) +* debugger commands, l (list): Miscellaneous Debugger Commands. (line 74) -* debugger commands, list: Miscellaneous Dgawk Commands. +* debugger commands, list: Miscellaneous Debugger Commands. (line 74) -* debugger commands, n (next): Dgawk Execution Control. +* debugger commands, n (next): Debugger Execution Control. (line 43) -* debugger commands, next: Dgawk Execution Control. +* debugger commands, next: Debugger Execution Control. (line 43) -* debugger commands, nexti: Dgawk Execution Control. +* debugger commands, nexti: Debugger Execution Control. (line 49) -* debugger commands, ni (nexti): Dgawk Execution Control. +* debugger commands, ni (nexti): Debugger Execution Control. (line 49) -* debugger commands, o (option): Dgawk Info. (line 56) -* debugger commands, option: Dgawk Info. (line 56) +* debugger commands, o (option): Debugger Info. (line 57) +* debugger commands, option: Debugger Info. (line 57) * debugger commands, p (print): Viewing And Changing Data. (line 36) * debugger commands, print: Viewing And Changing Data. (line 36) * debugger commands, printf: Viewing And Changing Data. (line 54) -* debugger commands, q (quit): Miscellaneous Dgawk Commands. +* debugger commands, q (quit): Miscellaneous Debugger Commands. (line 101) -* debugger commands, quit: Miscellaneous Dgawk Commands. +* debugger commands, quit: Miscellaneous Debugger Commands. (line 101) -* debugger commands, r (run): Dgawk Execution Control. +* debugger commands, r (run): Debugger Execution Control. (line 62) -* debugger commands, return: Dgawk Execution Control. +* debugger commands, return: Debugger Execution Control. (line 54) -* debugger commands, run: Dgawk Execution Control. +* debugger commands, run: Debugger Execution Control. (line 62) -* debugger commands, s (step): Dgawk Execution Control. +* debugger commands, s (step): Debugger Execution Control. (line 68) * debugger commands, set: Viewing And Changing Data. (line 59) -* debugger commands, si (stepi): Dgawk Execution Control. +* debugger commands, si (stepi): Debugger Execution Control. (line 76) -* debugger commands, silent: Dgawk Execution Control. +* debugger commands, silent: Debugger Execution Control. (line 10) -* debugger commands, step: Dgawk Execution Control. +* debugger commands, step: Debugger Execution Control. (line 68) -* debugger commands, stepi: Dgawk Execution Control. +* debugger commands, stepi: Debugger Execution Control. (line 76) -* debugger commands, t (tbreak): Breakpoint Control. (line 89) -* debugger commands, tbreak: Breakpoint Control. (line 89) -* debugger commands, trace: Miscellaneous Dgawk Commands. +* debugger commands, t (tbreak): Breakpoint Control. (line 90) +* debugger commands, tbreak: Breakpoint Control. (line 90) +* debugger commands, trace: Miscellaneous Debugger Commands. (line 110) -* debugger commands, u (until): Dgawk Execution Control. +* debugger commands, u (until): Debugger Execution Control. (line 83) * debugger commands, undisplay: Viewing And Changing Data. (line 80) -* debugger commands, until: Dgawk Execution Control. +* debugger commands, until: Debugger Execution Control. (line 83) * debugger commands, unwatch: Viewing And Changing Data. (line 84) -* debugger commands, up: Dgawk Stack. (line 33) +* debugger commands, up: Execution Stack. (line 33) * debugger commands, w (watch): Viewing And Changing Data. (line 67) * debugger commands, watch: Viewing And Changing Data. (line 67) +* debugging awk programs: Debugger. (line 6) * debugging gawk, bug reports: Bugs. (line 9) -* decimal point character, locale specific: Options. (line 218) +* decimal point character, locale specific: Options. (line 263) * decrement operators: Increment Ops. (line 35) * default keyword: Switch Statement. (line 6) * Deifik, Scott <1>: Bugs. (line 70) * Deifik, Scott <2>: Contributors. (line 54) * Deifik, Scott: Acknowledgments. (line 60) -* delete debugger command: Breakpoint Control. (line 63) +* delete debugger command: Breakpoint Control. (line 64) * delete statement: Delete. (line 6) * deleting elements in arrays: Delete. (line 6) * deleting entire arrays: Delete. (line 39) -* dgawk: Debugger. (line 6) * differences between gawk and awk: String Functions. (line 196) * differences in awk and gawk, ARGC/ARGV variables: ARGC and ARGV. (line 88) * differences in awk and gawk, ARGIND variable: Auto-set. (line 40) * differences in awk and gawk, array elements, deleting: Delete. (line 39) +* differences in awk and gawk, AWKLIBPATH environment variable: AWKLIBPATH Variable. + (line 6) * differences in awk and gawk, AWKPATH environment variable: AWKPATH Variable. (line 6) * differences in awk and gawk, BEGIN/END patterns: I/O And BEGIN/END. @@ -25644,11 +26713,12 @@ Index (line 23) * differences in awk and gawk, close() function: Close Files And Pipes. (line 81) -* differences in awk and gawk, ERRNO variable: Auto-set. (line 72) +* differences in awk and gawk, ERRNO variable: Auto-set. (line 73) * differences in awk and gawk, error messages: Special FD. (line 16) * differences in awk and gawk, FIELDWIDTHS variable: User-modified. (line 35) * differences in awk and gawk, FPAT variable: User-modified. (line 45) +* differences in awk and gawk, FUNCTAB variable: Auto-set. (line 119) * differences in awk and gawk, function arguments (gawk): Calling Built-in. (line 16) * differences in awk and gawk, getline command: Getline. (line 19) @@ -25673,14 +26743,14 @@ Index (line 6) * differences in awk and gawk, print/printf statements: Format Modifiers. (line 13) -* differences in awk and gawk, PROCINFO array: Auto-set. (line 123) +* differences in awk and gawk, PROCINFO array: Auto-set. (line 130) * differences in awk and gawk, record separators: Records. (line 117) * differences in awk and gawk, regexp constants: Using Constant Regexps. (line 43) * differences in awk and gawk, regular expressions: Case-sensitivity. (line 26) * differences in awk and gawk, RS/RT variables: Records. (line 172) -* differences in awk and gawk, RT variable: Auto-set. (line 196) +* differences in awk and gawk, RT variable: Auto-set. (line 246) * differences in awk and gawk, single-character fields: Single Character Fields. (line 6) * differences in awk and gawk, split() function: String Functions. @@ -25689,16 +26759,18 @@ Index * differences in awk and gawk, strings, storing: Records. (line 192) * differences in awk and gawk, strtonum() function (gawk): String Functions. (line 404) +* differences in awk and gawk, SYMTAB variable: Auto-set. (line 254) * differences in awk and gawk, TEXTDOMAIN variable: User-modified. - (line 153) + (line 162) * differences in awk and gawk, trunc-mod operation: Arithmetic Ops. (line 66) * directories, changing: Sample Library. (line 6) * directories, command line: Command line directories. (line 6) * directories, searching <1>: Igawk Program. (line 368) +* directories, searching <2>: AWKLIBPATH Variable. (line 6) * directories, searching: AWKPATH Variable. (line 6) -* disable debugger command: Breakpoint Control. (line 68) +* disable debugger command: Breakpoint Control. (line 69) * display debugger command: Viewing And Changing Data. (line 8) * division: Arithmetic Ops. (line 44) @@ -25712,18 +26784,17 @@ Index * dollar sign ($), $ field operator: Fields. (line 19) * dollar sign ($), incrementing fields and arrays: Increment Ops. (line 30) -* double precision floating-point: Basic Data Typing. (line 36) +* double precision floating-point: General Arithmetic. (line 21) * double quote (") <1>: Quoting. (line 37) * double quote ("): Read Terminal. (line 25) * double quote ("), regexp constants: Computed Regexps. (line 28) -* down debugger command: Dgawk Stack. (line 21) +* down debugger command: Execution Stack. (line 21) * Drepper, Ulrich: Acknowledgments. (line 52) * DuBois, John: Acknowledgments. (line 60) -* dump debugger command: Miscellaneous Dgawk Commands. +* dump debugger command: Miscellaneous Debugger Commands. (line 9) -* dupnode() internal function: Internals. (line 96) * dupword.awk program: Dupword Program. (line 31) -* e debugger command (alias for enable): Breakpoint Control. (line 72) +* e debugger command (alias for enable): Breakpoint Control. (line 73) * EBCDIC: Ordinal Functions. (line 45) * egrep utility <1>: Egrep Program. (line 6) * egrep utility: Bracket Expressions. (line 24) @@ -25739,9 +26810,10 @@ Index * empty pattern: Empty. (line 6) * empty strings, See null strings: Regexp Field Splitting. (line 43) -* enable debugger command: Breakpoint Control. (line 72) -* end debugger command: Dgawk Execution Control. +* enable debugger command: Breakpoint Control. (line 73) +* end debugger command: Debugger Execution Control. (line 10) +* END pattern <1>: Profiling. (line 62) * END pattern: BEGIN/END. (line 6) * END pattern, assert() user-defined function and: Assert Function. (line 75) @@ -25753,7 +26825,6 @@ Index * END pattern, next/nextfile statements and: I/O And BEGIN/END. (line 37) * END pattern, operators and: Using BEGIN/END. (line 17) -* END pattern, pgawk program: Profiling. (line 65) * 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 73) @@ -25762,7 +26833,6 @@ Index * endgrent() user-defined function: Group Functions. (line 218) * endpwent() function (C library): Passwd Functions. (line 210) * endpwent() user-defined function: Passwd Functions. (line 213) -* ENVIRON array <1>: Internals. (line 149) * ENVIRON array: Auto-set. (line 60) * environment variables: Auto-set. (line 60) * epoch, definition of: Glossary. (line 239) @@ -25771,15 +26841,14 @@ Index * equals sign (=), == operator: Comparison Operators. (line 11) * EREs (Extended Regular Expressions): Bracket Expressions. (line 24) -* ERRNO variable <1>: Internals. (line 139) -* ERRNO variable <2>: TCP/IP Networking. (line 54) -* ERRNO variable <3>: Auto-set. (line 72) -* ERRNO variable <4>: BEGINFILE/ENDFILE. (line 26) -* ERRNO variable <5>: Close Files And Pipes. +* ERRNO variable <1>: TCP/IP Networking. (line 54) +* ERRNO variable <2>: Auto-set. (line 73) +* ERRNO variable <3>: BEGINFILE/ENDFILE. (line 26) +* ERRNO variable <4>: Close Files And Pipes. (line 139) * ERRNO variable: Getline. (line 19) * error handling: Special FD. (line 16) -* error handling, ERRNO variable and: Auto-set. (line 72) +* error handling, ERRNO variable and: Auto-set. (line 73) * error output: Special FD. (line 6) * escape processing, gsub()/gensub()/sub() functions: Gory Details. (line 6) @@ -25820,7 +26889,6 @@ Index (line 9) * expressions, selecting: Conditional Exp. (line 6) * Extended Regular Expressions (EREs): Bracket Expressions. (line 24) -* eXtensible Markup Language (XML): Internals. (line 160) * extension() function (gawk): Using Internal File Ops. (line 15) * extensions, Brian Kernighan's awk <1>: Other Versions. (line 13) @@ -25845,7 +26913,7 @@ Index * extract.awk program: Extract Program. (line 78) * extraction, of marked strings (internationalization): String Extraction. (line 6) -* f debugger command (alias for frame): Dgawk Stack. (line 25) +* f debugger command (alias for frame): Execution Stack. (line 25) * false, logical: Truth Values. (line 6) * FDL (Free Documentation License): GNU Free Documentation License. (line 6) @@ -25894,7 +26962,7 @@ Index * file names, distinguishing: Auto-set. (line 52) * file names, in compatibility mode: Special Caveats. (line 9) * file names, standard streams in gawk: Special FD. (line 46) -* FILENAME variable <1>: Auto-set. (line 92) +* FILENAME variable <1>: Auto-set. (line 93) * FILENAME variable: Reading Files. (line 6) * FILENAME variable, getline, setting with: Getline Notes. (line 19) * filenames, assignments as: Ignoring Assigns. (line 6) @@ -25912,8 +26980,8 @@ Index * files, /inet6/... (gawk): TCP/IP Networking. (line 6) * files, as single records: Records. (line 201) * files, awk programs in: Long. (line 6) -* files, awkprof.out: Profiling. (line 10) -* files, awkvars.out: Options. (line 93) +* files, awkprof.out: Profiling. (line 6) +* files, awkvars.out: Options. (line 107) * files, closing: I/O Functions. (line 10) * files, descriptors, See file descriptors: Special FD. (line 6) * files, group: Group Functions. (line 6) @@ -25941,7 +27009,7 @@ Index * files, portable object template: Explaining gettext. (line 30) * files, portable object, converting to message object files: I18N Example. (line 62) -* files, portable object, generating: Options. (line 138) +* files, portable object, generating: Options. (line 161) * files, processing, ARGIND variable and: Auto-set. (line 47) * files, reading: Rewind Function. (line 6) * files, reading, multiline records: Multiple Line. (line 6) @@ -25950,23 +27018,21 @@ Index * files, source, search path for: Igawk Program. (line 368) * files, splitting: Split Program. (line 6) * files, Texinfo, extracting programs from: Extract Program. (line 6) -* finish debugger command: Dgawk Execution Control. +* finish debugger command: Debugger Execution Control. (line 39) * Fish, Fred: Contributors. (line 51) * fixed-width data: Constant Size. (line 9) * flag variables <1>: Tee Program. (line 20) * flag variables: Boolean Ops. (line 67) +* floating-point numbers, arbitrary precision: Arbitrary Precision Arithmetic. + (line 6) * floating-point, numbers <1>: Unexpected Results. (line 6) -* floating-point, numbers: Basic Data Typing. (line 21) -* floating-point, numbers, AWKNUM internal type: Internals. (line 19) -* FNR variable <1>: Auto-set. (line 102) +* floating-point, numbers: General Arithmetic. (line 6) +* FNR variable <1>: Auto-set. (line 103) * FNR variable: Records. (line 6) -* FNR variable, changing: Auto-set. (line 207) +* FNR variable, changing: Auto-set. (line 295) * for statement: For Statement. (line 6) * for statement, in arrays: Scanning an Array. (line 20) -* force_number() internal function: Internals. (line 27) -* force_string() internal function: Internals. (line 32) -* force_wstring() internal function: Internals. (line 37) * format specifiers, mixing regular with positional specifiers: Printf Ordering. (line 57) * format specifiers, printf statement: Control Letters. (line 6) @@ -25985,7 +27051,7 @@ Index * FPAT variable <1>: User-modified. (line 45) * FPAT variable: Splitting By Content. (line 26) -* frame debugger command: Dgawk Stack. (line 25) +* frame debugger command: Execution Stack. (line 25) * Free Documentation License (FDL): GNU Free Documentation License. (line 6) * Free Software Foundation (FSF) <1>: Glossary. (line 301) @@ -25997,7 +27063,7 @@ Index * FS variable, --field-separator option and: Options. (line 21) * FS variable, as null string: Single Character Fields. (line 20) -* FS variable, as TAB character: Options. (line 214) +* FS variable, as TAB character: Options. (line 259) * FS variable, changing value of: Field Separators. (line 34) * FS variable, running awk programs and: Cut Program. (line 68) * FS variable, setting from command line: Command Line Field Separator. @@ -26007,6 +27073,7 @@ Index * FSF (Free Software Foundation) <1>: Glossary. (line 301) * FSF (Free Software Foundation) <2>: Getting. (line 10) * FSF (Free Software Foundation): Manual History. (line 6) +* FUNCTAB array: Auto-set. (line 119) * function calls: Function Calls. (line 6) * function calls, indirect: Indirect Calls. (line 6) * function pointers: Indirect Calls. (line 6) @@ -26014,7 +27081,7 @@ Index (line 47) * functions, built-in <1>: Functions. (line 6) * functions, built-in: Function Calls. (line 10) -* functions, built-in, adding to gawk: Dynamic Extensions. (line 10) +* functions, built-in, adding to gawk: Dynamic Extensions. (line 9) * functions, built-in, evaluation order: Calling Built-in. (line 30) * functions, defining: Definition Syntax. (line 6) * functions, library: Library Functions. (line 6) @@ -26032,7 +27099,7 @@ Index (line 6) * functions, library, managing data files: Data File Management. (line 6) -* functions, library, managing time: Gettimeofday Function. +* functions, library, managing time: Getlocaltime Function. (line 6) * functions, library, merging arrays into strings: Join Function. (line 6) @@ -26042,20 +27109,20 @@ Index * functions, names of <1>: Definition Syntax. (line 20) * functions, names of: Arrays. (line 18) * functions, recursive: Definition Syntax. (line 73) -* functions, return values, setting: Internals. (line 139) * functions, string-translation: I18N Functions. (line 6) * functions, undefined: Pass By Value/Reference. (line 71) * functions, user-defined: User-defined. (line 6) * functions, user-defined, calling: Calling A Function. (line 6) -* functions, user-defined, counts: Profiling. (line 132) +* functions, user-defined, counts: Profiling. (line 129) * functions, user-defined, library of: Library Functions. (line 6) * functions, user-defined, next/nextfile statements and <1>: Nextfile Statement. (line 47) * functions, user-defined, next/nextfile statements and: Next Statement. (line 45) -* G-d: Acknowledgments. (line 81) +* G-d: Acknowledgments. (line 83) * Garfinkle, Scott: Contributors. (line 35) +* gawk program, dynamic profiling: Profiling. (line 171) * gawk, ARGIND variable in: Other Arguments. (line 12) * gawk, awk and <1>: This Manual. (line 14) * gawk, awk and: Preface. (line 23) @@ -26076,13 +27143,13 @@ Index * gawk, distribution: Distribution contents. (line 6) * gawk, ERRNO variable in <1>: TCP/IP Networking. (line 54) -* gawk, ERRNO variable in <2>: Auto-set. (line 72) +* gawk, ERRNO variable in <2>: Auto-set. (line 73) * gawk, ERRNO variable in <3>: BEGINFILE/ENDFILE. (line 26) * gawk, ERRNO variable in <4>: Close Files And Pipes. (line 139) * gawk, ERRNO variable in: Getline. (line 19) * gawk, escape sequences: Escape Sequences. (line 125) -* gawk, extensions, disabling: Options. (line 202) +* gawk, extensions, disabling: Options. (line 247) * gawk, features, adding: Adding Code. (line 6) * gawk, features, advanced: Advanced Features. (line 6) * gawk, fflush() function in: I/O Functions. (line 44) @@ -26094,8 +27161,9 @@ Index * gawk, FPAT variable in <1>: User-modified. (line 45) * gawk, FPAT variable in: Splitting By Content. (line 26) +* gawk, FUNCTAB array in: Auto-set. (line 119) * gawk, function arguments and: Calling Built-in. (line 16) -* gawk, functions, adding: Dynamic Extensions. (line 10) +* gawk, functions, adding: Dynamic Extensions. (line 9) * gawk, hexadecimal numbers and: Nondecimal-numbers. (line 42) * gawk, IGNORECASE variable in <1>: Array Sorting Functions. (line 81) @@ -26110,7 +27178,6 @@ Index * gawk, implementation issues, limits: Getline Notes. (line 14) * gawk, implementation issues, pipes: Redirection. (line 135) * gawk, installing: Installation. (line 6) -* gawk, internals: Internals. (line 6) * gawk, internationalization and, See internationalization: Internationalization. (line 13) * gawk, interpreter, adding code to: Using Internal File Ops. @@ -26126,7 +27193,7 @@ Index * gawk, OS/2 version of: PC Using. (line 11) * gawk, PROCINFO array in <1>: Two-way I/O. (line 116) * gawk, PROCINFO array in <2>: Time Functions. (line 46) -* gawk, PROCINFO array in: Auto-set. (line 123) +* gawk, PROCINFO array in: Auto-set. (line 130) * gawk, regexp constants and: Using Constant Regexps. (line 28) * gawk, regular expressions, case sensitivity: Case-sensitivity. @@ -26134,7 +27201,7 @@ Index * gawk, regular expressions, operators: GNU Regexp Operators. (line 6) * gawk, regular expressions, precedence: Regexp Operators. (line 161) -* gawk, RT variable in <1>: Auto-set. (line 196) +* gawk, RT variable in <1>: Auto-set. (line 246) * gawk, RT variable in <2>: Getline/Variable/File. (line 10) * gawk, RT variable in <3>: Multiple Line. (line 129) @@ -26143,10 +27210,11 @@ Index * gawk, source code, obtaining: Getting. (line 6) * gawk, splitting fields and: Constant Size. (line 87) * gawk, string-translation functions: I18N Functions. (line 6) -* gawk, TEXTDOMAIN variable in: User-modified. (line 153) +* gawk, SYMTAB array in: Auto-set. (line 254) +* gawk, TEXTDOMAIN variable in: User-modified. (line 162) * gawk, timestamps: Time Functions. (line 6) * gawk, uses for: Preface. (line 36) -* gawk, versions of, information about, printing: Options. (line 253) +* gawk, versions of, information about, printing: Options. (line 293) * gawk, VMS version of: VMS Installation. (line 6) * gawk, word-boundary operator: GNU Regexp Operators. (line 63) @@ -26156,12 +27224,6 @@ Index * gensub() function (gawk): Using Constant Regexps. (line 43) * gensub() function (gawk), escape processing: Gory Details. (line 6) -* get_actual_argument() internal function: Internals. (line 125) -* get_argument() internal function: Internals. (line 120) -* get_array_argument() internal macro: Internals. (line 136) -* get_curfunc_arg_count() internal function: Internals. (line 42) -* get_record() input method: Internals. (line 160) -* get_scalar_argument() internal macro: Internals. (line 133) * getaddrinfo() function (C library): TCP/IP Networking. (line 38) * getgrent() function (C library): Group Functions. (line 6) * getgrent() user-defined function: Group Functions. (line 6) @@ -26186,6 +27248,8 @@ Index * getline command, variants: Getline Summary. (line 6) * getline statement, BEGINFILE/ENDFILE patterns and: BEGINFILE/ENDFILE. (line 54) +* getlocaltime() user-defined function: Getlocaltime Function. + (line 16) * getopt() function (C library): Getopt Function. (line 15) * getopt() user-defined function: Getopt Function. (line 108) * getpwent() function (C library): Passwd Functions. (line 16) @@ -26197,8 +27261,8 @@ Index * gettext library: Explaining gettext. (line 6) * gettext library, locale categories: Explaining gettext. (line 80) * gettext() function (C library): Explaining gettext. (line 62) -* gettimeofday() user-defined function: Gettimeofday Function. - (line 16) +* GMP: Arbitrary Precision Arithmetic. + (line 6) * GNITS mailing list: Acknowledgments. (line 52) * GNU awk, See gawk: Preface. (line 49) * GNU Free Documentation License: GNU Free Documentation License. @@ -26207,7 +27271,7 @@ Index * GNU Lesser General Public License: Glossary. (line 401) * GNU long options <1>: Options. (line 6) * GNU long options: Command Line. (line 13) -* GNU long options, printing list of: Options. (line 145) +* GNU long options, printing list of: Options. (line 168) * GNU Project <1>: Glossary. (line 319) * GNU Project: Manual History. (line 11) * GNU/Linux <1>: Glossary. (line 615) @@ -26215,7 +27279,7 @@ Index * GNU/Linux: Manual History. (line 28) * GPL (General Public License) <1>: Glossary. (line 310) * GPL (General Public License): Manual History. (line 11) -* GPL (General Public License), printing: Options. (line 88) +* GPL (General Public License), printing: Options. (line 102) * grcat program: Group Functions. (line 16) * Grigera, Juan: Contributors. (line 58) * group database, reading: Group Functions. (line 6) @@ -26226,7 +27290,7 @@ Index (line 43) * gsub() function, arguments of: String Functions. (line 462) * gsub() function, escape processing: Gory Details. (line 6) -* h debugger command (alias for help): Miscellaneous Dgawk Commands. +* h debugger command (alias for help): Miscellaneous Debugger Commands. (line 68) * Hankerson, Darrel <1>: Contributors. (line 61) * Hankerson, Darrel: Acknowledgments. (line 60) @@ -26235,28 +27299,30 @@ Index * Hartholz, Elaine: Acknowledgments. (line 38) * Hartholz, Marshall: Acknowledgments. (line 38) * Hasegawa, Isamu: Contributors. (line 94) -* help debugger command: Miscellaneous Dgawk Commands. +* help debugger command: Miscellaneous Debugger Commands. (line 68) * hexadecimal numbers: Nondecimal-numbers. (line 6) -* hexadecimal values, enabling interpretation of: Options. (line 169) +* hexadecimal values, enabling interpretation of: Options. (line 207) * histsort.awk program: History Sorting. (line 25) * Hughes, Phil: Acknowledgments. (line 43) -* HUP signal: Profiling. (line 204) +* HUP signal: Profiling. (line 203) * hyphen (-), - operator: Precedence. (line 52) * hyphen (-), -- (decrement/increment) operators: Precedence. (line 46) * hyphen (-), -- operator: Increment Ops. (line 48) * hyphen (-), -= operator <1>: Precedence. (line 95) * hyphen (-), -= operator: Assignment Ops. (line 129) -* hyphen (-), filenames beginning with: Options. (line 59) +* hyphen (-), filenames beginning with: Options. (line 73) * hyphen (-), in bracket expressions: Bracket Expressions. (line 17) -* i debugger command (alias for info): Dgawk Info. (line 12) +* i debugger command (alias for info): Debugger Info. (line 13) * id utility: Id Program. (line 6) * id.awk program: Id Program. (line 30) +* IEEE-754 format: Floating-point Representation. + (line 6) * if statement <1>: If Statement. (line 6) * if statement: Regexp Usage. (line 19) * if statement, actions, changing: Ranges. (line 25) * igawk.sh program: Igawk Program. (line 124) -* ignore debugger command: Breakpoint Control. (line 86) +* ignore debugger command: Breakpoint Control. (line 87) * IGNORECASE variable <1>: Array Sorting Functions. (line 81) * IGNORECASE variable <2>: String Functions. (line 29) @@ -26284,7 +27350,9 @@ Index * index() function: String Functions. (line 155) * indexing arrays: Array Intro. (line 50) * indirect function calls: Indirect Calls. (line 6) -* info debugger command: Dgawk Info. (line 12) +* infinite precision: Arbitrary Precision Arithmetic. + (line 6) +* info debugger command: Debugger Info. (line 13) * initialization, automatic: More Complex. (line 38) * input files: Reading Files. (line 6) * input files, closing: Close Files And Pipes. @@ -26309,47 +27377,18 @@ Index * insomnia, cure for: Alarm Program. (line 6) * installation, VMS: VMS Installation. (line 6) * installing gawk: Installation. (line 6) -* INT signal (MS-Windows): Profiling. (line 207) +* INT signal (MS-Windows): Profiling. (line 206) * int() function: Numeric Functions. (line 23) -* integers: Basic Data Typing. (line 21) -* integers, unsigned: Basic Data Typing. (line 30) +* integer, arbitrary precision: Arbitrary Precision Integers. + (line 6) +* integers: General Arithmetic. (line 6) +* integers, unsigned: General Arithmetic. (line 15) * interacting with other programs: I/O Functions. (line 63) -* internal constant, INVALID_HANDLE: Internals. (line 160) -* internal function, assoc_clear(): Internals. (line 75) -* internal function, assoc_lookup(): Internals. (line 79) -* internal function, dupnode(): Internals. (line 96) -* internal function, force_number(): Internals. (line 27) -* internal function, force_string(): Internals. (line 32) -* internal function, force_wstring(): Internals. (line 37) -* internal function, get_actual_argument(): Internals. (line 125) -* internal function, get_argument(): Internals. (line 120) -* internal function, get_curfunc_arg_count(): Internals. (line 42) -* internal function, iop_alloc(): Internals. (line 160) -* internal function, make_builtin(): Internals. (line 106) -* internal function, make_number(): Internals. (line 91) -* internal function, make_string(): Internals. (line 86) -* internal function, register_deferred_variable(): Internals. (line 149) -* internal function, register_open_hook(): Internals. (line 160) -* internal function, unref(): Internals. (line 101) -* internal function, update_ERRNO(): Internals. (line 139) -* internal function, update_ERRNO_saved(): Internals. (line 144) -* internal macro, get_array_argument(): Internals. (line 136) -* internal macro, get_scalar_argument(): Internals. (line 133) -* internal structure, IOBUF: Internals. (line 160) -* internal type, AWKNUM: Internals. (line 19) -* internal type, NODE: Internals. (line 23) -* internal variable, nargs: Internals. (line 49) -* internal variable, stlen: Internals. (line 53) -* internal variable, stptr: Internals. (line 53) -* internal variable, type: Internals. (line 66) -* internal variable, vname: Internals. (line 71) -* internal variable, wstlen: Internals. (line 61) -* internal variable, wstptr: Internals. (line 61) * internationalization <1>: I18N and L10N. (line 6) * internationalization: I18N Functions. (line 6) * internationalization, localization <1>: Internationalization. (line 13) -* internationalization, localization: User-modified. (line 153) +* internationalization, localization: User-modified. (line 162) * internationalization, localization, character classes: Bracket Expressions. (line 90) * internationalization, localization, gawk and: Internationalization. @@ -26364,10 +27403,7 @@ Index * interpreted programs <1>: Glossary. (line 361) * interpreted programs: Basic High Level. (line 14) * interval expressions: Regexp Operators. (line 116) -* INVALID_HANDLE internal constant: Internals. (line 160) * inventory-shipped file: Sample Data Files. (line 32) -* IOBUF internal structure: Internals. (line 160) -* iop_alloc() internal function: Internals. (line 160) * isarray() function (gawk): Type Functions. (line 11) * ISO: Glossary. (line 372) * ISO 8859-1: Glossary. (line 141) @@ -26375,30 +27411,33 @@ Index * Jacobs, Andrew: Passwd Functions. (line 90) * Jaegermann, Michal <1>: Contributors. (line 46) * Jaegermann, Michal: Acknowledgments. (line 60) -* Java implementation of awk: Other Versions. (line 96) +* Java implementation of awk: Other Versions. (line 97) * Java programming language: Glossary. (line 384) -* jawk: Other Versions. (line 96) +* jawk: Other Versions. (line 97) * Jedi knights: Undocumented. (line 6) * join() user-defined function: Join Function. (line 18) * Kahrs, Ju"rgen <1>: Contributors. (line 70) * Kahrs, Ju"rgen: Acknowledgments. (line 60) * Kasal, Stepan: Acknowledgments. (line 60) * Kenobi, Obi-Wan: Undocumented. (line 6) -* Kernighan, Brian <1>: Basic Data Typing. (line 74) +* Kernighan, Brian <1>: Basic Data Typing. (line 55) * Kernighan, Brian <2>: Other Versions. (line 13) * Kernighan, Brian <3>: Contributors. (line 12) * Kernighan, Brian <4>: BTL. (line 6) * Kernighan, Brian <5>: Concatenation. (line 6) -* Kernighan, Brian <6>: Acknowledgments. (line 75) +* Kernighan, Brian <6>: Acknowledgments. (line 77) * Kernighan, Brian <7>: Conventions. (line 34) * Kernighan, Brian: History. (line 17) -* kill command, dynamic profiling: Profiling. (line 182) +* kill command, dynamic profiling: Profiling. (line 180) * Knights, jedi: Undocumented. (line 6) +* Knuth, Donald: Arbitrary Precision Arithmetic. + (line 6) * Kwok, Conrad: Contributors. (line 35) -* l debugger command (alias for list): Miscellaneous Dgawk Commands. +* l debugger command (alias for list): Miscellaneous Debugger Commands. (line 74) * labels.awk program: Labels Program. (line 51) * languages, data-driven: Basic High Level. (line 83) +* Laurie, Dirk: Changing Precision. (line 6) * LC_ALL locale category: Explaining gettext. (line 120) * LC_COLLATE locale category: Explaining gettext. (line 93) * LC_CTYPE locale category: Explaining gettext. (line 97) @@ -26421,7 +27460,7 @@ Index * length() function: String Functions. (line 166) * Lesser General Public License (LGPL): Glossary. (line 401) * LGPL (Lesser General Public License): Glossary. (line 401) -* libmawk: Other Versions. (line 104) +* libmawk: Other Versions. (line 105) * libraries of awk functions: Library Functions. (line 6) * libraries of awk functions, assertions: Assert Function. (line 6) * libraries of awk functions, associative arrays and: Library Names. @@ -26436,7 +27475,7 @@ Index (line 6) * libraries of awk functions, managing, data files: Data File Management. (line 6) -* libraries of awk functions, managing, time: Gettimeofday Function. +* libraries of awk functions, managing, time: Getlocaltime Function. (line 6) * libraries of awk functions, merging arrays into strings: Join Function. (line 6) @@ -26459,20 +27498,21 @@ Index * lint checking, array subscripts: Uninitialized Subscripts. (line 43) * lint checking, empty programs: Command Line. (line 16) -* lint checking, issuing warnings: Options. (line 150) +* lint checking, issuing warnings: Options. (line 182) * lint checking, POSIXLY_CORRECT environment variable: Options. - (line 292) + (line 332) * lint checking, undefined functions: Pass By Value/Reference. (line 88) * LINT variable: User-modified. (line 98) * Linux <1>: Glossary. (line 615) * Linux <2>: I18N Example. (line 55) * Linux: Manual History. (line 28) -* list debugger command: Miscellaneous Dgawk Commands. +* list debugger command: Miscellaneous Debugger Commands. (line 74) +* loading, library: Options. (line 173) * local variables: Variable Scope. (line 6) * locale categories: Explaining gettext. (line 80) -* locale decimal point character: Options. (line 218) +* locale decimal point character: Options. (line 263) * locale, definition of: Locales. (line 6) * localization: I18N and L10N. (line 6) * localization, See internationalization, localization: I18N and L10N. @@ -26485,18 +27525,14 @@ Index * long options: Command Line. (line 13) * loops: While Statement. (line 6) * loops, continue statements and: For Statement. (line 64) -* loops, count for header: Profiling. (line 126) +* loops, count for header: Profiling. (line 123) * loops, exiting: Break Statement. (line 6) * loops, See Also while statement: While Statement. (line 6) -* Lost In Space: Dynamic Extensions. (line 6) * ls utility: More Complex. (line 15) -* lshift() function (gawk): Bitwise Functions. (line 45) +* lshift() function (gawk): Bitwise Functions. (line 46) * lvalues/rvalues: Assignment Ops. (line 32) * mailing labels, printing: Labels Program. (line 6) * mailing list, GNITS: Acknowledgments. (line 52) -* make_builtin() internal function: Internals. (line 106) -* make_number() internal function: Internals. (line 91) -* make_string() internal function: Internals. (line 86) * mark parity: Ordinal Functions. (line 45) * marked string extraction (internationalization): String Extraction. (line 6) @@ -26511,7 +27547,6 @@ Index * matching, null strings: Gory Details. (line 164) * mawk program: Other Versions. (line 35) * McPhee, Patrick: Contributors. (line 100) -* memory, releasing: Internals. (line 101) * message object files: Explaining gettext. (line 41) * message object files, converting from portable object files: I18N Example. (line 62) @@ -26523,8 +27558,12 @@ Index * mktime() function (gawk): Time Functions. (line 24) * modifiers, in format specifiers: Format Modifiers. (line 6) * monetary information, localization: Explaining gettext. (line 103) +* MPFR: Arbitrary Precision Arithmetic. + (line 6) * msgfmt utility: I18N Example. (line 62) -* n debugger command (alias for next): Dgawk Execution Control. +* multiple precision: Arbitrary Precision Arithmetic. + (line 6) +* n debugger command (alias for next): Debugger Execution Control. (line 43) * names, arrays/variables <1>: Library Names. (line 6) * names, arrays/variables: Arrays. (line 18) @@ -26533,14 +27572,13 @@ Index * namespace issues <1>: Library Names. (line 6) * namespace issues: Arrays. (line 18) * namespace issues, functions: Definition Syntax. (line 20) -* nargs internal variable: Internals. (line 49) * nawk utility: Names. (line 17) -* negative zero: Unexpected Results. (line 28) +* negative zero: Unexpected Results. (line 34) * NetBSD: Glossary. (line 615) * networks, programming: TCP/IP Networking. (line 6) * networks, support for: Special Network. (line 6) * newlines <1>: Boolean Ops. (line 67) -* newlines <2>: Options. (line 208) +* newlines <2>: Options. (line 253) * newlines: Statements/Lines. (line 6) * newlines, as field separators: Default Field Splitting. (line 6) @@ -26551,7 +27589,7 @@ Index * newlines, separating statements in actions <1>: Statements. (line 10) * newlines, separating statements in actions: Action Overview. (line 19) -* next debugger command: Dgawk Execution Control. +* next debugger command: Debugger Execution Control. (line 43) * next statement <1>: Next Statement. (line 6) * next statement: Boolean Ops. (line 85) @@ -26566,21 +27604,19 @@ Index (line 26) * nextfile statement, user-defined functions and: Nextfile Statement. (line 47) -* nexti debugger command: Dgawk Execution Control. +* nexti debugger command: Debugger Execution Control. (line 49) -* NF variable <1>: Auto-set. (line 107) +* NF variable <1>: Auto-set. (line 108) * NF variable: Fields. (line 33) * NF variable, decrementing: Changing Fields. (line 107) -* ni debugger command (alias for nexti): Dgawk Execution Control. +* ni debugger command (alias for nexti): Debugger Execution Control. (line 49) * noassign.awk program: Ignoring Assigns. (line 15) -* NODE internal type: Internals. (line 23) -* nodes, duplicating: Internals. (line 96) * not Boolean-logic operator: Boolean Ops. (line 6) -* NR variable <1>: Auto-set. (line 118) +* NR variable <1>: Auto-set. (line 125) * NR variable: Records. (line 6) -* NR variable, changing: Auto-set. (line 207) -* null strings <1>: Basic Data Typing. (line 50) +* NR variable, changing: Auto-set. (line 295) +* null strings <1>: Basic Data Typing. (line 26) * null strings <2>: Truth Values. (line 6) * null strings <3>: Regexp Field Splitting. (line 43) @@ -26596,31 +27632,27 @@ Index * number sign (#), #! (executable scripts), portability issues with: Executable Scripts. (line 6) * number sign (#), commenting: Comments. (line 6) -* numbers: Internals. (line 91) * numbers, as array subscripts: Numeric Array Subscripts. (line 6) * numbers, as values of characters: Ordinal Functions. (line 6) * numbers, Cliff random: Cliff Random Function. (line 6) -* numbers, converting <1>: Bitwise Functions. (line 107) +* numbers, converting <1>: Bitwise Functions. (line 109) * numbers, converting: Conversion. (line 6) * numbers, converting, to strings: User-modified. (line 28) -* numbers, floating-point: Basic Data Typing. (line 21) -* numbers, floating-point, AWKNUM internal type: Internals. (line 19) +* numbers, floating-point: General Arithmetic. (line 6) * numbers, hexadecimal: Nondecimal-numbers. (line 6) -* numbers, NODE internal type: Internals. (line 23) * numbers, octal: Nondecimal-numbers. (line 6) * numbers, random: Numeric Functions. (line 64) * numbers, rounding: Round Function. (line 6) * numeric, constants: Scalar Constants. (line 6) * numeric, output format: OFMT. (line 6) * numeric, strings: Variable Typing. (line 6) -* numeric, values: Internals. (line 27) -* o debugger command (alias for option): Dgawk Info. (line 56) +* o debugger command (alias for option): Debugger Info. (line 57) * oawk utility: Names. (line 17) * obsolete features: Obsolete. (line 6) * octal numbers: Nondecimal-numbers. (line 6) -* octal values, enabling interpretation of: Options. (line 169) +* octal values, enabling interpretation of: Options. (line 207) * OFMT variable <1>: User-modified. (line 115) * OFMT variable <2>: Conversion. (line 55) * OFMT variable: OFMT. (line 15) @@ -26629,7 +27661,7 @@ Index * OFS variable <2>: Output Separators. (line 6) * OFS variable: Changing Fields. (line 64) * OpenBSD: Glossary. (line 615) -* OpenSolaris: Other Versions. (line 86) +* OpenSolaris: Other Versions. (line 87) * operating systems, BSD-based: Manual History. (line 28) * operating systems, PC, gawk on: PC Using. (line 6) * operating systems, PC, gawk on, installing: PC Installation. @@ -26662,21 +27694,21 @@ Index (line 48) * operators, word-boundary (gawk): GNU Regexp Operators. (line 63) -* option debugger command: Dgawk Info. (line 56) +* option debugger command: Debugger Info. (line 57) * options, command-line <1>: Command Line Field Separator. (line 6) * options, command-line <2>: Options. (line 6) * options, command-line: Long. (line 12) -* options, command-line, end of: Options. (line 54) +* options, command-line, end of: Options. (line 68) * options, command-line, invoking awk: Command Line. (line 6) * options, command-line, processing: Getopt Function. (line 6) * options, deprecated: Obsolete. (line 6) * options, long <1>: Options. (line 6) * options, long: Command Line. (line 13) -* options, printing list of: Options. (line 145) +* options, printing list of: Options. (line 168) * OR bitwise operation: Bitwise Functions. (line 6) * or Boolean-logic operator: Boolean Ops. (line 6) -* or() function (gawk): Bitwise Functions. (line 48) +* or() function (gawk): Bitwise Functions. (line 49) * ord() user-defined function: Ordinal Functions. (line 16) * order of evaluation, concatenation: Concatenation. (line 42) * ORS variable <1>: User-modified. (line 129) @@ -26699,15 +27731,14 @@ Index (line 36) * P1003.1 POSIX standard: Glossary. (line 458) * P1003.2 POSIX standard: Glossary. (line 458) -* parameters, number of: Internals. (line 49) +* parentheses () <1>: Profiling. (line 138) * parentheses (): Regexp Operators. (line 79) -* parentheses (), pgawk program: Profiling. (line 141) * password file: Passwd Functions. (line 16) * patsplit() function: String Functions. (line 293) * patterns: Patterns and Actions. (line 6) * patterns, comparison expressions as: Expression Patterns. (line 14) -* patterns, counts: Profiling. (line 113) +* patterns, counts: Profiling. (line 110) * patterns, default: Very Simple. (line 34) * patterns, empty: Empty. (line 6) * patterns, expressions as: Regexp Patterns. (line 6) @@ -26725,9 +27756,6 @@ Index * Perl: Future Extensions. (line 6) * Peters, Arno: Contributors. (line 85) * Peterson, Hal: Contributors. (line 40) -* pgawk program: Profiling. (line 6) -* pgawk program, awkprof.out file: Profiling. (line 10) -* pgawk program, dynamic profiling: Profiling. (line 174) * pipes, closing: Close Files And Pipes. (line 6) * pipes, input: Getline/Pipe. (line 6) @@ -26768,13 +27796,13 @@ Index * portability, NF variable, decrementing: Changing Fields. (line 115) * portability, operators: Increment Ops. (line 61) * portability, operators, not in POSIX awk: Precedence. (line 98) -* portability, POSIXLY_CORRECT environment variable: Options. (line 313) +* portability, POSIXLY_CORRECT environment variable: Options. (line 353) * portability, substr() function: String Functions. (line 512) * portable object files <1>: Translator i18n. (line 6) * portable object files: Explaining gettext. (line 36) * portable object files, converting to message object files: I18N Example. (line 62) -* portable object files, generating: Options. (line 138) +* portable object files, generating: Options. (line 161) * portable object template files: Explaining gettext. (line 30) * porting gawk: New Ports. (line 6) * positional specifiers, printf statement <1>: Printf Ordering. @@ -26782,7 +27810,7 @@ Index * positional specifiers, printf statement: Format Modifiers. (line 13) * positional specifiers, printf statement, mixing with regular formats: Printf Ordering. (line 57) -* positive zero: Unexpected Results. (line 28) +* positive zero: Unexpected Results. (line 34) * POSIX awk <1>: Assignment Ops. (line 136) * POSIX awk: This Manual. (line 14) * POSIX awk, ** operator and: Precedence. (line 98) @@ -26818,11 +27846,13 @@ Index * POSIX awk, regular expressions and: Regexp Operators. (line 161) * POSIX awk, timestamps and: Time Functions. (line 6) * POSIX awk, | I/O operator and: Getline/Pipe. (line 52) -* POSIX mode: Options. (line 202) +* POSIX mode: Options. (line 247) * POSIX, awk and: Preface. (line 23) * POSIX, gawk extensions not included in: POSIX/GNU. (line 6) * POSIX, programs, implementing in awk: Clones. (line 6) -* POSIXLY_CORRECT environment variable: Options. (line 292) +* POSIXLY_CORRECT environment variable: Options. (line 332) +* PREC variable <1>: Setting Precision. (line 6) +* PREC variable: User-modified. (line 134) * precedence <1>: Precedence. (line 6) * precedence: Increment Ops. (line 61) * precedence, regexp operators: Regexp Operators. (line 156) @@ -26856,24 +27886,23 @@ Index * printf statement, sprintf() function and: Round Function. (line 6) * printf statement, syntax of: Basic Printf. (line 6) * printing: Printing. (line 6) -* printing, list of options: Options. (line 145) +* printing, list of options: Options. (line 168) * printing, mailing labels: Labels Program. (line 6) * printing, unduplicated lines of text: Uniq Program. (line 6) * printing, user information: Id Program. (line 6) * private variables: Library Names. (line 11) * processes, two-way communications with: Two-way I/O. (line 23) * processing data: Basic High Level. (line 6) -* PROCINFO array <1>: Internals. (line 149) -* PROCINFO array <2>: Id Program. (line 15) -* PROCINFO array <3>: Group Functions. (line 6) -* PROCINFO array <4>: Passwd Functions. (line 6) -* PROCINFO array <5>: Two-way I/O. (line 116) -* PROCINFO array <6>: Time Functions. (line 46) -* PROCINFO array <7>: Auto-set. (line 123) +* PROCINFO array <1>: Id Program. (line 15) +* PROCINFO array <2>: Group Functions. (line 6) +* PROCINFO array <3>: Passwd Functions. (line 6) +* PROCINFO array <4>: Two-way I/O. (line 116) +* PROCINFO array <5>: Time Functions. (line 46) +* PROCINFO array <6>: Auto-set. (line 130) * PROCINFO array: Obsolete. (line 11) * profiling awk programs: Profiling. (line 6) -* profiling awk programs, dynamically: Profiling. (line 174) -* profiling gawk, See pgawk program: Profiling. (line 6) +* profiling awk programs, dynamically: Profiling. (line 171) +* profiling gawk: Profiling. (line 6) * program, definition of: Getting Started. (line 21) * programmers, attractiveness of: Two-way I/O. (line 6) * programming conventions, --non-decimal-data option: Nondecimal Data. @@ -26897,23 +27926,23 @@ Index * programming, basic steps: Basic High Level. (line 19) * programming, concepts: Basic Concepts. (line 6) * pwcat program: Passwd Functions. (line 23) -* q debugger command (alias for quit): Miscellaneous Dgawk Commands. +* q debugger command (alias for quit): Miscellaneous Debugger Commands. (line 101) -* QSE Awk: Other Versions. (line 108) +* QSE Awk: Other Versions. (line 109) * question mark (?) regexp operator <1>: GNU Regexp Operators. (line 59) * question mark (?) regexp operator: Regexp Operators. (line 111) * question mark (?), ?: operator: Precedence. (line 92) -* QuikTrim Awk: Other Versions. (line 112) -* quit debugger command: Miscellaneous Dgawk Commands. +* QuikTrim Awk: Other Versions. (line 113) +* quit debugger command: Miscellaneous Debugger Commands. (line 101) -* QUIT signal (MS-Windows): Profiling. (line 207) +* QUIT signal (MS-Windows): Profiling. (line 206) * quoting <1>: Comments. (line 27) * quoting <2>: Long. (line 26) * quoting: Read Terminal. (line 25) * quoting, rules for: Quoting. (line 6) * quoting, tricks for: Quoting. (line 71) -* r debugger command (alias for run): Dgawk Execution Control. +* r debugger command (alias for run): Debugger Execution Control. (line 62) * Rakitzis, Byron: History Sorting. (line 25) * rand() function: Numeric Functions. (line 34) @@ -26931,7 +27960,7 @@ Index * readable data files, checking: File Checking. (line 6) * readable.awk program: File Checking. (line 11) * recipe for a programming language: History. (line 6) -* record separators <1>: User-modified. (line 134) +* record separators <1>: User-modified. (line 143) * record separators: Records. (line 14) * record separators, changing: Records. (line 81) * record separators, regular expressions as: Records. (line 117) @@ -26959,8 +27988,6 @@ Index * regexp constants, slashes vs. quotes: Computed Regexps. (line 28) * regexp constants, vs. string constants: Computed Regexps. (line 38) * regexp, See regular expressions: Regexp. (line 6) -* register_deferred_variable() internal function: Internals. (line 149) -* register_open_hook() internal function: Internals. (line 160) * regular expressions: Regexp. (line 6) * regular expressions as field separators: Field Separators. (line 50) * regular expressions, anchors in: Regexp Operators. (line 22) @@ -26979,7 +28006,7 @@ Index (line 59) * regular expressions, gawk, command-line options: GNU Regexp Operators. (line 70) -* regular expressions, interval expressions and: Options. (line 227) +* regular expressions, interval expressions and: Options. (line 272) * regular expressions, leftmost longest match: Leftmost Longest. (line 6) * regular expressions, operators <1>: Regexp Operators. (line 6) @@ -26995,7 +28022,7 @@ Index * regular expressions, searching for: Egrep Program. (line 6) * relational operators, See comparison operators: Typing and Comparison. (line 9) -* return debugger command: Dgawk Execution Control. +* return debugger command: Debugger Execution Control. (line 54) * return statement, user-defined functions: Return Statement. (line 6) * return values, close() function: Close Files And Pipes. @@ -27012,8 +28039,8 @@ Index * right angle bracket (>), >> operator (I/O) <1>: Precedence. (line 65) * right angle bracket (>), >> operator (I/O): Redirection. (line 50) * right shift, bitwise: Bitwise Functions. (line 32) -* Ritchie, Dennis: Basic Data Typing. (line 74) -* RLENGTH variable: Auto-set. (line 183) +* Ritchie, Dennis: Basic Data Typing. (line 55) +* RLENGTH variable: Auto-set. (line 233) * RLENGTH variable, match() function and: String Functions. (line 223) * Robbins, Arnold <1>: Future Extensions. (line 6) * Robbins, Arnold <2>: Bugs. (line 32) @@ -27024,23 +28051,25 @@ Index * Robbins, Arnold: Command Line Field Separator. (line 80) * Robbins, Bill: Getline/Pipe. (line 36) -* Robbins, Harry: Acknowledgments. (line 81) -* Robbins, Jean: Acknowledgments. (line 81) +* Robbins, Harry: Acknowledgments. (line 83) +* Robbins, Jean: Acknowledgments. (line 83) * Robbins, Miriam <1>: Passwd Functions. (line 90) * Robbins, Miriam <2>: Getline/Pipe. (line 36) -* Robbins, Miriam: Acknowledgments. (line 81) -* Robinson, Will: Dynamic Extensions. (line 6) -* robot, the: Dynamic Extensions. (line 6) +* Robbins, Miriam: Acknowledgments. (line 83) * Rommel, Kai Uwe: Contributors. (line 43) * round() user-defined function: Round Function. (line 16) +* rounding mode, floating-point: Rounding Mode. (line 6) * rounding numbers: Round Function. (line 6) -* RS variable <1>: User-modified. (line 134) +* ROUNDMODE variable <1>: Setting Rounding Mode. + (line 6) +* ROUNDMODE variable: User-modified. (line 138) +* RS variable <1>: User-modified. (line 143) * RS variable: Records. (line 20) * RS variable, multiline records and: Multiple Line. (line 17) -* rshift() function (gawk): Bitwise Functions. (line 51) -* RSTART variable: Auto-set. (line 189) +* rshift() function (gawk): Bitwise Functions. (line 52) +* RSTART variable: Auto-set. (line 239) * RSTART variable, match() function and: String Functions. (line 223) -* RT variable <1>: Auto-set. (line 196) +* RT variable <1>: Auto-set. (line 246) * RT variable <2>: Getline/Variable/File. (line 10) * RT variable <3>: Multiple Line. (line 129) @@ -27048,12 +28077,12 @@ Index * Rubin, Paul <1>: Contributors. (line 16) * Rubin, Paul: History. (line 30) * rule, definition of: Getting Started. (line 21) -* run debugger command: Dgawk Execution Control. +* run debugger command: Debugger Execution Control. (line 62) * rvalues/lvalues: Assignment Ops. (line 32) -* s debugger command (alias for step): Dgawk Execution Control. +* s debugger command (alias for step): Debugger Execution Control. (line 68) -* sandbox mode: Options. (line 239) +* sandbox mode: Options. (line 279) * scalar values: Basic Data Typing. (line 13) * Schorr, Andrew: Acknowledgments. (line 60) * Schreiber, Bert: Acknowledgments. (line 38) @@ -27061,7 +28090,9 @@ Index * search paths <1>: VMS Running. (line 29) * search paths <2>: PC Using. (line 11) * search paths <3>: Igawk Program. (line 368) +* search paths <4>: AWKLIBPATH Variable. (line 6) * search paths: AWKPATH Variable. (line 6) +* search paths, for shared libraries: AWKLIBPATH Variable. (line 6) * search paths, for source files <1>: VMS Running. (line 29) * search paths, for source files <2>: PC Using. (line 11) * search paths, for source files <3>: Igawk Program. (line 368) @@ -27083,11 +28114,11 @@ Index * separators, field, FIELDWIDTHS variable and: User-modified. (line 35) * separators, field, FPAT variable and: User-modified. (line 45) * separators, field, POSIX and: Fields. (line 6) -* separators, for records <1>: User-modified. (line 134) +* separators, for records <1>: User-modified. (line 143) * separators, for records: Records. (line 14) * separators, for records, regular expressions as: Records. (line 117) * separators, for statements in actions: Action Overview. (line 19) -* separators, subscript: User-modified. (line 147) +* separators, subscript: User-modified. (line 156) * set debugger command: Viewing And Changing Data. (line 59) * shells, piping commands into: Redirection. (line 143) @@ -27099,7 +28130,7 @@ Index (line 6) * shift, bitwise: Bitwise Functions. (line 32) * short-circuit operators: Boolean Ops. (line 57) -* si debugger command (alias for stepi): Dgawk Execution Control. +* si debugger command (alias for stepi): Debugger Execution Control. (line 76) * side effects <1>: Increment Ops. (line 11) * side effects: Concatenation. (line 42) @@ -27114,18 +28145,18 @@ Index * side effects, FILENAME variable: Getline Notes. (line 19) * side effects, function calls: Function Calls. (line 54) * side effects, statements: Action Overview. (line 32) -* SIGHUP signal: Profiling. (line 204) -* SIGINT signal (MS-Windows): Profiling. (line 207) -* signals, HUP/SIGHUP: Profiling. (line 204) -* signals, INT/SIGINT (MS-Windows): Profiling. (line 207) -* signals, QUIT/SIGQUIT (MS-Windows): Profiling. (line 207) -* signals, USR1/SIGUSR1: Profiling. (line 182) -* SIGQUIT signal (MS-Windows): Profiling. (line 207) -* SIGUSR1 signal: Profiling. (line 182) -* silent debugger command: Dgawk Execution Control. +* SIGHUP signal: Profiling. (line 203) +* SIGINT signal (MS-Windows): Profiling. (line 206) +* signals, HUP/SIGHUP: Profiling. (line 203) +* signals, INT/SIGINT (MS-Windows): Profiling. (line 206) +* signals, QUIT/SIGQUIT (MS-Windows): Profiling. (line 206) +* signals, USR1/SIGUSR1: Profiling. (line 180) +* SIGQUIT signal (MS-Windows): Profiling. (line 206) +* SIGUSR1 signal: Profiling. (line 180) +* silent debugger command: Debugger Execution Control. (line 10) * sin() function: Numeric Functions. (line 75) -* single precision floating-point: Basic Data Typing. (line 36) +* single precision floating-point: General Arithmetic. (line 21) * single quote (') <1>: Quoting. (line 31) * single quote (') <2>: Long. (line 33) * single quote ('): One-shot. (line 15) @@ -27135,7 +28166,7 @@ Index (line 6) * Skywalker, Luke: Undocumented. (line 6) * sleep utility: Alarm Program. (line 109) -* Solaris, POSIX-compliant awk: Other Versions. (line 86) +* Solaris, POSIX-compliant awk: Other Versions. (line 87) * sort function, arrays, sorting: Array Sorting Functions. (line 6) * sort utility: Word Sorting. (line 50) @@ -27144,17 +28175,17 @@ Index (line 93) * source code, awka: Other Versions. (line 55) * source code, Brian Kernighan's awk: Other Versions. (line 13) -* source code, Busybox Awk: Other Versions. (line 78) +* source code, Busybox Awk: Other Versions. (line 79) * source code, gawk: Gawk Distribution. (line 6) -* source code, jawk: Other Versions. (line 96) -* source code, libmawk: Other Versions. (line 104) +* source code, jawk: Other Versions. (line 97) +* source code, libmawk: Other Versions. (line 105) * source code, mawk: Other Versions. (line 35) -* source code, mixing: Options. (line 108) +* source code, mixing: Options. (line 131) * source code, pawk: Other Versions. (line 69) -* source code, QSE Awk: Other Versions. (line 108) -* source code, QuikTrim Awk: Other Versions. (line 112) -* source code, Solaris awk: Other Versions. (line 86) -* source code, xgawk: Other Versions. (line 119) +* source code, QSE Awk: Other Versions. (line 109) +* source code, QuikTrim Awk: Other Versions. (line 113) +* source code, Solaris awk: Other Versions. (line 87) +* source code, xgawk: Other Versions. (line 120) * source files, search path for: Igawk Program. (line 368) * sparse arrays: Array Intro. (line 71) * Spencer, Henry: Glossary. (line 12) @@ -27182,12 +28213,10 @@ Index * statements, compound, control statements and: Statements. (line 10) * statements, control, in actions: Statements. (line 6) * statements, multiple: Statements/Lines. (line 91) -* step debugger command: Dgawk Execution Control. +* step debugger command: Debugger Execution Control. (line 68) -* stepi debugger command: Dgawk Execution Control. +* stepi debugger command: Debugger Execution Control. (line 76) -* stlen internal variable: Internals. (line 53) -* stptr internal variable: Internals. (line 53) * stream editors <1>: Simple Sed. (line 6) * stream editors: Field Splitting Summary. (line 47) @@ -27198,8 +28227,7 @@ Index (line 6) * string operators: Concatenation. (line 9) * string-matching operators: Regexp Usage. (line 19) -* strings: Internals. (line 86) -* strings, converting <1>: Bitwise Functions. (line 107) +* strings, converting <1>: Bitwise Functions. (line 109) * strings, converting: Conversion. (line 6) * strings, converting, numbers to: User-modified. (line 28) * strings, empty, See null strings: Records. (line 107) @@ -27207,7 +28235,6 @@ Index * strings, for localization: Programmer i18n. (line 14) * strings, length of: Scalar Constants. (line 20) * strings, merging arrays into: Join Function. (line 6) -* strings, NODE internal type: Internals. (line 23) * strings, null: Regexp Field Splitting. (line 43) * strings, numeric: Variable Typing. (line 6) @@ -27220,7 +28247,7 @@ Index (line 43) * sub() function, arguments of: String Functions. (line 462) * sub() function, escape processing: Gory Details. (line 6) -* subscript separators: User-modified. (line 147) +* subscript separators: User-modified. (line 156) * subscripts in arrays, multidimensional: Multi-dimensional. (line 10) * subscripts in arrays, multidimensional, scanning: Multi-scanning. (line 11) @@ -27228,25 +28255,26 @@ Index (line 6) * subscripts in arrays, uninitialized variables as: Uninitialized Subscripts. (line 6) -* SUBSEP variable: User-modified. (line 147) +* SUBSEP variable: User-modified. (line 156) * SUBSEP variable, multidimensional arrays: Multi-dimensional. (line 16) * substr() function: String Functions. (line 481) * Sumner, Andrew: Other Versions. (line 55) * switch statement: Switch Statement. (line 6) +* SYMTAB array: Auto-set. (line 254) * syntactic ambiguity: /= operator vs. /=.../ regexp constant: Assignment Ops. (line 148) * system() function: I/O Functions. (line 63) * systime() function (gawk): Time Functions. (line 64) -* t debugger command (alias for tbreak): Breakpoint Control. (line 89) -* tbreak debugger command: Breakpoint Control. (line 89) +* t debugger command (alias for tbreak): Breakpoint Control. (line 90) +* tbreak debugger command: Breakpoint Control. (line 90) * Tcl: Library Names. (line 57) * TCP/IP: TCP/IP Networking. (line 6) * TCP/IP, support for: Special Network. (line 6) * tee utility: Tee Program. (line 6) * tee.awk program: Tee Program. (line 26) * terminating records: Records. (line 117) -* testbits.awk program: Bitwise Functions. (line 68) +* testbits.awk program: Bitwise Functions. (line 70) * Texinfo <1>: Adding Code. (line 99) * Texinfo <2>: Distribution contents. (line 79) @@ -27261,7 +28289,7 @@ Index * text, printing: Print. (line 22) * text, printing, unduplicated lines of: Uniq Program. (line 6) * TEXTDOMAIN variable <1>: Programmer i18n. (line 9) -* TEXTDOMAIN variable: User-modified. (line 153) +* TEXTDOMAIN variable: User-modified. (line 162) * TEXTDOMAIN variable, BEGIN pattern and: Programmer i18n. (line 60) * TEXTDOMAIN variable, portability and: I18N Portability. (line 20) * textdomain() function (C library): Explaining gettext. (line 27) @@ -27275,20 +28303,21 @@ Index * tilde (~), ~ operator: Regexp Usage. (line 19) * time, alarm clock example program: Alarm Program. (line 9) * time, localization and: Explaining gettext. (line 115) -* time, managing: Gettimeofday Function. +* time, managing: Getlocaltime Function. (line 6) * time, retrieving: Time Functions. (line 17) +* timeout, reading input: Read Timeout. (line 6) * timestamps: Time Functions. (line 6) * timestamps, converting dates to: Time Functions. (line 74) -* timestamps, formatted: Gettimeofday Function. +* timestamps, formatted: Getlocaltime Function. (line 6) * tolower() function: String Functions. (line 523) * toupper() function: String Functions. (line 529) * tr utility: Translate Program. (line 6) -* trace debugger command: Miscellaneous Dgawk Commands. +* trace debugger command: Miscellaneous Debugger Commands. (line 110) * translate.awk program: Translate Program. (line 55) -* troubleshooting, --non-decimal-data option: Options. (line 169) +* troubleshooting, --non-decimal-data option: Options. (line 207) * troubleshooting, == operator: Comparison Operators. (line 37) * troubleshooting, awk uses FS not IFS: Field Separators. (line 29) @@ -27320,7 +28349,7 @@ Index * troubleshooting, substr() function: String Functions. (line 499) * troubleshooting, system() function: I/O Functions. (line 85) * troubleshooting, typographical errors, global variables: Options. - (line 98) + (line 112) * true, logical: Truth Values. (line 6) * Trueman, David <1>: Contributors. (line 31) * Trueman, David <2>: Acknowledgments. (line 47) @@ -27328,8 +28357,7 @@ Index * trunc-mod operation: Arithmetic Ops. (line 66) * truth values: Truth Values. (line 6) * type conversion: Conversion. (line 21) -* type internal variable: Internals. (line 66) -* u debugger command (alias for until): Dgawk Execution Control. +* u debugger command (alias for until): Debugger Execution Control. (line 83) * undefined functions: Pass By Value/Reference. (line 71) @@ -27354,23 +28382,20 @@ Index (line 72) * Unix, awk scripts and: Executable Scripts. (line 6) * UNIXROOT variable, on OS/2 systems: PC Using. (line 17) -* unref() internal function: Internals. (line 101) -* unsigned integers: Basic Data Typing. (line 30) -* until debugger command: Dgawk Execution Control. +* unsigned integers: General Arithmetic. (line 15) +* until debugger command: Debugger Execution Control. (line 83) * unwatch debugger command: Viewing And Changing Data. (line 84) -* up debugger command: Dgawk Stack. (line 33) -* update_ERRNO() internal function: Internals. (line 139) -* update_ERRNO_saved() internal function: Internals. (line 144) +* up debugger command: Execution Stack. (line 33) * user database, reading: Passwd Functions. (line 6) * user-defined, functions: User-defined. (line 6) -* user-defined, functions, counts: Profiling. (line 132) +* user-defined, functions, counts: Profiling. (line 129) * user-defined, variables: Variables. (line 6) * user-modifiable variables: User-modified. (line 6) * users, information about, printing: Id Program. (line 6) * users, information about, retrieving: Passwd Functions. (line 16) -* USR1 signal: Profiling. (line 182) +* USR1 signal: Profiling. (line 180) * values, numeric: Basic Data Typing. (line 13) * values, string: Basic Data Typing. (line 13) * variable typing: Typing and Comparison. @@ -27380,7 +28405,7 @@ Index * variables, assigning on command line: Assignment Options. (line 6) * variables, built-in <1>: Built-in Variables. (line 6) * variables, built-in: Using Variables. (line 20) -* variables, built-in, -v option, setting with: Options. (line 40) +* variables, built-in, -v option, setting with: Options. (line 54) * variables, built-in, conveying information: Auto-set. (line 6) * variables, flag: Boolean Ops. (line 67) * variables, getline command into, using <1>: Getline/Variable/Coprocess. @@ -27391,12 +28416,12 @@ Index (line 6) * variables, getline command into, using: Getline/Variable. (line 6) * variables, global, for library functions: Library Names. (line 11) -* variables, global, printing list of: Options. (line 93) +* variables, global, printing list of: Options. (line 107) * variables, initializing: Using Variables. (line 20) * variables, local: Variable Scope. (line 6) * variables, names of: Arrays. (line 18) * variables, private: Library Names. (line 11) -* variables, setting: Options. (line 32) +* variables, setting: Options. (line 46) * variables, shadowing: Definition Syntax. (line 61) * variables, types of: Assignment Ops. (line 40) * variables, types of, comparison expressions and: Typing and Comparison. @@ -27413,7 +28438,6 @@ Index * vertical bar (|), || operator <1>: Precedence. (line 89) * vertical bar (|), || operator: Boolean Ops. (line 57) * Vinschen, Corinna: Acknowledgments. (line 60) -* vname internal variable: Internals. (line 71) * w debugger command (alias for watch): Viewing And Changing Data. (line 67) * w utility: Constant Size. (line 22) @@ -27421,7 +28445,7 @@ Index * Wall, Larry <1>: Future Extensions. (line 6) * Wall, Larry: Array Intro. (line 6) * Wallin, Anders: Acknowledgments. (line 60) -* warnings, issuing: Options. (line 150) +* warnings, issuing: Options. (line 182) * watch debugger command: Viewing And Changing Data. (line 67) * wc utility: Wc Program. (line 6) @@ -27433,7 +28457,7 @@ Index * whitespace, as field separators: Default Field Splitting. (line 6) * whitespace, functions, calling: Calling Built-in. (line 10) -* whitespace, newlines as: Options. (line 208) +* whitespace, newlines as: Options. (line 253) * Williams, Kent: Contributors. (line 35) * Woehlke, Matthew: Contributors. (line 79) * Woods, John: Contributors. (line 28) @@ -27447,22 +28471,19 @@ Index * words, counting: Wc Program. (line 6) * words, duplicate, searching for: Dupword Program. (line 6) * words, usage counts, generating: Word Sorting. (line 6) -* wstlen internal variable: Internals. (line 61) -* wstptr internal variable: Internals. (line 61) -* xgawk: Other Versions. (line 119) +* xgawk: Other Versions. (line 120) * xgettext utility: String Extraction. (line 13) -* XML (eXtensible Markup Language): Internals. (line 160) * XOR bitwise operation: Bitwise Functions. (line 6) -* xor() function (gawk): Bitwise Functions. (line 54) +* xor() function (gawk): Bitwise Functions. (line 55) * Yawitz, Efraim: Contributors. (line 106) * Zaretskii, Eli <1>: Bugs. (line 70) * Zaretskii, Eli <2>: Contributors. (line 56) * Zaretskii, Eli: Acknowledgments. (line 60) -* zero, negative vs. positive: Unexpected Results. (line 28) +* zero, negative vs. positive: Unexpected Results. (line 34) * zerofile.awk program: Empty Files. (line 21) * Zoulas, Christos: Contributors. (line 67) +* {} (braces): Profiling. (line 134) * {} (braces), actions and: Action Overview. (line 19) -* {} (braces), pgawk program: Profiling. (line 137) * {} (braces), statements, grouping: Statements. (line 10) * | (vertical bar): Regexp Operators. (line 69) * | (vertical bar), | operator (I/O) <1>: Precedence. (line 65) @@ -27489,418 +28510,450 @@ Index Tag Table: Node: Top1352 -Node: Foreword30282 -Node: Preface34627 -Ref: Preface-Footnote-137680 -Ref: Preface-Footnote-237786 -Node: History38018 -Node: Names40409 -Ref: Names-Footnote-141886 -Node: This Manual41958 -Ref: This Manual-Footnote-146905 -Node: Conventions47005 -Node: Manual History49139 -Ref: Manual History-Footnote-152409 -Ref: Manual History-Footnote-252450 -Node: How To Contribute52524 -Node: Acknowledgments53668 -Node: Getting Started57999 -Node: Running gawk60378 -Node: One-shot61564 -Node: Read Terminal62789 -Ref: Read Terminal-Footnote-164439 -Ref: Read Terminal-Footnote-264715 -Node: Long64886 -Node: Executable Scripts66262 -Ref: Executable Scripts-Footnote-168131 -Ref: Executable Scripts-Footnote-268233 -Node: Comments68780 -Node: Quoting71247 -Node: DOS Quoting75870 -Node: Sample Data Files76545 -Node: Very Simple79577 -Node: Two Rules84176 -Node: More Complex86323 -Ref: More Complex-Footnote-189253 -Node: Statements/Lines89338 -Ref: Statements/Lines-Footnote-193800 -Node: Other Features94065 -Node: When94993 -Node: Invoking Gawk97140 -Node: Command Line98525 -Node: Options99308 -Ref: Options-Footnote-1112852 -Node: Other Arguments112877 -Node: Naming Standard Input115535 -Node: Environment Variables116629 -Node: AWKPATH Variable117073 -Ref: AWKPATH Variable-Footnote-1119670 -Node: Other Environment Variables119930 -Node: Exit Status122270 -Node: Include Files122945 -Node: Obsolete126430 -Node: Undocumented127116 -Node: Regexp127357 -Node: Regexp Usage128746 -Node: Escape Sequences130772 -Node: Regexp Operators136535 -Ref: Regexp Operators-Footnote-1143915 -Ref: Regexp Operators-Footnote-2144062 -Node: Bracket Expressions144160 -Ref: table-char-classes146050 -Node: GNU Regexp Operators148573 -Node: Case-sensitivity152296 -Ref: Case-sensitivity-Footnote-1155264 -Ref: Case-sensitivity-Footnote-2155499 -Node: Leftmost Longest155607 -Node: Computed Regexps156808 -Node: Reading Files160218 -Node: Records162159 -Ref: Records-Footnote-1171083 -Node: Fields171120 -Ref: Fields-Footnote-1174153 -Node: Nonconstant Fields174239 -Node: Changing Fields176441 -Node: Field Separators182422 -Node: Default Field Splitting185051 -Node: Regexp Field Splitting186168 -Node: Single Character Fields189510 -Node: Command Line Field Separator190569 -Node: Field Splitting Summary194010 -Ref: Field Splitting Summary-Footnote-1197202 -Node: Constant Size197303 -Node: Splitting By Content201887 -Ref: Splitting By Content-Footnote-1205613 -Node: Multiple Line205653 -Ref: Multiple Line-Footnote-1211500 -Node: Getline211679 -Node: Plain Getline213907 -Node: Getline/Variable215996 -Node: Getline/File217137 -Node: Getline/Variable/File218459 -Ref: Getline/Variable/File-Footnote-1220058 -Node: Getline/Pipe220145 -Node: Getline/Variable/Pipe222705 -Node: Getline/Coprocess223812 -Node: Getline/Variable/Coprocess225055 -Node: Getline Notes225769 -Node: Getline Summary228556 -Ref: table-getline-variants228899 -Node: Command line directories229755 -Node: Printing230380 -Node: Print232011 -Node: Print Examples233348 -Node: Output Separators236132 -Node: OFMT237892 -Node: Printf239250 -Node: Basic Printf240156 -Node: Control Letters241695 -Node: Format Modifiers245507 -Node: Printf Examples251516 -Node: Redirection254231 -Node: Special Files261215 -Node: Special FD261748 -Ref: Special FD-Footnote-1265373 -Node: Special Network265447 -Node: Special Caveats266297 -Node: Close Files And Pipes267093 -Ref: Close Files And Pipes-Footnote-1274116 -Ref: Close Files And Pipes-Footnote-2274264 -Node: Expressions274414 -Node: Values275546 -Node: Constants276222 -Node: Scalar Constants276902 -Ref: Scalar Constants-Footnote-1277761 -Node: Nondecimal-numbers277943 -Node: Regexp Constants281002 -Node: Using Constant Regexps281477 -Node: Variables284532 -Node: Using Variables285187 -Node: Assignment Options286911 -Node: Conversion288783 -Ref: table-locale-affects294159 -Ref: Conversion-Footnote-1294783 -Node: All Operators294892 -Node: Arithmetic Ops295522 -Node: Concatenation298027 -Ref: Concatenation-Footnote-1300820 -Node: Assignment Ops300940 -Ref: table-assign-ops305928 -Node: Increment Ops307336 -Node: Truth Values and Conditions310806 -Node: Truth Values311889 -Node: Typing and Comparison312938 -Node: Variable Typing313727 -Ref: Variable Typing-Footnote-1317624 -Node: Comparison Operators317746 -Ref: table-relational-ops318156 -Node: POSIX String Comparison321705 -Ref: POSIX String Comparison-Footnote-1322661 -Node: Boolean Ops322799 -Ref: Boolean Ops-Footnote-1326877 -Node: Conditional Exp326968 -Node: Function Calls328700 -Node: Precedence332294 -Node: Locales335963 -Node: Patterns and Actions337052 -Node: Pattern Overview338106 -Node: Regexp Patterns339775 -Node: Expression Patterns340318 -Node: Ranges344003 -Node: BEGIN/END346969 -Node: Using BEGIN/END347731 -Ref: Using BEGIN/END-Footnote-1350462 -Node: I/O And BEGIN/END350568 -Node: BEGINFILE/ENDFILE352850 -Node: Empty355743 -Node: Using Shell Variables356059 -Node: Action Overview358344 -Node: Statements360701 -Node: If Statement362555 -Node: While Statement364054 -Node: Do Statement366098 -Node: For Statement367254 -Node: Switch Statement370406 -Node: Break Statement372503 -Node: Continue Statement374493 -Node: Next Statement376286 -Node: Nextfile Statement378676 -Node: Exit Statement381317 -Node: Built-in Variables383733 -Node: User-modified384828 -Ref: User-modified-Footnote-1392854 -Node: Auto-set392916 -Ref: Auto-set-Footnote-1402207 -Node: ARGC and ARGV402412 -Node: Arrays406263 -Node: Array Basics407768 -Node: Array Intro408594 -Node: Reference to Elements412912 -Node: Assigning Elements415182 -Node: Array Example415673 -Node: Scanning an Array417405 -Node: Controlling Scanning419719 -Ref: Controlling Scanning-Footnote-1424652 -Node: Delete424968 -Ref: Delete-Footnote-1427733 -Node: Numeric Array Subscripts427790 -Node: Uninitialized Subscripts429973 -Node: Multi-dimensional431601 -Node: Multi-scanning434695 -Node: Arrays of Arrays436286 -Node: Functions440931 -Node: Built-in441753 -Node: Calling Built-in442831 -Node: Numeric Functions444819 -Ref: Numeric Functions-Footnote-1448651 -Ref: Numeric Functions-Footnote-2449008 -Ref: Numeric Functions-Footnote-3449056 -Node: String Functions449325 -Ref: String Functions-Footnote-1472822 -Ref: String Functions-Footnote-2472951 -Ref: String Functions-Footnote-3473199 -Node: Gory Details473286 -Ref: table-sub-escapes474965 -Ref: table-sub-posix-92476319 -Ref: table-sub-proposed477662 -Ref: table-posix-sub479012 -Ref: table-gensub-escapes480558 -Ref: Gory Details-Footnote-1481765 -Ref: Gory Details-Footnote-2481816 -Node: I/O Functions481967 -Ref: I/O Functions-Footnote-1488622 -Node: Time Functions488769 -Ref: Time Functions-Footnote-1499661 -Ref: Time Functions-Footnote-2499729 -Ref: Time Functions-Footnote-3499887 -Ref: Time Functions-Footnote-4499998 -Ref: Time Functions-Footnote-5500110 -Ref: Time Functions-Footnote-6500337 -Node: Bitwise Functions500603 -Ref: table-bitwise-ops501161 -Ref: Bitwise Functions-Footnote-1505321 -Node: Type Functions505505 -Node: I18N Functions505975 -Node: User-defined507602 -Node: Definition Syntax508406 -Ref: Definition Syntax-Footnote-1513316 -Node: Function Example513385 -Node: Function Caveats515979 -Node: Calling A Function516400 -Node: Variable Scope517515 -Node: Pass By Value/Reference519490 -Node: Return Statement522930 -Node: Dynamic Typing525911 -Node: Indirect Calls526646 -Node: Internationalization536331 -Node: I18N and L10N537757 -Node: Explaining gettext538443 -Ref: Explaining gettext-Footnote-1543509 -Ref: Explaining gettext-Footnote-2543693 -Node: Programmer i18n543858 -Node: Translator i18n548058 -Node: String Extraction548851 -Ref: String Extraction-Footnote-1549812 -Node: Printf Ordering549898 -Ref: Printf Ordering-Footnote-1552682 -Node: I18N Portability552746 -Ref: I18N Portability-Footnote-1555195 -Node: I18N Example555258 -Ref: I18N Example-Footnote-1557893 -Node: Gawk I18N557965 -Node: Advanced Features558582 -Node: Nondecimal Data560095 -Node: Array Sorting561678 -Node: Controlling Array Traversal562375 -Node: Array Sorting Functions570612 -Ref: Array Sorting Functions-Footnote-1574286 -Ref: Array Sorting Functions-Footnote-2574379 -Node: Two-way I/O574573 -Ref: Two-way I/O-Footnote-1580005 -Node: TCP/IP Networking580075 -Node: Profiling582919 -Node: Library Functions590393 -Ref: Library Functions-Footnote-1593400 -Node: Library Names593571 -Ref: Library Names-Footnote-1597042 -Ref: Library Names-Footnote-2597262 -Node: General Functions597348 -Node: Strtonum Function598301 -Node: Assert Function601231 -Node: Round Function604557 -Node: Cliff Random Function606100 -Node: Ordinal Functions607116 -Ref: Ordinal Functions-Footnote-1610186 -Ref: Ordinal Functions-Footnote-2610438 -Node: Join Function610647 -Ref: Join Function-Footnote-1612418 -Node: Gettimeofday Function612618 -Node: Data File Management616333 -Node: Filetrans Function616965 -Node: Rewind Function621104 -Node: File Checking622491 -Node: Empty Files623585 -Node: Ignoring Assigns625815 -Node: Getopt Function627368 -Ref: Getopt Function-Footnote-1638672 -Node: Passwd Functions638875 -Ref: Passwd Functions-Footnote-1647850 -Node: Group Functions647938 -Node: Walking Arrays656022 -Node: Sample Programs657591 -Node: Running Examples658256 -Node: Clones658984 -Node: Cut Program660208 -Node: Egrep Program670053 -Ref: Egrep Program-Footnote-1677826 -Node: Id Program677936 -Node: Split Program681552 -Ref: Split Program-Footnote-1685071 -Node: Tee Program685199 -Node: Uniq Program688002 -Node: Wc Program695431 -Ref: Wc Program-Footnote-1699697 -Ref: Wc Program-Footnote-2699897 -Node: Miscellaneous Programs699989 -Node: Dupword Program701177 -Node: Alarm Program703208 -Node: Translate Program707957 -Ref: Translate Program-Footnote-1712344 -Ref: Translate Program-Footnote-2712572 -Node: Labels Program712706 -Ref: Labels Program-Footnote-1716077 -Node: Word Sorting716161 -Node: History Sorting720045 -Node: Extract Program721884 -Ref: Extract Program-Footnote-1729367 -Node: Simple Sed729495 -Node: Igawk Program732557 -Ref: Igawk Program-Footnote-1747714 -Ref: Igawk Program-Footnote-2747915 -Node: Anagram Program748053 -Node: Signature Program751121 -Node: Debugger752221 -Node: Debugging753132 -Node: Debugging Concepts753545 -Node: Debugging Terms755401 -Node: Awk Debugging758024 -Node: Sample dgawk session758916 -Node: dgawk invocation759408 -Node: Finding The Bug760590 -Node: List of Debugger Commands767076 -Node: Breakpoint Control768387 -Node: Dgawk Execution Control772023 -Node: Viewing And Changing Data775374 -Node: Dgawk Stack778711 -Node: Dgawk Info780171 -Node: Miscellaneous Dgawk Commands784119 -Node: Readline Support789547 -Node: Dgawk Limitations790385 -Node: Language History792574 -Node: V7/SVR3.1794086 -Node: SVR4796407 -Node: POSIX797849 -Node: BTL798857 -Node: POSIX/GNU799591 -Node: Common Extensions804742 -Node: Ranges and Locales805849 -Ref: Ranges and Locales-Footnote-1810467 -Ref: Ranges and Locales-Footnote-2810494 -Ref: Ranges and Locales-Footnote-3810754 -Node: Contributors810975 -Node: Installation815237 -Node: Gawk Distribution816131 -Node: Getting816615 -Node: Extracting817441 -Node: Distribution contents819133 -Node: Unix Installation824355 -Node: Quick Installation824972 -Node: Additional Configuration Options826934 -Node: Configuration Philosophy828411 -Node: Non-Unix Installation830753 -Node: PC Installation831211 -Node: PC Binary Installation832510 -Node: PC Compiling834525 -Node: PC Testing837469 -Node: PC Using838645 -Node: Cygwin842830 -Node: MSYS843830 -Node: VMS Installation844344 -Node: VMS Compilation844947 -Ref: VMS Compilation-Footnote-1845954 -Node: VMS Installation Details846012 -Node: VMS Running847647 -Node: VMS Old Gawk849254 -Node: Bugs849728 -Node: Other Versions853580 -Node: Notes858861 -Node: Compatibility Mode859553 -Node: Additions860336 -Node: Accessing The Source861148 -Node: Adding Code862573 -Node: New Ports868540 -Node: Dynamic Extensions872653 -Node: Internals874029 -Node: Plugin License883132 -Node: Sample Library883766 -Node: Internal File Description884452 -Node: Internal File Ops888167 -Ref: Internal File Ops-Footnote-1892948 -Node: Using Internal File Ops893088 -Node: Future Extensions895465 -Node: Basic Concepts897969 -Node: Basic High Level898726 -Ref: Basic High Level-Footnote-1902761 -Node: Basic Data Typing902946 -Node: Floating Point Issues907471 -Node: String Conversion Precision908554 -Ref: String Conversion Precision-Footnote-1910254 -Node: Unexpected Results910363 -Node: POSIX Floating Point Problems912189 -Ref: POSIX Floating Point Problems-Footnote-1915894 -Node: Glossary915932 -Node: Copying941107 -Node: GNU Free Documentation License978664 -Node: Index1003801 +Node: Foreword31870 +Node: Preface36215 +Ref: Preface-Footnote-139268 +Ref: Preface-Footnote-239374 +Node: History39606 +Node: Names41997 +Ref: Names-Footnote-143474 +Node: This Manual43546 +Ref: This Manual-Footnote-148674 +Node: Conventions48774 +Node: Manual History50908 +Ref: Manual History-Footnote-154178 +Ref: Manual History-Footnote-254219 +Node: How To Contribute54293 +Node: Acknowledgments55437 +Node: Getting Started59933 +Node: Running gawk62312 +Node: One-shot63498 +Node: Read Terminal64723 +Ref: Read Terminal-Footnote-166373 +Ref: Read Terminal-Footnote-266649 +Node: Long66820 +Node: Executable Scripts68196 +Ref: Executable Scripts-Footnote-170065 +Ref: Executable Scripts-Footnote-270167 +Node: Comments70714 +Node: Quoting73181 +Node: DOS Quoting77804 +Node: Sample Data Files78479 +Node: Very Simple81511 +Node: Two Rules86110 +Node: More Complex88257 +Ref: More Complex-Footnote-191187 +Node: Statements/Lines91272 +Ref: Statements/Lines-Footnote-195734 +Node: Other Features95999 +Node: When96927 +Node: Invoking Gawk99074 +Node: Command Line100535 +Node: Options101318 +Ref: Options-Footnote-1116716 +Node: Other Arguments116741 +Node: Naming Standard Input119399 +Node: Environment Variables120493 +Node: AWKPATH Variable121051 +Ref: AWKPATH Variable-Footnote-1123809 +Node: AWKLIBPATH Variable124069 +Node: Other Environment Variables124666 +Node: Exit Status127161 +Node: Include Files127836 +Node: Loading Shared Libraries131405 +Node: Obsolete132630 +Node: Undocumented133327 +Node: Regexp133570 +Node: Regexp Usage134959 +Node: Escape Sequences136985 +Node: Regexp Operators142748 +Ref: Regexp Operators-Footnote-1150128 +Ref: Regexp Operators-Footnote-2150275 +Node: Bracket Expressions150373 +Ref: table-char-classes152263 +Node: GNU Regexp Operators154786 +Node: Case-sensitivity158509 +Ref: Case-sensitivity-Footnote-1161477 +Ref: Case-sensitivity-Footnote-2161712 +Node: Leftmost Longest161820 +Node: Computed Regexps163021 +Node: Reading Files166431 +Node: Records168434 +Ref: Records-Footnote-1177358 +Node: Fields177395 +Ref: Fields-Footnote-1180428 +Node: Nonconstant Fields180514 +Node: Changing Fields182716 +Node: Field Separators188697 +Node: Default Field Splitting191326 +Node: Regexp Field Splitting192443 +Node: Single Character Fields195785 +Node: Command Line Field Separator196844 +Node: Field Splitting Summary200285 +Ref: Field Splitting Summary-Footnote-1203477 +Node: Constant Size203578 +Node: Splitting By Content208162 +Ref: Splitting By Content-Footnote-1211888 +Node: Multiple Line211928 +Ref: Multiple Line-Footnote-1217775 +Node: Getline217954 +Node: Plain Getline220170 +Node: Getline/Variable222259 +Node: Getline/File223400 +Node: Getline/Variable/File224722 +Ref: Getline/Variable/File-Footnote-1226321 +Node: Getline/Pipe226408 +Node: Getline/Variable/Pipe228968 +Node: Getline/Coprocess230075 +Node: Getline/Variable/Coprocess231318 +Node: Getline Notes232032 +Node: Getline Summary234819 +Ref: table-getline-variants235227 +Node: Read Timeout236083 +Ref: Read Timeout-Footnote-1239828 +Node: Command line directories239885 +Node: Printing240515 +Node: Print242146 +Node: Print Examples243483 +Node: Output Separators246267 +Node: OFMT248027 +Node: Printf249385 +Node: Basic Printf250291 +Node: Control Letters251830 +Node: Format Modifiers255642 +Node: Printf Examples261651 +Node: Redirection264366 +Node: Special Files271350 +Node: Special FD271883 +Ref: Special FD-Footnote-1275508 +Node: Special Network275582 +Node: Special Caveats276432 +Node: Close Files And Pipes277228 +Ref: Close Files And Pipes-Footnote-1284251 +Ref: Close Files And Pipes-Footnote-2284399 +Node: Expressions284549 +Node: Values285681 +Node: Constants286357 +Node: Scalar Constants287037 +Ref: Scalar Constants-Footnote-1287896 +Node: Nondecimal-numbers288078 +Node: Regexp Constants291137 +Node: Using Constant Regexps291612 +Node: Variables294667 +Node: Using Variables295322 +Node: Assignment Options297046 +Node: Conversion298918 +Ref: table-locale-affects304294 +Ref: Conversion-Footnote-1304918 +Node: All Operators305027 +Node: Arithmetic Ops305657 +Node: Concatenation308162 +Ref: Concatenation-Footnote-1310955 +Node: Assignment Ops311075 +Ref: table-assign-ops316063 +Node: Increment Ops317471 +Node: Truth Values and Conditions320941 +Node: Truth Values322024 +Node: Typing and Comparison323073 +Node: Variable Typing323862 +Ref: Variable Typing-Footnote-1327759 +Node: Comparison Operators327881 +Ref: table-relational-ops328291 +Node: POSIX String Comparison331840 +Ref: POSIX String Comparison-Footnote-1332796 +Node: Boolean Ops332934 +Ref: Boolean Ops-Footnote-1337012 +Node: Conditional Exp337103 +Node: Function Calls338835 +Node: Precedence342429 +Node: Locales346098 +Node: Patterns and Actions347187 +Node: Pattern Overview348241 +Node: Regexp Patterns349910 +Node: Expression Patterns350453 +Node: Ranges354138 +Node: BEGIN/END357104 +Node: Using BEGIN/END357866 +Ref: Using BEGIN/END-Footnote-1360597 +Node: I/O And BEGIN/END360703 +Node: BEGINFILE/ENDFILE362985 +Node: Empty365889 +Node: Using Shell Variables366205 +Node: Action Overview368490 +Node: Statements370847 +Node: If Statement372701 +Node: While Statement374200 +Node: Do Statement376244 +Node: For Statement377400 +Node: Switch Statement380552 +Node: Break Statement382649 +Node: Continue Statement384639 +Node: Next Statement386432 +Node: Nextfile Statement388822 +Node: Exit Statement391463 +Node: Built-in Variables393879 +Node: User-modified394974 +Ref: User-modified-Footnote-1403329 +Node: Auto-set403391 +Ref: Auto-set-Footnote-1415742 +Ref: Auto-set-Footnote-2415947 +Node: ARGC and ARGV416003 +Node: Arrays419854 +Node: Array Basics421359 +Node: Array Intro422185 +Node: Reference to Elements426503 +Node: Assigning Elements428773 +Node: Array Example429264 +Node: Scanning an Array430996 +Node: Controlling Scanning433310 +Ref: Controlling Scanning-Footnote-1438243 +Node: Delete438559 +Ref: Delete-Footnote-1441324 +Node: Numeric Array Subscripts441381 +Node: Uninitialized Subscripts443564 +Node: Multi-dimensional445192 +Node: Multi-scanning448286 +Node: Arrays of Arrays449877 +Node: Functions454522 +Node: Built-in455344 +Node: Calling Built-in456422 +Node: Numeric Functions458410 +Ref: Numeric Functions-Footnote-1462242 +Ref: Numeric Functions-Footnote-2462599 +Ref: Numeric Functions-Footnote-3462647 +Node: String Functions462916 +Ref: String Functions-Footnote-1486413 +Ref: String Functions-Footnote-2486542 +Ref: String Functions-Footnote-3486790 +Node: Gory Details486877 +Ref: table-sub-escapes488556 +Ref: table-sub-posix-92489910 +Ref: table-sub-proposed491253 +Ref: table-posix-sub492603 +Ref: table-gensub-escapes494149 +Ref: Gory Details-Footnote-1495356 +Ref: Gory Details-Footnote-2495407 +Node: I/O Functions495558 +Ref: I/O Functions-Footnote-1502213 +Node: Time Functions502360 +Ref: Time Functions-Footnote-1513252 +Ref: Time Functions-Footnote-2513320 +Ref: Time Functions-Footnote-3513478 +Ref: Time Functions-Footnote-4513589 +Ref: Time Functions-Footnote-5513701 +Ref: Time Functions-Footnote-6513928 +Node: Bitwise Functions514194 +Ref: table-bitwise-ops514752 +Ref: Bitwise Functions-Footnote-1518973 +Node: Type Functions519157 +Node: I18N Functions519627 +Node: User-defined521254 +Node: Definition Syntax522058 +Ref: Definition Syntax-Footnote-1526968 +Node: Function Example527037 +Node: Function Caveats529631 +Node: Calling A Function530052 +Node: Variable Scope531167 +Node: Pass By Value/Reference533142 +Node: Return Statement536582 +Node: Dynamic Typing539563 +Node: Indirect Calls540298 +Node: Internationalization549983 +Node: I18N and L10N551409 +Node: Explaining gettext552095 +Ref: Explaining gettext-Footnote-1557161 +Ref: Explaining gettext-Footnote-2557345 +Node: Programmer i18n557510 +Node: Translator i18n561710 +Node: String Extraction562503 +Ref: String Extraction-Footnote-1563464 +Node: Printf Ordering563550 +Ref: Printf Ordering-Footnote-1566334 +Node: I18N Portability566398 +Ref: I18N Portability-Footnote-1568847 +Node: I18N Example568910 +Ref: I18N Example-Footnote-1571545 +Node: Gawk I18N571617 +Node: Advanced Features572234 +Node: Nondecimal Data573747 +Node: Array Sorting575330 +Node: Controlling Array Traversal576027 +Node: Array Sorting Functions584265 +Ref: Array Sorting Functions-Footnote-1587939 +Ref: Array Sorting Functions-Footnote-2588032 +Node: Two-way I/O588226 +Ref: Two-way I/O-Footnote-1593658 +Node: TCP/IP Networking593728 +Node: Profiling596572 +Node: Library Functions604026 +Ref: Library Functions-Footnote-1607033 +Node: Library Names607204 +Ref: Library Names-Footnote-1610675 +Ref: Library Names-Footnote-2610895 +Node: General Functions610981 +Node: Strtonum Function611934 +Node: Assert Function614864 +Node: Round Function618190 +Node: Cliff Random Function619733 +Node: Ordinal Functions620749 +Ref: Ordinal Functions-Footnote-1623819 +Ref: Ordinal Functions-Footnote-2624071 +Node: Join Function624280 +Ref: Join Function-Footnote-1626051 +Node: Getlocaltime Function626251 +Node: Data File Management629966 +Node: Filetrans Function630598 +Node: Rewind Function634737 +Node: File Checking636124 +Node: Empty Files637218 +Node: Ignoring Assigns639448 +Node: Getopt Function641001 +Ref: Getopt Function-Footnote-1652305 +Node: Passwd Functions652508 +Ref: Passwd Functions-Footnote-1661483 +Node: Group Functions661571 +Node: Walking Arrays669655 +Node: Sample Programs671224 +Node: Running Examples671889 +Node: Clones672617 +Node: Cut Program673841 +Node: Egrep Program683686 +Ref: Egrep Program-Footnote-1691459 +Node: Id Program691569 +Node: Split Program695185 +Ref: Split Program-Footnote-1698704 +Node: Tee Program698832 +Node: Uniq Program701635 +Node: Wc Program709064 +Ref: Wc Program-Footnote-1713330 +Ref: Wc Program-Footnote-2713530 +Node: Miscellaneous Programs713622 +Node: Dupword Program714810 +Node: Alarm Program716841 +Node: Translate Program721590 +Ref: Translate Program-Footnote-1725977 +Ref: Translate Program-Footnote-2726205 +Node: Labels Program726339 +Ref: Labels Program-Footnote-1729710 +Node: Word Sorting729794 +Node: History Sorting733678 +Node: Extract Program735517 +Ref: Extract Program-Footnote-1743000 +Node: Simple Sed743128 +Node: Igawk Program746190 +Ref: Igawk Program-Footnote-1761347 +Ref: Igawk Program-Footnote-2761548 +Node: Anagram Program761686 +Node: Signature Program764754 +Node: Debugger765854 +Node: Debugging766820 +Node: Debugging Concepts767253 +Node: Debugging Terms769109 +Node: Awk Debugging771706 +Node: Sample Debugging Session772598 +Node: Debugger Invocation773118 +Node: Finding The Bug774447 +Node: List of Debugger Commands780935 +Node: Breakpoint Control782269 +Node: Debugger Execution Control785933 +Node: Viewing And Changing Data789293 +Node: Execution Stack792649 +Node: Debugger Info794116 +Node: Miscellaneous Debugger Commands798097 +Node: Readline Support803542 +Node: Limitations804373 +Node: Arbitrary Precision Arithmetic806625 +Ref: Arbitrary Precision Arithmetic-Footnote-1808267 +Node: General Arithmetic808415 +Node: Floating Point Issues810135 +Node: String Conversion Precision811016 +Ref: String Conversion Precision-Footnote-1812722 +Node: Unexpected Results812831 +Node: POSIX Floating Point Problems814984 +Ref: POSIX Floating Point Problems-Footnote-1818809 +Node: Integer Programming818847 +Node: Floating-point Programming820600 +Ref: Floating-point Programming-Footnote-1826909 +Node: Floating-point Representation827173 +Node: Floating-point Context828338 +Ref: table-ieee-formats829180 +Node: Rounding Mode830564 +Ref: table-rounding-modes831043 +Ref: Rounding Mode-Footnote-1834047 +Node: Gawk and MPFR834228 +Node: Arbitrary Precision Floats835470 +Ref: Arbitrary Precision Floats-Footnote-1837899 +Node: Setting Precision838210 +Node: Setting Rounding Mode840943 +Ref: table-gawk-rounding-modes841347 +Node: Floating-point Constants842527 +Node: Changing Precision843951 +Ref: Changing Precision-Footnote-1845351 +Node: Exact Arithmetic845525 +Node: Arbitrary Precision Integers848633 +Ref: Arbitrary Precision Integers-Footnote-1851633 +Node: Dynamic Extensions851780 +Node: Plugin License852698 +Node: Sample Library853312 +Node: Internal File Description853996 +Node: Internal File Ops857709 +Ref: Internal File Ops-Footnote-1862272 +Node: Using Internal File Ops862412 +Node: Language History864788 +Node: V7/SVR3.1866310 +Node: SVR4868631 +Node: POSIX870073 +Node: BTL871081 +Node: POSIX/GNU871815 +Node: Common Extensions877350 +Node: Ranges and Locales878457 +Ref: Ranges and Locales-Footnote-1883075 +Ref: Ranges and Locales-Footnote-2883102 +Ref: Ranges and Locales-Footnote-3883362 +Node: Contributors883583 +Node: Installation887879 +Node: Gawk Distribution888773 +Node: Getting889257 +Node: Extracting890083 +Node: Distribution contents891775 +Node: Unix Installation896997 +Node: Quick Installation897614 +Node: Additional Configuration Options899576 +Node: Configuration Philosophy901053 +Node: Non-Unix Installation903395 +Node: PC Installation903853 +Node: PC Binary Installation905152 +Node: PC Compiling907000 +Node: PC Testing909944 +Node: PC Using911120 +Node: Cygwin915305 +Node: MSYS916305 +Node: VMS Installation916819 +Node: VMS Compilation917422 +Ref: VMS Compilation-Footnote-1918429 +Node: VMS Installation Details918487 +Node: VMS Running920122 +Node: VMS Old Gawk921729 +Node: Bugs922203 +Node: Other Versions926055 +Node: Notes931370 +Node: Compatibility Mode931957 +Node: Additions932740 +Node: Accessing The Source933667 +Node: Adding Code935093 +Node: New Ports941135 +Node: Derived Files945270 +Ref: Derived Files-Footnote-1950575 +Ref: Derived Files-Footnote-2950609 +Ref: Derived Files-Footnote-3951209 +Node: Future Extensions951307 +Node: Basic Concepts952794 +Node: Basic High Level953475 +Ref: Basic High Level-Footnote-1957510 +Node: Basic Data Typing957695 +Node: Glossary961050 +Node: Copying986225 +Node: GNU Free Documentation License1023782 +Node: Index1048919 End Tag Table |