diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2018-11-29 21:43:17 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2018-11-29 21:43:17 +0200 |
commit | ee2f450c7cf2550ca68fb205c5df22eca13e5b74 (patch) | |
tree | fbf8e24689c98fee012725f40a1f9565e4a6317e | |
parent | 1e12bcb4ceac5850999f4d714a305a00ce7a9ddc (diff) | |
parent | 68ba43d9c7604d8544834dadc6f549af45d8992c (diff) | |
download | egawk-ee2f450c7cf2550ca68fb205c5df22eca13e5b74.tar.gz egawk-ee2f450c7cf2550ca68fb205c5df22eca13e5b74.tar.bz2 egawk-ee2f450c7cf2550ca68fb205c5df22eca13e5b74.zip |
Merge branch 'master' into feature/fix-comments
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | doc/ChangeLog | 6 | ||||
-rw-r--r-- | doc/gawk.1 | 5 | ||||
-rw-r--r-- | doc/gawk.info | 745 | ||||
-rw-r--r-- | doc/gawk.texi | 8 | ||||
-rw-r--r-- | doc/gawktexi.in | 8 | ||||
-rw-r--r-- | interpret.h | 32 | ||||
-rw-r--r-- | test/Makefile.am | 3 | ||||
-rw-r--r-- | test/Makefile.in | 3 | ||||
-rw-r--r-- | test/symtab6.ok | 30 | ||||
-rw-r--r-- | test/symtab7.ok | 4 |
11 files changed, 418 insertions, 431 deletions
@@ -18,7 +18,10 @@ Changes from 4.2.x to 5.0.0 4. PROCINFO["platform"] yields a string indicating the platform for which gawk was compiled. -5. Comment handling in the pretty-printer has been reworked almost completely +5. Writing to elements of SYMTAB that are not variable names now + causes a fatal error. + +6. Comment handling in the pretty-printer has been reworked almost completely from scratch. As a result, comments in many corner cases that were previously lost are now included in the formatted output. diff --git a/doc/ChangeLog b/doc/ChangeLog index e0f06af1..f4fb7b69 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2018-11-29 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in (Auto-set): Document that you can no longer use + arbitrary indices in SYMTAB. + * gawk.1: Ditto. + 2018-11-27 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in (Other Versions): Document GoAWK, an awk interpreter @@ -13,7 +13,7 @@ . if \w'\(rq' .ds rq "\(rq . \} .\} -.TH GAWK 1 "Nov 26 2018" "Free Software Foundation" "Utility Commands" +.TH GAWK 1 "Nov 29 2018" "Free Software Foundation" "Utility Commands" .SH NAME gawk \- pattern scanning and processing language .SH SYNOPSIS @@ -1425,7 +1425,8 @@ You may not use the .B delete statement with the .B SYMTAB -array. +array, nor assign to elements with an index that is +not a variable name. .TP .B TEXTDOMAIN The text domain of the \*(AK program; used to find the localized diff --git a/doc/gawk.info b/doc/gawk.info index be729ca2..e0738357 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -11190,15 +11190,14 @@ they are not special: test if an element in 'SYMTAB' is an array. Also, you may not use the 'delete' statement with the 'SYMTAB' array. - You may use an index for 'SYMTAB' that is not a predefined - identifier: + Prior to version 5.0 of 'gawk', you could use an index for 'SYMTAB' + that was not a predefined identifier: SYMTAB["xxx"] = 5 print SYMTAB["xxx"] - This works as expected: in this case 'SYMTAB' acts just like a - regular array. The only difference is that you can't then delete - 'SYMTAB["xxx"]'. + This no longer works, instead producing a fatal error, as it led to + rampant confusion. The 'SYMTAB' array is more interesting than it looks. Andrew Schorr points out that it effectively gives 'awk' data pointers. @@ -33913,7 +33912,7 @@ Index * dark corner, field separators: Full Line Fields. (line 22) * dark corner, FILENAME variable: Getline Notes. (line 19) * dark corner, FILENAME variable <1>: Auto-set. (line 108) -* dark corner, FNR/NR variables: Auto-set. (line 410) +* dark corner, FNR/NR variables: Auto-set. (line 409) * dark corner, format-control characters: Control Letters. (line 33) * dark corner, format-control characters <1>: Control Letters. (line 108) @@ -34481,7 +34480,7 @@ Index (line 12) * FNR variable: Records. (line 6) * FNR variable <1>: Auto-set. (line 118) -* FNR variable, changing: Auto-set. (line 410) +* FNR variable, changing: Auto-set. (line 409) * for statement: For Statement. (line 6) * for statement, looping over arrays: Scanning an Array. (line 20) * fork() extension function: Extension Sample Fork. @@ -35139,7 +35138,7 @@ Index * not Boolean-logic operator: Boolean Ops. (line 6) * NR variable: Records. (line 6) * NR variable <1>: Auto-set. (line 143) -* NR variable, changing: Auto-set. (line 410) +* NR variable, changing: Auto-set. (line 409) * null strings: awk split records. (line 121) * null strings <1>: Regexp Field Splitting. (line 43) @@ -35657,7 +35656,7 @@ Index * scanning arrays: Scanning an Array. (line 6) * scanning multidimensional arrays: Multiscanning. (line 11) * Schorr, Andrew: Acknowledgments. (line 60) -* Schorr, Andrew <1>: Auto-set. (line 380) +* Schorr, Andrew <1>: Auto-set. (line 379) * Schorr, Andrew <2>: Contributors. (line 136) * Schreiber, Bert: Acknowledgments. (line 38) * Schreiber, Rita: Acknowledgments. (line 38) @@ -35743,7 +35742,7 @@ Index * sidebar, Beware The Smoke and Mirrors!: Bitwise Functions. (line 127) * sidebar, Changing FS Does Not Affect the Fields: Full Line Fields. (line 14) -* sidebar, Changing NR and FNR: Auto-set. (line 408) +* sidebar, Changing NR and FNR: Auto-set. (line 407) * sidebar, Controlling Output Buffering with system(): I/O Functions. (line 166) * sidebar, Escape Sequences for Metacharacters: Escape Sequences. @@ -36377,368 +36376,368 @@ Node: Exit Statement454653 Node: Built-in Variables457056 Node: User-modified458189 Node: Auto-set465956 -Ref: Auto-set-Footnote-1482792 -Ref: Auto-set-Footnote-2482998 -Node: ARGC and ARGV483054 -Node: Pattern Action Summary487267 -Node: Arrays489697 -Node: Array Basics491026 -Node: Array Intro491870 -Ref: figure-array-elements493845 -Ref: Array Intro-Footnote-1496549 -Node: Reference to Elements496677 -Node: Assigning Elements499141 -Node: Array Example499632 -Node: Scanning an Array501391 -Node: Controlling Scanning504413 -Ref: Controlling Scanning-Footnote-1509812 -Node: Numeric Array Subscripts510128 -Node: Uninitialized Subscripts512312 -Node: Delete513931 -Ref: Delete-Footnote-1516683 -Node: Multidimensional516740 -Node: Multiscanning519835 -Node: Arrays of Arrays521426 -Node: Arrays Summary526194 -Node: Functions528287 -Node: Built-in529325 -Node: Calling Built-in530406 -Node: Numeric Functions532402 -Ref: Numeric Functions-Footnote-1536430 -Ref: Numeric Functions-Footnote-2536787 -Ref: Numeric Functions-Footnote-3536835 -Node: String Functions537107 -Ref: String Functions-Footnote-1560965 -Ref: String Functions-Footnote-2561093 -Ref: String Functions-Footnote-3561341 -Node: Gory Details561428 -Ref: table-sub-escapes563219 -Ref: table-sub-proposed564738 -Ref: table-posix-sub566101 -Ref: table-gensub-escapes567642 -Ref: Gory Details-Footnote-1568465 -Node: I/O Functions568619 -Ref: table-system-return-values575087 -Ref: I/O Functions-Footnote-1577167 -Ref: I/O Functions-Footnote-2577315 -Node: Time Functions577435 -Ref: Time Functions-Footnote-1588106 -Ref: Time Functions-Footnote-2588174 -Ref: Time Functions-Footnote-3588332 -Ref: Time Functions-Footnote-4588443 -Ref: Time Functions-Footnote-5588555 -Ref: Time Functions-Footnote-6588782 -Node: Bitwise Functions589048 -Ref: table-bitwise-ops589642 -Ref: Bitwise Functions-Footnote-1595705 -Ref: Bitwise Functions-Footnote-2595878 -Node: Type Functions596069 -Node: I18N Functions598820 -Node: User-defined600471 -Node: Definition Syntax601276 -Ref: Definition Syntax-Footnote-1606963 -Node: Function Example607034 -Ref: Function Example-Footnote-1609956 -Node: Function Caveats609978 -Node: Calling A Function610496 -Node: Variable Scope611454 -Node: Pass By Value/Reference614448 -Node: Return Statement617947 -Node: Dynamic Typing620926 -Node: Indirect Calls621856 -Ref: Indirect Calls-Footnote-1632108 -Node: Functions Summary632236 -Node: Library Functions634941 -Ref: Library Functions-Footnote-1638548 -Ref: Library Functions-Footnote-2638691 -Node: Library Names638862 -Ref: Library Names-Footnote-1642322 -Ref: Library Names-Footnote-2642545 -Node: General Functions642631 -Node: Strtonum Function643734 -Node: Assert Function646756 -Node: Round Function650082 -Node: Cliff Random Function651622 -Node: Ordinal Functions652638 -Ref: Ordinal Functions-Footnote-1655701 -Ref: Ordinal Functions-Footnote-2655953 -Node: Join Function656163 -Ref: Join Function-Footnote-1657933 -Node: Getlocaltime Function658133 -Node: Readfile Function661875 -Node: Shell Quoting663852 -Node: Data File Management665253 -Node: Filetrans Function665885 -Node: Rewind Function669981 -Node: File Checking671891 -Ref: File Checking-Footnote-1673225 -Node: Empty Files673426 -Node: Ignoring Assigns675405 -Node: Getopt Function676955 -Ref: Getopt Function-Footnote-1688424 -Node: Passwd Functions688624 -Ref: Passwd Functions-Footnote-1697463 -Node: Group Functions697551 -Ref: Group Functions-Footnote-1705449 -Node: Walking Arrays705656 -Node: Library Functions Summary708664 -Node: Library Exercises710070 -Node: Sample Programs710535 -Node: Running Examples711305 -Node: Clones712033 -Node: Cut Program713257 -Node: Egrep Program723186 -Ref: Egrep Program-Footnote-1730698 -Node: Id Program730808 -Node: Split Program734488 -Ref: Split Program-Footnote-1737946 -Node: Tee Program738075 -Node: Uniq Program740865 -Node: Wc Program748291 -Ref: Wc Program-Footnote-1752546 -Node: Miscellaneous Programs752640 -Node: Dupword Program753853 -Node: Alarm Program755883 -Node: Translate Program760738 -Ref: Translate Program-Footnote-1765303 -Node: Labels Program765573 -Ref: Labels Program-Footnote-1768924 -Node: Word Sorting769008 -Node: History Sorting773080 -Node: Extract Program774915 -Node: Simple Sed782969 -Node: Igawk Program786043 -Ref: Igawk Program-Footnote-1800374 -Ref: Igawk Program-Footnote-2800576 -Ref: Igawk Program-Footnote-3800698 -Node: Anagram Program800813 -Node: Signature Program803875 -Node: Programs Summary805122 -Node: Programs Exercises806336 -Ref: Programs Exercises-Footnote-1810465 -Node: Advanced Features810556 -Node: Nondecimal Data812546 -Node: Array Sorting814137 -Node: Controlling Array Traversal814837 -Ref: Controlling Array Traversal-Footnote-1823205 -Node: Array Sorting Functions823323 -Ref: Array Sorting Functions-Footnote-1828414 -Node: Two-way I/O828610 -Ref: Two-way I/O-Footnote-1836330 -Ref: Two-way I/O-Footnote-2836517 -Node: TCP/IP Networking836599 -Node: Profiling839717 -Node: Advanced Features Summary848722 -Node: Internationalization850566 -Node: I18N and L10N852046 -Node: Explaining gettext852733 -Ref: Explaining gettext-Footnote-1858625 -Ref: Explaining gettext-Footnote-2858810 -Node: Programmer i18n858975 -Ref: Programmer i18n-Footnote-1863924 -Node: Translator i18n863973 -Node: String Extraction864767 -Ref: String Extraction-Footnote-1865899 -Node: Printf Ordering865985 -Ref: Printf Ordering-Footnote-1868771 -Node: I18N Portability868835 -Ref: I18N Portability-Footnote-1871291 -Node: I18N Example871354 -Ref: I18N Example-Footnote-1874160 -Node: Gawk I18N874233 -Node: I18N Summary874878 -Node: Debugger876219 -Node: Debugging877242 -Node: Debugging Concepts877683 -Node: Debugging Terms879492 -Node: Awk Debugging882067 -Node: Sample Debugging Session882973 -Node: Debugger Invocation883507 -Node: Finding The Bug884893 -Node: List of Debugger Commands891371 -Node: Breakpoint Control892704 -Node: Debugger Execution Control896398 -Node: Viewing And Changing Data899760 -Node: Execution Stack903134 -Node: Debugger Info904771 -Node: Miscellaneous Debugger Commands908842 -Node: Readline Support913904 -Node: Limitations914800 -Node: Debugging Summary916909 -Node: Arbitrary Precision Arithmetic918188 -Node: Computer Arithmetic919673 -Ref: table-numeric-ranges923439 -Ref: table-floating-point-ranges923932 -Ref: Computer Arithmetic-Footnote-1924590 -Node: Math Definitions924647 -Ref: table-ieee-formats927963 -Ref: Math Definitions-Footnote-1928566 -Node: MPFR features928671 -Node: FP Math Caution930389 -Ref: FP Math Caution-Footnote-1931461 -Node: Inexactness of computations931830 -Node: Inexact representation932790 -Node: Comparing FP Values934150 -Node: Errors accumulate935391 -Node: Getting Accuracy936824 -Node: Try To Round939534 -Node: Setting precision940433 -Ref: table-predefined-precision-strings941130 -Node: Setting the rounding mode942960 -Ref: table-gawk-rounding-modes943334 -Ref: Setting the rounding mode-Footnote-1947265 -Node: Arbitrary Precision Integers947444 -Ref: Arbitrary Precision Integers-Footnote-1950619 -Node: Checking for MPFR950768 -Node: POSIX Floating Point Problems952242 -Ref: POSIX Floating Point Problems-Footnote-1956527 -Node: Floating point summary956565 -Node: Dynamic Extensions958755 -Node: Extension Intro960308 -Node: Plugin License961574 -Node: Extension Mechanism Outline962371 -Ref: figure-load-extension962810 -Ref: figure-register-new-function964375 -Ref: figure-call-new-function965467 -Node: Extension API Description967529 -Node: Extension API Functions Introduction969171 -Node: General Data Types974711 -Ref: General Data Types-Footnote-1983072 -Node: Memory Allocation Functions983371 -Ref: Memory Allocation Functions-Footnote-1987581 -Node: Constructor Functions987680 -Node: Registration Functions991266 -Node: Extension Functions991951 -Node: Exit Callback Functions997166 -Node: Extension Version String998416 -Node: Input Parsers999079 -Node: Output Wrappers1011800 -Node: Two-way processors1016312 -Node: Printing Messages1018577 -Ref: Printing Messages-Footnote-11019748 -Node: Updating ERRNO1019901 -Node: Requesting Values1020640 -Ref: table-value-types-returned1021377 -Node: Accessing Parameters1022313 -Node: Symbol Table Access1023548 -Node: Symbol table by name1024060 -Node: Symbol table by cookie1025849 -Ref: Symbol table by cookie-Footnote-11030034 -Node: Cached values1030098 -Ref: Cached values-Footnote-11033634 -Node: Array Manipulation1033787 -Ref: Array Manipulation-Footnote-11034878 -Node: Array Data Types1034915 -Ref: Array Data Types-Footnote-11037573 -Node: Array Functions1037665 -Node: Flattening Arrays1042163 -Node: Creating Arrays1049139 -Node: Redirection API1053906 -Node: Extension API Variables1056739 -Node: Extension Versioning1057450 -Ref: gawk-api-version1057879 -Node: Extension GMP/MPFR Versioning1059610 -Node: Extension API Informational Variables1061238 -Node: Extension API Boilerplate1062311 -Node: Changes from API V11066285 -Node: Finding Extensions1067857 -Node: Extension Example1068416 -Node: Internal File Description1069214 -Node: Internal File Ops1073294 -Ref: Internal File Ops-Footnote-11084644 -Node: Using Internal File Ops1084784 -Ref: Using Internal File Ops-Footnote-11087167 -Node: Extension Samples1087441 -Node: Extension Sample File Functions1088970 -Node: Extension Sample Fnmatch1096619 -Node: Extension Sample Fork1098106 -Node: Extension Sample Inplace1099324 -Node: Extension Sample Ord1102541 -Node: Extension Sample Readdir1103377 -Ref: table-readdir-file-types1104266 -Node: Extension Sample Revout1105071 -Node: Extension Sample Rev2way1105660 -Node: Extension Sample Read write array1106400 -Node: Extension Sample Readfile1108342 -Node: Extension Sample Time1109437 -Node: Extension Sample API Tests1110785 -Node: gawkextlib1111277 -Node: Extension summary1114195 -Node: Extension Exercises1117897 -Node: Language History1119395 -Node: V7/SVR3.11121051 -Node: SVR41123203 -Node: POSIX1124637 -Node: BTL1126017 -Node: POSIX/GNU1126746 -Node: Feature History1132524 -Node: Common Extensions1148570 -Node: Ranges and Locales1149853 -Ref: Ranges and Locales-Footnote-11154469 -Ref: Ranges and Locales-Footnote-21154496 -Ref: Ranges and Locales-Footnote-31154731 -Node: Contributors1154952 -Node: History summary1160897 -Node: Installation1162277 -Node: Gawk Distribution1163221 -Node: Getting1163705 -Node: Extracting1164668 -Node: Distribution contents1166306 -Node: Unix Installation1172786 -Node: Quick Installation1173468 -Node: Shell Startup Files1175882 -Node: Additional Configuration Options1176971 -Node: Configuration Philosophy1179136 -Node: Non-Unix Installation1181505 -Node: PC Installation1181965 -Node: PC Binary Installation1182803 -Node: PC Compiling1183238 -Node: PC Using1184355 -Node: Cygwin1187908 -Node: MSYS1189007 -Node: VMS Installation1189508 -Node: VMS Compilation1190299 -Ref: VMS Compilation-Footnote-11191528 -Node: VMS Dynamic Extensions1191586 -Node: VMS Installation Details1193271 -Node: VMS Running1195524 -Node: VMS GNV1199803 -Node: VMS Old Gawk1200538 -Node: Bugs1201009 -Node: Bug address1201672 -Node: Usenet1204654 -Node: Maintainers1205658 -Node: Other Versions1206919 -Node: Installation summary1213833 -Node: Notes1215035 -Node: Compatibility Mode1215829 -Node: Additions1216611 -Node: Accessing The Source1217536 -Node: Adding Code1218973 -Node: New Ports1225192 -Node: Derived Files1229680 -Ref: Derived Files-Footnote-11235326 -Ref: Derived Files-Footnote-21235361 -Ref: Derived Files-Footnote-31235959 -Node: Future Extensions1236073 -Node: Implementation Limitations1236731 -Node: Extension Design1237914 -Node: Old Extension Problems1239058 -Ref: Old Extension Problems-Footnote-11240576 -Node: Extension New Mechanism Goals1240633 -Ref: Extension New Mechanism Goals-Footnote-11243997 -Node: Extension Other Design Decisions1244186 -Node: Extension Future Growth1246299 -Node: Notes summary1247135 -Node: Basic Concepts1248310 -Node: Basic High Level1248991 -Ref: figure-general-flow1249273 -Ref: figure-process-flow1249958 -Ref: Basic High Level-Footnote-11253259 -Node: Basic Data Typing1253444 -Node: Glossary1256772 -Node: Copying1288610 -Node: GNU Free Documentation License1326153 -Node: Index1351273 +Ref: Auto-set-Footnote-1482763 +Ref: Auto-set-Footnote-2482969 +Node: ARGC and ARGV483025 +Node: Pattern Action Summary487238 +Node: Arrays489668 +Node: Array Basics490997 +Node: Array Intro491841 +Ref: figure-array-elements493816 +Ref: Array Intro-Footnote-1496520 +Node: Reference to Elements496648 +Node: Assigning Elements499112 +Node: Array Example499603 +Node: Scanning an Array501362 +Node: Controlling Scanning504384 +Ref: Controlling Scanning-Footnote-1509783 +Node: Numeric Array Subscripts510099 +Node: Uninitialized Subscripts512283 +Node: Delete513902 +Ref: Delete-Footnote-1516654 +Node: Multidimensional516711 +Node: Multiscanning519806 +Node: Arrays of Arrays521397 +Node: Arrays Summary526165 +Node: Functions528258 +Node: Built-in529296 +Node: Calling Built-in530377 +Node: Numeric Functions532373 +Ref: Numeric Functions-Footnote-1536401 +Ref: Numeric Functions-Footnote-2536758 +Ref: Numeric Functions-Footnote-3536806 +Node: String Functions537078 +Ref: String Functions-Footnote-1560936 +Ref: String Functions-Footnote-2561064 +Ref: String Functions-Footnote-3561312 +Node: Gory Details561399 +Ref: table-sub-escapes563190 +Ref: table-sub-proposed564709 +Ref: table-posix-sub566072 +Ref: table-gensub-escapes567613 +Ref: Gory Details-Footnote-1568436 +Node: I/O Functions568590 +Ref: table-system-return-values575058 +Ref: I/O Functions-Footnote-1577138 +Ref: I/O Functions-Footnote-2577286 +Node: Time Functions577406 +Ref: Time Functions-Footnote-1588077 +Ref: Time Functions-Footnote-2588145 +Ref: Time Functions-Footnote-3588303 +Ref: Time Functions-Footnote-4588414 +Ref: Time Functions-Footnote-5588526 +Ref: Time Functions-Footnote-6588753 +Node: Bitwise Functions589019 +Ref: table-bitwise-ops589613 +Ref: Bitwise Functions-Footnote-1595676 +Ref: Bitwise Functions-Footnote-2595849 +Node: Type Functions596040 +Node: I18N Functions598791 +Node: User-defined600442 +Node: Definition Syntax601247 +Ref: Definition Syntax-Footnote-1606934 +Node: Function Example607005 +Ref: Function Example-Footnote-1609927 +Node: Function Caveats609949 +Node: Calling A Function610467 +Node: Variable Scope611425 +Node: Pass By Value/Reference614419 +Node: Return Statement617918 +Node: Dynamic Typing620897 +Node: Indirect Calls621827 +Ref: Indirect Calls-Footnote-1632079 +Node: Functions Summary632207 +Node: Library Functions634912 +Ref: Library Functions-Footnote-1638519 +Ref: Library Functions-Footnote-2638662 +Node: Library Names638833 +Ref: Library Names-Footnote-1642293 +Ref: Library Names-Footnote-2642516 +Node: General Functions642602 +Node: Strtonum Function643705 +Node: Assert Function646727 +Node: Round Function650053 +Node: Cliff Random Function651593 +Node: Ordinal Functions652609 +Ref: Ordinal Functions-Footnote-1655672 +Ref: Ordinal Functions-Footnote-2655924 +Node: Join Function656134 +Ref: Join Function-Footnote-1657904 +Node: Getlocaltime Function658104 +Node: Readfile Function661846 +Node: Shell Quoting663823 +Node: Data File Management665224 +Node: Filetrans Function665856 +Node: Rewind Function669952 +Node: File Checking671862 +Ref: File Checking-Footnote-1673196 +Node: Empty Files673397 +Node: Ignoring Assigns675376 +Node: Getopt Function676926 +Ref: Getopt Function-Footnote-1688395 +Node: Passwd Functions688595 +Ref: Passwd Functions-Footnote-1697434 +Node: Group Functions697522 +Ref: Group Functions-Footnote-1705420 +Node: Walking Arrays705627 +Node: Library Functions Summary708635 +Node: Library Exercises710041 +Node: Sample Programs710506 +Node: Running Examples711276 +Node: Clones712004 +Node: Cut Program713228 +Node: Egrep Program723157 +Ref: Egrep Program-Footnote-1730669 +Node: Id Program730779 +Node: Split Program734459 +Ref: Split Program-Footnote-1737917 +Node: Tee Program738046 +Node: Uniq Program740836 +Node: Wc Program748262 +Ref: Wc Program-Footnote-1752517 +Node: Miscellaneous Programs752611 +Node: Dupword Program753824 +Node: Alarm Program755854 +Node: Translate Program760709 +Ref: Translate Program-Footnote-1765274 +Node: Labels Program765544 +Ref: Labels Program-Footnote-1768895 +Node: Word Sorting768979 +Node: History Sorting773051 +Node: Extract Program774886 +Node: Simple Sed782940 +Node: Igawk Program786014 +Ref: Igawk Program-Footnote-1800345 +Ref: Igawk Program-Footnote-2800547 +Ref: Igawk Program-Footnote-3800669 +Node: Anagram Program800784 +Node: Signature Program803846 +Node: Programs Summary805093 +Node: Programs Exercises806307 +Ref: Programs Exercises-Footnote-1810436 +Node: Advanced Features810527 +Node: Nondecimal Data812517 +Node: Array Sorting814108 +Node: Controlling Array Traversal814808 +Ref: Controlling Array Traversal-Footnote-1823176 +Node: Array Sorting Functions823294 +Ref: Array Sorting Functions-Footnote-1828385 +Node: Two-way I/O828581 +Ref: Two-way I/O-Footnote-1836301 +Ref: Two-way I/O-Footnote-2836488 +Node: TCP/IP Networking836570 +Node: Profiling839688 +Node: Advanced Features Summary848693 +Node: Internationalization850537 +Node: I18N and L10N852017 +Node: Explaining gettext852704 +Ref: Explaining gettext-Footnote-1858596 +Ref: Explaining gettext-Footnote-2858781 +Node: Programmer i18n858946 +Ref: Programmer i18n-Footnote-1863895 +Node: Translator i18n863944 +Node: String Extraction864738 +Ref: String Extraction-Footnote-1865870 +Node: Printf Ordering865956 +Ref: Printf Ordering-Footnote-1868742 +Node: I18N Portability868806 +Ref: I18N Portability-Footnote-1871262 +Node: I18N Example871325 +Ref: I18N Example-Footnote-1874131 +Node: Gawk I18N874204 +Node: I18N Summary874849 +Node: Debugger876190 +Node: Debugging877213 +Node: Debugging Concepts877654 +Node: Debugging Terms879463 +Node: Awk Debugging882038 +Node: Sample Debugging Session882944 +Node: Debugger Invocation883478 +Node: Finding The Bug884864 +Node: List of Debugger Commands891342 +Node: Breakpoint Control892675 +Node: Debugger Execution Control896369 +Node: Viewing And Changing Data899731 +Node: Execution Stack903105 +Node: Debugger Info904742 +Node: Miscellaneous Debugger Commands908813 +Node: Readline Support913875 +Node: Limitations914771 +Node: Debugging Summary916880 +Node: Arbitrary Precision Arithmetic918159 +Node: Computer Arithmetic919644 +Ref: table-numeric-ranges923410 +Ref: table-floating-point-ranges923903 +Ref: Computer Arithmetic-Footnote-1924561 +Node: Math Definitions924618 +Ref: table-ieee-formats927934 +Ref: Math Definitions-Footnote-1928537 +Node: MPFR features928642 +Node: FP Math Caution930360 +Ref: FP Math Caution-Footnote-1931432 +Node: Inexactness of computations931801 +Node: Inexact representation932761 +Node: Comparing FP Values934121 +Node: Errors accumulate935362 +Node: Getting Accuracy936795 +Node: Try To Round939505 +Node: Setting precision940404 +Ref: table-predefined-precision-strings941101 +Node: Setting the rounding mode942931 +Ref: table-gawk-rounding-modes943305 +Ref: Setting the rounding mode-Footnote-1947236 +Node: Arbitrary Precision Integers947415 +Ref: Arbitrary Precision Integers-Footnote-1950590 +Node: Checking for MPFR950739 +Node: POSIX Floating Point Problems952213 +Ref: POSIX Floating Point Problems-Footnote-1956498 +Node: Floating point summary956536 +Node: Dynamic Extensions958726 +Node: Extension Intro960279 +Node: Plugin License961545 +Node: Extension Mechanism Outline962342 +Ref: figure-load-extension962781 +Ref: figure-register-new-function964346 +Ref: figure-call-new-function965438 +Node: Extension API Description967500 +Node: Extension API Functions Introduction969142 +Node: General Data Types974682 +Ref: General Data Types-Footnote-1983043 +Node: Memory Allocation Functions983342 +Ref: Memory Allocation Functions-Footnote-1987552 +Node: Constructor Functions987651 +Node: Registration Functions991237 +Node: Extension Functions991922 +Node: Exit Callback Functions997137 +Node: Extension Version String998387 +Node: Input Parsers999050 +Node: Output Wrappers1011771 +Node: Two-way processors1016283 +Node: Printing Messages1018548 +Ref: Printing Messages-Footnote-11019719 +Node: Updating ERRNO1019872 +Node: Requesting Values1020611 +Ref: table-value-types-returned1021348 +Node: Accessing Parameters1022284 +Node: Symbol Table Access1023519 +Node: Symbol table by name1024031 +Node: Symbol table by cookie1025820 +Ref: Symbol table by cookie-Footnote-11030005 +Node: Cached values1030069 +Ref: Cached values-Footnote-11033605 +Node: Array Manipulation1033758 +Ref: Array Manipulation-Footnote-11034849 +Node: Array Data Types1034886 +Ref: Array Data Types-Footnote-11037544 +Node: Array Functions1037636 +Node: Flattening Arrays1042134 +Node: Creating Arrays1049110 +Node: Redirection API1053877 +Node: Extension API Variables1056710 +Node: Extension Versioning1057421 +Ref: gawk-api-version1057850 +Node: Extension GMP/MPFR Versioning1059581 +Node: Extension API Informational Variables1061209 +Node: Extension API Boilerplate1062282 +Node: Changes from API V11066256 +Node: Finding Extensions1067828 +Node: Extension Example1068387 +Node: Internal File Description1069185 +Node: Internal File Ops1073265 +Ref: Internal File Ops-Footnote-11084615 +Node: Using Internal File Ops1084755 +Ref: Using Internal File Ops-Footnote-11087138 +Node: Extension Samples1087412 +Node: Extension Sample File Functions1088941 +Node: Extension Sample Fnmatch1096590 +Node: Extension Sample Fork1098077 +Node: Extension Sample Inplace1099295 +Node: Extension Sample Ord1102512 +Node: Extension Sample Readdir1103348 +Ref: table-readdir-file-types1104237 +Node: Extension Sample Revout1105042 +Node: Extension Sample Rev2way1105631 +Node: Extension Sample Read write array1106371 +Node: Extension Sample Readfile1108313 +Node: Extension Sample Time1109408 +Node: Extension Sample API Tests1110756 +Node: gawkextlib1111248 +Node: Extension summary1114166 +Node: Extension Exercises1117868 +Node: Language History1119366 +Node: V7/SVR3.11121022 +Node: SVR41123174 +Node: POSIX1124608 +Node: BTL1125988 +Node: POSIX/GNU1126717 +Node: Feature History1132495 +Node: Common Extensions1148541 +Node: Ranges and Locales1149824 +Ref: Ranges and Locales-Footnote-11154440 +Ref: Ranges and Locales-Footnote-21154467 +Ref: Ranges and Locales-Footnote-31154702 +Node: Contributors1154923 +Node: History summary1160868 +Node: Installation1162248 +Node: Gawk Distribution1163192 +Node: Getting1163676 +Node: Extracting1164639 +Node: Distribution contents1166277 +Node: Unix Installation1172757 +Node: Quick Installation1173439 +Node: Shell Startup Files1175853 +Node: Additional Configuration Options1176942 +Node: Configuration Philosophy1179107 +Node: Non-Unix Installation1181476 +Node: PC Installation1181936 +Node: PC Binary Installation1182774 +Node: PC Compiling1183209 +Node: PC Using1184326 +Node: Cygwin1187879 +Node: MSYS1188978 +Node: VMS Installation1189479 +Node: VMS Compilation1190270 +Ref: VMS Compilation-Footnote-11191499 +Node: VMS Dynamic Extensions1191557 +Node: VMS Installation Details1193242 +Node: VMS Running1195495 +Node: VMS GNV1199774 +Node: VMS Old Gawk1200509 +Node: Bugs1200980 +Node: Bug address1201643 +Node: Usenet1204625 +Node: Maintainers1205629 +Node: Other Versions1206890 +Node: Installation summary1213804 +Node: Notes1215006 +Node: Compatibility Mode1215800 +Node: Additions1216582 +Node: Accessing The Source1217507 +Node: Adding Code1218944 +Node: New Ports1225163 +Node: Derived Files1229651 +Ref: Derived Files-Footnote-11235297 +Ref: Derived Files-Footnote-21235332 +Ref: Derived Files-Footnote-31235930 +Node: Future Extensions1236044 +Node: Implementation Limitations1236702 +Node: Extension Design1237885 +Node: Old Extension Problems1239029 +Ref: Old Extension Problems-Footnote-11240547 +Node: Extension New Mechanism Goals1240604 +Ref: Extension New Mechanism Goals-Footnote-11243968 +Node: Extension Other Design Decisions1244157 +Node: Extension Future Growth1246270 +Node: Notes summary1247106 +Node: Basic Concepts1248281 +Node: Basic High Level1248962 +Ref: figure-general-flow1249244 +Ref: figure-process-flow1249929 +Ref: Basic High Level-Footnote-11253230 +Node: Basic Data Typing1253415 +Node: Glossary1256743 +Node: Copying1288581 +Node: GNU Free Documentation License1326124 +Node: Index1351244 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 6c3c28af..70ab0de3 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -15935,7 +15935,8 @@ if an element in @code{SYMTAB} is an array. Also, you may not use the @code{delete} statement with the @code{SYMTAB} array. -You may use an index for @code{SYMTAB} that is not a predefined identifier: +Prior to @value{PVERSION} 5.0 of @command{gawk}, you could +use an index for @code{SYMTAB} that was not a predefined identifier: @example SYMTAB["xxx"] = 5 @@ -15943,9 +15944,8 @@ print SYMTAB["xxx"] @end example @noindent -This works as expected: in this case @code{SYMTAB} acts just like -a regular array. The only difference is that you can't then delete -@code{SYMTAB["xxx"]}. +This no longer works, instead producing a fatal error, as it led +to rampant confusion. @cindex Schorr, Andrew The @code{SYMTAB} array is more interesting than it looks. Andrew Schorr diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 1e3d0bea..091b786d 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -15253,7 +15253,8 @@ if an element in @code{SYMTAB} is an array. Also, you may not use the @code{delete} statement with the @code{SYMTAB} array. -You may use an index for @code{SYMTAB} that is not a predefined identifier: +Prior to @value{PVERSION} 5.0 of @command{gawk}, you could +use an index for @code{SYMTAB} that was not a predefined identifier: @example SYMTAB["xxx"] = 5 @@ -15261,9 +15262,8 @@ print SYMTAB["xxx"] @end example @noindent -This works as expected: in this case @code{SYMTAB} acts just like -a regular array. The only difference is that you can't then delete -@code{SYMTAB["xxx"]}. +This no longer works, instead producing a fatal error, as it led +to rampant confusion. @cindex Schorr, Andrew The @code{SYMTAB} array is more interesting than it looks. Andrew Schorr diff --git a/interpret.h b/interpret.h index 4381a929..6a1a08b4 100644 --- a/interpret.h +++ b/interpret.h @@ -348,16 +348,19 @@ uninitialized_scalar: * 3. Values that awk code stuck into SYMTAB not related to variables (Node_value) * For 1, since we are giving it a value, we have to change the type to Node_var. * For 1 and 2, we have to step through the Node_var to get to the value. - * For 3, we just us the value we got from assoc_lookup(), above. + * For 3, we fatal out. This avoids confusion on things like + * SYMTAB["a foo"] = 42 # variable with a space in its name? */ if (t1 == func_table) fatal(_("cannot assign to elements of FUNCTAB")); - else if ( t1 == symbol_table - && ( (*lhs)->type == Node_var + else if (t1 == symbol_table) { + if (( (*lhs)->type == Node_var || (*lhs)->type == Node_var_new)) { - update_global_values(); /* make sure stuff like NF, NR, are up to date */ - (*lhs)->type = Node_var; /* in case was Node_var_new */ - lhs = & ((*lhs)->var_value); /* extra level of indirection */ + update_global_values(); /* make sure stuff like NF, NR, are up to date */ + (*lhs)->type = Node_var; /* in case was Node_var_new */ + lhs = & ((*lhs)->var_value); /* extra level of indirection */ + } else + fatal(_("cannot assign to arbitrary elements of SYMTAB")); } assert(set_idx == NULL); @@ -658,22 +661,25 @@ mod: /* * Changing something in FUNCTAB is not allowed. * - * SYMTAB is a little more messy. Three kinds of values may - * be stored in SYMTAB: + * SYMTAB is a little more messy. Three possibilities for SYMTAB: * 1. Variables that don"t yet have a value (Node_var_new) * 2. Variables that have a value (Node_var) * 3. Values that awk code stuck into SYMTAB not related to variables (Node_value) * For 1, since we are giving it a value, we have to change the type to Node_var. * For 1 and 2, we have to step through the Node_var to get to the value. - * For 3, we just us the value we got from assoc_lookup(), above. + * For 3, we fatal out. This avoids confusion on things like + * SYMTAB["a foo"] = 42 # variable with a space in its name? */ if (t1 == func_table) fatal(_("cannot assign to elements of FUNCTAB")); - else if ( t1 == symbol_table - && ( (*lhs)->type == Node_var + else if (t1 == symbol_table) { + if (( (*lhs)->type == Node_var || (*lhs)->type == Node_var_new)) { - (*lhs)->type = Node_var; /* in case was Node_var_new */ - lhs = & ((*lhs)->var_value); /* extra level of indirection */ + update_global_values(); /* make sure stuff like NF, NR, are up to date */ + (*lhs)->type = Node_var; /* in case was Node_var_new */ + lhs = & ((*lhs)->var_value); /* extra level of indirection */ + } else + fatal(_("cannot assign to arbitrary elements of SYMTAB")); } unref(*lhs); diff --git a/test/Makefile.am b/test/Makefile.am index 3e7394f9..98406a59 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2103,8 +2103,7 @@ charasbytes: symtab6: @echo $@ - @$(AWK) -d__$@ -f "$(srcdir)"/$@.awk - @grep -v '^ENVIRON' __$@ | grep -v '^PROCINFO' > _$@ ; rm __$@ + @$(AWK) -f "$(srcdir)"/$@.awk > _$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ symtab8: diff --git a/test/Makefile.in b/test/Makefile.in index 3daf6980..54c6b986 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -2551,8 +2551,7 @@ charasbytes: symtab6: @echo $@ - @$(AWK) -d__$@ -f "$(srcdir)"/$@.awk - @grep -v '^ENVIRON' __$@ | grep -v '^PROCINFO' > _$@ ; rm __$@ + @$(AWK) -f "$(srcdir)"/$@.awk > _$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ symtab8: diff --git a/test/symtab6.ok b/test/symtab6.ok index 7de717a0..23a1633d 100644 --- a/test/symtab6.ok +++ b/test/symtab6.ok @@ -1,28 +1,2 @@ -ARGC: 1 -ARGIND: 0 -ARGV: array, 1 elements -BINMODE: 0 -CONVFMT: "%.6g" -ERRNO: "" -FIELDWIDTHS: "" -FILENAME: "" -FNR: 0 -FPAT: "[^[:space:]]+" -FS: " " -FUNCTAB: array, 41 elements -IGNORECASE: 0 -LINT: 0 -NF: 0 -NR: 0 -OFMT: "%.6g" -OFS: " " -ORS: "\n" -PREC: 53 -RLENGTH: 0 -ROUNDMODE: "N" -RS: "\n" -RSTART: 0 -RT: "" -SUBSEP: "\034" -SYMTAB: array, 29 elements -TEXTDOMAIN: "messages" +gawk: ./symtab6.awk:1: fatal: cannot assign to arbitrary elements of SYMTAB +EXIT CODE: 2 diff --git a/test/symtab7.ok b/test/symtab7.ok index 28328831..37de1a49 100644 --- a/test/symtab7.ok +++ b/test/symtab7.ok @@ -1,2 +1,2 @@ -30 -40 +gawk: symtab7.awk:4: (FILENAME=- FNR=1) fatal: cannot assign to arbitrary elements of SYMTAB +EXIT CODE: 2 |