gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, master, updated. 8b6115459066a2adf536973


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. 8b6115459066a2adf536973fe5670c174bcd218c
Date: Mon, 09 May 2011 12:59:45 +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, master has been updated
       via  8b6115459066a2adf536973fe5670c174bcd218c (commit)
      from  40d4dae999918332bdbafbf51ba060db34fe254d (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=8b6115459066a2adf536973fe5670c174bcd218c

commit 8b6115459066a2adf536973fe5670c174bcd218c
Author: Arnold D. Robbins <address@hidden>
Date:   Mon May 9 15:59:21 2011 +0300

    Finish the doc.

diff --git a/doc/ChangeLog b/doc/ChangeLog
index fe25e16..de47ba1 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,7 @@
+Mon May  9 15:58:33 2011  Arnold D. Robbins  <address@hidden>
+
+       * gawk.texi: Finish array sorting and do a spell check.
+
 Fri May  6 13:21:20 2011  Arnold D. Robbins  <address@hidden>
 
        * gawk.texi: Finish edits after full read through.
diff --git a/doc/gawk.info b/doc/gawk.info
index 3bdf268..9d6774f 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -826,7 +826,7 @@ differences between `gawk' and other `awk' 
implementations.(1) Finally,
 any `gawk' features that are not in the POSIX standard for `awk' are
 noted.
 
-   There are subsections labelled as *Advanced Notes* scattered
+   There are subsections labeled as *Advanced Notes* scattered
 throughout the Info file.  They add a more complete explanation of
 points that are relevant, but not likely to be of interest on first
 reading.  All appear in the index, under the heading "advanced
@@ -6206,7 +6206,7 @@ error message in a `gawk' program is to use 
`/dev/stderr', like this:
 redirection, the value must be a string.  It is a common error to omit
 the quotes, which leads to confusing results.
 
-   Finally, usng the `close()' function on a file name of the form
+   Finally, using the `close()' function on a file name of the form
 `"/dev/fd/N"', for file descriptor numbers above two, will actually
 close the given file descriptor.
 
@@ -13487,7 +13487,7 @@ File: gawk.info,  Node: Controlling Scanning With A 
Function,  Next: Controlling
 The value of `PROCINFO["sorted_in"]' can be a function name.  This lets
 you traverse an array based on any custom criterion.  The array
 elements are ordered according to the return value of this function.
-This comparison function should be defined with at least four arguments:
+The comparison function should be defined with at least four arguments:
 
      function comp_func(i1, v1, i2, v2)
      {
@@ -13507,12 +13507,10 @@ values.  The three possible return values are 
interpreted this way:
      Indices I1 and I2 come together but the relative order with
      respect to each other is undefined.
 
-`'
-
 `comp_func(i1, v1, i2, v2) > 0'
      Index I1 comes after index I2 during loop traversal.
 
-   The following comparison function can be used to scan an array in
+   Our first comparison function can be used to scan an array in
 numerical order of the indices:
 
      function cmp_num_idx(i1, v1, i2, v2)
@@ -13521,8 +13519,8 @@ numerical order of the indices:
           return (i1 - i2)
      }
 
-   This function traverses an array based on the string order of the
-element values rather than by indices:
+   Our second function traverses an array based on the string order of
+the element values rather than by indices:
 
      function cmp_str_val(i1, v1, i2, v2)
      {
@@ -13534,9 +13532,9 @@ element values rather than by indices:
          return (v1 != v2)
      }
 
-   Here is a comparison function to make all numbers, and numeric
-strings without any leading or trailing spaces, come out first during
-loop traversal:
+   The third comparison function makes all numbers, and numeric strings
+without any leading or trailing spaces, come out first during loop
+traversal:
 
      function cmp_num_str_val(i1, v1, i2, v2,   n1, n2)
      {
@@ -13576,25 +13574,25 @@ of the previous functions:
 
      $ gawk -f compdemo.awk
      -| Sort function: cmp_num_idx      Sort by numeric index
-     -|        data[two] = 20
-     -|        data[one] = 10           Both strings are numerically zero
-     -|        data[10] = one
-     -|        data[20] = two
-     -|        data[100] = 100
+     -|     data[two] = 20
+     -|     data[one] = 10              Both strings are numerically zero
+     -|     data[10] = one
+     -|     data[20] = two
+     -|     data[100] = 100
      -|
-     -| Sort function: cmp_str_val      Compare values as strings
-     -|        data[one] = 10
-     -|        data[100] = 100          String 100 is less than string 20
-     -|        data[two] = 20
-     -|        data[10] = one
-     -|        data[20] = two
+     -| Sort function: cmp_str_val      Sort by element values as strings
+     -|     data[one] = 10
+     -|     data[100] = 100             String 100 is less than string 20
+     -|     data[two] = 20
+     -|     data[10] = one
+     -|     data[20] = two
      -|
-     -| Sort function: cmp_num_str_val  All numbers before all strings
-     -|        data[one] = 10
-     -|        data[two] = 20
-     -|        data[100] = 100
-     -|        data[10] = one
-     -|        data[20] = two
+     -| Sort function: cmp_num_str_val  Sort all numbers before all strings
+     -|     data[one] = 10
+     -|     data[two] = 20
+     -|     data[100] = 100
+     -|     data[10] = one
+     -|     data[20] = two
 
    Consider sorting the entries of a GNU/Linux system password file
 according to login names.  The following program sorts records by a
@@ -13627,8 +13625,9 @@ specific field position and can be used for this 
purpose:
 
    The first field in each entry of the password file is the user's
 login name, and the fields are seperated by colons.  Each record
-defines a subarray, with each field as an element in the subarray.
-Running the program produces the following output:
+defines a subarray (*note Arrays of Arrays::), with each field as an
+element in the subarray.  Running the program produces the following
+output:
 
      $ gawk -vPOS=1 -F: -f sort.awk /etc/passwd
      -| adm:x:3:4:adm:/var/adm:/sbin/nologin
@@ -13636,10 +13635,10 @@ Running the program produces the following output:
      -| avahi:x:70:70:Avahi daemon:/:/sbin/nologin
      ...
 
-   The comparison normally should always return the same value when
+   The comparison should normally always return the same value when
 given a specific pair of array elements as its arguments.  If
 inconsistent results are returned then the order is undefined.  This
-behavior is sometimes exploited to introduce random order in otherwise
+behavior can be exploited to introduce random order into otherwise
 seemingly ordered data:
 
      function cmp_randomize(i1, v1, i2, v2)
@@ -13675,8 +13674,8 @@ fact that the indices of two elements are never equal:
      }
 
    A custom comparison function can often simplify ordered loop
-traversal, and the the sky is really the limit when it comes to
-designing such a function.
+traversal, and the sky is really the limit when it comes to designing
+such a function.
 
    When string comparisons are made during a sort, either for element
 values where one or both aren't numbers, or for element indices handled
@@ -13711,7 +13710,7 @@ to specify custom sorting criteria.
 based on comparing the indices in ascending order," or "sort based on
 comparing the values in descending order."  Having to write a simple
 comparison function for this purpose for use in all of your programs
-becomes tedious.  For the most likely simple cases `gawk' provides the
+becomes tedious.  For the common simple cases, `gawk' provides the
 option of supplying special names that do the requested sorting for you.
 You can think of them as "predefined" sorting functions, if you like,
 although the names purposely include characters that are not valid in
@@ -13722,12 +13721,12 @@ real `awk' function names.
 `"@ind_str_asc"'
      Order by indices compared as strings; this is the most basic sort.
      (Internally, array indices are always strings, so with `a[2*5] = 1'
-     the index is actually `"10"' rather than numeric 10.)
+     the index is `"10"' rather than numeric 10.)
 
 `"@ind_num_asc"'
      Order by indices but force them to be treated as numbers in the
-     process.  Any index with non-numeric value will end up positioned
-     as if it were zero.
+     process.  Any index with a non-numeric value will end up
+     positioned as if it were zero.
 
 `"@val_type_asc"'
      Order by element values rather than indices.  Ordering is by the
@@ -13740,12 +13739,11 @@ real `awk' function names.
      compared as strings.  Subarrays, if present, come out last.
 
 `"@val_num_asc"'
-     Order by element values but force scalar values to be treated as
-     numbers for the purpose of comparison.  If there are subarrays,
-     those appear at the end of the sorted list.  When numeric values
-     are equal, the string values are used to provide an ordering: this
-     guarantees consistent results across different operating systems
-     and/or library versions of the C `qsort()' function.
+     Order by element values rather than by indices.  Scalar values are
+     compared as numbers.  Subarrays, if present, come out last.  When
+     numeric values are equal, the string values are used to provide an
+     ordering: this guarantees consistent results across different
+     versions of the C `qsort()' function.(1)
 
 `"@ind_str_desc"'
      Reverse order from the most basic sort.
@@ -13800,19 +13798,25 @@ value, regardless of what the subarray itself 
contains, and all
 subarrays are treated as being equal to each other.  Their order
 relative to each other is determined by their index strings.
 
+   ---------- Footnotes ----------
+
+   (1) When two elements compare as equal, the C `qsort()' function
+does not guarantee that they will maintain their original relative
+order after sorting.  Using the string value to provide a unique
+ordering when the numeric values are equal ensures that `gawk' behaves
+consistently across different environments.
+
 
 File: gawk.info,  Node: Array Sorting Functions,  Prev: Controlling Array 
Traversal,  Up: Array Sorting
 
 11.2.2 Sorting Array Values and Indices with `gawk'
 ---------------------------------------------------
 
-The order in which an array is scanned with a `for (i in array)' loop
-is essentially arbitrary.  In most `awk' implementations, sorting an
-array requires writing a `sort' function.  While this can be
-educational for exploring different sorting algorithms, usually that's
-not the point of the program.  `gawk' provides the built-in `asort()'
-and `asorti()' functions (*note String Functions::) for sorting arrays.
-For example:
+In most `awk' implementations, sorting an array requires writing a
+`sort' function.  While this can be educational for exploring different
+sorting algorithms, usually that's not the point of the program.
+`gawk' provides the built-in `asort()' and `asorti()' functions (*note
+String Functions::) for sorting arrays.  For example:
 
      POPULATE THE ARRAY data
      n = asort(data)
@@ -13837,12 +13841,14 @@ desirable, `asort()' accepts a second argument:
 and then sorts `dest', destroying its indices.  However, the `source'
 array is not affected.
 
-   `asort()' and `asorti()' accept a third string argument to control
-comparison of array elements.
+   `asort()' accepts a third string argument to control comparison of
+array elements.  As with `PROCINFO["sorted_in"]', this argument may be
+the name of a user-defined function, or one of the predefined names
+that `gawk' provides (*note Controlling Scanning With A Function::).
 
-   As with `PROCINFO["sorted_in"]', this argument may be the name of a
-user-defined function, or one of the predefined names that `gawk'
-provides (*note Controlling Scanning With A Function::).
+     NOTE: In all cases, the sorted element values consist of the
+     original array's element values.  The ability to control
+     comparison merely affects the way in which they are sorted.
 
    Often, what's needed is to sort on the values of the _indices_
 instead of the values of the elements.  To do that, use the `asorti()'
@@ -13863,10 +13869,14 @@ result array:
          }
      }
 
+   Similar to `asort()', in all cases, the sorted element values
+consist of the original array's indices.  The ability to control
+comparison merely affects the way in which they are sorted.
+
    Sorting the array by replacing the indices provides maximal
 flexibility.  To traverse the elements in decreasing order, use a loop
 that goes from N down to 1, either over the elements or over the
-indices.
+indices.(1)
 
    Copying array indices and elements isn't expensive in terms of
 memory.  Internally, `gawk' maintains "reference counts" to data.  For
@@ -13877,11 +13887,14 @@ arrays use the values.
    Because `IGNORECASE' affects string comparisons, the value of
 `IGNORECASE' also affects sorting for both `asort()' and `asorti()'.
 Note also that the locale's sorting order does _not_ come into play;
-comparisons are based on character values only.(1) Caveat Emptor.
+comparisons are based on character values only.(2) Caveat Emptor.
 
    ---------- Footnotes ----------
 
-   (1) This is true because locale-based comparison occurs only when in
+   (1) You may also use one of the predefined sorting names that sorts
+in decreasing order.
+
+   (2) This is true because locale-based comparison occurs only when in
 POSIX compatibility mode, and since `asort()' and `asorti()' are `gawk'
 extensions, they are not available in that case.
 
@@ -18770,8 +18783,8 @@ File: gawk.info,  Node: Debugging Terms,  Next: Awk 
Debugging,  Prev: Debugging
 
 Before diving in to the details, we need to introduce several important
 concepts that apply to just about all debuggers, including `dgawk'.
-The following list defines terms used thoughout the rest of this major
-node.
+The following list defines terms used throughout the rest of this
+major node.
 
 "Stack Frame"
      Programs generally call functions during the course of their
@@ -21273,7 +21286,7 @@ File: gawk.info,  Node: Notes,  Next: Basic Concepts,  
Prev: Installation,  Up:
 Appendix C Implementation Notes
 *******************************
 
-This appendix contains information mainly of interest to implementors
+This appendix contains information mainly of interest to implementers
 and maintainers of `gawk'.  Everything in it applies specifically to
 `gawk' and not to other implementations.
 
@@ -24880,7 +24893,7 @@ Index
 * arrays, sorting:                       Array Sorting Functions.
                                                               (line   6)
 * arrays, sorting, IGNORECASE variable and: Array Sorting Functions.
-                                                              (line  74)
+                                                              (line  78)
 * arrays, sparse:                        Array Intro.         (line  71)
 * arrays, subscripts:                    Numeric Array Subscripts.
                                                               (line   6)
@@ -25925,7 +25938,7 @@ Index
 * gawk, functions, adding:               Dynamic Extensions.  (line  10)
 * gawk, hexadecimal numbers and:         Nondecimal-numbers.  (line  42)
 * gawk, IGNORECASE variable in <1>:      Array Sorting Functions.
-                                                              (line  74)
+                                                              (line  78)
 * gawk, IGNORECASE variable in <2>:      String Functions.    (line  29)
 * gawk, IGNORECASE variable in <3>:      Array Intro.         (line  92)
 * gawk, IGNORECASE variable in <4>:      User-modified.       (line  82)
@@ -26085,13 +26098,13 @@ Index
 * igawk.sh program:                      Igawk Program.       (line 124)
 * ignore debugger command:               Breakpoint Control.  (line  86)
 * IGNORECASE variable <1>:               Array Sorting Functions.
-                                                              (line  74)
+                                                              (line  78)
 * IGNORECASE variable <2>:               String Functions.    (line  29)
 * IGNORECASE variable <3>:               Array Intro.         (line  92)
 * IGNORECASE variable <4>:               User-modified.       (line  82)
 * IGNORECASE variable:                   Case-sensitivity.    (line  26)
 * IGNORECASE variable, array sorting and: Array Sorting Functions.
-                                                              (line  74)
+                                                              (line  78)
 * IGNORECASE variable, array subscripts and: Array Intro.     (line  92)
 * IGNORECASE variable, in example programs: Library Functions.
                                                               (line  42)
@@ -26773,7 +26786,7 @@ Index
 * redirection of input:                  Getline/File.        (line   6)
 * redirection of output:                 Redirection.         (line   6)
 * reference counting, sorting arrays:    Array Sorting Functions.
-                                                              (line  68)
+                                                              (line  72)
 * regexp constants <1>:                  Comparison Operators.
                                                               (line 103)
 * regexp constants <2>:                  Regexp Constants.    (line   6)
@@ -26932,7 +26945,7 @@ Index
 * side effects, array indexing:          Reference to Elements.
                                                               (line  42)
 * side effects, asort() function:        Array Sorting Functions.
-                                                              (line  24)
+                                                              (line  22)
 * side effects, assignment expressions:  Assignment Ops.      (line  23)
 * side effects, Boolean operators:       Boolean Ops.         (line  30)
 * side effects, conditional expressions: Conditional Exp.     (line  22)
@@ -27322,110 +27335,110 @@ Node: History40970
 Node: Names43361
 Ref: Names-Footnote-144838
 Node: This Manual44910
-Ref: This Manual-Footnote-149858
-Node: Conventions49958
-Node: Manual History52092
-Ref: Manual History-Footnote-155362
-Ref: Manual History-Footnote-255403
-Node: How To Contribute55477
-Node: Acknowledgments56621
-Node: Getting Started60952
-Node: Running gawk63331
-Node: One-shot64517
-Node: Read Terminal65742
-Ref: Read Terminal-Footnote-167392
-Ref: Read Terminal-Footnote-267668
-Node: Long67839
-Node: Executable Scripts69215
-Ref: Executable Scripts-Footnote-171084
-Ref: Executable Scripts-Footnote-271186
-Node: Comments71637
-Node: Quoting74104
-Node: DOS Quoting78727
-Node: Sample Data Files79402
-Node: Very Simple82434
-Node: Two Rules87033
-Node: More Complex89180
-Ref: More Complex-Footnote-192110
-Node: Statements/Lines92195
-Ref: Statements/Lines-Footnote-196657
-Node: Other Features96922
-Node: When97850
-Node: Invoking Gawk99997
-Node: Command Line101382
-Node: Options102165
-Ref: Options-Footnote-1115297
-Node: Other Arguments115322
-Node: Naming Standard Input117980
-Node: Environment Variables119074
-Node: AWKPATH Variable119518
-Ref: AWKPATH Variable-Footnote-1122115
-Node: Other Environment Variables122375
-Node: Exit Status124715
-Node: Include Files125390
-Node: Obsolete128875
-Node: Undocumented129561
-Node: Regexp129802
-Node: Regexp Usage131254
-Node: Escape Sequences133280
-Node: Regexp Operators139043
-Ref: Regexp Operators-Footnote-1146240
-Ref: Regexp Operators-Footnote-2146387
-Node: Bracket Expressions146485
-Ref: table-char-classes148288
-Node: GNU Regexp Operators150932
-Node: Case-sensitivity154655
-Ref: Case-sensitivity-Footnote-1157623
-Ref: Case-sensitivity-Footnote-2157858
-Node: Leftmost Longest157966
-Node: Computed Regexps159167
-Node: Locales162593
-Node: Reading Files166300
-Node: Records168241
-Ref: Records-Footnote-1176915
-Node: Fields176952
-Ref: Fields-Footnote-1179985
-Node: Nonconstant Fields180071
-Node: Changing Fields182273
-Node: Field Separators188251
-Node: Default Field Splitting190880
-Node: Regexp Field Splitting191997
-Node: Single Character Fields195339
-Node: Command Line Field Separator196398
-Node: Field Splitting Summary199839
-Ref: Field Splitting Summary-Footnote-1203031
-Node: Constant Size203132
-Node: Splitting By Content207716
-Ref: Splitting By Content-Footnote-1211442
-Node: Multiple Line211482
-Ref: Multiple Line-Footnote-1217329
-Node: Getline217508
-Node: Plain Getline219736
-Node: Getline/Variable221825
-Node: Getline/File222966
-Node: Getline/Variable/File224288
-Ref: Getline/Variable/File-Footnote-1225887
-Node: Getline/Pipe225974
-Node: Getline/Variable/Pipe228534
-Node: Getline/Coprocess229641
-Node: Getline/Variable/Coprocess230884
-Node: Getline Notes231598
-Node: Getline Summary233540
-Ref: table-getline-variants233883
-Node: Command line directories234739
-Node: Printing235364
-Node: Print236995
-Node: Print Examples238332
-Node: Output Separators241116
-Node: OFMT242876
-Node: Printf244234
-Node: Basic Printf245140
-Node: Control Letters246679
-Node: Format Modifiers250491
-Node: Printf Examples256500
-Node: Redirection259215
-Node: Special Files266199
-Node: Special FD266732
+Ref: This Manual-Footnote-149857
+Node: Conventions49957
+Node: Manual History52091
+Ref: Manual History-Footnote-155361
+Ref: Manual History-Footnote-255402
+Node: How To Contribute55476
+Node: Acknowledgments56620
+Node: Getting Started60951
+Node: Running gawk63330
+Node: One-shot64516
+Node: Read Terminal65741
+Ref: Read Terminal-Footnote-167391
+Ref: Read Terminal-Footnote-267667
+Node: Long67838
+Node: Executable Scripts69214
+Ref: Executable Scripts-Footnote-171083
+Ref: Executable Scripts-Footnote-271185
+Node: Comments71636
+Node: Quoting74103
+Node: DOS Quoting78726
+Node: Sample Data Files79401
+Node: Very Simple82433
+Node: Two Rules87032
+Node: More Complex89179
+Ref: More Complex-Footnote-192109
+Node: Statements/Lines92194
+Ref: Statements/Lines-Footnote-196656
+Node: Other Features96921
+Node: When97849
+Node: Invoking Gawk99996
+Node: Command Line101381
+Node: Options102164
+Ref: Options-Footnote-1115296
+Node: Other Arguments115321
+Node: Naming Standard Input117979
+Node: Environment Variables119073
+Node: AWKPATH Variable119517
+Ref: AWKPATH Variable-Footnote-1122114
+Node: Other Environment Variables122374
+Node: Exit Status124714
+Node: Include Files125389
+Node: Obsolete128874
+Node: Undocumented129560
+Node: Regexp129801
+Node: Regexp Usage131253
+Node: Escape Sequences133279
+Node: Regexp Operators139042
+Ref: Regexp Operators-Footnote-1146239
+Ref: Regexp Operators-Footnote-2146386
+Node: Bracket Expressions146484
+Ref: table-char-classes148287
+Node: GNU Regexp Operators150931
+Node: Case-sensitivity154654
+Ref: Case-sensitivity-Footnote-1157622
+Ref: Case-sensitivity-Footnote-2157857
+Node: Leftmost Longest157965
+Node: Computed Regexps159166
+Node: Locales162592
+Node: Reading Files166299
+Node: Records168240
+Ref: Records-Footnote-1176914
+Node: Fields176951
+Ref: Fields-Footnote-1179984
+Node: Nonconstant Fields180070
+Node: Changing Fields182272
+Node: Field Separators188250
+Node: Default Field Splitting190879
+Node: Regexp Field Splitting191996
+Node: Single Character Fields195338
+Node: Command Line Field Separator196397
+Node: Field Splitting Summary199838
+Ref: Field Splitting Summary-Footnote-1203030
+Node: Constant Size203131
+Node: Splitting By Content207715
+Ref: Splitting By Content-Footnote-1211441
+Node: Multiple Line211481
+Ref: Multiple Line-Footnote-1217328
+Node: Getline217507
+Node: Plain Getline219735
+Node: Getline/Variable221824
+Node: Getline/File222965
+Node: Getline/Variable/File224287
+Ref: Getline/Variable/File-Footnote-1225886
+Node: Getline/Pipe225973
+Node: Getline/Variable/Pipe228533
+Node: Getline/Coprocess229640
+Node: Getline/Variable/Coprocess230883
+Node: Getline Notes231597
+Node: Getline Summary233539
+Ref: table-getline-variants233882
+Node: Command line directories234738
+Node: Printing235363
+Node: Print236994
+Node: Print Examples238331
+Node: Output Separators241115
+Node: OFMT242875
+Node: Printf244233
+Node: Basic Printf245139
+Node: Control Letters246678
+Node: Format Modifiers250490
+Node: Printf Examples256499
+Node: Redirection259214
+Node: Special Files266198
+Node: Special FD266731
 Ref: Special FD-Footnote-1270356
 Node: Special Network270430
 Node: Special Caveats271280
@@ -27572,151 +27585,153 @@ Node: Nondecimal Data555718
 Node: Array Sorting557301
 Node: Controlling Array Traversal558001
 Node: Controlling Scanning With A Function558748
-Node: Controlling Scanning566372
-Node: Array Sorting Functions570229
-Ref: Array Sorting Functions-Footnote-1573471
-Node: Two-way I/O573665
-Ref: Two-way I/O-Footnote-1579097
-Node: TCP/IP Networking579167
-Node: Profiling582011
-Node: Library Functions589485
-Ref: Library Functions-Footnote-1592492
-Node: Library Names592663
-Ref: Library Names-Footnote-1596134
-Ref: Library Names-Footnote-2596354
-Node: General Functions596440
-Node: Strtonum Function597393
-Node: Assert Function600323
-Node: Round Function603649
-Node: Cliff Random Function605192
-Node: Ordinal Functions606208
-Ref: Ordinal Functions-Footnote-1609278
-Ref: Ordinal Functions-Footnote-2609530
-Node: Join Function609739
-Ref: Join Function-Footnote-1611510
-Node: Gettimeofday Function611710
-Node: Data File Management615425
-Node: Filetrans Function616057
-Node: Rewind Function620196
-Node: File Checking621583
-Node: Empty Files622677
-Node: Ignoring Assigns624907
-Node: Getopt Function626460
-Ref: Getopt Function-Footnote-1637764
-Node: Passwd Functions637967
-Ref: Passwd Functions-Footnote-1646942
-Node: Group Functions647030
-Node: Walking Arrays655114
-Node: Sample Programs656683
-Node: Running Examples657348
-Node: Clones658076
-Node: Cut Program659300
-Node: Egrep Program669145
-Ref: Egrep Program-Footnote-1676918
-Node: Id Program677028
-Node: Split Program680644
-Ref: Split Program-Footnote-1684163
-Node: Tee Program684291
-Node: Uniq Program687094
-Node: Wc Program694523
-Ref: Wc Program-Footnote-1698789
-Ref: Wc Program-Footnote-2698989
-Node: Miscellaneous Programs699081
-Node: Dupword Program700269
-Node: Alarm Program702300
-Node: Translate Program707049
-Ref: Translate Program-Footnote-1711436
-Ref: Translate Program-Footnote-2711664
-Node: Labels Program711798
-Ref: Labels Program-Footnote-1715169
-Node: Word Sorting715253
-Node: History Sorting719137
-Node: Extract Program720976
-Ref: Extract Program-Footnote-1728459
-Node: Simple Sed728587
-Node: Igawk Program731649
-Ref: Igawk Program-Footnote-1746682
-Ref: Igawk Program-Footnote-2746883
-Node: Anagram Program747021
-Node: Signature Program750089
-Node: Debugger751189
-Node: Debugging752100
-Node: Debugging Concepts752513
-Node: Debugging Terms754369
-Node: Awk Debugging756991
-Node: Sample dgawk session757883
-Node: dgawk invocation758375
-Node: Finding The Bug759557
-Node: List of Debugger Commands766043
-Node: Breakpoint Control767354
-Node: Dgawk Execution Control770990
-Node: Viewing And Changing Data774341
-Node: Dgawk Stack777678
-Node: Dgawk Info779138
-Node: Miscellaneous Dgawk Commands783086
-Node: Readline Support788514
-Node: Dgawk Limitations789352
-Node: Language History791541
-Node: V7/SVR3.1792979
-Node: SVR4795300
-Node: POSIX796742
-Node: BTL797750
-Node: POSIX/GNU798484
-Node: Common Extensions803635
-Node: Contributors804736
-Node: Installation808912
-Node: Gawk Distribution809806
-Node: Getting810290
-Node: Extracting811116
-Node: Distribution contents812808
-Node: Unix Installation818030
-Node: Quick Installation818647
-Node: Additional Configuration Options820609
-Node: Configuration Philosophy822086
-Node: Non-Unix Installation824428
-Node: PC Installation824886
-Node: PC Binary Installation826185
-Node: PC Compiling828033
-Node: PC Testing830977
-Node: PC Using832153
-Node: Cygwin836338
-Node: MSYS837338
-Node: VMS Installation837852
-Node: VMS Compilation838455
-Ref: VMS Compilation-Footnote-1839462
-Node: VMS Installation Details839520
-Node: VMS Running841155
-Node: VMS Old Gawk842762
-Node: Bugs843236
-Node: Other Versions847146
-Node: Notes852425
-Node: Compatibility Mode853117
-Node: Additions853900
-Node: Accessing The Source854712
-Node: Adding Code856137
-Node: New Ports862104
-Node: Dynamic Extensions866217
-Node: Internals867593
-Node: Plugin License876696
-Node: Sample Library877330
-Node: Internal File Description878016
-Node: Internal File Ops881731
-Ref: Internal File Ops-Footnote-1886512
-Node: Using Internal File Ops886652
-Node: Future Extensions889029
-Node: Basic Concepts891533
-Node: Basic High Level892290
-Ref: Basic High Level-Footnote-1896325
-Node: Basic Data Typing896510
-Node: Floating Point Issues901035
-Node: String Conversion Precision902118
-Ref: String Conversion Precision-Footnote-1903818
-Node: Unexpected Results903927
-Node: POSIX Floating Point Problems905753
-Ref: POSIX Floating Point Problems-Footnote-1909458
-Node: Glossary909496
-Node: Copying934472
-Node: GNU Free Documentation License972029
-Node: Index997166
+Node: Controlling Scanning566451
+Ref: Controlling Scanning-Footnote-1570252
+Node: Array Sorting Functions570568
+Ref: Array Sorting Functions-Footnote-1574084
+Ref: Array Sorting Functions-Footnote-2574177
+Node: Two-way I/O574371
+Ref: Two-way I/O-Footnote-1579803
+Node: TCP/IP Networking579873
+Node: Profiling582717
+Node: Library Functions590191
+Ref: Library Functions-Footnote-1593198
+Node: Library Names593369
+Ref: Library Names-Footnote-1596840
+Ref: Library Names-Footnote-2597060
+Node: General Functions597146
+Node: Strtonum Function598099
+Node: Assert Function601029
+Node: Round Function604355
+Node: Cliff Random Function605898
+Node: Ordinal Functions606914
+Ref: Ordinal Functions-Footnote-1609984
+Ref: Ordinal Functions-Footnote-2610236
+Node: Join Function610445
+Ref: Join Function-Footnote-1612216
+Node: Gettimeofday Function612416
+Node: Data File Management616131
+Node: Filetrans Function616763
+Node: Rewind Function620902
+Node: File Checking622289
+Node: Empty Files623383
+Node: Ignoring Assigns625613
+Node: Getopt Function627166
+Ref: Getopt Function-Footnote-1638470
+Node: Passwd Functions638673
+Ref: Passwd Functions-Footnote-1647648
+Node: Group Functions647736
+Node: Walking Arrays655820
+Node: Sample Programs657389
+Node: Running Examples658054
+Node: Clones658782
+Node: Cut Program660006
+Node: Egrep Program669851
+Ref: Egrep Program-Footnote-1677624
+Node: Id Program677734
+Node: Split Program681350
+Ref: Split Program-Footnote-1684869
+Node: Tee Program684997
+Node: Uniq Program687800
+Node: Wc Program695229
+Ref: Wc Program-Footnote-1699495
+Ref: Wc Program-Footnote-2699695
+Node: Miscellaneous Programs699787
+Node: Dupword Program700975
+Node: Alarm Program703006
+Node: Translate Program707755
+Ref: Translate Program-Footnote-1712142
+Ref: Translate Program-Footnote-2712370
+Node: Labels Program712504
+Ref: Labels Program-Footnote-1715875
+Node: Word Sorting715959
+Node: History Sorting719843
+Node: Extract Program721682
+Ref: Extract Program-Footnote-1729165
+Node: Simple Sed729293
+Node: Igawk Program732355
+Ref: Igawk Program-Footnote-1747388
+Ref: Igawk Program-Footnote-2747589
+Node: Anagram Program747727
+Node: Signature Program750795
+Node: Debugger751895
+Node: Debugging752806
+Node: Debugging Concepts753219
+Node: Debugging Terms755075
+Node: Awk Debugging757698
+Node: Sample dgawk session758590
+Node: dgawk invocation759082
+Node: Finding The Bug760264
+Node: List of Debugger Commands766750
+Node: Breakpoint Control768061
+Node: Dgawk Execution Control771697
+Node: Viewing And Changing Data775048
+Node: Dgawk Stack778385
+Node: Dgawk Info779845
+Node: Miscellaneous Dgawk Commands783793
+Node: Readline Support789221
+Node: Dgawk Limitations790059
+Node: Language History792248
+Node: V7/SVR3.1793686
+Node: SVR4796007
+Node: POSIX797449
+Node: BTL798457
+Node: POSIX/GNU799191
+Node: Common Extensions804342
+Node: Contributors805443
+Node: Installation809619
+Node: Gawk Distribution810513
+Node: Getting810997
+Node: Extracting811823
+Node: Distribution contents813515
+Node: Unix Installation818737
+Node: Quick Installation819354
+Node: Additional Configuration Options821316
+Node: Configuration Philosophy822793
+Node: Non-Unix Installation825135
+Node: PC Installation825593
+Node: PC Binary Installation826892
+Node: PC Compiling828740
+Node: PC Testing831684
+Node: PC Using832860
+Node: Cygwin837045
+Node: MSYS838045
+Node: VMS Installation838559
+Node: VMS Compilation839162
+Ref: VMS Compilation-Footnote-1840169
+Node: VMS Installation Details840227
+Node: VMS Running841862
+Node: VMS Old Gawk843469
+Node: Bugs843943
+Node: Other Versions847853
+Node: Notes853132
+Node: Compatibility Mode853824
+Node: Additions854607
+Node: Accessing The Source855419
+Node: Adding Code856844
+Node: New Ports862811
+Node: Dynamic Extensions866924
+Node: Internals868300
+Node: Plugin License877403
+Node: Sample Library878037
+Node: Internal File Description878723
+Node: Internal File Ops882438
+Ref: Internal File Ops-Footnote-1887219
+Node: Using Internal File Ops887359
+Node: Future Extensions889736
+Node: Basic Concepts892240
+Node: Basic High Level892997
+Ref: Basic High Level-Footnote-1897032
+Node: Basic Data Typing897217
+Node: Floating Point Issues901742
+Node: String Conversion Precision902825
+Ref: String Conversion Precision-Footnote-1904525
+Node: Unexpected Results904634
+Node: POSIX Floating Point Problems906460
+Ref: POSIX Floating Point Problems-Footnote-1910165
+Node: Glossary910203
+Node: Copying935179
+Node: GNU Free Documentation License972736
+Node: Index997873
 
 End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index d594639..7c32872 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -1120,7 +1120,7 @@ expert user and for the online Info and HTML versions of 
the document.
 @end ifnotinfo
 
 There are
-subsections labelled @c FIXME: labeled?
+subsections labeled
 as @strong{Advanced Notes}
 scattered throughout the @value{DOCUMENT}.
 They add a more complete explanation of points that are relevant, but not 
likely
@@ -8462,7 +8462,7 @@ It is a common error to omit the quotes, which leads
 to confusing results.
 @c Exercise: What does it do?  :-)
 
-Finally, usng the @code{close()} function on a @value{FN} of the
+Finally, using the @code{close()} function on a @value{FN} of the
 form @code{"/dev/fd/@var{N}"}, for file descriptor numbers
 above two, will actually close the given file descriptor.
 
@@ -18239,7 +18239,7 @@ lets you do this; this @value{SUBSECTION} describes how.
 The value of @code{PROCINFO["sorted_in"]} can be a function name.
 This lets you traverse an array based on any custom criterion.
 The array elements are ordered according to the return value of this
-function.  This comparison function should be defined with at least
+function.  The comparison function should be defined with at least
 four arguments:
 
 @example
@@ -18264,12 +18264,11 @@ Index @var{i1} comes before index @var{i2} during 
loop traversal.
 Indices @var{i1} and @var{i2}
 come together but the relative order with respect to each other is undefined.
 
address@hidden
 @item comp_func(i1, v1, i2, v2) > 0
 Index @var{i1} comes after index @var{i2} during loop traversal.
 @end table
 
-The following comparison function can be used to scan an array in
+Our first comparison function can be used to scan an array in
 numerical order of the indices:
 
 @example
@@ -18280,8 +18279,8 @@ function cmp_num_idx(i1, v1, i2, v2)
 @}
 @end example
 
-This function traverses an array based on the string order of the element 
values
-rather than by indices:
+Our second function traverses an array based on the string order of
+the element values rather than by indices:
 
 @example
 function cmp_str_val(i1, v1, i2, v2)
@@ -18295,8 +18294,8 @@ function cmp_str_val(i1, v1, i2, v2)
 @}
 @end example
 
-Here is a
-comparison function to make all numbers, and numeric strings without
+The third
+comparison function makes all numbers, and numeric strings without
 any leading or trailing spaces, come out first during loop traversal:  
 
 @example
@@ -18349,14 +18348,14 @@ $ @kbd{gawk -f compdemo.awk}
 @print{}     data[20] = two
 @print{}     data[100] = 100
 @print{} 
address@hidden Sort function: cmp_str_val      @ii{Compare values as strings}
address@hidden Sort function: cmp_str_val      @ii{Sort by element values as 
strings}
 @print{}     data[one] = 10
 @print{}     data[100] = 100             @ii{String 100 is less than string 20}
 @print{}     data[two] = 20
 @print{}     data[10] = one
 @print{}     data[20] = two
 @print{} 
address@hidden Sort function: cmp_num_str_val  @ii{All numbers before all 
strings}
address@hidden Sort function: cmp_num_str_val  @ii{Sort all numbers before all 
strings}
 @print{}     data[one] = 10
 @print{}     data[two] = 20
 @print{}     data[100] = 100
@@ -18397,7 +18396,8 @@ END @{
 
 The first field in each entry of the password file is the user's login name,
 and the fields are seperated by colons.
-Each record defines a subarray, with each field as an element in the subarray.
+Each record defines a subarray (@pxref{Arrays of Arrays}),
+with each field as an element in the subarray.
 Running the program produces the
 following output:
 
@@ -18409,10 +18409,10 @@ $ @kbd{gawk -vPOS=1 -F: -f sort.awk /etc/passwd}
 @dots{}
 @end example
 
-The comparison normally should always return the same value when given a
+The comparison should normally always return the same value when given a
 specific pair of array elements as its arguments.  If inconsistent
-results are returned then the order is undefined.  This behavior is
-sometimes exploited to introduce random order in otherwise seemingly
+results are returned then the order is undefined.  This behavior can be
+exploited to introduce random order into otherwise seemingly
 ordered data:
 
 @example
@@ -18457,7 +18457,7 @@ function cmp_string(i1, v1, i2, v2)
 @c concept for a list constructed from a hash.
 
 A custom comparison function can often simplify ordered loop
-traversal, and the the sky is really the limit when it comes to
+traversal, and the sky is really the limit when it comes to
 designing such a function.
 
 When string comparisons are made during a sort, either for element
@@ -18493,8 +18493,8 @@ As described in
 @iftex
 the previous subsubsection,
 @end iftex
address@hidden Scanning With A Function},
 @ifnottex
address@hidden Scanning With A Function},
 @end ifnottex
 you can provide the name of a function as the value of
 @code{PROCINFO["sorted_in"]} to specify custom sorting criteria.
@@ -18504,7 +18504,7 @@ Often, though, you may wish to do something simple, 
such as
 or ``sort based on comparing the values in descending order.''
 Having to write a simple comparison function for this purpose
 for use in all of your programs becomes tedious.
-For the most likely simple cases @command{gawk} provides
+For the common simple cases, @command{gawk} provides
 the option of supplying special names that do the requested
 sorting for you.
 You can think of them as ``predefined'' sorting functions,
@@ -18517,11 +18517,11 @@ The following special values are available:
 @item "@@ind_str_asc"
 Order by indices compared as strings; this is the most basic sort.
 (Internally, array indices are always strings, so with @samp{a[2*5] = 1}
-the index is actually @code{"10"} rather than numeric 10.)
+the index is @code{"10"} rather than numeric 10.)
 
 @item "@@ind_num_asc"
 Order by indices but force them to be treated as numbers in the process.
-Any index with non-numeric value will end up positioned as if it were zero. 
+Any index with a non-numeric value will end up positioned as if it were zero. 
 
 @item "@@val_type_asc"
 Order by element values rather than indices.
@@ -18535,13 +18535,16 @@ Order by element values rather than by indices.  
Scalar values are
 compared as strings.  Subarrays, if present, come out last.
 
 @item "@@val_num_asc"
-Order by element values but force scalar values to be treated as numbers
-for the purpose of comparison.  If there are subarrays, those appear
-at the end of the sorted list.
+Order by element values rather than by indices.  Scalar values are 
+compared as numbers.  Subarrays, if present, come out last.
 When numeric values are equal, the string values are used to provide
 an ordering: this guarantees consistent results across different
-operating systems and/or library versions of the C @code{qsort()}
-function.
+versions of the C @code{qsort()} address@hidden two elements
+compare as equal, the C @code{qsort()} function does not guarantee
+that they will maintain their original relative order after sorting.
+Using the string value to provide a unique ordering when the numeric
+values are equal ensures that @command{gawk} behaves consistently
+across different environments.}
 
 @item "@@ind_str_desc"
 Reverse order from the most basic sort.
@@ -18606,8 +18609,6 @@ order relative to each other is determined by their 
index strings.
 @cindex @code{asort()} function (@command{gawk})
 @cindex @code{asort()} function (@command{gawk}), address@hidden sorting
 @cindex sort function, arrays, sorting
-The order in which an array is scanned with a @samp{for (i in array)}
-loop is essentially arbitrary.
 In most @command{awk} implementations, sorting an array requires
 writing a @code{sort} function.
 While this can be educational for exploring different sorting algorithms,
@@ -18647,14 +18648,19 @@ In this case, @command{gawk} copies the @code{source} 
array into the
 @code{dest} array and then sorts @code{dest}, destroying its indices.
 However, the @code{source} array is not affected.
 
address@hidden()} and @code{asorti()} accept a third string argument
address@hidden()} accepts a third string argument
 to control comparison of array elements.
-
 As with @code{PROCINFO["sorted_in"]}, this argument may be the
 name of a user-defined function, or one of the predefined names
 that @command{gawk} provides
 (@pxref{Controlling Scanning With A Function}).
 
address@hidden NOTE
+In all cases, the sorted element values consist of the original
+array's element values.  The ability to control comparison merely
+affects the way in which they are sorted.
address@hidden quotation
+
 Often, what's needed is to sort on the values of the @emph{indices}
 instead of the values of the elements.
 To do that, use the
@@ -18677,9 +18683,16 @@ END @{
 @}
 @end example
 
+Similar to @code{asort()},
+in all cases, the sorted element values consist of the original
+array's indices.  The ability to control comparison merely
+affects the way in which they are sorted.
+
 Sorting the array by replacing the indices provides maximal flexibility.
 To traverse the elements in decreasing order, use a loop that goes from
address@hidden down to 1, either over the elements or over the indices.
address@hidden down to 1, either over the elements or over the address@hidden
+may also use one of the predefined sorting names that sorts in
+decreasing order.}
 
 @cindex reference counting, sorting arrays
 Copying array indices and elements isn't expensive in terms of memory.
@@ -24970,7 +24983,7 @@ in sorted order.
 # This program requires gawk 4.0 or newer.
 # Required gawk-specific features:
 #   - True multidimensional arrays
-#   - split() with "" as separater splits out individual characters
+#   - split() with "" as separator splits out individual characters
 #   - asort() and asorti() functions
 #
 # See http://savannah.gnu.org/projects/gawk.
@@ -25179,7 +25192,7 @@ functional program that you or someone else wrote).
 Before diving in to the details, we need to introduce several
 important concepts that apply to just about all debuggers, including
 @command{dgawk}.
-The following list defines terms used thoughout the rest of
+The following list defines terms used throughout the rest of
 this @value{CHAPTER}.
 
 @table @dfn
@@ -28497,7 +28510,7 @@ For more information, see
 @c STARTOFRANGE impis
 @cindex implementation issues, @command{gawk}
 
-This appendix contains information mainly of interest to implementors and
+This appendix contains information mainly of interest to implementers and
 maintainers of @command{gawk}.  Everything in it applies specifically to
 @command{gawk} and not to other implementations.
 

-----------------------------------------------------------------------

Summary of changes:
 doc/ChangeLog |    4 +
 doc/gawk.info |  651 +++++++++++++++++++++++++++++----------------------------
 doc/gawk.texi |   79 ++++---
 3 files changed, 383 insertions(+), 351 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]