diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | doc/ChangeLog | 5 | ||||
-rw-r--r-- | doc/gawk.info | 1011 | ||||
-rw-r--r-- | doc/gawk.texi | 11 | ||||
-rw-r--r-- | doc/gawktexi.in | 11 | ||||
-rw-r--r-- | pc/ChangeLog | 4 | ||||
-rw-r--r-- | pc/Makefile.tst | 7 | ||||
-rw-r--r-- | test/ChangeLog | 5 | ||||
-rw-r--r-- | test/Makefile.am | 5 | ||||
-rw-r--r-- | test/Makefile.in | 10 | ||||
-rw-r--r-- | test/Maketests | 5 | ||||
-rw-r--r-- | test/fpat9.awk | 22 | ||||
-rw-r--r-- | test/fpat9.in | 7 | ||||
-rw-r--r-- | test/fpat9.ok | 64 |
15 files changed, 672 insertions, 501 deletions
@@ -1,3 +1,7 @@ +2020-12-26 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS: Updated. + 2020-12-20 Arnold D. Robbins <arnold@skeeve.com> Second steps fixing +inform, +nancy, for MPFR. @@ -48,6 +48,8 @@ Changes from 5.1.0 to 5.1.1 9. Several example programs in the manual have been updated to their modern POSIX equivalents. +10. Handling of Infinity and NaN values has been improved. + xx. There have been numerous minor code cleanups and bug fixes. See the ChangeLog for details. diff --git a/doc/ChangeLog b/doc/ChangeLog index de71baa5..6cb20896 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2020-12-26 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in (More CSV): Add indexing and reference to + Manuel Collado's CSVMODE library. + 2020-12-07 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in (awk split records): Remove the bit about POSIX diff --git a/doc/gawk.info b/doc/gawk.info index 258ddf71..ee2526ec 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -5663,6 +5663,11 @@ And here is his test program: -| <p,,s> -| NF = 3 <p><><s> + In general, using 'FPAT' to do your own CSV parsing is like having a +bed with a blanket that's not quite big enough. There's always a corner +that isn't covered. We recommend, instead, that you use Manuel +Collado's 'CSVMODE' library for 'gawk' (http://mcollado.z15.es/xgawk/). + File: gawk.info, Node: Testing field creation, Next: Multiple Line, Prev: Splitting By Content, Up: Reading Files @@ -35386,6 +35391,7 @@ Index * Close, Diane <1>: Contributors. (line 21) * Collado, Manuel: Acknowledgments. (line 60) * Collado, Manuel <1>: More CSV. (line 6) +* Collado, Manuel <2>: More CSV. (line 52) * collating elements: Bracket Expressions. (line 90) * collating symbols: Bracket Expressions. (line 97) * Colombo, Antonio: Acknowledgments. (line 60) @@ -35395,6 +35401,10 @@ Index * columns, aligning: Print Examples. (line 69) * columns, cutting: Cut Program. (line 6) * comma (,), in range patterns: Ranges. (line 6) +* Comma separated values (CSV) data, parsing with FPAT: Splitting By Content. + (line 19) +* Comma separated values (CSV) data, parsing with FPAT library: More CSV. + (line 52) * command completion, in debugger: Readline Support. (line 6) * command line, formats: Running gawk. (line 12) * command line, option -f: Long. (line 12) @@ -35510,6 +35520,11 @@ Index * csh utility: Statements/Lines. (line 45) * csh utility, POSIXLY_CORRECT environment variable: Options. (line 406) * csh utility, |& operator, comparison with: Two-way I/O. (line 27) +* CSV (comma separated values) data, parsing with FPAT: Splitting By Content. + (line 19) +* CSV (comma separated values) data, parsing with CSVMODE library: More CSV. + (line 52) +* CSVMODE library for gawk: More CSV. (line 52) * ctime() user-defined function: Function Example. (line 74) * Curreli, Marco: Contributors. (line 147) * currency symbols, localization: Explaining gettext. (line 104) @@ -38118,504 +38133,504 @@ Node: Fields with fixed data246249 Node: Splitting By Content247767 Ref: Splitting By Content-Footnote-1251550 Node: More CSV251713 -Node: Testing field creation253023 -Node: Multiple Line254648 -Node: Getline260925 -Node: Plain Getline263394 -Node: Getline/Variable265967 -Node: Getline/File267118 -Node: Getline/Variable/File268506 -Ref: Getline/Variable/File-Footnote-1270111 -Node: Getline/Pipe270199 -Node: Getline/Variable/Pipe272903 -Node: Getline/Coprocess274038 -Node: Getline/Variable/Coprocess275305 -Node: Getline Notes276047 -Node: Getline Summary278844 -Ref: table-getline-variants279268 -Node: Read Timeout280016 -Ref: Read Timeout-Footnote-1283922 -Node: Retrying Input283980 -Node: Command-line directories285179 -Node: Input Summary286085 -Node: Input Exercises289257 -Node: Printing289691 -Node: Print291525 -Node: Print Examples292982 -Node: Output Separators295762 -Node: OFMT297779 -Node: Printf299135 -Node: Basic Printf299920 -Node: Control Letters301494 -Node: Format Modifiers306656 -Node: Printf Examples312671 -Node: Redirection315157 -Node: Special FD321998 -Ref: Special FD-Footnote-1325166 -Node: Special Files325240 -Node: Other Inherited Files325857 -Node: Special Network326858 -Node: Special Caveats327718 -Node: Close Files And Pipes328667 -Ref: table-close-pipe-return-values335574 -Ref: Close Files And Pipes-Footnote-1336387 -Ref: Close Files And Pipes-Footnote-2336535 -Node: Nonfatal336687 -Node: Output Summary339025 -Node: Output Exercises340247 -Node: Expressions340926 -Node: Values342114 -Node: Constants342792 -Node: Scalar Constants343483 -Ref: Scalar Constants-Footnote-1345993 -Node: Nondecimal-numbers346243 -Node: Regexp Constants349244 -Node: Using Constant Regexps349770 -Node: Standard Regexp Constants350392 -Node: Strong Regexp Constants353580 -Node: Variables356592 -Node: Using Variables357249 -Node: Assignment Options359159 -Node: Conversion361630 -Node: Strings And Numbers362154 -Ref: Strings And Numbers-Footnote-1365217 -Node: Locale influences conversions365326 -Ref: table-locale-affects368084 -Node: All Operators368702 -Node: Arithmetic Ops369331 -Node: Concatenation372047 -Ref: Concatenation-Footnote-1374894 -Node: Assignment Ops375001 -Ref: table-assign-ops379992 -Node: Increment Ops381305 -Node: Truth Values and Conditions384765 -Node: Truth Values385839 -Node: Typing and Comparison386887 -Node: Variable Typing387707 -Ref: Variable Typing-Footnote-1394170 -Ref: Variable Typing-Footnote-2394242 -Node: Comparison Operators394319 -Ref: table-relational-ops394738 -Node: POSIX String Comparison398233 -Ref: POSIX String Comparison-Footnote-1399928 -Ref: POSIX String Comparison-Footnote-2400067 -Node: Boolean Ops400151 -Ref: Boolean Ops-Footnote-1404633 -Node: Conditional Exp404725 -Node: Function Calls406461 -Node: Precedence410338 -Node: Locales413997 -Node: Expressions Summary415629 -Node: Patterns and Actions418202 -Node: Pattern Overview419322 -Node: Regexp Patterns420999 -Node: Expression Patterns421541 -Node: Ranges425322 -Node: BEGIN/END428430 -Node: Using BEGIN/END429191 -Ref: Using BEGIN/END-Footnote-1431945 -Node: I/O And BEGIN/END432051 -Node: BEGINFILE/ENDFILE434364 -Node: Empty437595 -Node: Using Shell Variables437912 -Node: Action Overview440186 -Node: Statements442511 -Node: If Statement444359 -Node: While Statement445854 -Node: Do Statement447882 -Node: For Statement449030 -Node: Switch Statement452201 -Node: Break Statement454642 -Node: Continue Statement456734 -Node: Next Statement458561 -Node: Nextfile Statement460944 -Node: Exit Statement463633 -Node: Built-in Variables466036 -Node: User-modified467169 -Node: Auto-set474936 -Ref: Auto-set-Footnote-1491743 -Ref: Auto-set-Footnote-2491949 -Node: ARGC and ARGV492005 -Node: Pattern Action Summary496218 -Node: Arrays498648 -Node: Array Basics499977 -Node: Array Intro500821 -Ref: figure-array-elements502796 -Ref: Array Intro-Footnote-1505500 -Node: Reference to Elements505628 -Node: Assigning Elements508092 -Node: Array Example508583 -Node: Scanning an Array510342 -Node: Controlling Scanning513364 -Ref: Controlling Scanning-Footnote-1519820 -Node: Numeric Array Subscripts520136 -Node: Uninitialized Subscripts522320 -Node: Delete523939 -Ref: Delete-Footnote-1526691 -Node: Multidimensional526748 -Node: Multiscanning529843 -Node: Arrays of Arrays531434 -Node: Arrays Summary536202 -Node: Functions538295 -Node: Built-in539333 -Node: Calling Built-in540414 -Node: Numeric Functions542410 -Ref: Numeric Functions-Footnote-1546436 -Ref: Numeric Functions-Footnote-2547084 -Ref: Numeric Functions-Footnote-3547132 -Node: String Functions547404 -Ref: String Functions-Footnote-1571545 -Ref: String Functions-Footnote-2571673 -Ref: String Functions-Footnote-3571921 -Node: Gory Details572008 -Ref: table-sub-escapes573799 -Ref: table-sub-proposed575318 -Ref: table-posix-sub576681 -Ref: table-gensub-escapes578222 -Ref: Gory Details-Footnote-1579045 -Node: I/O Functions579199 -Ref: table-system-return-values585653 -Ref: I/O Functions-Footnote-1587733 -Ref: I/O Functions-Footnote-2587881 -Node: Time Functions588001 -Ref: Time Functions-Footnote-1598672 -Ref: Time Functions-Footnote-2598740 -Ref: Time Functions-Footnote-3598898 -Ref: Time Functions-Footnote-4599009 -Ref: Time Functions-Footnote-5599121 -Ref: Time Functions-Footnote-6599348 -Node: Bitwise Functions599614 -Ref: table-bitwise-ops600208 -Ref: Bitwise Functions-Footnote-1606271 -Ref: Bitwise Functions-Footnote-2606444 -Node: Type Functions606635 -Node: I18N Functions609498 -Node: User-defined611149 -Node: Definition Syntax611961 -Ref: Definition Syntax-Footnote-1617655 -Node: Function Example617726 -Ref: Function Example-Footnote-1620648 -Node: Function Calling620670 -Node: Calling A Function621258 -Node: Variable Scope622216 -Node: Pass By Value/Reference625210 -Node: Function Caveats627854 -Ref: Function Caveats-Footnote-1629901 -Node: Return Statement630021 -Node: Dynamic Typing633000 -Node: Indirect Calls633930 -Ref: Indirect Calls-Footnote-1644182 -Node: Functions Summary644310 -Node: Library Functions647015 -Ref: Library Functions-Footnote-1650622 -Ref: Library Functions-Footnote-2650765 -Node: Library Names650936 -Ref: Library Names-Footnote-1654603 -Ref: Library Names-Footnote-2654826 -Node: General Functions654912 -Node: Strtonum Function656015 -Node: Assert Function659037 -Node: Round Function662363 -Node: Cliff Random Function663903 -Node: Ordinal Functions664919 -Ref: Ordinal Functions-Footnote-1667982 -Ref: Ordinal Functions-Footnote-2668234 -Node: Join Function668444 -Ref: Join Function-Footnote-1670214 -Node: Getlocaltime Function670414 -Node: Readfile Function674156 -Node: Shell Quoting676133 -Node: Data File Management677534 -Node: Filetrans Function678166 -Node: Rewind Function682262 -Node: File Checking684171 -Ref: File Checking-Footnote-1685505 -Node: Empty Files685706 -Node: Ignoring Assigns687685 -Node: Getopt Function689235 -Ref: Getopt Function-Footnote-1704446 -Node: Passwd Functions704646 -Ref: Passwd Functions-Footnote-1713485 -Node: Group Functions713573 -Ref: Group Functions-Footnote-1721471 -Node: Walking Arrays721678 -Node: Library Functions Summary724686 -Node: Library Exercises726092 -Node: Sample Programs726557 -Node: Running Examples727327 -Node: Clones728055 -Node: Cut Program729279 -Node: Egrep Program739419 -Node: Id Program748430 -Node: Split Program758377 -Ref: Split Program-Footnote-1768267 -Node: Tee Program768440 -Node: Uniq Program771230 -Node: Wc Program778818 -Node: Bytes vs. Characters779215 -Node: Using extensions780763 -Node: wc program781517 -Node: Miscellaneous Programs786382 -Node: Dupword Program787595 -Node: Alarm Program789625 -Node: Translate Program794480 -Ref: Translate Program-Footnote-1799045 -Node: Labels Program799315 -Ref: Labels Program-Footnote-1802666 -Node: Word Sorting802750 -Node: History Sorting806822 -Node: Extract Program809047 -Node: Simple Sed817101 -Node: Igawk Program820175 -Ref: Igawk Program-Footnote-1834506 -Ref: Igawk Program-Footnote-2834708 -Ref: Igawk Program-Footnote-3834830 -Node: Anagram Program834945 -Node: Signature Program838007 -Node: Programs Summary839254 -Node: Programs Exercises840468 -Ref: Programs Exercises-Footnote-1844598 -Node: Advanced Features844684 -Node: Nondecimal Data846751 -Node: Array Sorting848342 -Node: Controlling Array Traversal849042 -Ref: Controlling Array Traversal-Footnote-1857410 -Node: Array Sorting Functions857528 -Ref: Array Sorting Functions-Footnote-1862619 -Node: Two-way I/O862815 -Ref: Two-way I/O-Footnote-1870536 -Ref: Two-way I/O-Footnote-2870723 -Node: TCP/IP Networking870805 -Node: Profiling873923 -Node: Extension Philosophy883232 -Node: Advanced Features Summary884683 -Node: Internationalization886682 -Node: I18N and L10N888162 -Node: Explaining gettext888849 -Ref: Explaining gettext-Footnote-1894741 -Ref: Explaining gettext-Footnote-2894926 -Node: Programmer i18n895091 -Ref: Programmer i18n-Footnote-1900040 -Node: Translator i18n900089 -Node: String Extraction900883 -Ref: String Extraction-Footnote-1902015 -Node: Printf Ordering902101 -Ref: Printf Ordering-Footnote-1904887 -Node: I18N Portability904951 -Ref: I18N Portability-Footnote-1907407 -Node: I18N Example907470 -Ref: I18N Example-Footnote-1910745 -Ref: I18N Example-Footnote-2910818 -Node: Gawk I18N910927 -Node: I18N Summary911576 -Node: Debugger912917 -Node: Debugging913917 -Node: Debugging Concepts914358 -Node: Debugging Terms916167 -Node: Awk Debugging918742 -Ref: Awk Debugging-Footnote-1919687 -Node: Sample Debugging Session919819 -Node: Debugger Invocation920353 -Node: Finding The Bug921739 -Node: List of Debugger Commands928213 -Node: Breakpoint Control929546 -Node: Debugger Execution Control933240 -Node: Viewing And Changing Data936602 -Node: Execution Stack940143 -Node: Debugger Info941780 -Node: Miscellaneous Debugger Commands945851 -Node: Readline Support950913 -Node: Limitations951809 -Node: Debugging Summary954363 -Node: Namespaces955642 -Node: Global Namespace956753 -Node: Qualified Names958151 -Node: Default Namespace959150 -Node: Changing The Namespace959891 -Node: Naming Rules961505 -Node: Internal Name Management963353 -Node: Namespace Example964395 -Node: Namespace And Features966957 -Node: Namespace Summary968392 -Node: Arbitrary Precision Arithmetic969869 -Node: Computer Arithmetic971356 -Ref: table-numeric-ranges975122 -Ref: table-floating-point-ranges975615 -Ref: Computer Arithmetic-Footnote-1976273 -Node: Math Definitions976330 -Ref: table-ieee-formats979306 -Node: MPFR features979873 -Node: FP Math Caution981591 -Ref: FP Math Caution-Footnote-1982663 -Node: Inexactness of computations983032 -Node: Inexact representation984063 -Node: Comparing FP Values985423 -Node: Errors accumulate986664 -Node: Strange values988120 -Ref: Strange values-Footnote-1990708 -Node: Getting Accuracy990813 -Node: Try To Round993523 -Node: Setting precision994422 -Ref: table-predefined-precision-strings995119 -Node: Setting the rounding mode996949 -Ref: table-gawk-rounding-modes997323 -Ref: Setting the rounding mode-Footnote-11001254 -Node: Arbitrary Precision Integers1001433 -Ref: Arbitrary Precision Integers-Footnote-11004608 -Node: Checking for MPFR1004757 -Node: POSIX Floating Point Problems1006231 -Ref: POSIX Floating Point Problems-Footnote-11010516 -Node: Floating point summary1010554 -Node: Dynamic Extensions1012744 -Node: Extension Intro1014297 -Node: Plugin License1015563 -Node: Extension Mechanism Outline1016360 -Ref: figure-load-extension1016799 -Ref: figure-register-new-function1018364 -Ref: figure-call-new-function1019456 -Node: Extension API Description1021518 -Node: Extension API Functions Introduction1023231 -Ref: table-api-std-headers1025067 -Node: General Data Types1029316 -Ref: General Data Types-Footnote-11037946 -Node: Memory Allocation Functions1038245 -Ref: Memory Allocation Functions-Footnote-11042746 -Node: Constructor Functions1042845 -Node: API Ownership of MPFR and GMP Values1046311 -Node: Registration Functions1047624 -Node: Extension Functions1048324 -Node: Exit Callback Functions1053646 -Node: Extension Version String1054896 -Node: Input Parsers1055559 -Node: Output Wrappers1068280 -Node: Two-way processors1072792 -Node: Printing Messages1075057 -Ref: Printing Messages-Footnote-11076228 -Node: Updating ERRNO1076381 -Node: Requesting Values1077120 -Ref: table-value-types-returned1077857 -Node: Accessing Parameters1078793 -Node: Symbol Table Access1080030 -Node: Symbol table by name1080542 -Ref: Symbol table by name-Footnote-11083566 -Node: Symbol table by cookie1083694 -Ref: Symbol table by cookie-Footnote-11087879 -Node: Cached values1087943 -Ref: Cached values-Footnote-11091479 -Node: Array Manipulation1091632 -Ref: Array Manipulation-Footnote-11092723 -Node: Array Data Types1092760 -Ref: Array Data Types-Footnote-11095418 -Node: Array Functions1095510 -Node: Flattening Arrays1100008 -Node: Creating Arrays1106984 -Node: Redirection API1111751 -Node: Extension API Variables1114584 -Node: Extension Versioning1115295 -Ref: gawk-api-version1115724 -Node: Extension GMP/MPFR Versioning1117455 -Node: Extension API Informational Variables1119083 -Node: Extension API Boilerplate1120156 -Node: Changes from API V11124130 -Node: Finding Extensions1125702 -Node: Extension Example1126261 -Node: Internal File Description1127059 -Node: Internal File Ops1131139 -Ref: Internal File Ops-Footnote-11142489 -Node: Using Internal File Ops1142629 -Ref: Using Internal File Ops-Footnote-11145012 -Node: Extension Samples1145286 -Node: Extension Sample File Functions1146815 -Node: Extension Sample Fnmatch1154464 -Node: Extension Sample Fork1155951 -Node: Extension Sample Inplace1157169 -Node: Extension Sample Ord1160795 -Node: Extension Sample Readdir1161631 -Ref: table-readdir-file-types1162520 -Node: Extension Sample Revout1163587 -Node: Extension Sample Rev2way1164176 -Node: Extension Sample Read write array1164916 -Node: Extension Sample Readfile1166858 -Node: Extension Sample Time1167953 -Node: Extension Sample API Tests1169705 -Node: gawkextlib1170197 -Node: Extension summary1173115 -Node: Extension Exercises1176817 -Node: Language History1178059 -Node: V7/SVR3.11179715 -Node: SVR41181867 -Node: POSIX1183301 -Node: BTL1184682 -Node: POSIX/GNU1185411 -Node: Feature History1191189 -Node: Common Extensions1207508 -Node: Ranges and Locales1208791 -Ref: Ranges and Locales-Footnote-11213407 -Ref: Ranges and Locales-Footnote-21213434 -Ref: Ranges and Locales-Footnote-31213669 -Node: Contributors1213892 -Node: History summary1219889 -Node: Installation1221269 -Node: Gawk Distribution1222213 -Node: Getting1222697 -Node: Extracting1223660 -Node: Distribution contents1225298 -Node: Unix Installation1231778 -Node: Quick Installation1232460 -Node: Shell Startup Files1234874 -Node: Additional Configuration Options1235963 -Node: Configuration Philosophy1238278 -Node: Non-Unix Installation1240647 -Node: PC Installation1241107 -Node: PC Binary Installation1241945 -Node: PC Compiling1242380 -Node: PC Using1243497 -Node: Cygwin1247050 -Node: MSYS1248274 -Node: VMS Installation1248876 -Node: VMS Compilation1249667 -Ref: VMS Compilation-Footnote-11250896 -Node: VMS Dynamic Extensions1250954 -Node: VMS Installation Details1252639 -Node: VMS Running1254892 -Node: VMS GNV1259171 -Node: VMS Old Gawk1259906 -Node: Bugs1260377 -Node: Bug address1261040 -Node: Usenet1264022 -Node: Maintainers1265026 -Node: Other Versions1266211 -Node: Installation summary1273299 -Node: Notes1274508 -Node: Compatibility Mode1275302 -Node: Additions1276084 -Node: Accessing The Source1277009 -Node: Adding Code1278446 -Node: New Ports1284665 -Node: Derived Files1289040 -Ref: Derived Files-Footnote-11294700 -Ref: Derived Files-Footnote-21294735 -Ref: Derived Files-Footnote-31295333 -Node: Future Extensions1295447 -Node: Implementation Limitations1296105 -Node: Extension Design1297315 -Node: Old Extension Problems1298459 -Ref: Old Extension Problems-Footnote-11299977 -Node: Extension New Mechanism Goals1300034 -Ref: Extension New Mechanism Goals-Footnote-11303398 -Node: Extension Other Design Decisions1303587 -Node: Extension Future Growth1305700 -Node: Notes summary1306306 -Node: Basic Concepts1307464 -Node: Basic High Level1308145 -Ref: figure-general-flow1308427 -Ref: figure-process-flow1309112 -Ref: Basic High Level-Footnote-11312413 -Node: Basic Data Typing1312598 -Node: Glossary1315926 -Node: Copying1347811 -Node: GNU Free Documentation License1385354 -Node: Index1410474 +Node: Testing field creation253305 +Node: Multiple Line254930 +Node: Getline261207 +Node: Plain Getline263676 +Node: Getline/Variable266249 +Node: Getline/File267400 +Node: Getline/Variable/File268788 +Ref: Getline/Variable/File-Footnote-1270393 +Node: Getline/Pipe270481 +Node: Getline/Variable/Pipe273185 +Node: Getline/Coprocess274320 +Node: Getline/Variable/Coprocess275587 +Node: Getline Notes276329 +Node: Getline Summary279126 +Ref: table-getline-variants279550 +Node: Read Timeout280298 +Ref: Read Timeout-Footnote-1284204 +Node: Retrying Input284262 +Node: Command-line directories285461 +Node: Input Summary286367 +Node: Input Exercises289539 +Node: Printing289973 +Node: Print291807 +Node: Print Examples293264 +Node: Output Separators296044 +Node: OFMT298061 +Node: Printf299417 +Node: Basic Printf300202 +Node: Control Letters301776 +Node: Format Modifiers306938 +Node: Printf Examples312953 +Node: Redirection315439 +Node: Special FD322280 +Ref: Special FD-Footnote-1325448 +Node: Special Files325522 +Node: Other Inherited Files326139 +Node: Special Network327140 +Node: Special Caveats328000 +Node: Close Files And Pipes328949 +Ref: table-close-pipe-return-values335856 +Ref: Close Files And Pipes-Footnote-1336669 +Ref: Close Files And Pipes-Footnote-2336817 +Node: Nonfatal336969 +Node: Output Summary339307 +Node: Output Exercises340529 +Node: Expressions341208 +Node: Values342396 +Node: Constants343074 +Node: Scalar Constants343765 +Ref: Scalar Constants-Footnote-1346275 +Node: Nondecimal-numbers346525 +Node: Regexp Constants349526 +Node: Using Constant Regexps350052 +Node: Standard Regexp Constants350674 +Node: Strong Regexp Constants353862 +Node: Variables356874 +Node: Using Variables357531 +Node: Assignment Options359441 +Node: Conversion361912 +Node: Strings And Numbers362436 +Ref: Strings And Numbers-Footnote-1365499 +Node: Locale influences conversions365608 +Ref: table-locale-affects368366 +Node: All Operators368984 +Node: Arithmetic Ops369613 +Node: Concatenation372329 +Ref: Concatenation-Footnote-1375176 +Node: Assignment Ops375283 +Ref: table-assign-ops380274 +Node: Increment Ops381587 +Node: Truth Values and Conditions385047 +Node: Truth Values386121 +Node: Typing and Comparison387169 +Node: Variable Typing387989 +Ref: Variable Typing-Footnote-1394452 +Ref: Variable Typing-Footnote-2394524 +Node: Comparison Operators394601 +Ref: table-relational-ops395020 +Node: POSIX String Comparison398515 +Ref: POSIX String Comparison-Footnote-1400210 +Ref: POSIX String Comparison-Footnote-2400349 +Node: Boolean Ops400433 +Ref: Boolean Ops-Footnote-1404915 +Node: Conditional Exp405007 +Node: Function Calls406743 +Node: Precedence410620 +Node: Locales414279 +Node: Expressions Summary415911 +Node: Patterns and Actions418484 +Node: Pattern Overview419604 +Node: Regexp Patterns421281 +Node: Expression Patterns421823 +Node: Ranges425604 +Node: BEGIN/END428712 +Node: Using BEGIN/END429473 +Ref: Using BEGIN/END-Footnote-1432227 +Node: I/O And BEGIN/END432333 +Node: BEGINFILE/ENDFILE434646 +Node: Empty437877 +Node: Using Shell Variables438194 +Node: Action Overview440468 +Node: Statements442793 +Node: If Statement444641 +Node: While Statement446136 +Node: Do Statement448164 +Node: For Statement449312 +Node: Switch Statement452483 +Node: Break Statement454924 +Node: Continue Statement457016 +Node: Next Statement458843 +Node: Nextfile Statement461226 +Node: Exit Statement463915 +Node: Built-in Variables466318 +Node: User-modified467451 +Node: Auto-set475218 +Ref: Auto-set-Footnote-1492025 +Ref: Auto-set-Footnote-2492231 +Node: ARGC and ARGV492287 +Node: Pattern Action Summary496500 +Node: Arrays498930 +Node: Array Basics500259 +Node: Array Intro501103 +Ref: figure-array-elements503078 +Ref: Array Intro-Footnote-1505782 +Node: Reference to Elements505910 +Node: Assigning Elements508374 +Node: Array Example508865 +Node: Scanning an Array510624 +Node: Controlling Scanning513646 +Ref: Controlling Scanning-Footnote-1520102 +Node: Numeric Array Subscripts520418 +Node: Uninitialized Subscripts522602 +Node: Delete524221 +Ref: Delete-Footnote-1526973 +Node: Multidimensional527030 +Node: Multiscanning530125 +Node: Arrays of Arrays531716 +Node: Arrays Summary536484 +Node: Functions538577 +Node: Built-in539615 +Node: Calling Built-in540696 +Node: Numeric Functions542692 +Ref: Numeric Functions-Footnote-1546718 +Ref: Numeric Functions-Footnote-2547366 +Ref: Numeric Functions-Footnote-3547414 +Node: String Functions547686 +Ref: String Functions-Footnote-1571827 +Ref: String Functions-Footnote-2571955 +Ref: String Functions-Footnote-3572203 +Node: Gory Details572290 +Ref: table-sub-escapes574081 +Ref: table-sub-proposed575600 +Ref: table-posix-sub576963 +Ref: table-gensub-escapes578504 +Ref: Gory Details-Footnote-1579327 +Node: I/O Functions579481 +Ref: table-system-return-values585935 +Ref: I/O Functions-Footnote-1588015 +Ref: I/O Functions-Footnote-2588163 +Node: Time Functions588283 +Ref: Time Functions-Footnote-1598954 +Ref: Time Functions-Footnote-2599022 +Ref: Time Functions-Footnote-3599180 +Ref: Time Functions-Footnote-4599291 +Ref: Time Functions-Footnote-5599403 +Ref: Time Functions-Footnote-6599630 +Node: Bitwise Functions599896 +Ref: table-bitwise-ops600490 +Ref: Bitwise Functions-Footnote-1606553 +Ref: Bitwise Functions-Footnote-2606726 +Node: Type Functions606917 +Node: I18N Functions609780 +Node: User-defined611431 +Node: Definition Syntax612243 +Ref: Definition Syntax-Footnote-1617937 +Node: Function Example618008 +Ref: Function Example-Footnote-1620930 +Node: Function Calling620952 +Node: Calling A Function621540 +Node: Variable Scope622498 +Node: Pass By Value/Reference625492 +Node: Function Caveats628136 +Ref: Function Caveats-Footnote-1630183 +Node: Return Statement630303 +Node: Dynamic Typing633282 +Node: Indirect Calls634212 +Ref: Indirect Calls-Footnote-1644464 +Node: Functions Summary644592 +Node: Library Functions647297 +Ref: Library Functions-Footnote-1650904 +Ref: Library Functions-Footnote-2651047 +Node: Library Names651218 +Ref: Library Names-Footnote-1654885 +Ref: Library Names-Footnote-2655108 +Node: General Functions655194 +Node: Strtonum Function656297 +Node: Assert Function659319 +Node: Round Function662645 +Node: Cliff Random Function664185 +Node: Ordinal Functions665201 +Ref: Ordinal Functions-Footnote-1668264 +Ref: Ordinal Functions-Footnote-2668516 +Node: Join Function668726 +Ref: Join Function-Footnote-1670496 +Node: Getlocaltime Function670696 +Node: Readfile Function674438 +Node: Shell Quoting676415 +Node: Data File Management677816 +Node: Filetrans Function678448 +Node: Rewind Function682544 +Node: File Checking684453 +Ref: File Checking-Footnote-1685787 +Node: Empty Files685988 +Node: Ignoring Assigns687967 +Node: Getopt Function689517 +Ref: Getopt Function-Footnote-1704728 +Node: Passwd Functions704928 +Ref: Passwd Functions-Footnote-1713767 +Node: Group Functions713855 +Ref: Group Functions-Footnote-1721753 +Node: Walking Arrays721960 +Node: Library Functions Summary724968 +Node: Library Exercises726374 +Node: Sample Programs726839 +Node: Running Examples727609 +Node: Clones728337 +Node: Cut Program729561 +Node: Egrep Program739701 +Node: Id Program748712 +Node: Split Program758659 +Ref: Split Program-Footnote-1768549 +Node: Tee Program768722 +Node: Uniq Program771512 +Node: Wc Program779100 +Node: Bytes vs. Characters779497 +Node: Using extensions781045 +Node: wc program781799 +Node: Miscellaneous Programs786664 +Node: Dupword Program787877 +Node: Alarm Program789907 +Node: Translate Program794762 +Ref: Translate Program-Footnote-1799327 +Node: Labels Program799597 +Ref: Labels Program-Footnote-1802948 +Node: Word Sorting803032 +Node: History Sorting807104 +Node: Extract Program809329 +Node: Simple Sed817383 +Node: Igawk Program820457 +Ref: Igawk Program-Footnote-1834788 +Ref: Igawk Program-Footnote-2834990 +Ref: Igawk Program-Footnote-3835112 +Node: Anagram Program835227 +Node: Signature Program838289 +Node: Programs Summary839536 +Node: Programs Exercises840750 +Ref: Programs Exercises-Footnote-1844880 +Node: Advanced Features844966 +Node: Nondecimal Data847033 +Node: Array Sorting848624 +Node: Controlling Array Traversal849324 +Ref: Controlling Array Traversal-Footnote-1857692 +Node: Array Sorting Functions857810 +Ref: Array Sorting Functions-Footnote-1862901 +Node: Two-way I/O863097 +Ref: Two-way I/O-Footnote-1870818 +Ref: Two-way I/O-Footnote-2871005 +Node: TCP/IP Networking871087 +Node: Profiling874205 +Node: Extension Philosophy883514 +Node: Advanced Features Summary884965 +Node: Internationalization886964 +Node: I18N and L10N888444 +Node: Explaining gettext889131 +Ref: Explaining gettext-Footnote-1895023 +Ref: Explaining gettext-Footnote-2895208 +Node: Programmer i18n895373 +Ref: Programmer i18n-Footnote-1900322 +Node: Translator i18n900371 +Node: String Extraction901165 +Ref: String Extraction-Footnote-1902297 +Node: Printf Ordering902383 +Ref: Printf Ordering-Footnote-1905169 +Node: I18N Portability905233 +Ref: I18N Portability-Footnote-1907689 +Node: I18N Example907752 +Ref: I18N Example-Footnote-1911027 +Ref: I18N Example-Footnote-2911100 +Node: Gawk I18N911209 +Node: I18N Summary911858 +Node: Debugger913199 +Node: Debugging914199 +Node: Debugging Concepts914640 +Node: Debugging Terms916449 +Node: Awk Debugging919024 +Ref: Awk Debugging-Footnote-1919969 +Node: Sample Debugging Session920101 +Node: Debugger Invocation920635 +Node: Finding The Bug922021 +Node: List of Debugger Commands928495 +Node: Breakpoint Control929828 +Node: Debugger Execution Control933522 +Node: Viewing And Changing Data936884 +Node: Execution Stack940425 +Node: Debugger Info942062 +Node: Miscellaneous Debugger Commands946133 +Node: Readline Support951195 +Node: Limitations952091 +Node: Debugging Summary954645 +Node: Namespaces955924 +Node: Global Namespace957035 +Node: Qualified Names958433 +Node: Default Namespace959432 +Node: Changing The Namespace960173 +Node: Naming Rules961787 +Node: Internal Name Management963635 +Node: Namespace Example964677 +Node: Namespace And Features967239 +Node: Namespace Summary968674 +Node: Arbitrary Precision Arithmetic970151 +Node: Computer Arithmetic971638 +Ref: table-numeric-ranges975404 +Ref: table-floating-point-ranges975897 +Ref: Computer Arithmetic-Footnote-1976555 +Node: Math Definitions976612 +Ref: table-ieee-formats979588 +Node: MPFR features980155 +Node: FP Math Caution981873 +Ref: FP Math Caution-Footnote-1982945 +Node: Inexactness of computations983314 +Node: Inexact representation984345 +Node: Comparing FP Values985705 +Node: Errors accumulate986946 +Node: Strange values988402 +Ref: Strange values-Footnote-1990990 +Node: Getting Accuracy991095 +Node: Try To Round993805 +Node: Setting precision994704 +Ref: table-predefined-precision-strings995401 +Node: Setting the rounding mode997231 +Ref: table-gawk-rounding-modes997605 +Ref: Setting the rounding mode-Footnote-11001536 +Node: Arbitrary Precision Integers1001715 +Ref: Arbitrary Precision Integers-Footnote-11004890 +Node: Checking for MPFR1005039 +Node: POSIX Floating Point Problems1006513 +Ref: POSIX Floating Point Problems-Footnote-11010798 +Node: Floating point summary1010836 +Node: Dynamic Extensions1013026 +Node: Extension Intro1014579 +Node: Plugin License1015845 +Node: Extension Mechanism Outline1016642 +Ref: figure-load-extension1017081 +Ref: figure-register-new-function1018646 +Ref: figure-call-new-function1019738 +Node: Extension API Description1021800 +Node: Extension API Functions Introduction1023513 +Ref: table-api-std-headers1025349 +Node: General Data Types1029598 +Ref: General Data Types-Footnote-11038228 +Node: Memory Allocation Functions1038527 +Ref: Memory Allocation Functions-Footnote-11043028 +Node: Constructor Functions1043127 +Node: API Ownership of MPFR and GMP Values1046593 +Node: Registration Functions1047906 +Node: Extension Functions1048606 +Node: Exit Callback Functions1053928 +Node: Extension Version String1055178 +Node: Input Parsers1055841 +Node: Output Wrappers1068562 +Node: Two-way processors1073074 +Node: Printing Messages1075339 +Ref: Printing Messages-Footnote-11076510 +Node: Updating ERRNO1076663 +Node: Requesting Values1077402 +Ref: table-value-types-returned1078139 +Node: Accessing Parameters1079075 +Node: Symbol Table Access1080312 +Node: Symbol table by name1080824 +Ref: Symbol table by name-Footnote-11083848 +Node: Symbol table by cookie1083976 +Ref: Symbol table by cookie-Footnote-11088161 +Node: Cached values1088225 +Ref: Cached values-Footnote-11091761 +Node: Array Manipulation1091914 +Ref: Array Manipulation-Footnote-11093005 +Node: Array Data Types1093042 +Ref: Array Data Types-Footnote-11095700 +Node: Array Functions1095792 +Node: Flattening Arrays1100290 +Node: Creating Arrays1107266 +Node: Redirection API1112033 +Node: Extension API Variables1114866 +Node: Extension Versioning1115577 +Ref: gawk-api-version1116006 +Node: Extension GMP/MPFR Versioning1117737 +Node: Extension API Informational Variables1119365 +Node: Extension API Boilerplate1120438 +Node: Changes from API V11124412 +Node: Finding Extensions1125984 +Node: Extension Example1126543 +Node: Internal File Description1127341 +Node: Internal File Ops1131421 +Ref: Internal File Ops-Footnote-11142771 +Node: Using Internal File Ops1142911 +Ref: Using Internal File Ops-Footnote-11145294 +Node: Extension Samples1145568 +Node: Extension Sample File Functions1147097 +Node: Extension Sample Fnmatch1154746 +Node: Extension Sample Fork1156233 +Node: Extension Sample Inplace1157451 +Node: Extension Sample Ord1161077 +Node: Extension Sample Readdir1161913 +Ref: table-readdir-file-types1162802 +Node: Extension Sample Revout1163869 +Node: Extension Sample Rev2way1164458 +Node: Extension Sample Read write array1165198 +Node: Extension Sample Readfile1167140 +Node: Extension Sample Time1168235 +Node: Extension Sample API Tests1169987 +Node: gawkextlib1170479 +Node: Extension summary1173397 +Node: Extension Exercises1177099 +Node: Language History1178341 +Node: V7/SVR3.11179997 +Node: SVR41182149 +Node: POSIX1183583 +Node: BTL1184964 +Node: POSIX/GNU1185693 +Node: Feature History1191471 +Node: Common Extensions1207790 +Node: Ranges and Locales1209073 +Ref: Ranges and Locales-Footnote-11213689 +Ref: Ranges and Locales-Footnote-21213716 +Ref: Ranges and Locales-Footnote-31213951 +Node: Contributors1214174 +Node: History summary1220171 +Node: Installation1221551 +Node: Gawk Distribution1222495 +Node: Getting1222979 +Node: Extracting1223942 +Node: Distribution contents1225580 +Node: Unix Installation1232060 +Node: Quick Installation1232742 +Node: Shell Startup Files1235156 +Node: Additional Configuration Options1236245 +Node: Configuration Philosophy1238560 +Node: Non-Unix Installation1240929 +Node: PC Installation1241389 +Node: PC Binary Installation1242227 +Node: PC Compiling1242662 +Node: PC Using1243779 +Node: Cygwin1247332 +Node: MSYS1248556 +Node: VMS Installation1249158 +Node: VMS Compilation1249949 +Ref: VMS Compilation-Footnote-11251178 +Node: VMS Dynamic Extensions1251236 +Node: VMS Installation Details1252921 +Node: VMS Running1255174 +Node: VMS GNV1259453 +Node: VMS Old Gawk1260188 +Node: Bugs1260659 +Node: Bug address1261322 +Node: Usenet1264304 +Node: Maintainers1265308 +Node: Other Versions1266493 +Node: Installation summary1273581 +Node: Notes1274790 +Node: Compatibility Mode1275584 +Node: Additions1276366 +Node: Accessing The Source1277291 +Node: Adding Code1278728 +Node: New Ports1284947 +Node: Derived Files1289322 +Ref: Derived Files-Footnote-11294982 +Ref: Derived Files-Footnote-21295017 +Ref: Derived Files-Footnote-31295615 +Node: Future Extensions1295729 +Node: Implementation Limitations1296387 +Node: Extension Design1297597 +Node: Old Extension Problems1298741 +Ref: Old Extension Problems-Footnote-11300259 +Node: Extension New Mechanism Goals1300316 +Ref: Extension New Mechanism Goals-Footnote-11303680 +Node: Extension Other Design Decisions1303869 +Node: Extension Future Growth1305982 +Node: Notes summary1306588 +Node: Basic Concepts1307746 +Node: Basic High Level1308427 +Ref: figure-general-flow1308709 +Ref: figure-process-flow1309394 +Ref: Basic High Level-Footnote-11312695 +Node: Basic Data Typing1312880 +Node: Glossary1316208 +Node: Copying1348093 +Node: GNU Free Documentation License1385636 +Node: Index1410756 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index b8fcff00..664f9e70 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -8293,6 +8293,8 @@ words, @code{FS} defines what a field @emph{is not}, instead of what a field However, there are times when you really want to define the fields by what they are, and not by what they are not. +@cindex CSV (comma separated values) data @subentry parsing with @code{FPAT} +@cindex Comma separated values (CSV) data @subentry parsing with @code{FPAT} The most notorious such case is so-called @dfn{comma-separated values} (CSV) data. Many spreadsheet programs, for example, can export their data into text files, where each record is @@ -8476,6 +8478,15 @@ $ @kbd{gawk -v fpat=2 -f test-csv.awk sample.csv} @print{} NF = 3 <p><><s> @end example +@cindex Collado, Manuel +@cindex @code{CSVMODE} library for @command{gawk} +@cindex CSV (comma separated values) data @subentry parsing with @code{CSVMODE} library +@cindex Comma separated values (CSV) data @subentry parsing with @code{FPAT} library +In general, using @code{FPAT} to do your own CSV parsing is like having +a bed with a blanket that's not quite big enough. There's always a corner +that isn't covered. We recommend, instead, that you use Manuel Collado's +@uref{http://mcollado.z15.es/xgawk/, @code{CSVMODE} library for @command{gawk}}. + @node Testing field creation @section Checking How @command{gawk} Is Splitting Records diff --git a/doc/gawktexi.in b/doc/gawktexi.in index eb9e794e..92098829 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -7846,6 +7846,8 @@ words, @code{FS} defines what a field @emph{is not}, instead of what a field However, there are times when you really want to define the fields by what they are, and not by what they are not. +@cindex CSV (comma separated values) data @subentry parsing with @code{FPAT} +@cindex Comma separated values (CSV) data @subentry parsing with @code{FPAT} The most notorious such case is so-called @dfn{comma-separated values} (CSV) data. Many spreadsheet programs, for example, can export their data into text files, where each record is @@ -8029,6 +8031,15 @@ $ @kbd{gawk -v fpat=2 -f test-csv.awk sample.csv} @print{} NF = 3 <p><><s> @end example +@cindex Collado, Manuel +@cindex @code{CSVMODE} library for @command{gawk} +@cindex CSV (comma separated values) data @subentry parsing with @code{CSVMODE} library +@cindex Comma separated values (CSV) data @subentry parsing with @code{FPAT} library +In general, using @code{FPAT} to do your own CSV parsing is like having +a bed with a blanket that's not quite big enough. There's always a corner +that isn't covered. We recommend, instead, that you use Manuel Collado's +@uref{http://mcollado.z15.es/xgawk/, @code{CSVMODE} library for @command{gawk}}. + @node Testing field creation @section Checking How @command{gawk} Is Splitting Records diff --git a/pc/ChangeLog b/pc/ChangeLog index 2c0b8b34..c954002e 100644 --- a/pc/ChangeLog +++ b/pc/ChangeLog @@ -1,3 +1,7 @@ +2020-12-26 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.tst: Rebuilt. + 2020-12-20 Arnold D. Robbins <arnold@skeeve.com> * Makefile.tst: Rebuilt. diff --git a/pc/Makefile.tst b/pc/Makefile.tst index 0d5cef13..890c2ff0 100644 --- a/pc/Makefile.tst +++ b/pc/Makefile.tst @@ -197,7 +197,7 @@ GAWK_EXT_TESTS = \ dbugeval dbugeval2 dbugeval3 dbugtypedre1 dbugtypedre2 delsub \ devfd devfd1 devfd2 dfacheck1 dumpvars \ errno exit fieldwdth forcenum \ - fpat1 fpat2 fpat3 fpat4 fpat5 fpat6 fpat7 fpat8 fpatnull \ + fpat1 fpat2 fpat3 fpat4 fpat5 fpat6 fpat7 fpat8 fpat9 fpatnull \ fsfwfs funlen functab1 functab2 functab3 \ fwtest fwtest2 fwtest3 fwtest4 fwtest5 fwtest6 fwtest7 fwtest8 \ genpot gensub gensub2 gensub3 getlndir gnuops2 gnuops3 gnureops gsubind \ @@ -2707,6 +2707,11 @@ fpat8: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +fpat9: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + fpatnull: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/ChangeLog b/test/ChangeLog index f1c0a6a0..7d373146 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2020-12-26 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (EXTRA_DIST): fpat9, new test. + * fpat9.awk, fpat9.in, fpat9.ok: New files. + 2020-12-20 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (EXTRA_DIST): Remove forcenum-mpfr.ok. diff --git a/test/Makefile.am b/test/Makefile.am index 097dc261..2b1f1416 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -376,6 +376,9 @@ EXTRA_DIST = \ fpat8.awk \ fpat8.in \ fpat8.ok \ + fpat9.awk \ + fpat9.in \ + fpat9.ok \ fpatnull.awk \ fpatnull.in \ fpatnull.ok \ @@ -1424,7 +1427,7 @@ GAWK_EXT_TESTS = \ dbugeval dbugeval2 dbugeval3 dbugtypedre1 dbugtypedre2 delsub \ devfd devfd1 devfd2 dfacheck1 dumpvars \ errno exit fieldwdth forcenum \ - fpat1 fpat2 fpat3 fpat4 fpat5 fpat6 fpat7 fpat8 fpatnull \ + fpat1 fpat2 fpat3 fpat4 fpat5 fpat6 fpat7 fpat8 fpat9 fpatnull \ fsfwfs funlen functab1 functab2 functab3 \ fwtest fwtest2 fwtest3 fwtest4 fwtest5 fwtest6 fwtest7 fwtest8 \ genpot gensub gensub2 gensub3 getlndir gnuops2 gnuops3 gnureops gsubind \ diff --git a/test/Makefile.in b/test/Makefile.in index 871e5a43..b96b7d0d 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -639,6 +639,9 @@ EXTRA_DIST = \ fpat8.awk \ fpat8.in \ fpat8.ok \ + fpat9.awk \ + fpat9.in \ + fpat9.ok \ fpatnull.awk \ fpatnull.in \ fpatnull.ok \ @@ -1687,7 +1690,7 @@ GAWK_EXT_TESTS = \ dbugeval dbugeval2 dbugeval3 dbugtypedre1 dbugtypedre2 delsub \ devfd devfd1 devfd2 dfacheck1 dumpvars \ errno exit fieldwdth forcenum \ - fpat1 fpat2 fpat3 fpat4 fpat5 fpat6 fpat7 fpat8 fpatnull \ + fpat1 fpat2 fpat3 fpat4 fpat5 fpat6 fpat7 fpat8 fpat9 fpatnull \ fsfwfs funlen functab1 functab2 functab3 \ fwtest fwtest2 fwtest3 fwtest4 fwtest5 fwtest6 fwtest7 fwtest8 \ genpot gensub gensub2 gensub3 getlndir gnuops2 gnuops3 gnureops gsubind \ @@ -4366,6 +4369,11 @@ fpat8: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +fpat9: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + fpatnull: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index 90599c49..363a2755 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1451,6 +1451,11 @@ fpat8: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +fpat9: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + fpatnull: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/fpat9.awk b/test/fpat9.awk new file mode 100644 index 00000000..06142b85 --- /dev/null +++ b/test/fpat9.awk @@ -0,0 +1,22 @@ +#! /bin/gawk -f + +# Modified version of program from Arthur Schwarz <home@slipbits.com>. + +BEGIN { # program constants + FPAT = "([^,]*)|(\"([^\"]|\"\")+\")" # CSV field separator + print "FPAT = ", FPAT; +} +{ + print "------------------------------------------------\n" + print $0; + printf("%3d: \n", NF); + for (i = 1; i <= NF; i++) { + if (substr($i, 1, 1) == "\"") { + len = length($i) # BUG FIX, was length($1) + $i = substr($i, 2, len - 2); + gsub(/""/, "\"", $i) # embedded "" --> " + } + printf(" <%d: %s>\n", i, $i); + } + print " "; +} diff --git a/test/fpat9.in b/test/fpat9.in new file mode 100644 index 00000000..70440d81 --- /dev/null +++ b/test/fpat9.in @@ -0,0 +1,7 @@ +"PDQ",,, +"line 1",,,"http://file.a/A%20Guide%20" +"line 2",,,"https://www.whitgt.pdf" +"line 3, and xyz",,,"http://www.c/main.pdf" +"line 4 "" and abc",,,http://file.a/A%20Guide%20 +line 5,,,https://www.whitgt.pdf +line 6,,,http://file.a/A%20Guide%20 diff --git a/test/fpat9.ok b/test/fpat9.ok new file mode 100644 index 00000000..e1f705e6 --- /dev/null +++ b/test/fpat9.ok @@ -0,0 +1,64 @@ +FPAT = ([^,]*)|("([^"]|"")+") +------------------------------------------------ + +"PDQ",,, + 4: + <1: PDQ> + <2: > + <3: > + <4: > + +------------------------------------------------ + +"line 1",,,"http://file.a/A%20Guide%20" + 4: + <1: line 1> + <2: > + <3: > + <4: http://file.a/A%20Guide%20> + +------------------------------------------------ + +"line 2",,,"https://www.whitgt.pdf" + 4: + <1: line 2> + <2: > + <3: > + <4: https://www.whitgt.pdf> + +------------------------------------------------ + +"line 3, and xyz",,,"http://www.c/main.pdf" + 4: + <1: line 3, and xyz> + <2: > + <3: > + <4: http://www.c/main.pdf> + +------------------------------------------------ + +"line 4 "" and abc",,,http://file.a/A%20Guide%20 + 4: + <1: line 4 " and abc> + <2: > + <3: > + <4: http://file.a/A%20Guide%20> + +------------------------------------------------ + +line 5,,,https://www.whitgt.pdf + 4: + <1: line 5> + <2: > + <3: > + <4: https://www.whitgt.pdf> + +------------------------------------------------ + +line 6,,,http://file.a/A%20Guide%20 + 4: + <1: line 6> + <2: > + <3: > + <4: http://file.a/A%20Guide%20> + |