diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/CMakeLists.txt | 95 | ||||
-rw-r--r-- | doc/ChangeLog | 53 | ||||
-rw-r--r-- | doc/Makefile.am | 14 | ||||
-rw-r--r-- | doc/Makefile.in | 14 | ||||
-rw-r--r-- | doc/awkcard.in | 3 | ||||
-rw-r--r-- | doc/gawk.1 | 25 | ||||
-rw-r--r-- | doc/gawk.info | 1586 | ||||
-rw-r--r-- | doc/gawk.texi | 270 | ||||
-rw-r--r-- | doc/gawktexi.in | 270 |
9 files changed, 1525 insertions, 805 deletions
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 00000000..e12f5de0 --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,95 @@ +# +# doc/CMakeLists.txt --- CMake input file for gawk +# +# Copyright (C) 2013 +# the Free Software Foundation, Inc. +# +# This file is part of GAWK, the GNU implementation of the +# AWK Programming Language. +# +# GAWK is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# GAWK is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +# + +## process this file with CMake to produce Makefile + +MACRO(DocDependency outfile) + add_dependencies(doc ${outfile}) + add_custom_target( + ${outfile} + DEPENDS ${ARGN} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${CMAKE_SOURCE_DIR}/cmake/docmaker ${outfile} ${ARGN} + ) +ENDMACRO(DocDependency) + +find_program(TEXI2DVI_CONVERTER texi2dvi) +if (TEXI2DVI_CONVERTER) + add_custom_target(doc) + DocDependency(gawk.texi gawktexi.in rflashlight.eps api-figure1.fig api-figure2.fig api-figure3.fig general-program.fig process-flow.fig) + DocDependency(rflashlight.eps) + DocDependency(api-figure1.fig) + DocDependency(api-figure2.fig) + DocDependency(api-figure3.fig) + DocDependency(general-program.fig) + DocDependency(process-flow.fig) + DocDependency(gawk.dvi gawk.texi) + DocDependency(gawk.info gawk.texi) + DocDependency(gawkinet.dvi gawkinet.texi) + DocDependency(gawkinet.info gawkinet.texi) + DocDependency(gawkinet.texi statist.eps) + DocDependency(gawk.1.ps gawk.1) + DocDependency(igawk.1.ps igawk.1) + find_program(DVIPS_CONVERTER dvips) + if (DVIPS_CONVERTER) + DocDependency(gawk.ps gawk.dvi) + DocDependency(gawkinet.ps gawkinet.dvi) + find_program(PS2PDF_CONVERTER ps2pdf) + if (PS2PDF_CONVERTER) + DocDependency(gawk.1.pdf gawk.1.ps) + DocDependency(igawk.1.pdf igawk.1.ps) + DocDependency(gawk.pdf gawk.ps) + DocDependency(gawkinet.pdf gawkinet.ps) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gawk.1.pdf DESTINATION doc) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/igawk.1.pdf DESTINATION doc) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gawk.info DESTINATION doc) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gawk.pdf DESTINATION doc) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gawkinet.info DESTINATION doc) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gawkinet.pdf DESTINATION doc) + + set(CARDSRC macros cardfonts colors awkcard.tr) + set(CARDSRC_N macros cardfonts no.colors awkcard.tr) + set(CARDFILES ${CARDSRC} ad.block awkcard.in setter.outline) + DocDependency(awkcard.tr awkcard.in) + DocDependency(awkcard.nc ${CARDFILES}) + DocDependency(awkcard.ps ${CARDFILES}) + DocDependency(awkcard.pdf awkcard.ps) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/awkcard.pdf DESTINATION doc) + + else() + message(WARNING "Found no ps2pdf tool; no doc will be generated") + install(CODE "MESSAGE(\"doc generated only in .ps files\")") + endif() + else() + message(WARNING "Found no dvips tool; no doc will be generated") + install(CODE "MESSAGE(\"doc generated only in .dvi files and man pages in .ps files\")") + endif() +else() + message(WARNING "Found no texi2dvi tool; no doc will be generated") + add_custom_command( + TARGET doc + COMMAND echo no doc generated because of missing texi2dvi + ) +endif() + diff --git a/doc/ChangeLog b/doc/ChangeLog index ae3a25cd..6dfd1b17 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -3,6 +3,11 @@ * gawktexi.in: Comment out that I need an owner for awk.info. I may have found one or two people. +2014-10-29 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawktexi.in: Document new extras directory containing shell startup + files to manipulate AWKPATH and AWKLIBPATH environment variables. + 2014-10-28 Arnold D. Robbins <arnold@skeeve.com> * gawk.1: Clarification that debugger reads stdin. @@ -16,6 +21,7 @@ 2014-10-25 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Minor typo fixes. + Fix discussion of \x, per note from Antonio Colombo. 2014-10-17 Arnold D. Robbins <arnold@skeeve.com> @@ -57,10 +63,25 @@ * gawktexi.in: Pretty much done! + Unrelated: + + * gawktexi.in: Fix braino in awk version of div function. + Thanks to Katie Wasserman for the catch. + 2014-10-01 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: More fixes after reading through the MS. + Unrelated: + + * gawktexi.in: Add Katie Wasserman's program to compute + the digits of PI. + + Unrelated: + + * gawktexi.in: Document the differences between profiling + and pretty printing. + 2014-09-30 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: More fixes after reading through the MS. @@ -156,6 +177,10 @@ exercises. Remove use of LC_ALL in an example; doesn't seem to be needed anymore. + Unrelated: + + * gawktexi.in: Document that MirBSD is no longer supported. + 2014-08-25 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Exercises are excluded from print edition. @@ -189,6 +214,10 @@ * gawktexi.in: Starting on reviewer comments. Update acknowledgements. +2014-08-12 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in: Cause div.awk to get into the example files. + 2014-08-06 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Misc minor additions. @@ -203,6 +232,18 @@ * gawktexi.in: Fix doc for API get_record - errcode needs to be greater than zero. +2014-07-24 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in (Numeric Functions): For `div()', clarify + truncation is towards zero. Thanks to Michal Jaegermann + for pointing out the need to clarify this. + +2014-07-10 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in (Numeric Functions): Document new `div()' function. + (Arbitrary Precision Integers): Document raison d'etre for div(). + * gawk.1, awkcard.in: Document `div()'. + 2014-07-04 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in (Bracket Expressions): Add a note about how to @@ -213,6 +254,11 @@ * gawktexi.in: Update permissions on copyright page per latest maintain.texi. Add GPL to print version of book. +2014-06-24 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in: Document that --pretty-print no longer runs the + program. Remove mention of GAWK_NO_PP_RUN env var. + 2014-06-22 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Typo fixes and minor corrections. @@ -509,7 +555,7 @@ 2013-12-26 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: More minor additions / fixes. - (Bugs): Add John Malmberg for VMS. + (Bugs): Add John Malmberg for VMS. Other minor edits. 2013-12-25 Arnold D. Robbins <arnold@skeeve.com> @@ -583,6 +629,11 @@ * gawktexi.in (FN, FFN, DF,DDF, PVERSION, CTL): Remove macros. They have no alternate versions and are just in the way. +2013-08-15 Arnold D. Robbins <arnold@skeeve.com> + + * gawk.1: Document that ENVIRON updates affect the environment. + * gawktexi.in: Ditto. + 2013-06-27 Arnold D. Robbins <arnold@skeeve.com> * texinfo.tex: Update from Karl, fixes a formating problem. diff --git a/doc/Makefile.am b/doc/Makefile.am index 86321bbc..8a0442a7 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -26,7 +26,7 @@ info_TEXINFOS = gawk.texi gawkinet.texi -man_MANS = gawk.1 igawk.1 +man_MANS = gawk.1 EXTRA_DIST = ChangeLog ChangeLog.0 README.card ad.block setter.outline \ awkcard.in awkforai.txt texinfo.tex cardfonts \ @@ -50,7 +50,7 @@ EXTRA_DIST = ChangeLog ChangeLog.0 README.card ad.block setter.outline \ bc_notes # Get rid of generated files when cleaning -CLEANFILES = *.ps *.html *.dvi *~ awkcard.nc awkcard.tr gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf igawk.1.pdf +CLEANFILES = *.ps *.html *.dvi *~ awkcard.nc awkcard.tr gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf MAKEINFO = @MAKEINFO@ --no-split --force @@ -75,9 +75,9 @@ AWKCARD = awkcard.ps gawk.texi: $(srcdir)/gawktexi.in $(srcdir)/sidebar.awk awk -f $(srcdir)/sidebar.awk < $(srcdir)/gawktexi.in > gawk.texi -postscript: gawk.ps gawkinet.ps gawk.1.ps igawk.1.ps $(AWKCARD) +postscript: gawk.ps gawkinet.ps gawk.1.ps $(AWKCARD) -pdf: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf igawk.1.pdf +pdf: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf gawk.ps: gawk.dvi TEXINPUTS=$(srcdir): dvips -o gawk.ps gawk.dvi @@ -91,12 +91,6 @@ gawk.1.ps: gawk.1 gawk.1.pdf: gawk.1.ps ps2pdf gawk.1.ps gawk.1.pdf -igawk.1.ps: igawk.1 - -groff -man $(srcdir)/igawk.1 > igawk.1.ps - -igawk.1.pdf: igawk.1.ps - ps2pdf igawk.1.ps igawk.1.pdf - awkcard.tr: awkcard.in sed 's:SRCDIR:$(srcdir):' < $(srcdir)/awkcard.in > awkcard.tr diff --git a/doc/Makefile.in b/doc/Makefile.in index abaf5601..d89beffd 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -341,7 +341,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ info_TEXINFOS = gawk.texi gawkinet.texi -man_MANS = gawk.1 igawk.1 +man_MANS = gawk.1 EXTRA_DIST = ChangeLog ChangeLog.0 README.card ad.block setter.outline \ awkcard.in awkforai.txt texinfo.tex cardfonts \ api-figure1.eps api-figure1.fig api-figure1.pdf \ @@ -365,7 +365,7 @@ EXTRA_DIST = ChangeLog ChangeLog.0 README.card ad.block setter.outline \ # Get rid of generated files when cleaning -CLEANFILES = *.ps *.html *.dvi *~ awkcard.nc awkcard.tr gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf igawk.1.pdf +CLEANFILES = *.ps *.html *.dvi *~ awkcard.nc awkcard.tr gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf TROFF = groff -t -Tps -U SEDME = sed -e "s/^level0 restore/level0 restore flashme 100 72 moveto (Copyright `date '+%m-%d-%y %T'`, FSF, Inc. (all)) show/" \ -e "s/^\/level0 save def/\/level0 save def 30 -48 translate/" @@ -869,9 +869,9 @@ uninstall-man: uninstall-man1 gawk.texi: $(srcdir)/gawktexi.in $(srcdir)/sidebar.awk awk -f $(srcdir)/sidebar.awk < $(srcdir)/gawktexi.in > gawk.texi -postscript: gawk.ps gawkinet.ps gawk.1.ps igawk.1.ps $(AWKCARD) +postscript: gawk.ps gawkinet.ps gawk.1.ps $(AWKCARD) -pdf: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf igawk.1.pdf +pdf: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf gawk.ps: gawk.dvi TEXINPUTS=$(srcdir): dvips -o gawk.ps gawk.dvi @@ -885,12 +885,6 @@ gawk.1.ps: gawk.1 gawk.1.pdf: gawk.1.ps ps2pdf gawk.1.ps gawk.1.pdf -igawk.1.ps: igawk.1 - -groff -man $(srcdir)/igawk.1 > igawk.1.ps - -igawk.1.pdf: igawk.1.ps - ps2pdf igawk.1.ps igawk.1.pdf - awkcard.tr: awkcard.in sed 's:SRCDIR:$(srcdir):' < $(srcdir)/awkcard.in > awkcard.tr diff --git a/doc/awkcard.in b/doc/awkcard.in index ca28f0a7..556bdc1e 100644 --- a/doc/awkcard.in +++ b/doc/awkcard.in @@ -1609,6 +1609,9 @@ expand; l lw(2i). \*(CD\*(FCatan2(\*(FIy\*(FC, \*(FIx\*(FC)\*(FR The arctangent of \*(FIy/x\fP in radians. \*(FCcos(\*(FIexpr\*(FC)\*(FR The cosine of \*(FIexpr\fP, which is in radians. +\*(CB\*(FCdiv(\*(FIn\*(FR\*(FC,\*(FI d\*(FR\*(FC,\*(FI res\*(FR\*(FC)\*(FR T{ +Return the result of integer division in \*(FIres\*(FR.\*(CD +T} \*(FCexp(\*(FIexpr\*(FC)\*(FR The exponential function (\*(FIe \*(FC^ \*(FIx\*(FR). \*(FCint(\*(FIexpr\*(FC)\*(FR Truncate to integer. \*(FClog(\*(FIexpr\*(FC)\*(FR The natural logarithm function (base \*(FIe\^\*(FR). @@ -918,11 +918,17 @@ An array containing the values of the current environment. The array is indexed by the environment variables, each element being the value of that variable (e.g., \fBENVIRON["HOME"]\fP might be \fB"/home/arnold"\fR). -Changing this array does not affect the environment seen by programs which +.sp +In POSIX mode, +changing this array does not affect the environment seen by programs which .I gawk spawns via redirection or the .B system() function. +Otherwise, +.I gawk +updates its real environment so that programs it spawns see +the changes. .TP .B ERRNO If a system error occurs either doing a redirection for @@ -2629,6 +2635,23 @@ Return the cosine of .IR expr , which is in radians. .TP +.BI div( num ", " denom ", " result ) +Truncate +.I num +and +.I denom +to integers. Return the quotient of +.I num +divided by +.I denom +in \fIresult\fB["quotient"]\fR +and the remainder in +in \fIresult\fB["remainder"]\fR. +This is a +.I gawk +extension, primarily of value when working with +arbitrarily large integers. +.TP .BI exp( expr ) The exponential function. .TP diff --git a/doc/gawk.info b/doc/gawk.info index 32d86905..5863ea0f 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -615,6 +615,7 @@ entitled "GNU Free Documentation License". * Unix Installation:: Installing `gawk' under various versions of Unix. * Quick Installation:: Compiling `gawk' under Unix. +* Shell Startup Files:: Shell convenience functions. * Additional Configuration Options:: Other compile-time options. * Configuration Philosophy:: How it's all supposed to work. * Non-Unix Installation:: Installation on Other Operating @@ -2620,10 +2621,8 @@ The following list describes options mandated by the POSIX standard: different file name for the output. No space is allowed between the `-o' and FILE, if FILE is supplied. - NOTE: Due to the way `gawk' has evolved, with this option - your program is still executed. This will change in the next - major release such that `gawk' will only pretty-print the - program and not run it. + NOTE: In the past, this option would also execute your + program. This is no longer the case. `-O' `--optimize' @@ -2917,6 +2916,9 @@ Since `.' is included at the beginning, `gawk' searches first in the current directory and then in `/usr/local/share/awk'. In practice, this means that you will rarely need to change the value of `AWKPATH'. + *Note Shell Startup Files::, for information on functions that help +to manipulate the `AWKPATH' variable. + `gawk' places the value of the search path that it used into `ENVIRON["AWKPATH"]'. This provides access to the actual search path value from within an `awk' program. @@ -2956,6 +2958,9 @@ empty value, `gawk' uses a default path; this is typically `/usr/local/lib/gawk', although it can vary depending upon how `gawk' was built. + *Note Shell Startup Files::, for information on functions that help +to manipulate the `AWKLIBPATH' variable. + `gawk' places the value of the search path that it used into `ENVIRON["AWKLIBPATH"]'. This provides access to the actual search path value from within an `awk' program. @@ -3027,13 +3032,6 @@ change. The variables are: supposed to be differences, but occasionally theory and practice don't coordinate with each other.) -`GAWK_NO_PP_RUN' - If this variable exists, then when invoked with the - `--pretty-print' option, `gawk' skips running the program. - - CAUTION: This variable will not survive into the next major - release. - `GAWK_STACKSIZE' This specifies the amount by which `gawk' should grow its internal evaluation stack, when needed. @@ -3425,15 +3423,18 @@ sequences apply to both string constants and regexp constants: `\xHH...' The hexadecimal value HH, where HH stands for a sequence of - hexadecimal digits (`0'-`9', and either `A'-`F' or `a'-`f'). Like - the same construct in ISO C, the escape sequence continues until - the first nonhexadecimal digit is seen. (c.e.) However, using - more than two hexadecimal digits produces undefined results. (The - `\x' escape sequence is not allowed in POSIX `awk'.) - - CAUTION: The next major relase of `gawk' will change, such - that a maximum of two hexadecimal digits following the `\x' - will be used. + hexadecimal digits (`0'-`9', and either `A'-`F' or `a'-`f'). A + maximum of two digts are allowed after the `\x'. Any further + hexadecimal digits are treated as simple letters or numbers. + (c.e.) (The `\x' escape sequence is not allowed in POSIX awk.) + + CAUTION: In ISO C, the escape sequence continues until the + first nonhexadecimal digit is seen. For many years, `gawk' + would continue incorporating hexadecimal digits into the + value until a non-hexadecimal digit or the end of the string + was encountered. However, using more than two hexadecimal + digits produced undefined results. As of version *FIXME:* + 4.3.0, only two digits are processed. `\/' A literal slash (necessary for regexp constants only). This @@ -10306,10 +10307,18 @@ Options::), they are not special. An associative array containing the values of the environment. The array indices are the environment variable names; the elements are the values of the particular environment variables. For - example, `ENVIRON["HOME"]' might be `"/home/arnold"'. Changing - this array does not affect the environment passed on to any - programs that `awk' may spawn via redirection or the `system()' - function. (In a future version of `gawk', it may do so.) + example, `ENVIRON["HOME"]' might be `/home/arnold'. + + For POSIX `awk', changing this array does not affect the + environment passed on to any programs that `awk' may spawn via + redirection or the `system()' function. + + However, beginning with version 4.2, if not in POSIX compatibility + mode, `gawk' does update its own environment when `ENVIRON' is + changed, thus changing the environment seen by programs that it + creates. You should therefore be especially careful if you modify + `ENVIRON["PATH"]"', which is the search path for finding + executable programs. Some operating systems may not have environment variables. On such systems, the `ENVIRON' array is empty (except for @@ -11859,6 +11868,21 @@ brackets ([ ]): `cos(X)' Return the cosine of X, with X in radians. +`div(NUMERATOR, DENOMINATOR, RESULT)' + Perform integer division, similar to the standard C function of the + same name. First, truncate `numerator' and `denominator' towards + zero, creating integer values. Clear the `result' array, and then + set `result["quotient"]' to the result of `numerator / + denominator', truncated towards zero to an integer, and set + `result["remainder"]' to the result of `numerator % denominator', + truncated towards zero to an integer. This function is primarily + intended for use with arbitrary length integers; it avoids + creating MPFR arbitrary precision floating-point values (*note + Arbitrary Precision Integers::). + + This function is a `gawk' extension. It is not available in + compatibility mode (*note Options::). + `exp(X)' Return the exponential of X (`e ^ X') or report an error if X is out of range. The range of values X can have depends on your @@ -19849,8 +19873,7 @@ output. They are as follows: 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. Also, things such as: +standard representation. Also, things such as: /foo/ @@ -19909,8 +19932,24 @@ 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. + NOTE: Once upon a time, the `--pretty-print' option would also run + your program. This is is no longer the case. + + There is a significant difference between the output created when +profiling, and that created when pretty-printing. Pretty-printed output +preserves the original comments that were in the program, although their +placement may not correspond exactly to their original locations in the +source code. + + However, as a deliberate design decision, profiling output _omits_ +the original program's comments. This allows you to focus on the +execution count data and helps you avoid the temptation to use the +profiler for pretty-printing. + + Additionally, pretty-printed output does not have the leading +indentation that the profiling output does. This makes it easy to +pretty-print your code once development is completed, and then use the +result as the final version of your program. File: gawk.info, Node: Advanced Features Summary, Prev: Profiling, Up: Advanced Features @@ -22395,6 +22434,62 @@ just use the following: gawk -M 'BEGIN { n = 13; print n % 2 }' + When dividing two arbitrary precision integers with either `/' or +`%', the result is typically an arbitrary precision floating point +value (unless the denominator evenly divides into the numerator). In +order to do integer division or remainder with arbitrary precision +integers, use the built-in `div()' function (*note Numeric Functions::). + + You can simulate the `div()' function in standard `awk' using this +user-defined function: + + # div --- do integer division + + function div(numerator, denominator, result) + { + split("", result) + + numerator = int(numerator) + denominator = int(denominator) + result["quotient"] = int(numerator / denominator) + result["remainder"] = int(numerator % denominator) + + return 0.0 + } + + The following example program, contributed by Katie Wasserman, uses +`div()' to compute the digits of pi to as many places as you choose to +set: + + # pi.awk --- compute the digits of pi + + BEGIN { + digits = 100000 + two = 2 * 10 ^ digits + pi = two + for (m = digits * 4; m > 0; --m) { + d = m * 2 + 1 + x = pi * m + div(x, d, result) + pi = result["quotient"] + pi = pi + two + } + print pi + } + + When asked about the algorithm used, Katie replied: + + It's not that well known but it's not that obscure either. It's + Euler's modification to Newton's method for calculating pi. Take + a look at lines (23) - (25) here: + `http://mathworld.wolfram.com/PiFormulas.htm'. + + The algorithm I wrote simply expands the multiply by 2 and works + from the innermost expression outwards. I used this to program HP + calculators because it's quite easy to modify for tiny memory + devices with smallish word sizes. See + `http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=899'. + ---------- Footnotes ---------- (1) Weisstein, Eric W. `Sylvester's Sequence'. From MathWorld--A @@ -26419,6 +26514,8 @@ the current version of `gawk'. - Ultrix + * Support for MirBSD was removed at `gawk' version 4.2. + File: gawk.info, Node: Feature History, Next: Common Extensions, Prev: POSIX/GNU, Up: Language History @@ -27321,7 +27418,9 @@ Various `.c', `.y', and `.h' files `doc/igawk.1' The `troff' source for a manual page describing the `igawk' - program presented in *note Igawk Program::. + program presented in *note Igawk Program::. (Since `gawk' can do + its own `@include' processing, neither `igawk' nor `igawk.1' are + installed.) `doc/Makefile.in' The input file used during the configuration process to generate @@ -27363,17 +27462,23 @@ Various `.c', `.y', and `.h' files contains a `Makefile.in' file, which `configure' uses to generate a `Makefile'. `Makefile.am' is used by GNU Automake to create `Makefile.in'. The library functions from *note Library - Functions::, and the `igawk' program from *note Igawk Program::, - are included as ready-to-use files in the `gawk' distribution. - They are installed as part of the installation process. The rest - of the programs in this Info file are available in appropriate - subdirectories of `awklib/eg'. + Functions::, are included as ready-to-use files in the `gawk' + distribution. They are installed as part of the installation + process. The rest of the programs in this Info file are available + in appropriate subdirectories of `awklib/eg'. `extension/*' The source code, manual pages, and infrastructure files for the sample extensions included with `gawk'. *Note Dynamic Extensions::, for more information. +`extras/*' + Additional non-essential files. Currently, this directory + contains some shell startup files to be installed in + `/etc/profile.d' to aid in manipulating the `AWKPATH' and + `AWKLIBPATH' environment variables. *Note Shell Startup Files::, + for more information. + `posix/*' Files needed for building `gawk' on POSIX-compliant systems. @@ -27404,11 +27509,12 @@ configure `gawk' for your system yourself. * Menu: * Quick Installation:: Compiling `gawk' under Unix. +* Shell Startup Files:: Shell convenience functions. * Additional Configuration Options:: Other compile-time options. * Configuration Philosophy:: How it's all supposed to work. -File: gawk.info, Node: Quick Installation, Next: Additional Configuration Options, Up: Unix Installation +File: gawk.info, Node: Quick Installation, Next: Shell Startup Files, Up: Unix Installation B.2.1 Compiling `gawk' for Unix-like Systems -------------------------------------------- @@ -27465,9 +27571,43 @@ will be asked for your password, and you will have to have been set up previously as a user who is allowed to run the `sudo' command. -File: gawk.info, Node: Additional Configuration Options, Next: Configuration Philosophy, Prev: Quick Installation, Up: Unix Installation +File: gawk.info, Node: Shell Startup Files, Next: Additional Configuration Options, Prev: Quick Installation, Up: Unix Installation + +B.2.2 Shell Startup Files +------------------------- + +The distribution contains shell startup files `gawk.sh' and `gawk.csh' +containing functions to aid in manipulating the `AWKPATH' and +`AWKLIBPATH' environment variables. On a Fedora system, these files +should be installed in `/etc/profile.d'; on other platforms, the +appropriate location may be different. + +`gawkpath_default' + Reset the `AWKPATH' environment variable to its default value. + +`gawkpath_prepend' + Add the argument to the front of the `AWKPATH' environment + variable. + +`gawkpath_append' + Add the argument to the end of the `AWKPATH' environment variable. + +`gawklibpath_default' + Reset the `AWKLIBPATH' environment variable to its default value. + +`gawklibpath_prepend' + Add the argument to the front of the `AWKLIBPATH' environment + variable. + +`gawklibpath_append' + Add the argument to the end of the `AWKLIBPATH' environment + variable. + + + +File: gawk.info, Node: Additional Configuration Options, Next: Configuration Philosophy, Prev: Shell Startup Files, Up: Unix Installation -B.2.2 Additional Configuration Options +B.2.3 Additional Configuration Options -------------------------------------- There are several additional options you may use on the `configure' @@ -27509,7 +27649,7 @@ that `configure' supplies. File: gawk.info, Node: Configuration Philosophy, Prev: Additional Configuration Options, Up: Unix Installation -B.2.3 The Configuration Process +B.2.4 The Configuration Process ------------------------------- This minor node is of interest only if you know something about using @@ -31313,20 +31453,20 @@ Index * --include option: Options. (line 159) * --lint option <1>: Options. (line 185) * --lint option: Command Line. (line 20) -* --lint-old option: Options. (line 297) +* --lint-old option: Options. (line 295) * --load option: Options. (line 173) * --non-decimal-data option <1>: Nondecimal Data. (line 6) * --non-decimal-data option: Options. (line 211) * --non-decimal-data option, strtonum() function and: Nondecimal Data. (line 35) -* --optimize option: Options. (line 239) -* --posix option: Options. (line 256) -* --posix option, --traditional option and: Options. (line 275) +* --optimize option: Options. (line 237) +* --posix option: Options. (line 254) +* --posix option, --traditional option and: Options. (line 273) * --pretty-print option: Options. (line 226) * --profile option <1>: Profiling. (line 12) -* --profile option: Options. (line 244) -* --re-interval option: Options. (line 281) -* --sandbox option: Options. (line 288) +* --profile option: Options. (line 242) +* --re-interval option: Options. (line 279) +* --sandbox option: Options. (line 286) * --sandbox option, disabling system() function: I/O Functions. (line 96) * --sandbox option, input redirection with getline: Getline. (line 19) @@ -31334,9 +31474,9 @@ Index (line 6) * --source option: Options. (line 117) * --traditional option: Options. (line 81) -* --traditional option, --posix option and: Options. (line 275) +* --traditional option, --posix option and: Options. (line 273) * --use-lc-numeric option: Options. (line 221) -* --version option: Options. (line 302) +* --version option: Options. (line 300) * --with-whiny-user-strftime configuration option: Additional Configuration Options. (line 35) * -b option: Options. (line 68) @@ -31344,32 +31484,32 @@ Index * -c option: Options. (line 81) * -D option: Options. (line 108) * -d option: Options. (line 93) -* -e option: Options. (line 338) +* -e option: Options. (line 336) * -E option: Options. (line 125) * -e option: Options. (line 117) * -f option: Options. (line 25) * -F option: Options. (line 21) * -f option: Long. (line 12) -* -F option, -Ft sets FS to TAB: Options. (line 310) +* -F option, -Ft sets FS to TAB: Options. (line 308) * -F option, command-line: Command Line Field Separator. (line 6) -* -f option, multiple uses: Options. (line 315) +* -f option, multiple uses: Options. (line 313) * -g option: Options. (line 147) * -h option: Options. (line 154) * -i option: Options. (line 159) -* -L option: Options. (line 297) +* -L option: Options. (line 295) * -l option: Options. (line 173) * -M option: Options. (line 205) * -N option: Options. (line 221) * -n option: Options. (line 211) -* -O option: Options. (line 239) +* -O option: Options. (line 237) * -o option: Options. (line 226) -* -P option: Options. (line 256) -* -p option: Options. (line 244) -* -r option: Options. (line 281) -* -S option: Options. (line 288) +* -P option: Options. (line 254) +* -p option: Options. (line 242) +* -r option: Options. (line 279) +* -S option: Options. (line 286) * -v option: Assignment Options. (line 12) -* -V option: Options. (line 302) +* -V option: Options. (line 300) * -v option: Options. (line 32) * -W option: Options. (line 46) * . (period), regexp operator: Regexp Operators. (line 44) @@ -31431,10 +31571,10 @@ Index (line 8) * [] (square brackets), regexp operator: Regexp Operators. (line 56) * \ (backslash): Comments. (line 50) -* \ (backslash), \" escape sequence: Escape Sequences. (line 82) +* \ (backslash), \" escape sequence: Escape Sequences. (line 85) * \ (backslash), \' operator (gawk): GNU Regexp Operators. (line 56) -* \ (backslash), \/ escape sequence: Escape Sequences. (line 73) +* \ (backslash), \/ escape sequence: Escape Sequences. (line 76) * \ (backslash), \< operator (gawk): GNU Regexp Operators. (line 30) * \ (backslash), \> operator (gawk): GNU Regexp Operators. @@ -31474,7 +31614,7 @@ Index * \ (backslash), in bracket expressions: Bracket Expressions. (line 17) * \ (backslash), in escape sequences: Escape Sequences. (line 6) * \ (backslash), in escape sequences, POSIX and: Escape Sequences. - (line 118) + (line 121) * \ (backslash), in regexp constants: Computed Regexps. (line 29) * \ (backslash), in shell commands: Quoting. (line 48) * \ (backslash), regexp operator: Regexp Operators. (line 18) @@ -31642,7 +31782,7 @@ Index * awf (amazingly workable formatter) program: Glossary. (line 24) * awk debugging, enabling: Options. (line 108) * awk language, POSIX version: Assignment Ops. (line 137) -* awk profiling, enabling: Options. (line 244) +* awk profiling, enabling: Options. (line 242) * awk programs <1>: Two Rules. (line 6) * awk programs <2>: Executable Scripts. (line 6) * awk programs: Getting Started. (line 12) @@ -31700,10 +31840,10 @@ Index * awkvars.out file: Options. (line 93) * b debugger command (alias for break): Breakpoint Control. (line 11) * backslash (\): Comments. (line 50) -* backslash (\), \" escape sequence: Escape Sequences. (line 82) +* backslash (\), \" escape sequence: Escape Sequences. (line 85) * backslash (\), \' operator (gawk): GNU Regexp Operators. (line 56) -* backslash (\), \/ escape sequence: Escape Sequences. (line 73) +* backslash (\), \/ escape sequence: Escape Sequences. (line 76) * backslash (\), \< operator (gawk): GNU Regexp Operators. (line 30) * backslash (\), \> operator (gawk): GNU Regexp Operators. @@ -31743,7 +31883,7 @@ Index * backslash (\), in bracket expressions: Bracket Expressions. (line 17) * backslash (\), in escape sequences: Escape Sequences. (line 6) * backslash (\), in escape sequences, POSIX and: Escape Sequences. - (line 118) + (line 121) * backslash (\), in regexp constants: Computed Regexps. (line 29) * backslash (\), in shell commands: Quoting. (line 48) * backslash (\), regexp operator: Regexp Operators. (line 18) @@ -31849,7 +31989,7 @@ Index (line 67) * Brian Kernighan's awk <12>: GNU Regexp Operators. (line 83) -* Brian Kernighan's awk <13>: Escape Sequences. (line 122) +* Brian Kernighan's awk <13>: Escape Sequences. (line 125) * Brian Kernighan's awk: When. (line 21) * Brian Kernighan's awk, extensions: BTL. (line 6) * Brian Kernighan's awk, source code: Other Versions. (line 13) @@ -32043,7 +32183,7 @@ Index * cosine: Numeric Functions. (line 15) * counting: Wc Program. (line 6) * csh utility: Statements/Lines. (line 44) -* csh utility, POSIXLY_CORRECT environment variable: Options. (line 356) +* csh utility, POSIXLY_CORRECT environment variable: Options. (line 354) * csh utility, |& operator, comparison with: Two-way I/O. (line 25) * ctime() user-defined function: Function Example. (line 74) * currency symbols, localization: Explaining gettext. (line 104) @@ -32074,13 +32214,13 @@ Index * dark corner, CONVFMT variable: Strings And Numbers. (line 40) * dark corner, escape sequences: Other Arguments. (line 38) * dark corner, escape sequences, for metacharacters: Escape Sequences. - (line 140) + (line 143) * dark corner, exit statement: Exit Statement. (line 30) * dark corner, field separators: Field Splitting Summary. (line 46) -* dark corner, FILENAME variable <1>: Auto-set. (line 90) +* dark corner, FILENAME variable <1>: Auto-set. (line 98) * dark corner, FILENAME variable: Getline Notes. (line 19) -* dark corner, FNR/NR variables: Auto-set. (line 313) +* dark corner, FNR/NR variables: Auto-set. (line 321) * dark corner, format-control characters: Control Letters. (line 18) * dark corner, FS as null string: Single Character Fields. (line 20) @@ -32230,7 +32370,7 @@ Index * debugger, read commands from a file: Debugger Info. (line 96) * debugging awk programs: Debugger. (line 6) * debugging gawk, bug reports: Bugs. (line 9) -* decimal point character, locale specific: Options. (line 272) +* decimal point character, locale specific: Options. (line 270) * decrement operators: Increment Ops. (line 35) * default keyword: Switch Statement. (line 6) * Deifik, Scott <1>: Bugs. (line 72) @@ -32269,12 +32409,12 @@ Index (line 81) * differences in awk and gawk, command-line directories: Command-line directories. (line 6) -* differences in awk and gawk, ERRNO variable: Auto-set. (line 74) +* differences in awk and gawk, ERRNO variable: Auto-set. (line 82) * differences in awk and gawk, error messages: Special FD. (line 19) * differences in awk and gawk, FIELDWIDTHS variable: User-modified. (line 37) * differences in awk and gawk, FPAT variable: User-modified. (line 43) -* differences in awk and gawk, FUNCTAB variable: Auto-set. (line 115) +* differences in awk and gawk, FUNCTAB variable: Auto-set. (line 123) * differences in awk and gawk, function arguments (gawk): Calling Built-in. (line 16) * differences in awk and gawk, getline command: Getline. (line 19) @@ -32297,7 +32437,7 @@ Index (line 262) * differences in awk and gawk, print/printf statements: Format Modifiers. (line 13) -* differences in awk and gawk, PROCINFO array: Auto-set. (line 129) +* differences in awk and gawk, PROCINFO array: Auto-set. (line 137) * differences in awk and gawk, read timeouts: Read Timeout. (line 6) * differences in awk and gawk, record separators: awk split records. (line 125) @@ -32307,7 +32447,7 @@ Index (line 26) * differences in awk and gawk, RS/RT variables: gawk split records. (line 58) -* differences in awk and gawk, RT variable: Auto-set. (line 264) +* differences in awk and gawk, RT variable: Auto-set. (line 272) * differences in awk and gawk, single-character fields: Single Character Fields. (line 6) * differences in awk and gawk, split() function: String Functions. @@ -32315,7 +32455,7 @@ Index * differences in awk and gawk, strings: Scalar Constants. (line 20) * differences in awk and gawk, strings, storing: gawk split records. (line 77) -* differences in awk and gawk, SYMTAB variable: Auto-set. (line 268) +* differences in awk and gawk, SYMTAB variable: Auto-set. (line 276) * differences in awk and gawk, TEXTDOMAIN variable: User-modified. (line 151) * differences in awk and gawk, trunc-mod operation: Arithmetic Ops. @@ -32331,6 +32471,7 @@ Index * display debugger command: Viewing And Changing Data. (line 8) * display debugger options: Debugger Info. (line 57) +* div: Numeric Functions. (line 18) * division: Arithmetic Ops. (line 44) * do-while statement: Do Statement. (line 6) * do-while statement, use of regexps in: Regexp Usage. (line 19) @@ -32351,12 +32492,12 @@ Index * dump debugger command: Miscellaneous Debugger Commands. (line 9) * dupword.awk program: Dupword Program. (line 31) -* dynamic profiling: Profiling. (line 179) +* dynamic profiling: Profiling. (line 178) * dynamically loaded extensions: Dynamic Extensions. (line 6) * e debugger command (alias for enable): Breakpoint Control. (line 73) * EBCDIC: Ordinal Functions. (line 45) -* effective group ID of gawk user: Auto-set. (line 134) -* effective user ID of gawk user: Auto-set. (line 138) +* effective group ID of gawk user: Auto-set. (line 142) +* effective user ID of gawk user: Auto-set. (line 146) * egrep utility <1>: Egrep Program. (line 6) * egrep utility: Bracket Expressions. (line 26) * egrep.awk program: Egrep Program. (line 54) @@ -32411,13 +32552,13 @@ Index (line 11) * EREs (Extended Regular Expressions): Bracket Expressions. (line 26) * ERRNO variable <1>: TCP/IP Networking. (line 54) -* ERRNO variable: Auto-set. (line 74) +* ERRNO variable: Auto-set. (line 82) * ERRNO variable, with BEGINFILE pattern: BEGINFILE/ENDFILE. (line 26) * ERRNO variable, with close() function: Close Files And Pipes. (line 140) * ERRNO variable, with getline command: Getline. (line 19) * error handling: Special FD. (line 19) -* error handling, ERRNO variable and: Auto-set. (line 74) +* error handling, ERRNO variable and: Auto-set. (line 82) * error output: Special FD. (line 6) * escape processing, gsub()/gensub()/sub() functions: Gory Details. (line 6) @@ -32450,10 +32591,10 @@ Index * exit status, of VMS: VMS Running. (line 29) * exit the debugger: Miscellaneous Debugger Commands. (line 99) -* exp: Numeric Functions. (line 18) +* exp: Numeric Functions. (line 33) * expand utility: Very Simple. (line 72) * Expat XML parser library: gawkextlib. (line 31) -* exponent: Numeric Functions. (line 18) +* exponent: Numeric Functions. (line 33) * expressions: Expressions. (line 6) * expressions, as patterns: Expression Patterns. (line 6) * expressions, assignment: Assignment Ops. (line 6) @@ -32471,7 +32612,7 @@ Index (line 6) * extension API version: Extension Versioning. (line 6) -* extension API, version number: Auto-set. (line 231) +* extension API, version number: Auto-set. (line 239) * extension example: Extension Example. (line 6) * extension registration: Registration Functions. (line 6) @@ -32553,7 +32694,7 @@ Index * file names, distinguishing: Auto-set. (line 56) * file names, in compatibility mode: Special Caveats. (line 9) * file names, standard streams in gawk: Special FD. (line 48) -* FILENAME variable <1>: Auto-set. (line 90) +* FILENAME variable <1>: Auto-set. (line 98) * FILENAME variable: Reading Files. (line 6) * FILENAME variable, getline, setting with: Getline Notes. (line 19) * filenames, assignments as: Ignoring Assigns. (line 6) @@ -32621,9 +32762,9 @@ Index * flush buffered output: I/O Functions. (line 28) * fnmatch() extension function: Extension Sample Fnmatch. (line 12) -* FNR variable <1>: Auto-set. (line 99) +* FNR variable <1>: Auto-set. (line 107) * FNR variable: Records. (line 6) -* FNR variable, changing: Auto-set. (line 313) +* FNR variable, changing: Auto-set. (line 321) * for statement: For Statement. (line 6) * for statement, looping over arrays: Scanning an Array. (line 20) * fork() extension function: Extension Sample Fork. @@ -32660,7 +32801,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 268) +* FS variable, as TAB character: Options. (line 266) * FS variable, changing value of: Field Separators. (line 35) * FS variable, running awk programs and: Cut Program. (line 63) * FS variable, setting from command line: Command Line Field Separator. @@ -32673,7 +32814,7 @@ Index * FSF (Free Software Foundation): Manual History. (line 6) * fts() extension function: Extension Sample File Functions. (line 61) -* FUNCTAB array: Auto-set. (line 115) +* FUNCTAB array: Auto-set. (line 123) * function calls: Function Calls. (line 6) * function calls, indirect: Indirect Calls. (line 6) * function calls, indirect, @-notation for: Indirect Calls. (line 47) @@ -32722,8 +32863,8 @@ Index (line 44) * G-d: Acknowledgments. (line 94) * Garfinkle, Scott: Contributors. (line 34) -* gawk program, dynamic profiling: Profiling. (line 179) -* gawk version: Auto-set. (line 206) +* gawk program, dynamic profiling: Profiling. (line 178) +* gawk version: Auto-set. (line 214) * gawk, ARGIND variable in: Other Arguments. (line 15) * gawk, awk and <1>: This Manual. (line 14) * gawk, awk and: Preface. (line 21) @@ -32741,13 +32882,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 74) +* gawk, ERRNO variable in <2>: Auto-set. (line 82) * gawk, ERRNO variable in <3>: BEGINFILE/ENDFILE. (line 26) * gawk, ERRNO variable in <4>: Close Files And Pipes. (line 140) * gawk, ERRNO variable in: Getline. (line 19) -* gawk, escape sequences: Escape Sequences. (line 130) -* gawk, extensions, disabling: Options. (line 256) +* gawk, escape sequences: Escape Sequences. (line 133) +* gawk, extensions, disabling: Options. (line 254) * gawk, features, adding: Adding Code. (line 6) * gawk, features, advanced: Advanced Features. (line 6) * gawk, field separators and: User-modified. (line 71) @@ -32758,7 +32899,7 @@ Index * gawk, FPAT variable in <1>: User-modified. (line 43) * gawk, FPAT variable in: Splitting By Content. (line 27) -* gawk, FUNCTAB array in: Auto-set. (line 115) +* gawk, FUNCTAB array in: Auto-set. (line 123) * gawk, function arguments and: Calling Built-in. (line 16) * gawk, hexadecimal numbers and: Nondecimal-numbers. (line 42) * gawk, IGNORECASE variable in <1>: Array Sorting Functions. @@ -32790,7 +32931,7 @@ Index * gawk, predefined variables and: Built-in Variables. (line 14) * gawk, PROCINFO array in <1>: Two-way I/O. (line 99) * gawk, PROCINFO array in <2>: Time Functions. (line 47) -* gawk, PROCINFO array in: Auto-set. (line 129) +* gawk, PROCINFO array in: Auto-set. (line 137) * gawk, regexp constants and: Using Constant Regexps. (line 28) * gawk, regular expressions, case sensitivity: Case-sensitivity. @@ -32798,23 +32939,29 @@ 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 264) +* gawk, RT variable in <1>: Auto-set. (line 272) * gawk, RT variable in <2>: Multiple Line. (line 129) * gawk, RT variable in: awk split records. (line 125) * gawk, See Also awk: Preface. (line 34) * gawk, source code, obtaining: Getting. (line 6) * gawk, splitting fields and: Constant Size. (line 88) * gawk, string-translation functions: I18N Functions. (line 6) -* gawk, SYMTAB array in: Auto-set. (line 268) +* gawk, SYMTAB array in: Auto-set. (line 276) * gawk, TEXTDOMAIN variable in: User-modified. (line 151) * gawk, timestamps: Time Functions. (line 6) * gawk, uses for: Preface. (line 34) -* gawk, versions of, information about, printing: Options. (line 302) +* gawk, versions of, information about, printing: Options. (line 300) * gawk, VMS version of: VMS Installation. (line 6) * gawk, word-boundary operator: GNU Regexp Operators. (line 63) * gawkextlib: gawkextlib. (line 6) * gawkextlib project: gawkextlib. (line 6) +* gawklibpath_append shell function: Shell Startup Files. (line 29) +* gawklibpath_default shell function: Shell Startup Files. (line 22) +* gawklibpath_prepend shell function: Shell Startup Files. (line 25) +* gawkpath_append shell function: Shell Startup Files. (line 19) +* gawkpath_default shell function: Shell Startup Files. (line 12) +* gawkpath_prepend shell function: Shell Startup Files. (line 15) * General Public License (GPL): Glossary. (line 305) * General Public License, See GPL: Manual History. (line 11) * generate time values: Time Functions. (line 25) @@ -32891,7 +33038,7 @@ Index * Grigera, Juan: Contributors. (line 57) * group database, reading: Group Functions. (line 6) * group file: Group Functions. (line 6) -* group ID of gawk user: Auto-set. (line 179) +* group ID of gawk user: Auto-set. (line 187) * groups, information about: Group Functions. (line 6) * gsub <1>: String Functions. (line 139) * gsub: Using Constant Regexps. @@ -32913,7 +33060,7 @@ Index * history expansion, in debugger: Readline Support. (line 6) * histsort.awk program: History Sorting. (line 25) * Hughes, Phil: Acknowledgments. (line 43) -* HUP signal, for dynamic profiling: Profiling. (line 211) +* HUP signal, for dynamic profiling: Profiling. (line 210) * hyphen (-), - operator: Precedence. (line 52) * hyphen (-), -- operator <1>: Precedence. (line 46) * hyphen (-), -- operator: Increment Ops. (line 48) @@ -32992,8 +33139,8 @@ Index * installation, VMS: VMS Installation. (line 6) * installing gawk: Installation. (line 6) * instruction tracing, in debugger: Debugger Info. (line 89) -* int: Numeric Functions. (line 23) -* INT signal (MS-Windows): Profiling. (line 214) +* int: Numeric Functions. (line 38) +* INT signal (MS-Windows): Profiling. (line 213) * integer array indices: Numeric Array Subscripts. (line 31) * integers, arbitrary precision: Arbitrary Precision Integers. @@ -33049,7 +33196,7 @@ Index * Kernighan, Brian <9>: Acknowledgments. (line 78) * Kernighan, Brian <10>: Conventions. (line 38) * Kernighan, Brian: History. (line 17) -* kill command, dynamic profiling: Profiling. (line 188) +* kill command, dynamic profiling: Profiling. (line 187) * Knights, jedi: Undocumented. (line 6) * Kwok, Conrad: Contributors. (line 34) * l debugger command (alias for list): Miscellaneous Debugger Commands. @@ -33121,7 +33268,7 @@ Index * lint checking, empty programs: Command Line. (line 16) * lint checking, issuing warnings: Options. (line 185) * lint checking, POSIXLY_CORRECT environment variable: Options. - (line 341) + (line 339) * lint checking, undefined functions: Pass By Value/Reference. (line 88) * LINT variable: User-modified. (line 88) @@ -33137,14 +33284,14 @@ Index * loading, extensions: Options. (line 173) * local variables, in a function: Variable Scope. (line 6) * locale categories: Explaining gettext. (line 81) -* locale decimal point character: Options. (line 272) +* locale decimal point character: Options. (line 270) * locale, definition of: Locales. (line 6) * localization: I18N and L10N. (line 6) * localization, See internationalization, localization: I18N and L10N. (line 6) -* log: Numeric Functions. (line 30) +* log: Numeric Functions. (line 45) * log files, timestamps in: Time Functions. (line 6) -* logarithm: Numeric Functions. (line 30) +* logarithm: Numeric Functions. (line 45) * logical false/true: Truth Values. (line 6) * logical operators, See Boolean expressions: Boolean Ops. (line 6) * login information: Passwd Functions. (line 16) @@ -33185,8 +33332,8 @@ Index * mawk utility <2>: Nextfile Statement. (line 47) * mawk utility <3>: Concatenation. (line 36) * mawk utility <4>: Getline/Pipe. (line 62) -* mawk utility: Escape Sequences. (line 130) -* maximum precision supported by MPFR library: Auto-set. (line 220) +* mawk utility: Escape Sequences. (line 133) +* maximum precision supported by MPFR library: Auto-set. (line 228) * McIlroy, Doug: Glossary. (line 149) * McPhee, Patrick: Contributors. (line 100) * message object files: Explaining gettext. (line 42) @@ -33198,8 +33345,8 @@ Index (line 54) * messages from extensions: Printing Messages. (line 6) * metacharacters in regular expressions: Regexp Operators. (line 6) -* metacharacters, escape sequences for: Escape Sequences. (line 136) -* minimum precision supported by MPFR library: Auto-set. (line 223) +* metacharacters, escape sequences for: Escape Sequences. (line 139) +* minimum precision supported by MPFR library: Auto-set. (line 231) * mktime: Time Functions. (line 25) * modifiers, in format specifiers: Format Modifiers. (line 6) * monetary information, localization: Explaining gettext. (line 104) @@ -33219,7 +33366,7 @@ Index * networks, programming: TCP/IP Networking. (line 6) * networks, support for: Special Network. (line 6) * newlines <1>: Boolean Ops. (line 69) -* newlines <2>: Options. (line 262) +* newlines <2>: Options. (line 260) * newlines: Statements/Lines. (line 6) * newlines, as field separators: Default Field Splitting. (line 6) @@ -33248,7 +33395,7 @@ Index (line 47) * nexti debugger command: Debugger Execution Control. (line 49) -* NF variable <1>: Auto-set. (line 104) +* NF variable <1>: Auto-set. (line 112) * NF variable: Fields. (line 33) * NF variable, decrementing: Changing Fields. (line 107) * ni debugger command (alias for nexti): Debugger Execution Control. @@ -33257,9 +33404,9 @@ Index * non-existent array elements: Reference to Elements. (line 23) * not Boolean-logic operator: Boolean Ops. (line 6) -* NR variable <1>: Auto-set. (line 124) +* NR variable <1>: Auto-set. (line 132) * NR variable: Records. (line 6) -* NR variable, changing: Auto-set. (line 313) +* NR variable, changing: Auto-set. (line 321) * null strings <1>: Basic Data Typing. (line 26) * null strings <2>: Truth Values. (line 6) * null strings <3>: Regexp Field Splitting. @@ -33373,7 +33520,7 @@ Index * p debugger command (alias for print): Viewing And Changing Data. (line 36) * Papadopoulos, Panos: Contributors. (line 128) -* parent process ID of gawk process: Auto-set. (line 188) +* parent process ID of gawk process: Auto-set. (line 196) * parentheses (), in a profile: Profiling. (line 146) * parentheses (), regexp operator: Regexp Operators. (line 81) * password file: Passwd Functions. (line 16) @@ -33415,14 +33562,14 @@ Index * plus sign (+), += operator: Assignment Ops. (line 82) * plus sign (+), regexp operator: Regexp Operators. (line 105) * pointers to functions: Indirect Calls. (line 6) -* portability: Escape Sequences. (line 100) +* portability: Escape Sequences. (line 103) * portability, #! (executable scripts): Executable Scripts. (line 33) * portability, ** operator and: Arithmetic Ops. (line 81) * portability, **= operator and: Assignment Ops. (line 143) * portability, ARGV variable: Executable Scripts. (line 59) * portability, backslash continuation and: Statements/Lines. (line 30) * portability, backslash in escape sequences: Escape Sequences. - (line 118) + (line 121) * portability, close() function and: Close Files And Pipes. (line 81) * portability, data files as single record: gawk split records. @@ -33440,7 +33587,7 @@ Index * portability, NF variable, decrementing: Changing Fields. (line 115) * portability, operators: Increment Ops. (line 60) * portability, operators, not in POSIX awk: Precedence. (line 98) -* portability, POSIXLY_CORRECT environment variable: Options. (line 361) +* portability, POSIXLY_CORRECT environment variable: Options. (line 359) * portability, substr() function: String Functions. (line 511) * portable object files <1>: Translator i18n. (line 6) * portable object files: Explaining gettext. (line 37) @@ -33461,7 +33608,7 @@ Index * POSIX awk, < operator and: Getline/File. (line 26) * POSIX awk, arithmetic operators and: Arithmetic Ops. (line 30) * POSIX awk, backslashes in string constants: Escape Sequences. - (line 118) + (line 121) * POSIX awk, BEGIN/END patterns: I/O And BEGIN/END. (line 16) * POSIX awk, bracket expressions and: Bracket Expressions. (line 26) * POSIX awk, bracket expressions and, character classes: Bracket Expressions. @@ -33489,11 +33636,11 @@ 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 55) -* POSIX mode: Options. (line 256) +* POSIX mode: Options. (line 254) * POSIX, awk and: Preface. (line 21) * POSIX, gawk extensions not included in: POSIX/GNU. (line 6) * POSIX, programs, implementing in awk: Clones. (line 6) -* POSIXLY_CORRECT environment variable: Options. (line 341) +* POSIXLY_CORRECT environment variable: Options. (line 339) * PREC variable: User-modified. (line 123) * precedence <1>: Precedence. (line 6) * precedence: Increment Ops. (line 60) @@ -33540,24 +33687,24 @@ Index * printing, unduplicated lines of text: Uniq Program. (line 6) * printing, user information: Id Program. (line 6) * private variables: Library Names. (line 11) -* process group idIDof gawk process: Auto-set. (line 182) -* process ID of gawk process: Auto-set. (line 185) +* process group idIDof gawk process: Auto-set. (line 190) +* process ID of gawk process: Auto-set. (line 193) * processes, two-way communications with: Two-way I/O. (line 6) * processing data: Basic High Level. (line 6) * PROCINFO array <1>: Passwd Functions. (line 6) * PROCINFO array <2>: Time Functions. (line 47) -* PROCINFO array: Auto-set. (line 129) +* PROCINFO array: Auto-set. (line 137) * PROCINFO array, and communications via ptys: Two-way I/O. (line 99) * PROCINFO array, and group membership: Group Functions. (line 6) * PROCINFO array, and user and group ID numbers: Id Program. (line 15) * PROCINFO array, testing the field splitting: Passwd Functions. (line 154) -* PROCINFO array, uses: Auto-set. (line 241) +* PROCINFO array, uses: Auto-set. (line 249) * PROCINFO, values of sorted_in: Controlling Scanning. (line 26) * profiling awk programs: Profiling. (line 6) -* profiling awk programs, dynamically: Profiling. (line 179) -* program identifiers: Auto-set. (line 147) +* profiling awk programs, dynamically: Profiling. (line 178) +* program identifiers: Auto-set. (line 155) * program, definition of: Getting Started. (line 21) * programming conventions, --non-decimal-data option: Nondecimal Data. (line 35) @@ -33592,7 +33739,7 @@ Index * QuikTrim Awk: Other Versions. (line 135) * quit debugger command: Miscellaneous Debugger Commands. (line 99) -* QUIT signal (MS-Windows): Profiling. (line 214) +* QUIT signal (MS-Windows): Profiling. (line 213) * quoting in gawk command lines: Long. (line 26) * quoting in gawk command lines, tricks for: Quoting. (line 91) * quoting, for small awk programs: Comments. (line 27) @@ -33601,12 +33748,12 @@ Index * Rakitzis, Byron: History Sorting. (line 25) * Ramey, Chet <1>: General Data Types. (line 6) * Ramey, Chet: Acknowledgments. (line 60) -* rand: Numeric Functions. (line 35) +* rand: Numeric Functions. (line 50) * random numbers, Cliff: Cliff Random Function. (line 6) * random numbers, rand()/srand() functions: Numeric Functions. - (line 35) -* random numbers, seed of: Numeric Functions. (line 65) + (line 50) +* random numbers, seed of: Numeric Functions. (line 80) * range expressions (regexps): Bracket Expressions. (line 6) * range patterns: Ranges. (line 6) * range patterns, line continuation and: Ranges. (line 65) @@ -33675,7 +33822,7 @@ Index (line 59) * regular expressions, gawk, command-line options: GNU Regexp Operators. (line 70) -* regular expressions, interval expressions and: Options. (line 281) +* regular expressions, interval expressions and: Options. (line 279) * regular expressions, leftmost longest match: Leftmost Longest. (line 6) * regular expressions, operators <1>: Regexp Operators. (line 6) @@ -33715,7 +33862,7 @@ Index * right shift: Bitwise Functions. (line 53) * right shift, bitwise: Bitwise Functions. (line 32) * Ritchie, Dennis: Basic Data Typing. (line 54) -* RLENGTH variable: Auto-set. (line 251) +* RLENGTH variable: Auto-set. (line 259) * RLENGTH variable, match() function and: String Functions. (line 227) * Robbins, Arnold <1>: Future Extensions. (line 6) * Robbins, Arnold <2>: Bugs. (line 72) @@ -33733,7 +33880,7 @@ Index * Robbins, Miriam <2>: Getline/Pipe. (line 39) * Robbins, Miriam: Acknowledgments. (line 94) * Rommel, Kai Uwe: Contributors. (line 42) -* round to nearest integer: Numeric Functions. (line 23) +* round to nearest integer: Numeric Functions. (line 38) * round() user-defined function: Round Function. (line 16) * rounding numbers: Round Function. (line 6) * ROUNDMODE variable: User-modified. (line 127) @@ -33741,9 +33888,9 @@ Index * RS variable: awk split records. (line 12) * RS variable, multiline records and: Multiple Line. (line 17) * rshift: Bitwise Functions. (line 53) -* RSTART variable: Auto-set. (line 257) +* RSTART variable: Auto-set. (line 265) * RSTART variable, match() function and: String Functions. (line 227) -* RT variable <1>: Auto-set. (line 264) +* RT variable <1>: Auto-set. (line 272) * RT variable <2>: Multiple Line. (line 129) * RT variable: awk split records. (line 125) * Rubin, Paul <1>: Contributors. (line 15) @@ -33756,14 +33903,14 @@ Index (line 68) * sample debugging session: Sample Debugging Session. (line 6) -* sandbox mode: Options. (line 288) +* sandbox mode: Options. (line 286) * save debugger options: Debugger Info. (line 84) * scalar or array: Type Functions. (line 11) * scalar values: Basic Data Typing. (line 13) * scanning arrays: Scanning an Array. (line 6) * scanning multidimensional arrays: Multiscanning. (line 11) * Schorr, Andrew <1>: Contributors. (line 133) -* Schorr, Andrew <2>: Auto-set. (line 296) +* Schorr, Andrew <2>: Auto-set. (line 304) * Schorr, Andrew: Acknowledgments. (line 60) * Schreiber, Bert: Acknowledgments. (line 38) * Schreiber, Rita: Acknowledgments. (line 38) @@ -33783,7 +33930,7 @@ Index * sed utility <2>: Simple Sed. (line 6) * sed utility: Field Splitting Summary. (line 46) -* seeding random number generator: Numeric Functions. (line 65) +* seeding random number generator: Numeric Functions. (line 80) * semicolon (;), AWKPATH variable and: PC Using. (line 10) * semicolon (;), separating statements in actions <1>: Statements. (line 10) @@ -33844,14 +33991,14 @@ Index * sidebar, A Constant's Base Does Not Affect Its Value: Nondecimal-numbers. (line 64) * sidebar, Backslash Before Regular Characters: Escape Sequences. - (line 116) + (line 119) * sidebar, Changing FS Does Not Affect the Fields: Field Splitting Summary. (line 38) -* sidebar, Changing NR and FNR: Auto-set. (line 311) +* sidebar, Changing NR and FNR: Auto-set. (line 319) * sidebar, Controlling Output Buffering with system(): I/O Functions. (line 137) * sidebar, Escape Sequences for Metacharacters: Escape Sequences. - (line 134) + (line 137) * sidebar, FS and IGNORECASE: Field Splitting Summary. (line 64) * sidebar, Interactive Versus Noninteractive Buffering: I/O Functions. @@ -33873,19 +34020,19 @@ Index (line 57) * sidebar, Using close()'s Return Value: Close Files And Pipes. (line 130) -* SIGHUP signal, for dynamic profiling: Profiling. (line 211) -* SIGINT signal (MS-Windows): Profiling. (line 214) -* signals, HUP/SIGHUP, for profiling: Profiling. (line 211) -* signals, INT/SIGINT (MS-Windows): Profiling. (line 214) -* signals, QUIT/SIGQUIT (MS-Windows): Profiling. (line 214) -* signals, USR1/SIGUSR1, for profiling: Profiling. (line 188) +* SIGHUP signal, for dynamic profiling: Profiling. (line 210) +* SIGINT signal (MS-Windows): Profiling. (line 213) +* signals, HUP/SIGHUP, for profiling: Profiling. (line 210) +* signals, INT/SIGINT (MS-Windows): Profiling. (line 213) +* signals, QUIT/SIGQUIT (MS-Windows): Profiling. (line 213) +* signals, USR1/SIGUSR1, for profiling: Profiling. (line 187) * signature program: Signature Program. (line 6) -* SIGQUIT signal (MS-Windows): Profiling. (line 214) -* SIGUSR1 signal, for dynamic profiling: Profiling. (line 188) +* SIGQUIT signal (MS-Windows): Profiling. (line 213) +* SIGUSR1 signal, for dynamic profiling: Profiling. (line 187) * silent debugger command: Debugger Execution Control. (line 10) -* sin: Numeric Functions. (line 76) -* sine: Numeric Functions. (line 76) +* sin: Numeric Functions. (line 91) +* sine: Numeric Functions. (line 91) * single quote ('): One-shot. (line 15) * single quote (') in gawk command lines: Long. (line 35) * single quote ('), in shell commands: Quoting. (line 48) @@ -33935,10 +34082,10 @@ Index * sprintf() function, OFMT variable and: User-modified. (line 113) * sprintf() function, print/printf statements and: Round Function. (line 6) -* sqrt: Numeric Functions. (line 79) +* sqrt: Numeric Functions. (line 94) * square brackets ([]), regexp operator: Regexp Operators. (line 56) -* square root: Numeric Functions. (line 79) -* srand: Numeric Functions. (line 83) +* square root: Numeric Functions. (line 94) +* srand: Numeric Functions. (line 98) * stack frame: Debugging Terms. (line 10) * Stallman, Richard <1>: Glossary. (line 296) * Stallman, Richard <2>: Contributors. (line 23) @@ -34010,9 +34157,9 @@ Index * substr: String Functions. (line 480) * substring: String Functions. (line 480) * Sumner, Andrew: Other Versions. (line 64) -* supplementary groups of gawk process: Auto-set. (line 236) +* supplementary groups of gawk process: Auto-set. (line 244) * switch statement: Switch Statement. (line 6) -* SYMTAB array: Auto-set. (line 268) +* SYMTAB array: Auto-set. (line 276) * syntactic ambiguity: /= operator vs. /=.../ regexp constant: Assignment Ops. (line 148) * system: I/O Functions. (line 74) @@ -34079,7 +34226,7 @@ Index (line 37) * troubleshooting, awk uses FS not IFS: Field Separators. (line 30) * troubleshooting, backslash before nonspecial character: Escape Sequences. - (line 118) + (line 121) * troubleshooting, division: Arithmetic Ops. (line 44) * troubleshooting, fatal errors, field widths, specifying: Constant Size. (line 23) @@ -34135,7 +34282,7 @@ Index * uniq.awk program: Uniq Program. (line 65) * Unix: Glossary. (line 611) * Unix awk, backslashes in escape sequences: Escape Sequences. - (line 130) + (line 133) * Unix awk, close() function and: Close Files And Pipes. (line 132) * Unix awk, password files, field separators and: Command Line Field Separator. @@ -34155,7 +34302,7 @@ Index * 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, for dynamic profiling: Profiling. (line 188) +* USR1 signal, for dynamic profiling: Profiling. (line 187) * values, numeric: Basic Data Typing. (line 13) * values, string: Basic Data Typing. (line 13) * variable assignments and input files: Other Arguments. (line 26) @@ -34189,10 +34336,10 @@ Index * variables, uninitialized, as array subscripts: Uninitialized Subscripts. (line 6) * variables, user-defined: Variables. (line 6) -* version of gawk: Auto-set. (line 206) -* version of gawk extension API: Auto-set. (line 231) -* version of GNU MP library: Auto-set. (line 217) -* version of GNU MPFR library: Auto-set. (line 213) +* version of gawk: Auto-set. (line 214) +* version of gawk extension API: Auto-set. (line 239) +* version of GNU MP library: Auto-set. (line 225) +* version of GNU MPFR library: Auto-set. (line 221) * vertical bar (|): Regexp Operators. (line 70) * vertical bar (|), | operator (I/O) <1>: Precedence. (line 65) * vertical bar (|), | operator (I/O): Getline/Pipe. (line 9) @@ -34229,7 +34376,7 @@ Index * whitespace, as field separators: Default Field Splitting. (line 6) * whitespace, functions, calling: Calling Built-in. (line 10) -* whitespace, newlines as: Options. (line 262) +* whitespace, newlines as: Options. (line 260) * Williams, Kent: Contributors. (line 34) * Woehlke, Matthew: Contributors. (line 79) * Woods, John: Contributors. (line 27) @@ -34282,558 +34429,559 @@ Index Tag Table: Node: Top1204 -Node: Foreword342156 -Node: Foreword446548 -Node: Preface47982 -Ref: Preface-Footnote-150853 -Ref: Preface-Footnote-250960 -Ref: Preface-Footnote-351193 -Node: History51335 -Node: Names53683 -Ref: Names-Footnote-154777 -Node: This Manual54923 -Ref: This Manual-Footnote-160752 -Node: Conventions60852 -Node: Manual History63192 -Ref: Manual History-Footnote-166183 -Ref: Manual History-Footnote-266224 -Node: How To Contribute66298 -Node: Acknowledgments67429 -Node: Getting Started72237 -Node: Running gawk74671 -Node: One-shot75861 -Node: Read Terminal77086 -Node: Long79113 -Node: Executable Scripts80629 -Ref: Executable Scripts-Footnote-183418 -Node: Comments83520 -Node: Quoting85993 -Node: DOS Quoting91499 -Node: Sample Data Files92174 -Node: Very Simple94767 -Node: Two Rules99658 -Node: More Complex101544 -Node: Statements/Lines104406 -Ref: Statements/Lines-Footnote-1108862 -Node: Other Features109127 -Node: When110058 -Ref: When-Footnote-1111814 -Node: Intro Summary111879 -Node: Invoking Gawk112762 -Node: Command Line114277 -Node: Options115068 -Ref: Options-Footnote-1130980 -Node: Other Arguments131005 -Node: Naming Standard Input133966 -Node: Environment Variables135059 -Node: AWKPATH Variable135617 -Ref: AWKPATH Variable-Footnote-1138917 -Ref: AWKPATH Variable-Footnote-2138962 -Node: AWKLIBPATH Variable139222 -Node: Other Environment Variables140365 -Node: Exit Status144085 -Node: Include Files144760 -Node: Loading Shared Libraries148348 -Node: Obsolete149775 -Node: Undocumented150472 -Node: Invoking Summary150739 -Node: Regexp152405 -Node: Regexp Usage153864 -Node: Escape Sequences155897 -Node: Regexp Operators161914 -Ref: Regexp Operators-Footnote-1169348 -Ref: Regexp Operators-Footnote-2169495 -Node: Bracket Expressions169593 -Ref: table-char-classes171610 -Node: Leftmost Longest174550 -Node: Computed Regexps175852 -Node: GNU Regexp Operators179249 -Node: Case-sensitivity182951 -Ref: Case-sensitivity-Footnote-1185841 -Ref: Case-sensitivity-Footnote-2186076 -Node: Regexp Summary186184 -Node: Reading Files187653 -Node: Records189747 -Node: awk split records190479 -Node: gawk split records195393 -Ref: gawk split records-Footnote-1199932 -Node: Fields199969 -Ref: Fields-Footnote-1202767 -Node: Nonconstant Fields202853 -Ref: Nonconstant Fields-Footnote-1205089 -Node: Changing Fields205291 -Node: Field Separators211223 -Node: Default Field Splitting213927 -Node: Regexp Field Splitting215044 -Node: Single Character Fields218394 -Node: Command Line Field Separator219453 -Node: Full Line Fields222665 -Ref: Full Line Fields-Footnote-1223173 -Node: Field Splitting Summary223219 -Ref: Field Splitting Summary-Footnote-1226350 -Node: Constant Size226451 -Node: Splitting By Content231057 -Ref: Splitting By Content-Footnote-1235130 -Node: Multiple Line235170 -Ref: Multiple Line-Footnote-1241059 -Node: Getline241238 -Node: Plain Getline243449 -Node: Getline/Variable246089 -Node: Getline/File247236 -Node: Getline/Variable/File248620 -Ref: Getline/Variable/File-Footnote-1250221 -Node: Getline/Pipe250308 -Node: Getline/Variable/Pipe252991 -Node: Getline/Coprocess254122 -Node: Getline/Variable/Coprocess255374 -Node: Getline Notes256113 -Node: Getline Summary258905 -Ref: table-getline-variants259317 -Node: Read Timeout260146 -Ref: Read Timeout-Footnote-1263960 -Node: Command-line directories264018 -Node: Input Summary264922 -Node: Input Exercises268174 -Node: Printing268902 -Node: Print270679 -Node: Print Examples272136 -Node: Output Separators274915 -Node: OFMT276933 -Node: Printf278287 -Node: Basic Printf279072 -Node: Control Letters280643 -Node: Format Modifiers284627 -Node: Printf Examples290634 -Node: Redirection293116 -Node: Special FD299955 -Ref: Special FD-Footnote-1303112 -Node: Special Files303186 -Node: Other Inherited Files303802 -Node: Special Network304802 -Node: Special Caveats305663 -Node: Close Files And Pipes306614 -Ref: Close Files And Pipes-Footnote-1313793 -Ref: Close Files And Pipes-Footnote-2313941 -Node: Output Summary314091 -Node: Output Exercises315087 -Node: Expressions315767 -Node: Values316952 -Node: Constants317628 -Node: Scalar Constants318308 -Ref: Scalar Constants-Footnote-1319167 -Node: Nondecimal-numbers319417 -Node: Regexp Constants322417 -Node: Using Constant Regexps322942 -Node: Variables326080 -Node: Using Variables326735 -Node: Assignment Options328645 -Node: Conversion330520 -Node: Strings And Numbers331044 -Ref: Strings And Numbers-Footnote-1334108 -Node: Locale influences conversions334217 -Ref: table-locale-affects336962 -Node: All Operators337550 -Node: Arithmetic Ops338180 -Node: Concatenation340685 -Ref: Concatenation-Footnote-1343504 -Node: Assignment Ops343610 -Ref: table-assign-ops348593 -Node: Increment Ops349871 -Node: Truth Values and Conditions353309 -Node: Truth Values354392 -Node: Typing and Comparison355441 -Node: Variable Typing356234 -Node: Comparison Operators359886 -Ref: table-relational-ops360296 -Node: POSIX String Comparison363811 -Ref: POSIX String Comparison-Footnote-1364883 -Node: Boolean Ops365021 -Ref: Boolean Ops-Footnote-1369500 -Node: Conditional Exp369591 -Node: Function Calls371318 -Node: Precedence375198 -Node: Locales378866 -Node: Expressions Summary380497 -Node: Patterns and Actions383071 -Node: Pattern Overview384191 -Node: Regexp Patterns385870 -Node: Expression Patterns386413 -Node: Ranges390193 -Node: BEGIN/END393299 -Node: Using BEGIN/END394061 -Ref: Using BEGIN/END-Footnote-1396798 -Node: I/O And BEGIN/END396904 -Node: BEGINFILE/ENDFILE399218 -Node: Empty402119 -Node: Using Shell Variables402436 -Node: Action Overview404712 -Node: Statements407039 -Node: If Statement408887 -Node: While Statement410385 -Node: Do Statement412413 -Node: For Statement413555 -Node: Switch Statement416710 -Node: Break Statement419098 -Node: Continue Statement421139 -Node: Next Statement422964 -Node: Nextfile Statement425344 -Node: Exit Statement427974 -Node: Built-in Variables430377 -Node: User-modified431510 -Ref: User-modified-Footnote-1439190 -Node: Auto-set439252 -Ref: Auto-set-Footnote-1452282 -Ref: Auto-set-Footnote-2452487 -Node: ARGC and ARGV452543 -Node: Pattern Action Summary456747 -Node: Arrays459174 -Node: Array Basics460503 -Node: Array Intro461347 -Ref: figure-array-elements463311 -Ref: Array Intro-Footnote-1465835 -Node: Reference to Elements465963 -Node: Assigning Elements468413 -Node: Array Example468904 -Node: Scanning an Array470662 -Node: Controlling Scanning473678 -Ref: Controlling Scanning-Footnote-1478867 -Node: Numeric Array Subscripts479183 -Node: Uninitialized Subscripts481368 -Node: Delete482985 -Ref: Delete-Footnote-1485729 -Node: Multidimensional485786 -Node: Multiscanning488881 -Node: Arrays of Arrays490470 -Node: Arrays Summary495231 -Node: Functions497336 -Node: Built-in498209 -Node: Calling Built-in499287 -Node: Numeric Functions501275 -Ref: Numeric Functions-Footnote-1505297 -Ref: Numeric Functions-Footnote-2505654 -Ref: Numeric Functions-Footnote-3505702 -Node: String Functions505971 -Ref: String Functions-Footnote-1529443 -Ref: String Functions-Footnote-2529572 -Ref: String Functions-Footnote-3529820 -Node: Gory Details529907 -Ref: table-sub-escapes531688 -Ref: table-sub-proposed533208 -Ref: table-posix-sub534572 -Ref: table-gensub-escapes536112 -Ref: Gory Details-Footnote-1536944 -Node: I/O Functions537095 -Ref: I/O Functions-Footnote-1544196 -Node: Time Functions544343 -Ref: Time Functions-Footnote-1554812 -Ref: Time Functions-Footnote-2554880 -Ref: Time Functions-Footnote-3555038 -Ref: Time Functions-Footnote-4555149 -Ref: Time Functions-Footnote-5555261 -Ref: Time Functions-Footnote-6555488 -Node: Bitwise Functions555754 -Ref: table-bitwise-ops556316 -Ref: Bitwise Functions-Footnote-1560624 -Node: Type Functions560793 -Node: I18N Functions561942 -Node: User-defined563587 -Node: Definition Syntax564391 -Ref: Definition Syntax-Footnote-1569797 -Node: Function Example569866 -Ref: Function Example-Footnote-1572783 -Node: Function Caveats572805 -Node: Calling A Function573323 -Node: Variable Scope574278 -Node: Pass By Value/Reference577266 -Node: Return Statement580776 -Node: Dynamic Typing583760 -Node: Indirect Calls584689 -Ref: Indirect Calls-Footnote-1595993 -Node: Functions Summary596121 -Node: Library Functions598820 -Ref: Library Functions-Footnote-1602438 -Ref: Library Functions-Footnote-2602581 -Node: Library Names602752 -Ref: Library Names-Footnote-1606212 -Ref: Library Names-Footnote-2606432 -Node: General Functions606518 -Node: Strtonum Function607621 -Node: Assert Function610641 -Node: Round Function613965 -Node: Cliff Random Function615506 -Node: Ordinal Functions616522 -Ref: Ordinal Functions-Footnote-1619587 -Ref: Ordinal Functions-Footnote-2619839 -Node: Join Function620050 -Ref: Join Function-Footnote-1621821 -Node: Getlocaltime Function622021 -Node: Readfile Function625762 -Node: Shell Quoting627732 -Node: Data File Management629133 -Node: Filetrans Function629765 -Node: Rewind Function633824 -Node: File Checking635209 -Ref: File Checking-Footnote-1636537 -Node: Empty Files636738 -Node: Ignoring Assigns638717 -Node: Getopt Function640268 -Ref: Getopt Function-Footnote-1651728 -Node: Passwd Functions651931 -Ref: Passwd Functions-Footnote-1660782 -Node: Group Functions660870 -Ref: Group Functions-Footnote-1668773 -Node: Walking Arrays668986 -Node: Library Functions Summary670589 -Node: Library Exercises671990 -Node: Sample Programs673270 -Node: Running Examples674040 -Node: Clones674768 -Node: Cut Program675992 -Node: Egrep Program685722 -Ref: Egrep Program-Footnote-1693226 -Node: Id Program693336 -Node: Split Program696980 -Ref: Split Program-Footnote-1700426 -Node: Tee Program700554 -Node: Uniq Program703341 -Node: Wc Program710762 -Ref: Wc Program-Footnote-1715010 -Node: Miscellaneous Programs715102 -Node: Dupword Program716315 -Node: Alarm Program718346 -Node: Translate Program723150 -Ref: Translate Program-Footnote-1727714 -Node: Labels Program727984 -Ref: Labels Program-Footnote-1731333 -Node: Word Sorting731417 -Node: History Sorting735487 -Node: Extract Program737323 -Node: Simple Sed744855 -Node: Igawk Program747917 -Ref: Igawk Program-Footnote-1762243 -Ref: Igawk Program-Footnote-2762444 -Ref: Igawk Program-Footnote-3762566 -Node: Anagram Program762681 -Node: Signature Program765743 -Node: Programs Summary766990 -Node: Programs Exercises768183 -Ref: Programs Exercises-Footnote-1772314 -Node: Advanced Features772405 -Node: Nondecimal Data774353 -Node: Array Sorting775943 -Node: Controlling Array Traversal776640 -Ref: Controlling Array Traversal-Footnote-1784971 -Node: Array Sorting Functions785089 -Ref: Array Sorting Functions-Footnote-1788981 -Node: Two-way I/O789175 -Ref: Two-way I/O-Footnote-1794119 -Ref: Two-way I/O-Footnote-2794305 -Node: TCP/IP Networking794387 -Node: Profiling797259 -Node: Advanced Features Summary804803 -Node: Internationalization806736 -Node: I18N and L10N808216 -Node: Explaining gettext808902 -Ref: Explaining gettext-Footnote-1813931 -Ref: Explaining gettext-Footnote-2814115 -Node: Programmer i18n814280 -Ref: Programmer i18n-Footnote-1819146 -Node: Translator i18n819195 -Node: String Extraction819989 -Ref: String Extraction-Footnote-1821120 -Node: Printf Ordering821206 -Ref: Printf Ordering-Footnote-1823992 -Node: I18N Portability824056 -Ref: I18N Portability-Footnote-1826505 -Node: I18N Example826568 -Ref: I18N Example-Footnote-1829368 -Node: Gawk I18N829440 -Node: I18N Summary830078 -Node: Debugger831417 -Node: Debugging832439 -Node: Debugging Concepts832880 -Node: Debugging Terms834737 -Node: Awk Debugging837312 -Node: Sample Debugging Session838204 -Node: Debugger Invocation838724 -Node: Finding The Bug840108 -Node: List of Debugger Commands846583 -Node: Breakpoint Control847915 -Node: Debugger Execution Control851607 -Node: Viewing And Changing Data854971 -Node: Execution Stack858336 -Node: Debugger Info859974 -Node: Miscellaneous Debugger Commands863991 -Node: Readline Support869183 -Node: Limitations870075 -Node: Debugging Summary872172 -Node: Arbitrary Precision Arithmetic873340 -Node: Computer Arithmetic874756 -Ref: table-numeric-ranges878357 -Ref: Computer Arithmetic-Footnote-1879216 -Node: Math Definitions879273 -Ref: table-ieee-formats882560 -Ref: Math Definitions-Footnote-1883164 -Node: MPFR features883269 -Node: FP Math Caution884940 -Ref: FP Math Caution-Footnote-1885990 -Node: Inexactness of computations886359 -Node: Inexact representation887307 -Node: Comparing FP Values888662 -Node: Errors accumulate889735 -Node: Getting Accuracy891168 -Node: Try To Round893827 -Node: Setting precision894726 -Ref: table-predefined-precision-strings895410 -Node: Setting the rounding mode897204 -Ref: table-gawk-rounding-modes897568 -Ref: Setting the rounding mode-Footnote-1901022 -Node: Arbitrary Precision Integers901201 -Ref: Arbitrary Precision Integers-Footnote-1904192 -Node: POSIX Floating Point Problems904341 -Ref: POSIX Floating Point Problems-Footnote-1908217 -Node: Floating point summary908255 -Node: Dynamic Extensions910447 -Node: Extension Intro911999 -Node: Plugin License913265 -Node: Extension Mechanism Outline914062 -Ref: figure-load-extension914490 -Ref: figure-register-new-function915970 -Ref: figure-call-new-function916974 -Node: Extension API Description918960 -Node: Extension API Functions Introduction920410 -Node: General Data Types925246 -Ref: General Data Types-Footnote-1930933 -Node: Memory Allocation Functions931232 -Ref: Memory Allocation Functions-Footnote-1934062 -Node: Constructor Functions934158 -Node: Registration Functions935892 -Node: Extension Functions936577 -Node: Exit Callback Functions938873 -Node: Extension Version String940121 -Node: Input Parsers940771 -Node: Output Wrappers950586 -Node: Two-way processors955102 -Node: Printing Messages957306 -Ref: Printing Messages-Footnote-1958383 -Node: Updating `ERRNO'958535 -Node: Requesting Values959275 -Ref: table-value-types-returned960003 -Node: Accessing Parameters960961 -Node: Symbol Table Access962192 -Node: Symbol table by name962706 -Node: Symbol table by cookie964686 -Ref: Symbol table by cookie-Footnote-1968825 -Node: Cached values968888 -Ref: Cached values-Footnote-1972392 -Node: Array Manipulation972483 -Ref: Array Manipulation-Footnote-1973581 -Node: Array Data Types973620 -Ref: Array Data Types-Footnote-1976277 -Node: Array Functions976369 -Node: Flattening Arrays980223 -Node: Creating Arrays987110 -Node: Extension API Variables991877 -Node: Extension Versioning992513 -Node: Extension API Informational Variables994414 -Node: Extension API Boilerplate995502 -Node: Finding Extensions999318 -Node: Extension Example999878 -Node: Internal File Description1000650 -Node: Internal File Ops1004717 -Ref: Internal File Ops-Footnote-11016375 -Node: Using Internal File Ops1016515 -Ref: Using Internal File Ops-Footnote-11018898 -Node: Extension Samples1019171 -Node: Extension Sample File Functions1020695 -Node: Extension Sample Fnmatch1028297 -Node: Extension Sample Fork1029779 -Node: Extension Sample Inplace1030992 -Node: Extension Sample Ord1032667 -Node: Extension Sample Readdir1033503 -Ref: table-readdir-file-types1034379 -Node: Extension Sample Revout1035190 -Node: Extension Sample Rev2way1035781 -Node: Extension Sample Read write array1036522 -Node: Extension Sample Readfile1038461 -Node: Extension Sample Time1039556 -Node: Extension Sample API Tests1040905 -Node: gawkextlib1041396 -Node: Extension summary1044046 -Node: Extension Exercises1047728 -Node: Language History1048450 -Node: V7/SVR3.11050107 -Node: SVR41052288 -Node: POSIX1053733 -Node: BTL1055122 -Node: POSIX/GNU1055856 -Node: Feature History1061425 -Node: Common Extensions1074523 -Node: Ranges and Locales1075847 -Ref: Ranges and Locales-Footnote-11080486 -Ref: Ranges and Locales-Footnote-21080513 -Ref: Ranges and Locales-Footnote-31080747 -Node: Contributors1080968 -Node: History summary1086508 -Node: Installation1087877 -Node: Gawk Distribution1088833 -Node: Getting1089317 -Node: Extracting1090141 -Node: Distribution contents1091783 -Node: Unix Installation1097500 -Node: Quick Installation1098117 -Node: Additional Configuration Options1100548 -Node: Configuration Philosophy1102288 -Node: Non-Unix Installation1104639 -Node: PC Installation1105097 -Node: PC Binary Installation1106423 -Node: PC Compiling1108271 -Ref: PC Compiling-Footnote-11111292 -Node: PC Testing1111397 -Node: PC Using1112573 -Node: Cygwin1116688 -Node: MSYS1117511 -Node: VMS Installation1118009 -Node: VMS Compilation1118801 -Ref: VMS Compilation-Footnote-11120023 -Node: VMS Dynamic Extensions1120081 -Node: VMS Installation Details1121765 -Node: VMS Running1124017 -Node: VMS GNV1126858 -Node: VMS Old Gawk1127592 -Node: Bugs1128062 -Node: Other Versions1131966 -Node: Installation summary1138179 -Node: Notes1139235 -Node: Compatibility Mode1140100 -Node: Additions1140882 -Node: Accessing The Source1141807 -Node: Adding Code1143243 -Node: New Ports1149415 -Node: Derived Files1153897 -Ref: Derived Files-Footnote-11159372 -Ref: Derived Files-Footnote-21159406 -Ref: Derived Files-Footnote-31160002 -Node: Future Extensions1160116 -Node: Implementation Limitations1160722 -Node: Extension Design1161970 -Node: Old Extension Problems1163124 -Ref: Old Extension Problems-Footnote-11164641 -Node: Extension New Mechanism Goals1164698 -Ref: Extension New Mechanism Goals-Footnote-11168058 -Node: Extension Other Design Decisions1168247 -Node: Extension Future Growth1170355 -Node: Old Extension Mechanism1171191 -Node: Notes summary1172953 -Node: Basic Concepts1174139 -Node: Basic High Level1174820 -Ref: figure-general-flow1175092 -Ref: figure-process-flow1175691 -Ref: Basic High Level-Footnote-11178920 -Node: Basic Data Typing1179105 -Node: Glossary1182433 -Node: Copying1207591 -Node: GNU Free Documentation License1245147 -Node: Index1270283 +Node: Foreword342225 +Node: Foreword446617 +Node: Preface48051 +Ref: Preface-Footnote-150922 +Ref: Preface-Footnote-251029 +Ref: Preface-Footnote-351262 +Node: History51404 +Node: Names53752 +Ref: Names-Footnote-154846 +Node: This Manual54992 +Ref: This Manual-Footnote-160821 +Node: Conventions60921 +Node: Manual History63261 +Ref: Manual History-Footnote-166252 +Ref: Manual History-Footnote-266293 +Node: How To Contribute66367 +Node: Acknowledgments67498 +Node: Getting Started72306 +Node: Running gawk74740 +Node: One-shot75930 +Node: Read Terminal77155 +Node: Long79182 +Node: Executable Scripts80698 +Ref: Executable Scripts-Footnote-183487 +Node: Comments83589 +Node: Quoting86062 +Node: DOS Quoting91568 +Node: Sample Data Files92243 +Node: Very Simple94836 +Node: Two Rules99727 +Node: More Complex101613 +Node: Statements/Lines104475 +Ref: Statements/Lines-Footnote-1108931 +Node: Other Features109196 +Node: When110127 +Ref: When-Footnote-1111883 +Node: Intro Summary111948 +Node: Invoking Gawk112831 +Node: Command Line114346 +Node: Options115137 +Ref: Options-Footnote-1130920 +Node: Other Arguments130945 +Node: Naming Standard Input133906 +Node: Environment Variables134999 +Node: AWKPATH Variable135557 +Ref: AWKPATH Variable-Footnote-1138967 +Ref: AWKPATH Variable-Footnote-2139012 +Node: AWKLIBPATH Variable139272 +Node: Other Environment Variables140528 +Node: Exit Status144019 +Node: Include Files144694 +Node: Loading Shared Libraries148282 +Node: Obsolete149709 +Node: Undocumented150406 +Node: Invoking Summary150673 +Node: Regexp152339 +Node: Regexp Usage153798 +Node: Escape Sequences155831 +Node: Regexp Operators162079 +Ref: Regexp Operators-Footnote-1169513 +Ref: Regexp Operators-Footnote-2169660 +Node: Bracket Expressions169758 +Ref: table-char-classes171775 +Node: Leftmost Longest174715 +Node: Computed Regexps176017 +Node: GNU Regexp Operators179414 +Node: Case-sensitivity183116 +Ref: Case-sensitivity-Footnote-1186006 +Ref: Case-sensitivity-Footnote-2186241 +Node: Regexp Summary186349 +Node: Reading Files187818 +Node: Records189912 +Node: awk split records190644 +Node: gawk split records195558 +Ref: gawk split records-Footnote-1200097 +Node: Fields200134 +Ref: Fields-Footnote-1202932 +Node: Nonconstant Fields203018 +Ref: Nonconstant Fields-Footnote-1205254 +Node: Changing Fields205456 +Node: Field Separators211388 +Node: Default Field Splitting214092 +Node: Regexp Field Splitting215209 +Node: Single Character Fields218559 +Node: Command Line Field Separator219618 +Node: Full Line Fields222830 +Ref: Full Line Fields-Footnote-1223338 +Node: Field Splitting Summary223384 +Ref: Field Splitting Summary-Footnote-1226515 +Node: Constant Size226616 +Node: Splitting By Content231222 +Ref: Splitting By Content-Footnote-1235295 +Node: Multiple Line235335 +Ref: Multiple Line-Footnote-1241224 +Node: Getline241403 +Node: Plain Getline243614 +Node: Getline/Variable246254 +Node: Getline/File247401 +Node: Getline/Variable/File248785 +Ref: Getline/Variable/File-Footnote-1250386 +Node: Getline/Pipe250473 +Node: Getline/Variable/Pipe253156 +Node: Getline/Coprocess254287 +Node: Getline/Variable/Coprocess255539 +Node: Getline Notes256278 +Node: Getline Summary259070 +Ref: table-getline-variants259482 +Node: Read Timeout260311 +Ref: Read Timeout-Footnote-1264125 +Node: Command-line directories264183 +Node: Input Summary265087 +Node: Input Exercises268339 +Node: Printing269067 +Node: Print270844 +Node: Print Examples272301 +Node: Output Separators275080 +Node: OFMT277098 +Node: Printf278452 +Node: Basic Printf279237 +Node: Control Letters280808 +Node: Format Modifiers284792 +Node: Printf Examples290799 +Node: Redirection293281 +Node: Special FD300120 +Ref: Special FD-Footnote-1303277 +Node: Special Files303351 +Node: Other Inherited Files303967 +Node: Special Network304967 +Node: Special Caveats305828 +Node: Close Files And Pipes306779 +Ref: Close Files And Pipes-Footnote-1313958 +Ref: Close Files And Pipes-Footnote-2314106 +Node: Output Summary314256 +Node: Output Exercises315252 +Node: Expressions315932 +Node: Values317117 +Node: Constants317793 +Node: Scalar Constants318473 +Ref: Scalar Constants-Footnote-1319332 +Node: Nondecimal-numbers319582 +Node: Regexp Constants322582 +Node: Using Constant Regexps323107 +Node: Variables326245 +Node: Using Variables326900 +Node: Assignment Options328810 +Node: Conversion330685 +Node: Strings And Numbers331209 +Ref: Strings And Numbers-Footnote-1334273 +Node: Locale influences conversions334382 +Ref: table-locale-affects337127 +Node: All Operators337715 +Node: Arithmetic Ops338345 +Node: Concatenation340850 +Ref: Concatenation-Footnote-1343669 +Node: Assignment Ops343775 +Ref: table-assign-ops348758 +Node: Increment Ops350036 +Node: Truth Values and Conditions353474 +Node: Truth Values354557 +Node: Typing and Comparison355606 +Node: Variable Typing356399 +Node: Comparison Operators360051 +Ref: table-relational-ops360461 +Node: POSIX String Comparison363976 +Ref: POSIX String Comparison-Footnote-1365048 +Node: Boolean Ops365186 +Ref: Boolean Ops-Footnote-1369665 +Node: Conditional Exp369756 +Node: Function Calls371483 +Node: Precedence375363 +Node: Locales379031 +Node: Expressions Summary380662 +Node: Patterns and Actions383236 +Node: Pattern Overview384356 +Node: Regexp Patterns386035 +Node: Expression Patterns386578 +Node: Ranges390358 +Node: BEGIN/END393464 +Node: Using BEGIN/END394226 +Ref: Using BEGIN/END-Footnote-1396963 +Node: I/O And BEGIN/END397069 +Node: BEGINFILE/ENDFILE399383 +Node: Empty402284 +Node: Using Shell Variables402601 +Node: Action Overview404877 +Node: Statements407204 +Node: If Statement409052 +Node: While Statement410550 +Node: Do Statement412578 +Node: For Statement413720 +Node: Switch Statement416875 +Node: Break Statement419263 +Node: Continue Statement421304 +Node: Next Statement423129 +Node: Nextfile Statement425509 +Node: Exit Statement428139 +Node: Built-in Variables430542 +Node: User-modified431675 +Ref: User-modified-Footnote-1439355 +Node: Auto-set439417 +Ref: Auto-set-Footnote-1452784 +Ref: Auto-set-Footnote-2452989 +Node: ARGC and ARGV453045 +Node: Pattern Action Summary457249 +Node: Arrays459676 +Node: Array Basics461005 +Node: Array Intro461849 +Ref: figure-array-elements463813 +Ref: Array Intro-Footnote-1466337 +Node: Reference to Elements466465 +Node: Assigning Elements468915 +Node: Array Example469406 +Node: Scanning an Array471164 +Node: Controlling Scanning474180 +Ref: Controlling Scanning-Footnote-1479369 +Node: Numeric Array Subscripts479685 +Node: Uninitialized Subscripts481870 +Node: Delete483487 +Ref: Delete-Footnote-1486231 +Node: Multidimensional486288 +Node: Multiscanning489383 +Node: Arrays of Arrays490972 +Node: Arrays Summary495733 +Node: Functions497838 +Node: Built-in498711 +Node: Calling Built-in499789 +Node: Numeric Functions501777 +Ref: Numeric Functions-Footnote-1506601 +Ref: Numeric Functions-Footnote-2506958 +Ref: Numeric Functions-Footnote-3507006 +Node: String Functions507275 +Ref: String Functions-Footnote-1530747 +Ref: String Functions-Footnote-2530876 +Ref: String Functions-Footnote-3531124 +Node: Gory Details531211 +Ref: table-sub-escapes532992 +Ref: table-sub-proposed534512 +Ref: table-posix-sub535876 +Ref: table-gensub-escapes537416 +Ref: Gory Details-Footnote-1538248 +Node: I/O Functions538399 +Ref: I/O Functions-Footnote-1545500 +Node: Time Functions545647 +Ref: Time Functions-Footnote-1556116 +Ref: Time Functions-Footnote-2556184 +Ref: Time Functions-Footnote-3556342 +Ref: Time Functions-Footnote-4556453 +Ref: Time Functions-Footnote-5556565 +Ref: Time Functions-Footnote-6556792 +Node: Bitwise Functions557058 +Ref: table-bitwise-ops557620 +Ref: Bitwise Functions-Footnote-1561928 +Node: Type Functions562097 +Node: I18N Functions563246 +Node: User-defined564891 +Node: Definition Syntax565695 +Ref: Definition Syntax-Footnote-1571101 +Node: Function Example571170 +Ref: Function Example-Footnote-1574087 +Node: Function Caveats574109 +Node: Calling A Function574627 +Node: Variable Scope575582 +Node: Pass By Value/Reference578570 +Node: Return Statement582080 +Node: Dynamic Typing585064 +Node: Indirect Calls585993 +Ref: Indirect Calls-Footnote-1597297 +Node: Functions Summary597425 +Node: Library Functions600124 +Ref: Library Functions-Footnote-1603742 +Ref: Library Functions-Footnote-2603885 +Node: Library Names604056 +Ref: Library Names-Footnote-1607516 +Ref: Library Names-Footnote-2607736 +Node: General Functions607822 +Node: Strtonum Function608925 +Node: Assert Function611945 +Node: Round Function615269 +Node: Cliff Random Function616810 +Node: Ordinal Functions617826 +Ref: Ordinal Functions-Footnote-1620891 +Ref: Ordinal Functions-Footnote-2621143 +Node: Join Function621354 +Ref: Join Function-Footnote-1623125 +Node: Getlocaltime Function623325 +Node: Readfile Function627066 +Node: Shell Quoting629036 +Node: Data File Management630437 +Node: Filetrans Function631069 +Node: Rewind Function635128 +Node: File Checking636513 +Ref: File Checking-Footnote-1637841 +Node: Empty Files638042 +Node: Ignoring Assigns640021 +Node: Getopt Function641572 +Ref: Getopt Function-Footnote-1653032 +Node: Passwd Functions653235 +Ref: Passwd Functions-Footnote-1662086 +Node: Group Functions662174 +Ref: Group Functions-Footnote-1670077 +Node: Walking Arrays670290 +Node: Library Functions Summary671893 +Node: Library Exercises673294 +Node: Sample Programs674574 +Node: Running Examples675344 +Node: Clones676072 +Node: Cut Program677296 +Node: Egrep Program687026 +Ref: Egrep Program-Footnote-1694530 +Node: Id Program694640 +Node: Split Program698284 +Ref: Split Program-Footnote-1701730 +Node: Tee Program701858 +Node: Uniq Program704645 +Node: Wc Program712066 +Ref: Wc Program-Footnote-1716314 +Node: Miscellaneous Programs716406 +Node: Dupword Program717619 +Node: Alarm Program719650 +Node: Translate Program724454 +Ref: Translate Program-Footnote-1729018 +Node: Labels Program729288 +Ref: Labels Program-Footnote-1732637 +Node: Word Sorting732721 +Node: History Sorting736791 +Node: Extract Program738627 +Node: Simple Sed746159 +Node: Igawk Program749221 +Ref: Igawk Program-Footnote-1763547 +Ref: Igawk Program-Footnote-2763748 +Ref: Igawk Program-Footnote-3763870 +Node: Anagram Program763985 +Node: Signature Program767047 +Node: Programs Summary768294 +Node: Programs Exercises769487 +Ref: Programs Exercises-Footnote-1773618 +Node: Advanced Features773709 +Node: Nondecimal Data775657 +Node: Array Sorting777247 +Node: Controlling Array Traversal777944 +Ref: Controlling Array Traversal-Footnote-1786275 +Node: Array Sorting Functions786393 +Ref: Array Sorting Functions-Footnote-1790285 +Node: Two-way I/O790479 +Ref: Two-way I/O-Footnote-1795423 +Ref: Two-way I/O-Footnote-2795609 +Node: TCP/IP Networking795691 +Node: Profiling798563 +Node: Advanced Features Summary806837 +Node: Internationalization808770 +Node: I18N and L10N810250 +Node: Explaining gettext810936 +Ref: Explaining gettext-Footnote-1815965 +Ref: Explaining gettext-Footnote-2816149 +Node: Programmer i18n816314 +Ref: Programmer i18n-Footnote-1821180 +Node: Translator i18n821229 +Node: String Extraction822023 +Ref: String Extraction-Footnote-1823154 +Node: Printf Ordering823240 +Ref: Printf Ordering-Footnote-1826026 +Node: I18N Portability826090 +Ref: I18N Portability-Footnote-1828539 +Node: I18N Example828602 +Ref: I18N Example-Footnote-1831402 +Node: Gawk I18N831474 +Node: I18N Summary832112 +Node: Debugger833451 +Node: Debugging834473 +Node: Debugging Concepts834914 +Node: Debugging Terms836771 +Node: Awk Debugging839346 +Node: Sample Debugging Session840238 +Node: Debugger Invocation840758 +Node: Finding The Bug842142 +Node: List of Debugger Commands848617 +Node: Breakpoint Control849949 +Node: Debugger Execution Control853641 +Node: Viewing And Changing Data857005 +Node: Execution Stack860370 +Node: Debugger Info862008 +Node: Miscellaneous Debugger Commands866025 +Node: Readline Support871217 +Node: Limitations872109 +Node: Debugging Summary874206 +Node: Arbitrary Precision Arithmetic875374 +Node: Computer Arithmetic876790 +Ref: table-numeric-ranges880391 +Ref: Computer Arithmetic-Footnote-1881250 +Node: Math Definitions881307 +Ref: table-ieee-formats884594 +Ref: Math Definitions-Footnote-1885198 +Node: MPFR features885303 +Node: FP Math Caution886974 +Ref: FP Math Caution-Footnote-1888024 +Node: Inexactness of computations888393 +Node: Inexact representation889341 +Node: Comparing FP Values890696 +Node: Errors accumulate891769 +Node: Getting Accuracy893202 +Node: Try To Round895861 +Node: Setting precision896760 +Ref: table-predefined-precision-strings897444 +Node: Setting the rounding mode899238 +Ref: table-gawk-rounding-modes899602 +Ref: Setting the rounding mode-Footnote-1903056 +Node: Arbitrary Precision Integers903235 +Ref: Arbitrary Precision Integers-Footnote-1908139 +Node: POSIX Floating Point Problems908288 +Ref: POSIX Floating Point Problems-Footnote-1912164 +Node: Floating point summary912202 +Node: Dynamic Extensions914394 +Node: Extension Intro915946 +Node: Plugin License917212 +Node: Extension Mechanism Outline918009 +Ref: figure-load-extension918437 +Ref: figure-register-new-function919917 +Ref: figure-call-new-function920921 +Node: Extension API Description922907 +Node: Extension API Functions Introduction924357 +Node: General Data Types929193 +Ref: General Data Types-Footnote-1934880 +Node: Memory Allocation Functions935179 +Ref: Memory Allocation Functions-Footnote-1938009 +Node: Constructor Functions938105 +Node: Registration Functions939839 +Node: Extension Functions940524 +Node: Exit Callback Functions942820 +Node: Extension Version String944068 +Node: Input Parsers944718 +Node: Output Wrappers954533 +Node: Two-way processors959049 +Node: Printing Messages961253 +Ref: Printing Messages-Footnote-1962330 +Node: Updating `ERRNO'962482 +Node: Requesting Values963222 +Ref: table-value-types-returned963950 +Node: Accessing Parameters964908 +Node: Symbol Table Access966139 +Node: Symbol table by name966653 +Node: Symbol table by cookie968633 +Ref: Symbol table by cookie-Footnote-1972772 +Node: Cached values972835 +Ref: Cached values-Footnote-1976339 +Node: Array Manipulation976430 +Ref: Array Manipulation-Footnote-1977528 +Node: Array Data Types977567 +Ref: Array Data Types-Footnote-1980224 +Node: Array Functions980316 +Node: Flattening Arrays984170 +Node: Creating Arrays991057 +Node: Extension API Variables995824 +Node: Extension Versioning996460 +Node: Extension API Informational Variables998361 +Node: Extension API Boilerplate999449 +Node: Finding Extensions1003265 +Node: Extension Example1003825 +Node: Internal File Description1004597 +Node: Internal File Ops1008664 +Ref: Internal File Ops-Footnote-11020322 +Node: Using Internal File Ops1020462 +Ref: Using Internal File Ops-Footnote-11022845 +Node: Extension Samples1023118 +Node: Extension Sample File Functions1024642 +Node: Extension Sample Fnmatch1032244 +Node: Extension Sample Fork1033726 +Node: Extension Sample Inplace1034939 +Node: Extension Sample Ord1036614 +Node: Extension Sample Readdir1037450 +Ref: table-readdir-file-types1038326 +Node: Extension Sample Revout1039137 +Node: Extension Sample Rev2way1039728 +Node: Extension Sample Read write array1040469 +Node: Extension Sample Readfile1042408 +Node: Extension Sample Time1043503 +Node: Extension Sample API Tests1044852 +Node: gawkextlib1045343 +Node: Extension summary1047993 +Node: Extension Exercises1051675 +Node: Language History1052397 +Node: V7/SVR3.11054054 +Node: SVR41056235 +Node: POSIX1057680 +Node: BTL1059069 +Node: POSIX/GNU1059803 +Node: Feature History1065432 +Node: Common Extensions1078530 +Node: Ranges and Locales1079854 +Ref: Ranges and Locales-Footnote-11084493 +Ref: Ranges and Locales-Footnote-21084520 +Ref: Ranges and Locales-Footnote-31084754 +Node: Contributors1084975 +Node: History summary1090515 +Node: Installation1091884 +Node: Gawk Distribution1092840 +Node: Getting1093324 +Node: Extracting1094148 +Node: Distribution contents1095790 +Node: Unix Installation1101855 +Node: Quick Installation1102538 +Node: Shell Startup Files1104956 +Node: Additional Configuration Options1106035 +Node: Configuration Philosophy1107776 +Node: Non-Unix Installation1110127 +Node: PC Installation1110585 +Node: PC Binary Installation1111911 +Node: PC Compiling1113759 +Ref: PC Compiling-Footnote-11116780 +Node: PC Testing1116885 +Node: PC Using1118061 +Node: Cygwin1122176 +Node: MSYS1122999 +Node: VMS Installation1123497 +Node: VMS Compilation1124289 +Ref: VMS Compilation-Footnote-11125511 +Node: VMS Dynamic Extensions1125569 +Node: VMS Installation Details1127253 +Node: VMS Running1129505 +Node: VMS GNV1132346 +Node: VMS Old Gawk1133080 +Node: Bugs1133550 +Node: Other Versions1137454 +Node: Installation summary1143667 +Node: Notes1144723 +Node: Compatibility Mode1145588 +Node: Additions1146370 +Node: Accessing The Source1147295 +Node: Adding Code1148731 +Node: New Ports1154903 +Node: Derived Files1159385 +Ref: Derived Files-Footnote-11164860 +Ref: Derived Files-Footnote-21164894 +Ref: Derived Files-Footnote-31165490 +Node: Future Extensions1165604 +Node: Implementation Limitations1166210 +Node: Extension Design1167458 +Node: Old Extension Problems1168612 +Ref: Old Extension Problems-Footnote-11170129 +Node: Extension New Mechanism Goals1170186 +Ref: Extension New Mechanism Goals-Footnote-11173546 +Node: Extension Other Design Decisions1173735 +Node: Extension Future Growth1175843 +Node: Old Extension Mechanism1176679 +Node: Notes summary1178441 +Node: Basic Concepts1179627 +Node: Basic High Level1180308 +Ref: figure-general-flow1180580 +Ref: figure-process-flow1181179 +Ref: Basic High Level-Footnote-11184408 +Node: Basic Data Typing1184593 +Node: Glossary1187921 +Node: Copying1213079 +Node: GNU Free Documentation License1250635 +Node: Index1275771 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 52fd2003..e97b88b6 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -989,6 +989,7 @@ particular records in a file and perform operations upon them. * Unix Installation:: Installing @command{gawk} under various versions of Unix. * Quick Installation:: Compiling @command{gawk} under Unix. +* Shell Startup Files:: Shell convenience functions. * Additional Configuration Options:: Other compile-time options. * Configuration Philosophy:: How it's all supposed to work. * Non-Unix Installation:: Installation on Other Operating @@ -3998,10 +3999,8 @@ No space is allowed between the @option{-o} and @var{file}, if @var{file} is supplied. @quotation NOTE -Due to the way @command{gawk} has evolved, with this option -your program is still executed. This will change in the -next major release such that @command{gawk} will only -pretty-print the program and not run it. +In the past, this option would also execute your program. +This is no longer the case. @end quotation @item @option{-O} @@ -4404,6 +4403,9 @@ searches first in the current directory and then in @file{/usr/local/share/awk}. In practice, this means that you will rarely need to change the value of @env{AWKPATH}. +@xref{Shell Startup Files}, for information on functions that help to +manipulate the @env{AWKPATH} variable. + @command{gawk} places the value of the search path that it used into @code{ENVIRON["AWKPATH"]}. This provides access to the actual search path value from within an @command{awk} program. @@ -4435,6 +4437,9 @@ an empty value, @command{gawk} uses a default path; this is typically @samp{/usr/local/lib/gawk}, although it can vary depending upon how @command{gawk} was built. +@xref{Shell Startup Files}, for information on functions that help to +manipulate the @env{AWKLIBPATH} variable. + @command{gawk} places the value of the search path that it used into @code{ENVIRON["AWKLIBPATH"]}. This provides access to the actual search path value from within an @command{awk} program. @@ -4511,14 +4516,6 @@ two regexp matchers that @command{gawk} uses internally. (There aren't supposed to be differences, but occasionally theory and practice don't coordinate with each other.) -@item GAWK_NO_PP_RUN -If this variable exists, then when invoked with the @option{--pretty-print} -option, @command{gawk} skips running the program. - -@quotation CAUTION -This variable will not survive into the next major release. -@end quotation - @item GAWK_STACKSIZE This specifies the amount by which @command{gawk} should grow its internal evaluation stack, when needed. @@ -5099,17 +5096,22 @@ between @samp{0} and @samp{7}. For example, the code for the ASCII ESC @item \x@var{hh}@dots{} The hexadecimal value @var{hh}, where @var{hh} stands for a sequence of hexadecimal digits (@samp{0}--@samp{9}, and either @samp{A}--@samp{F} -or @samp{a}--@samp{f}). Like the same construct -in ISO C, the escape sequence continues until the first nonhexadecimal -digit is seen. @value{COMMONEXT} -However, using more than two hexadecimal digits produces -undefined results. (The @samp{\x} escape sequence is not allowed in -POSIX @command{awk}.) +or @samp{a}--@samp{f}). A maximum of two digts are allowed after +the @samp{\x}. Any further hexadecimal digits are treated as simple +letters or numbers. @value{COMMONEXT} +(The @samp{\x} escape sequence is not allowed in POSIX awk.) @quotation CAUTION -The next major relase of @command{gawk} will change, such -that a maximum of two hexadecimal digits following the -@samp{\x} will be used. +In ISO C, the escape sequence continues until the first nonhexadecimal +digit is seen. +@c FIXME: Add exact version here. +For many years, @command{gawk} would continue incorporating +hexadecimal digits into the value until a non-hexadecimal digit +or the end of the string was encountered. +However, using more than two hexadecimal digits produced +undefined results. +As of @value{PVERSION} @strong{FIXME:} 4.3.0, only two digits +are processed. @end quotation @cindex @code{\} (backslash), @code{\/} escape sequence @@ -14799,10 +14801,18 @@ opens the next file. An associative array containing the values of the environment. The array indices are the environment variable names; the elements are the values of the particular environment variables. For example, -@code{ENVIRON["HOME"]} might be @code{"/home/arnold"}. Changing this array -does not affect the environment passed on to any programs that -@command{awk} may spawn via redirection or the @code{system()} function. -(In a future version of @command{gawk}, it may do so.) +@code{ENVIRON["HOME"]} might be @code{/home/arnold}. + +For POSIX @command{awk}, changing this array does not affect the +environment passed on to any programs that @command{awk} may spawn via +redirection or the @code{system()} function. + +However, beginning with version 4.2, if not in POSIX +compatibility mode, @command{gawk} does update its own environment when +@code{ENVIRON} is changed, thus changing the environment seen by programs +that it creates. You should therefore be especially careful if you +modify @code{ENVIRON["PATH"]"}, which is the search path for finding +executable programs. Some operating systems may not have environment variables. On such systems, the @code{ENVIRON} array is empty (except for @@ -16913,6 +16923,23 @@ You can use @samp{pi = atan2(0, -1)} to retrieve the value of @cindex cosine Return the cosine of @var{x}, with @var{x} in radians. +@item @code{div(@var{numerator}, @var{denominator}, @var{result})} +@cindexawkfunc{div} +@cindex div +Perform integer division, similar to the standard C function of the +same name. First, truncate @code{numerator} and @code{denominator} +towards zero, creating integer values. Clear the @code{result} +array, and then set @code{result["quotient"]} to the result of +@samp{numerator / denominator}, truncated towards zero to an integer, +and set @code{result["remainder"]} to the result of @samp{numerator % +denominator}, truncated towards zero to an integer. This function is +primarily intended for use with arbitrary length integers; it avoids +creating MPFR arbitrary precision floating-point values (@pxref{Arbitrary +Precision Integers}). + +This function is a @code{gawk} extension. It is not available in +compatibility mode (@pxref{Options}). + @item @code{exp(@var{x})} @cindexawkfunc{exp} @cindex exponent @@ -27867,8 +27894,7 @@ The profiled version of your program may not look exactly like what you 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. +a standard representation. Also, things such as: @example @@ -27962,9 +27988,26 @@ 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. +Once upon a time, the @option{--pretty-print} option would also run +your program. This is is no longer the case. @end quotation + +There is a significant difference between the output created when +profiling, and that created when pretty-printing. Pretty-printed output +preserves the original comments that were in the program, although their +placement may not correspond exactly to their original locations in the +source code. + +However, as a deliberate design decision, profiling output @emph{omits} +the original program's comments. This allows you to focus on the +execution count data and helps you avoid the temptation to use the +profiler for pretty-printing. + +Additionally, pretty-printed output does not have the leading indentation +that the profiling output does. This makes it easy to pretty-print your +code once development is completed, and then use the result as the final +version of your program. + @c ENDOFRANGE awkp @c ENDOFRANGE proawk @@ -31028,6 +31071,119 @@ to just use the following: gawk -M 'BEGIN @{ n = 13; print n % 2 @}' @end example +When dividing two arbitrary precision integers with either +@samp{/} or @samp{%}, the result is typically an arbitrary +precision floating point value (unless the denominator evenly +divides into the numerator). In order to do integer division +or remainder with arbitrary precision integers, use the built-in +@code{div()} function (@pxref{Numeric Functions}). + +You can simulate the @code{div()} function in standard @command{awk} +using this user-defined function: + +@example +@c file eg/lib/div.awk +# div --- do integer division + +@c endfile +@ignore +@c file eg/lib/div.awk +# +# Arnold Robbins, arnold@@skeeve.com, Public Domain +# July, 2014 + +@c endfile + +@end ignore +@c file eg/lib/div.awk +function div(numerator, denominator, result) +@{ + split("", result) + + numerator = int(numerator) + denominator = int(denominator) + result["quotient"] = int(numerator / denominator) + result["remainder"] = int(numerator % denominator) + + return 0.0 +@} +@c endfile +@end example + +The following example program, contributed by Katie Wasserman, +uses @code{div()} to +compute the digits of @value{PI} to as many places as you +choose to set: + +@example +@c file eg/prog/pi.awk +# pi.awk --- compute the digits of pi +@c endfile +@c endfile +@ignore +@c file eg/prog/pi.awk +# +# Katie Wasserman, katie@@wass.net +# August 2014 +@c endfile +@end ignore +@c file eg/prog/pi.awk + +BEGIN @{ + digits = 100000 + two = 2 * 10 ^ digits + pi = two + for (m = digits * 4; m > 0; --m) @{ + d = m * 2 + 1 + x = pi * m + div(x, d, result) + pi = result["quotient"] + pi = pi + two + @} + print pi +@} +@c endfile +@end example + +@ignore +Date: Wed, 20 Aug 2014 10:19:11 -0400 +To: arnold@skeeve.com +From: Katherine Wasserman <katie@wass.net> +Subject: Re: computation of digits of pi? + +Arnold, + +>The program that you sent to compute the digits of pi using div(). Is +>that some standard algorithm that every math student knows? If so, +>what's it called? + +It's not that well known but it's not that obscure either + +It's Euler's modification to Newton's method for calculating pi. + +Take a look at lines (23) - (25) here: http://mathworld.wolfram.com/PiFormulas.htm + +The algorithm I wrote simply expands the multiply by 2 and works from the innermost expression outwards. I used this to program HP calculators because it's quite easy to modify for tiny memory devices with smallish word sizes. + +http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=899 + +-Katie +@end ignore + +When asked about the algorithm used, Katie replied: + +@quotation +It's not that well known but it's not that obscure either. +It's Euler's modification to Newton's method for calculating pi. +Take a look at lines (23) - (25) here: @uref{http://mathworld.wolfram.com/PiFormulas.htm}. + +The algorithm I wrote simply expands the multiply by 2 and works from +the innermost expression outwards. I used this to program HP calculators +because it's quite easy to modify for tiny memory devices with smallish +word sizes. See +@uref{http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=899}. +@end quotation + @node POSIX Floating Point Problems @section Standards Versus Existing Practice @@ -35854,6 +36010,10 @@ for @command{gawk} @value{PVERSION} 4.1: Ultrix @end itemize +@item +@c FIXME: Verify the version here. +Support for MirBSD was removed at @command{gawk} @value{PVERSION} 4.2. + @end itemize @c XXX ADD MORE STUFF HERE @@ -37137,6 +37297,8 @@ The generated Info file for The @command{troff} source for a manual page describing the @command{igawk} program presented in @ref{Igawk Program}. +(Since @command{gawk} can do its own @code{@@include} processing, +neither @command{igawk} nor @file{igawk.1} are installed.) @item doc/Makefile.in The input file used during the configuration process to generate the @@ -37181,8 +37343,6 @@ source file for this @value{DOCUMENT}. It also contains a @file{Makefile.in} fil @file{Makefile.am} is used by GNU Automake to create @file{Makefile.in}. The library functions from @ref{Library Functions}, -and the @command{igawk} program from -@ref{Igawk Program}, are included as ready-to-use files in the @command{gawk} distribution. They are installed as part of the installation process. The rest of the programs in this @value{DOCUMENT} are available in appropriate @@ -37193,6 +37353,12 @@ The source code, manual pages, and infrastructure files for the sample extensions included with @command{gawk}. @xref{Dynamic Extensions}, for more information. +@item extras/* +Additional non-essential files. Currently, this directory contains some shell +startup files to be installed in @file{/etc/profile.d} to aid in manipulating +the @env{AWKPATH} and @env{AWKLIBPATH} environment variables. +@xref{Shell Startup Files}, for more information. + @item posix/* Files needed for building @command{gawk} on POSIX-compliant systems. @@ -37225,6 +37391,7 @@ to configure @command{gawk} for your system yourself. @menu * Quick Installation:: Compiling @command{gawk} under Unix. +* Shell Startup Files:: Shell convenience functions. * Additional Configuration Options:: Other compile-time options. * Configuration Philosophy:: How it's all supposed to work. @end menu @@ -37305,6 +37472,44 @@ is likely that you will be asked for your password, and you will have to have been set up previously as a user who is allowed to run the @command{sudo} command. +@node Shell Startup Files +@appendixsubsec Shell Startup Files + +The distribution contains shell startup files @file{gawk.sh} and +@file{gawk.csh} containing functions to aid in manipulating +the @env{AWKPATH} and @env{AWKLIBPATH} environment variables. +On a Fedora system, these files should be installed in @file{/etc/profile.d}; +on other platforms, the appropriate location may be different. + +@table @command + +@cindex @command{gawkpath_default} shell function +@item gawkpath_default +Reset the @env{AWKPATH} environment variable to its default value. + +@cindex @command{gawkpath_prepend} shell function +@item gawkpath_prepend +Add the argument to the front of the @env{AWKPATH} environment variable. + +@cindex @command{gawkpath_append} shell function +@item gawkpath_append +Add the argument to the end of the @env{AWKPATH} environment variable. + +@cindex @command{gawklibpath_default} shell function +@item gawklibpath_default +Reset the @env{AWKLIBPATH} environment variable to its default value. + +@cindex @command{gawklibpath_prepend} shell function +@item gawklibpath_prepend +Add the argument to the front of the @env{AWKLIBPATH} environment variable. + +@cindex @command{gawklibpath_append} shell function +@item gawklibpath_append +Add the argument to the end of the @env{AWKLIBPATH} environment variable. + +@end table + + @node Additional Configuration Options @appendixsubsec Additional Configuration Options @cindex @command{gawk}, configuring, options @@ -38260,7 +38465,8 @@ The people maintaining the various @command{gawk} ports are: @end multitable If your bug is also reproducible under Unix, please send a copy of your -report to the @EMAIL{bug-gawk@@gnu.org,bug-gawk at gnu dot org} email list as well. +report to the @EMAIL{bug-gawk@@gnu.org,bug-gawk at gnu dot org} email +list as well. @c ENDOFRANGE dbugg @c ENDOFRANGE tblgawb diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 6a66f8c4..c06bca82 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -984,6 +984,7 @@ particular records in a file and perform operations upon them. * Unix Installation:: Installing @command{gawk} under various versions of Unix. * Quick Installation:: Compiling @command{gawk} under Unix. +* Shell Startup Files:: Shell convenience functions. * Additional Configuration Options:: Other compile-time options. * Configuration Philosophy:: How it's all supposed to work. * Non-Unix Installation:: Installation on Other Operating @@ -3909,10 +3910,8 @@ No space is allowed between the @option{-o} and @var{file}, if @var{file} is supplied. @quotation NOTE -Due to the way @command{gawk} has evolved, with this option -your program is still executed. This will change in the -next major release such that @command{gawk} will only -pretty-print the program and not run it. +In the past, this option would also execute your program. +This is no longer the case. @end quotation @item @option{-O} @@ -4315,6 +4314,9 @@ searches first in the current directory and then in @file{/usr/local/share/awk}. In practice, this means that you will rarely need to change the value of @env{AWKPATH}. +@xref{Shell Startup Files}, for information on functions that help to +manipulate the @env{AWKPATH} variable. + @command{gawk} places the value of the search path that it used into @code{ENVIRON["AWKPATH"]}. This provides access to the actual search path value from within an @command{awk} program. @@ -4346,6 +4348,9 @@ an empty value, @command{gawk} uses a default path; this is typically @samp{/usr/local/lib/gawk}, although it can vary depending upon how @command{gawk} was built. +@xref{Shell Startup Files}, for information on functions that help to +manipulate the @env{AWKLIBPATH} variable. + @command{gawk} places the value of the search path that it used into @code{ENVIRON["AWKLIBPATH"]}. This provides access to the actual search path value from within an @command{awk} program. @@ -4422,14 +4427,6 @@ two regexp matchers that @command{gawk} uses internally. (There aren't supposed to be differences, but occasionally theory and practice don't coordinate with each other.) -@item GAWK_NO_PP_RUN -If this variable exists, then when invoked with the @option{--pretty-print} -option, @command{gawk} skips running the program. - -@quotation CAUTION -This variable will not survive into the next major release. -@end quotation - @item GAWK_STACKSIZE This specifies the amount by which @command{gawk} should grow its internal evaluation stack, when needed. @@ -5010,17 +5007,22 @@ between @samp{0} and @samp{7}. For example, the code for the ASCII ESC @item \x@var{hh}@dots{} The hexadecimal value @var{hh}, where @var{hh} stands for a sequence of hexadecimal digits (@samp{0}--@samp{9}, and either @samp{A}--@samp{F} -or @samp{a}--@samp{f}). Like the same construct -in ISO C, the escape sequence continues until the first nonhexadecimal -digit is seen. @value{COMMONEXT} -However, using more than two hexadecimal digits produces -undefined results. (The @samp{\x} escape sequence is not allowed in -POSIX @command{awk}.) +or @samp{a}--@samp{f}). A maximum of two digts are allowed after +the @samp{\x}. Any further hexadecimal digits are treated as simple +letters or numbers. @value{COMMONEXT} +(The @samp{\x} escape sequence is not allowed in POSIX awk.) @quotation CAUTION -The next major relase of @command{gawk} will change, such -that a maximum of two hexadecimal digits following the -@samp{\x} will be used. +In ISO C, the escape sequence continues until the first nonhexadecimal +digit is seen. +@c FIXME: Add exact version here. +For many years, @command{gawk} would continue incorporating +hexadecimal digits into the value until a non-hexadecimal digit +or the end of the string was encountered. +However, using more than two hexadecimal digits produced +undefined results. +As of @value{PVERSION} @strong{FIXME:} 4.3.0, only two digits +are processed. @end quotation @cindex @code{\} (backslash), @code{\/} escape sequence @@ -14129,10 +14131,18 @@ opens the next file. An associative array containing the values of the environment. The array indices are the environment variable names; the elements are the values of the particular environment variables. For example, -@code{ENVIRON["HOME"]} might be @code{"/home/arnold"}. Changing this array -does not affect the environment passed on to any programs that -@command{awk} may spawn via redirection or the @code{system()} function. -(In a future version of @command{gawk}, it may do so.) +@code{ENVIRON["HOME"]} might be @code{/home/arnold}. + +For POSIX @command{awk}, changing this array does not affect the +environment passed on to any programs that @command{awk} may spawn via +redirection or the @code{system()} function. + +However, beginning with version 4.2, if not in POSIX +compatibility mode, @command{gawk} does update its own environment when +@code{ENVIRON} is changed, thus changing the environment seen by programs +that it creates. You should therefore be especially careful if you +modify @code{ENVIRON["PATH"]"}, which is the search path for finding +executable programs. Some operating systems may not have environment variables. On such systems, the @code{ENVIRON} array is empty (except for @@ -16197,6 +16207,23 @@ You can use @samp{pi = atan2(0, -1)} to retrieve the value of @cindex cosine Return the cosine of @var{x}, with @var{x} in radians. +@item @code{div(@var{numerator}, @var{denominator}, @var{result})} +@cindexawkfunc{div} +@cindex div +Perform integer division, similar to the standard C function of the +same name. First, truncate @code{numerator} and @code{denominator} +towards zero, creating integer values. Clear the @code{result} +array, and then set @code{result["quotient"]} to the result of +@samp{numerator / denominator}, truncated towards zero to an integer, +and set @code{result["remainder"]} to the result of @samp{numerator % +denominator}, truncated towards zero to an integer. This function is +primarily intended for use with arbitrary length integers; it avoids +creating MPFR arbitrary precision floating-point values (@pxref{Arbitrary +Precision Integers}). + +This function is a @code{gawk} extension. It is not available in +compatibility mode (@pxref{Options}). + @item @code{exp(@var{x})} @cindexawkfunc{exp} @cindex exponent @@ -26961,8 +26988,7 @@ The profiled version of your program may not look exactly like what you 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. +a standard representation. Also, things such as: @example @@ -27056,9 +27082,26 @@ 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. +Once upon a time, the @option{--pretty-print} option would also run +your program. This is is no longer the case. @end quotation + +There is a significant difference between the output created when +profiling, and that created when pretty-printing. Pretty-printed output +preserves the original comments that were in the program, although their +placement may not correspond exactly to their original locations in the +source code. + +However, as a deliberate design decision, profiling output @emph{omits} +the original program's comments. This allows you to focus on the +execution count data and helps you avoid the temptation to use the +profiler for pretty-printing. + +Additionally, pretty-printed output does not have the leading indentation +that the profiling output does. This makes it easy to pretty-print your +code once development is completed, and then use the result as the final +version of your program. + @c ENDOFRANGE awkp @c ENDOFRANGE proawk @@ -30122,6 +30165,119 @@ to just use the following: gawk -M 'BEGIN @{ n = 13; print n % 2 @}' @end example +When dividing two arbitrary precision integers with either +@samp{/} or @samp{%}, the result is typically an arbitrary +precision floating point value (unless the denominator evenly +divides into the numerator). In order to do integer division +or remainder with arbitrary precision integers, use the built-in +@code{div()} function (@pxref{Numeric Functions}). + +You can simulate the @code{div()} function in standard @command{awk} +using this user-defined function: + +@example +@c file eg/lib/div.awk +# div --- do integer division + +@c endfile +@ignore +@c file eg/lib/div.awk +# +# Arnold Robbins, arnold@@skeeve.com, Public Domain +# July, 2014 + +@c endfile + +@end ignore +@c file eg/lib/div.awk +function div(numerator, denominator, result) +@{ + split("", result) + + numerator = int(numerator) + denominator = int(denominator) + result["quotient"] = int(numerator / denominator) + result["remainder"] = int(numerator % denominator) + + return 0.0 +@} +@c endfile +@end example + +The following example program, contributed by Katie Wasserman, +uses @code{div()} to +compute the digits of @value{PI} to as many places as you +choose to set: + +@example +@c file eg/prog/pi.awk +# pi.awk --- compute the digits of pi +@c endfile +@c endfile +@ignore +@c file eg/prog/pi.awk +# +# Katie Wasserman, katie@@wass.net +# August 2014 +@c endfile +@end ignore +@c file eg/prog/pi.awk + +BEGIN @{ + digits = 100000 + two = 2 * 10 ^ digits + pi = two + for (m = digits * 4; m > 0; --m) @{ + d = m * 2 + 1 + x = pi * m + div(x, d, result) + pi = result["quotient"] + pi = pi + two + @} + print pi +@} +@c endfile +@end example + +@ignore +Date: Wed, 20 Aug 2014 10:19:11 -0400 +To: arnold@skeeve.com +From: Katherine Wasserman <katie@wass.net> +Subject: Re: computation of digits of pi? + +Arnold, + +>The program that you sent to compute the digits of pi using div(). Is +>that some standard algorithm that every math student knows? If so, +>what's it called? + +It's not that well known but it's not that obscure either + +It's Euler's modification to Newton's method for calculating pi. + +Take a look at lines (23) - (25) here: http://mathworld.wolfram.com/PiFormulas.htm + +The algorithm I wrote simply expands the multiply by 2 and works from the innermost expression outwards. I used this to program HP calculators because it's quite easy to modify for tiny memory devices with smallish word sizes. + +http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=899 + +-Katie +@end ignore + +When asked about the algorithm used, Katie replied: + +@quotation +It's not that well known but it's not that obscure either. +It's Euler's modification to Newton's method for calculating pi. +Take a look at lines (23) - (25) here: @uref{http://mathworld.wolfram.com/PiFormulas.htm}. + +The algorithm I wrote simply expands the multiply by 2 and works from +the innermost expression outwards. I used this to program HP calculators +because it's quite easy to modify for tiny memory devices with smallish +word sizes. See +@uref{http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=899}. +@end quotation + @node POSIX Floating Point Problems @section Standards Versus Existing Practice @@ -34948,6 +35104,10 @@ for @command{gawk} @value{PVERSION} 4.1: Ultrix @end itemize +@item +@c FIXME: Verify the version here. +Support for MirBSD was removed at @command{gawk} @value{PVERSION} 4.2. + @end itemize @c XXX ADD MORE STUFF HERE @@ -36231,6 +36391,8 @@ The generated Info file for The @command{troff} source for a manual page describing the @command{igawk} program presented in @ref{Igawk Program}. +(Since @command{gawk} can do its own @code{@@include} processing, +neither @command{igawk} nor @file{igawk.1} are installed.) @item doc/Makefile.in The input file used during the configuration process to generate the @@ -36275,8 +36437,6 @@ source file for this @value{DOCUMENT}. It also contains a @file{Makefile.in} fil @file{Makefile.am} is used by GNU Automake to create @file{Makefile.in}. The library functions from @ref{Library Functions}, -and the @command{igawk} program from -@ref{Igawk Program}, are included as ready-to-use files in the @command{gawk} distribution. They are installed as part of the installation process. The rest of the programs in this @value{DOCUMENT} are available in appropriate @@ -36287,6 +36447,12 @@ The source code, manual pages, and infrastructure files for the sample extensions included with @command{gawk}. @xref{Dynamic Extensions}, for more information. +@item extras/* +Additional non-essential files. Currently, this directory contains some shell +startup files to be installed in @file{/etc/profile.d} to aid in manipulating +the @env{AWKPATH} and @env{AWKLIBPATH} environment variables. +@xref{Shell Startup Files}, for more information. + @item posix/* Files needed for building @command{gawk} on POSIX-compliant systems. @@ -36319,6 +36485,7 @@ to configure @command{gawk} for your system yourself. @menu * Quick Installation:: Compiling @command{gawk} under Unix. +* Shell Startup Files:: Shell convenience functions. * Additional Configuration Options:: Other compile-time options. * Configuration Philosophy:: How it's all supposed to work. @end menu @@ -36399,6 +36566,44 @@ is likely that you will be asked for your password, and you will have to have been set up previously as a user who is allowed to run the @command{sudo} command. +@node Shell Startup Files +@appendixsubsec Shell Startup Files + +The distribution contains shell startup files @file{gawk.sh} and +@file{gawk.csh} containing functions to aid in manipulating +the @env{AWKPATH} and @env{AWKLIBPATH} environment variables. +On a Fedora system, these files should be installed in @file{/etc/profile.d}; +on other platforms, the appropriate location may be different. + +@table @command + +@cindex @command{gawkpath_default} shell function +@item gawkpath_default +Reset the @env{AWKPATH} environment variable to its default value. + +@cindex @command{gawkpath_prepend} shell function +@item gawkpath_prepend +Add the argument to the front of the @env{AWKPATH} environment variable. + +@cindex @command{gawkpath_append} shell function +@item gawkpath_append +Add the argument to the end of the @env{AWKPATH} environment variable. + +@cindex @command{gawklibpath_default} shell function +@item gawklibpath_default +Reset the @env{AWKLIBPATH} environment variable to its default value. + +@cindex @command{gawklibpath_prepend} shell function +@item gawklibpath_prepend +Add the argument to the front of the @env{AWKLIBPATH} environment variable. + +@cindex @command{gawklibpath_append} shell function +@item gawklibpath_append +Add the argument to the end of the @env{AWKLIBPATH} environment variable. + +@end table + + @node Additional Configuration Options @appendixsubsec Additional Configuration Options @cindex @command{gawk}, configuring, options @@ -37354,7 +37559,8 @@ The people maintaining the various @command{gawk} ports are: @end multitable If your bug is also reproducible under Unix, please send a copy of your -report to the @EMAIL{bug-gawk@@gnu.org,bug-gawk at gnu dot org} email list as well. +report to the @EMAIL{bug-gawk@@gnu.org,bug-gawk at gnu dot org} email +list as well. @c ENDOFRANGE dbugg @c ENDOFRANGE tblgawb |