aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--awklib/eg/lib/quicksort.awk5
-rw-r--r--doc/ChangeLog2
-rw-r--r--doc/gawk.info690
-rw-r--r--doc/gawk.texi67
-rw-r--r--doc/gawktexi.in67
5 files changed, 421 insertions, 410 deletions
diff --git a/awklib/eg/lib/quicksort.awk b/awklib/eg/lib/quicksort.awk
index 3ba2d6e3..e0ed8bc7 100644
--- a/awklib/eg/lib/quicksort.awk
+++ b/awklib/eg/lib/quicksort.awk
@@ -4,8 +4,9 @@
# Arnold Robbins, arnold@skeeve.com, Public Domain
# January 2009
-# quicksort --- C.A.R. Hoare's quick sort algorithm. See Wikipedia
-# or almost any algorithms or computer science text
+
+# quicksort --- C.A.R. Hoare's quicksort algorithm. See Wikipedia
+# or almost any algorithms or computer science text.
#
# Adapted from K&R-II, page 110
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 22636fe7..75a5e6a3 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -4,6 +4,8 @@
have the same name as a function is now --posix.
Restore indirectcall example.
+ More O'Reilly fixes.
+
2015-01-30 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in: Document POSIX requirement that function parameters
diff --git a/doc/gawk.info b/doc/gawk.info
index 0329a038..4176eb81 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -13347,13 +13347,14 @@ This program produces the following output when run:
-| lshift(0x99, 2) = 0x264 = 0000001001100100
-| rshift(0x99, 2) = 0x26 = 00100110
- The `bits2str()' function turns a binary number into a string. The
-number `1' represents a binary value where the rightmost bit is set to
-1. Using this mask, the function repeatedly checks the rightmost bit.
-ANDing the mask with the value indicates whether the rightmost bit is 1
-or not. If so, a `"1"' is concatenated onto the front of the string.
-Otherwise, a `"0"' is added. The value is then shifted right by one
-bit and the loop continues until there are no more 1 bits.
+ The `bits2str()' function turns a binary number into a string.
+Initializing `mask' to one creates a binary value where the rightmost
+bit is set to one. Using this mask, the function repeatedly checks the
+rightmost bit. ANDing the mask with the value indicates whether the
+rightmost bit is one or not. If so, a `"1"' is concatenated onto the
+front of the string. Otherwise, a `"0"' is added. The value is then
+shifted right by one bit and the loop continues until there are no more
+one bits.
If the initial value is zero, it returns a simple `"0"'. Otherwise,
at the end, it pads the value with zeros to represent multiples of
@@ -13382,7 +13383,7 @@ traverses every element of an array of arrays (*note Arrays of
Arrays::).
`isarray(X)'
- Return a true value if X is an array. Otherwise return false.
+ Return a true value if X is an array. Otherwise, return false.
`isarray()' is meant for use in two circumstances. The first is when
traversing a multidimensional array: you can test if an element is
@@ -13429,8 +13430,8 @@ brackets ([ ]):
Return the plural form used for NUMBER of the translation of
STRING1 and STRING2 in text domain DOMAIN for locale category
CATEGORY. STRING1 is the English singular variant of a message,
- and STRING2 the English plural variant of the same message. The
- default value for DOMAIN is the current value of `TEXTDOMAIN'.
+ and STRING2 is the English plural variant of the same message.
+ The default value for DOMAIN is the current value of `TEXTDOMAIN'.
The default value for CATEGORY is `"LC_MESSAGES"'.

@@ -13459,7 +13460,7 @@ File: gawk.info, Node: Definition Syntax, Next: Function Example, Up: User-de
9.2.1 Function Definition Syntax
--------------------------------
- It's entirely fair to say that the `awk' syntax for local variable
+ It's entirely fair to say that the awk syntax for local variable
definitions is appallingly awful. -- Brian Kernighan
Definitions of functions can appear anywhere between the rules of an
@@ -13502,9 +13503,9 @@ have a parameter with the same name as the function itself.
Local variables act like the empty string if referenced where a
string value is required, and like zero if referenced where a numeric
-value is required. This is the same as regular variables that have
-never been assigned a value. (There is more to understand about local
-variables; *note Dynamic Typing::.)
+value is required. This is the same as the behavior of regular
+variables that have never been assigned a value. (There is more to
+understand about local variables; *note Dynamic Typing::.)
The BODY-OF-FUNCTION consists of `awk' statements. It is the most
important part of the definition, because it says what the function
@@ -13533,9 +13534,9 @@ function is supposed to be used.
variable values hide, or "shadow", any variables of the same names used
in the rest of the program. The shadowed variables are not accessible
in the function definition, because there is no way to name them while
-their names have been taken away for the local variables. All other
-variables used in the `awk' program can be referenced or set normally
-in the function's body.
+their names have been taken away for the arguments and local variables.
+All other variables used in the `awk' program can be referenced or set
+normally in the function's body.
The arguments and local variables last only as long as the function
body is executing. Once the body finishes, you can once again access
@@ -13588,7 +13589,7 @@ takes a number and prints it in a specific format:
printf "%6.3g\n", num
}
-To illustrate, here is an `awk' rule that uses our `myprint' function:
+To illustrate, here is an `awk' rule that uses our `myprint()' function:
$3 > 0 { myprint($3) }
@@ -13617,13 +13618,13 @@ extra whitespace signifies the start of the local variable list):
When working with arrays, it is often necessary to delete all the
elements in an array and start over with a new list of elements (*note
Delete::). Instead of having to repeat this loop everywhere that you
-need to clear out an array, your program can just call `delarray'.
+need to clear out an array, your program can just call `delarray()'.
(This guarantees portability. The use of `delete ARRAY' to delete the
contents of an entire array is a relatively recent(1) addition to the
POSIX standard.)
The following is an example of a recursive function. It takes a
-string as an input parameter and returns the string in backwards order.
+string as an input parameter and returns the string in reverse order.
Recursive functions must always have a test that stops the recursion.
In this case, the recursion terminates when the input string is already
empty:
@@ -13714,14 +13715,14 @@ File: gawk.info, Node: Variable Scope, Next: Pass By Value/Reference, Prev: C
9.2.3.2 Controlling Variable Scope
..................................
-Unlike many languages, there is no way to make a variable local to a
+Unlike in many languages, there is no way to make a variable local to a
`{' ... `}' block in `awk', but you can make a variable local to a
function. It is good practice to do so whenever a variable is needed
only in that function.
To make a variable local to a function, simply declare the variable
as an argument after the actual function arguments (*note Definition
-Syntax::). Look at the following example where variable `i' is a
+Syntax::). Look at the following example, where variable `i' is a
global variable used by both functions `foo()' and `bar()':
function bar()
@@ -13757,7 +13758,7 @@ variable instance:
foo's i=3
top's i=3
- If you want `i' to be local to both `foo()' and `bar()' do as
+ If you want `i' to be local to both `foo()' and `bar()', do as
follows (the extra space before `i' is a coding convention to indicate
that `i' is a local variable, not an argument):
@@ -13839,7 +13840,7 @@ explicitly whether the arguments are passed "by value" or "by
reference".
Instead, the passing convention is determined at runtime when the
-function is called according to the following rule: if the argument is
+function is called, according to the following rule: if the argument is
an array variable, then it is passed by reference. Otherwise, the
argument is passed by value.
@@ -13897,7 +13898,7 @@ function _are_ visible outside that function.
stores `"two"' in the second element of `a'.
Some `awk' implementations allow you to call a function that has not
-been defined. They only report a problem at runtime when the program
+been defined. They only report a problem at runtime, when the program
actually tries to call the function. For example:
BEGIN {
@@ -13942,15 +13943,15 @@ undefined, and therefore, unpredictable. In practice, though, all
versions of `awk' simply return the null string, which acts like zero
if used in a numeric context.
- A `return' statement with no value expression is assumed at the end
-of every function definition. So if control reaches the end of the
-function body, then technically, the function returns an unpredictable
+ A `return' statement without an EXPRESSION is assumed at the end of
+every function definition. So, if control reaches the end of the
+function body, then technically the function returns an unpredictable
value. In practice, it returns the empty string. `awk' does _not_
warn you if you use the return value of such a function.
Sometimes, you want to write a function for what it does, not for
what it returns. Such a function corresponds to a `void' function in
-C, C++ or Java, or to a `procedure' in Ada. Thus, it may be
+C, C++, or Java, or to a `procedure' in Ada. Thus, it may be
appropriate to not return any value; simply bear in mind that you
should not be using the return value of such a function.
@@ -14056,13 +14057,13 @@ you can specify the name of the function to call as a string variable,
and then call the function. Let's look at an example.
Suppose you have a file with your test scores for the classes you
-are taking. The first field is the class name. The following fields
-are the functions to call to process the data, up to a "marker" field
+are taking, and you wish to get the sum and the average of your test
+scores. The first field is the class name. The following fields are
+the functions to call to process the data, up to a "marker" field
`data:'. Following the marker, to the end of the record, are the
various numeric test scores.
- Here is the initial file; you wish to get the sum and the average of
-your test scores:
+ Here is the initial file:
Biology_101 sum average data: 87.0 92.4 78.5 94.9
Chemistry_305 sum average data: 75.2 98.3 94.7 88.2
@@ -14120,9 +14121,9 @@ using indirect function calls:
return ret
}
- These two functions expect to work on fields; thus the parameters
+ These two functions expect to work on fields; thus, the parameters
`first' and `last' indicate where in the fields to start and end.
-Otherwise they perform the expected computations and are not unusual:
+Otherwise, they perform the expected computations and are not unusual:
# For each record, print the class name and the requested statistics
{
@@ -14175,18 +14176,19 @@ to force it to be a string value.)
may think at first. The C and C++ languages provide "function
pointers," which are a mechanism for calling a function chosen at
runtime. One of the most well-known uses of this ability is the C
-`qsort()' function, which sorts an array using the famous "quick sort"
+`qsort()' function, which sorts an array using the famous "quicksort"
algorithm (see the Wikipedia article
-(http://en.wikipedia.org/wiki/Quick_sort) for more information). To
-use this function, you supply a pointer to a comparison function. This
+(http://en.wikipedia.org/wiki/Quicksort) for more information). To use
+this function, you supply a pointer to a comparison function. This
mechanism allows you to sort arbitrary data in an arbitrary fashion.
We can do something similar using `gawk', like this:
# quicksort.awk --- Quicksort algorithm, with user-supplied
# comparison function
- # quicksort --- C.A.R. Hoare's quick sort algorithm. See Wikipedia
- # or almost any algorithms or computer science text
+
+ # quicksort --- C.A.R. Hoare's quicksort algorithm. See Wikipedia
+ # or almost any algorithms or computer science text.
function quicksort(data, left, right, less_than, i, last)
{
@@ -14215,7 +14217,7 @@ mechanism allows you to sort arbitrary data in an arbitrary fashion.
The `quicksort()' function receives the `data' array, the starting
and ending indices to sort (`left' and `right'), and the name of a
function that performs a "less than" comparison. It then implements
-the quick sort algorithm.
+the quicksort algorithm.
To make use of the sorting function, we return to our previous
example. The first thing to do is write some comparison functions:
@@ -34876,308 +34878,308 @@ Ref: Time Functions-Footnote-5558886
Ref: Time Functions-Footnote-6559113
Node: Bitwise Functions559379
Ref: table-bitwise-ops559941
-Ref: Bitwise Functions-Footnote-1564253
-Node: Type Functions564425
-Node: I18N Functions565576
-Node: User-defined567221
-Node: Definition Syntax568026
-Ref: Definition Syntax-Footnote-1573658
-Node: Function Example573729
-Ref: Function Example-Footnote-1576648
-Node: Function Caveats576670
-Node: Calling A Function577188
-Node: Variable Scope578146
-Node: Pass By Value/Reference581134
-Node: Return Statement584629
-Node: Dynamic Typing587610
-Node: Indirect Calls588539
-Ref: Indirect Calls-Footnote-1599841
-Node: Functions Summary599969
-Node: Library Functions602671
-Ref: Library Functions-Footnote-1606280
-Ref: Library Functions-Footnote-2606423
-Node: Library Names606594
-Ref: Library Names-Footnote-1610048
-Ref: Library Names-Footnote-2610271
-Node: General Functions610357
-Node: Strtonum Function611460
-Node: Assert Function614482
-Node: Round Function617806
-Node: Cliff Random Function619347
-Node: Ordinal Functions620363
-Ref: Ordinal Functions-Footnote-1623426
-Ref: Ordinal Functions-Footnote-2623678
-Node: Join Function623889
-Ref: Join Function-Footnote-1625658
-Node: Getlocaltime Function625858
-Node: Readfile Function629602
-Node: Shell Quoting631572
-Node: Data File Management632973
-Node: Filetrans Function633605
-Node: Rewind Function637661
-Node: File Checking639048
-Ref: File Checking-Footnote-1640380
-Node: Empty Files640581
-Node: Ignoring Assigns642560
-Node: Getopt Function644111
-Ref: Getopt Function-Footnote-1655573
-Node: Passwd Functions655773
-Ref: Passwd Functions-Footnote-1664610
-Node: Group Functions664698
-Ref: Group Functions-Footnote-1672592
-Node: Walking Arrays672805
-Node: Library Functions Summary674408
-Node: Library Exercises675809
-Node: Sample Programs677089
-Node: Running Examples677859
-Node: Clones678587
-Node: Cut Program679811
-Node: Egrep Program689530
-Ref: Egrep Program-Footnote-1697028
-Node: Id Program697138
-Node: Split Program700783
-Ref: Split Program-Footnote-1704231
-Node: Tee Program704359
-Node: Uniq Program707148
-Node: Wc Program714567
-Ref: Wc Program-Footnote-1718817
-Node: Miscellaneous Programs718911
-Node: Dupword Program720124
-Node: Alarm Program722155
-Node: Translate Program726959
-Ref: Translate Program-Footnote-1731524
-Node: Labels Program731794
-Ref: Labels Program-Footnote-1735145
-Node: Word Sorting735229
-Node: History Sorting739300
-Node: Extract Program741136
-Node: Simple Sed748661
-Node: Igawk Program751729
-Ref: Igawk Program-Footnote-1766053
-Ref: Igawk Program-Footnote-2766254
-Ref: Igawk Program-Footnote-3766376
-Node: Anagram Program766491
-Node: Signature Program769548
-Node: Programs Summary770795
-Node: Programs Exercises771988
-Ref: Programs Exercises-Footnote-1776119
-Node: Advanced Features776210
-Node: Nondecimal Data778158
-Node: Array Sorting779748
-Node: Controlling Array Traversal780445
-Ref: Controlling Array Traversal-Footnote-1788778
-Node: Array Sorting Functions788896
-Ref: Array Sorting Functions-Footnote-1792785
-Node: Two-way I/O792981
-Ref: Two-way I/O-Footnote-1797926
-Ref: Two-way I/O-Footnote-2798112
-Node: TCP/IP Networking798194
-Node: Profiling801067
-Node: Advanced Features Summary809344
-Node: Internationalization811277
-Node: I18N and L10N812757
-Node: Explaining gettext813443
-Ref: Explaining gettext-Footnote-1818468
-Ref: Explaining gettext-Footnote-2818652
-Node: Programmer i18n818817
-Ref: Programmer i18n-Footnote-1823683
-Node: Translator i18n823732
-Node: String Extraction824526
-Ref: String Extraction-Footnote-1825657
-Node: Printf Ordering825743
-Ref: Printf Ordering-Footnote-1828529
-Node: I18N Portability828593
-Ref: I18N Portability-Footnote-1831048
-Node: I18N Example831111
-Ref: I18N Example-Footnote-1833914
-Node: Gawk I18N833986
-Node: I18N Summary834624
-Node: Debugger835963
-Node: Debugging836985
-Node: Debugging Concepts837426
-Node: Debugging Terms839279
-Node: Awk Debugging841851
-Node: Sample Debugging Session842745
-Node: Debugger Invocation843265
-Node: Finding The Bug844649
-Node: List of Debugger Commands851124
-Node: Breakpoint Control852457
-Node: Debugger Execution Control856153
-Node: Viewing And Changing Data859517
-Node: Execution Stack862895
-Node: Debugger Info864532
-Node: Miscellaneous Debugger Commands868549
-Node: Readline Support873578
-Node: Limitations874470
-Node: Debugging Summary876584
-Node: Arbitrary Precision Arithmetic877752
-Node: Computer Arithmetic879168
-Ref: table-numeric-ranges882766
-Ref: Computer Arithmetic-Footnote-1883625
-Node: Math Definitions883682
-Ref: table-ieee-formats886970
-Ref: Math Definitions-Footnote-1887574
-Node: MPFR features887679
-Node: FP Math Caution889350
-Ref: FP Math Caution-Footnote-1890400
-Node: Inexactness of computations890769
-Node: Inexact representation891728
-Node: Comparing FP Values893085
-Node: Errors accumulate894167
-Node: Getting Accuracy895600
-Node: Try To Round898262
-Node: Setting precision899161
-Ref: table-predefined-precision-strings899845
-Node: Setting the rounding mode901634
-Ref: table-gawk-rounding-modes901998
-Ref: Setting the rounding mode-Footnote-1905453
-Node: Arbitrary Precision Integers905632
-Ref: Arbitrary Precision Integers-Footnote-1910532
-Node: POSIX Floating Point Problems910681
-Ref: POSIX Floating Point Problems-Footnote-1914554
-Node: Floating point summary914592
-Node: Dynamic Extensions916786
-Node: Extension Intro918338
-Node: Plugin License919604
-Node: Extension Mechanism Outline920401
-Ref: figure-load-extension920829
-Ref: figure-register-new-function922309
-Ref: figure-call-new-function923313
-Node: Extension API Description925299
-Node: Extension API Functions Introduction926749
-Node: General Data Types931573
-Ref: General Data Types-Footnote-1937312
-Node: Memory Allocation Functions937611
-Ref: Memory Allocation Functions-Footnote-1940450
-Node: Constructor Functions940546
-Node: Registration Functions942280
-Node: Extension Functions942965
-Node: Exit Callback Functions945262
-Node: Extension Version String946510
-Node: Input Parsers947175
-Node: Output Wrappers957054
-Node: Two-way processors961569
-Node: Printing Messages963773
-Ref: Printing Messages-Footnote-1964849
-Node: Updating `ERRNO'965001
-Node: Requesting Values965741
-Ref: table-value-types-returned966469
-Node: Accessing Parameters967426
-Node: Symbol Table Access968657
-Node: Symbol table by name969171
-Node: Symbol table by cookie971152
-Ref: Symbol table by cookie-Footnote-1975296
-Node: Cached values975359
-Ref: Cached values-Footnote-1978858
-Node: Array Manipulation978949
-Ref: Array Manipulation-Footnote-1980047
-Node: Array Data Types980084
-Ref: Array Data Types-Footnote-1982739
-Node: Array Functions982831
-Node: Flattening Arrays986685
-Node: Creating Arrays993577
-Node: Extension API Variables998348
-Node: Extension Versioning998984
-Node: Extension API Informational Variables1000885
-Node: Extension API Boilerplate1001950
-Node: Finding Extensions1005759
-Node: Extension Example1006319
-Node: Internal File Description1007091
-Node: Internal File Ops1011158
-Ref: Internal File Ops-Footnote-11022828
-Node: Using Internal File Ops1022968
-Ref: Using Internal File Ops-Footnote-11025351
-Node: Extension Samples1025624
-Node: Extension Sample File Functions1027150
-Node: Extension Sample Fnmatch1034788
-Node: Extension Sample Fork1036279
-Node: Extension Sample Inplace1037494
-Node: Extension Sample Ord1039169
-Node: Extension Sample Readdir1040005
-Ref: table-readdir-file-types1040881
-Node: Extension Sample Revout1041692
-Node: Extension Sample Rev2way1042282
-Node: Extension Sample Read write array1043022
-Node: Extension Sample Readfile1044962
-Node: Extension Sample Time1046057
-Node: Extension Sample API Tests1047406
-Node: gawkextlib1047897
-Node: Extension summary1050555
-Node: Extension Exercises1054244
-Node: Language History1054966
-Node: V7/SVR3.11056622
-Node: SVR41058803
-Node: POSIX1060248
-Node: BTL1061637
-Node: POSIX/GNU1062371
-Node: Feature History1067995
-Node: Common Extensions1081093
-Node: Ranges and Locales1082417
-Ref: Ranges and Locales-Footnote-11087035
-Ref: Ranges and Locales-Footnote-21087062
-Ref: Ranges and Locales-Footnote-31087296
-Node: Contributors1087517
-Node: History summary1093058
-Node: Installation1094428
-Node: Gawk Distribution1095374
-Node: Getting1095858
-Node: Extracting1096681
-Node: Distribution contents1098316
-Node: Unix Installation1104381
-Node: Quick Installation1105064
-Node: Shell Startup Files1107475
-Node: Additional Configuration Options1108554
-Node: Configuration Philosophy1110293
-Node: Non-Unix Installation1112662
-Node: PC Installation1113120
-Node: PC Binary Installation1114439
-Node: PC Compiling1116287
-Ref: PC Compiling-Footnote-11119308
-Node: PC Testing1119417
-Node: PC Using1120593
-Node: Cygwin1124708
-Node: MSYS1125531
-Node: VMS Installation1126031
-Node: VMS Compilation1126823
-Ref: VMS Compilation-Footnote-11128045
-Node: VMS Dynamic Extensions1128103
-Node: VMS Installation Details1129787
-Node: VMS Running1132039
-Node: VMS GNV1134875
-Node: VMS Old Gawk1135609
-Node: Bugs1136079
-Node: Other Versions1139962
-Node: Installation summary1146386
-Node: Notes1147442
-Node: Compatibility Mode1148307
-Node: Additions1149089
-Node: Accessing The Source1150014
-Node: Adding Code1151449
-Node: New Ports1157606
-Node: Derived Files1162088
-Ref: Derived Files-Footnote-11167563
-Ref: Derived Files-Footnote-21167597
-Ref: Derived Files-Footnote-31168193
-Node: Future Extensions1168307
-Node: Implementation Limitations1168913
-Node: Extension Design1170161
-Node: Old Extension Problems1171315
-Ref: Old Extension Problems-Footnote-11172832
-Node: Extension New Mechanism Goals1172889
-Ref: Extension New Mechanism Goals-Footnote-11176249
-Node: Extension Other Design Decisions1176438
-Node: Extension Future Growth1178546
-Node: Old Extension Mechanism1179382
-Node: Notes summary1181144
-Node: Basic Concepts1182330
-Node: Basic High Level1183011
-Ref: figure-general-flow1183283
-Ref: figure-process-flow1183882
-Ref: Basic High Level-Footnote-11187111
-Node: Basic Data Typing1187296
-Node: Glossary1190624
-Node: Copying1222553
-Node: GNU Free Documentation License1260109
-Node: Index1285245
+Ref: Bitwise Functions-Footnote-1564269
+Node: Type Functions564441
+Node: I18N Functions565593
+Node: User-defined567240
+Node: Definition Syntax568045
+Ref: Definition Syntax-Footnote-1573704
+Node: Function Example573775
+Ref: Function Example-Footnote-1576696
+Node: Function Caveats576718
+Node: Calling A Function577236
+Node: Variable Scope578194
+Node: Pass By Value/Reference581187
+Node: Return Statement584684
+Node: Dynamic Typing587663
+Node: Indirect Calls588592
+Ref: Indirect Calls-Footnote-1599898
+Node: Functions Summary600026
+Node: Library Functions602728
+Ref: Library Functions-Footnote-1606337
+Ref: Library Functions-Footnote-2606480
+Node: Library Names606651
+Ref: Library Names-Footnote-1610105
+Ref: Library Names-Footnote-2610328
+Node: General Functions610414
+Node: Strtonum Function611517
+Node: Assert Function614539
+Node: Round Function617863
+Node: Cliff Random Function619404
+Node: Ordinal Functions620420
+Ref: Ordinal Functions-Footnote-1623483
+Ref: Ordinal Functions-Footnote-2623735
+Node: Join Function623946
+Ref: Join Function-Footnote-1625715
+Node: Getlocaltime Function625915
+Node: Readfile Function629659
+Node: Shell Quoting631629
+Node: Data File Management633030
+Node: Filetrans Function633662
+Node: Rewind Function637718
+Node: File Checking639105
+Ref: File Checking-Footnote-1640437
+Node: Empty Files640638
+Node: Ignoring Assigns642617
+Node: Getopt Function644168
+Ref: Getopt Function-Footnote-1655630
+Node: Passwd Functions655830
+Ref: Passwd Functions-Footnote-1664667
+Node: Group Functions664755
+Ref: Group Functions-Footnote-1672649
+Node: Walking Arrays672862
+Node: Library Functions Summary674465
+Node: Library Exercises675866
+Node: Sample Programs677146
+Node: Running Examples677916
+Node: Clones678644
+Node: Cut Program679868
+Node: Egrep Program689587
+Ref: Egrep Program-Footnote-1697085
+Node: Id Program697195
+Node: Split Program700840
+Ref: Split Program-Footnote-1704288
+Node: Tee Program704416
+Node: Uniq Program707205
+Node: Wc Program714624
+Ref: Wc Program-Footnote-1718874
+Node: Miscellaneous Programs718968
+Node: Dupword Program720181
+Node: Alarm Program722212
+Node: Translate Program727016
+Ref: Translate Program-Footnote-1731581
+Node: Labels Program731851
+Ref: Labels Program-Footnote-1735202
+Node: Word Sorting735286
+Node: History Sorting739357
+Node: Extract Program741193
+Node: Simple Sed748718
+Node: Igawk Program751786
+Ref: Igawk Program-Footnote-1766110
+Ref: Igawk Program-Footnote-2766311
+Ref: Igawk Program-Footnote-3766433
+Node: Anagram Program766548
+Node: Signature Program769605
+Node: Programs Summary770852
+Node: Programs Exercises772045
+Ref: Programs Exercises-Footnote-1776176
+Node: Advanced Features776267
+Node: Nondecimal Data778215
+Node: Array Sorting779805
+Node: Controlling Array Traversal780502
+Ref: Controlling Array Traversal-Footnote-1788835
+Node: Array Sorting Functions788953
+Ref: Array Sorting Functions-Footnote-1792842
+Node: Two-way I/O793038
+Ref: Two-way I/O-Footnote-1797983
+Ref: Two-way I/O-Footnote-2798169
+Node: TCP/IP Networking798251
+Node: Profiling801124
+Node: Advanced Features Summary809401
+Node: Internationalization811334
+Node: I18N and L10N812814
+Node: Explaining gettext813500
+Ref: Explaining gettext-Footnote-1818525
+Ref: Explaining gettext-Footnote-2818709
+Node: Programmer i18n818874
+Ref: Programmer i18n-Footnote-1823740
+Node: Translator i18n823789
+Node: String Extraction824583
+Ref: String Extraction-Footnote-1825714
+Node: Printf Ordering825800
+Ref: Printf Ordering-Footnote-1828586
+Node: I18N Portability828650
+Ref: I18N Portability-Footnote-1831105
+Node: I18N Example831168
+Ref: I18N Example-Footnote-1833971
+Node: Gawk I18N834043
+Node: I18N Summary834681
+Node: Debugger836020
+Node: Debugging837042
+Node: Debugging Concepts837483
+Node: Debugging Terms839336
+Node: Awk Debugging841908
+Node: Sample Debugging Session842802
+Node: Debugger Invocation843322
+Node: Finding The Bug844706
+Node: List of Debugger Commands851181
+Node: Breakpoint Control852514
+Node: Debugger Execution Control856210
+Node: Viewing And Changing Data859574
+Node: Execution Stack862952
+Node: Debugger Info864589
+Node: Miscellaneous Debugger Commands868606
+Node: Readline Support873635
+Node: Limitations874527
+Node: Debugging Summary876641
+Node: Arbitrary Precision Arithmetic877809
+Node: Computer Arithmetic879225
+Ref: table-numeric-ranges882823
+Ref: Computer Arithmetic-Footnote-1883682
+Node: Math Definitions883739
+Ref: table-ieee-formats887027
+Ref: Math Definitions-Footnote-1887631
+Node: MPFR features887736
+Node: FP Math Caution889407
+Ref: FP Math Caution-Footnote-1890457
+Node: Inexactness of computations890826
+Node: Inexact representation891785
+Node: Comparing FP Values893142
+Node: Errors accumulate894224
+Node: Getting Accuracy895657
+Node: Try To Round898319
+Node: Setting precision899218
+Ref: table-predefined-precision-strings899902
+Node: Setting the rounding mode901691
+Ref: table-gawk-rounding-modes902055
+Ref: Setting the rounding mode-Footnote-1905510
+Node: Arbitrary Precision Integers905689
+Ref: Arbitrary Precision Integers-Footnote-1910589
+Node: POSIX Floating Point Problems910738
+Ref: POSIX Floating Point Problems-Footnote-1914611
+Node: Floating point summary914649
+Node: Dynamic Extensions916843
+Node: Extension Intro918395
+Node: Plugin License919661
+Node: Extension Mechanism Outline920458
+Ref: figure-load-extension920886
+Ref: figure-register-new-function922366
+Ref: figure-call-new-function923370
+Node: Extension API Description925356
+Node: Extension API Functions Introduction926806
+Node: General Data Types931630
+Ref: General Data Types-Footnote-1937369
+Node: Memory Allocation Functions937668
+Ref: Memory Allocation Functions-Footnote-1940507
+Node: Constructor Functions940603
+Node: Registration Functions942337
+Node: Extension Functions943022
+Node: Exit Callback Functions945319
+Node: Extension Version String946567
+Node: Input Parsers947232
+Node: Output Wrappers957111
+Node: Two-way processors961626
+Node: Printing Messages963830
+Ref: Printing Messages-Footnote-1964906
+Node: Updating `ERRNO'965058
+Node: Requesting Values965798
+Ref: table-value-types-returned966526
+Node: Accessing Parameters967483
+Node: Symbol Table Access968714
+Node: Symbol table by name969228
+Node: Symbol table by cookie971209
+Ref: Symbol table by cookie-Footnote-1975353
+Node: Cached values975416
+Ref: Cached values-Footnote-1978915
+Node: Array Manipulation979006
+Ref: Array Manipulation-Footnote-1980104
+Node: Array Data Types980141
+Ref: Array Data Types-Footnote-1982796
+Node: Array Functions982888
+Node: Flattening Arrays986742
+Node: Creating Arrays993634
+Node: Extension API Variables998405
+Node: Extension Versioning999041
+Node: Extension API Informational Variables1000942
+Node: Extension API Boilerplate1002007
+Node: Finding Extensions1005816
+Node: Extension Example1006376
+Node: Internal File Description1007148
+Node: Internal File Ops1011215
+Ref: Internal File Ops-Footnote-11022885
+Node: Using Internal File Ops1023025
+Ref: Using Internal File Ops-Footnote-11025408
+Node: Extension Samples1025681
+Node: Extension Sample File Functions1027207
+Node: Extension Sample Fnmatch1034845
+Node: Extension Sample Fork1036336
+Node: Extension Sample Inplace1037551
+Node: Extension Sample Ord1039226
+Node: Extension Sample Readdir1040062
+Ref: table-readdir-file-types1040938
+Node: Extension Sample Revout1041749
+Node: Extension Sample Rev2way1042339
+Node: Extension Sample Read write array1043079
+Node: Extension Sample Readfile1045019
+Node: Extension Sample Time1046114
+Node: Extension Sample API Tests1047463
+Node: gawkextlib1047954
+Node: Extension summary1050612
+Node: Extension Exercises1054301
+Node: Language History1055023
+Node: V7/SVR3.11056679
+Node: SVR41058860
+Node: POSIX1060305
+Node: BTL1061694
+Node: POSIX/GNU1062428
+Node: Feature History1068052
+Node: Common Extensions1081150
+Node: Ranges and Locales1082474
+Ref: Ranges and Locales-Footnote-11087092
+Ref: Ranges and Locales-Footnote-21087119
+Ref: Ranges and Locales-Footnote-31087353
+Node: Contributors1087574
+Node: History summary1093115
+Node: Installation1094485
+Node: Gawk Distribution1095431
+Node: Getting1095915
+Node: Extracting1096738
+Node: Distribution contents1098373
+Node: Unix Installation1104438
+Node: Quick Installation1105121
+Node: Shell Startup Files1107532
+Node: Additional Configuration Options1108611
+Node: Configuration Philosophy1110350
+Node: Non-Unix Installation1112719
+Node: PC Installation1113177
+Node: PC Binary Installation1114496
+Node: PC Compiling1116344
+Ref: PC Compiling-Footnote-11119365
+Node: PC Testing1119474
+Node: PC Using1120650
+Node: Cygwin1124765
+Node: MSYS1125588
+Node: VMS Installation1126088
+Node: VMS Compilation1126880
+Ref: VMS Compilation-Footnote-11128102
+Node: VMS Dynamic Extensions1128160
+Node: VMS Installation Details1129844
+Node: VMS Running1132096
+Node: VMS GNV1134932
+Node: VMS Old Gawk1135666
+Node: Bugs1136136
+Node: Other Versions1140019
+Node: Installation summary1146443
+Node: Notes1147499
+Node: Compatibility Mode1148364
+Node: Additions1149146
+Node: Accessing The Source1150071
+Node: Adding Code1151506
+Node: New Ports1157663
+Node: Derived Files1162145
+Ref: Derived Files-Footnote-11167620
+Ref: Derived Files-Footnote-21167654
+Ref: Derived Files-Footnote-31168250
+Node: Future Extensions1168364
+Node: Implementation Limitations1168970
+Node: Extension Design1170218
+Node: Old Extension Problems1171372
+Ref: Old Extension Problems-Footnote-11172889
+Node: Extension New Mechanism Goals1172946
+Ref: Extension New Mechanism Goals-Footnote-11176306
+Node: Extension Other Design Decisions1176495
+Node: Extension Future Growth1178603
+Node: Old Extension Mechanism1179439
+Node: Notes summary1181201
+Node: Basic Concepts1182387
+Node: Basic High Level1183068
+Ref: figure-general-flow1183340
+Ref: figure-process-flow1183939
+Ref: Basic High Level-Footnote-11187168
+Node: Basic Data Typing1187353
+Node: Glossary1190681
+Node: Copying1222610
+Node: GNU Free Documentation License1260166
+Node: Index1285302

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 457a20f2..e56c8a89 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -19205,15 +19205,16 @@ $ @kbd{gawk -f testbits.awk}
@cindex converting, numbers to strings
@cindex number as string of bits
The @code{bits2str()} function turns a binary number into a string.
-The number @code{1} represents a binary value where the rightmost bit
-is set to 1. Using this mask,
+Initializing @code{mask} to one creates
+a binary value where the rightmost bit
+is set to one. Using this mask,
the function repeatedly checks the rightmost bit.
ANDing the mask with the value indicates whether the
-rightmost bit is 1 or not. If so, a @code{"1"} is concatenated onto the front
+rightmost bit is one or not. If so, a @code{"1"} is concatenated onto the front
of the string.
Otherwise, a @code{"0"} is added.
The value is then shifted right by one bit and the loop continues
-until there are no more 1 bits.
+until there are no more one bits.
If the initial value is zero, it returns a simple @code{"0"}.
Otherwise, at the end, it pads the value with zeros to represent multiples
@@ -19237,7 +19238,7 @@ that traverses every element of an array of arrays
@cindexgawkfunc{isarray}
@cindex scalar or array
@item isarray(@var{x})
-Return a true value if @var{x} is an array. Otherwise return false.
+Return a true value if @var{x} is an array. Otherwise, return false.
@end table
@code{isarray()} is meant for use in two circumstances. The first is when
@@ -19298,7 +19299,7 @@ The default value for @var{category} is @code{"LC_MESSAGES"}.
Return the plural form used for @var{number} of the
translation of @var{string1} and @var{string2} in text domain
@var{domain} for locale category @var{category}. @var{string1} is the
-English singular variant of a message, and @var{string2} the English plural
+English singular variant of a message, and @var{string2} is the English plural
variant of the same message.
The default value for @var{domain} is the current value of @code{TEXTDOMAIN}.
The default value for @var{category} is @code{"LC_MESSAGES"}.
@@ -19327,7 +19328,7 @@ them (i.e., to tell @command{awk} what they should do).
@subsection Function Definition Syntax
@quotation
-@i{It's entirely fair to say that the @command{awk} syntax for local
+@i{It's entirely fair to say that the awk syntax for local
variable definitions is appallingly awful.}
@author Brian Kernighan
@end quotation
@@ -19385,7 +19386,7 @@ it also enforces the second restriction.
Local variables act like the empty string if referenced where a string
value is required, and like zero if referenced where a numeric value
-is required. This is the same as regular variables that have never been
+is required. This is the same as the behavior of regular variables that have never been
assigned a value. (There is more to understand about local variables;
@pxref{Dynamic Typing}.)
@@ -19419,7 +19420,7 @@ During execution of the function body, the arguments and local variable
values hide, or @dfn{shadow}, any variables of the same names used in the
rest of the program. The shadowed variables are not accessible in the
function definition, because there is no way to name them while their
-names have been taken away for the local variables. All other variables
+names have been taken away for the arguments and local variables. All other variables
used in the @command{awk} program can be referenced or set normally in the
function's body.
@@ -19486,7 +19487,7 @@ function myprint(num)
@end example
@noindent
-To illustrate, here is an @command{awk} rule that uses our @code{myprint}
+To illustrate, here is an @command{awk} rule that uses our @code{myprint()}
function:
@example
@@ -19527,13 +19528,13 @@ in an array and start over with a new list of elements
(@pxref{Delete}).
Instead of having
to repeat this loop everywhere that you need to clear out
-an array, your program can just call @code{delarray}.
+an array, your program can just call @code{delarray()}.
(This guarantees portability. The use of @samp{delete @var{array}} to delete
the contents of an entire array is a relatively recent@footnote{Late in 2012.}
addition to the POSIX standard.)
The following is an example of a recursive function. It takes a string
-as an input parameter and returns the string in backwards order.
+as an input parameter and returns the string in reverse order.
Recursive functions must always have a test that stops the recursion.
In this case, the recursion terminates when the input string is
already empty:
@@ -19630,7 +19631,7 @@ an error.
@cindex local variables, in a function
@cindex variables, local to a function
-Unlike many languages,
+Unlike in many languages,
there is no way to make a variable local to a @code{@{} @dots{} @code{@}} block in
@command{awk}, but you can make a variable local to a function. It is
good practice to do so whenever a variable is needed only in that
@@ -19639,7 +19640,7 @@ function.
To make a variable local to a function, simply declare the variable as
an argument after the actual function arguments
(@pxref{Definition Syntax}).
-Look at the following example where variable
+Look at the following example, where variable
@code{i} is a global variable used by both functions @code{foo()} and
@code{bar()}:
@@ -19680,7 +19681,7 @@ foo's i=3
top's i=3
@end example
-If you want @code{i} to be local to both @code{foo()} and @code{bar()} do as
+If you want @code{i} to be local to both @code{foo()} and @code{bar()}, do as
follows (the extra space before @code{i} is a coding convention to
indicate that @code{i} is a local variable, not an argument):
@@ -19768,7 +19769,7 @@ declare explicitly whether the arguments are passed @dfn{by value} or
@dfn{by reference}.
Instead, the passing convention is determined at runtime when
-the function is called according to the following rule:
+the function is called, according to the following rule:
if the argument is an array variable, then it is passed by reference.
Otherwise, the argument is passed by value.
@@ -19845,7 +19846,7 @@ prints @samp{a[1] = 1, a[2] = two, a[3] = 3}, because
@cindex undefined functions
@cindex functions, undefined
Some @command{awk} implementations allow you to call a function that
-has not been defined. They only report a problem at runtime when the
+has not been defined. They only report a problem at runtime, when the
program actually tries to call the function. For example:
@example
@@ -19904,15 +19905,15 @@ makes the returned value undefined, and therefore, unpredictable.
In practice, though, all versions of @command{awk} simply return the
null string, which acts like zero if used in a numeric context.
-A @code{return} statement with no value expression is assumed at the end of
-every function definition. So if control reaches the end of the function
-body, then technically, the function returns an unpredictable value.
+A @code{return} statement without an @var{expression} is assumed at the end of
+every function definition. So, if control reaches the end of the function
+body, then technically the function returns an unpredictable value.
In practice, it returns the empty string. @command{awk}
does @emph{not} warn you if you use the return value of such a function.
Sometimes, you want to write a function for what it does, not for
what it returns. Such a function corresponds to a @code{void} function
-in C, C++ or Java, or to a @code{procedure} in Ada. Thus, it may be appropriate to not
+in C, C++, or Java, or to a @code{procedure} in Ada. Thus, it may be appropriate to not
return any value; simply bear in mind that you should not be using the
return value of such a function.
@@ -20031,13 +20032,15 @@ function calls, you can specify the name of the function to call as a
string variable, and then call the function. Let's look at an example.
Suppose you have a file with your test scores for the classes you
-are taking. The first field is the class name. The following fields
+are taking, and
+you wish to get the sum and the average of
+your test scores.
+The first field is the class name. The following fields
are the functions to call to process the data, up to a ``marker''
field @samp{data:}. Following the marker, to the end of the record,
are the various numeric test scores.
-Here is the initial file; you wish to get the sum and the average of
-your test scores:
+Here is the initial file:
@example
@c file eg/data/class_data1
@@ -20120,9 +20123,9 @@ function sum(first, last, ret, i)
@c endfile
@end example
-These two functions expect to work on fields; thus the parameters
+These two functions expect to work on fields; thus, the parameters
@code{first} and @code{last} indicate where in the fields to start and end.
-Otherwise they perform the expected computations and are not unusual:
+Otherwise, they perform the expected computations and are not unusual:
@example
@c file eg/prog/indirectcall.awk
@@ -20181,8 +20184,8 @@ The ability to use indirect function calls is more powerful than you may
think at first. The C and C++ languages provide ``function pointers,'' which
are a mechanism for calling a function chosen at runtime. One of the most
well-known uses of this ability is the C @code{qsort()} function, which sorts
-an array using the famous ``quick sort'' algorithm
-(see @uref{http://en.wikipedia.org/wiki/Quick_sort, the Wikipedia article}
+an array using the famous ``quicksort'' algorithm
+(see @uref{http://en.wikipedia.org/wiki/Quicksort, the Wikipedia article}
for more information). To use this function, you supply a pointer to a comparison
function. This mechanism allows you to sort arbitrary data in an arbitrary
fashion.
@@ -20201,11 +20204,11 @@ We can do something similar using @command{gawk}, like this:
# January 2009
@c endfile
-
@end ignore
@c file eg/lib/quicksort.awk
-# quicksort --- C.A.R. Hoare's quick sort algorithm. See Wikipedia
-# or almost any algorithms or computer science text
+
+# quicksort --- C.A.R. Hoare's quicksort algorithm. See Wikipedia
+# or almost any algorithms or computer science text.
@c endfile
@ignore
@c file eg/lib/quicksort.awk
@@ -20243,7 +20246,7 @@ function quicksort_swap(data, i, j, temp)
The @code{quicksort()} function receives the @code{data} array, the starting and ending
indices to sort (@code{left} and @code{right}), and the name of a function that
-performs a ``less than'' comparison. It then implements the quick sort algorithm.
+performs a ``less than'' comparison. It then implements the quicksort algorithm.
To make use of the sorting function, we return to our previous example. The
first thing to do is write some comparison functions:
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 64a4ef28..e38feeab 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -18326,15 +18326,16 @@ $ @kbd{gawk -f testbits.awk}
@cindex converting, numbers to strings
@cindex number as string of bits
The @code{bits2str()} function turns a binary number into a string.
-The number @code{1} represents a binary value where the rightmost bit
-is set to 1. Using this mask,
+Initializing @code{mask} to one creates
+a binary value where the rightmost bit
+is set to one. Using this mask,
the function repeatedly checks the rightmost bit.
ANDing the mask with the value indicates whether the
-rightmost bit is 1 or not. If so, a @code{"1"} is concatenated onto the front
+rightmost bit is one or not. If so, a @code{"1"} is concatenated onto the front
of the string.
Otherwise, a @code{"0"} is added.
The value is then shifted right by one bit and the loop continues
-until there are no more 1 bits.
+until there are no more one bits.
If the initial value is zero, it returns a simple @code{"0"}.
Otherwise, at the end, it pads the value with zeros to represent multiples
@@ -18358,7 +18359,7 @@ that traverses every element of an array of arrays
@cindexgawkfunc{isarray}
@cindex scalar or array
@item isarray(@var{x})
-Return a true value if @var{x} is an array. Otherwise return false.
+Return a true value if @var{x} is an array. Otherwise, return false.
@end table
@code{isarray()} is meant for use in two circumstances. The first is when
@@ -18419,7 +18420,7 @@ The default value for @var{category} is @code{"LC_MESSAGES"}.
Return the plural form used for @var{number} of the
translation of @var{string1} and @var{string2} in text domain
@var{domain} for locale category @var{category}. @var{string1} is the
-English singular variant of a message, and @var{string2} the English plural
+English singular variant of a message, and @var{string2} is the English plural
variant of the same message.
The default value for @var{domain} is the current value of @code{TEXTDOMAIN}.
The default value for @var{category} is @code{"LC_MESSAGES"}.
@@ -18448,7 +18449,7 @@ them (i.e., to tell @command{awk} what they should do).
@subsection Function Definition Syntax
@quotation
-@i{It's entirely fair to say that the @command{awk} syntax for local
+@i{It's entirely fair to say that the awk syntax for local
variable definitions is appallingly awful.}
@author Brian Kernighan
@end quotation
@@ -18506,7 +18507,7 @@ it also enforces the second restriction.
Local variables act like the empty string if referenced where a string
value is required, and like zero if referenced where a numeric value
-is required. This is the same as regular variables that have never been
+is required. This is the same as the behavior of regular variables that have never been
assigned a value. (There is more to understand about local variables;
@pxref{Dynamic Typing}.)
@@ -18540,7 +18541,7 @@ During execution of the function body, the arguments and local variable
values hide, or @dfn{shadow}, any variables of the same names used in the
rest of the program. The shadowed variables are not accessible in the
function definition, because there is no way to name them while their
-names have been taken away for the local variables. All other variables
+names have been taken away for the arguments and local variables. All other variables
used in the @command{awk} program can be referenced or set normally in the
function's body.
@@ -18607,7 +18608,7 @@ function myprint(num)
@end example
@noindent
-To illustrate, here is an @command{awk} rule that uses our @code{myprint}
+To illustrate, here is an @command{awk} rule that uses our @code{myprint()}
function:
@example
@@ -18648,13 +18649,13 @@ in an array and start over with a new list of elements
(@pxref{Delete}).
Instead of having
to repeat this loop everywhere that you need to clear out
-an array, your program can just call @code{delarray}.
+an array, your program can just call @code{delarray()}.
(This guarantees portability. The use of @samp{delete @var{array}} to delete
the contents of an entire array is a relatively recent@footnote{Late in 2012.}
addition to the POSIX standard.)
The following is an example of a recursive function. It takes a string
-as an input parameter and returns the string in backwards order.
+as an input parameter and returns the string in reverse order.
Recursive functions must always have a test that stops the recursion.
In this case, the recursion terminates when the input string is
already empty:
@@ -18751,7 +18752,7 @@ an error.
@cindex local variables, in a function
@cindex variables, local to a function
-Unlike many languages,
+Unlike in many languages,
there is no way to make a variable local to a @code{@{} @dots{} @code{@}} block in
@command{awk}, but you can make a variable local to a function. It is
good practice to do so whenever a variable is needed only in that
@@ -18760,7 +18761,7 @@ function.
To make a variable local to a function, simply declare the variable as
an argument after the actual function arguments
(@pxref{Definition Syntax}).
-Look at the following example where variable
+Look at the following example, where variable
@code{i} is a global variable used by both functions @code{foo()} and
@code{bar()}:
@@ -18801,7 +18802,7 @@ foo's i=3
top's i=3
@end example
-If you want @code{i} to be local to both @code{foo()} and @code{bar()} do as
+If you want @code{i} to be local to both @code{foo()} and @code{bar()}, do as
follows (the extra space before @code{i} is a coding convention to
indicate that @code{i} is a local variable, not an argument):
@@ -18889,7 +18890,7 @@ declare explicitly whether the arguments are passed @dfn{by value} or
@dfn{by reference}.
Instead, the passing convention is determined at runtime when
-the function is called according to the following rule:
+the function is called, according to the following rule:
if the argument is an array variable, then it is passed by reference.
Otherwise, the argument is passed by value.
@@ -18966,7 +18967,7 @@ prints @samp{a[1] = 1, a[2] = two, a[3] = 3}, because
@cindex undefined functions
@cindex functions, undefined
Some @command{awk} implementations allow you to call a function that
-has not been defined. They only report a problem at runtime when the
+has not been defined. They only report a problem at runtime, when the
program actually tries to call the function. For example:
@example
@@ -19025,15 +19026,15 @@ makes the returned value undefined, and therefore, unpredictable.
In practice, though, all versions of @command{awk} simply return the
null string, which acts like zero if used in a numeric context.
-A @code{return} statement with no value expression is assumed at the end of
-every function definition. So if control reaches the end of the function
-body, then technically, the function returns an unpredictable value.
+A @code{return} statement without an @var{expression} is assumed at the end of
+every function definition. So, if control reaches the end of the function
+body, then technically the function returns an unpredictable value.
In practice, it returns the empty string. @command{awk}
does @emph{not} warn you if you use the return value of such a function.
Sometimes, you want to write a function for what it does, not for
what it returns. Such a function corresponds to a @code{void} function
-in C, C++ or Java, or to a @code{procedure} in Ada. Thus, it may be appropriate to not
+in C, C++, or Java, or to a @code{procedure} in Ada. Thus, it may be appropriate to not
return any value; simply bear in mind that you should not be using the
return value of such a function.
@@ -19152,13 +19153,15 @@ function calls, you can specify the name of the function to call as a
string variable, and then call the function. Let's look at an example.
Suppose you have a file with your test scores for the classes you
-are taking. The first field is the class name. The following fields
+are taking, and
+you wish to get the sum and the average of
+your test scores.
+The first field is the class name. The following fields
are the functions to call to process the data, up to a ``marker''
field @samp{data:}. Following the marker, to the end of the record,
are the various numeric test scores.
-Here is the initial file; you wish to get the sum and the average of
-your test scores:
+Here is the initial file:
@example
@c file eg/data/class_data1
@@ -19241,9 +19244,9 @@ function sum(first, last, ret, i)
@c endfile
@end example
-These two functions expect to work on fields; thus the parameters
+These two functions expect to work on fields; thus, the parameters
@code{first} and @code{last} indicate where in the fields to start and end.
-Otherwise they perform the expected computations and are not unusual:
+Otherwise, they perform the expected computations and are not unusual:
@example
@c file eg/prog/indirectcall.awk
@@ -19302,8 +19305,8 @@ The ability to use indirect function calls is more powerful than you may
think at first. The C and C++ languages provide ``function pointers,'' which
are a mechanism for calling a function chosen at runtime. One of the most
well-known uses of this ability is the C @code{qsort()} function, which sorts
-an array using the famous ``quick sort'' algorithm
-(see @uref{http://en.wikipedia.org/wiki/Quick_sort, the Wikipedia article}
+an array using the famous ``quicksort'' algorithm
+(see @uref{http://en.wikipedia.org/wiki/Quicksort, the Wikipedia article}
for more information). To use this function, you supply a pointer to a comparison
function. This mechanism allows you to sort arbitrary data in an arbitrary
fashion.
@@ -19322,11 +19325,11 @@ We can do something similar using @command{gawk}, like this:
# January 2009
@c endfile
-
@end ignore
@c file eg/lib/quicksort.awk
-# quicksort --- C.A.R. Hoare's quick sort algorithm. See Wikipedia
-# or almost any algorithms or computer science text
+
+# quicksort --- C.A.R. Hoare's quicksort algorithm. See Wikipedia
+# or almost any algorithms or computer science text.
@c endfile
@ignore
@c file eg/lib/quicksort.awk
@@ -19364,7 +19367,7 @@ function quicksort_swap(data, i, j, temp)
The @code{quicksort()} function receives the @code{data} array, the starting and ending
indices to sort (@code{left} and @code{right}), and the name of a function that
-performs a ``less than'' comparison. It then implements the quick sort algorithm.
+performs a ``less than'' comparison. It then implements the quicksort algorithm.
To make use of the sorting function, we return to our previous example. The
first thing to do is write some comparison functions: