diff options
Diffstat (limited to 'doc/gawk.info')
-rw-r--r-- | doc/gawk.info | 501 |
1 files changed, 250 insertions, 251 deletions
diff --git a/doc/gawk.info b/doc/gawk.info index 0d7505a5..1ae776a6 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -17646,6 +17646,10 @@ array only once, in a `BEGIN' rule. However, this assumes that the "from" and "to" lists will never change throughout the lifetime of the program. + Another obvious improvement is to enable the use of ranges, such as +`a-z', as allowed by the `tr' utility. Look at the code for `cut.awk' +(*note Cut Program::) for inspiration. + ---------- Footnotes ---------- (1) On some older systems, including Solaris, the system version of @@ -18740,18 +18744,13 @@ File: gawk.info, Node: Programs Exercises, Prev: Programs Summary, Up: Sample Program::) to accept the same arguments and perform in the same way. - 4. The `split.awk' program (*note Split Program::) uses the `chr()' - and `ord()' functions to move through the letters of the alphabet. - Modify the program to instead use only the `awk' built-in - functions, such as `index()' and `substr()'. - - 5. The `split.awk' program (*note Split Program::) assumes that + 4. The `split.awk' program (*note Split Program::) assumes that letters are contiguous in the character set, which isn't true for EBCDIC systems. Fix this problem. (Hint: Consider a different way to work through the alphabet, without relying on `ord()' and `chr()'.) - 6. In `uniq.awk' (*note Uniq Program::, the logic for choosing which + 5. In `uniq.awk' (*note Uniq Program::, the logic for choosing which lines to print represents a "state machine", which is "a device that can be in one of a set number of stable conditions depending on its previous condition and on the present values of its @@ -18761,21 +18760,21 @@ File: gawk.info, Node: Programs Exercises, Prev: Programs Summary, Up: Sample where you would use this, just as fast." Rewrite the logic to follow this suggestion. - 7. Why can't the `wc.awk' program (*note Wc Program::) just use the + 6. Why can't the `wc.awk' program (*note Wc Program::) just use the value of `FNR' in `endfile()'? Hint: Examine the code in *note Filetrans Function::. - 8. Manipulation of individual characters in the `translate' program + 7. Manipulation of individual characters in the `translate' program (*note Translate Program::) is painful using standard `awk' functions. Given that `gawk' can split strings into individual characters using `""' as the separator, how might you use this feature to simplify the program? - 9. The `extract.awk' program (*note Extract Program::) was written + 8. The `extract.awk' program (*note Extract Program::) was written before `gawk' had the `gensub()' function. Use it to simplify the code. - 10. Compare the performance of the `awksed.awk' program (*note Simple + 9. Compare the performance of the `awksed.awk' program (*note Simple Sed::) with the more straightforward: BEGIN { @@ -18786,16 +18785,16 @@ File: gawk.info, Node: Programs Exercises, Prev: Programs Summary, Up: Sample { gsub(pat, repl); print } - 11. What are the advantages and disadvantages of `awksed.awk' versus + 10. What are the advantages and disadvantages of `awksed.awk' versus the real `sed' utility? - 12. In *note Igawk Program::, we mentioned that not trying to save the + 11. In *note Igawk Program::, we mentioned that not trying to save the line read with `getline' in the `pathto()' function when testing for the file's accessibility for use with the main program simplifies things considerably. What problem does this engender though? - 13. As an additional example of the idea that it is not always + 12. As an additional example of the idea that it is not always necessary to add new features to a program, consider the idea of having two files in a directory in the search path: @@ -18818,7 +18817,7 @@ File: gawk.info, Node: Programs Exercises, Prev: Programs Summary, Up: Sample `@include' statements for the desired library functions. Make this change. - 14. Modify `anagram.awk' (*note Anagram Program::), to avoid the use + 13. Modify `anagram.awk' (*note Anagram Program::), to avoid the use of the external `sort' utility. @@ -32079,7 +32078,7 @@ Index (line 66) * directories, command-line: Command-line directories. (line 6) -* directories, searching: Programs Exercises. (line 75) +* directories, searching: Programs Exercises. (line 70) * directories, searching for loadable extensions: AWKLIBPATH Variable. (line 6) * directories, searching for source files: AWKPATH Variable. (line 6) @@ -32360,7 +32359,7 @@ Index * files, reading, multiline records: Multiple Line. (line 6) * files, searching for regular expressions: Egrep Program. (line 6) * files, skipping: File Checking. (line 6) -* files, source, search path for: Programs Exercises. (line 75) +* files, source, search path for: Programs Exercises. (line 70) * files, splitting: Split Program. (line 6) * files, Texinfo, extracting programs from: Extract Program. (line 6) * find substring in string: String Functions. (line 155) @@ -33528,11 +33527,11 @@ Index * search in string: String Functions. (line 155) * search paths <1>: VMS Running. (line 58) * search paths <2>: PC Using. (line 10) -* search paths: Programs Exercises. (line 75) +* search paths: Programs Exercises. (line 70) * search paths, for loadable extensions: AWKLIBPATH Variable. (line 6) * search paths, for source files <1>: VMS Running. (line 58) * search paths, for source files <2>: PC Using. (line 10) -* search paths, for source files <3>: Programs Exercises. (line 75) +* search paths, for source files <3>: Programs Exercises. (line 70) * search paths, for source files: AWKPATH Variable. (line 6) * searching, files for regular expressions: Egrep Program. (line 6) * searching, for words: Dupword Program. (line 6) @@ -33679,7 +33678,7 @@ Index * source code, QSE Awk: Other Versions. (line 131) * source code, QuikTrim Awk: Other Versions. (line 135) * source code, Solaris awk: Other Versions. (line 96) -* source files, search path for: Programs Exercises. (line 75) +* source files, search path for: Programs Exercises. (line 70) * sparse arrays: Array Intro. (line 72) * Spencer, Henry: Glossary. (line 11) * split: String Functions. (line 313) @@ -34354,236 +34353,236 @@ Node: Miscellaneous Programs706803 Node: Dupword Program708016 Node: Alarm Program710047 Node: Translate Program714851 -Ref: Translate Program-Footnote-1719242 -Ref: Translate Program-Footnote-2719512 -Node: Labels Program719651 -Ref: Labels Program-Footnote-1723012 -Node: Word Sorting723096 -Node: History Sorting727139 -Node: Extract Program728975 -Node: Simple Sed736511 -Node: Igawk Program739573 -Ref: Igawk Program-Footnote-1753877 -Ref: Igawk Program-Footnote-2754078 -Node: Anagram Program754216 -Node: Signature Program757284 -Node: Programs Summary758531 -Node: Programs Exercises759746 -Ref: Programs Exercises-Footnote-1764133 -Node: Advanced Features764224 -Node: Nondecimal Data766172 -Node: Array Sorting767749 -Node: Controlling Array Traversal768446 -Node: Array Sorting Functions776726 -Ref: Array Sorting Functions-Footnote-1780633 -Node: Two-way I/O780827 -Ref: Two-way I/O-Footnote-1785771 -Ref: Two-way I/O-Footnote-2785950 -Node: TCP/IP Networking786032 -Node: Profiling788877 -Node: Advanced Features Summary796419 -Node: Internationalization798283 -Node: I18N and L10N799763 -Node: Explaining gettext800449 -Ref: Explaining gettext-Footnote-1805475 -Ref: Explaining gettext-Footnote-2805659 -Node: Programmer i18n805824 -Ref: Programmer i18n-Footnote-1810618 -Node: Translator i18n810667 -Node: String Extraction811461 -Ref: String Extraction-Footnote-1812594 -Node: Printf Ordering812680 -Ref: Printf Ordering-Footnote-1815462 -Node: I18N Portability815526 -Ref: I18N Portability-Footnote-1817975 -Node: I18N Example818038 -Ref: I18N Example-Footnote-1820744 -Node: Gawk I18N820816 -Node: I18N Summary821454 -Node: Debugger822793 -Node: Debugging823815 -Node: Debugging Concepts824256 -Node: Debugging Terms826112 -Node: Awk Debugging828709 -Node: Sample Debugging Session829601 -Node: Debugger Invocation830121 -Node: Finding The Bug831457 -Node: List of Debugger Commands837936 -Node: Breakpoint Control839268 -Node: Debugger Execution Control842932 -Node: Viewing And Changing Data846292 -Node: Execution Stack849650 -Node: Debugger Info851163 -Node: Miscellaneous Debugger Commands855157 -Node: Readline Support860341 -Node: Limitations861233 -Node: Debugging Summary863506 -Node: Arbitrary Precision Arithmetic864674 -Node: Computer Arithmetic866161 -Ref: Computer Arithmetic-Footnote-1870548 -Node: Math Definitions870605 -Ref: table-ieee-formats873894 -Ref: Math Definitions-Footnote-1874434 -Node: MPFR features874537 -Node: FP Math Caution876154 -Ref: FP Math Caution-Footnote-1877204 -Node: Inexactness of computations877573 -Node: Inexact representation878521 -Node: Comparing FP Values879876 -Node: Errors accumulate880840 -Node: Getting Accuracy882273 -Node: Try To Round884932 -Node: Setting precision885831 -Ref: table-predefined-precision-strings886513 -Node: Setting the rounding mode888306 -Ref: table-gawk-rounding-modes888670 -Ref: Setting the rounding mode-Footnote-1892124 -Node: Arbitrary Precision Integers892303 -Ref: Arbitrary Precision Integers-Footnote-1895284 -Node: POSIX Floating Point Problems895433 -Ref: POSIX Floating Point Problems-Footnote-1899309 -Node: Floating point summary899347 -Node: Dynamic Extensions901551 -Node: Extension Intro903103 -Node: Plugin License904368 -Node: Extension Mechanism Outline905053 -Ref: figure-load-extension905477 -Ref: figure-load-new-function906962 -Ref: figure-call-new-function907964 -Node: Extension API Description909948 -Node: Extension API Functions Introduction911398 -Node: General Data Types916265 -Ref: General Data Types-Footnote-1921958 -Node: Requesting Values922257 -Ref: table-value-types-returned922994 -Node: Memory Allocation Functions923952 -Ref: Memory Allocation Functions-Footnote-1926699 -Node: Constructor Functions926795 -Node: Registration Functions928553 -Node: Extension Functions929238 -Node: Exit Callback Functions931540 -Node: Extension Version String932788 -Node: Input Parsers933438 -Node: Output Wrappers943252 -Node: Two-way processors947768 -Node: Printing Messages949972 -Ref: Printing Messages-Footnote-1951049 -Node: Updating `ERRNO'951201 -Node: Accessing Parameters951940 -Node: Symbol Table Access953170 -Node: Symbol table by name953684 -Node: Symbol table by cookie955660 -Ref: Symbol table by cookie-Footnote-1959793 -Node: Cached values959856 -Ref: Cached values-Footnote-1963360 -Node: Array Manipulation963451 -Ref: Array Manipulation-Footnote-1964549 -Node: Array Data Types964588 -Ref: Array Data Types-Footnote-1967291 -Node: Array Functions967383 -Node: Flattening Arrays971257 -Node: Creating Arrays978109 -Node: Extension API Variables982840 -Node: Extension Versioning983476 -Node: Extension API Informational Variables985377 -Node: Extension API Boilerplate986463 -Node: Finding Extensions990267 -Node: Extension Example990827 -Node: Internal File Description991557 -Node: Internal File Ops995648 -Ref: Internal File Ops-Footnote-11007080 -Node: Using Internal File Ops1007220 -Ref: Using Internal File Ops-Footnote-11009567 -Node: Extension Samples1009835 -Node: Extension Sample File Functions1011359 -Node: Extension Sample Fnmatch1018927 -Node: Extension Sample Fork1020409 -Node: Extension Sample Inplace1021622 -Node: Extension Sample Ord1023297 -Node: Extension Sample Readdir1024133 -Ref: table-readdir-file-types1024989 -Node: Extension Sample Revout1025788 -Node: Extension Sample Rev2way1026379 -Node: Extension Sample Read write array1027120 -Node: Extension Sample Readfile1028999 -Node: Extension Sample API Tests1030099 -Node: Extension Sample Time1030624 -Node: gawkextlib1031939 -Node: Extension summary1034752 -Node: Extension Exercises1038445 -Node: Language History1039167 -Node: V7/SVR3.11040810 -Node: SVR41043130 -Node: POSIX1044572 -Node: BTL1045958 -Node: POSIX/GNU1046692 -Node: Feature History1052408 -Node: Common Extensions1065499 -Node: Ranges and Locales1066811 -Ref: Ranges and Locales-Footnote-11071428 -Ref: Ranges and Locales-Footnote-21071455 -Ref: Ranges and Locales-Footnote-31071689 -Node: Contributors1071910 -Node: History summary1077335 -Node: Installation1078704 -Node: Gawk Distribution1079655 -Node: Getting1080139 -Node: Extracting1080963 -Node: Distribution contents1082605 -Node: Unix Installation1088322 -Node: Quick Installation1088939 -Node: Additional Configuration Options1091381 -Node: Configuration Philosophy1093119 -Node: Non-Unix Installation1095470 -Node: PC Installation1095928 -Node: PC Binary Installation1097239 -Node: PC Compiling1099087 -Ref: PC Compiling-Footnote-11102086 -Node: PC Testing1102191 -Node: PC Using1103367 -Node: Cygwin1107519 -Node: MSYS1108328 -Node: VMS Installation1108842 -Node: VMS Compilation1109638 -Ref: VMS Compilation-Footnote-11110860 -Node: VMS Dynamic Extensions1110918 -Node: VMS Installation Details1112291 -Node: VMS Running1114543 -Node: VMS GNV1117377 -Node: VMS Old Gawk1118100 -Node: Bugs1118570 -Node: Other Versions1122574 -Node: Installation summary1128801 -Node: Notes1129857 -Node: Compatibility Mode1130722 -Node: Additions1131504 -Node: Accessing The Source1132429 -Node: Adding Code1133865 -Node: New Ports1140043 -Node: Derived Files1144524 -Ref: Derived Files-Footnote-11149605 -Ref: Derived Files-Footnote-21149639 -Ref: Derived Files-Footnote-31150235 -Node: Future Extensions1150349 -Node: Implementation Limitations1150955 -Node: Extension Design1152203 -Node: Old Extension Problems1153357 -Ref: Old Extension Problems-Footnote-11154874 -Node: Extension New Mechanism Goals1154931 -Ref: Extension New Mechanism Goals-Footnote-11158291 -Node: Extension Other Design Decisions1158480 -Node: Extension Future Growth1160586 -Node: Old Extension Mechanism1161422 -Node: Notes summary1163184 -Node: Basic Concepts1164370 -Node: Basic High Level1165051 -Ref: figure-general-flow1165323 -Ref: figure-process-flow1165922 -Ref: Basic High Level-Footnote-11169151 -Node: Basic Data Typing1169336 -Node: Glossary1172664 -Node: Copying1197816 -Node: GNU Free Documentation License1235372 -Node: Index1260508 +Ref: Translate Program-Footnote-1719424 +Ref: Translate Program-Footnote-2719694 +Node: Labels Program719833 +Ref: Labels Program-Footnote-1723194 +Node: Word Sorting723278 +Node: History Sorting727321 +Node: Extract Program729157 +Node: Simple Sed736693 +Node: Igawk Program739755 +Ref: Igawk Program-Footnote-1754059 +Ref: Igawk Program-Footnote-2754260 +Node: Anagram Program754398 +Node: Signature Program757466 +Node: Programs Summary758713 +Node: Programs Exercises759928 +Ref: Programs Exercises-Footnote-1764059 +Node: Advanced Features764150 +Node: Nondecimal Data766098 +Node: Array Sorting767675 +Node: Controlling Array Traversal768372 +Node: Array Sorting Functions776652 +Ref: Array Sorting Functions-Footnote-1780559 +Node: Two-way I/O780753 +Ref: Two-way I/O-Footnote-1785697 +Ref: Two-way I/O-Footnote-2785876 +Node: TCP/IP Networking785958 +Node: Profiling788803 +Node: Advanced Features Summary796345 +Node: Internationalization798209 +Node: I18N and L10N799689 +Node: Explaining gettext800375 +Ref: Explaining gettext-Footnote-1805401 +Ref: Explaining gettext-Footnote-2805585 +Node: Programmer i18n805750 +Ref: Programmer i18n-Footnote-1810544 +Node: Translator i18n810593 +Node: String Extraction811387 +Ref: String Extraction-Footnote-1812520 +Node: Printf Ordering812606 +Ref: Printf Ordering-Footnote-1815388 +Node: I18N Portability815452 +Ref: I18N Portability-Footnote-1817901 +Node: I18N Example817964 +Ref: I18N Example-Footnote-1820670 +Node: Gawk I18N820742 +Node: I18N Summary821380 +Node: Debugger822719 +Node: Debugging823741 +Node: Debugging Concepts824182 +Node: Debugging Terms826038 +Node: Awk Debugging828635 +Node: Sample Debugging Session829527 +Node: Debugger Invocation830047 +Node: Finding The Bug831383 +Node: List of Debugger Commands837862 +Node: Breakpoint Control839194 +Node: Debugger Execution Control842858 +Node: Viewing And Changing Data846218 +Node: Execution Stack849576 +Node: Debugger Info851089 +Node: Miscellaneous Debugger Commands855083 +Node: Readline Support860267 +Node: Limitations861159 +Node: Debugging Summary863432 +Node: Arbitrary Precision Arithmetic864600 +Node: Computer Arithmetic866087 +Ref: Computer Arithmetic-Footnote-1870474 +Node: Math Definitions870531 +Ref: table-ieee-formats873820 +Ref: Math Definitions-Footnote-1874360 +Node: MPFR features874463 +Node: FP Math Caution876080 +Ref: FP Math Caution-Footnote-1877130 +Node: Inexactness of computations877499 +Node: Inexact representation878447 +Node: Comparing FP Values879802 +Node: Errors accumulate880766 +Node: Getting Accuracy882199 +Node: Try To Round884858 +Node: Setting precision885757 +Ref: table-predefined-precision-strings886439 +Node: Setting the rounding mode888232 +Ref: table-gawk-rounding-modes888596 +Ref: Setting the rounding mode-Footnote-1892050 +Node: Arbitrary Precision Integers892229 +Ref: Arbitrary Precision Integers-Footnote-1895210 +Node: POSIX Floating Point Problems895359 +Ref: POSIX Floating Point Problems-Footnote-1899235 +Node: Floating point summary899273 +Node: Dynamic Extensions901477 +Node: Extension Intro903029 +Node: Plugin License904294 +Node: Extension Mechanism Outline904979 +Ref: figure-load-extension905403 +Ref: figure-load-new-function906888 +Ref: figure-call-new-function907890 +Node: Extension API Description909874 +Node: Extension API Functions Introduction911324 +Node: General Data Types916191 +Ref: General Data Types-Footnote-1921884 +Node: Requesting Values922183 +Ref: table-value-types-returned922920 +Node: Memory Allocation Functions923878 +Ref: Memory Allocation Functions-Footnote-1926625 +Node: Constructor Functions926721 +Node: Registration Functions928479 +Node: Extension Functions929164 +Node: Exit Callback Functions931466 +Node: Extension Version String932714 +Node: Input Parsers933364 +Node: Output Wrappers943178 +Node: Two-way processors947694 +Node: Printing Messages949898 +Ref: Printing Messages-Footnote-1950975 +Node: Updating `ERRNO'951127 +Node: Accessing Parameters951866 +Node: Symbol Table Access953096 +Node: Symbol table by name953610 +Node: Symbol table by cookie955586 +Ref: Symbol table by cookie-Footnote-1959719 +Node: Cached values959782 +Ref: Cached values-Footnote-1963286 +Node: Array Manipulation963377 +Ref: Array Manipulation-Footnote-1964475 +Node: Array Data Types964514 +Ref: Array Data Types-Footnote-1967217 +Node: Array Functions967309 +Node: Flattening Arrays971183 +Node: Creating Arrays978035 +Node: Extension API Variables982766 +Node: Extension Versioning983402 +Node: Extension API Informational Variables985303 +Node: Extension API Boilerplate986389 +Node: Finding Extensions990193 +Node: Extension Example990753 +Node: Internal File Description991483 +Node: Internal File Ops995574 +Ref: Internal File Ops-Footnote-11007006 +Node: Using Internal File Ops1007146 +Ref: Using Internal File Ops-Footnote-11009493 +Node: Extension Samples1009761 +Node: Extension Sample File Functions1011285 +Node: Extension Sample Fnmatch1018853 +Node: Extension Sample Fork1020335 +Node: Extension Sample Inplace1021548 +Node: Extension Sample Ord1023223 +Node: Extension Sample Readdir1024059 +Ref: table-readdir-file-types1024915 +Node: Extension Sample Revout1025714 +Node: Extension Sample Rev2way1026305 +Node: Extension Sample Read write array1027046 +Node: Extension Sample Readfile1028925 +Node: Extension Sample API Tests1030025 +Node: Extension Sample Time1030550 +Node: gawkextlib1031865 +Node: Extension summary1034678 +Node: Extension Exercises1038371 +Node: Language History1039093 +Node: V7/SVR3.11040736 +Node: SVR41043056 +Node: POSIX1044498 +Node: BTL1045884 +Node: POSIX/GNU1046618 +Node: Feature History1052334 +Node: Common Extensions1065425 +Node: Ranges and Locales1066737 +Ref: Ranges and Locales-Footnote-11071354 +Ref: Ranges and Locales-Footnote-21071381 +Ref: Ranges and Locales-Footnote-31071615 +Node: Contributors1071836 +Node: History summary1077261 +Node: Installation1078630 +Node: Gawk Distribution1079581 +Node: Getting1080065 +Node: Extracting1080889 +Node: Distribution contents1082531 +Node: Unix Installation1088248 +Node: Quick Installation1088865 +Node: Additional Configuration Options1091307 +Node: Configuration Philosophy1093045 +Node: Non-Unix Installation1095396 +Node: PC Installation1095854 +Node: PC Binary Installation1097165 +Node: PC Compiling1099013 +Ref: PC Compiling-Footnote-11102012 +Node: PC Testing1102117 +Node: PC Using1103293 +Node: Cygwin1107445 +Node: MSYS1108254 +Node: VMS Installation1108768 +Node: VMS Compilation1109564 +Ref: VMS Compilation-Footnote-11110786 +Node: VMS Dynamic Extensions1110844 +Node: VMS Installation Details1112217 +Node: VMS Running1114469 +Node: VMS GNV1117303 +Node: VMS Old Gawk1118026 +Node: Bugs1118496 +Node: Other Versions1122500 +Node: Installation summary1128727 +Node: Notes1129783 +Node: Compatibility Mode1130648 +Node: Additions1131430 +Node: Accessing The Source1132355 +Node: Adding Code1133791 +Node: New Ports1139969 +Node: Derived Files1144450 +Ref: Derived Files-Footnote-11149531 +Ref: Derived Files-Footnote-21149565 +Ref: Derived Files-Footnote-31150161 +Node: Future Extensions1150275 +Node: Implementation Limitations1150881 +Node: Extension Design1152129 +Node: Old Extension Problems1153283 +Ref: Old Extension Problems-Footnote-11154800 +Node: Extension New Mechanism Goals1154857 +Ref: Extension New Mechanism Goals-Footnote-11158217 +Node: Extension Other Design Decisions1158406 +Node: Extension Future Growth1160512 +Node: Old Extension Mechanism1161348 +Node: Notes summary1163110 +Node: Basic Concepts1164296 +Node: Basic High Level1164977 +Ref: figure-general-flow1165249 +Ref: figure-process-flow1165848 +Ref: Basic High Level-Footnote-11169077 +Node: Basic Data Typing1169262 +Node: Glossary1172590 +Node: Copying1197742 +Node: GNU Free Documentation License1235298 +Node: Index1260434 End Tag Table |