diff options
-rw-r--r-- | awklib/eg/lib/isnumeric.awk | 23 | ||||
-rw-r--r-- | awklib/eg/prog/split.awk | 2 | ||||
-rw-r--r-- | doc/ChangeLog | 5 | ||||
-rw-r--r-- | doc/gawk.info | 617 | ||||
-rw-r--r-- | doc/gawk.texi | 33 | ||||
-rw-r--r-- | doc/gawktexi.in | 33 |
6 files changed, 369 insertions, 344 deletions
diff --git a/awklib/eg/lib/isnumeric.awk b/awklib/eg/lib/isnumeric.awk index 6309e76a..c2699022 100644 --- a/awklib/eg/lib/isnumeric.awk +++ b/awklib/eg/lib/isnumeric.awk @@ -2,13 +2,18 @@ function isnumeric(x, f) { - switch (typeof(x)) { - case "strnum": - case "number": - return 1 - case "string": - return (split(x, f, " ") == 1) && (typeof(f[1]) == "strnum") - default: - return 0 - } + switch (typeof(x)) { + case "strnum": + case "number": + return 1 + case "string": + return (split(x, f, " ") == 1) && (typeof(f[1]) == "strnum") + default: + return 0 + } } + +Please note that leading or trailing white space is disregarded in deciding +whether a value is numeric or not, so if it matters to you, you may want +to add an additional check for that. + diff --git a/awklib/eg/prog/split.awk b/awklib/eg/prog/split.awk index 16780044..4804de5f 100644 --- a/awklib/eg/prog/split.awk +++ b/awklib/eg/prog/split.awk @@ -8,7 +8,7 @@ # Rewritten September 2020 -function usage( common) +function usage( common) { common = "[-a suffix-len] [file [outname]]" printf("usage: split [-l count] %s\n", common) > "/dev/stderr" diff --git a/doc/ChangeLog b/doc/ChangeLog index 9ffc67d0..897f994d 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2021-06-23 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in (Isnumeric Function): Add an additional paragraph + from Andy. Turn some real tabs into spaces. + 2021-06-22 Andrew J. Schorr <aschorr@telemetry-investments.com> * gawktexi.in (Isnumeric Function): New node. diff --git a/doc/gawk.info b/doc/gawk.info index 1820528d..022965d1 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -16303,7 +16303,7 @@ three-character string '"\"'\""': File: gawk.info, Node: Isnumeric Function, Prev: Shell Quoting, Up: General Functions -10.2.10 Checking whether a value is numeric +10.2.10 Checking Whether A Value Is Numeric ------------------------------------------- A frequent programming question is how to ascertain whether a value is @@ -16315,17 +16315,22 @@ user input by using the 'split()' function: function isnumeric(x, f) { - switch (typeof(x)) { - case "strnum": - case "number": - return 1 - case "string": - return (split(x, f, " ") == 1) && (typeof(f[1]) == "strnum") - default: - return 0 - } + switch (typeof(x)) { + case "strnum": + case "number": + return 1 + case "string": + return (split(x, f, " ") == 1) && (typeof(f[1]) == "strnum") + default: + return 0 + } } + Please note that leading or trailing white space is disregarded in deciding + whether a value is numeric or not, so if it matters to you, you may want + to add an additional check for that. + + File: gawk.info, Node: Data File Management, Next: Getopt Function, Prev: General Functions, Up: Library Functions @@ -16997,8 +17002,8 @@ results of some sample runs of the test program: -| c = <otherd>, Optarg = <> -| c = <otherc>, Optarg = <> -| non-option arguments: - -| ARGV[8] = <arg1> - -| ARGV[9] = <arg2> + -| ARGV[8] = <arg1> + -| ARGV[9] = <arg2> In all the runs, the first '--' terminates the arguments to 'awk', so that it does not try to interpret the '-a', etc., as its own options. @@ -18584,7 +18589,7 @@ the function's lines short so that they look nice on the page: # # Requires getopt() library function. - function usage( common) + function usage( common) { common = "[-a suffix-len] [file [outname]]" printf("usage: split [-l count] %s\n", common) > "/dev/stderr" @@ -21514,7 +21519,7 @@ purpose: printf("%d\n", x + y); return 0; } - $ cc -O add.c -o add Compile the program + $ cc -O add.c -o add Compile the program You could then write an exceedingly simple 'gawk' program to add numbers by passing them to the coprocess: @@ -38531,298 +38536,298 @@ Node: Getlocaltime Function672799 Node: Readfile Function676541 Node: Shell Quoting678518 Node: Isnumeric Function679946 -Node: Data File Management680688 -Node: Filetrans Function681320 -Node: Rewind Function685416 -Node: File Checking687325 -Ref: File Checking-Footnote-1688659 -Node: Empty Files688860 -Node: Ignoring Assigns690839 -Node: Getopt Function692389 -Ref: Getopt Function-Footnote-1707600 -Node: Passwd Functions707800 -Ref: Passwd Functions-Footnote-1716639 -Node: Group Functions716727 -Ref: Group Functions-Footnote-1724625 -Node: Walking Arrays724832 -Node: Library Functions Summary727840 -Node: Library Exercises729246 -Node: Sample Programs729711 -Node: Running Examples730481 -Node: Clones731209 -Node: Cut Program732433 -Node: Egrep Program742573 -Node: Id Program751574 -Node: Split Program761521 -Ref: Split Program-Footnote-1771411 -Node: Tee Program771584 -Node: Uniq Program774374 -Node: Wc Program781962 -Node: Bytes vs. Characters782349 -Node: Using extensions783897 -Node: wc program784651 -Node: Miscellaneous Programs789516 -Node: Dupword Program790729 -Node: Alarm Program792759 -Node: Translate Program797614 -Ref: Translate Program-Footnote-1802179 -Node: Labels Program802449 -Ref: Labels Program-Footnote-1805800 -Node: Word Sorting805884 -Node: History Sorting809956 -Node: Extract Program812181 -Node: Simple Sed820235 -Node: Igawk Program823309 -Ref: Igawk Program-Footnote-1837640 -Ref: Igawk Program-Footnote-2837842 -Ref: Igawk Program-Footnote-3837964 -Node: Anagram Program838079 -Node: Signature Program841141 -Node: Programs Summary842388 -Node: Programs Exercises843602 -Ref: Programs Exercises-Footnote-1847732 -Node: Advanced Features847818 -Node: Nondecimal Data849885 -Node: Array Sorting851476 -Node: Controlling Array Traversal852176 -Ref: Controlling Array Traversal-Footnote-1860544 -Node: Array Sorting Functions860662 -Ref: Array Sorting Functions-Footnote-1865753 -Node: Two-way I/O865949 -Ref: Two-way I/O-Footnote-1873670 -Ref: Two-way I/O-Footnote-2873857 -Node: TCP/IP Networking873939 -Node: Profiling877057 -Node: Extension Philosophy886366 -Node: Advanced Features Summary887845 -Node: Internationalization889860 -Node: I18N and L10N891534 -Node: Explaining gettext892221 -Ref: Explaining gettext-Footnote-1898113 -Ref: Explaining gettext-Footnote-2898298 -Node: Programmer i18n898463 -Ref: Programmer i18n-Footnote-1903412 -Node: Translator i18n903461 -Node: String Extraction904255 -Ref: String Extraction-Footnote-1905387 -Node: Printf Ordering905473 -Ref: Printf Ordering-Footnote-1908259 -Node: I18N Portability908323 -Ref: I18N Portability-Footnote-1910779 -Node: I18N Example910842 -Ref: I18N Example-Footnote-1914117 -Ref: I18N Example-Footnote-2914190 -Node: Gawk I18N914299 -Node: I18N Summary914948 -Node: Debugger916289 -Node: Debugging917289 -Node: Debugging Concepts917730 -Node: Debugging Terms919539 -Node: Awk Debugging922114 -Ref: Awk Debugging-Footnote-1923059 -Node: Sample Debugging Session923191 -Node: Debugger Invocation923725 -Node: Finding The Bug925111 -Node: List of Debugger Commands931585 -Node: Breakpoint Control932918 -Node: Debugger Execution Control936612 -Node: Viewing And Changing Data939974 -Node: Execution Stack943515 -Node: Debugger Info945152 -Node: Miscellaneous Debugger Commands949223 -Node: Readline Support954285 -Node: Limitations955181 -Node: Debugging Summary957735 -Node: Namespaces959014 -Node: Global Namespace960125 -Node: Qualified Names961523 -Node: Default Namespace962522 -Node: Changing The Namespace963263 -Node: Naming Rules964877 -Node: Internal Name Management966725 -Node: Namespace Example967767 -Node: Namespace And Features970329 -Node: Namespace Summary971764 -Node: Arbitrary Precision Arithmetic973241 -Node: Computer Arithmetic974728 -Ref: table-numeric-ranges978494 -Ref: table-floating-point-ranges978987 -Ref: Computer Arithmetic-Footnote-1979645 -Node: Math Definitions979702 -Ref: table-ieee-formats983018 -Ref: Math Definitions-Footnote-1983621 -Node: MPFR features983726 -Node: FP Math Caution985444 -Ref: FP Math Caution-Footnote-1986516 -Node: Inexactness of computations986885 -Node: Inexact representation987845 -Node: Comparing FP Values989205 -Node: Errors accumulate990446 -Node: Getting Accuracy991879 -Node: Try To Round994589 -Node: Setting precision995488 -Ref: table-predefined-precision-strings996185 -Node: Setting the rounding mode998015 -Ref: table-gawk-rounding-modes998389 -Ref: Setting the rounding mode-Footnote-11002320 -Node: Arbitrary Precision Integers1002499 -Ref: Arbitrary Precision Integers-Footnote-11005674 -Node: Checking for MPFR1005823 -Node: POSIX Floating Point Problems1007297 -Ref: POSIX Floating Point Problems-Footnote-11011582 -Node: Floating point summary1011620 -Node: Dynamic Extensions1013810 -Node: Extension Intro1015363 -Node: Plugin License1016629 -Node: Extension Mechanism Outline1017426 -Ref: figure-load-extension1017865 -Ref: figure-register-new-function1019430 -Ref: figure-call-new-function1020522 -Node: Extension API Description1022584 -Node: Extension API Functions Introduction1024297 -Ref: table-api-std-headers1026133 -Node: General Data Types1030382 -Ref: General Data Types-Footnote-11039012 -Node: Memory Allocation Functions1039311 -Ref: Memory Allocation Functions-Footnote-11043812 -Node: Constructor Functions1043911 -Node: API Ownership of MPFR and GMP Values1047377 -Node: Registration Functions1048690 -Node: Extension Functions1049390 -Node: Exit Callback Functions1054712 -Node: Extension Version String1055962 -Node: Input Parsers1056625 -Node: Output Wrappers1069346 -Node: Two-way processors1073858 -Node: Printing Messages1076123 -Ref: Printing Messages-Footnote-11077294 -Node: Updating ERRNO1077447 -Node: Requesting Values1078186 -Ref: table-value-types-returned1078923 -Node: Accessing Parameters1079859 -Node: Symbol Table Access1081096 -Node: Symbol table by name1081608 -Ref: Symbol table by name-Footnote-11084632 -Node: Symbol table by cookie1084760 -Ref: Symbol table by cookie-Footnote-11088945 -Node: Cached values1089009 -Ref: Cached values-Footnote-11092545 -Node: Array Manipulation1092698 -Ref: Array Manipulation-Footnote-11093789 -Node: Array Data Types1093826 -Ref: Array Data Types-Footnote-11096484 -Node: Array Functions1096576 -Node: Flattening Arrays1101074 -Node: Creating Arrays1108050 -Node: Redirection API1112817 -Node: Extension API Variables1115650 -Node: Extension Versioning1116361 -Ref: gawk-api-version1116790 -Node: Extension GMP/MPFR Versioning1118521 -Node: Extension API Informational Variables1120149 -Node: Extension API Boilerplate1121222 -Node: Changes from API V11125196 -Node: Finding Extensions1126768 -Node: Extension Example1127327 -Node: Internal File Description1128125 -Node: Internal File Ops1132205 -Ref: Internal File Ops-Footnote-11143555 -Node: Using Internal File Ops1143695 -Ref: Using Internal File Ops-Footnote-11146078 -Node: Extension Samples1146352 -Node: Extension Sample File Functions1147881 -Node: Extension Sample Fnmatch1155530 -Node: Extension Sample Fork1157017 -Node: Extension Sample Inplace1158235 -Node: Extension Sample Ord1161861 -Node: Extension Sample Readdir1162697 -Ref: table-readdir-file-types1163586 -Node: Extension Sample Revout1164653 -Node: Extension Sample Rev2way1165242 -Node: Extension Sample Read write array1165982 -Node: Extension Sample Readfile1167924 -Node: Extension Sample Time1169019 -Node: Extension Sample API Tests1170771 -Node: gawkextlib1171263 -Node: Extension summary1174181 -Node: Extension Exercises1177883 -Node: Language History1179125 -Node: V7/SVR3.11180781 -Node: SVR41182933 -Node: POSIX1184367 -Node: BTL1185748 -Node: POSIX/GNU1186477 -Node: Feature History1192255 -Node: Common Extensions1209430 -Node: Ranges and Locales1210713 -Ref: Ranges and Locales-Footnote-11215329 -Ref: Ranges and Locales-Footnote-21215356 -Ref: Ranges and Locales-Footnote-31215591 -Node: Contributors1215814 -Node: History summary1221811 -Node: Installation1223191 -Node: Gawk Distribution1224135 -Node: Getting1224619 -Node: Extracting1225582 -Node: Distribution contents1227220 -Node: Unix Installation1233700 -Node: Quick Installation1234382 -Node: Compiling with MPFR1236863 -Node: Shell Startup Files1237555 -Node: Additional Configuration Options1238644 -Node: Configuration Philosophy1240959 -Node: Non-Unix Installation1243328 -Node: PC Installation1243788 -Node: PC Binary Installation1244626 -Node: PC Compiling1245061 -Node: PC Using1246178 -Node: Cygwin1249731 -Node: MSYS1250955 -Node: VMS Installation1251557 -Node: VMS Compilation1252348 -Ref: VMS Compilation-Footnote-11253577 -Node: VMS Dynamic Extensions1253635 -Node: VMS Installation Details1255320 -Node: VMS Running1257573 -Node: VMS GNV1261852 -Node: VMS Old Gawk1262587 -Node: Bugs1263058 -Node: Bug address1263807 -Node: Usenet1266789 -Node: Performance bugs1267798 -Node: Maintainers1270655 -Node: Other Versions1271850 -Node: Installation summary1279715 -Node: Notes1280924 -Node: Compatibility Mode1281718 -Node: Additions1282500 -Node: Accessing The Source1283425 -Node: Adding Code1284862 -Node: New Ports1291081 -Node: Derived Files1295456 -Ref: Derived Files-Footnote-11301116 -Ref: Derived Files-Footnote-21301151 -Ref: Derived Files-Footnote-31301749 -Node: Future Extensions1301863 -Node: Implementation Limitations1302521 -Node: Extension Design1303731 -Node: Old Extension Problems1304875 -Ref: Old Extension Problems-Footnote-11306393 -Node: Extension New Mechanism Goals1306450 -Ref: Extension New Mechanism Goals-Footnote-11309814 -Node: Extension Other Design Decisions1310003 -Node: Extension Future Growth1312116 -Node: Notes summary1312722 -Node: Basic Concepts1313880 -Node: Basic High Level1314561 -Ref: figure-general-flow1314843 -Ref: figure-process-flow1315528 -Ref: Basic High Level-Footnote-11318829 -Node: Basic Data Typing1319014 -Node: Glossary1322342 -Node: Copying1354227 -Node: GNU Free Documentation License1391770 -Node: Index1416890 +Node: Data File Management680927 +Node: Filetrans Function681559 +Node: Rewind Function685655 +Node: File Checking687564 +Ref: File Checking-Footnote-1688898 +Node: Empty Files689099 +Node: Ignoring Assigns691078 +Node: Getopt Function692628 +Ref: Getopt Function-Footnote-1707851 +Node: Passwd Functions708051 +Ref: Passwd Functions-Footnote-1716890 +Node: Group Functions716978 +Ref: Group Functions-Footnote-1724876 +Node: Walking Arrays725083 +Node: Library Functions Summary728091 +Node: Library Exercises729497 +Node: Sample Programs729962 +Node: Running Examples730732 +Node: Clones731460 +Node: Cut Program732684 +Node: Egrep Program742824 +Node: Id Program751825 +Node: Split Program761772 +Ref: Split Program-Footnote-1771665 +Node: Tee Program771838 +Node: Uniq Program774628 +Node: Wc Program782216 +Node: Bytes vs. Characters782603 +Node: Using extensions784151 +Node: wc program784905 +Node: Miscellaneous Programs789770 +Node: Dupword Program790983 +Node: Alarm Program793013 +Node: Translate Program797868 +Ref: Translate Program-Footnote-1802433 +Node: Labels Program802703 +Ref: Labels Program-Footnote-1806054 +Node: Word Sorting806138 +Node: History Sorting810210 +Node: Extract Program812435 +Node: Simple Sed820489 +Node: Igawk Program823563 +Ref: Igawk Program-Footnote-1837894 +Ref: Igawk Program-Footnote-2838096 +Ref: Igawk Program-Footnote-3838218 +Node: Anagram Program838333 +Node: Signature Program841395 +Node: Programs Summary842642 +Node: Programs Exercises843856 +Ref: Programs Exercises-Footnote-1847986 +Node: Advanced Features848072 +Node: Nondecimal Data850139 +Node: Array Sorting851730 +Node: Controlling Array Traversal852430 +Ref: Controlling Array Traversal-Footnote-1860798 +Node: Array Sorting Functions860916 +Ref: Array Sorting Functions-Footnote-1866007 +Node: Two-way I/O866203 +Ref: Two-way I/O-Footnote-1873929 +Ref: Two-way I/O-Footnote-2874116 +Node: TCP/IP Networking874198 +Node: Profiling877316 +Node: Extension Philosophy886625 +Node: Advanced Features Summary888104 +Node: Internationalization890119 +Node: I18N and L10N891793 +Node: Explaining gettext892480 +Ref: Explaining gettext-Footnote-1898372 +Ref: Explaining gettext-Footnote-2898557 +Node: Programmer i18n898722 +Ref: Programmer i18n-Footnote-1903671 +Node: Translator i18n903720 +Node: String Extraction904514 +Ref: String Extraction-Footnote-1905646 +Node: Printf Ordering905732 +Ref: Printf Ordering-Footnote-1908518 +Node: I18N Portability908582 +Ref: I18N Portability-Footnote-1911038 +Node: I18N Example911101 +Ref: I18N Example-Footnote-1914376 +Ref: I18N Example-Footnote-2914449 +Node: Gawk I18N914558 +Node: I18N Summary915207 +Node: Debugger916548 +Node: Debugging917548 +Node: Debugging Concepts917989 +Node: Debugging Terms919798 +Node: Awk Debugging922373 +Ref: Awk Debugging-Footnote-1923318 +Node: Sample Debugging Session923450 +Node: Debugger Invocation923984 +Node: Finding The Bug925370 +Node: List of Debugger Commands931844 +Node: Breakpoint Control933177 +Node: Debugger Execution Control936871 +Node: Viewing And Changing Data940233 +Node: Execution Stack943774 +Node: Debugger Info945411 +Node: Miscellaneous Debugger Commands949482 +Node: Readline Support954544 +Node: Limitations955440 +Node: Debugging Summary957994 +Node: Namespaces959273 +Node: Global Namespace960384 +Node: Qualified Names961782 +Node: Default Namespace962781 +Node: Changing The Namespace963522 +Node: Naming Rules965136 +Node: Internal Name Management966984 +Node: Namespace Example968026 +Node: Namespace And Features970588 +Node: Namespace Summary972023 +Node: Arbitrary Precision Arithmetic973500 +Node: Computer Arithmetic974987 +Ref: table-numeric-ranges978753 +Ref: table-floating-point-ranges979246 +Ref: Computer Arithmetic-Footnote-1979904 +Node: Math Definitions979961 +Ref: table-ieee-formats983277 +Ref: Math Definitions-Footnote-1983880 +Node: MPFR features983985 +Node: FP Math Caution985703 +Ref: FP Math Caution-Footnote-1986775 +Node: Inexactness of computations987144 +Node: Inexact representation988104 +Node: Comparing FP Values989464 +Node: Errors accumulate990705 +Node: Getting Accuracy992138 +Node: Try To Round994848 +Node: Setting precision995747 +Ref: table-predefined-precision-strings996444 +Node: Setting the rounding mode998274 +Ref: table-gawk-rounding-modes998648 +Ref: Setting the rounding mode-Footnote-11002579 +Node: Arbitrary Precision Integers1002758 +Ref: Arbitrary Precision Integers-Footnote-11005933 +Node: Checking for MPFR1006082 +Node: POSIX Floating Point Problems1007556 +Ref: POSIX Floating Point Problems-Footnote-11011841 +Node: Floating point summary1011879 +Node: Dynamic Extensions1014069 +Node: Extension Intro1015622 +Node: Plugin License1016888 +Node: Extension Mechanism Outline1017685 +Ref: figure-load-extension1018124 +Ref: figure-register-new-function1019689 +Ref: figure-call-new-function1020781 +Node: Extension API Description1022843 +Node: Extension API Functions Introduction1024556 +Ref: table-api-std-headers1026392 +Node: General Data Types1030641 +Ref: General Data Types-Footnote-11039271 +Node: Memory Allocation Functions1039570 +Ref: Memory Allocation Functions-Footnote-11044071 +Node: Constructor Functions1044170 +Node: API Ownership of MPFR and GMP Values1047636 +Node: Registration Functions1048949 +Node: Extension Functions1049649 +Node: Exit Callback Functions1054971 +Node: Extension Version String1056221 +Node: Input Parsers1056884 +Node: Output Wrappers1069605 +Node: Two-way processors1074117 +Node: Printing Messages1076382 +Ref: Printing Messages-Footnote-11077553 +Node: Updating ERRNO1077706 +Node: Requesting Values1078445 +Ref: table-value-types-returned1079182 +Node: Accessing Parameters1080118 +Node: Symbol Table Access1081355 +Node: Symbol table by name1081867 +Ref: Symbol table by name-Footnote-11084891 +Node: Symbol table by cookie1085019 +Ref: Symbol table by cookie-Footnote-11089204 +Node: Cached values1089268 +Ref: Cached values-Footnote-11092804 +Node: Array Manipulation1092957 +Ref: Array Manipulation-Footnote-11094048 +Node: Array Data Types1094085 +Ref: Array Data Types-Footnote-11096743 +Node: Array Functions1096835 +Node: Flattening Arrays1101333 +Node: Creating Arrays1108309 +Node: Redirection API1113076 +Node: Extension API Variables1115909 +Node: Extension Versioning1116620 +Ref: gawk-api-version1117049 +Node: Extension GMP/MPFR Versioning1118780 +Node: Extension API Informational Variables1120408 +Node: Extension API Boilerplate1121481 +Node: Changes from API V11125455 +Node: Finding Extensions1127027 +Node: Extension Example1127586 +Node: Internal File Description1128384 +Node: Internal File Ops1132464 +Ref: Internal File Ops-Footnote-11143814 +Node: Using Internal File Ops1143954 +Ref: Using Internal File Ops-Footnote-11146337 +Node: Extension Samples1146611 +Node: Extension Sample File Functions1148140 +Node: Extension Sample Fnmatch1155789 +Node: Extension Sample Fork1157276 +Node: Extension Sample Inplace1158494 +Node: Extension Sample Ord1162120 +Node: Extension Sample Readdir1162956 +Ref: table-readdir-file-types1163845 +Node: Extension Sample Revout1164912 +Node: Extension Sample Rev2way1165501 +Node: Extension Sample Read write array1166241 +Node: Extension Sample Readfile1168183 +Node: Extension Sample Time1169278 +Node: Extension Sample API Tests1171030 +Node: gawkextlib1171522 +Node: Extension summary1174440 +Node: Extension Exercises1178142 +Node: Language History1179384 +Node: V7/SVR3.11181040 +Node: SVR41183192 +Node: POSIX1184626 +Node: BTL1186007 +Node: POSIX/GNU1186736 +Node: Feature History1192514 +Node: Common Extensions1209689 +Node: Ranges and Locales1210972 +Ref: Ranges and Locales-Footnote-11215588 +Ref: Ranges and Locales-Footnote-21215615 +Ref: Ranges and Locales-Footnote-31215850 +Node: Contributors1216073 +Node: History summary1222070 +Node: Installation1223450 +Node: Gawk Distribution1224394 +Node: Getting1224878 +Node: Extracting1225841 +Node: Distribution contents1227479 +Node: Unix Installation1233959 +Node: Quick Installation1234641 +Node: Compiling with MPFR1237122 +Node: Shell Startup Files1237814 +Node: Additional Configuration Options1238903 +Node: Configuration Philosophy1241218 +Node: Non-Unix Installation1243587 +Node: PC Installation1244047 +Node: PC Binary Installation1244885 +Node: PC Compiling1245320 +Node: PC Using1246437 +Node: Cygwin1249990 +Node: MSYS1251214 +Node: VMS Installation1251816 +Node: VMS Compilation1252607 +Ref: VMS Compilation-Footnote-11253836 +Node: VMS Dynamic Extensions1253894 +Node: VMS Installation Details1255579 +Node: VMS Running1257832 +Node: VMS GNV1262111 +Node: VMS Old Gawk1262846 +Node: Bugs1263317 +Node: Bug address1264066 +Node: Usenet1267048 +Node: Performance bugs1268057 +Node: Maintainers1270914 +Node: Other Versions1272109 +Node: Installation summary1279974 +Node: Notes1281183 +Node: Compatibility Mode1281977 +Node: Additions1282759 +Node: Accessing The Source1283684 +Node: Adding Code1285121 +Node: New Ports1291340 +Node: Derived Files1295715 +Ref: Derived Files-Footnote-11301375 +Ref: Derived Files-Footnote-21301410 +Ref: Derived Files-Footnote-31302008 +Node: Future Extensions1302122 +Node: Implementation Limitations1302780 +Node: Extension Design1303990 +Node: Old Extension Problems1305134 +Ref: Old Extension Problems-Footnote-11306652 +Node: Extension New Mechanism Goals1306709 +Ref: Extension New Mechanism Goals-Footnote-11310073 +Node: Extension Other Design Decisions1310262 +Node: Extension Future Growth1312375 +Node: Notes summary1312981 +Node: Basic Concepts1314139 +Node: Basic High Level1314820 +Ref: figure-general-flow1315102 +Ref: figure-process-flow1315787 +Ref: Basic High Level-Footnote-11319088 +Node: Basic Data Typing1319273 +Node: Glossary1322601 +Node: Copying1354486 +Node: GNU Free Documentation License1392029 +Node: Index1417149 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index fb71bb68..0372897f 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -23256,7 +23256,7 @@ function shell_quote(s, # parameter @end example @node Isnumeric Function -@subsection Checking whether a value is numeric +@subsection Checking Whether A Value Is Numeric A frequent programming question is how to ascertain whether a value is numeric. This can be solved by using this example function @code{isnumeric()}, which @@ -23271,16 +23271,21 @@ employs the trick of converting a string value to user input by using the function isnumeric(x, f) @{ - switch (typeof(x)) @{ - case "strnum": - case "number": - return 1 - case "string": - return (split(x, f, " ") == 1) && (typeof(f[1]) == "strnum") - default: - return 0 - @} + switch (typeof(x)) @{ + case "strnum": + case "number": + return 1 + case "string": + return (split(x, f, " ") == 1) && (typeof(f[1]) == "strnum") + default: + return 0 + @} @} + +Please note that leading or trailing white space is disregarded in deciding +whether a value is numeric or not, so if it matters to you, you may want +to add an additional check for that. + @c endfile @end example @@ -24155,8 +24160,8 @@ $ @kbd{awk -f getopt.awk -v _getopt_test=1 -- -a \} @print{} c = <otherd>, Optarg = <> @print{} c = <otherc>, Optarg = <> @print{} non-option arguments: -@print{} ARGV[8] = <arg1> -@print{} ARGV[9] = <arg2> +@print{} ARGV[8] = <arg1> +@print{} ARGV[9] = <arg2> @end example In all the runs, the first @option{--} terminates the arguments to @@ -26353,7 +26358,7 @@ look nice on the page: @end ignore @c file eg/prog/split.awk -function usage( common) +function usage( common) @{ common = "[-a suffix-len] [file [outname]]" printf("usage: split [-l count] %s\n", common) > "/dev/stderr" @@ -30186,7 +30191,7 @@ main(void) printf("%d\n", x + y); return 0; @} -$ @kbd{cc -O add.c -o add} @ii{Compile the program} +$ @kbd{cc -O add.c -o add} @ii{Compile the program} @end example You could then write an exceedingly simple @command{gawk} program diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 81a24079..236ef638 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -22168,7 +22168,7 @@ function shell_quote(s, # parameter @end example @node Isnumeric Function -@subsection Checking whether a value is numeric +@subsection Checking Whether A Value Is Numeric A frequent programming question is how to ascertain whether a value is numeric. This can be solved by using this example function @code{isnumeric()}, which @@ -22183,16 +22183,21 @@ employs the trick of converting a string value to user input by using the function isnumeric(x, f) @{ - switch (typeof(x)) @{ - case "strnum": - case "number": - return 1 - case "string": - return (split(x, f, " ") == 1) && (typeof(f[1]) == "strnum") - default: - return 0 - @} + switch (typeof(x)) @{ + case "strnum": + case "number": + return 1 + case "string": + return (split(x, f, " ") == 1) && (typeof(f[1]) == "strnum") + default: + return 0 + @} @} + +Please note that leading or trailing white space is disregarded in deciding +whether a value is numeric or not, so if it matters to you, you may want +to add an additional check for that. + @c endfile @end example @@ -23037,8 +23042,8 @@ $ @kbd{awk -f getopt.awk -v _getopt_test=1 -- -a \} @print{} c = <otherd>, Optarg = <> @print{} c = <otherc>, Optarg = <> @print{} non-option arguments: -@print{} ARGV[8] = <arg1> -@print{} ARGV[9] = <arg2> +@print{} ARGV[8] = <arg1> +@print{} ARGV[9] = <arg2> @end example In all the runs, the first @option{--} terminates the arguments to @@ -25235,7 +25240,7 @@ look nice on the page: @end ignore @c file eg/prog/split.awk -function usage( common) +function usage( common) @{ common = "[-a suffix-len] [file [outname]]" printf("usage: split [-l count] %s\n", common) > "/dev/stderr" @@ -29068,7 +29073,7 @@ main(void) printf("%d\n", x + y); return 0; @} -$ @kbd{cc -O add.c -o add} @ii{Compile the program} +$ @kbd{cc -O add.c -o add} @ii{Compile the program} @end example You could then write an exceedingly simple @command{gawk} program |