aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--array.c2
-rw-r--r--awk.h1
-rw-r--r--awklib/eg/lib/quicksort.awk3
-rw-r--r--awklib/eg/prog/cut.awk2
-rw-r--r--builtin.c4
-rwxr-xr-xconfigure4
-rw-r--r--configure.ac4
-rw-r--r--doc/ChangeLog5
-rw-r--r--doc/gawk.info923
-rw-r--r--doc/gawk.texi166
-rw-r--r--doc/gawktexi.in166
-rw-r--r--gawkapi.c117
13 files changed, 740 insertions, 672 deletions
diff --git a/ChangeLog b/ChangeLog
index 42c2ead3..3749e0a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2014-02-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ Fixes for enum/int mismatches as warned by some compilers.
+
+ * awk.h (ANONE): New enum for array sorting.
+ * array.c (assoc_list): Use it.
+ * builtin.c (format_tree): New MP_NONE value.
+ * gawkapi.c: Use awk_false and awk_true everywhere instead of
+ false and true.
+
+2014-02-26 Arnold D. Robbins <arnold@skeeve.com>
+
+ * configure.ac: Set up do-nothing extension/Makefile on
+ MirBSD also.
+
2014-02-21 Arnold D. Robbins <arnold@skeeve.com>
* dfa.h, dfa.c (parse_bracket_exp): Sync with grep.
diff --git a/array.c b/array.c
index 37894da5..840808e4 100644
--- a/array.c
+++ b/array.c
@@ -1279,7 +1279,7 @@ assoc_list(NODE *symbol, const char *sort_str, sort_context_t sort_ctxt)
INSTRUCTION *code = NULL;
extern int currule;
int save_rule = 0;
- assoc_kind_t assoc_kind = 0;
+ assoc_kind_t assoc_kind = ANONE;
elem_size = 1;
diff --git a/awk.h b/awk.h
index e0964b94..3c58d1dc 100644
--- a/awk.h
+++ b/awk.h
@@ -1327,6 +1327,7 @@ if (--val) \
/* array.c */
typedef enum { SORTED_IN = 1, ASORT, ASORTI } sort_context_t;
typedef enum {
+ ANONE = 0x00, /* "unused" value */
AINDEX = 0x001, /* list of indices */
AVALUE = 0x002, /* list of values */
AINUM = 0x004, /* numeric index */
diff --git a/awklib/eg/lib/quicksort.awk b/awklib/eg/lib/quicksort.awk
index 7a635d6f..43357ac6 100644
--- a/awklib/eg/lib/quicksort.awk
+++ b/awklib/eg/lib/quicksort.awk
@@ -1,8 +1,9 @@
# quicksort.awk --- Quicksort algorithm, with user-supplied
# comparison function
#
-# Arnold Robbins, arnoldskeeve.com, Public Domain
+# Arnold Robbins, arnold@skeeve.com, Public Domain
# January 2009
+
# quicksort --- C.A.R. Hoare's quick sort algorithm. See Wikipedia
# or almost any algorithms or computer science text
#
diff --git a/awklib/eg/prog/cut.awk b/awklib/eg/prog/cut.awk
index 16b4bdaa..1399411e 100644
--- a/awklib/eg/prog/cut.awk
+++ b/awklib/eg/prog/cut.awk
@@ -86,7 +86,7 @@ function set_fieldlist( n, m, i, j, k, f, g)
}
nfields = j - 1
}
-function set_charlist( field, i, j, f, g, t,
+function set_charlist( field, i, j, f, g, n, m, t,
filler, last, len)
{
field = 1 # count total fields
diff --git a/builtin.c b/builtin.c
index b3e2962b..3571fae3 100644
--- a/builtin.c
+++ b/builtin.c
@@ -719,7 +719,7 @@ format_tree(
mpz_ptr zi;
mpfr_ptr mf;
#endif
- enum { MP_INT_WITH_PREC = 1, MP_INT_WITHOUT_PREC, MP_FLOAT } fmt_type;
+ enum { MP_NONE = 0, MP_INT_WITH_PREC = 1, MP_INT_WITHOUT_PREC, MP_FLOAT } fmt_type;
static const char sp[] = " ";
static const char zero_string[] = "0";
@@ -817,7 +817,7 @@ format_tree(
mf = NULL;
zi = NULL;
#endif
- fmt_type = 0;
+ fmt_type = MP_NONE;
lj = alt = big_flag = bigbig_flag = small_flag = false;
fill = sp;
diff --git a/configure b/configure
index a9bf0805..4b64006a 100755
--- a/configure
+++ b/configure
@@ -10068,9 +10068,7 @@ if test "x$enable_extensions" != "xno"; then
extensions_supported=no
case $host_os in
- mirbsd*)
- : ;;
- openedition*) # OS/390 z/OS POSIX layer
+ mirbsd* | openedition*) # OS/390 z/OS POSIX layer
cat << \EOF > extension/Makefile
all dist check clean distclean install uninstall distcheck:
@exit 0
diff --git a/configure.ac b/configure.ac
index ee100054..62edc618 100644
--- a/configure.ac
+++ b/configure.ac
@@ -290,9 +290,7 @@ if test "x$enable_extensions" != "xno"; then
dnl On MirBSD (and probably other systems), don't even try.
case $host_os in
- mirbsd*)
- : ;;
- openedition*) # OS/390 z/OS POSIX layer
+ mirbsd* | openedition*) # OS/390 z/OS POSIX layer
cat << \EOF > extension/Makefile
all dist check clean distclean install uninstall distcheck:
@exit 0
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 52574058..2c3cb257 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Lots of small fixes throughout, update of
+ profiling output.
+
2014-02-20 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in: Add a quote to the alarm clock program.
diff --git a/doc/gawk.info b/doc/gawk.info
index 5deb6482..10307b39 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -9116,9 +9116,11 @@ File: gawk.info, Node: Switch Statement, Next: Break Statement, Prev: For Sta
7.4.5 The `switch' Statement
----------------------------
-The `switch' statement allows the evaluation of an expression and the
-execution of statements based on a `case' match. Case statements are
-checked for a match in the order they are defined. If no suitable
+This minor node describes a `gawk'-specific feature.
+
+ The `switch' statement allows the evaluation of an expression and
+the execution of statements based on a `case' match. Case statements
+are checked for a match in the order they are defined. If no suitable
`case' is found, the `default' section is executed, if supplied.
Each `case' contains a single constant, be it numeric, string, or
@@ -11978,10 +11980,10 @@ parameters are enclosed in square brackets ([ ]):
function--`gawk' also buffers its output and the `fflush()'
function forces `gawk' to flush its buffers.
- `fflush()' was added to Brian Kernighan's version of `awk' in 1994.
- For over two decades, it was not part of the POSIX standard. As
- of December, 2012, it was accepted for inclusion into the POSIX
- standard. See the Austin Group website
+ `fflush()' was added to Brian Kernighan's version of `awk' in
+ April of 1992. For two decades, it was not part of the POSIX
+ standard. As of December, 2012, it was accepted for inclusion
+ into the POSIX standard. See the Austin Group website
(http://austingroupbugs.net/view.php?id=634).
POSIX standardizes `fflush()' as follows: If there is no argument,
@@ -12698,7 +12700,7 @@ a parameter with the same name as the function itself.
In addition, according to the POSIX standard, function parameters
cannot have the same name as one of the special built-in variables
(*note Built-in Variables::. Not all versions of `awk' enforce this
-restriction.
+restriction.)
The BODY-OF-FUNCTION consists of `awk' statements. It is the most
important part of the definition, because it says what the function
@@ -12741,8 +12743,8 @@ function. When this happens, we say the function is "recursive". The
act of a function calling itself is called "recursion".
All the built-in functions return a value to their caller.
-User-defined functions can do also, using the `return' statement, which
-is described in detail in *note Return Statement::. Many of the
+User-defined functions can do so also, using the `return' statement,
+which is described in detail in *note Return Statement::. Many of the
subsequent examples in this minor node use the `return' statement.
In many `awk' implementations, including `gawk', the keyword
@@ -12812,7 +12814,8 @@ elements in an array and start over with a new list of elements (*note
Delete::). Instead of having to repeat this loop everywhere that you
need to clear out an array, your program can just call `delarray'.
(This guarantees portability. The use of `delete ARRAY' to delete the
-contents of an entire array is a nonstandard extension.)
+contents of an entire array is a recent(1) addition to the POSIX
+standard.)
The following is an example of a recursive function. It takes a
string as an input parameter and returns the string in backwards order.
@@ -12852,13 +12855,19 @@ an `awk' version of `ctime()':
return strftime(format, ts)
}
+ ---------- Footnotes ----------
+
+ (1) Late in 2012.
+

File: gawk.info, Node: Function Caveats, Next: Return Statement, Prev: Function Example, Up: User-defined
9.2.3 Calling User-Defined Functions
------------------------------------
-This section describes how to call a user-defined function.
+"Calling a function" means causing the function to run and do its job.
+A function call is an expression and its value is the value returned by
+the function.
* Menu:
@@ -12872,16 +12881,12 @@ File: gawk.info, Node: Calling A Function, Next: Variable Scope, Up: Function
9.2.3.1 Writing A Function Call
...............................
-"Calling a function" means causing the function to run and do its job.
-A function call is an expression and its value is the value returned by
-the function.
-
- A function call consists of the function name followed by the
-arguments in parentheses. `awk' expressions are what you write in the
-call for the arguments. Each time the call is executed, these
-expressions are evaluated, and the values become the actual arguments.
-For example, here is a call to `foo()' with three arguments (the first
-being a string concatenation):
+A function call consists of the function name followed by the arguments
+in parentheses. `awk' expressions are what you write in the call for
+the arguments. Each time the call is executed, these expressions are
+evaluated, and the values become the actual arguments. For example,
+here is a call to `foo()' with three arguments (the first being a
+string concatenation):
foo(x y, "lose", 4 * z)
@@ -13276,7 +13281,7 @@ and then a closing right parenthesis, with the addition of a leading `@'
character:
the_func = "sum"
- result = @the_func() # calls the `sum' function
+ result = @the_func() # calls the sum() function
Here is a full program that processes the previously shown data,
using indirect function calls.
@@ -13427,8 +13432,8 @@ order.
Next comes a sorting function. It is parameterized with the
starting and ending field numbers and the comparison function. It
-builds an array with the data and calls `quicksort' appropriately, and
-then formats the results as a single string:
+builds an array with the data and calls `quicksort()' appropriately,
+and then formats the results as a single string:
# do_sort --- sort the data according to `compare'
# and return it as a string
@@ -13628,7 +13633,7 @@ will be accidentally shared with the user's program.
In addition, several of the library functions use a prefix that helps
indicate what function or set of functions use the variables--for
-example, `_pw_byname' in the user database routines (*note Passwd
+example, `_pw_byname()' in the user database routines (*note Passwd
Functions::). This convention is recommended, since it even further
decreases the chance of inadvertent conflict among variable names.
Note that this convention is used equally well for variable names and
@@ -13879,9 +13884,9 @@ File: gawk.info, Node: Round Function, Next: Cliff Random Function, Prev: Ass
The way `printf' and `sprintf()' (*note Printf::) perform rounding
often depends upon the system's C `sprintf()' subroutine. On many
-machines, `sprintf()' rounding is "unbiased," which means it doesn't
-always round a trailing `.5' up, contrary to naive expectations. In
-unbiased rounding, `.5' rounds to even, rather than always up, so 1.5
+machines, `sprintf()' rounding is "unbiased", which means it doesn't
+always round a trailing .5 up, contrary to naive expectations. In
+unbiased rounding, .5 rounds to even, rather than always up, so 1.5
rounds to 2 but 4.5 rounds to 4. This means that if you are using a
format that does rounding (e.g., `"%.0f"'), you should check what your
system does. The following function does traditional rounding; it
@@ -13915,7 +13920,7 @@ might be useful if your `awk''s `printf' does unbiased rounding:
}
# test harness
- { print $0, round($0) }
+ # { print $0, round($0) }

File: gawk.info, Node: Cliff Random Function, Next: Ordinal Functions, Prev: Round Function, Up: General Functions
@@ -13991,8 +13996,8 @@ corresponding character. Both functions are written very nicely in
}
}
- Some explanation of the numbers used by `chr()' is worthwhile. The
-most prominent character set in use today is ASCII.(1) Although an
+ Some explanation of the numbers used by `_ord_init()' is worthwhile.
+The most prominent character set in use today is ASCII.(1) Although an
8-bit byte can hold 256 distinct values (from 0 to 255), ASCII only
defines characters that use the values from 0 to 127.(2) In the now
distant past, at least one minicomputer manufacturer used ASCII, but
@@ -14042,7 +14047,7 @@ tests such as used here prohibitively expensive.
(2) ASCII has been extended in many countries to use the values from
128 to 255 for country-specific characters. If your system uses these
-extensions, you can simplify `_ord_init' to loop from 0 to 255.
+extensions, you can simplify `_ord_init()' to loop from 0 to 255.

File: gawk.info, Node: Join Function, Next: Getlocaltime Function, Prev: Ordinal Functions, Up: General Functions
@@ -14483,7 +14488,7 @@ File: gawk.info, Node: Ignoring Assigns, Prev: Empty Files, Up: Data File Man
Occasionally, you might not want `awk' to process command-line variable
assignments (*note Assignment Options::). In particular, if you have a
-file name that contain an `=' character, `awk' treats the file name as
+file name that contains an `=' character, `awk' treats the file name as
an assignment, and does not process it.
Some users have suggested an additional command-line option for
@@ -14979,7 +14984,7 @@ later. The test can only be true for `gawk'. It is false if using
`FS' or `FPAT', or on some other `awk' implementation.
The code that checks for using `FPAT', using `using_fpat' and
-`PROCINFO["FS"]' is similar.
+`PROCINFO["FS"]', is similar.
The main part of the function uses a loop to read database lines,
split the line into fields, and then store the line into each array as
@@ -14999,9 +15004,9 @@ create the element with the null string as its value:
return _pw_byname[name]
}
- Similarly, the `getpwuid' function takes a user ID number argument.
-If that user number is in the database, it returns the appropriate
-line. Otherwise, it returns the null string:
+ Similarly, the `getpwuid()' function takes a user ID number
+argument. If that user number is in the database, it returns the
+appropriate line. Otherwise, it returns the null string:
function getpwuid(uid)
{
@@ -15348,8 +15353,8 @@ index and value, use the indirect function call syntax (*note Indirect
Calls::) on `process', passing it the index and the value.
When calling `walk_array()', you would pass the name of a
-user-defined function that expects to receive and index and a value,
-and then processes the element.
+user-defined function that expects to receive an index and a value, and
+then processes the element.

File: gawk.info, Node: Sample Programs, Next: Advanced Features, Prev: Library Functions, Up: Top
@@ -15610,7 +15615,7 @@ fields to print are `$1', `$3', and `$5'. The intermediate fields are
the fields to print, and `t' tracks the complete field list, including
filler fields:
- function set_charlist( field, i, j, f, g, t,
+ function set_charlist( field, i, j, f, g, n, m, t,
filler, last, len)
{
field = 1 # count total fields
@@ -18536,7 +18541,8 @@ regular pipes.
---------- Footnotes ----------
- (1) This is very different from the same operator in the C shell.
+ (1) This is very different from the same operator in the C shell and
+in Bash.

File: gawk.info, Node: TCP/IP Networking, Next: Profiling, Prev: Two-way I/O, Up: Advanced Features
@@ -18674,56 +18680,64 @@ First, the `awk' program:
junk
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):
+profiler on this program and data. (This example also illustrates that
+`awk' programmers sometimes get up very early in the morning to work.)
- # gawk profile, created Sun Aug 13 00:00:15 2000
+ # gawk profile, created Thu Feb 27 05:16:21 2014
- # BEGIN block(s)
+ # BEGIN block(s)
- BEGIN {
- 1 print "First BEGIN rule"
- 1 print "Second BEGIN rule"
- }
+ BEGIN {
+ 1 print "First BEGIN rule"
+ }
- # Rule(s)
+ BEGIN {
+ 1 print "Second BEGIN rule"
+ }
- 5 /foo/ { # 2
- 2 print "matched /foo/, gosh"
- 6 for (i = 1; i <= 3; i++) {
- 6 sing()
- }
- }
+ # Rule(s)
- 5 {
- 5 if (/foo/) { # 2
- 2 print "if is true"
- 3 } else {
- 3 print "else is true"
- }
- }
+ 5 /foo/ { # 2
+ 2 print "matched /foo/, gosh"
+ 6 for (i = 1; i <= 3; i++) {
+ 6 sing()
+ }
+ }
- # END block(s)
+ 5 {
+ 5 if (/foo/) { # 2
+ 2 print "if is true"
+ 3 } else {
+ 3 print "else is true"
+ }
+ }
- END {
- 1 print "First END rule"
- 1 print "Second END rule"
- }
+ # END block(s)
- # Functions, listed alphabetically
+ END {
+ 1 print "First END rule"
+ }
- 6 function sing(dummy)
- {
- 6 print "I gotta be me!"
- }
+ END {
+ 1 print "Second END rule"
+ }
+
+
+ # Functions, listed alphabetically
+
+ 6 function sing(dummy)
+ {
+ 6 print "I gotta be me!"
+ }
This example illustrates many of the basic features of profiling
output. They are as follows:
- * The program is printed in the order `BEGIN' rule, `BEGINFILE' rule,
- pattern/action rules, `ENDFILE' rule, `END' rule and functions,
- listed alphabetically. Multiple `BEGIN' and `END' rules are
- merged together, as are multiple `BEGINFILE' and `ENDFILE' rules.
+ * The program is printed in the order `BEGIN' rules, `BEGINFILE'
+ rules, pattern/action rules, `ENDFILE' rules, `END' rules and
+ functions, listed alphabetically. Multiple `BEGIN' and `END'
+ rules retain their separate identities, as do multiple `BEGINFILE'
+ and `ENDFILE' rules.
* Pattern-action rules have two counts. The first count, to the
left of the rule, shows how many times the rule's pattern was
@@ -18774,8 +18788,7 @@ 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 `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:
+comments are lost. Also, things such as:
/foo/
@@ -18834,6 +18847,9 @@ by the `Ctrl-<\>' key.
called this way, `gawk' "pretty prints" the program into `awkprof.out',
without any execution counts.
+ NOTE: The `--pretty-print' option still runs your program. This
+ will change in the next major release.
+

File: gawk.info, Node: Internationalization, Next: Debugger, Prev: Advanced Features, Up: Top
@@ -25681,7 +25697,7 @@ as working in this fashion, and in particular, would teach that the
`[A-Z]' was the "correct" way to match uppercase letters. And indeed,
this was true.(1)
- The 1993 POSIX standard introduced the idea of locales (*note
+ The 1992 POSIX standard introduced the idea of locales (*note
Locales::). Since many locales include other letters besides the plain
twenty-six letters of the American English alphabet, the POSIX standard
added character classes (*note Bracket Expressions::) as a way to match
@@ -29984,7 +30000,7 @@ 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) <1>: Profiling. (line 146)
* () (parentheses): Regexp Operators. (line 79)
* * (asterisk), * operator, as multiplication operator: Precedence.
(line 55)
@@ -30490,7 +30506,7 @@ 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 ({}): Profiling. (line 142)
* braces ({}), actions and: Action Overview. (line 19)
* braces ({}), statements, grouping: Statements. (line 10)
* bracket expressions <1>: Bracket Expressions. (line 6)
@@ -30697,7 +30713,7 @@ Index
* csh utility: Statements/Lines. (line 44)
* 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)
+* ctime() user-defined function: Function Example. (line 73)
* currency symbols, localization: Explaining gettext. (line 103)
* custom.h file: Configuration Philosophy.
(line 30)
@@ -31297,8 +31313,8 @@ Index
* 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 129)
+* functions, user-defined, calling: Function Caveats. (line 6)
+* functions, user-defined, counts: Profiling. (line 137)
* functions, user-defined, library of: Library Functions. (line 6)
* functions, user-defined, next/nextfile statements and <1>: Nextfile Statement.
(line 47)
@@ -31306,7 +31322,7 @@ Index
(line 45)
* G-d: Acknowledgments. (line 78)
* Garfinkle, Scott: Contributors. (line 34)
-* gawk program, dynamic profiling: Profiling. (line 172)
+* gawk program, dynamic profiling: Profiling. (line 179)
* gawk, ARGIND variable in: Other Arguments. (line 12)
* gawk, awk and <1>: This Manual. (line 14)
* gawk, awk and: Preface. (line 23)
@@ -31489,7 +31505,7 @@ Index
* 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 211)
* hyphen (-), - operator: Precedence. (line 52)
* hyphen (-), -- operator <1>: Precedence. (line 46)
* hyphen (-), -- operator: Increment Ops. (line 48)
@@ -31565,7 +31581,7 @@ 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 214)
* int() function: Numeric Functions. (line 23)
* integer, arbitrary precision: Arbitrary Precision Integers.
(line 6)
@@ -31612,11 +31628,12 @@ Index
* Kernighan, Brian <2>: Other Versions. (line 13)
* Kernighan, Brian <3>: Contributors. (line 11)
* Kernighan, Brian <4>: BTL. (line 6)
-* Kernighan, Brian <5>: Concatenation. (line 6)
-* Kernighan, Brian <6>: Acknowledgments. (line 72)
-* Kernighan, Brian <7>: Conventions. (line 34)
+* Kernighan, Brian <5>: Library Functions. (line 12)
+* Kernighan, Brian <6>: Concatenation. (line 6)
+* Kernighan, Brian <7>: Acknowledgments. (line 72)
+* Kernighan, Brian <8>: Conventions. (line 34)
* Kernighan, Brian: History. (line 17)
-* kill command, dynamic profiling: Profiling. (line 181)
+* kill command, dynamic profiling: Profiling. (line 188)
* Knights, jedi: Undocumented. (line 6)
* Knuth, Donald: Arbitrary Precision Arithmetic.
(line 6)
@@ -31713,7 +31730,7 @@ 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 123)
+* loops, count for header: Profiling. (line 131)
* loops, exiting: Break Statement. (line 6)
* loops, See Also while statement: While Statement. (line 6)
* ls utility: More Complex. (line 15)
@@ -31921,14 +31938,14 @@ Index
* p debugger command (alias for print): Viewing And Changing Data.
(line 36)
* P1003.1 POSIX standard: Glossary. (line 462)
-* parentheses () <1>: Profiling. (line 138)
+* parentheses () <1>: Profiling. (line 146)
* parentheses (): Regexp Operators. (line 79)
* password file: Passwd Functions. (line 16)
* patsplit() function (gawk): String Functions. (line 290)
* patterns: Patterns and Actions.
(line 6)
* patterns, comparison expressions as: Expression Patterns. (line 14)
-* patterns, counts: Profiling. (line 110)
+* patterns, counts: Profiling. (line 118)
* patterns, default: Very Simple. (line 34)
* patterns, empty: Empty. (line 6)
* patterns, expressions as: Regexp Patterns. (line 6)
@@ -31953,6 +31970,7 @@ Index
* pipes, output: Redirection. (line 57)
* Pitts, Dave <1>: Bugs. (line 73)
* Pitts, Dave: Acknowledgments. (line 60)
+* Plauger, P.J.: Library Functions. (line 12)
* plus sign (+): Regexp Operators. (line 102)
* plus sign (+), + operator: Precedence. (line 52)
* plus sign (+), ++ operator <1>: Precedence. (line 46)
@@ -32089,7 +32107,7 @@ Index
* PROCINFO array <6>: Auto-set. (line 142)
* PROCINFO array: Obsolete. (line 11)
* profiling awk programs: Profiling. (line 6)
-* profiling awk programs, dynamically: Profiling. (line 172)
+* profiling awk programs, dynamically: Profiling. (line 179)
* program, definition of: Getting Started. (line 21)
* programmers, attractiveness of: Two-way I/O. (line 6)
* programming conventions, --non-decimal-data option: Nondecimal Data.
@@ -32125,7 +32143,7 @@ Index
* QuikTrim Awk: Other Versions. (line 134)
* quit debugger command: Miscellaneous Debugger Commands.
(line 99)
-* QUIT signal (MS-Windows): Profiling. (line 207)
+* QUIT signal (MS-Windows): Profiling. (line 214)
* quoting <1>: Comments. (line 27)
* quoting <2>: Long. (line 26)
* quoting: Read Terminal. (line 25)
@@ -32224,7 +32242,7 @@ Index
* return statement, user-defined functions: Return Statement. (line 6)
* return value, close() function: Close Files And Pipes.
(line 130)
-* rev() user-defined function: Function Example. (line 52)
+* rev() user-defined function: Function Example. (line 53)
* revoutput extension: Extension Sample Revout.
(line 11)
* revtwoway extension: Extension Sample Rev2way.
@@ -32377,14 +32395,14 @@ Index
(line 56)
* sidebar, Using close()'s Return Value: Close Files And Pipes.
(line 128)
-* 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 181)
-* SIGQUIT signal (MS-Windows): Profiling. (line 207)
-* SIGUSR1 signal: Profiling. (line 181)
+* SIGHUP signal: Profiling. (line 211)
+* SIGINT signal (MS-Windows): Profiling. (line 214)
+* signals, HUP/SIGHUP: Profiling. (line 211)
+* signals, INT/SIGINT (MS-Windows): Profiling. (line 214)
+* signals, QUIT/SIGQUIT (MS-Windows): Profiling. (line 214)
+* signals, USR1/SIGUSR1: Profiling. (line 188)
+* SIGQUIT signal (MS-Windows): Profiling. (line 214)
+* SIGUSR1 signal: Profiling. (line 188)
* silent debugger command: Debugger Execution Control.
(line 10)
* sin() function: Numeric Functions. (line 75)
@@ -32625,12 +32643,12 @@ Index
* 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 129)
+* user-defined, functions, counts: Profiling. (line 137)
* 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 181)
+* USR1 signal: Profiling. (line 188)
* values, numeric: Basic Data Typing. (line 13)
* values, string: Basic Data Typing. (line 13)
* variable typing: Typing and Comparison.
@@ -32722,7 +32740,7 @@ Index
* zero, negative vs. positive: Unexpected Results. (line 34)
* zerofile.awk program: Empty Files. (line 21)
* Zoulas, Christos: Contributors. (line 66)
-* {} (braces): Profiling. (line 134)
+* {} (braces): Profiling. (line 142)
* {} (braces), actions and: Action Overview. (line 19)
* {} (braces), statements, grouping: Statements. (line 10)
* | (vertical bar): Regexp Operators. (line 69)
@@ -32928,347 +32946,348 @@ Node: While Statement384453
Node: Do Statement386497
Node: For Statement387653
Node: Switch Statement390805
-Node: Break Statement392902
-Node: Continue Statement394892
-Node: Next Statement396685
-Node: Nextfile Statement399075
-Node: Exit Statement401718
-Node: Built-in Variables404134
-Node: User-modified405229
-Ref: User-modified-Footnote-1413587
-Node: Auto-set413649
-Ref: Auto-set-Footnote-1427119
-Ref: Auto-set-Footnote-2427324
-Node: ARGC and ARGV427380
-Node: Arrays431231
-Node: Array Basics432736
-Node: Array Intro433562
-Node: Reference to Elements437879
-Node: Assigning Elements440149
-Node: Array Example440640
-Node: Scanning an Array442372
-Node: Controlling Scanning444686
-Ref: Controlling Scanning-Footnote-1449773
-Node: Delete450089
-Ref: Delete-Footnote-1452854
-Node: Numeric Array Subscripts452911
-Node: Uninitialized Subscripts455094
-Node: Multidimensional456721
-Node: Multiscanning459814
-Node: Arrays of Arrays461403
-Node: Functions466043
-Node: Built-in466862
-Node: Calling Built-in467940
-Node: Numeric Functions469928
-Ref: Numeric Functions-Footnote-1473760
-Ref: Numeric Functions-Footnote-2474117
-Ref: Numeric Functions-Footnote-3474165
-Node: String Functions474434
-Ref: String Functions-Footnote-1497354
-Ref: String Functions-Footnote-2497483
-Ref: String Functions-Footnote-3497731
-Node: Gory Details497818
-Ref: table-sub-escapes499497
-Ref: table-sub-posix-92500851
-Ref: table-sub-proposed502202
-Ref: table-posix-sub503556
-Ref: table-gensub-escapes505101
-Ref: Gory Details-Footnote-1506277
-Ref: Gory Details-Footnote-2506328
-Node: I/O Functions506479
-Ref: I/O Functions-Footnote-1513464
-Node: Time Functions513611
-Ref: Time Functions-Footnote-1524544
-Ref: Time Functions-Footnote-2524612
-Ref: Time Functions-Footnote-3524770
-Ref: Time Functions-Footnote-4524881
-Ref: Time Functions-Footnote-5524993
-Ref: Time Functions-Footnote-6525220
-Node: Bitwise Functions525486
-Ref: table-bitwise-ops526048
-Ref: Bitwise Functions-Footnote-1530269
-Node: Type Functions530453
-Node: I18N Functions531604
-Node: User-defined533231
-Node: Definition Syntax534035
-Ref: Definition Syntax-Footnote-1538945
-Node: Function Example539014
-Node: Function Caveats541608
-Node: Calling A Function542029
-Node: Variable Scope543144
-Node: Pass By Value/Reference546107
-Node: Return Statement549615
-Node: Dynamic Typing552596
-Node: Indirect Calls553527
-Node: Library Functions563212
-Ref: Library Functions-Footnote-1566725
-Ref: Library Functions-Footnote-2566868
-Node: Library Names567039
-Ref: Library Names-Footnote-1570510
-Ref: Library Names-Footnote-2570730
-Node: General Functions570816
-Node: Strtonum Function571844
-Node: Assert Function574774
-Node: Round Function578100
-Node: Cliff Random Function579643
-Node: Ordinal Functions580659
-Ref: Ordinal Functions-Footnote-1583731
-Ref: Ordinal Functions-Footnote-2583983
-Node: Join Function584192
-Ref: Join Function-Footnote-1585963
-Node: Getlocaltime Function586163
-Node: Readfile Function589904
-Node: Data File Management591743
-Node: Filetrans Function592375
-Node: Rewind Function596444
-Node: File Checking597831
-Node: Empty Files598925
-Node: Ignoring Assigns601155
-Node: Getopt Function602708
-Ref: Getopt Function-Footnote-1614011
-Node: Passwd Functions614214
-Ref: Passwd Functions-Footnote-1623189
-Node: Group Functions623277
-Node: Walking Arrays631361
-Node: Sample Programs633498
-Node: Running Examples634172
-Node: Clones634900
-Node: Cut Program636124
-Node: Egrep Program645969
-Ref: Egrep Program-Footnote-1653742
-Node: Id Program653852
-Node: Split Program657468
-Ref: Split Program-Footnote-1660987
-Node: Tee Program661115
-Node: Uniq Program663918
-Node: Wc Program671347
-Ref: Wc Program-Footnote-1675613
-Ref: Wc Program-Footnote-2675813
-Node: Miscellaneous Programs675905
-Node: Dupword Program677093
-Node: Alarm Program679124
-Node: Translate Program683931
-Ref: Translate Program-Footnote-1688318
-Ref: Translate Program-Footnote-2688566
-Node: Labels Program688700
-Ref: Labels Program-Footnote-1692071
-Node: Word Sorting692155
-Node: History Sorting696039
-Node: Extract Program697878
-Ref: Extract Program-Footnote-1705381
-Node: Simple Sed705509
-Node: Igawk Program708571
-Ref: Igawk Program-Footnote-1723728
-Ref: Igawk Program-Footnote-2723929
-Node: Anagram Program724067
-Node: Signature Program727135
-Node: Advanced Features728235
-Node: Nondecimal Data730121
-Node: Array Sorting731704
-Node: Controlling Array Traversal732401
-Node: Array Sorting Functions740685
-Ref: Array Sorting Functions-Footnote-1744554
-Node: Two-way I/O744748
-Ref: Two-way I/O-Footnote-1750180
-Node: TCP/IP Networking750250
-Node: Profiling753094
-Node: Internationalization760591
-Node: I18N and L10N762016
-Node: Explaining gettext762702
-Ref: Explaining gettext-Footnote-1767770
-Ref: Explaining gettext-Footnote-2767954
-Node: Programmer i18n768119
-Node: Translator i18n772321
-Node: String Extraction773114
-Ref: String Extraction-Footnote-1774075
-Node: Printf Ordering774161
-Ref: Printf Ordering-Footnote-1776945
-Node: I18N Portability777009
-Ref: I18N Portability-Footnote-1779458
-Node: I18N Example779521
-Ref: I18N Example-Footnote-1782159
-Node: Gawk I18N782231
-Node: Debugger782852
-Node: Debugging783823
-Node: Debugging Concepts784256
-Node: Debugging Terms786112
-Node: Awk Debugging788709
-Node: Sample Debugging Session789601
-Node: Debugger Invocation790121
-Node: Finding The Bug791453
-Node: List of Debugger Commands797941
-Node: Breakpoint Control799275
-Node: Debugger Execution Control802939
-Node: Viewing And Changing Data806299
-Node: Execution Stack809655
-Node: Debugger Info811122
-Node: Miscellaneous Debugger Commands815104
-Node: Readline Support820280
-Node: Limitations821111
-Node: Arbitrary Precision Arithmetic823363
-Ref: Arbitrary Precision Arithmetic-Footnote-1825012
-Node: General Arithmetic825160
-Node: Floating Point Issues826880
-Node: String Conversion Precision827761
-Ref: String Conversion Precision-Footnote-1829466
-Node: Unexpected Results829575
-Node: POSIX Floating Point Problems831728
-Ref: POSIX Floating Point Problems-Footnote-1835553
-Node: Integer Programming835591
-Node: Floating-point Programming837330
-Ref: Floating-point Programming-Footnote-1843661
-Ref: Floating-point Programming-Footnote-2843931
-Node: Floating-point Representation844195
-Node: Floating-point Context845360
-Ref: table-ieee-formats846199
-Node: Rounding Mode847583
-Ref: table-rounding-modes848062
-Ref: Rounding Mode-Footnote-1851077
-Node: Gawk and MPFR851256
-Node: Arbitrary Precision Floats852511
-Ref: Arbitrary Precision Floats-Footnote-1854954
-Node: Setting Precision855270
-Ref: table-predefined-precision-strings855956
-Node: Setting Rounding Mode858101
-Ref: table-gawk-rounding-modes858505
-Node: Floating-point Constants859692
-Node: Changing Precision861121
-Ref: Changing Precision-Footnote-1862518
-Node: Exact Arithmetic862692
-Node: Arbitrary Precision Integers865830
-Ref: Arbitrary Precision Integers-Footnote-1868848
-Node: Dynamic Extensions868995
-Node: Extension Intro870453
-Node: Plugin License871718
-Node: Extension Mechanism Outline872403
-Ref: load-extension872820
-Ref: load-new-function874298
-Ref: call-new-function875293
-Node: Extension API Description877308
-Node: Extension API Functions Introduction878521
-Node: General Data Types883387
-Ref: General Data Types-Footnote-1888989
-Node: Requesting Values889288
-Ref: table-value-types-returned890019
-Node: Constructor Functions890973
-Node: Registration Functions893993
-Node: Extension Functions894678
-Node: Exit Callback Functions896903
-Node: Extension Version String898152
-Node: Input Parsers898802
-Node: Output Wrappers908559
-Node: Two-way processors913069
-Node: Printing Messages915277
-Ref: Printing Messages-Footnote-1916354
-Node: Updating `ERRNO'916506
-Node: Accessing Parameters917245
-Node: Symbol Table Access918475
-Node: Symbol table by name918987
-Node: Symbol table by cookie920734
-Ref: Symbol table by cookie-Footnote-1924864
-Node: Cached values924927
-Ref: Cached values-Footnote-1928376
-Node: Array Manipulation928467
-Ref: Array Manipulation-Footnote-1929565
-Node: Array Data Types929604
-Ref: Array Data Types-Footnote-1932307
-Node: Array Functions932399
-Node: Flattening Arrays936165
-Node: Creating Arrays943017
-Node: Extension API Variables947742
-Node: Extension Versioning948378
-Node: Extension API Informational Variables950279
-Node: Extension API Boilerplate951365
-Node: Finding Extensions955169
-Node: Extension Example955729
-Node: Internal File Description956459
-Node: Internal File Ops960550
-Ref: Internal File Ops-Footnote-1972058
-Node: Using Internal File Ops972198
-Ref: Using Internal File Ops-Footnote-1974551
-Node: Extension Samples974817
-Node: Extension Sample File Functions976341
-Node: Extension Sample Fnmatch984826
-Node: Extension Sample Fork986552
-Node: Extension Sample Inplace987770
-Node: Extension Sample Ord989548
-Node: Extension Sample Readdir990384
-Node: Extension Sample Revout991916
-Node: Extension Sample Rev2way992509
-Node: Extension Sample Read write array993199
-Node: Extension Sample Readfile995082
-Node: Extension Sample API Tests995900
-Node: Extension Sample Time996425
-Node: gawkextlib997789
-Node: Language History1000570
-Node: V7/SVR3.11002163
-Node: SVR41004483
-Node: POSIX1005925
-Node: BTL1007311
-Node: POSIX/GNU1008045
-Node: Feature History1013644
-Node: Common Extensions1026608
-Node: Ranges and Locales1027920
-Ref: Ranges and Locales-Footnote-11032538
-Ref: Ranges and Locales-Footnote-21032565
-Ref: Ranges and Locales-Footnote-31032825
-Node: Contributors1033046
-Node: Installation1038191
-Node: Gawk Distribution1039085
-Node: Getting1039569
-Node: Extracting1040395
-Node: Distribution contents1042087
-Node: Unix Installation1047792
-Node: Quick Installation1048409
-Node: Additional Configuration Options1050853
-Node: Configuration Philosophy1052589
-Node: Non-Unix Installation1054943
-Node: PC Installation1055401
-Node: PC Binary Installation1056700
-Node: PC Compiling1058548
-Node: PC Testing1061492
-Node: PC Using1062668
-Node: Cygwin1066853
-Node: MSYS1067853
-Node: VMS Installation1068367
-Node: VMS Compilation1069131
-Ref: VMS Compilation-Footnote-11070746
-Node: VMS Dynamic Extensions1070804
-Node: VMS Installation Details1072177
-Node: VMS Running1074424
-Node: VMS GNV1077258
-Node: VMS Old Gawk1077981
-Node: Bugs1078451
-Node: Other Versions1082369
-Node: Notes1088453
-Node: Compatibility Mode1089253
-Node: Additions1090036
-Node: Accessing The Source1090963
-Node: Adding Code1092403
-Node: New Ports1098448
-Node: Derived Files1102583
-Ref: Derived Files-Footnote-11107904
-Ref: Derived Files-Footnote-21107938
-Ref: Derived Files-Footnote-31108538
-Node: Future Extensions1108636
-Node: Implementation Limitations1109219
-Node: Extension Design1110471
-Node: Old Extension Problems1111625
-Ref: Old Extension Problems-Footnote-11113133
-Node: Extension New Mechanism Goals1113190
-Ref: Extension New Mechanism Goals-Footnote-11116555
-Node: Extension Other Design Decisions1116741
-Node: Extension Future Growth1118847
-Node: Old Extension Mechanism1119683
-Node: Basic Concepts1121423
-Node: Basic High Level1122104
-Ref: figure-general-flow1122375
-Ref: figure-process-flow1122974
-Ref: Basic High Level-Footnote-11126203
-Node: Basic Data Typing1126388
-Node: Glossary1129743
-Node: Copying1155205
-Node: GNU Free Documentation License1192762
-Node: Index1217899
+Node: Break Statement392959
+Node: Continue Statement394949
+Node: Next Statement396742
+Node: Nextfile Statement399132
+Node: Exit Statement401775
+Node: Built-in Variables404191
+Node: User-modified405286
+Ref: User-modified-Footnote-1413644
+Node: Auto-set413706
+Ref: Auto-set-Footnote-1427176
+Ref: Auto-set-Footnote-2427381
+Node: ARGC and ARGV427437
+Node: Arrays431288
+Node: Array Basics432793
+Node: Array Intro433619
+Node: Reference to Elements437936
+Node: Assigning Elements440206
+Node: Array Example440697
+Node: Scanning an Array442429
+Node: Controlling Scanning444743
+Ref: Controlling Scanning-Footnote-1449830
+Node: Delete450146
+Ref: Delete-Footnote-1452911
+Node: Numeric Array Subscripts452968
+Node: Uninitialized Subscripts455151
+Node: Multidimensional456778
+Node: Multiscanning459871
+Node: Arrays of Arrays461460
+Node: Functions466100
+Node: Built-in466919
+Node: Calling Built-in467997
+Node: Numeric Functions469985
+Ref: Numeric Functions-Footnote-1473817
+Ref: Numeric Functions-Footnote-2474174
+Ref: Numeric Functions-Footnote-3474222
+Node: String Functions474491
+Ref: String Functions-Footnote-1497411
+Ref: String Functions-Footnote-2497540
+Ref: String Functions-Footnote-3497788
+Node: Gory Details497875
+Ref: table-sub-escapes499554
+Ref: table-sub-posix-92500908
+Ref: table-sub-proposed502259
+Ref: table-posix-sub503613
+Ref: table-gensub-escapes505158
+Ref: Gory Details-Footnote-1506334
+Ref: Gory Details-Footnote-2506385
+Node: I/O Functions506536
+Ref: I/O Functions-Footnote-1513526
+Node: Time Functions513673
+Ref: Time Functions-Footnote-1524606
+Ref: Time Functions-Footnote-2524674
+Ref: Time Functions-Footnote-3524832
+Ref: Time Functions-Footnote-4524943
+Ref: Time Functions-Footnote-5525055
+Ref: Time Functions-Footnote-6525282
+Node: Bitwise Functions525548
+Ref: table-bitwise-ops526110
+Ref: Bitwise Functions-Footnote-1530331
+Node: Type Functions530515
+Node: I18N Functions531666
+Node: User-defined533293
+Node: Definition Syntax534097
+Ref: Definition Syntax-Footnote-1539011
+Node: Function Example539080
+Ref: Function Example-Footnote-1541729
+Node: Function Caveats541751
+Node: Calling A Function542269
+Node: Variable Scope543224
+Node: Pass By Value/Reference546187
+Node: Return Statement549695
+Node: Dynamic Typing552676
+Node: Indirect Calls553607
+Node: Library Functions563294
+Ref: Library Functions-Footnote-1566807
+Ref: Library Functions-Footnote-2566950
+Node: Library Names567121
+Ref: Library Names-Footnote-1570594
+Ref: Library Names-Footnote-2570814
+Node: General Functions570900
+Node: Strtonum Function571928
+Node: Assert Function574858
+Node: Round Function578184
+Node: Cliff Random Function579725
+Node: Ordinal Functions580741
+Ref: Ordinal Functions-Footnote-1583818
+Ref: Ordinal Functions-Footnote-2584070
+Node: Join Function584281
+Ref: Join Function-Footnote-1586052
+Node: Getlocaltime Function586252
+Node: Readfile Function589993
+Node: Data File Management591832
+Node: Filetrans Function592464
+Node: Rewind Function596533
+Node: File Checking597920
+Node: Empty Files599014
+Node: Ignoring Assigns601244
+Node: Getopt Function602798
+Ref: Getopt Function-Footnote-1614101
+Node: Passwd Functions614304
+Ref: Passwd Functions-Footnote-1623282
+Node: Group Functions623370
+Node: Walking Arrays631454
+Node: Sample Programs633590
+Node: Running Examples634264
+Node: Clones634992
+Node: Cut Program636216
+Node: Egrep Program646067
+Ref: Egrep Program-Footnote-1653840
+Node: Id Program653950
+Node: Split Program657566
+Ref: Split Program-Footnote-1661085
+Node: Tee Program661213
+Node: Uniq Program664016
+Node: Wc Program671445
+Ref: Wc Program-Footnote-1675711
+Ref: Wc Program-Footnote-2675911
+Node: Miscellaneous Programs676003
+Node: Dupword Program677191
+Node: Alarm Program679222
+Node: Translate Program684029
+Ref: Translate Program-Footnote-1688416
+Ref: Translate Program-Footnote-2688664
+Node: Labels Program688798
+Ref: Labels Program-Footnote-1692169
+Node: Word Sorting692253
+Node: History Sorting696137
+Node: Extract Program697976
+Ref: Extract Program-Footnote-1705479
+Node: Simple Sed705607
+Node: Igawk Program708669
+Ref: Igawk Program-Footnote-1723826
+Ref: Igawk Program-Footnote-2724027
+Node: Anagram Program724165
+Node: Signature Program727233
+Node: Advanced Features728333
+Node: Nondecimal Data730219
+Node: Array Sorting731802
+Node: Controlling Array Traversal732499
+Node: Array Sorting Functions740783
+Ref: Array Sorting Functions-Footnote-1744652
+Node: Two-way I/O744846
+Ref: Two-way I/O-Footnote-1750278
+Node: TCP/IP Networking750360
+Node: Profiling753204
+Node: Internationalization760707
+Node: I18N and L10N762132
+Node: Explaining gettext762818
+Ref: Explaining gettext-Footnote-1767886
+Ref: Explaining gettext-Footnote-2768070
+Node: Programmer i18n768235
+Node: Translator i18n772437
+Node: String Extraction773230
+Ref: String Extraction-Footnote-1774191
+Node: Printf Ordering774277
+Ref: Printf Ordering-Footnote-1777061
+Node: I18N Portability777125
+Ref: I18N Portability-Footnote-1779574
+Node: I18N Example779637
+Ref: I18N Example-Footnote-1782275
+Node: Gawk I18N782347
+Node: Debugger782968
+Node: Debugging783939
+Node: Debugging Concepts784372
+Node: Debugging Terms786228
+Node: Awk Debugging788825
+Node: Sample Debugging Session789717
+Node: Debugger Invocation790237
+Node: Finding The Bug791569
+Node: List of Debugger Commands798057
+Node: Breakpoint Control799391
+Node: Debugger Execution Control803055
+Node: Viewing And Changing Data806415
+Node: Execution Stack809771
+Node: Debugger Info811238
+Node: Miscellaneous Debugger Commands815220
+Node: Readline Support820396
+Node: Limitations821227
+Node: Arbitrary Precision Arithmetic823479
+Ref: Arbitrary Precision Arithmetic-Footnote-1825128
+Node: General Arithmetic825276
+Node: Floating Point Issues826996
+Node: String Conversion Precision827877
+Ref: String Conversion Precision-Footnote-1829582
+Node: Unexpected Results829691
+Node: POSIX Floating Point Problems831844
+Ref: POSIX Floating Point Problems-Footnote-1835669
+Node: Integer Programming835707
+Node: Floating-point Programming837446
+Ref: Floating-point Programming-Footnote-1843777
+Ref: Floating-point Programming-Footnote-2844047
+Node: Floating-point Representation844311
+Node: Floating-point Context845476
+Ref: table-ieee-formats846315
+Node: Rounding Mode847699
+Ref: table-rounding-modes848178
+Ref: Rounding Mode-Footnote-1851193
+Node: Gawk and MPFR851372
+Node: Arbitrary Precision Floats852627
+Ref: Arbitrary Precision Floats-Footnote-1855070
+Node: Setting Precision855386
+Ref: table-predefined-precision-strings856072
+Node: Setting Rounding Mode858217
+Ref: table-gawk-rounding-modes858621
+Node: Floating-point Constants859808
+Node: Changing Precision861237
+Ref: Changing Precision-Footnote-1862634
+Node: Exact Arithmetic862808
+Node: Arbitrary Precision Integers865946
+Ref: Arbitrary Precision Integers-Footnote-1868964
+Node: Dynamic Extensions869111
+Node: Extension Intro870569
+Node: Plugin License871834
+Node: Extension Mechanism Outline872519
+Ref: load-extension872936
+Ref: load-new-function874414
+Ref: call-new-function875409
+Node: Extension API Description877424
+Node: Extension API Functions Introduction878637
+Node: General Data Types883503
+Ref: General Data Types-Footnote-1889105
+Node: Requesting Values889404
+Ref: table-value-types-returned890135
+Node: Constructor Functions891089
+Node: Registration Functions894109
+Node: Extension Functions894794
+Node: Exit Callback Functions897019
+Node: Extension Version String898268
+Node: Input Parsers898918
+Node: Output Wrappers908675
+Node: Two-way processors913185
+Node: Printing Messages915393
+Ref: Printing Messages-Footnote-1916470
+Node: Updating `ERRNO'916622
+Node: Accessing Parameters917361
+Node: Symbol Table Access918591
+Node: Symbol table by name919103
+Node: Symbol table by cookie920850
+Ref: Symbol table by cookie-Footnote-1924980
+Node: Cached values925043
+Ref: Cached values-Footnote-1928492
+Node: Array Manipulation928583
+Ref: Array Manipulation-Footnote-1929681
+Node: Array Data Types929720
+Ref: Array Data Types-Footnote-1932423
+Node: Array Functions932515
+Node: Flattening Arrays936281
+Node: Creating Arrays943133
+Node: Extension API Variables947858
+Node: Extension Versioning948494
+Node: Extension API Informational Variables950395
+Node: Extension API Boilerplate951481
+Node: Finding Extensions955285
+Node: Extension Example955845
+Node: Internal File Description956575
+Node: Internal File Ops960666
+Ref: Internal File Ops-Footnote-1972174
+Node: Using Internal File Ops972314
+Ref: Using Internal File Ops-Footnote-1974667
+Node: Extension Samples974933
+Node: Extension Sample File Functions976457
+Node: Extension Sample Fnmatch984942
+Node: Extension Sample Fork986668
+Node: Extension Sample Inplace987886
+Node: Extension Sample Ord989664
+Node: Extension Sample Readdir990500
+Node: Extension Sample Revout992032
+Node: Extension Sample Rev2way992625
+Node: Extension Sample Read write array993315
+Node: Extension Sample Readfile995198
+Node: Extension Sample API Tests996016
+Node: Extension Sample Time996541
+Node: gawkextlib997905
+Node: Language History1000686
+Node: V7/SVR3.11002279
+Node: SVR41004599
+Node: POSIX1006041
+Node: BTL1007427
+Node: POSIX/GNU1008161
+Node: Feature History1013760
+Node: Common Extensions1026724
+Node: Ranges and Locales1028036
+Ref: Ranges and Locales-Footnote-11032654
+Ref: Ranges and Locales-Footnote-21032681
+Ref: Ranges and Locales-Footnote-31032941
+Node: Contributors1033162
+Node: Installation1038307
+Node: Gawk Distribution1039201
+Node: Getting1039685
+Node: Extracting1040511
+Node: Distribution contents1042203
+Node: Unix Installation1047908
+Node: Quick Installation1048525
+Node: Additional Configuration Options1050969
+Node: Configuration Philosophy1052705
+Node: Non-Unix Installation1055059
+Node: PC Installation1055517
+Node: PC Binary Installation1056816
+Node: PC Compiling1058664
+Node: PC Testing1061608
+Node: PC Using1062784
+Node: Cygwin1066969
+Node: MSYS1067969
+Node: VMS Installation1068483
+Node: VMS Compilation1069247
+Ref: VMS Compilation-Footnote-11070862
+Node: VMS Dynamic Extensions1070920
+Node: VMS Installation Details1072293
+Node: VMS Running1074540
+Node: VMS GNV1077374
+Node: VMS Old Gawk1078097
+Node: Bugs1078567
+Node: Other Versions1082485
+Node: Notes1088569
+Node: Compatibility Mode1089369
+Node: Additions1090152
+Node: Accessing The Source1091079
+Node: Adding Code1092519
+Node: New Ports1098564
+Node: Derived Files1102699
+Ref: Derived Files-Footnote-11108020
+Ref: Derived Files-Footnote-21108054
+Ref: Derived Files-Footnote-31108654
+Node: Future Extensions1108752
+Node: Implementation Limitations1109335
+Node: Extension Design1110587
+Node: Old Extension Problems1111741
+Ref: Old Extension Problems-Footnote-11113249
+Node: Extension New Mechanism Goals1113306
+Ref: Extension New Mechanism Goals-Footnote-11116671
+Node: Extension Other Design Decisions1116857
+Node: Extension Future Growth1118963
+Node: Old Extension Mechanism1119799
+Node: Basic Concepts1121539
+Node: Basic High Level1122220
+Ref: figure-general-flow1122491
+Ref: figure-process-flow1123090
+Ref: Basic High Level-Footnote-11126319
+Node: Basic Data Typing1126504
+Node: Glossary1129859
+Node: Copying1155321
+Node: GNU Free Documentation License1192878
+Node: Index1218015

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 0d780286..83f2d626 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -12893,6 +12893,8 @@ for more information on this version of the @code{for} loop.
@cindex @code{case} keyword
@cindex @code{default} keyword
+This @value{SECTION} describes a @command{gawk}-specific feature.
+
The @code{switch} statement allows the evaluation of an expression and
the execution of statements based on a @code{case} match. Case statements
are checked for a match in the order they are defined. If no suitable
@@ -16753,11 +16755,10 @@ This is the purpose of the @code{fflush()} function---@command{gawk} also
buffers its output and the @code{fflush()} function forces
@command{gawk} to flush its buffers.
-@code{fflush()} was added to Brian Kernighan's
-version of @command{awk} in 1994.
-For over two decades, it was not part of the POSIX standard.
-As of December, 2012, it was accepted for
-inclusion into the POSIX standard.
+@code{fflush()} was added to Brian Kernighan's version of @command{awk} in
+April of 1992. For two decades, it was not part of the POSIX standard.
+As of December, 2012, it was accepted for inclusion into the POSIX
+standard.
See @uref{http://austingroupbugs.net/view.php?id=634, the Austin Group website}.
POSIX standardizes @code{fflush()} as follows: If there
@@ -17889,7 +17890,7 @@ have a parameter with the same name as the function itself.
In addition, according to the POSIX standard, function parameters cannot have the same
name as one of the special built-in variables
(@pxref{Built-in Variables}. Not all versions of @command{awk}
-enforce this restriction.
+enforce this restriction.)
The @var{body-of-function} consists of @command{awk} statements. It is the
most important part of the definition, because it says what the function
@@ -17936,7 +17937,7 @@ function. When this happens, we say the function is @dfn{recursive}.
The act of a function calling itself is called @dfn{recursion}.
All the built-in functions return a value to their caller.
-User-defined functions can do also, using the @code{return} statement,
+User-defined functions can do so also, using the @code{return} statement,
which is described in detail in @ref{Return Statement}.
Many of the subsequent examples in this @value{SECTION} use
the @code{return} statement.
@@ -18028,7 +18029,8 @@ Instead of having
to repeat this loop everywhere that you need to clear out
an array, your program can just call @code{delarray}.
(This guarantees portability. The use of @samp{delete @var{array}} to delete
-the contents of an entire array is a nonstandard extension.)
+the contents of an entire array is a recent@footnote{Late in 2012.}
+addition to the POSIX standard.)
The following is an example of a recursive function. It takes a string
as an input parameter and returns the string in backwards order.
@@ -18084,7 +18086,10 @@ function ctime(ts, format)
@subsection Calling User-Defined Functions
@c STARTOFRANGE fudc
-This section describes how to call a user-defined function.
+@cindex functions, user-defined, calling
+@dfn{Calling a function} means causing the function to run and do its job.
+A function call is an expression and its value is the value returned by
+the function.
@menu
* Calling A Function:: Don't use spaces.
@@ -18095,11 +18100,6 @@ This section describes how to call a user-defined function.
@node Calling A Function
@subsubsection Writing A Function Call
-@cindex functions, user-defined, calling
-@dfn{Calling a function} means causing the function to run and do its job.
-A function call is an expression and its value is the value returned by
-the function.
-
A function call consists of the function name followed by the arguments
in parentheses. @command{awk} expressions are what you write in the
call for the arguments. Each time the call is executed, these
@@ -18569,7 +18569,7 @@ character:
@example
the_func = "sum"
-result = @@the_func() # calls the `sum' function
+result = @@the_func() # calls the sum() function
@end example
Here is a full program that processes the previously shown data,
@@ -18690,8 +18690,9 @@ We can do something similar using @command{gawk}, like this:
@ignore
@c file eg/lib/quicksort.awk
#
-# Arnold Robbins, arnold@skeeve.com, Public Domain
+# Arnold Robbins, arnold@@skeeve.com, Public Domain
# January 2009
+
@c endfile
@end ignore
@@ -18764,7 +18765,7 @@ or equal to), which yields data sorted in descending order.
Next comes a sorting function. It is parameterized with the starting and
ending field numbers and the comparison function. It builds an array with
-the data and calls @code{quicksort} appropriately, and then formats the
+the data and calls @code{quicksort()} appropriately, and then formats the
results as a single string:
@example
@@ -18902,6 +18903,8 @@ it allows you to encapsulate algorithms and program tasks in a single
place. It simplifies programming, making program development more
manageable, and making programs more readable.
+@cindex Kernighan, Brian
+@cindex Plauger, P.J.@:
In their seminal 1976 book, @cite{Software Tools},@footnote{Sadly, over 35
years later, many of the lessons taught by this book have yet to be
learned by a vast number of practicing programmers.} Brian Kernighan
@@ -19031,7 +19034,7 @@ with the user's program.
@cindex underscore (@code{_}), in names of private variables
In addition, several of the library functions use a prefix that helps
indicate what function or set of functions use the variables---for example,
-@code{_pw_byname} in the user database routines
+@code{_pw_byname()} in the user database routines
(@pxref{Passwd Functions}).
This convention is recommended, since it even further decreases the
chance of inadvertent conflict among variable names. Note that this
@@ -19345,9 +19348,9 @@ with an @code{exit} statement.
The way @code{printf} and @code{sprintf()}
(@pxref{Printf})
perform rounding often depends upon the system's C @code{sprintf()}
-subroutine. On many machines, @code{sprintf()} rounding is ``unbiased,''
-which means it doesn't always round a trailing @samp{.5} up, contrary
-to naive expectations. In unbiased rounding, @samp{.5} rounds to even,
+subroutine. On many machines, @code{sprintf()} rounding is @dfn{unbiased},
+which means it doesn't always round a trailing .5 up, contrary
+to naive expectations. In unbiased rounding, .5 rounds to even,
rather than always up, so 1.5 rounds to 2 but 4.5 rounds to 4. This means
that if you are using a format that does rounding (e.g., @code{"%.0f"}),
you should check what your system does. The following function does
@@ -19396,7 +19399,7 @@ function round(x, ival, aval, fraction)
@c don't include test harness in the file that gets installed
# test harness
-@{ print $0, round($0) @}
+# @{ print $0, round($0) @}
@end example
@node Cliff Random Function
@@ -19510,7 +19513,7 @@ function _ord_init( low, high, i, t)
@cindex ASCII
@cindex EBCDIC
@cindex mark parity
-Some explanation of the numbers used by @code{chr()} is worthwhile.
+Some explanation of the numbers used by @code{_ord_init()} is worthwhile.
The most prominent character set in use today is ASCII.@footnote{This
is changing; many systems use Unicode, a very large character set
that includes ASCII as a subset. On systems with full Unicode support,
@@ -19521,7 +19524,7 @@ Although an
defines characters that use the values from 0 to 127.@footnote{ASCII
has been extended in many countries to use the values from 128 to 255
for country-specific characters. If your system uses these extensions,
-you can simplify @code{_ord_init} to loop from 0 to 255.}
+you can simplify @code{_ord_init()} to loop from 0 to 255.}
In the now distant past,
at least one minicomputer manufacturer
@c Pr1me, blech
@@ -20195,7 +20198,7 @@ END @{
Occasionally, you might not want @command{awk} to process command-line
variable assignments
(@pxref{Assignment Options}).
-In particular, if you have a file name that contain an @samp{=} character,
+In particular, if you have a file name that contains an @samp{=} character,
@command{awk} treats the file name as an assignment, and does not process it.
Some users have suggested an additional command-line option for @command{gawk}
@@ -20874,7 +20877,7 @@ field-splitting mechanism later. The test can only be true for
or on some other @command{awk} implementation.
The code that checks for using @code{FPAT}, using @code{using_fpat}
-and @code{PROCINFO["FS"]} is similar.
+and @code{PROCINFO["FS"]}, is similar.
The main part of the function uses a loop to read database lines, split
the line into fields, and then store the line into each array as necessary.
@@ -20904,10 +20907,9 @@ function getpwnam(name)
@end example
@cindex @code{getpwuid()} function (C library)
-Similarly,
-the @code{getpwuid} function takes a user ID number argument. If that
-user number is in the database, it returns the appropriate line. Otherwise, it
-returns the null string:
+Similarly, the @code{getpwuid()} function takes a user ID number
+argument. If that user number is in the database, it returns the
+appropriate line. Otherwise, it returns the null string:
@cindex @code{getpwuid()} user-defined function
@example
@@ -21411,7 +21413,7 @@ index and value, use the indirect function call syntax
and the value.
When calling @code{walk_array()}, you would pass the name of a user-defined
-function that expects to receive and index and a value, and then processes
+function that expects to receive an index and a value, and then processes
the element.
@@ -21765,7 +21767,7 @@ complete field list, including filler fields:
@example
@c file eg/prog/cut.awk
-function set_charlist( field, i, j, f, g, t,
+function set_charlist( field, i, j, f, g, n, m, t,
filler, last, len)
@{
field = 1 # count total fields
@@ -24493,7 +24495,7 @@ BEGIN @{
@c endfile
@end example
-The stack is initialized with @code{ARGV[1]}, which will be @file{/dev/stdin}.
+The stack is initialized with @code{ARGV[1]}, which will be @samp{/dev/stdin}.
The main loop comes next. Input lines are read in succession. Lines that
do not start with @samp{@@include} are printed verbatim.
If the line does start with @samp{@@include}, the file name is in @code{$2}.
@@ -25535,7 +25537,7 @@ open a @emph{two-way} pipe to another process. The second process is
termed a @dfn{coprocess}, since it runs in parallel with @command{gawk}.
The two-way connection is created using the @samp{|&} operator
(borrowed from the Korn shell, @command{ksh}):@footnote{This is very
-different from the same operator in the C shell.}
+different from the same operator in the C shell and in Bash.}
@example
do @{
@@ -25823,52 +25825,60 @@ foo
junk
@end example
-Here is the @file{awkprof.out} that results from running the @command{gawk}
-profiler on this program and data (this example also illustrates that @command{awk}
-programmers sometimes have to work late):
+Here is the @file{awkprof.out} that results from running the
+@command{gawk} profiler on this program and data. (This example also
+illustrates that @command{awk} programmers sometimes get up very early
+in the morning to work.)
@cindex @code{BEGIN} pattern
@cindex @code{END} pattern
@example
- # gawk profile, created Sun Aug 13 00:00:15 2000
+ # gawk profile, created Thu Feb 27 05:16:21 2014
- # BEGIN block(s)
+ # BEGIN block(s)
- BEGIN @{
- 1 print "First BEGIN rule"
- 1 print "Second BEGIN rule"
- @}
+ BEGIN @{
+ 1 print "First BEGIN rule"
+ @}
- # Rule(s)
+ BEGIN @{
+ 1 print "Second BEGIN rule"
+ @}
- 5 /foo/ @{ # 2
- 2 print "matched /foo/, gosh"
- 6 for (i = 1; i <= 3; i++) @{
- 6 sing()
- @}
- @}
+ # Rule(s)
- 5 @{
- 5 if (/foo/) @{ # 2
- 2 print "if is true"
- 3 @} else @{
- 3 print "else is true"
- @}
- @}
+ 5 /foo/ @{ # 2
+ 2 print "matched /foo/, gosh"
+ 6 for (i = 1; i <= 3; i++) @{
+ 6 sing()
+ @}
+ @}
- # END block(s)
+ 5 @{
+ 5 if (/foo/) @{ # 2
+ 2 print "if is true"
+ 3 @} else @{
+ 3 print "else is true"
+ @}
+ @}
- END @{
- 1 print "First END rule"
- 1 print "Second END rule"
- @}
+ # END block(s)
- # Functions, listed alphabetically
+ END @{
+ 1 print "First END rule"
+ @}
- 6 function sing(dummy)
- @{
- 6 print "I gotta be me!"
- @}
+ END @{
+ 1 print "Second END rule"
+ @}
+
+
+ # Functions, listed alphabetically
+
+ 6 function sing(dummy)
+ @{
+ 6 print "I gotta be me!"
+ @}
@end example
This example illustrates many of the basic features of profiling output.
@@ -25876,13 +25886,14 @@ They are as follows:
@itemize @bullet
@item
-The program is printed in the order @code{BEGIN} rule,
-@code{BEGINFILE} rule,
+The program is printed in the order @code{BEGIN} rules,
+@code{BEGINFILE} rules,
pattern/action rules,
-@code{ENDFILE} rule, @code{END} rule and functions, listed
+@code{ENDFILE} rules, @code{END} rules and functions, listed
alphabetically.
-Multiple @code{BEGIN} and @code{END} rules are merged together,
-as are multiple @code{BEGINFILE} and @code{ENDFILE} rules.
+Multiple @code{BEGIN} and @code{END} rules retain their
+separate identities, as do
+multiple @code{BEGINFILE} and @code{ENDFILE} rules.
@cindex patterns, counts
@item
@@ -25963,8 +25974,8 @@ typed when you wrote it. This is because @command{gawk} creates the
profiled version by ``pretty printing'' its internal representation of
the program. The advantage to this is that @command{gawk} can produce
a standard representation. The disadvantage is that all source-code
-comments are lost, as are the distinctions among multiple @code{BEGIN},
-@code{END}, @code{BEGINFILE}, and @code{ENDFILE} rules. Also, things such as:
+comments are lost.
+Also, things such as:
@example
/foo/
@@ -26054,6 +26065,11 @@ keyboard. The @code{INT} signal is generated by the
Finally, @command{gawk} also accepts another option, @option{--pretty-print}.
When called this way, @command{gawk} ``pretty prints'' the program into
@file{awkprof.out}, without any execution counts.
+
+@quotation NOTE
+The @option{--pretty-print} option still runs your program.
+This will change in the next major release.
+@end quotation
@c ENDOFRANGE advgaw
@c ENDOFRANGE gawadv
@c ENDOFRANGE awkp
@@ -34292,7 +34308,7 @@ as working in this fashion, and in particular, would teach that the
that @samp{[A-Z]} was the ``correct'' way to match uppercase letters.
And indeed, this was true.@footnote{And Life was good.}
-The 1993 POSIX standard introduced the idea of locales (@pxref{Locales}).
+The 1992 POSIX standard introduced the idea of locales (@pxref{Locales}).
Since many locales include other letters besides the plain twenty-six
letters of the American English alphabet, the POSIX standard added
character classes (@pxref{Bracket Expressions}) as a way to match
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 6b9acdea..4f6723e8 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -12272,6 +12272,8 @@ for more information on this version of the @code{for} loop.
@cindex @code{case} keyword
@cindex @code{default} keyword
+This @value{SECTION} describes a @command{gawk}-specific feature.
+
The @code{switch} statement allows the evaluation of an expression and
the execution of statements based on a @code{case} match. Case statements
are checked for a match in the order they are defined. If no suitable
@@ -16053,11 +16055,10 @@ This is the purpose of the @code{fflush()} function---@command{gawk} also
buffers its output and the @code{fflush()} function forces
@command{gawk} to flush its buffers.
-@code{fflush()} was added to Brian Kernighan's
-version of @command{awk} in 1994.
-For over two decades, it was not part of the POSIX standard.
-As of December, 2012, it was accepted for
-inclusion into the POSIX standard.
+@code{fflush()} was added to Brian Kernighan's version of @command{awk} in
+April of 1992. For two decades, it was not part of the POSIX standard.
+As of December, 2012, it was accepted for inclusion into the POSIX
+standard.
See @uref{http://austingroupbugs.net/view.php?id=634, the Austin Group website}.
POSIX standardizes @code{fflush()} as follows: If there
@@ -17061,7 +17062,7 @@ have a parameter with the same name as the function itself.
In addition, according to the POSIX standard, function parameters cannot have the same
name as one of the special built-in variables
(@pxref{Built-in Variables}. Not all versions of @command{awk}
-enforce this restriction.
+enforce this restriction.)
The @var{body-of-function} consists of @command{awk} statements. It is the
most important part of the definition, because it says what the function
@@ -17108,7 +17109,7 @@ function. When this happens, we say the function is @dfn{recursive}.
The act of a function calling itself is called @dfn{recursion}.
All the built-in functions return a value to their caller.
-User-defined functions can do also, using the @code{return} statement,
+User-defined functions can do so also, using the @code{return} statement,
which is described in detail in @ref{Return Statement}.
Many of the subsequent examples in this @value{SECTION} use
the @code{return} statement.
@@ -17200,7 +17201,8 @@ Instead of having
to repeat this loop everywhere that you need to clear out
an array, your program can just call @code{delarray}.
(This guarantees portability. The use of @samp{delete @var{array}} to delete
-the contents of an entire array is a nonstandard extension.)
+the contents of an entire array is a recent@footnote{Late in 2012.}
+addition to the POSIX standard.)
The following is an example of a recursive function. It takes a string
as an input parameter and returns the string in backwards order.
@@ -17256,7 +17258,10 @@ function ctime(ts, format)
@subsection Calling User-Defined Functions
@c STARTOFRANGE fudc
-This section describes how to call a user-defined function.
+@cindex functions, user-defined, calling
+@dfn{Calling a function} means causing the function to run and do its job.
+A function call is an expression and its value is the value returned by
+the function.
@menu
* Calling A Function:: Don't use spaces.
@@ -17267,11 +17272,6 @@ This section describes how to call a user-defined function.
@node Calling A Function
@subsubsection Writing A Function Call
-@cindex functions, user-defined, calling
-@dfn{Calling a function} means causing the function to run and do its job.
-A function call is an expression and its value is the value returned by
-the function.
-
A function call consists of the function name followed by the arguments
in parentheses. @command{awk} expressions are what you write in the
call for the arguments. Each time the call is executed, these
@@ -17741,7 +17741,7 @@ character:
@example
the_func = "sum"
-result = @@the_func() # calls the `sum' function
+result = @@the_func() # calls the sum() function
@end example
Here is a full program that processes the previously shown data,
@@ -17862,8 +17862,9 @@ We can do something similar using @command{gawk}, like this:
@ignore
@c file eg/lib/quicksort.awk
#
-# Arnold Robbins, arnold@skeeve.com, Public Domain
+# Arnold Robbins, arnold@@skeeve.com, Public Domain
# January 2009
+
@c endfile
@end ignore
@@ -17936,7 +17937,7 @@ or equal to), which yields data sorted in descending order.
Next comes a sorting function. It is parameterized with the starting and
ending field numbers and the comparison function. It builds an array with
-the data and calls @code{quicksort} appropriately, and then formats the
+the data and calls @code{quicksort()} appropriately, and then formats the
results as a single string:
@example
@@ -18074,6 +18075,8 @@ it allows you to encapsulate algorithms and program tasks in a single
place. It simplifies programming, making program development more
manageable, and making programs more readable.
+@cindex Kernighan, Brian
+@cindex Plauger, P.J.@:
In their seminal 1976 book, @cite{Software Tools},@footnote{Sadly, over 35
years later, many of the lessons taught by this book have yet to be
learned by a vast number of practicing programmers.} Brian Kernighan
@@ -18203,7 +18206,7 @@ with the user's program.
@cindex underscore (@code{_}), in names of private variables
In addition, several of the library functions use a prefix that helps
indicate what function or set of functions use the variables---for example,
-@code{_pw_byname} in the user database routines
+@code{_pw_byname()} in the user database routines
(@pxref{Passwd Functions}).
This convention is recommended, since it even further decreases the
chance of inadvertent conflict among variable names. Note that this
@@ -18517,9 +18520,9 @@ with an @code{exit} statement.
The way @code{printf} and @code{sprintf()}
(@pxref{Printf})
perform rounding often depends upon the system's C @code{sprintf()}
-subroutine. On many machines, @code{sprintf()} rounding is ``unbiased,''
-which means it doesn't always round a trailing @samp{.5} up, contrary
-to naive expectations. In unbiased rounding, @samp{.5} rounds to even,
+subroutine. On many machines, @code{sprintf()} rounding is @dfn{unbiased},
+which means it doesn't always round a trailing .5 up, contrary
+to naive expectations. In unbiased rounding, .5 rounds to even,
rather than always up, so 1.5 rounds to 2 but 4.5 rounds to 4. This means
that if you are using a format that does rounding (e.g., @code{"%.0f"}),
you should check what your system does. The following function does
@@ -18568,7 +18571,7 @@ function round(x, ival, aval, fraction)
@c don't include test harness in the file that gets installed
# test harness
-@{ print $0, round($0) @}
+# @{ print $0, round($0) @}
@end example
@node Cliff Random Function
@@ -18682,7 +18685,7 @@ function _ord_init( low, high, i, t)
@cindex ASCII
@cindex EBCDIC
@cindex mark parity
-Some explanation of the numbers used by @code{chr()} is worthwhile.
+Some explanation of the numbers used by @code{_ord_init()} is worthwhile.
The most prominent character set in use today is ASCII.@footnote{This
is changing; many systems use Unicode, a very large character set
that includes ASCII as a subset. On systems with full Unicode support,
@@ -18693,7 +18696,7 @@ Although an
defines characters that use the values from 0 to 127.@footnote{ASCII
has been extended in many countries to use the values from 128 to 255
for country-specific characters. If your system uses these extensions,
-you can simplify @code{_ord_init} to loop from 0 to 255.}
+you can simplify @code{_ord_init()} to loop from 0 to 255.}
In the now distant past,
at least one minicomputer manufacturer
@c Pr1me, blech
@@ -19338,7 +19341,7 @@ END @{
Occasionally, you might not want @command{awk} to process command-line
variable assignments
(@pxref{Assignment Options}).
-In particular, if you have a file name that contain an @samp{=} character,
+In particular, if you have a file name that contains an @samp{=} character,
@command{awk} treats the file name as an assignment, and does not process it.
Some users have suggested an additional command-line option for @command{gawk}
@@ -20017,7 +20020,7 @@ field-splitting mechanism later. The test can only be true for
or on some other @command{awk} implementation.
The code that checks for using @code{FPAT}, using @code{using_fpat}
-and @code{PROCINFO["FS"]} is similar.
+and @code{PROCINFO["FS"]}, is similar.
The main part of the function uses a loop to read database lines, split
the line into fields, and then store the line into each array as necessary.
@@ -20047,10 +20050,9 @@ function getpwnam(name)
@end example
@cindex @code{getpwuid()} function (C library)
-Similarly,
-the @code{getpwuid} function takes a user ID number argument. If that
-user number is in the database, it returns the appropriate line. Otherwise, it
-returns the null string:
+Similarly, the @code{getpwuid()} function takes a user ID number
+argument. If that user number is in the database, it returns the
+appropriate line. Otherwise, it returns the null string:
@cindex @code{getpwuid()} user-defined function
@example
@@ -20554,7 +20556,7 @@ index and value, use the indirect function call syntax
and the value.
When calling @code{walk_array()}, you would pass the name of a user-defined
-function that expects to receive and index and a value, and then processes
+function that expects to receive an index and a value, and then processes
the element.
@@ -20908,7 +20910,7 @@ complete field list, including filler fields:
@example
@c file eg/prog/cut.awk
-function set_charlist( field, i, j, f, g, t,
+function set_charlist( field, i, j, f, g, n, m, t,
filler, last, len)
@{
field = 1 # count total fields
@@ -23636,7 +23638,7 @@ BEGIN @{
@c endfile
@end example
-The stack is initialized with @code{ARGV[1]}, which will be @file{/dev/stdin}.
+The stack is initialized with @code{ARGV[1]}, which will be @samp{/dev/stdin}.
The main loop comes next. Input lines are read in succession. Lines that
do not start with @samp{@@include} are printed verbatim.
If the line does start with @samp{@@include}, the file name is in @code{$2}.
@@ -24678,7 +24680,7 @@ open a @emph{two-way} pipe to another process. The second process is
termed a @dfn{coprocess}, since it runs in parallel with @command{gawk}.
The two-way connection is created using the @samp{|&} operator
(borrowed from the Korn shell, @command{ksh}):@footnote{This is very
-different from the same operator in the C shell.}
+different from the same operator in the C shell and in Bash.}
@example
do @{
@@ -24966,52 +24968,60 @@ foo
junk
@end example
-Here is the @file{awkprof.out} that results from running the @command{gawk}
-profiler on this program and data (this example also illustrates that @command{awk}
-programmers sometimes have to work late):
+Here is the @file{awkprof.out} that results from running the
+@command{gawk} profiler on this program and data. (This example also
+illustrates that @command{awk} programmers sometimes get up very early
+in the morning to work.)
@cindex @code{BEGIN} pattern
@cindex @code{END} pattern
@example
- # gawk profile, created Sun Aug 13 00:00:15 2000
+ # gawk profile, created Thu Feb 27 05:16:21 2014
- # BEGIN block(s)
+ # BEGIN block(s)
- BEGIN @{
- 1 print "First BEGIN rule"
- 1 print "Second BEGIN rule"
- @}
+ BEGIN @{
+ 1 print "First BEGIN rule"
+ @}
- # Rule(s)
+ BEGIN @{
+ 1 print "Second BEGIN rule"
+ @}
- 5 /foo/ @{ # 2
- 2 print "matched /foo/, gosh"
- 6 for (i = 1; i <= 3; i++) @{
- 6 sing()
- @}
- @}
+ # Rule(s)
- 5 @{
- 5 if (/foo/) @{ # 2
- 2 print "if is true"
- 3 @} else @{
- 3 print "else is true"
- @}
- @}
+ 5 /foo/ @{ # 2
+ 2 print "matched /foo/, gosh"
+ 6 for (i = 1; i <= 3; i++) @{
+ 6 sing()
+ @}
+ @}
- # END block(s)
+ 5 @{
+ 5 if (/foo/) @{ # 2
+ 2 print "if is true"
+ 3 @} else @{
+ 3 print "else is true"
+ @}
+ @}
- END @{
- 1 print "First END rule"
- 1 print "Second END rule"
- @}
+ # END block(s)
- # Functions, listed alphabetically
+ END @{
+ 1 print "First END rule"
+ @}
- 6 function sing(dummy)
- @{
- 6 print "I gotta be me!"
- @}
+ END @{
+ 1 print "Second END rule"
+ @}
+
+
+ # Functions, listed alphabetically
+
+ 6 function sing(dummy)
+ @{
+ 6 print "I gotta be me!"
+ @}
@end example
This example illustrates many of the basic features of profiling output.
@@ -25019,13 +25029,14 @@ They are as follows:
@itemize @bullet
@item
-The program is printed in the order @code{BEGIN} rule,
-@code{BEGINFILE} rule,
+The program is printed in the order @code{BEGIN} rules,
+@code{BEGINFILE} rules,
pattern/action rules,
-@code{ENDFILE} rule, @code{END} rule and functions, listed
+@code{ENDFILE} rules, @code{END} rules and functions, listed
alphabetically.
-Multiple @code{BEGIN} and @code{END} rules are merged together,
-as are multiple @code{BEGINFILE} and @code{ENDFILE} rules.
+Multiple @code{BEGIN} and @code{END} rules retain their
+separate identities, as do
+multiple @code{BEGINFILE} and @code{ENDFILE} rules.
@cindex patterns, counts
@item
@@ -25106,8 +25117,8 @@ typed when you wrote it. This is because @command{gawk} creates the
profiled version by ``pretty printing'' its internal representation of
the program. The advantage to this is that @command{gawk} can produce
a standard representation. The disadvantage is that all source-code
-comments are lost, as are the distinctions among multiple @code{BEGIN},
-@code{END}, @code{BEGINFILE}, and @code{ENDFILE} rules. Also, things such as:
+comments are lost.
+Also, things such as:
@example
/foo/
@@ -25197,6 +25208,11 @@ keyboard. The @code{INT} signal is generated by the
Finally, @command{gawk} also accepts another option, @option{--pretty-print}.
When called this way, @command{gawk} ``pretty prints'' the program into
@file{awkprof.out}, without any execution counts.
+
+@quotation NOTE
+The @option{--pretty-print} option still runs your program.
+This will change in the next major release.
+@end quotation
@c ENDOFRANGE advgaw
@c ENDOFRANGE gawadv
@c ENDOFRANGE awkp
@@ -33435,7 +33451,7 @@ as working in this fashion, and in particular, would teach that the
that @samp{[A-Z]} was the ``correct'' way to match uppercase letters.
And indeed, this was true.@footnote{And Life was good.}
-The 1993 POSIX standard introduced the idea of locales (@pxref{Locales}).
+The 1992 POSIX standard introduced the idea of locales (@pxref{Locales}).
Since many locales include other letters besides the plain twenty-six
letters of the American English alphabet, the POSIX standard added
character classes (@pxref{Bracket Expressions}) as a way to match
diff --git a/gawkapi.c b/gawkapi.c
index 9936d530..fb456ce7 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -43,7 +43,7 @@ api_get_argument(awk_ext_id_t id, size_t count,
NODE *arg;
if (result == NULL)
- return false;
+ return awk_false;
(void) id;
@@ -59,7 +59,7 @@ api_get_argument(awk_ext_id_t id, size_t count,
*/
arg = get_argument(count);
if (arg == NULL)
- return false;
+ return awk_false;
/* if type is undefined */
if (arg->type == Node_var_new) {
@@ -84,7 +84,7 @@ array:
/* get the array here */
arg = get_array_argument(count, false);
if (arg == NULL)
- return false;
+ return awk_false;
return node_to_awk_value(arg, result, wanted);
@@ -92,11 +92,11 @@ scalar:
/* at this point we have a real type that is not an array */
arg = get_scalar_argument(count, false);
if (arg == NULL)
- return false;
+ return awk_false;
return node_to_awk_value(arg, result, wanted);
#else
- return false;
+ return awk_false;
#endif
}
@@ -114,23 +114,23 @@ api_set_argument(awk_ext_id_t id,
(void) id;
if (array == NULL || array->type != Node_var_array)
- return false;
+ return awk_false;
if ( (arg = get_argument(count)) == NULL
|| arg->type != Node_var_new)
- return false;
+ return awk_false;
arg = get_array_argument(count, false);
if (arg == NULL)
- return false;
+ return awk_false;
array->vname = arg->vname;
*arg = *array;
freenode(array);
- return true;
+ return awk_true;
#else
- return false;
+ return awk_false;
#endif
}
@@ -314,12 +314,12 @@ api_add_ext_func(awk_ext_id_t id,
(void) namespace;
if (func == NULL)
- return false;
+ return awk_false;
#ifdef DYNAMIC
return make_builtin(func);
#else
- return false;
+ return awk_false;
#endif
}
@@ -378,7 +378,7 @@ api_awk_atexit(awk_ext_id_t id,
static awk_bool_t
node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
{
- awk_bool_t ret = false;
+ awk_bool_t ret = awk_false;
if (node == NULL)
fatal(_("node_to_awk_value: received null node"));
@@ -390,7 +390,7 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
case Node_var_new: /* undefined variable */
val->val_type = AWK_UNDEFINED;
if (wanted == AWK_UNDEFINED) {
- ret = true;
+ ret = awk_true;
}
break;
@@ -399,7 +399,7 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
if (wanted == AWK_SCALAR) {
val->val_type = AWK_SCALAR;
val->scalar_cookie = (void *) node;
- ret = true;
+ ret = awk_true;
break;
}
@@ -414,7 +414,7 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
(void) force_number(node);
if ((node->flags & NUMCUR) != 0) {
val->num_value = get_number_d(node);
- ret = true;
+ ret = awk_true;
}
break;
@@ -425,7 +425,7 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
if ((node->flags & STRCUR) != 0) {
val->str_value.str = node->stptr;
val->str_value.len = node->stlen;
- ret = true;
+ ret = awk_true;
}
break;
@@ -436,7 +436,7 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
val->val_type = AWK_STRING;
} else
val->val_type = AWK_UNDEFINED;
- ret = false;
+ ret = awk_false;
break;
case AWK_UNDEFINED:
@@ -444,12 +444,12 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
if ((node->flags & NUMBER) != 0) {
val->val_type = AWK_NUMBER;
val->num_value = get_number_d(node);
- ret = true;
+ ret = awk_true;
} else if ((node->flags & STRING) != 0) {
val->val_type = AWK_STRING;
val->str_value.str = node->stptr;
val->str_value.len = node->stlen;
- ret = true;
+ ret = awk_true;
} else
val->val_type = AWK_UNDEFINED;
break;
@@ -464,15 +464,14 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
val->val_type = AWK_ARRAY;
if (wanted == AWK_ARRAY || wanted == AWK_UNDEFINED) {
val->array_cookie = node;
- ret = true;
- } else {
- ret = false;
- }
+ ret = awk_true;
+ } else
+ ret = awk_false;
break;
default:
val->val_type = AWK_UNDEFINED;
- ret = false;
+ ret = awk_false;
break;
}
@@ -510,7 +509,7 @@ api_sym_lookup(awk_ext_id_t id,
|| *name == '\0'
|| result == NULL
|| (node = lookup(name)) == NULL)
- return false;
+ return awk_false;
if (is_off_limits_var(name)) /* a built-in variable */
node->flags |= NO_EXT_SET;
@@ -531,7 +530,7 @@ api_sym_lookup_scalar(awk_ext_id_t id,
if (node == NULL
|| result == NULL
|| node->type != Node_var)
- return false;
+ return awk_false;
update_global_values(); /* make sure stuff like NF, NR, are up to date */
@@ -551,7 +550,7 @@ api_sym_update(awk_ext_id_t id,
if ( name == NULL
|| *name == '\0'
|| value == NULL)
- return false;
+ return awk_false;
switch (value->val_type) {
case AWK_NUMBER:
@@ -564,7 +563,7 @@ api_sym_update(awk_ext_id_t id,
default:
/* fatal(_("api_sym_update: invalid value for type of new value (%d)"), value->val_type); */
- return false;
+ return awk_false;
}
node = lookup(name);
@@ -586,7 +585,7 @@ api_sym_update(awk_ext_id_t id,
node->var_value = awk_value_to_node(value);
}
- return true;
+ return awk_true;
}
/*
@@ -596,7 +595,7 @@ api_sym_update(awk_ext_id_t id,
if ( (node->flags & NO_EXT_SET) != 0
|| is_off_limits_var(name)) { /* most built-in vars not allowed */
node->flags |= NO_EXT_SET;
- return false;
+ return awk_false;
}
if ( value->val_type != AWK_ARRAY
@@ -606,10 +605,10 @@ api_sym_update(awk_ext_id_t id,
if (node->type == Node_var_new && value->val_type != AWK_UNDEFINED)
node->type = Node_var;
- return true;
+ return awk_true;
}
- return false;
+ return awk_false;
}
/* api_sym_update_scalar --- update a scalar cookie */
@@ -625,7 +624,7 @@ api_sym_update_scalar(awk_ext_id_t id,
|| node == NULL
|| node->type != Node_var
|| (node->flags & NO_EXT_SET) != 0)
- return false;
+ return awk_false;
/*
* Optimization: if valref is 1, and the new value is a string or
@@ -650,7 +649,7 @@ api_sym_update_scalar(awk_ext_id_t id,
r->flags = MALLOC|NUMBER|NUMCUR;
r->stptr = NULL;
r->stlen = 0;
- return true;
+ return awk_true;
}
break;
case AWK_STRING:
@@ -670,7 +669,7 @@ api_sym_update_scalar(awk_ext_id_t id,
r->stfmt = -1;
r->stptr = value->str_value.str;
r->stlen = value->str_value.len;
- return true;
+ return awk_true;
}
break;
case AWK_UNDEFINED:
@@ -679,13 +678,13 @@ api_sym_update_scalar(awk_ext_id_t id,
break;
default: /* AWK_ARRAY or invalid type */
- return false;
+ return awk_false;
}
/* do it the hard (slow) way */
unref(node->var_value);
node->var_value = awk_value_to_node(value);
- return true;
+ return awk_true;
}
/*
@@ -694,7 +693,7 @@ api_sym_update_scalar(awk_ext_id_t id,
* Any scalar value is fine, so only AWK_ARRAY (or an invalid type) is illegal.
*/
-static inline int
+static inline bool
valid_subscript_type(awk_valtype_t valtype)
{
switch (valtype) {
@@ -733,21 +732,21 @@ api_get_array_element(awk_ext_id_t id,
|| result == NULL
|| index == NULL
|| ! valid_subscript_type(index->val_type))
- return false;
+ return awk_false;
subscript = awk_value_to_node(index);
/* if it doesn't exist, return false */
if (in_array(array, subscript) == NULL) {
unref(subscript);
- return false;
+ return awk_false;
}
aptr = assoc_lookup(array, subscript);
if (aptr == NULL) { /* can't happen */
unref(subscript);
- return false;
+ return awk_false;
}
unref(subscript);
@@ -777,7 +776,7 @@ api_set_array_element(awk_ext_id_t id, awk_array_t a_cookie,
|| index == NULL
|| value == NULL
|| ! valid_subscript_type(index->val_type))
- return false;
+ return awk_false;
tmp = awk_value_to_node(index);
aptr = assoc_lookup(array, tmp);
@@ -791,7 +790,7 @@ api_set_array_element(awk_ext_id_t id, awk_array_t a_cookie,
make_aname(elem);
}
- return true;
+ return awk_true;
}
/*
@@ -843,13 +842,13 @@ api_del_array_element(awk_ext_id_t id,
|| (array->flags & NO_EXT_SET) != 0
|| index == NULL
|| ! valid_subscript_type(index->val_type))
- return false;
+ return awk_false;
sub = awk_value_to_node(index);
remove_element(array, sub);
unref(sub);
- return true;
+ return awk_true;
}
/*
@@ -864,10 +863,10 @@ api_get_element_count(awk_ext_id_t id,
NODE *node = (NODE *) a_cookie;
if (count == NULL || node == NULL || node->type != Node_var_array)
- return false;
+ return awk_false;
*count = node->table_size;
- return true;
+ return awk_true;
}
/* api_create_array --- create a new array cookie to which elements may be added */
@@ -894,10 +893,10 @@ api_clear_array(awk_ext_id_t id, awk_array_t a_cookie)
if ( node == NULL
|| node->type != Node_var_array
|| (node->flags & NO_EXT_SET) != 0)
- return false;
+ return awk_false;
assoc_clear(node);
- return true;
+ return awk_true;
}
/* api_flatten_array --- flatten out an array so that it can be looped over easily. */
@@ -916,7 +915,7 @@ api_flatten_array(awk_ext_id_t id,
|| array->type != Node_var_array
|| array->table_size == 0
|| data == NULL)
- return false;
+ return awk_false;
alloc_size = sizeof(awk_flat_array_t) +
(array->table_size - 1) * sizeof(awk_element_t);
@@ -954,7 +953,7 @@ api_flatten_array(awk_ext_id_t id,
(int) i);
}
}
- return true;
+ return awk_true;
}
/*
@@ -978,7 +977,7 @@ api_release_flattened_array(awk_ext_id_t id,
|| array != (NODE *) data->opaque1
|| data->count != array->table_size
|| data->opaque2 == NULL)
- return false;
+ return awk_false;
list = (NODE **) data->opaque2;
@@ -995,7 +994,7 @@ api_release_flattened_array(awk_ext_id_t id,
efree(list);
efree(data);
- return true;
+ return awk_true;
}
/* api_create_value --- create a cached value */
@@ -1005,7 +1004,7 @@ api_create_value(awk_ext_id_t id, awk_value_t *value,
awk_value_cookie_t *result)
{
if (value == NULL || result == NULL)
- return false;
+ return awk_false;
switch (value->val_type) {
case AWK_NUMBER:
@@ -1013,10 +1012,10 @@ api_create_value(awk_ext_id_t id, awk_value_t *value,
break;
default:
/* reject anything other than a simple scalar */
- return false;
+ return awk_false;
}
- return (*result = awk_value_to_node(value)) != NULL;
+ return (awk_bool_t) ((*result = awk_value_to_node(value)) != NULL);
}
/* api_release_value --- release a cached value */
@@ -1027,10 +1026,10 @@ api_release_value(awk_ext_id_t id, awk_value_cookie_t value)
NODE *val = (NODE *) value;
if (val == NULL)
- return false;
+ return awk_false;
unref(val);
- return true;
+ return awk_true;
}
/*