[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-573
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-573-gec0a8d6 |
Date: |
Sun, 01 Feb 2015 19:49:01 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk-4.1-stable has been updated
via ec0a8d6c8ed3855b440aeb90b92088115212fb78 (commit)
from bcb51623b8e156b03c2ae588906e4ed25fa3eba2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=ec0a8d6c8ed3855b440aeb90b92088115212fb78
commit ec0a8d6c8ed3855b440aeb90b92088115212fb78
Author: Arnold D. Robbins <address@hidden>
Date: Sun Feb 1 21:48:46 2015 +0200
More O'Reilly fixes.
diff --git a/awklib/eg/lib/quicksort.awk b/awklib/eg/lib/quicksort.awk
index 3ba2d6e..e0ed8bc 100644
--- a/awklib/eg/lib/quicksort.awk
+++ b/awklib/eg/lib/quicksort.awk
@@ -4,8 +4,9 @@
# Arnold Robbins, address@hidden, 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 904cd32..865e343 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 <address@hidden>
* gawktexi.in: Document POSIX requirement that function parameters
diff --git a/doc/gawk.info b/doc/gawk.info
index ca16811..0e8bcb5 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -13317,13 +13317,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
@@ -13352,7 +13353,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
@@ -13399,8 +13400,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"'.
@@ -13429,7 +13430,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
@@ -13472,9 +13473,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
@@ -13503,9 +13504,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
@@ -13558,7 +13559,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) }
@@ -13587,13 +13588,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:
@@ -13684,14 +13685,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()
@@ -13727,7 +13728,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):
@@ -13809,7 +13810,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.
@@ -13867,7 +13868,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 {
@@ -13912,15 +13913,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.
@@ -14026,13 +14027,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
@@ -14090,9 +14091,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
{
@@ -14145,18 +14146,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)
{
@@ -14185,7 +14187,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:
@@ -34723,307 +34725,307 @@ Ref: Time Functions-Footnote-5557272
Ref: Time Functions-Footnote-6557499
Node: Bitwise Functions557765
Ref: table-bitwise-ops558327
-Ref: Bitwise Functions-Footnote-1562639
-Node: Type Functions562811
-Node: I18N Functions563962
-Node: User-defined565607
-Node: Definition Syntax566412
-Ref: Definition Syntax-Footnote-1572044
-Node: Function Example572115
-Ref: Function Example-Footnote-1575034
-Node: Function Caveats575056
-Node: Calling A Function575574
-Node: Variable Scope576532
-Node: Pass By Value/Reference579520
-Node: Return Statement583015
-Node: Dynamic Typing585996
-Node: Indirect Calls586925
-Ref: Indirect Calls-Footnote-1598227
-Node: Functions Summary598355
-Node: Library Functions601057
-Ref: Library Functions-Footnote-1604666
-Ref: Library Functions-Footnote-2604809
-Node: Library Names604980
-Ref: Library Names-Footnote-1608434
-Ref: Library Names-Footnote-2608657
-Node: General Functions608743
-Node: Strtonum Function609846
-Node: Assert Function612868
-Node: Round Function616192
-Node: Cliff Random Function617733
-Node: Ordinal Functions618749
-Ref: Ordinal Functions-Footnote-1621812
-Ref: Ordinal Functions-Footnote-2622064
-Node: Join Function622275
-Ref: Join Function-Footnote-1624044
-Node: Getlocaltime Function624244
-Node: Readfile Function627988
-Node: Shell Quoting629958
-Node: Data File Management631359
-Node: Filetrans Function631991
-Node: Rewind Function636047
-Node: File Checking637434
-Ref: File Checking-Footnote-1638766
-Node: Empty Files638967
-Node: Ignoring Assigns640946
-Node: Getopt Function642497
-Ref: Getopt Function-Footnote-1653959
-Node: Passwd Functions654159
-Ref: Passwd Functions-Footnote-1662996
-Node: Group Functions663084
-Ref: Group Functions-Footnote-1670978
-Node: Walking Arrays671191
-Node: Library Functions Summary672794
-Node: Library Exercises674195
-Node: Sample Programs675475
-Node: Running Examples676245
-Node: Clones676973
-Node: Cut Program678197
-Node: Egrep Program687916
-Ref: Egrep Program-Footnote-1695414
-Node: Id Program695524
-Node: Split Program699169
-Ref: Split Program-Footnote-1702617
-Node: Tee Program702745
-Node: Uniq Program705534
-Node: Wc Program712953
-Ref: Wc Program-Footnote-1717203
-Node: Miscellaneous Programs717297
-Node: Dupword Program718510
-Node: Alarm Program720541
-Node: Translate Program725345
-Ref: Translate Program-Footnote-1729910
-Node: Labels Program730180
-Ref: Labels Program-Footnote-1733531
-Node: Word Sorting733615
-Node: History Sorting737686
-Node: Extract Program739522
-Node: Simple Sed747047
-Node: Igawk Program750115
-Ref: Igawk Program-Footnote-1764439
-Ref: Igawk Program-Footnote-2764640
-Ref: Igawk Program-Footnote-3764762
-Node: Anagram Program764877
-Node: Signature Program767934
-Node: Programs Summary769181
-Node: Programs Exercises770374
-Ref: Programs Exercises-Footnote-1774505
-Node: Advanced Features774596
-Node: Nondecimal Data776544
-Node: Array Sorting778134
-Node: Controlling Array Traversal778831
-Ref: Controlling Array Traversal-Footnote-1787164
-Node: Array Sorting Functions787282
-Ref: Array Sorting Functions-Footnote-1791171
-Node: Two-way I/O791367
-Ref: Two-way I/O-Footnote-1796312
-Ref: Two-way I/O-Footnote-2796498
-Node: TCP/IP Networking796580
-Node: Profiling799453
-Node: Advanced Features Summary807000
-Node: Internationalization808933
-Node: I18N and L10N810413
-Node: Explaining gettext811099
-Ref: Explaining gettext-Footnote-1816124
-Ref: Explaining gettext-Footnote-2816308
-Node: Programmer i18n816473
-Ref: Programmer i18n-Footnote-1821339
-Node: Translator i18n821388
-Node: String Extraction822182
-Ref: String Extraction-Footnote-1823313
-Node: Printf Ordering823399
-Ref: Printf Ordering-Footnote-1826185
-Node: I18N Portability826249
-Ref: I18N Portability-Footnote-1828704
-Node: I18N Example828767
-Ref: I18N Example-Footnote-1831570
-Node: Gawk I18N831642
-Node: I18N Summary832280
-Node: Debugger833619
-Node: Debugging834641
-Node: Debugging Concepts835082
-Node: Debugging Terms836935
-Node: Awk Debugging839507
-Node: Sample Debugging Session840401
-Node: Debugger Invocation840921
-Node: Finding The Bug842305
-Node: List of Debugger Commands848780
-Node: Breakpoint Control850113
-Node: Debugger Execution Control853809
-Node: Viewing And Changing Data857173
-Node: Execution Stack860551
-Node: Debugger Info862188
-Node: Miscellaneous Debugger Commands866205
-Node: Readline Support871234
-Node: Limitations872126
-Node: Debugging Summary874240
-Node: Arbitrary Precision Arithmetic875408
-Node: Computer Arithmetic876824
-Ref: table-numeric-ranges880422
-Ref: Computer Arithmetic-Footnote-1881281
-Node: Math Definitions881338
-Ref: table-ieee-formats884626
-Ref: Math Definitions-Footnote-1885230
-Node: MPFR features885335
-Node: FP Math Caution887006
-Ref: FP Math Caution-Footnote-1888056
-Node: Inexactness of computations888425
-Node: Inexact representation889384
-Node: Comparing FP Values890741
-Node: Errors accumulate891823
-Node: Getting Accuracy893256
-Node: Try To Round895918
-Node: Setting precision896817
-Ref: table-predefined-precision-strings897501
-Node: Setting the rounding mode899290
-Ref: table-gawk-rounding-modes899654
-Ref: Setting the rounding mode-Footnote-1903109
-Node: Arbitrary Precision Integers903288
-Ref: Arbitrary Precision Integers-Footnote-1906274
-Node: POSIX Floating Point Problems906423
-Ref: POSIX Floating Point Problems-Footnote-1910296
-Node: Floating point summary910334
-Node: Dynamic Extensions912528
-Node: Extension Intro914080
-Node: Plugin License915346
-Node: Extension Mechanism Outline916143
-Ref: figure-load-extension916571
-Ref: figure-register-new-function918051
-Ref: figure-call-new-function919055
-Node: Extension API Description921041
-Node: Extension API Functions Introduction922491
-Node: General Data Types927315
-Ref: General Data Types-Footnote-1933054
-Node: Memory Allocation Functions933353
-Ref: Memory Allocation Functions-Footnote-1936192
-Node: Constructor Functions936288
-Node: Registration Functions938022
-Node: Extension Functions938707
-Node: Exit Callback Functions941004
-Node: Extension Version String942252
-Node: Input Parsers942917
-Node: Output Wrappers952796
-Node: Two-way processors957311
-Node: Printing Messages959515
-Ref: Printing Messages-Footnote-1960591
-Node: Updating `ERRNO'960743
-Node: Requesting Values961483
-Ref: table-value-types-returned962211
-Node: Accessing Parameters963168
-Node: Symbol Table Access964399
-Node: Symbol table by name964913
-Node: Symbol table by cookie966894
-Ref: Symbol table by cookie-Footnote-1971038
-Node: Cached values971101
-Ref: Cached values-Footnote-1974600
-Node: Array Manipulation974691
-Ref: Array Manipulation-Footnote-1975789
-Node: Array Data Types975826
-Ref: Array Data Types-Footnote-1978481
-Node: Array Functions978573
-Node: Flattening Arrays982427
-Node: Creating Arrays989319
-Node: Extension API Variables994090
-Node: Extension Versioning994726
-Node: Extension API Informational Variables996627
-Node: Extension API Boilerplate997692
-Node: Finding Extensions1001501
-Node: Extension Example1002061
-Node: Internal File Description1002833
-Node: Internal File Ops1006900
-Ref: Internal File Ops-Footnote-11018570
-Node: Using Internal File Ops1018710
-Ref: Using Internal File Ops-Footnote-11021093
-Node: Extension Samples1021366
-Node: Extension Sample File Functions1022892
-Node: Extension Sample Fnmatch1030530
-Node: Extension Sample Fork1032021
-Node: Extension Sample Inplace1033236
-Node: Extension Sample Ord1034911
-Node: Extension Sample Readdir1035747
-Ref: table-readdir-file-types1036623
-Node: Extension Sample Revout1037434
-Node: Extension Sample Rev2way1038024
-Node: Extension Sample Read write array1038764
-Node: Extension Sample Readfile1040704
-Node: Extension Sample Time1041799
-Node: Extension Sample API Tests1043148
-Node: gawkextlib1043639
-Node: Extension summary1046297
-Node: Extension Exercises1049986
-Node: Language History1050708
-Node: V7/SVR3.11052364
-Node: SVR41054545
-Node: POSIX1055990
-Node: BTL1057379
-Node: POSIX/GNU1058113
-Node: Feature History1063677
-Node: Common Extensions1076775
-Node: Ranges and Locales1078099
-Ref: Ranges and Locales-Footnote-11082717
-Ref: Ranges and Locales-Footnote-21082744
-Ref: Ranges and Locales-Footnote-31082978
-Node: Contributors1083199
-Node: History summary1088740
-Node: Installation1090110
-Node: Gawk Distribution1091056
-Node: Getting1091540
-Node: Extracting1092363
-Node: Distribution contents1093998
-Node: Unix Installation1099715
-Node: Quick Installation1100332
-Node: Additional Configuration Options1102756
-Node: Configuration Philosophy1104494
-Node: Non-Unix Installation1106863
-Node: PC Installation1107321
-Node: PC Binary Installation1108640
-Node: PC Compiling1110488
-Ref: PC Compiling-Footnote-11113509
-Node: PC Testing1113618
-Node: PC Using1114794
-Node: Cygwin1118909
-Node: MSYS1119732
-Node: VMS Installation1120232
-Node: VMS Compilation1121024
-Ref: VMS Compilation-Footnote-11122246
-Node: VMS Dynamic Extensions1122304
-Node: VMS Installation Details1123988
-Node: VMS Running1126240
-Node: VMS GNV1129076
-Node: VMS Old Gawk1129810
-Node: Bugs1130280
-Node: Other Versions1134163
-Node: Installation summary1140587
-Node: Notes1141643
-Node: Compatibility Mode1142508
-Node: Additions1143290
-Node: Accessing The Source1144215
-Node: Adding Code1145650
-Node: New Ports1151807
-Node: Derived Files1156289
-Ref: Derived Files-Footnote-11161764
-Ref: Derived Files-Footnote-21161798
-Ref: Derived Files-Footnote-31162394
-Node: Future Extensions1162508
-Node: Implementation Limitations1163114
-Node: Extension Design1164362
-Node: Old Extension Problems1165516
-Ref: Old Extension Problems-Footnote-11167033
-Node: Extension New Mechanism Goals1167090
-Ref: Extension New Mechanism Goals-Footnote-11170450
-Node: Extension Other Design Decisions1170639
-Node: Extension Future Growth1172747
-Node: Old Extension Mechanism1173583
-Node: Notes summary1175345
-Node: Basic Concepts1176531
-Node: Basic High Level1177212
-Ref: figure-general-flow1177484
-Ref: figure-process-flow1178083
-Ref: Basic High Level-Footnote-11181312
-Node: Basic Data Typing1181497
-Node: Glossary1184825
-Node: Copying1216754
-Node: GNU Free Documentation License1254310
-Node: Index1279446
+Ref: Bitwise Functions-Footnote-1562655
+Node: Type Functions562827
+Node: I18N Functions563979
+Node: User-defined565626
+Node: Definition Syntax566431
+Ref: Definition Syntax-Footnote-1572090
+Node: Function Example572161
+Ref: Function Example-Footnote-1575082
+Node: Function Caveats575104
+Node: Calling A Function575622
+Node: Variable Scope576580
+Node: Pass By Value/Reference579573
+Node: Return Statement583070
+Node: Dynamic Typing586049
+Node: Indirect Calls586978
+Ref: Indirect Calls-Footnote-1598284
+Node: Functions Summary598412
+Node: Library Functions601114
+Ref: Library Functions-Footnote-1604723
+Ref: Library Functions-Footnote-2604866
+Node: Library Names605037
+Ref: Library Names-Footnote-1608491
+Ref: Library Names-Footnote-2608714
+Node: General Functions608800
+Node: Strtonum Function609903
+Node: Assert Function612925
+Node: Round Function616249
+Node: Cliff Random Function617790
+Node: Ordinal Functions618806
+Ref: Ordinal Functions-Footnote-1621869
+Ref: Ordinal Functions-Footnote-2622121
+Node: Join Function622332
+Ref: Join Function-Footnote-1624101
+Node: Getlocaltime Function624301
+Node: Readfile Function628045
+Node: Shell Quoting630015
+Node: Data File Management631416
+Node: Filetrans Function632048
+Node: Rewind Function636104
+Node: File Checking637491
+Ref: File Checking-Footnote-1638823
+Node: Empty Files639024
+Node: Ignoring Assigns641003
+Node: Getopt Function642554
+Ref: Getopt Function-Footnote-1654016
+Node: Passwd Functions654216
+Ref: Passwd Functions-Footnote-1663053
+Node: Group Functions663141
+Ref: Group Functions-Footnote-1671035
+Node: Walking Arrays671248
+Node: Library Functions Summary672851
+Node: Library Exercises674252
+Node: Sample Programs675532
+Node: Running Examples676302
+Node: Clones677030
+Node: Cut Program678254
+Node: Egrep Program687973
+Ref: Egrep Program-Footnote-1695471
+Node: Id Program695581
+Node: Split Program699226
+Ref: Split Program-Footnote-1702674
+Node: Tee Program702802
+Node: Uniq Program705591
+Node: Wc Program713010
+Ref: Wc Program-Footnote-1717260
+Node: Miscellaneous Programs717354
+Node: Dupword Program718567
+Node: Alarm Program720598
+Node: Translate Program725402
+Ref: Translate Program-Footnote-1729967
+Node: Labels Program730237
+Ref: Labels Program-Footnote-1733588
+Node: Word Sorting733672
+Node: History Sorting737743
+Node: Extract Program739579
+Node: Simple Sed747104
+Node: Igawk Program750172
+Ref: Igawk Program-Footnote-1764496
+Ref: Igawk Program-Footnote-2764697
+Ref: Igawk Program-Footnote-3764819
+Node: Anagram Program764934
+Node: Signature Program767991
+Node: Programs Summary769238
+Node: Programs Exercises770431
+Ref: Programs Exercises-Footnote-1774562
+Node: Advanced Features774653
+Node: Nondecimal Data776601
+Node: Array Sorting778191
+Node: Controlling Array Traversal778888
+Ref: Controlling Array Traversal-Footnote-1787221
+Node: Array Sorting Functions787339
+Ref: Array Sorting Functions-Footnote-1791228
+Node: Two-way I/O791424
+Ref: Two-way I/O-Footnote-1796369
+Ref: Two-way I/O-Footnote-2796555
+Node: TCP/IP Networking796637
+Node: Profiling799510
+Node: Advanced Features Summary807057
+Node: Internationalization808990
+Node: I18N and L10N810470
+Node: Explaining gettext811156
+Ref: Explaining gettext-Footnote-1816181
+Ref: Explaining gettext-Footnote-2816365
+Node: Programmer i18n816530
+Ref: Programmer i18n-Footnote-1821396
+Node: Translator i18n821445
+Node: String Extraction822239
+Ref: String Extraction-Footnote-1823370
+Node: Printf Ordering823456
+Ref: Printf Ordering-Footnote-1826242
+Node: I18N Portability826306
+Ref: I18N Portability-Footnote-1828761
+Node: I18N Example828824
+Ref: I18N Example-Footnote-1831627
+Node: Gawk I18N831699
+Node: I18N Summary832337
+Node: Debugger833676
+Node: Debugging834698
+Node: Debugging Concepts835139
+Node: Debugging Terms836992
+Node: Awk Debugging839564
+Node: Sample Debugging Session840458
+Node: Debugger Invocation840978
+Node: Finding The Bug842362
+Node: List of Debugger Commands848837
+Node: Breakpoint Control850170
+Node: Debugger Execution Control853866
+Node: Viewing And Changing Data857230
+Node: Execution Stack860608
+Node: Debugger Info862245
+Node: Miscellaneous Debugger Commands866262
+Node: Readline Support871291
+Node: Limitations872183
+Node: Debugging Summary874297
+Node: Arbitrary Precision Arithmetic875465
+Node: Computer Arithmetic876881
+Ref: table-numeric-ranges880479
+Ref: Computer Arithmetic-Footnote-1881338
+Node: Math Definitions881395
+Ref: table-ieee-formats884683
+Ref: Math Definitions-Footnote-1885287
+Node: MPFR features885392
+Node: FP Math Caution887063
+Ref: FP Math Caution-Footnote-1888113
+Node: Inexactness of computations888482
+Node: Inexact representation889441
+Node: Comparing FP Values890798
+Node: Errors accumulate891880
+Node: Getting Accuracy893313
+Node: Try To Round895975
+Node: Setting precision896874
+Ref: table-predefined-precision-strings897558
+Node: Setting the rounding mode899347
+Ref: table-gawk-rounding-modes899711
+Ref: Setting the rounding mode-Footnote-1903166
+Node: Arbitrary Precision Integers903345
+Ref: Arbitrary Precision Integers-Footnote-1906331
+Node: POSIX Floating Point Problems906480
+Ref: POSIX Floating Point Problems-Footnote-1910353
+Node: Floating point summary910391
+Node: Dynamic Extensions912585
+Node: Extension Intro914137
+Node: Plugin License915403
+Node: Extension Mechanism Outline916200
+Ref: figure-load-extension916628
+Ref: figure-register-new-function918108
+Ref: figure-call-new-function919112
+Node: Extension API Description921098
+Node: Extension API Functions Introduction922548
+Node: General Data Types927372
+Ref: General Data Types-Footnote-1933111
+Node: Memory Allocation Functions933410
+Ref: Memory Allocation Functions-Footnote-1936249
+Node: Constructor Functions936345
+Node: Registration Functions938079
+Node: Extension Functions938764
+Node: Exit Callback Functions941061
+Node: Extension Version String942309
+Node: Input Parsers942974
+Node: Output Wrappers952853
+Node: Two-way processors957368
+Node: Printing Messages959572
+Ref: Printing Messages-Footnote-1960648
+Node: Updating `ERRNO'960800
+Node: Requesting Values961540
+Ref: table-value-types-returned962268
+Node: Accessing Parameters963225
+Node: Symbol Table Access964456
+Node: Symbol table by name964970
+Node: Symbol table by cookie966951
+Ref: Symbol table by cookie-Footnote-1971095
+Node: Cached values971158
+Ref: Cached values-Footnote-1974657
+Node: Array Manipulation974748
+Ref: Array Manipulation-Footnote-1975846
+Node: Array Data Types975883
+Ref: Array Data Types-Footnote-1978538
+Node: Array Functions978630
+Node: Flattening Arrays982484
+Node: Creating Arrays989376
+Node: Extension API Variables994147
+Node: Extension Versioning994783
+Node: Extension API Informational Variables996684
+Node: Extension API Boilerplate997749
+Node: Finding Extensions1001558
+Node: Extension Example1002118
+Node: Internal File Description1002890
+Node: Internal File Ops1006957
+Ref: Internal File Ops-Footnote-11018627
+Node: Using Internal File Ops1018767
+Ref: Using Internal File Ops-Footnote-11021150
+Node: Extension Samples1021423
+Node: Extension Sample File Functions1022949
+Node: Extension Sample Fnmatch1030587
+Node: Extension Sample Fork1032078
+Node: Extension Sample Inplace1033293
+Node: Extension Sample Ord1034968
+Node: Extension Sample Readdir1035804
+Ref: table-readdir-file-types1036680
+Node: Extension Sample Revout1037491
+Node: Extension Sample Rev2way1038081
+Node: Extension Sample Read write array1038821
+Node: Extension Sample Readfile1040761
+Node: Extension Sample Time1041856
+Node: Extension Sample API Tests1043205
+Node: gawkextlib1043696
+Node: Extension summary1046354
+Node: Extension Exercises1050043
+Node: Language History1050765
+Node: V7/SVR3.11052421
+Node: SVR41054602
+Node: POSIX1056047
+Node: BTL1057436
+Node: POSIX/GNU1058170
+Node: Feature History1063734
+Node: Common Extensions1076832
+Node: Ranges and Locales1078156
+Ref: Ranges and Locales-Footnote-11082774
+Ref: Ranges and Locales-Footnote-21082801
+Ref: Ranges and Locales-Footnote-31083035
+Node: Contributors1083256
+Node: History summary1088797
+Node: Installation1090167
+Node: Gawk Distribution1091113
+Node: Getting1091597
+Node: Extracting1092420
+Node: Distribution contents1094055
+Node: Unix Installation1099772
+Node: Quick Installation1100389
+Node: Additional Configuration Options1102813
+Node: Configuration Philosophy1104551
+Node: Non-Unix Installation1106920
+Node: PC Installation1107378
+Node: PC Binary Installation1108697
+Node: PC Compiling1110545
+Ref: PC Compiling-Footnote-11113566
+Node: PC Testing1113675
+Node: PC Using1114851
+Node: Cygwin1118966
+Node: MSYS1119789
+Node: VMS Installation1120289
+Node: VMS Compilation1121081
+Ref: VMS Compilation-Footnote-11122303
+Node: VMS Dynamic Extensions1122361
+Node: VMS Installation Details1124045
+Node: VMS Running1126297
+Node: VMS GNV1129133
+Node: VMS Old Gawk1129867
+Node: Bugs1130337
+Node: Other Versions1134220
+Node: Installation summary1140644
+Node: Notes1141700
+Node: Compatibility Mode1142565
+Node: Additions1143347
+Node: Accessing The Source1144272
+Node: Adding Code1145707
+Node: New Ports1151864
+Node: Derived Files1156346
+Ref: Derived Files-Footnote-11161821
+Ref: Derived Files-Footnote-21161855
+Ref: Derived Files-Footnote-31162451
+Node: Future Extensions1162565
+Node: Implementation Limitations1163171
+Node: Extension Design1164419
+Node: Old Extension Problems1165573
+Ref: Old Extension Problems-Footnote-11167090
+Node: Extension New Mechanism Goals1167147
+Ref: Extension New Mechanism Goals-Footnote-11170507
+Node: Extension Other Design Decisions1170696
+Node: Extension Future Growth1172804
+Node: Old Extension Mechanism1173640
+Node: Notes summary1175402
+Node: Basic Concepts1176588
+Node: Basic High Level1177269
+Ref: figure-general-flow1177541
+Ref: figure-process-flow1178140
+Ref: Basic High Level-Footnote-11181369
+Node: Basic Data Typing1181554
+Node: Glossary1184882
+Node: Copying1216811
+Node: GNU Free Documentation License1254367
+Node: Index1279503
End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 7e8d93d..6b37e74 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -19172,15 +19172,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
@@ -19204,7 +19205,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
@@ -19265,7 +19266,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"}.
@@ -19294,7 +19295,7 @@ them (i.e., to tell @command{awk} what they should do).
@subsection Function Definition Syntax
@quotation
address@hidden's entirely fair to say that the @command{awk} syntax for local
address@hidden's entirely fair to say that the awk syntax for local
variable definitions is appallingly awful.}
@author Brian Kernighan
@end quotation
@@ -19352,7 +19353,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}.)
@@ -19386,7 +19387,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.
@@ -19453,7 +19454,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
@@ -19494,13 +19495,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 address@hidden 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:
@@ -19597,7 +19598,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 @address@hidden @dots{}
@address@hidden 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
@@ -19606,7 +19607,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()}:
@@ -19647,7 +19648,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):
@@ -19735,7 +19736,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.
@@ -19812,7 +19813,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
@@ -19871,15 +19872,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.
@@ -19998,13 +19999,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
@@ -20087,9 +20090,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
@@ -20148,8 +20151,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.
@@ -20168,11 +20171,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
@@ -20210,7 +20213,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 125e840..cc021c9 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -18293,15 +18293,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
@@ -18325,7 +18326,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
@@ -18386,7 +18387,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"}.
@@ -18415,7 +18416,7 @@ them (i.e., to tell @command{awk} what they should do).
@subsection Function Definition Syntax
@quotation
address@hidden's entirely fair to say that the @command{awk} syntax for local
address@hidden's entirely fair to say that the awk syntax for local
variable definitions is appallingly awful.}
@author Brian Kernighan
@end quotation
@@ -18473,7 +18474,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}.)
@@ -18507,7 +18508,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.
@@ -18574,7 +18575,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
@@ -18615,13 +18616,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 address@hidden 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:
@@ -18718,7 +18719,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 @address@hidden @dots{}
@address@hidden 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
@@ -18727,7 +18728,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()}:
@@ -18768,7 +18769,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):
@@ -18856,7 +18857,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.
@@ -18933,7 +18934,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
@@ -18992,15 +18993,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.
@@ -19119,13 +19120,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
@@ -19208,9 +19211,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
@@ -19269,8 +19272,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.
@@ -19289,11 +19292,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
@@ -19331,7 +19334,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:
-----------------------------------------------------------------------
Summary of changes:
awklib/eg/lib/quicksort.awk | 5 +-
doc/ChangeLog | 2 +
doc/gawk.info | 688 ++++++++++++++++++++++---------------------
doc/gawk.texi | 67 +++--
doc/gawktexi.in | 67 +++--
5 files changed, 420 insertions(+), 409 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-573-gec0a8d6,
Arnold Robbins <=