diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | awk.h | 2 | ||||
-rw-r--r-- | doc/ChangeLog | 4 | ||||
-rw-r--r-- | doc/gawk.info | 681 | ||||
-rw-r--r-- | doc/gawk.texi | 1 | ||||
-rw-r--r-- | extension/ChangeLog | 4 | ||||
-rw-r--r-- | extension/readdir.c | 6 | ||||
-rw-r--r-- | gawkapi.c | 29 | ||||
-rw-r--r-- | gawkapi.h | 13 | ||||
-rw-r--r-- | io.c | 53 |
10 files changed, 392 insertions, 410 deletions
@@ -1,3 +1,12 @@ +2012-07-29 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (set_RT_to_null, set_RT): Removed. + * gawkapi.h (api_set_RT): Removed. + (get_record): Signature changed in input parser struct. + * gawkapi.c (api_set_RT): Removed. + * io.c (set_RT_to_null, set_RT): Removed. + (get_a_record): Adjustments for new API for input parser. + 2012-07-29 Arnold D. Robbins <arnold@skeeve.com> * awk.h (os_isreadable): Adjust declaration. @@ -1546,8 +1546,6 @@ extern void init_io(void); extern void register_input_parser(awk_input_parser_t *input_parser); extern void set_FNR(void); extern void set_NR(void); -extern void set_RT_to_null(void); -extern void set_RT(NODE *n); extern struct redirect *redirect(NODE *redir_exp, int redirtype, int *errflg); extern NODE *do_close(int nargs); diff --git a/doc/ChangeLog b/doc/ChangeLog index 1628e796..9c18e99e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2012-07-29 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawk.texi: Document that RT is set by getline. + 2012-07-04 Arnold D. Robbins <arnold@skeeve.com> * gawk.texi, gawk.1, awkcard.in: Document that and(), or(), and diff --git a/doc/gawk.info b/doc/gawk.info index 57c5ec26..bcc773d6 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -5331,7 +5331,8 @@ File: gawk.info, Node: Getline Summary, Prev: Getline Notes, Up: Getline *note table-getline-variants:: summarizes the eight variants of `getline', listing which built-in variables are set by each one, and -whether the variant is standard or a `gawk' extension. +whether the variant is standard or a `gawk' extension. Note: for each +variant, `gawk' sets the `RT' built-in variable. Variant Effect Standard / Extension @@ -28611,344 +28612,344 @@ Node: Getline/Coprocess229524 Node: Getline/Variable/Coprocess230767 Node: Getline Notes231481 Node: Getline Summary233423 -Ref: table-getline-variants233766 -Node: Read Timeout234622 -Ref: Read Timeout-Footnote-1238367 -Node: Command line directories238424 -Node: Printing239054 -Node: Print240685 -Node: Print Examples242022 -Node: Output Separators244806 -Node: OFMT246566 -Node: Printf247924 -Node: Basic Printf248830 -Node: Control Letters250369 -Node: Format Modifiers254181 -Node: Printf Examples260190 -Node: Redirection262905 -Node: Special Files269889 -Node: Special FD270422 -Ref: Special FD-Footnote-1274047 -Node: Special Network274121 -Node: Special Caveats274971 -Node: Close Files And Pipes275767 -Ref: Close Files And Pipes-Footnote-1282790 -Ref: Close Files And Pipes-Footnote-2282938 -Node: Expressions283088 -Node: Values284220 -Node: Constants284896 -Node: Scalar Constants285576 -Ref: Scalar Constants-Footnote-1286435 -Node: Nondecimal-numbers286617 -Node: Regexp Constants289676 -Node: Using Constant Regexps290151 -Node: Variables293206 -Node: Using Variables293861 -Node: Assignment Options295585 -Node: Conversion297457 -Ref: table-locale-affects302833 -Ref: Conversion-Footnote-1303457 -Node: All Operators303566 -Node: Arithmetic Ops304196 -Node: Concatenation306701 -Ref: Concatenation-Footnote-1309494 -Node: Assignment Ops309614 -Ref: table-assign-ops314602 -Node: Increment Ops316010 -Node: Truth Values and Conditions319480 -Node: Truth Values320563 -Node: Typing and Comparison321612 -Node: Variable Typing322401 -Ref: Variable Typing-Footnote-1326298 -Node: Comparison Operators326420 -Ref: table-relational-ops326830 -Node: POSIX String Comparison330379 -Ref: POSIX String Comparison-Footnote-1331335 -Node: Boolean Ops331473 -Ref: Boolean Ops-Footnote-1335551 -Node: Conditional Exp335642 -Node: Function Calls337374 -Node: Precedence340968 -Node: Locales344637 -Node: Patterns and Actions345726 -Node: Pattern Overview346780 -Node: Regexp Patterns348449 -Node: Expression Patterns348992 -Node: Ranges352677 -Node: BEGIN/END355643 -Node: Using BEGIN/END356405 -Ref: Using BEGIN/END-Footnote-1359136 -Node: I/O And BEGIN/END359242 -Node: BEGINFILE/ENDFILE361524 -Node: Empty364417 -Node: Using Shell Variables364733 -Node: Action Overview367018 -Node: Statements369375 -Node: If Statement371229 -Node: While Statement372728 -Node: Do Statement374772 -Node: For Statement375928 -Node: Switch Statement379080 -Node: Break Statement381177 -Node: Continue Statement383167 -Node: Next Statement384960 -Node: Nextfile Statement387350 -Node: Exit Statement389895 -Node: Built-in Variables392311 -Node: User-modified393406 -Ref: User-modified-Footnote-1401761 -Node: Auto-set401823 -Ref: Auto-set-Footnote-1411731 -Node: ARGC and ARGV411936 -Node: Arrays415787 -Node: Array Basics417292 -Node: Array Intro418118 -Node: Reference to Elements422436 -Node: Assigning Elements424706 -Node: Array Example425197 -Node: Scanning an Array426929 -Node: Controlling Scanning429243 -Ref: Controlling Scanning-Footnote-1434176 -Node: Delete434492 -Ref: Delete-Footnote-1436927 -Node: Numeric Array Subscripts436984 -Node: Uninitialized Subscripts439167 -Node: Multi-dimensional440795 -Node: Multi-scanning443889 -Node: Arrays of Arrays445480 -Node: Functions450125 -Node: Built-in450947 -Node: Calling Built-in452025 -Node: Numeric Functions454013 -Ref: Numeric Functions-Footnote-1457845 -Ref: Numeric Functions-Footnote-2458202 -Ref: Numeric Functions-Footnote-3458250 -Node: String Functions458519 -Ref: String Functions-Footnote-1482016 -Ref: String Functions-Footnote-2482145 -Ref: String Functions-Footnote-3482393 -Node: Gory Details482480 -Ref: table-sub-escapes484159 -Ref: table-sub-posix-92485513 -Ref: table-sub-proposed486856 -Ref: table-posix-sub488206 -Ref: table-gensub-escapes489752 -Ref: Gory Details-Footnote-1490959 -Ref: Gory Details-Footnote-2491010 -Node: I/O Functions491161 -Ref: I/O Functions-Footnote-1497816 -Node: Time Functions497963 -Ref: Time Functions-Footnote-1508855 -Ref: Time Functions-Footnote-2508923 -Ref: Time Functions-Footnote-3509081 -Ref: Time Functions-Footnote-4509192 -Ref: Time Functions-Footnote-5509304 -Ref: Time Functions-Footnote-6509531 -Node: Bitwise Functions509797 -Ref: table-bitwise-ops510355 -Ref: Bitwise Functions-Footnote-1514576 -Node: Type Functions514760 -Node: I18N Functions515230 -Node: User-defined516857 -Node: Definition Syntax517661 -Ref: Definition Syntax-Footnote-1522571 -Node: Function Example522640 -Node: Function Caveats525234 -Node: Calling A Function525655 -Node: Variable Scope526770 -Node: Pass By Value/Reference528745 -Node: Return Statement532185 -Node: Dynamic Typing535166 -Node: Indirect Calls535901 -Node: Internationalization545586 -Node: I18N and L10N547025 -Node: Explaining gettext547711 -Ref: Explaining gettext-Footnote-1552777 -Ref: Explaining gettext-Footnote-2552961 -Node: Programmer i18n553126 -Node: Translator i18n557326 -Node: String Extraction558119 -Ref: String Extraction-Footnote-1559080 -Node: Printf Ordering559166 -Ref: Printf Ordering-Footnote-1561950 -Node: I18N Portability562014 -Ref: I18N Portability-Footnote-1564463 -Node: I18N Example564526 -Ref: I18N Example-Footnote-1567161 -Node: Gawk I18N567233 -Node: Arbitrary Precision Arithmetic567850 -Ref: Arbitrary Precision Arithmetic-Footnote-1570725 -Node: Floating-point Programming570873 -Node: Floating-point Representation576143 -Node: Floating-point Context577247 -Ref: table-ieee-formats578082 -Node: Rounding Mode579452 -Ref: table-rounding-modes580079 -Ref: Rounding Mode-Footnote-1583202 -Node: Arbitrary Precision Floats583383 -Ref: Arbitrary Precision Floats-Footnote-1585424 -Node: Setting Precision585735 -Node: Setting Rounding Mode588493 -Node: Floating-point Constants589410 -Node: Changing Precision590829 -Ref: Changing Precision-Footnote-1592229 -Node: Exact Arithmetic592402 -Node: Integer Programming595415 -Node: Arbitrary Precision Integers597195 -Ref: Arbitrary Precision Integers-Footnote-1600219 -Node: MPFR and GMP Libraries600365 -Node: Advanced Features600750 -Node: Nondecimal Data602273 -Node: Array Sorting603856 -Node: Controlling Array Traversal604553 -Node: Array Sorting Functions612790 -Ref: Array Sorting Functions-Footnote-1616464 -Ref: Array Sorting Functions-Footnote-2616557 -Node: Two-way I/O616751 -Ref: Two-way I/O-Footnote-1622183 -Node: TCP/IP Networking622253 -Node: Profiling625097 -Node: Library Functions632551 -Ref: Library Functions-Footnote-1635558 -Node: Library Names635729 -Ref: Library Names-Footnote-1639200 -Ref: Library Names-Footnote-2639420 -Node: General Functions639506 -Node: Strtonum Function640459 -Node: Assert Function643389 -Node: Round Function646715 -Node: Cliff Random Function648258 -Node: Ordinal Functions649274 -Ref: Ordinal Functions-Footnote-1652344 -Ref: Ordinal Functions-Footnote-2652596 -Node: Join Function652805 -Ref: Join Function-Footnote-1654576 -Node: Getlocaltime Function654776 -Node: Data File Management658491 -Node: Filetrans Function659123 -Node: Rewind Function663262 -Node: File Checking664649 -Node: Empty Files665743 -Node: Ignoring Assigns667973 -Node: Getopt Function669526 -Ref: Getopt Function-Footnote-1680830 -Node: Passwd Functions681033 -Ref: Passwd Functions-Footnote-1690008 -Node: Group Functions690096 -Node: Walking Arrays698180 -Node: Sample Programs699749 -Node: Running Examples700414 -Node: Clones701142 -Node: Cut Program702366 -Node: Egrep Program712211 -Ref: Egrep Program-Footnote-1719984 -Node: Id Program720094 -Node: Split Program723710 -Ref: Split Program-Footnote-1727229 -Node: Tee Program727357 -Node: Uniq Program730160 -Node: Wc Program737589 -Ref: Wc Program-Footnote-1741855 -Ref: Wc Program-Footnote-2742055 -Node: Miscellaneous Programs742147 -Node: Dupword Program743335 -Node: Alarm Program745366 -Node: Translate Program750115 -Ref: Translate Program-Footnote-1754502 -Ref: Translate Program-Footnote-2754730 -Node: Labels Program754864 -Ref: Labels Program-Footnote-1758235 -Node: Word Sorting758319 -Node: History Sorting762203 -Node: Extract Program764042 -Ref: Extract Program-Footnote-1771525 -Node: Simple Sed771653 -Node: Igawk Program774715 -Ref: Igawk Program-Footnote-1789872 -Ref: Igawk Program-Footnote-2790073 -Node: Anagram Program790211 -Node: Signature Program793279 -Node: Debugger794379 -Node: Debugging795331 -Node: Debugging Concepts795764 -Node: Debugging Terms797620 -Node: Awk Debugging800217 -Node: Sample Debugging Session801109 -Node: Debugger Invocation801629 -Node: Finding The Bug802958 -Node: List of Debugger Commands809446 -Node: Breakpoint Control810780 -Node: Debugger Execution Control814444 -Node: Viewing And Changing Data817804 -Node: Execution Stack821160 -Node: Debugger Info822627 -Node: Miscellaneous Debugger Commands826608 -Node: Readline Support832053 -Node: Limitations832884 -Node: Language History835136 -Node: V7/SVR3.1836648 -Node: SVR4838969 -Node: POSIX840411 -Node: BTL841419 -Node: POSIX/GNU842153 -Node: Common Extensions847444 -Node: Ranges and Locales848551 -Ref: Ranges and Locales-Footnote-1853155 -Node: Contributors853376 -Node: Installation857637 -Node: Gawk Distribution858531 -Node: Getting859015 -Node: Extracting859841 -Node: Distribution contents861533 -Node: Unix Installation866755 -Node: Quick Installation867372 -Node: Additional Configuration Options869334 -Node: Configuration Philosophy870811 -Node: Non-Unix Installation873153 -Node: PC Installation873611 -Node: PC Binary Installation874910 -Node: PC Compiling876758 -Node: PC Testing879702 -Node: PC Using880878 -Node: Cygwin885063 -Node: MSYS886063 -Node: VMS Installation886577 -Node: VMS Compilation887180 -Ref: VMS Compilation-Footnote-1888187 -Node: VMS Installation Details888245 -Node: VMS Running889880 -Node: VMS Old Gawk891487 -Node: Bugs891961 -Node: Other Versions895813 -Node: Notes901128 -Node: Compatibility Mode901820 -Node: Additions902603 -Node: Accessing The Source903415 -Node: Adding Code904840 -Node: New Ports910807 -Node: Dynamic Extensions914920 -Node: Internals916360 -Node: Plugin License925182 -Node: Loading Extensions925820 -Node: Sample Library927661 -Node: Internal File Description928351 -Node: Internal File Ops932066 -Ref: Internal File Ops-Footnote-1936631 -Node: Using Internal File Ops936771 -Node: Future Extensions939149 -Node: Basic Concepts941653 -Node: Basic High Level942410 -Ref: Basic High Level-Footnote-1946445 -Node: Basic Data Typing946630 -Node: Floating Point Issues951155 -Node: String Conversion Precision952238 -Ref: String Conversion Precision-Footnote-1953938 -Node: Unexpected Results954047 -Node: POSIX Floating Point Problems955873 -Ref: POSIX Floating Point Problems-Footnote-1959578 -Node: Glossary959616 -Node: Copying984592 -Node: GNU Free Documentation License1022149 -Node: Index1047286 +Ref: table-getline-variants233831 +Node: Read Timeout234687 +Ref: Read Timeout-Footnote-1238432 +Node: Command line directories238489 +Node: Printing239119 +Node: Print240750 +Node: Print Examples242087 +Node: Output Separators244871 +Node: OFMT246631 +Node: Printf247989 +Node: Basic Printf248895 +Node: Control Letters250434 +Node: Format Modifiers254246 +Node: Printf Examples260255 +Node: Redirection262970 +Node: Special Files269954 +Node: Special FD270487 +Ref: Special FD-Footnote-1274112 +Node: Special Network274186 +Node: Special Caveats275036 +Node: Close Files And Pipes275832 +Ref: Close Files And Pipes-Footnote-1282855 +Ref: Close Files And Pipes-Footnote-2283003 +Node: Expressions283153 +Node: Values284285 +Node: Constants284961 +Node: Scalar Constants285641 +Ref: Scalar Constants-Footnote-1286500 +Node: Nondecimal-numbers286682 +Node: Regexp Constants289741 +Node: Using Constant Regexps290216 +Node: Variables293271 +Node: Using Variables293926 +Node: Assignment Options295650 +Node: Conversion297522 +Ref: table-locale-affects302898 +Ref: Conversion-Footnote-1303522 +Node: All Operators303631 +Node: Arithmetic Ops304261 +Node: Concatenation306766 +Ref: Concatenation-Footnote-1309559 +Node: Assignment Ops309679 +Ref: table-assign-ops314667 +Node: Increment Ops316075 +Node: Truth Values and Conditions319545 +Node: Truth Values320628 +Node: Typing and Comparison321677 +Node: Variable Typing322466 +Ref: Variable Typing-Footnote-1326363 +Node: Comparison Operators326485 +Ref: table-relational-ops326895 +Node: POSIX String Comparison330444 +Ref: POSIX String Comparison-Footnote-1331400 +Node: Boolean Ops331538 +Ref: Boolean Ops-Footnote-1335616 +Node: Conditional Exp335707 +Node: Function Calls337439 +Node: Precedence341033 +Node: Locales344702 +Node: Patterns and Actions345791 +Node: Pattern Overview346845 +Node: Regexp Patterns348514 +Node: Expression Patterns349057 +Node: Ranges352742 +Node: BEGIN/END355708 +Node: Using BEGIN/END356470 +Ref: Using BEGIN/END-Footnote-1359201 +Node: I/O And BEGIN/END359307 +Node: BEGINFILE/ENDFILE361589 +Node: Empty364482 +Node: Using Shell Variables364798 +Node: Action Overview367083 +Node: Statements369440 +Node: If Statement371294 +Node: While Statement372793 +Node: Do Statement374837 +Node: For Statement375993 +Node: Switch Statement379145 +Node: Break Statement381242 +Node: Continue Statement383232 +Node: Next Statement385025 +Node: Nextfile Statement387415 +Node: Exit Statement389960 +Node: Built-in Variables392376 +Node: User-modified393471 +Ref: User-modified-Footnote-1401826 +Node: Auto-set401888 +Ref: Auto-set-Footnote-1411796 +Node: ARGC and ARGV412001 +Node: Arrays415852 +Node: Array Basics417357 +Node: Array Intro418183 +Node: Reference to Elements422501 +Node: Assigning Elements424771 +Node: Array Example425262 +Node: Scanning an Array426994 +Node: Controlling Scanning429308 +Ref: Controlling Scanning-Footnote-1434241 +Node: Delete434557 +Ref: Delete-Footnote-1436992 +Node: Numeric Array Subscripts437049 +Node: Uninitialized Subscripts439232 +Node: Multi-dimensional440860 +Node: Multi-scanning443954 +Node: Arrays of Arrays445545 +Node: Functions450190 +Node: Built-in451012 +Node: Calling Built-in452090 +Node: Numeric Functions454078 +Ref: Numeric Functions-Footnote-1457910 +Ref: Numeric Functions-Footnote-2458267 +Ref: Numeric Functions-Footnote-3458315 +Node: String Functions458584 +Ref: String Functions-Footnote-1482081 +Ref: String Functions-Footnote-2482210 +Ref: String Functions-Footnote-3482458 +Node: Gory Details482545 +Ref: table-sub-escapes484224 +Ref: table-sub-posix-92485578 +Ref: table-sub-proposed486921 +Ref: table-posix-sub488271 +Ref: table-gensub-escapes489817 +Ref: Gory Details-Footnote-1491024 +Ref: Gory Details-Footnote-2491075 +Node: I/O Functions491226 +Ref: I/O Functions-Footnote-1497881 +Node: Time Functions498028 +Ref: Time Functions-Footnote-1508920 +Ref: Time Functions-Footnote-2508988 +Ref: Time Functions-Footnote-3509146 +Ref: Time Functions-Footnote-4509257 +Ref: Time Functions-Footnote-5509369 +Ref: Time Functions-Footnote-6509596 +Node: Bitwise Functions509862 +Ref: table-bitwise-ops510420 +Ref: Bitwise Functions-Footnote-1514641 +Node: Type Functions514825 +Node: I18N Functions515295 +Node: User-defined516922 +Node: Definition Syntax517726 +Ref: Definition Syntax-Footnote-1522636 +Node: Function Example522705 +Node: Function Caveats525299 +Node: Calling A Function525720 +Node: Variable Scope526835 +Node: Pass By Value/Reference528810 +Node: Return Statement532250 +Node: Dynamic Typing535231 +Node: Indirect Calls535966 +Node: Internationalization545651 +Node: I18N and L10N547090 +Node: Explaining gettext547776 +Ref: Explaining gettext-Footnote-1552842 +Ref: Explaining gettext-Footnote-2553026 +Node: Programmer i18n553191 +Node: Translator i18n557391 +Node: String Extraction558184 +Ref: String Extraction-Footnote-1559145 +Node: Printf Ordering559231 +Ref: Printf Ordering-Footnote-1562015 +Node: I18N Portability562079 +Ref: I18N Portability-Footnote-1564528 +Node: I18N Example564591 +Ref: I18N Example-Footnote-1567226 +Node: Gawk I18N567298 +Node: Arbitrary Precision Arithmetic567915 +Ref: Arbitrary Precision Arithmetic-Footnote-1570790 +Node: Floating-point Programming570938 +Node: Floating-point Representation576208 +Node: Floating-point Context577312 +Ref: table-ieee-formats578147 +Node: Rounding Mode579517 +Ref: table-rounding-modes580144 +Ref: Rounding Mode-Footnote-1583267 +Node: Arbitrary Precision Floats583448 +Ref: Arbitrary Precision Floats-Footnote-1585489 +Node: Setting Precision585800 +Node: Setting Rounding Mode588558 +Node: Floating-point Constants589475 +Node: Changing Precision590894 +Ref: Changing Precision-Footnote-1592294 +Node: Exact Arithmetic592467 +Node: Integer Programming595480 +Node: Arbitrary Precision Integers597260 +Ref: Arbitrary Precision Integers-Footnote-1600284 +Node: MPFR and GMP Libraries600430 +Node: Advanced Features600815 +Node: Nondecimal Data602338 +Node: Array Sorting603921 +Node: Controlling Array Traversal604618 +Node: Array Sorting Functions612855 +Ref: Array Sorting Functions-Footnote-1616529 +Ref: Array Sorting Functions-Footnote-2616622 +Node: Two-way I/O616816 +Ref: Two-way I/O-Footnote-1622248 +Node: TCP/IP Networking622318 +Node: Profiling625162 +Node: Library Functions632616 +Ref: Library Functions-Footnote-1635623 +Node: Library Names635794 +Ref: Library Names-Footnote-1639265 +Ref: Library Names-Footnote-2639485 +Node: General Functions639571 +Node: Strtonum Function640524 +Node: Assert Function643454 +Node: Round Function646780 +Node: Cliff Random Function648323 +Node: Ordinal Functions649339 +Ref: Ordinal Functions-Footnote-1652409 +Ref: Ordinal Functions-Footnote-2652661 +Node: Join Function652870 +Ref: Join Function-Footnote-1654641 +Node: Getlocaltime Function654841 +Node: Data File Management658556 +Node: Filetrans Function659188 +Node: Rewind Function663327 +Node: File Checking664714 +Node: Empty Files665808 +Node: Ignoring Assigns668038 +Node: Getopt Function669591 +Ref: Getopt Function-Footnote-1680895 +Node: Passwd Functions681098 +Ref: Passwd Functions-Footnote-1690073 +Node: Group Functions690161 +Node: Walking Arrays698245 +Node: Sample Programs699814 +Node: Running Examples700479 +Node: Clones701207 +Node: Cut Program702431 +Node: Egrep Program712276 +Ref: Egrep Program-Footnote-1720049 +Node: Id Program720159 +Node: Split Program723775 +Ref: Split Program-Footnote-1727294 +Node: Tee Program727422 +Node: Uniq Program730225 +Node: Wc Program737654 +Ref: Wc Program-Footnote-1741920 +Ref: Wc Program-Footnote-2742120 +Node: Miscellaneous Programs742212 +Node: Dupword Program743400 +Node: Alarm Program745431 +Node: Translate Program750180 +Ref: Translate Program-Footnote-1754567 +Ref: Translate Program-Footnote-2754795 +Node: Labels Program754929 +Ref: Labels Program-Footnote-1758300 +Node: Word Sorting758384 +Node: History Sorting762268 +Node: Extract Program764107 +Ref: Extract Program-Footnote-1771590 +Node: Simple Sed771718 +Node: Igawk Program774780 +Ref: Igawk Program-Footnote-1789937 +Ref: Igawk Program-Footnote-2790138 +Node: Anagram Program790276 +Node: Signature Program793344 +Node: Debugger794444 +Node: Debugging795396 +Node: Debugging Concepts795829 +Node: Debugging Terms797685 +Node: Awk Debugging800282 +Node: Sample Debugging Session801174 +Node: Debugger Invocation801694 +Node: Finding The Bug803023 +Node: List of Debugger Commands809511 +Node: Breakpoint Control810845 +Node: Debugger Execution Control814509 +Node: Viewing And Changing Data817869 +Node: Execution Stack821225 +Node: Debugger Info822692 +Node: Miscellaneous Debugger Commands826673 +Node: Readline Support832118 +Node: Limitations832949 +Node: Language History835201 +Node: V7/SVR3.1836713 +Node: SVR4839034 +Node: POSIX840476 +Node: BTL841484 +Node: POSIX/GNU842218 +Node: Common Extensions847509 +Node: Ranges and Locales848616 +Ref: Ranges and Locales-Footnote-1853220 +Node: Contributors853441 +Node: Installation857702 +Node: Gawk Distribution858596 +Node: Getting859080 +Node: Extracting859906 +Node: Distribution contents861598 +Node: Unix Installation866820 +Node: Quick Installation867437 +Node: Additional Configuration Options869399 +Node: Configuration Philosophy870876 +Node: Non-Unix Installation873218 +Node: PC Installation873676 +Node: PC Binary Installation874975 +Node: PC Compiling876823 +Node: PC Testing879767 +Node: PC Using880943 +Node: Cygwin885128 +Node: MSYS886128 +Node: VMS Installation886642 +Node: VMS Compilation887245 +Ref: VMS Compilation-Footnote-1888252 +Node: VMS Installation Details888310 +Node: VMS Running889945 +Node: VMS Old Gawk891552 +Node: Bugs892026 +Node: Other Versions895878 +Node: Notes901193 +Node: Compatibility Mode901885 +Node: Additions902668 +Node: Accessing The Source903480 +Node: Adding Code904905 +Node: New Ports910872 +Node: Dynamic Extensions914985 +Node: Internals916425 +Node: Plugin License925247 +Node: Loading Extensions925885 +Node: Sample Library927726 +Node: Internal File Description928416 +Node: Internal File Ops932131 +Ref: Internal File Ops-Footnote-1936696 +Node: Using Internal File Ops936836 +Node: Future Extensions939214 +Node: Basic Concepts941718 +Node: Basic High Level942475 +Ref: Basic High Level-Footnote-1946510 +Node: Basic Data Typing946695 +Node: Floating Point Issues951220 +Node: String Conversion Precision952303 +Ref: String Conversion Precision-Footnote-1954003 +Node: Unexpected Results954112 +Node: POSIX Floating Point Problems955938 +Ref: POSIX Floating Point Problems-Footnote-1959643 +Node: Glossary959681 +Node: Copying984657 +Node: GNU Free Documentation License1022214 +Node: Index1047351 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 940dc783..12b77556 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -7323,6 +7323,7 @@ can cause @code{FILENAME} to be updated if they cause summarizes the eight variants of @code{getline}, listing which built-in variables are set by each one, and whether the variant is standard or a @command{gawk} extension. +Note: for each variant, @command{gawk} sets the @code{RT} built-in variable. @float Table,table-getline-variants @caption{getline Variants and What They Set} diff --git a/extension/ChangeLog b/extension/ChangeLog index 31a070d8..c3bbc8ea 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,7 @@ +2012-07-29 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * readdir.c (dir_get_record): Adjust to new interface for RT. + 2012-07-29 Arnold D. Robbins <arnold@skeeve.com> * readdir.c (dir_take_control_of): Print error message and diff --git a/extension/readdir.c b/extension/readdir.c index 99073a2d..bba07ef4 100644 --- a/extension/readdir.c +++ b/extension/readdir.c @@ -120,13 +120,13 @@ typedef struct open_directory { /* dir_get_record --- get one record at a time out of a directory */ static int -dir_get_record(char **out, struct iobuf_public *iobuf, int *errcode) +dir_get_record(char **out, struct iobuf_public *iobuf, int *errcode, + char **rt_start, size_t *rt_len) { DIR *dp; struct dirent *dirent; size_t len; open_directory_t *the_dir; - static const awk_value_t null_val = { AWK_UNDEFINED, { { 0, 0 } } }; /* * The caller sets *errcode to 0, so we should set it only if an @@ -136,7 +136,6 @@ dir_get_record(char **out, struct iobuf_public *iobuf, int *errcode) if (out == NULL || iobuf == NULL || iobuf->opaque == NULL) return EOF; - set_RT((awk_value_t *) & null_val); the_dir = (open_directory_t *) iobuf->opaque; dp = the_dir->dp; /* @@ -159,6 +158,7 @@ dir_get_record(char **out, struct iobuf_public *iobuf, int *errcode) *out = the_dir->buf; len = strlen(the_dir->buf); + *rt_len = 0; /* set RT to "" */ return len; } @@ -228,34 +228,6 @@ api_register_input_parser(awk_ext_id_t id, awk_input_parser_t *input_parser) register_input_parser(input_parser); } -/* api_set_RT --- set RT's value */ - -static void -api_set_RT(awk_ext_id_t id, awk_value_t *value) -{ - NODE *n; - - (void) id; - - if (value == NULL) - return; - - switch (value->val_type) { - case AWK_UNDEFINED: - set_RT_to_null(); - break; - case AWK_ARRAY: - case AWK_VALUE_COOKIE: - break; - case AWK_STRING: - case AWK_NUMBER: - case AWK_SCALAR: - n = awk_value_to_node(value); - force_string(n); - set_RT(n); /* set_RT takes ownership of n */ - } -} - /* Functions to update ERRNO */ /* api_update_ERRNO_int --- update ERRNO with an integer value */ @@ -988,7 +960,6 @@ gawk_api_t api_impl = { api_lintwarn, api_register_input_parser, - api_set_RT, api_update_ERRNO_int, api_update_ERRNO_string, @@ -94,9 +94,14 @@ typedef struct iobuf_public { * the right thing). It is guaranteed that errcode is a valid * pointer, so there is no need to test for a NULL value. The * caller sets *errcode to 0, so there is no need to set it unless - * an error occurs. + * an error occurs. The rt_start and rt_len arguments should be + * used to return RT to gawk. Gawk will make its own copy of RT, + * so the parser is responsible for managing this memory. If EOF is + * not returned, the parser must set *rt_len (and *rt_start if *rt_len + * is non-zero). */ - int (*get_record)(char **out, struct iobuf_public *, int *errcode); + int (*get_record)(char **out, struct iobuf_public *, int *errcode, + char **rt_start, size_t *rt_len); /* * The close_func is called to allow the parser to free private data. * Gawk itself will close the fd unless close_func sets it to -1. @@ -324,9 +329,6 @@ typedef struct gawk_api { /* Register an input parser; for opening files read-only */ void (*api_register_input_parser)(awk_ext_id_t id, awk_input_parser_t *input_parser); - /* Set RT - pass AWK_UNDEFINED to set to null string */ - void (*api_set_RT)(awk_ext_id_t id, awk_value_t *value); - /* Functions to update ERRNO */ void (*api_update_ERRNO_int)(awk_ext_id_t id, int errno_val); void (*api_update_ERRNO_string)(awk_ext_id_t id, const char *string); @@ -507,7 +509,6 @@ typedef struct gawk_api { #define lintwarn api->api_lintwarn #define register_input_parser(parser) (api->api_register_input_parser(ext_id, parser)) -#define set_RT(value) (api->api_set_RT(ext_id, value)) #define update_ERRNO_int(e) (api->api_update_ERRNO_int(ext_id, e)) #define update_ERRNO_string(str) \ @@ -2700,34 +2700,6 @@ iop_alloc(int fd, const char *name) return iop; } -/* set_RT_to_null --- real function for use by extension API */ - -void -set_RT_to_null() -{ - if (! do_traditional) { - unref(RT_node->var_value); - RT_node->var_value = dupnode(Nnull_string); - } -} - -/* set_RT --- real function **** for use by extension API **** */ - -void -set_RT(NODE *n) -{ - if (do_traditional) - unref(n); - else if (RT_node->var_value == n) - assert(n == Nnull_string); /* do nothing */ - else { - unref(RT_node->var_value); - RT_node->var_value = n; - } -} - -/* macros for speed in default implementation */ - #define set_RT_to_null() \ (void)(! do_traditional && (unref(RT_node->var_value), \ RT_node->var_value = dupnode(Nnull_string))) @@ -3097,7 +3069,11 @@ find_longest_terminator: return REC_OK; } -/* get_a_record --- read a record from IOP into out, return length of EOF, set RT. Note that errcode is never NULL, and the caller initializes *errcode to 0. */ +/* + * get_a_record --- read a record from IOP into out, + * return length of EOF, set RT. + * Note that errcode is never NULL, and the caller initializes *errcode to 0. + */ static int get_a_record(char **out, /* pointer to pointer to data */ @@ -3118,9 +3094,26 @@ get_a_record(char **out, /* pointer to pointer to data */ read_timeout = get_read_timeout(iop); if (iop->public.get_record != NULL) { - int rc = iop->public.get_record(out, &iop->public, errcode); + char *rt_start; + size_t rt_len; + int rc = iop->public.get_record(out, &iop->public, errcode, + &rt_start, &rt_len); if (rc == EOF) iop->flag |= IOP_AT_EOF; + else if (! do_traditional) { + /* + * all known extension parsers set RT to "", so probably + * not worth optimizing the other case + */ + if (rt_len != 0) { + /* should we optimize this? */ + unref(RT_node->var_value); + RT_node->var_value = make_string(rt_start, rt_len); + } else if (RT_node->var_value != Nnull_string) { + unref(RT_node->var_value); + RT_node->var_value = dupnode(Nnull_string); + } + } return rc; } |