diff options
-rw-r--r-- | doc/ChangeLog | 4 | ||||
-rw-r--r-- | doc/gawk.info | 501 | ||||
-rw-r--r-- | doc/gawk.texi | 14 | ||||
-rw-r--r-- | doc/gawktexi.in | 14 |
4 files changed, 268 insertions, 265 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index 26e27b91..e6ab67cb 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -4,6 +4,10 @@ PROCINFO["identifiers"]. * gawk.1: Ditto. + Unrelated: + + * gawktexi.in: More stuff from reviewer comments. + 2014-09-04 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Document that indirect calls now work on built-in diff --git a/doc/gawk.info b/doc/gawk.info index 4a283786..2b8c0e0b 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -17664,6 +17664,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 @@ -18758,18 +18762,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 @@ -18779,21 +18778,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 { @@ -18804,16 +18803,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: @@ -18836,7 +18835,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. @@ -32123,7 +32122,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) @@ -32405,7 +32404,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) @@ -33573,11 +33572,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) @@ -33724,7 +33723,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) @@ -34399,236 +34398,236 @@ Node: Miscellaneous Programs707691 Node: Dupword Program708904 Node: Alarm Program710935 Node: Translate Program715739 -Ref: Translate Program-Footnote-1720130 -Ref: Translate Program-Footnote-2720400 -Node: Labels Program720539 -Ref: Labels Program-Footnote-1723900 -Node: Word Sorting723984 -Node: History Sorting728027 -Node: Extract Program729863 -Node: Simple Sed737399 -Node: Igawk Program740461 -Ref: Igawk Program-Footnote-1754765 -Ref: Igawk Program-Footnote-2754966 -Node: Anagram Program755104 -Node: Signature Program758172 -Node: Programs Summary759419 -Node: Programs Exercises760634 -Ref: Programs Exercises-Footnote-1765021 -Node: Advanced Features765112 -Node: Nondecimal Data767060 -Node: Array Sorting768637 -Node: Controlling Array Traversal769334 -Node: Array Sorting Functions777614 -Ref: Array Sorting Functions-Footnote-1781521 -Node: Two-way I/O781715 -Ref: Two-way I/O-Footnote-1786659 -Ref: Two-way I/O-Footnote-2786838 -Node: TCP/IP Networking786920 -Node: Profiling789765 -Node: Advanced Features Summary797316 -Node: Internationalization799180 -Node: I18N and L10N800660 -Node: Explaining gettext801346 -Ref: Explaining gettext-Footnote-1806372 -Ref: Explaining gettext-Footnote-2806556 -Node: Programmer i18n806721 -Ref: Programmer i18n-Footnote-1811515 -Node: Translator i18n811564 -Node: String Extraction812358 -Ref: String Extraction-Footnote-1813491 -Node: Printf Ordering813577 -Ref: Printf Ordering-Footnote-1816359 -Node: I18N Portability816423 -Ref: I18N Portability-Footnote-1818872 -Node: I18N Example818935 -Ref: I18N Example-Footnote-1821641 -Node: Gawk I18N821713 -Node: I18N Summary822351 -Node: Debugger823690 -Node: Debugging824712 -Node: Debugging Concepts825153 -Node: Debugging Terms827009 -Node: Awk Debugging829606 -Node: Sample Debugging Session830498 -Node: Debugger Invocation831018 -Node: Finding The Bug832354 -Node: List of Debugger Commands838833 -Node: Breakpoint Control840165 -Node: Debugger Execution Control843829 -Node: Viewing And Changing Data847189 -Node: Execution Stack850547 -Node: Debugger Info852060 -Node: Miscellaneous Debugger Commands856054 -Node: Readline Support861238 -Node: Limitations862130 -Node: Debugging Summary864403 -Node: Arbitrary Precision Arithmetic865571 -Node: Computer Arithmetic867058 -Ref: Computer Arithmetic-Footnote-1871445 -Node: Math Definitions871502 -Ref: table-ieee-formats874791 -Ref: Math Definitions-Footnote-1875331 -Node: MPFR features875434 -Node: FP Math Caution877051 -Ref: FP Math Caution-Footnote-1878101 -Node: Inexactness of computations878470 -Node: Inexact representation879418 -Node: Comparing FP Values880773 -Node: Errors accumulate881737 -Node: Getting Accuracy883170 -Node: Try To Round885829 -Node: Setting precision886728 -Ref: table-predefined-precision-strings887410 -Node: Setting the rounding mode889203 -Ref: table-gawk-rounding-modes889567 -Ref: Setting the rounding mode-Footnote-1893021 -Node: Arbitrary Precision Integers893200 -Ref: Arbitrary Precision Integers-Footnote-1896973 -Node: POSIX Floating Point Problems897122 -Ref: POSIX Floating Point Problems-Footnote-1900998 -Node: Floating point summary901036 -Node: Dynamic Extensions903240 -Node: Extension Intro904792 -Node: Plugin License906057 -Node: Extension Mechanism Outline906742 -Ref: figure-load-extension907166 -Ref: figure-load-new-function908651 -Ref: figure-call-new-function909653 -Node: Extension API Description911637 -Node: Extension API Functions Introduction913087 -Node: General Data Types917954 -Ref: General Data Types-Footnote-1923647 -Node: Requesting Values923946 -Ref: table-value-types-returned924683 -Node: Memory Allocation Functions925641 -Ref: Memory Allocation Functions-Footnote-1928388 -Node: Constructor Functions928484 -Node: Registration Functions930242 -Node: Extension Functions930927 -Node: Exit Callback Functions933229 -Node: Extension Version String934477 -Node: Input Parsers935127 -Node: Output Wrappers944941 -Node: Two-way processors949457 -Node: Printing Messages951661 -Ref: Printing Messages-Footnote-1952738 -Node: Updating `ERRNO'952890 -Node: Accessing Parameters953629 -Node: Symbol Table Access954859 -Node: Symbol table by name955373 -Node: Symbol table by cookie957349 -Ref: Symbol table by cookie-Footnote-1961482 -Node: Cached values961545 -Ref: Cached values-Footnote-1965049 -Node: Array Manipulation965140 -Ref: Array Manipulation-Footnote-1966238 -Node: Array Data Types966277 -Ref: Array Data Types-Footnote-1968980 -Node: Array Functions969072 -Node: Flattening Arrays972946 -Node: Creating Arrays979798 -Node: Extension API Variables984529 -Node: Extension Versioning985165 -Node: Extension API Informational Variables987066 -Node: Extension API Boilerplate988152 -Node: Finding Extensions991956 -Node: Extension Example992516 -Node: Internal File Description993246 -Node: Internal File Ops997337 -Ref: Internal File Ops-Footnote-11008769 -Node: Using Internal File Ops1008909 -Ref: Using Internal File Ops-Footnote-11011256 -Node: Extension Samples1011524 -Node: Extension Sample File Functions1013048 -Node: Extension Sample Fnmatch1020616 -Node: Extension Sample Fork1022098 -Node: Extension Sample Inplace1023311 -Node: Extension Sample Ord1024986 -Node: Extension Sample Readdir1025822 -Ref: table-readdir-file-types1026678 -Node: Extension Sample Revout1027477 -Node: Extension Sample Rev2way1028068 -Node: Extension Sample Read write array1028809 -Node: Extension Sample Readfile1030688 -Node: Extension Sample API Tests1031788 -Node: Extension Sample Time1032313 -Node: gawkextlib1033628 -Node: Extension summary1036441 -Node: Extension Exercises1040134 -Node: Language History1040856 -Node: V7/SVR3.11042499 -Node: SVR41044819 -Node: POSIX1046261 -Node: BTL1047647 -Node: POSIX/GNU1048381 -Node: Feature History1054157 -Node: Common Extensions1067248 -Node: Ranges and Locales1068560 -Ref: Ranges and Locales-Footnote-11073177 -Ref: Ranges and Locales-Footnote-21073204 -Ref: Ranges and Locales-Footnote-31073438 -Node: Contributors1073659 -Node: History summary1079084 -Node: Installation1080453 -Node: Gawk Distribution1081404 -Node: Getting1081888 -Node: Extracting1082712 -Node: Distribution contents1084354 -Node: Unix Installation1090124 -Node: Quick Installation1090741 -Node: Additional Configuration Options1093183 -Node: Configuration Philosophy1094921 -Node: Non-Unix Installation1097272 -Node: PC Installation1097730 -Node: PC Binary Installation1099041 -Node: PC Compiling1100889 -Ref: PC Compiling-Footnote-11103888 -Node: PC Testing1103993 -Node: PC Using1105169 -Node: Cygwin1109321 -Node: MSYS1110130 -Node: VMS Installation1110644 -Node: VMS Compilation1111440 -Ref: VMS Compilation-Footnote-11112662 -Node: VMS Dynamic Extensions1112720 -Node: VMS Installation Details1114093 -Node: VMS Running1116345 -Node: VMS GNV1119179 -Node: VMS Old Gawk1119902 -Node: Bugs1120372 -Node: Other Versions1124376 -Node: Installation summary1130603 -Node: Notes1131659 -Node: Compatibility Mode1132524 -Node: Additions1133306 -Node: Accessing The Source1134231 -Node: Adding Code1135667 -Node: New Ports1141845 -Node: Derived Files1146326 -Ref: Derived Files-Footnote-11151407 -Ref: Derived Files-Footnote-21151441 -Ref: Derived Files-Footnote-31152037 -Node: Future Extensions1152151 -Node: Implementation Limitations1152757 -Node: Extension Design1154005 -Node: Old Extension Problems1155159 -Ref: Old Extension Problems-Footnote-11156676 -Node: Extension New Mechanism Goals1156733 -Ref: Extension New Mechanism Goals-Footnote-11160093 -Node: Extension Other Design Decisions1160282 -Node: Extension Future Growth1162388 -Node: Old Extension Mechanism1163224 -Node: Notes summary1164986 -Node: Basic Concepts1166172 -Node: Basic High Level1166853 -Ref: figure-general-flow1167125 -Ref: figure-process-flow1167724 -Ref: Basic High Level-Footnote-11170953 -Node: Basic Data Typing1171138 -Node: Glossary1174466 -Node: Copying1199618 -Node: GNU Free Documentation License1237174 -Node: Index1262310 +Ref: Translate Program-Footnote-1720312 +Ref: Translate Program-Footnote-2720582 +Node: Labels Program720721 +Ref: Labels Program-Footnote-1724082 +Node: Word Sorting724166 +Node: History Sorting728209 +Node: Extract Program730045 +Node: Simple Sed737581 +Node: Igawk Program740643 +Ref: Igawk Program-Footnote-1754947 +Ref: Igawk Program-Footnote-2755148 +Node: Anagram Program755286 +Node: Signature Program758354 +Node: Programs Summary759601 +Node: Programs Exercises760816 +Ref: Programs Exercises-Footnote-1764947 +Node: Advanced Features765038 +Node: Nondecimal Data766986 +Node: Array Sorting768563 +Node: Controlling Array Traversal769260 +Node: Array Sorting Functions777540 +Ref: Array Sorting Functions-Footnote-1781447 +Node: Two-way I/O781641 +Ref: Two-way I/O-Footnote-1786585 +Ref: Two-way I/O-Footnote-2786764 +Node: TCP/IP Networking786846 +Node: Profiling789691 +Node: Advanced Features Summary797242 +Node: Internationalization799106 +Node: I18N and L10N800586 +Node: Explaining gettext801272 +Ref: Explaining gettext-Footnote-1806298 +Ref: Explaining gettext-Footnote-2806482 +Node: Programmer i18n806647 +Ref: Programmer i18n-Footnote-1811441 +Node: Translator i18n811490 +Node: String Extraction812284 +Ref: String Extraction-Footnote-1813417 +Node: Printf Ordering813503 +Ref: Printf Ordering-Footnote-1816285 +Node: I18N Portability816349 +Ref: I18N Portability-Footnote-1818798 +Node: I18N Example818861 +Ref: I18N Example-Footnote-1821567 +Node: Gawk I18N821639 +Node: I18N Summary822277 +Node: Debugger823616 +Node: Debugging824638 +Node: Debugging Concepts825079 +Node: Debugging Terms826935 +Node: Awk Debugging829532 +Node: Sample Debugging Session830424 +Node: Debugger Invocation830944 +Node: Finding The Bug832280 +Node: List of Debugger Commands838759 +Node: Breakpoint Control840091 +Node: Debugger Execution Control843755 +Node: Viewing And Changing Data847115 +Node: Execution Stack850473 +Node: Debugger Info851986 +Node: Miscellaneous Debugger Commands855980 +Node: Readline Support861164 +Node: Limitations862056 +Node: Debugging Summary864329 +Node: Arbitrary Precision Arithmetic865497 +Node: Computer Arithmetic866984 +Ref: Computer Arithmetic-Footnote-1871371 +Node: Math Definitions871428 +Ref: table-ieee-formats874717 +Ref: Math Definitions-Footnote-1875257 +Node: MPFR features875360 +Node: FP Math Caution876977 +Ref: FP Math Caution-Footnote-1878027 +Node: Inexactness of computations878396 +Node: Inexact representation879344 +Node: Comparing FP Values880699 +Node: Errors accumulate881663 +Node: Getting Accuracy883096 +Node: Try To Round885755 +Node: Setting precision886654 +Ref: table-predefined-precision-strings887336 +Node: Setting the rounding mode889129 +Ref: table-gawk-rounding-modes889493 +Ref: Setting the rounding mode-Footnote-1892947 +Node: Arbitrary Precision Integers893126 +Ref: Arbitrary Precision Integers-Footnote-1896899 +Node: POSIX Floating Point Problems897048 +Ref: POSIX Floating Point Problems-Footnote-1900924 +Node: Floating point summary900962 +Node: Dynamic Extensions903166 +Node: Extension Intro904718 +Node: Plugin License905983 +Node: Extension Mechanism Outline906668 +Ref: figure-load-extension907092 +Ref: figure-load-new-function908577 +Ref: figure-call-new-function909579 +Node: Extension API Description911563 +Node: Extension API Functions Introduction913013 +Node: General Data Types917880 +Ref: General Data Types-Footnote-1923573 +Node: Requesting Values923872 +Ref: table-value-types-returned924609 +Node: Memory Allocation Functions925567 +Ref: Memory Allocation Functions-Footnote-1928314 +Node: Constructor Functions928410 +Node: Registration Functions930168 +Node: Extension Functions930853 +Node: Exit Callback Functions933155 +Node: Extension Version String934403 +Node: Input Parsers935053 +Node: Output Wrappers944867 +Node: Two-way processors949383 +Node: Printing Messages951587 +Ref: Printing Messages-Footnote-1952664 +Node: Updating `ERRNO'952816 +Node: Accessing Parameters953555 +Node: Symbol Table Access954785 +Node: Symbol table by name955299 +Node: Symbol table by cookie957275 +Ref: Symbol table by cookie-Footnote-1961408 +Node: Cached values961471 +Ref: Cached values-Footnote-1964975 +Node: Array Manipulation965066 +Ref: Array Manipulation-Footnote-1966164 +Node: Array Data Types966203 +Ref: Array Data Types-Footnote-1968906 +Node: Array Functions968998 +Node: Flattening Arrays972872 +Node: Creating Arrays979724 +Node: Extension API Variables984455 +Node: Extension Versioning985091 +Node: Extension API Informational Variables986992 +Node: Extension API Boilerplate988078 +Node: Finding Extensions991882 +Node: Extension Example992442 +Node: Internal File Description993172 +Node: Internal File Ops997263 +Ref: Internal File Ops-Footnote-11008695 +Node: Using Internal File Ops1008835 +Ref: Using Internal File Ops-Footnote-11011182 +Node: Extension Samples1011450 +Node: Extension Sample File Functions1012974 +Node: Extension Sample Fnmatch1020542 +Node: Extension Sample Fork1022024 +Node: Extension Sample Inplace1023237 +Node: Extension Sample Ord1024912 +Node: Extension Sample Readdir1025748 +Ref: table-readdir-file-types1026604 +Node: Extension Sample Revout1027403 +Node: Extension Sample Rev2way1027994 +Node: Extension Sample Read write array1028735 +Node: Extension Sample Readfile1030614 +Node: Extension Sample API Tests1031714 +Node: Extension Sample Time1032239 +Node: gawkextlib1033554 +Node: Extension summary1036367 +Node: Extension Exercises1040060 +Node: Language History1040782 +Node: V7/SVR3.11042425 +Node: SVR41044745 +Node: POSIX1046187 +Node: BTL1047573 +Node: POSIX/GNU1048307 +Node: Feature History1054083 +Node: Common Extensions1067174 +Node: Ranges and Locales1068486 +Ref: Ranges and Locales-Footnote-11073103 +Ref: Ranges and Locales-Footnote-21073130 +Ref: Ranges and Locales-Footnote-31073364 +Node: Contributors1073585 +Node: History summary1079010 +Node: Installation1080379 +Node: Gawk Distribution1081330 +Node: Getting1081814 +Node: Extracting1082638 +Node: Distribution contents1084280 +Node: Unix Installation1090050 +Node: Quick Installation1090667 +Node: Additional Configuration Options1093109 +Node: Configuration Philosophy1094847 +Node: Non-Unix Installation1097198 +Node: PC Installation1097656 +Node: PC Binary Installation1098967 +Node: PC Compiling1100815 +Ref: PC Compiling-Footnote-11103814 +Node: PC Testing1103919 +Node: PC Using1105095 +Node: Cygwin1109247 +Node: MSYS1110056 +Node: VMS Installation1110570 +Node: VMS Compilation1111366 +Ref: VMS Compilation-Footnote-11112588 +Node: VMS Dynamic Extensions1112646 +Node: VMS Installation Details1114019 +Node: VMS Running1116271 +Node: VMS GNV1119105 +Node: VMS Old Gawk1119828 +Node: Bugs1120298 +Node: Other Versions1124302 +Node: Installation summary1130529 +Node: Notes1131585 +Node: Compatibility Mode1132450 +Node: Additions1133232 +Node: Accessing The Source1134157 +Node: Adding Code1135593 +Node: New Ports1141771 +Node: Derived Files1146252 +Ref: Derived Files-Footnote-11151333 +Ref: Derived Files-Footnote-21151367 +Ref: Derived Files-Footnote-31151963 +Node: Future Extensions1152077 +Node: Implementation Limitations1152683 +Node: Extension Design1153931 +Node: Old Extension Problems1155085 +Ref: Old Extension Problems-Footnote-11156602 +Node: Extension New Mechanism Goals1156659 +Ref: Extension New Mechanism Goals-Footnote-11160019 +Node: Extension Other Design Decisions1160208 +Node: Extension Future Growth1162314 +Node: Old Extension Mechanism1163150 +Node: Notes summary1164912 +Node: Basic Concepts1166098 +Node: Basic High Level1166779 +Ref: figure-general-flow1167051 +Ref: figure-process-flow1167650 +Ref: Basic High Level-Footnote-11170879 +Node: Basic Data Typing1171064 +Node: Glossary1174392 +Node: Copying1199544 +Node: GNU Free Documentation License1237100 +Node: Index1262236 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 95747864..5e1dacf0 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -23868,6 +23868,7 @@ This program is a bit sloppy; it relies on @command{awk} to automatically close instead of doing it in an @code{END} rule. It also assumes that letters are contiguous in the character set, which isn't true for EBCDIC systems. + @ifset FOR_PRINT You might want to consider how to eliminate the use of @code{ord()} and @code{chr()}; this can be done in such a @@ -24904,6 +24905,12 @@ An obvious improvement to this program would be to set up the @code{t_ar} array only once, in a @code{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 @samp{a-z}, as allowed by the @command{tr} utility. +Look at the code for @file{cut.awk} (@pxref{Cut Program}) +for inspiration. + @c ENDOFRANGE chtra @c ENDOFRANGE tr @@ -26399,13 +26406,6 @@ information is printed. Modify the @command{awk} version same way. @item -The @code{split.awk} program (@pxref{Split Program}) uses -the @code{chr()} and @code{ord()} functions to move through the -letters of the alphabet. -Modify the program to instead use only the @command{awk} -built-in functions, such as @code{index()} and @code{substr()}. - -@item The @code{split.awk} program (@pxref{Split Program}) assumes that letters are contiguous in the character set, which isn't true for EBCDIC systems. diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 2c1bee3e..423b82ed 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -22966,6 +22966,7 @@ This program is a bit sloppy; it relies on @command{awk} to automatically close instead of doing it in an @code{END} rule. It also assumes that letters are contiguous in the character set, which isn't true for EBCDIC systems. + @ifset FOR_PRINT You might want to consider how to eliminate the use of @code{ord()} and @code{chr()}; this can be done in such a @@ -24002,6 +24003,12 @@ An obvious improvement to this program would be to set up the @code{t_ar} array only once, in a @code{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 @samp{a-z}, as allowed by the @command{tr} utility. +Look at the code for @file{cut.awk} (@pxref{Cut Program}) +for inspiration. + @c ENDOFRANGE chtra @c ENDOFRANGE tr @@ -25497,13 +25504,6 @@ information is printed. Modify the @command{awk} version same way. @item -The @code{split.awk} program (@pxref{Split Program}) uses -the @code{chr()} and @code{ord()} functions to move through the -letters of the alphabet. -Modify the program to instead use only the @command{awk} -built-in functions, such as @code{index()} and @code{substr()}. - -@item The @code{split.awk} program (@pxref{Split Program}) assumes that letters are contiguous in the character set, which isn't true for EBCDIC systems. |