diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/ChangeLog | 5 | ||||
-rw-r--r-- | doc/awkcard.in | 7 | ||||
-rw-r--r-- | doc/gawk.info | 878 | ||||
-rw-r--r-- | doc/gawk.texi | 21 | ||||
-rw-r--r-- | doc/texinfo.tex | 1161 |
5 files changed, 1319 insertions, 753 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index 2bbb982d..bbd5cbd0 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -18,6 +18,11 @@ * gawk.1: Same. * awkcard.in: Same. +2012-02-10 Arnold D. Robbins <arnold@skeeve.com> + + * gawk.texi, awkcard.in: Bump patch level. + * texinfo.tex: Updated from Texinfo CVS. + 2011-12-06 Arnold D. Robbins <arnold@skeeve.com> * gawk.texi: Various typo fixes from mailing list. diff --git a/doc/awkcard.in b/doc/awkcard.in index c8d41833..adc506c3 100644 --- a/doc/awkcard.in +++ b/doc/awkcard.in @@ -1,7 +1,8 @@ .\" AWK Reference Card --- Arnold Robbins, arnold@skeeve.com .\" .\" Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, -.\" 2003, 2004, 2005, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. +.\" 2003, 2004, 2005, 2007, 2009, 2010, 2011, 2012 +.\" Free Software Foundation, Inc. .\" .\" Permission is granted to make and distribute verbatim copies of .\" this reference card provided the copyright notice and this permission @@ -100,7 +101,7 @@ Brian Kernighan and Michael Brennan who reviewed it. .SL .nf \*(FRCopyright \(co 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -2005, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. +2005, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. .nf .BT @@ -1914,7 +1915,7 @@ to use the current domain.\*(CB .ES .nf \*(CDHost: \*(FCftp.gnu.org\*(FR -File: \*(FC/gnu/gawk/gawk-4.0.0.tar.gz\fP +File: \*(FC/gnu/gawk/gawk-4.0.1.tar.gz\fP .in +.2i .fi GNU \*(AK (\*(GK). There may be a later version. diff --git a/doc/gawk.info b/doc/gawk.info index 6647e1e3..ca6b661f 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -10,8 +10,8 @@ START-INFO-DIR-ENTRY END-INFO-DIR-ENTRY Copyright (C) 1989, 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010, 2011 Free Software -Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010, 2011, 2012 Free +Software Foundation, Inc. This is Edition 4 of `GAWK: Effective AWK Programming: A User's @@ -42,8 +42,8 @@ This file documents `awk', a program that you can use to select particular records in a file and perform operations upon them. Copyright (C) 1989, 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010, 2011 Free Software -Foundation, Inc. +2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010, 2011, 2012 Free +Software Foundation, Inc. This is Edition 4 of `GAWK: Effective AWK Programming: A User's @@ -1395,7 +1395,8 @@ pass to that interpreter. The operating system then runs the interpreter with the given argument and the full argument list of the executed program. The first argument in the list is the full file name of the `awk' program. The rest of the argument list contains either -options to `awk', or data files, or both. +options to `awk', or data files, or both. Note that on many systems +`awk' may be found in `/usr/bin' instead of in `/bin'. Caveat Emptor. File: gawk.info, Node: Comments, Next: Quoting, Prev: Executable Scripts, Up: Running gawk @@ -3196,6 +3197,10 @@ sequences and that are not listed in the table stand for themselves: constants are valid and work the way you want them to, using any version of `awk'.(2) + Finally, when `{' and `}' appear in regexp constants in a way that + cannot be interpreted as an interval expression (such as + `/q{a}/'), then they stand for themselves. + In regular expressions, the `*', `+', and `?' operators, as well as the braces `{' and `}', have the highest precedence, followed by concatenation, and finally by `|'. As in arithmetic, parentheses can @@ -10672,7 +10677,8 @@ with numbers. Optional parameters are enclosed in square brackets ([ ]): `atan2(Y, X)' - Return the arctangent of `Y / X' in radians. + Return the arctangent of `Y / X' in radians. You can use `pi = + atan2(0, -1)' to retrieve the value of pi. `cos(X)' Return the cosine of X, with X in radians. @@ -25558,7 +25564,7 @@ Index * coprocesses, closing: Close Files And Pipes. (line 6) * coprocesses, getline from: Getline/Coprocess. (line 6) -* cos() function: Numeric Functions. (line 14) +* cos() function: Numeric Functions. (line 15) * counting: Wc Program. (line 6) * csh utility: Statements/Lines. (line 44) * csh utility, POSIXLY_CORRECT environment variable: Options. (line 323) @@ -25919,7 +25925,7 @@ Index * exclamation point (!), !~ operator: Regexp Usage. (line 19) * exit statement: Exit Statement. (line 6) * exit status, of gawk: Exit Status. (line 6) -* exp() function: Numeric Functions. (line 17) +* exp() function: Numeric Functions. (line 18) * expand utility: Very Simple. (line 69) * expressions: Expressions. (line 6) * expressions, as patterns: Expression Patterns. (line 6) @@ -26247,7 +26253,7 @@ Index (line 26) * gawk, regular expressions, operators: GNU Regexp Operators. (line 6) -* gawk, regular expressions, precedence: Regexp Operators. (line 157) +* gawk, regular expressions, precedence: Regexp Operators. (line 161) * gawk, RT variable in <1>: Auto-set. (line 196) * gawk, RT variable in <2>: Getline/Variable/File. (line 10) @@ -26423,7 +26429,7 @@ Index * installation, VMS: VMS Installation. (line 6) * installing gawk: Installation. (line 6) * INT signal (MS-Windows): Profiling. (line 206) -* int() function: Numeric Functions. (line 22) +* int() function: Numeric Functions. (line 23) * integers: Basic Data Typing. (line 21) * integers, unsigned: Basic Data Typing. (line 30) * interacting with other programs: I/O Functions. (line 63) @@ -26592,7 +26598,7 @@ Index * localization, See internationalization, localization: I18N and L10N. (line 6) * log files, timestamps in: Time Functions. (line 6) -* log() function: Numeric Functions. (line 29) +* log() function: Numeric Functions. (line 30) * logical false/true: Truth Values. (line 6) * logical operators, See Boolean expressions: Boolean Ops. (line 6) * login information: Passwd Functions. (line 16) @@ -26724,7 +26730,7 @@ Index * numbers, hexadecimal: Nondecimal-numbers. (line 6) * numbers, NODE internal type: Internals. (line 23) * numbers, octal: Nondecimal-numbers. (line 6) -* numbers, random: Numeric Functions. (line 63) +* numbers, random: Numeric Functions. (line 64) * numbers, rounding: Round Function. (line 6) * numeric, constants: Scalar Constants. (line 6) * numeric, output format: OFMT. (line 6) @@ -26926,7 +26932,7 @@ Index * POSIX awk, OFMT variable and: OFMT. (line 27) * POSIX awk, period (.), using: Regexp Operators. (line 50) * POSIX awk, printf format strings and: Format Modifiers. (line 159) -* POSIX awk, regular expressions and: Regexp Operators. (line 157) +* POSIX awk, regular expressions and: Regexp Operators. (line 161) * POSIX awk, timestamps and: Time Functions. (line 6) * POSIX awk, | I/O operator and: Getline/Pipe. (line 52) * POSIX mode: Options. (line 222) @@ -26936,7 +26942,7 @@ Index * POSIXLY_CORRECT environment variable: Options. (line 307) * precedence <1>: Precedence. (line 6) * precedence: Increment Ops. (line 61) -* precedence, regexp operators: Regexp Operators. (line 152) +* precedence, regexp operators: Regexp Operators. (line 156) * print debugger command: Viewing And Changing Data. (line 36) * print statement: Printing. (line 16) @@ -27027,12 +27033,12 @@ Index * r debugger command (alias for run): Debugger Execution Control. (line 62) * Rakitzis, Byron: History Sorting. (line 25) -* rand() function: Numeric Functions. (line 33) +* rand() function: Numeric Functions. (line 34) * random numbers, Cliff: Cliff Random Function. (line 6) * random numbers, rand()/srand() functions: Numeric Functions. - (line 33) -* random numbers, seed of: Numeric Functions. (line 63) + (line 34) +* random numbers, seed of: Numeric Functions. (line 64) * range expressions (regexps): Bracket Expressions. (line 6) * range patterns: Ranges. (line 6) * Rankin, Pat <1>: Bugs. (line 72) @@ -27102,7 +27108,7 @@ Index * regular expressions, operators, gawk: GNU Regexp Operators. (line 6) * regular expressions, operators, precedence of: Regexp Operators. - (line 152) + (line 156) * regular expressions, searching for: Egrep Program. (line 6) * relational operators, See comparison operators: Typing and Comparison. (line 9) @@ -27235,7 +27241,7 @@ Index * SIGUSR1 signal: Profiling. (line 180) * silent debugger command: Debugger Execution Control. (line 10) -* sin() function: Numeric Functions. (line 74) +* sin() function: Numeric Functions. (line 75) * single precision floating-point: Basic Data Typing. (line 36) * single quote (') <1>: Quoting. (line 31) * single quote (') <2>: Long. (line 33) @@ -27278,9 +27284,9 @@ Index * sprintf() function, OFMT variable and: User-modified. (line 124) * sprintf() function, print/printf statements and: Round Function. (line 6) -* sqrt() function: Numeric Functions. (line 77) +* sqrt() function: Numeric Functions. (line 78) * square brackets ([]): Regexp Operators. (line 55) -* srand() function: Numeric Functions. (line 81) +* srand() function: Numeric Functions. (line 82) * Stallman, Richard <1>: Glossary. (line 301) * Stallman, Richard <2>: Contributors. (line 24) * Stallman, Richard <3>: Acknowledgments. (line 18) @@ -27600,420 +27606,420 @@ Index Tag Table: -Node: Top1346 -Node: Foreword30411 -Node: Preface34756 -Ref: Preface-Footnote-137809 -Ref: Preface-Footnote-237915 -Node: History38147 -Node: Names40538 -Ref: Names-Footnote-142015 -Node: This Manual42087 -Ref: This Manual-Footnote-147025 -Node: Conventions47125 -Node: Manual History49259 -Ref: Manual History-Footnote-152529 -Ref: Manual History-Footnote-252570 -Node: How To Contribute52644 -Node: Acknowledgments53788 -Node: Getting Started58119 -Node: Running gawk60498 -Node: One-shot61684 -Node: Read Terminal62909 -Ref: Read Terminal-Footnote-164559 -Ref: Read Terminal-Footnote-264835 -Node: Long65006 -Node: Executable Scripts66382 -Ref: Executable Scripts-Footnote-168251 -Ref: Executable Scripts-Footnote-268353 -Node: Comments68804 -Node: Quoting71271 -Node: DOS Quoting75894 -Node: Sample Data Files76569 -Node: Very Simple79601 -Node: Two Rules84200 -Node: More Complex86347 -Ref: More Complex-Footnote-189277 -Node: Statements/Lines89362 -Ref: Statements/Lines-Footnote-193824 -Node: Other Features94089 -Node: When95017 -Node: Invoking Gawk97164 -Node: Command Line98549 -Node: Options99332 -Ref: Options-Footnote-1113477 -Node: Other Arguments113502 -Node: Naming Standard Input116160 -Node: Environment Variables117254 -Node: AWKPATH Variable117698 -Ref: AWKPATH Variable-Footnote-1120295 -Node: Other Environment Variables120555 -Node: Exit Status123047 -Node: Include Files123722 -Node: Obsolete127207 -Node: Undocumented127893 -Node: Regexp128134 -Node: Regexp Usage129523 -Node: Escape Sequences131549 -Node: Regexp Operators137312 -Ref: Regexp Operators-Footnote-1144509 -Ref: Regexp Operators-Footnote-2144656 -Node: Bracket Expressions144754 -Ref: table-char-classes146644 -Node: GNU Regexp Operators149167 -Node: Case-sensitivity152890 -Ref: Case-sensitivity-Footnote-1155858 -Ref: Case-sensitivity-Footnote-2156093 -Node: Leftmost Longest156201 -Node: Computed Regexps157402 -Node: Reading Files160812 -Node: Records162816 -Ref: Records-Footnote-1171490 -Node: Fields171527 -Ref: Fields-Footnote-1174560 -Node: Nonconstant Fields174646 -Node: Changing Fields176848 -Node: Field Separators182829 -Node: Default Field Splitting185458 -Node: Regexp Field Splitting186575 -Node: Single Character Fields189917 -Node: Command Line Field Separator190976 -Node: Field Splitting Summary194417 -Ref: Field Splitting Summary-Footnote-1197609 -Node: Constant Size197710 -Node: Splitting By Content202294 -Ref: Splitting By Content-Footnote-1206020 -Node: Multiple Line206060 -Ref: Multiple Line-Footnote-1211907 -Node: Getline212086 -Node: Plain Getline214302 -Node: Getline/Variable216391 -Node: Getline/File217532 -Node: Getline/Variable/File218854 -Ref: Getline/Variable/File-Footnote-1220453 -Node: Getline/Pipe220540 -Node: Getline/Variable/Pipe223100 -Node: Getline/Coprocess224207 -Node: Getline/Variable/Coprocess225450 -Node: Getline Notes226164 -Node: Getline Summary228106 -Ref: table-getline-variants228449 -Node: Read Timeout229305 -Ref: Read Timeout-Footnote-1233050 -Node: Command line directories233107 -Node: Printing233737 -Node: Print235368 -Node: Print Examples236705 -Node: Output Separators239489 -Node: OFMT241249 -Node: Printf242607 -Node: Basic Printf243513 -Node: Control Letters245052 -Node: Format Modifiers248864 -Node: Printf Examples254873 -Node: Redirection257588 -Node: Special Files264572 -Node: Special FD265105 -Ref: Special FD-Footnote-1268730 -Node: Special Network268804 -Node: Special Caveats269654 -Node: Close Files And Pipes270450 -Ref: Close Files And Pipes-Footnote-1277473 -Ref: Close Files And Pipes-Footnote-2277621 -Node: Expressions277771 -Node: Values278903 -Node: Constants279579 -Node: Scalar Constants280259 -Ref: Scalar Constants-Footnote-1281118 -Node: Nondecimal-numbers281300 -Node: Regexp Constants284359 -Node: Using Constant Regexps284834 -Node: Variables287889 -Node: Using Variables288544 -Node: Assignment Options290268 -Node: Conversion292140 -Ref: table-locale-affects297516 -Ref: Conversion-Footnote-1298140 -Node: All Operators298249 -Node: Arithmetic Ops298879 -Node: Concatenation301384 -Ref: Concatenation-Footnote-1304177 -Node: Assignment Ops304297 -Ref: table-assign-ops309285 -Node: Increment Ops310693 -Node: Truth Values and Conditions314163 -Node: Truth Values315246 -Node: Typing and Comparison316295 -Node: Variable Typing317084 -Ref: Variable Typing-Footnote-1320981 -Node: Comparison Operators321103 -Ref: table-relational-ops321513 -Node: POSIX String Comparison325062 -Ref: POSIX String Comparison-Footnote-1326018 -Node: Boolean Ops326156 -Ref: Boolean Ops-Footnote-1330234 -Node: Conditional Exp330325 -Node: Function Calls332057 -Node: Precedence335651 -Node: Locales339320 -Node: Patterns and Actions340409 -Node: Pattern Overview341463 -Node: Regexp Patterns343132 -Node: Expression Patterns343675 -Node: Ranges347360 -Node: BEGIN/END350326 -Node: Using BEGIN/END351088 -Ref: Using BEGIN/END-Footnote-1353819 -Node: I/O And BEGIN/END353925 -Node: BEGINFILE/ENDFILE356207 -Node: Empty359100 -Node: Using Shell Variables359416 -Node: Action Overview361701 -Node: Statements364058 -Node: If Statement365912 -Node: While Statement367411 -Node: Do Statement369455 -Node: For Statement370611 -Node: Switch Statement373763 -Node: Break Statement375860 -Node: Continue Statement377850 -Node: Next Statement379643 -Node: Nextfile Statement382033 -Node: Exit Statement384578 -Node: Built-in Variables386994 -Node: User-modified388089 -Ref: User-modified-Footnote-1396115 -Node: Auto-set396177 -Ref: Auto-set-Footnote-1405468 -Node: ARGC and ARGV405673 -Node: Arrays409524 -Node: Array Basics411029 -Node: Array Intro411855 -Node: Reference to Elements416173 -Node: Assigning Elements418443 -Node: Array Example418934 -Node: Scanning an Array420666 -Node: Controlling Scanning422980 -Ref: Controlling Scanning-Footnote-1427913 -Node: Delete428229 -Ref: Delete-Footnote-1430664 -Node: Numeric Array Subscripts430721 -Node: Uninitialized Subscripts432904 -Node: Multi-dimensional434532 -Node: Multi-scanning437626 -Node: Arrays of Arrays439217 -Node: Functions443862 -Node: Built-in444684 -Node: Calling Built-in445762 -Node: Numeric Functions447750 -Ref: Numeric Functions-Footnote-1451515 -Ref: Numeric Functions-Footnote-2451872 -Ref: Numeric Functions-Footnote-3451920 -Node: String Functions452189 -Ref: String Functions-Footnote-1475686 -Ref: String Functions-Footnote-2475815 -Ref: String Functions-Footnote-3476063 -Node: Gory Details476150 -Ref: table-sub-escapes477829 -Ref: table-sub-posix-92479183 -Ref: table-sub-proposed480526 -Ref: table-posix-sub481876 -Ref: table-gensub-escapes483422 -Ref: Gory Details-Footnote-1484629 -Ref: Gory Details-Footnote-2484680 -Node: I/O Functions484831 -Ref: I/O Functions-Footnote-1491486 -Node: Time Functions491633 -Ref: Time Functions-Footnote-1502525 -Ref: Time Functions-Footnote-2502593 -Ref: Time Functions-Footnote-3502751 -Ref: Time Functions-Footnote-4502862 -Ref: Time Functions-Footnote-5502974 -Ref: Time Functions-Footnote-6503201 -Node: Bitwise Functions503467 -Ref: table-bitwise-ops504025 -Ref: Bitwise Functions-Footnote-1508185 -Node: Type Functions508369 -Node: I18N Functions508839 -Node: User-defined510466 -Node: Definition Syntax511270 -Ref: Definition Syntax-Footnote-1516180 -Node: Function Example516249 -Node: Function Caveats518843 -Node: Calling A Function519264 -Node: Variable Scope520379 -Node: Pass By Value/Reference522354 -Node: Return Statement525794 -Node: Dynamic Typing528775 -Node: Indirect Calls529510 -Node: Internationalization539195 -Node: I18N and L10N540621 -Node: Explaining gettext541307 -Ref: Explaining gettext-Footnote-1546373 -Ref: Explaining gettext-Footnote-2546557 -Node: Programmer i18n546722 -Node: Translator i18n550922 -Node: String Extraction551715 -Ref: String Extraction-Footnote-1552676 -Node: Printf Ordering552762 -Ref: Printf Ordering-Footnote-1555546 -Node: I18N Portability555610 -Ref: I18N Portability-Footnote-1558059 -Node: I18N Example558122 -Ref: I18N Example-Footnote-1560757 -Node: Gawk I18N560829 -Node: Advanced Features561446 -Node: Nondecimal Data562959 -Node: Array Sorting564542 -Node: Controlling Array Traversal565239 -Node: Array Sorting Functions573476 -Ref: Array Sorting Functions-Footnote-1577150 -Ref: Array Sorting Functions-Footnote-2577243 -Node: Two-way I/O577437 -Ref: Two-way I/O-Footnote-1582869 -Node: TCP/IP Networking582939 -Node: Profiling585783 -Node: Library Functions593237 -Ref: Library Functions-Footnote-1596244 -Node: Library Names596415 -Ref: Library Names-Footnote-1599886 -Ref: Library Names-Footnote-2600106 -Node: General Functions600192 -Node: Strtonum Function601145 -Node: Assert Function604075 -Node: Round Function607401 -Node: Cliff Random Function608944 -Node: Ordinal Functions609960 -Ref: Ordinal Functions-Footnote-1613030 -Ref: Ordinal Functions-Footnote-2613282 -Node: Join Function613491 -Ref: Join Function-Footnote-1615262 -Node: Gettimeofday Function615462 -Node: Data File Management619177 -Node: Filetrans Function619809 -Node: Rewind Function623948 -Node: File Checking625335 -Node: Empty Files626429 -Node: Ignoring Assigns628659 -Node: Getopt Function630212 -Ref: Getopt Function-Footnote-1641516 -Node: Passwd Functions641719 -Ref: Passwd Functions-Footnote-1650694 -Node: Group Functions650782 -Node: Walking Arrays658866 -Node: Sample Programs660435 -Node: Running Examples661100 -Node: Clones661828 -Node: Cut Program663052 -Node: Egrep Program672897 -Ref: Egrep Program-Footnote-1680670 -Node: Id Program680780 -Node: Split Program684396 -Ref: Split Program-Footnote-1687915 -Node: Tee Program688043 -Node: Uniq Program690846 -Node: Wc Program698275 -Ref: Wc Program-Footnote-1702541 -Ref: Wc Program-Footnote-2702741 -Node: Miscellaneous Programs702833 -Node: Dupword Program704021 -Node: Alarm Program706052 -Node: Translate Program710801 -Ref: Translate Program-Footnote-1715188 -Ref: Translate Program-Footnote-2715416 -Node: Labels Program715550 -Ref: Labels Program-Footnote-1718921 -Node: Word Sorting719005 -Node: History Sorting722889 -Node: Extract Program724728 -Ref: Extract Program-Footnote-1732211 -Node: Simple Sed732339 -Node: Igawk Program735401 -Ref: Igawk Program-Footnote-1750558 -Ref: Igawk Program-Footnote-2750759 -Node: Anagram Program750897 -Node: Signature Program753965 -Node: Debugger755065 -Node: Debugging756017 -Node: Debugging Concepts756450 -Node: Debugging Terms758306 -Node: Awk Debugging760903 -Node: Sample Debugging Session761795 -Node: Debugger Invocation762315 -Node: Finding The Bug763644 -Node: List of Debugger Commands770132 -Node: Breakpoint Control771466 -Node: Debugger Execution Control775130 -Node: Viewing And Changing Data778490 -Node: Execution Stack781846 -Node: Debugger Info783313 -Node: Miscellaneous Debugger Commands787294 -Node: Readline Support792739 -Node: Limitations793570 -Node: Language History795822 -Node: V7/SVR3.1797334 -Node: SVR4799655 -Node: POSIX801097 -Node: BTL802105 -Node: POSIX/GNU802839 -Node: Common Extensions807990 -Node: Ranges and Locales809097 -Ref: Ranges and Locales-Footnote-1813701 -Node: Contributors813922 -Node: Installation818183 -Node: Gawk Distribution819077 -Node: Getting819561 -Node: Extracting820387 -Node: Distribution contents822079 -Node: Unix Installation827301 -Node: Quick Installation827918 -Node: Additional Configuration Options829880 -Node: Configuration Philosophy831357 -Node: Non-Unix Installation833699 -Node: PC Installation834157 -Node: PC Binary Installation835456 -Node: PC Compiling837304 -Node: PC Testing840248 -Node: PC Using841424 -Node: Cygwin845609 -Node: MSYS846609 -Node: VMS Installation847123 -Node: VMS Compilation847726 -Ref: VMS Compilation-Footnote-1848733 -Node: VMS Installation Details848791 -Node: VMS Running850426 -Node: VMS Old Gawk852033 -Node: Bugs852507 -Node: Other Versions856359 -Node: Notes861674 -Node: Compatibility Mode862366 -Node: Additions863149 -Node: Accessing The Source863961 -Node: Adding Code865386 -Node: New Ports871353 -Node: Dynamic Extensions875466 -Node: Internals876906 -Node: Plugin License885425 -Node: Loading Extensions886063 -Node: Sample Library887873 -Node: Internal File Description888563 -Node: Internal File Ops892278 -Ref: Internal File Ops-Footnote-1897002 -Node: Using Internal File Ops897142 -Node: Future Extensions899519 -Node: Basic Concepts902023 -Node: Basic High Level902780 -Ref: Basic High Level-Footnote-1906815 -Node: Basic Data Typing907000 -Node: Floating Point Issues911525 -Node: String Conversion Precision912608 -Ref: String Conversion Precision-Footnote-1914308 -Node: Unexpected Results914417 -Node: POSIX Floating Point Problems916243 -Ref: POSIX Floating Point Problems-Footnote-1919948 -Node: Glossary919986 -Node: Copying944962 -Node: GNU Free Documentation License982519 -Node: Index1007656 +Node: Top1352 +Node: Foreword30423 +Node: Preface34768 +Ref: Preface-Footnote-137821 +Ref: Preface-Footnote-237927 +Node: History38159 +Node: Names40550 +Ref: Names-Footnote-142027 +Node: This Manual42099 +Ref: This Manual-Footnote-147037 +Node: Conventions47137 +Node: Manual History49271 +Ref: Manual History-Footnote-152541 +Ref: Manual History-Footnote-252582 +Node: How To Contribute52656 +Node: Acknowledgments53800 +Node: Getting Started58131 +Node: Running gawk60510 +Node: One-shot61696 +Node: Read Terminal62921 +Ref: Read Terminal-Footnote-164571 +Ref: Read Terminal-Footnote-264847 +Node: Long65018 +Node: Executable Scripts66394 +Ref: Executable Scripts-Footnote-168263 +Ref: Executable Scripts-Footnote-268365 +Node: Comments68912 +Node: Quoting71379 +Node: DOS Quoting76002 +Node: Sample Data Files76677 +Node: Very Simple79709 +Node: Two Rules84308 +Node: More Complex86455 +Ref: More Complex-Footnote-189385 +Node: Statements/Lines89470 +Ref: Statements/Lines-Footnote-193932 +Node: Other Features94197 +Node: When95125 +Node: Invoking Gawk97272 +Node: Command Line98657 +Node: Options99440 +Ref: Options-Footnote-1113585 +Node: Other Arguments113610 +Node: Naming Standard Input116268 +Node: Environment Variables117362 +Node: AWKPATH Variable117806 +Ref: AWKPATH Variable-Footnote-1120403 +Node: Other Environment Variables120663 +Node: Exit Status123155 +Node: Include Files123830 +Node: Obsolete127315 +Node: Undocumented128001 +Node: Regexp128242 +Node: Regexp Usage129631 +Node: Escape Sequences131657 +Node: Regexp Operators137420 +Ref: Regexp Operators-Footnote-1144800 +Ref: Regexp Operators-Footnote-2144947 +Node: Bracket Expressions145045 +Ref: table-char-classes146935 +Node: GNU Regexp Operators149458 +Node: Case-sensitivity153181 +Ref: Case-sensitivity-Footnote-1156149 +Ref: Case-sensitivity-Footnote-2156384 +Node: Leftmost Longest156492 +Node: Computed Regexps157693 +Node: Reading Files161103 +Node: Records163107 +Ref: Records-Footnote-1171781 +Node: Fields171818 +Ref: Fields-Footnote-1174851 +Node: Nonconstant Fields174937 +Node: Changing Fields177139 +Node: Field Separators183120 +Node: Default Field Splitting185749 +Node: Regexp Field Splitting186866 +Node: Single Character Fields190208 +Node: Command Line Field Separator191267 +Node: Field Splitting Summary194708 +Ref: Field Splitting Summary-Footnote-1197900 +Node: Constant Size198001 +Node: Splitting By Content202585 +Ref: Splitting By Content-Footnote-1206311 +Node: Multiple Line206351 +Ref: Multiple Line-Footnote-1212198 +Node: Getline212377 +Node: Plain Getline214593 +Node: Getline/Variable216682 +Node: Getline/File217823 +Node: Getline/Variable/File219145 +Ref: Getline/Variable/File-Footnote-1220744 +Node: Getline/Pipe220831 +Node: Getline/Variable/Pipe223391 +Node: Getline/Coprocess224498 +Node: Getline/Variable/Coprocess225741 +Node: Getline Notes226455 +Node: Getline Summary228397 +Ref: table-getline-variants228740 +Node: Read Timeout229596 +Ref: Read Timeout-Footnote-1233341 +Node: Command line directories233398 +Node: Printing234028 +Node: Print235659 +Node: Print Examples236996 +Node: Output Separators239780 +Node: OFMT241540 +Node: Printf242898 +Node: Basic Printf243804 +Node: Control Letters245343 +Node: Format Modifiers249155 +Node: Printf Examples255164 +Node: Redirection257879 +Node: Special Files264863 +Node: Special FD265396 +Ref: Special FD-Footnote-1269021 +Node: Special Network269095 +Node: Special Caveats269945 +Node: Close Files And Pipes270741 +Ref: Close Files And Pipes-Footnote-1277764 +Ref: Close Files And Pipes-Footnote-2277912 +Node: Expressions278062 +Node: Values279194 +Node: Constants279870 +Node: Scalar Constants280550 +Ref: Scalar Constants-Footnote-1281409 +Node: Nondecimal-numbers281591 +Node: Regexp Constants284650 +Node: Using Constant Regexps285125 +Node: Variables288180 +Node: Using Variables288835 +Node: Assignment Options290559 +Node: Conversion292431 +Ref: table-locale-affects297807 +Ref: Conversion-Footnote-1298431 +Node: All Operators298540 +Node: Arithmetic Ops299170 +Node: Concatenation301675 +Ref: Concatenation-Footnote-1304468 +Node: Assignment Ops304588 +Ref: table-assign-ops309576 +Node: Increment Ops310984 +Node: Truth Values and Conditions314454 +Node: Truth Values315537 +Node: Typing and Comparison316586 +Node: Variable Typing317375 +Ref: Variable Typing-Footnote-1321272 +Node: Comparison Operators321394 +Ref: table-relational-ops321804 +Node: POSIX String Comparison325353 +Ref: POSIX String Comparison-Footnote-1326309 +Node: Boolean Ops326447 +Ref: Boolean Ops-Footnote-1330525 +Node: Conditional Exp330616 +Node: Function Calls332348 +Node: Precedence335942 +Node: Locales339611 +Node: Patterns and Actions340700 +Node: Pattern Overview341754 +Node: Regexp Patterns343423 +Node: Expression Patterns343966 +Node: Ranges347651 +Node: BEGIN/END350617 +Node: Using BEGIN/END351379 +Ref: Using BEGIN/END-Footnote-1354110 +Node: I/O And BEGIN/END354216 +Node: BEGINFILE/ENDFILE356498 +Node: Empty359391 +Node: Using Shell Variables359707 +Node: Action Overview361992 +Node: Statements364349 +Node: If Statement366203 +Node: While Statement367702 +Node: Do Statement369746 +Node: For Statement370902 +Node: Switch Statement374054 +Node: Break Statement376151 +Node: Continue Statement378141 +Node: Next Statement379934 +Node: Nextfile Statement382324 +Node: Exit Statement384869 +Node: Built-in Variables387285 +Node: User-modified388380 +Ref: User-modified-Footnote-1396406 +Node: Auto-set396468 +Ref: Auto-set-Footnote-1405759 +Node: ARGC and ARGV405964 +Node: Arrays409815 +Node: Array Basics411320 +Node: Array Intro412146 +Node: Reference to Elements416464 +Node: Assigning Elements418734 +Node: Array Example419225 +Node: Scanning an Array420957 +Node: Controlling Scanning423271 +Ref: Controlling Scanning-Footnote-1428204 +Node: Delete428520 +Ref: Delete-Footnote-1430955 +Node: Numeric Array Subscripts431012 +Node: Uninitialized Subscripts433195 +Node: Multi-dimensional434823 +Node: Multi-scanning437917 +Node: Arrays of Arrays439508 +Node: Functions444153 +Node: Built-in444975 +Node: Calling Built-in446053 +Node: Numeric Functions448041 +Ref: Numeric Functions-Footnote-1451873 +Ref: Numeric Functions-Footnote-2452230 +Ref: Numeric Functions-Footnote-3452278 +Node: String Functions452547 +Ref: String Functions-Footnote-1476044 +Ref: String Functions-Footnote-2476173 +Ref: String Functions-Footnote-3476421 +Node: Gory Details476508 +Ref: table-sub-escapes478187 +Ref: table-sub-posix-92479541 +Ref: table-sub-proposed480884 +Ref: table-posix-sub482234 +Ref: table-gensub-escapes483780 +Ref: Gory Details-Footnote-1484987 +Ref: Gory Details-Footnote-2485038 +Node: I/O Functions485189 +Ref: I/O Functions-Footnote-1491844 +Node: Time Functions491991 +Ref: Time Functions-Footnote-1502883 +Ref: Time Functions-Footnote-2502951 +Ref: Time Functions-Footnote-3503109 +Ref: Time Functions-Footnote-4503220 +Ref: Time Functions-Footnote-5503332 +Ref: Time Functions-Footnote-6503559 +Node: Bitwise Functions503825 +Ref: table-bitwise-ops504383 +Ref: Bitwise Functions-Footnote-1508543 +Node: Type Functions508727 +Node: I18N Functions509197 +Node: User-defined510824 +Node: Definition Syntax511628 +Ref: Definition Syntax-Footnote-1516538 +Node: Function Example516607 +Node: Function Caveats519201 +Node: Calling A Function519622 +Node: Variable Scope520737 +Node: Pass By Value/Reference522712 +Node: Return Statement526152 +Node: Dynamic Typing529133 +Node: Indirect Calls529868 +Node: Internationalization539553 +Node: I18N and L10N540979 +Node: Explaining gettext541665 +Ref: Explaining gettext-Footnote-1546731 +Ref: Explaining gettext-Footnote-2546915 +Node: Programmer i18n547080 +Node: Translator i18n551280 +Node: String Extraction552073 +Ref: String Extraction-Footnote-1553034 +Node: Printf Ordering553120 +Ref: Printf Ordering-Footnote-1555904 +Node: I18N Portability555968 +Ref: I18N Portability-Footnote-1558417 +Node: I18N Example558480 +Ref: I18N Example-Footnote-1561115 +Node: Gawk I18N561187 +Node: Advanced Features561804 +Node: Nondecimal Data563317 +Node: Array Sorting564900 +Node: Controlling Array Traversal565597 +Node: Array Sorting Functions573834 +Ref: Array Sorting Functions-Footnote-1577508 +Ref: Array Sorting Functions-Footnote-2577601 +Node: Two-way I/O577795 +Ref: Two-way I/O-Footnote-1583227 +Node: TCP/IP Networking583297 +Node: Profiling586141 +Node: Library Functions593595 +Ref: Library Functions-Footnote-1596602 +Node: Library Names596773 +Ref: Library Names-Footnote-1600244 +Ref: Library Names-Footnote-2600464 +Node: General Functions600550 +Node: Strtonum Function601503 +Node: Assert Function604433 +Node: Round Function607759 +Node: Cliff Random Function609302 +Node: Ordinal Functions610318 +Ref: Ordinal Functions-Footnote-1613388 +Ref: Ordinal Functions-Footnote-2613640 +Node: Join Function613849 +Ref: Join Function-Footnote-1615620 +Node: Gettimeofday Function615820 +Node: Data File Management619535 +Node: Filetrans Function620167 +Node: Rewind Function624306 +Node: File Checking625693 +Node: Empty Files626787 +Node: Ignoring Assigns629017 +Node: Getopt Function630570 +Ref: Getopt Function-Footnote-1641874 +Node: Passwd Functions642077 +Ref: Passwd Functions-Footnote-1651052 +Node: Group Functions651140 +Node: Walking Arrays659224 +Node: Sample Programs660793 +Node: Running Examples661458 +Node: Clones662186 +Node: Cut Program663410 +Node: Egrep Program673255 +Ref: Egrep Program-Footnote-1681028 +Node: Id Program681138 +Node: Split Program684754 +Ref: Split Program-Footnote-1688273 +Node: Tee Program688401 +Node: Uniq Program691204 +Node: Wc Program698633 +Ref: Wc Program-Footnote-1702899 +Ref: Wc Program-Footnote-2703099 +Node: Miscellaneous Programs703191 +Node: Dupword Program704379 +Node: Alarm Program706410 +Node: Translate Program711159 +Ref: Translate Program-Footnote-1715546 +Ref: Translate Program-Footnote-2715774 +Node: Labels Program715908 +Ref: Labels Program-Footnote-1719279 +Node: Word Sorting719363 +Node: History Sorting723247 +Node: Extract Program725086 +Ref: Extract Program-Footnote-1732569 +Node: Simple Sed732697 +Node: Igawk Program735759 +Ref: Igawk Program-Footnote-1750916 +Ref: Igawk Program-Footnote-2751117 +Node: Anagram Program751255 +Node: Signature Program754323 +Node: Debugger755423 +Node: Debugging756375 +Node: Debugging Concepts756808 +Node: Debugging Terms758664 +Node: Awk Debugging761261 +Node: Sample Debugging Session762153 +Node: Debugger Invocation762673 +Node: Finding The Bug764002 +Node: List of Debugger Commands770490 +Node: Breakpoint Control771824 +Node: Debugger Execution Control775488 +Node: Viewing And Changing Data778848 +Node: Execution Stack782204 +Node: Debugger Info783671 +Node: Miscellaneous Debugger Commands787652 +Node: Readline Support793097 +Node: Limitations793928 +Node: Language History796180 +Node: V7/SVR3.1797692 +Node: SVR4800013 +Node: POSIX801455 +Node: BTL802463 +Node: POSIX/GNU803197 +Node: Common Extensions808348 +Node: Ranges and Locales809455 +Ref: Ranges and Locales-Footnote-1814059 +Node: Contributors814280 +Node: Installation818541 +Node: Gawk Distribution819435 +Node: Getting819919 +Node: Extracting820745 +Node: Distribution contents822437 +Node: Unix Installation827659 +Node: Quick Installation828276 +Node: Additional Configuration Options830238 +Node: Configuration Philosophy831715 +Node: Non-Unix Installation834057 +Node: PC Installation834515 +Node: PC Binary Installation835814 +Node: PC Compiling837662 +Node: PC Testing840606 +Node: PC Using841782 +Node: Cygwin845967 +Node: MSYS846967 +Node: VMS Installation847481 +Node: VMS Compilation848084 +Ref: VMS Compilation-Footnote-1849091 +Node: VMS Installation Details849149 +Node: VMS Running850784 +Node: VMS Old Gawk852391 +Node: Bugs852865 +Node: Other Versions856717 +Node: Notes862032 +Node: Compatibility Mode862724 +Node: Additions863507 +Node: Accessing The Source864319 +Node: Adding Code865744 +Node: New Ports871711 +Node: Dynamic Extensions875824 +Node: Internals877264 +Node: Plugin License885783 +Node: Loading Extensions886421 +Node: Sample Library888231 +Node: Internal File Description888921 +Node: Internal File Ops892636 +Ref: Internal File Ops-Footnote-1897360 +Node: Using Internal File Ops897500 +Node: Future Extensions899877 +Node: Basic Concepts902381 +Node: Basic High Level903138 +Ref: Basic High Level-Footnote-1907173 +Node: Basic Data Typing907358 +Node: Floating Point Issues911883 +Node: String Conversion Precision912966 +Ref: String Conversion Precision-Footnote-1914666 +Node: Unexpected Results914775 +Node: POSIX Floating Point Problems916601 +Ref: POSIX Floating Point Problems-Footnote-1920306 +Node: Glossary920344 +Node: Copying945320 +Node: GNU Free Documentation License982877 +Node: Index1008014 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 5b3dd71c..0946f888 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -20,7 +20,7 @@ @c applies to and all the info about who's publishing this edition @c These apply across the board. -@set UPDATE-MONTH November, 2011 +@set UPDATE-MONTH February, 2012 @set VERSION 4.0 @set PATCHLEVEL 1 @@ -143,7 +143,7 @@ Some comments on the layout for TeX. @copying Copyright @copyright{} 1989, 1991, 1992, 1993, 1996, 1997, 1998, 1999, -2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010, 2011 +2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. @sp 2 @@ -1970,9 +1970,11 @@ line beginning with @samp{#!} lists the full @value{FN} of an interpreter to run and an optional initial command-line argument to pass to that interpreter. The operating system then runs the interpreter with the given argument and the full argument list of the executed program. The first argument -in the list is the full @value{FN} of the @command{awk} program. The rest of the +in the list is the full @value{FN} of the @command{awk} program. +The rest of the argument list contains either options to @command{awk}, or @value{DF}s, -or both.} as if you had +or both. Note that on many systems @command{awk} may be found in +@file{/usr/bin} instead of in @file{/bin}. Caveat Emptor.} as if you had typed @samp{awk -f advice}: @example @@ -4514,6 +4516,10 @@ it is good practice to always escape them with a backslash. Then the regexp constants are valid and work the way you want them to, using any version of @command{awk}.@footnote{Use two backslashes if you're using a string constant with a regexp operator or function.} + +Finally, when @samp{@{} and @samp{@}} appear in regexp constants +in a way that cannot be interpreted as an interval expression +(such as @code{/q@{a@}/}), then they stand for themselves. @end table @cindex precedence, regexp operators @@ -14339,6 +14345,13 @@ Optional parameters are enclosed in square brackets@w{ ([ ]):} @item atan2(@var{y}, @var{x}) @cindex @code{atan2()} function Return the arctangent of @code{@var{y} / @var{x}} in radians. +You can use @samp{pi = atan2(0, -1)} to retrieve the value of +@tex +$\pi$. +@end tex +@ifnottex +pi. +@end ifnottex @item cos(@var{x}) @cindex @code{cos()} function diff --git a/doc/texinfo.tex b/doc/texinfo.tex index 1130b8fc..dcdeb9b4 100644 --- a/doc/texinfo.tex +++ b/doc/texinfo.tex @@ -3,11 +3,11 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2010-12-23.17} +\def\texinfoversion{2012-01-19.16} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, -% 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +% 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. % % This texinfo.tex file is free software: you can redistribute it and/or % modify it under the terms of the GNU General Public License as @@ -116,10 +116,11 @@ % Set up fixed words for English if not already set. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putworderror\undefined \gdef\putworderror{error}\fi \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi \ifx\putwordin\undefined \gdef\putwordin{in}\fi -\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi -\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi @@ -158,15 +159,18 @@ \def\spaceisspace{\catcode`\ =\spacecat} % sometimes characters are active, so we need control sequences. +\chardef\ampChar = `\& \chardef\colonChar = `\: \chardef\commaChar = `\, \chardef\dashChar = `\- \chardef\dotChar = `\. \chardef\exclamChar= `\! +\chardef\hashChar = `\# \chardef\lquoteChar= `\` \chardef\questChar = `\? \chardef\rquoteChar= `\' \chardef\semiChar = `\; +\chardef\slashChar = `\/ \chardef\underChar = `\_ % Ignore a token. @@ -215,7 +219,7 @@ \tracingmacros2 \tracingrestores1 \showboxbreadth\maxdimen \showboxdepth\maxdimen - \ifx\eTeXversion\undefined\else % etex gives us more logging + \ifx\eTeXversion\thisisundefined\else % etex gives us more logging \tracingscantokens1 \tracingifs1 \tracinggroups1 @@ -226,6 +230,13 @@ \errorcontextlines16 }% +% @errormsg{MSG}. Do the index-like expansions on MSG, but if things +% aren't perfect, it's not the end of the world, being an error message, +% after all. +% +\def\errormsg{\begingroup \indexnofonts \doerrormsg} +\def\doerrormsg#1{\errmessage{#1}} + % add check for \lastpenalty to plain's definitions. If the last thing % we did was a \nobreak, we don't want to insert more space. % @@ -545,7 +556,7 @@ } \def\inenvironment#1{% \ifx#1\empty - out of any environment% + outside of any environment% \else in environment \expandafter\string#1% \fi @@ -557,7 +568,7 @@ \parseargdef\end{% \if 1\csname iscond.#1\endcsname \else - % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 + % The general wording of \badenverr may not be ideal. \expandafter\checkenv\csname#1\endcsname \csname E#1\endcsname \endgroup @@ -608,7 +619,7 @@ \else\ifx\temp\offword \plainnonfrenchspacing \else \errhelp = \EMsimple - \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% + \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% \fi\fi } @@ -690,15 +701,6 @@ where each line of input produces a line of output.} \newdimen\mil \mil=0.001in -% Old definition--didn't work. -%\parseargdef\need{\par % -%% This method tries to make TeX break the page naturally -%% if the depth of the box does not fit. -%{\baselineskip=0pt% -%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak -%\prevdepth=-1000pt -%}} - \parseargdef\need{% % Ensure vertical mode, so we don't make a big box in the middle of a % paragraph. @@ -849,6 +851,7 @@ where each line of input produces a line of output.} \makevalueexpandable % we want to expand any @value in FILE. \turnoffactive % and allow special characters in the expansion \indexnofonts % Allow `@@' and other weird things in file names. + \wlog{texinfo.tex: doing @include of #1^^J}% \edef\temp{\noexpand\input #1 }% % % This trickery is to read FILE outside of a group, in case it makes @@ -1078,9 +1081,8 @@ where each line of input produces a line of output.} \newif\ifpdfmakepagedest % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 -% can be set). So we test for \relax and 0 as well as \undefined, -% borrowed from ifpdf.sty. -\ifx\pdfoutput\undefined +% can be set). So we test for \relax and 0 as well as being undefined. +\ifx\pdfoutput\thisisundefined \else \ifx\pdfoutput\relax \else @@ -1095,50 +1097,24 @@ where each line of input produces a line of output.} % for display in the outlines, and in other places. Thus, we have to % double any backslashes. Otherwise, a name like "\node" will be % interpreted as a newline (\n), followed by o, d, e. Not good. -% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html -% (and related messages, the final outcome is that it is up to the TeX -% user to double the backslashes and otherwise make the string valid, so -% that's what we do). - -% double active backslashes. -% -{\catcode`\@=0 \catcode`\\=\active - @gdef@activebackslashdouble{% - @catcode`@\=@active - @let\=@doublebackslash} -} - -% To handle parens, we must adopt a different approach, since parens are -% not active characters. hyperref.dtx (which has the same problem as -% us) handles it with this amazing macro to replace tokens, with minor -% changes for Texinfo. It is included here under the GPL by permission -% from the author, Heiko Oberdiek. -% -% #1 is the tokens to replace. -% #2 is the replacement. -% #3 is the control sequence with the string. -% -\def\HyPsdSubst#1#2#3{% - \def\HyPsdReplace##1#1##2\END{% - ##1% - \ifx\\##2\\% - \else - #2% - \HyReturnAfterFi{% - \HyPsdReplace##2\END - }% - \fi - }% - \xdef#3{\expandafter\HyPsdReplace#3#1\END}% -} -\long\def\HyReturnAfterFi#1\fi{\fi#1} - -% #1 is a control sequence in which to do the replacements. -\def\backslashparens#1{% - \xdef#1{#1}% redefine it as its expansion; the definition is simply - % \lastnode when called from \setref -> \pdfmkdest. - \HyPsdSubst{(}{\realbackslash(}{#1}% - \HyPsdSubst{)}{\realbackslash)}{#1}% +% +% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and +% related messages. The final outcome is that it is up to the TeX user +% to double the backslashes and otherwise make the string valid, so +% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to +% do this reliably, so we use it. + +% #1 is a control sequence in which to do the replacements, +% which we \xdef. +\def\txiescapepdf#1{% + \ifx\pdfescapestring\relax + % No primitive available; should we give a warning or log? + % Many times it won't matter. + \else + % The expandable \pdfescapestring primitive escapes parentheses, + % backslashes, and other special chars. + \xdef#1{\pdfescapestring{#1}}% + \fi } \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images @@ -1200,29 +1176,31 @@ output) for that.)} \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% % - % pdftex (and the PDF format) support .png, .jpg, .pdf (among - % others). Let's try in that order. + % pdftex (and the PDF format) support .pdf, .png, .jpg (among + % others). Let's try in that order, PDF first since if + % someone has a scalable image, presumably better to use that than a + % bitmap. \let\pdfimgext=\empty \begingroup - \openin 1 #1.png \ifeof 1 - \openin 1 #1.jpg \ifeof 1 - \openin 1 #1.jpeg \ifeof 1 - \openin 1 #1.JPG \ifeof 1 - \openin 1 #1.pdf \ifeof 1 - \openin 1 #1.PDF \ifeof 1 + \openin 1 #1.pdf \ifeof 1 + \openin 1 #1.PDF \ifeof 1 + \openin 1 #1.png \ifeof 1 + \openin 1 #1.jpg \ifeof 1 + \openin 1 #1.jpeg \ifeof 1 + \openin 1 #1.JPG \ifeof 1 \errhelp = \nopdfimagehelp \errmessage{Could not find image file #1 for pdf}% - \else \gdef\pdfimgext{PDF}% + \else \gdef\pdfimgext{JPG}% \fi - \else \gdef\pdfimgext{pdf}% + \else \gdef\pdfimgext{jpeg}% \fi - \else \gdef\pdfimgext{JPG}% + \else \gdef\pdfimgext{jpg}% \fi - \else \gdef\pdfimgext{jpeg}% + \else \gdef\pdfimgext{png}% \fi - \else \gdef\pdfimgext{jpg}% + \else \gdef\pdfimgext{PDF}% \fi - \else \gdef\pdfimgext{png}% + \else \gdef\pdfimgext{pdf}% \fi \closein 1 \endgroup @@ -1250,10 +1228,9 @@ output) for that.)} % such as \, aren't expanded when present in a section title. \indexnofonts \turnoffactive - \activebackslashdouble \makevalueexpandable \def\pdfdestname{#1}% - \backslashparens\pdfdestname + \txiescapepdf\pdfdestname \safewhatsit{\pdfdest name{\pdfdestname} xyz}% }} % @@ -1285,28 +1262,22 @@ output) for that.)} % page number. We could generate a destination for the section % text in the case where a section has no node, but it doesn't % seem worth the trouble, since most documents are normally structured. - \def\pdfoutlinedest{#3}% + \edef\pdfoutlinedest{#3}% \ifx\pdfoutlinedest\empty \def\pdfoutlinedest{#4}% \else - % Doubled backslashes in the name. - {\activebackslashdouble \xdef\pdfoutlinedest{#3}% - \backslashparens\pdfoutlinedest}% + \txiescapepdf\pdfoutlinedest \fi % - % Also double the backslashes in the display string. - {\activebackslashdouble \xdef\pdfoutlinetext{#1}% - \backslashparens\pdfoutlinetext}% + % Also escape PDF chars in the display string. + \edef\pdfoutlinetext{#1}% + \txiescapepdf\pdfoutlinetext % \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% } % \def\pdfmakeoutlines{% \begingroup - % Thanh's hack / proper braces in bookmarks - \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace - \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace - % % Read toc silently, to get counts of subentries for \pdfoutline. \def\partentry##1##2##3##4{}% ignore parts in the outlines \def\numchapentry##1##2##3##4{% @@ -1362,15 +1333,26 @@ output) for that.)} % Latin 2 (0xea) gets translated to a | character. Info from % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. % - % xx to do this right, we have to translate 8-bit characters to - % their "best" equivalent, based on the @documentencoding. Right - % now, I guess we'll just let the pdf reader have its way. + % TODO this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Too + % much work for too little return. Just use the ASCII equivalents + % we use for the index sort strings. + % \indexnofonts \setupdatafile + % We can have normal brace characters in the PDF outlines, unlike + % Texinfo index files. So set that up. + \def\{{\lbracecharliteral}% + \def\}{\rbracecharliteral}% \catcode`\\=\active \otherbackslash \input \tocreadfilename \endgroup } + {\catcode`[=1 \catcode`]=2 + \catcode`{=\other \catcode`}=\other + \gdef\lbracecharliteral[{]% + \gdef\rbracecharliteral[}]% + ] % \def\skipspaces#1{\def\PP{#1}\def\D{|}% \ifx\PP\D\let\nextsp\relax @@ -1512,7 +1494,7 @@ output) for that.)} % if we are producing pdf, and we have \pdffontattr, then define cmaps. % (\pdffontattr was introduced many years ago, but people still run % older pdftex's; it's easy to conditionalize, so we do.) -\ifpdf \ifx\pdffontattr\undefined \else +\ifpdf \ifx\pdffontattr\thisisundefined \else \begingroup \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap @@ -1779,7 +1761,7 @@ end % Use cm as the default font prefix. % To specify the font prefix, you must define \fontprefix % before you read in texinfo.tex. -\ifx\fontprefix\undefined +\ifx\fontprefix\thisisundefined \def\fontprefix{cm} \fi % Support font families that don't use the same naming scheme as CM. @@ -2070,7 +2052,7 @@ end % \parseargdef\fonttextsize{% \def\textsizearg{#1}% - \wlog{doing @fonttextsize \textsizearg}% + %\wlog{doing @fonttextsize \textsizearg}% % % Set \globaldefs so that documents can use this inside @tex, since % makeinfo 4.8 does not support it, but we need it nonetheless. @@ -2252,12 +2234,14 @@ end % Markup style setup for left and right quotes. \defmarkupstylesetup\markupsetuplq{% - \expandafter\let\expandafter \temp \csname markupsetuplq\currentmarkupstyle\endcsname + \expandafter\let\expandafter \temp + \csname markupsetuplq\currentmarkupstyle\endcsname \ifx\temp\relax \markupsetuplqdefault \else \temp \fi } \defmarkupstylesetup\markupsetuprq{% - \expandafter\let\expandafter \temp \csname markupsetuprq\currentmarkupstyle\endcsname + \expandafter\let\expandafter \temp + \csname markupsetuprq\currentmarkupstyle\endcsname \ifx\temp\relax \markupsetuprqdefault \else \temp \fi } @@ -2291,12 +2275,11 @@ end \let\markupsetuplqkbd \markupsetnoligaturesquoteleft -% Allow an option to not replace quotes with a regular directed right -% quote/apostrophe (char 0x27), but instead use the undirected quote -% from cmtt (char 0x0d). The undirected quote is ugly, so don't make it -% the default, but it works for pasting with more pdf viewers (at least -% evince), the lilypond developers report. xpdf does work with the -% regular 0x27. +% Allow an option to not use regular directed right quote/apostrophe +% (char 0x27), but instead the undirected quote from cmtt (char 0x0d). +% The undirected quote is ugly, so don't make it the default, but it +% works for pasting with more pdf viewers (at least evince), the +% lilypond developers report. xpdf does work with the regular 0x27. % \def\codequoteright{% \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax @@ -2320,6 +2303,36 @@ end \else \char'22 \fi } +% Commands to set the quote options. +% +\parseargdef\codequoteundirected{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxicodequoteundirected\endcsname + = t% + \else\ifx\temp\offword + \expandafter\let\csname SETtxicodequoteundirected\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}% + \fi\fi +} +% +\parseargdef\codequotebacktick{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxicodequotebacktick\endcsname + = t% + \else\ifx\temp\offword + \expandafter\let\csname SETtxicodequotebacktick\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}% + \fi\fi +} + % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. \def\noligaturesquoteleft{\relax\lq} @@ -2347,7 +2360,9 @@ end \else\ifx\next-% \else\ifx\next.% \else\ptexslash - \fi\fi\fi} + \fi\fi\fi + \aftersmartic +} % like \smartslanted except unconditionally uses \ttsl, and no ic. % @var is set to this for defun arguments. @@ -2357,9 +2372,15 @@ end % ttsl for book titles, do we? \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection} +\def\aftersmartic{} +\def\var#1{% + \let\saveaftersmartic = \aftersmartic + \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% + \smartslanted{#1}% +} + \let\i=\smartitalic \let\slanted=\smartslanted -\def\var#1{\smartslanted{#1}} \let\dfn=\smartslanted \let\emph=\smartitalic @@ -2455,7 +2476,7 @@ end \plainfrenchspacing #1% }% - \null + \null % reset spacefactor to 1000 } % We *must* turn on hyphenation at `-' and `_' in @code. @@ -2487,6 +2508,8 @@ end } } +\def\codex #1{\tclose{#1}\endgroup} + \def\realdash{-} \def\codedash{-\discretionary{}{}{}} \def\codeunder{% @@ -2500,7 +2523,6 @@ end \discretionary{}{}{}}% {\_}% } -\def\codex #1{\tclose{#1}\endgroup} % An additional complication: the above will allow breaks after, e.g., % each of the four underscores in __typeof__. This is undesirable in @@ -2520,63 +2542,18 @@ end \allowcodebreaksfalse \else \errhelp = \EMsimple - \errmessage{Unknown @allowcodebreaks option `\txiarg'}% + \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}% \fi\fi } -% @kbd is like @code, except that if the argument is just one @key command, -% then @kbd has no effect. -\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}} - -% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), -% `example' (@kbd uses ttsl only inside of @example and friends), -% or `code' (@kbd uses normal tty font always). -\parseargdef\kbdinputstyle{% - \def\txiarg{#1}% - \ifx\txiarg\worddistinct - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% - \else\ifx\txiarg\wordexample - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% - \else\ifx\txiarg\wordcode - \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% - \else - \errhelp = \EMsimple - \errmessage{Unknown @kbdinputstyle option `\txiarg'}% - \fi\fi\fi -} -\def\worddistinct{distinct} -\def\wordexample{example} -\def\wordcode{code} - -% Default is `distinct'. -\kbdinputstyle distinct - -\def\xkey{\key} -\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% -\ifx\one\xkey\ifx\threex\three \key{#2}% -\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi -\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi} - -% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. -\let\indicateurl=\code -\let\env=\code -\let\command=\code - -% @clicksequence{File @click{} Open ...} -\def\clicksequence#1{\begingroup #1\endgroup} - -% @clickstyle @arrow (by default) -\parseargdef\clickstyle{\def\click{#1}} -\def\click{\arrow} - % @uref (abbreviation for `urlref') takes an optional (comma-separated) % second argument specifying the text to display and an optional third % arg as text to display instead of (rather than in addition to) the url -% itself. First (mandatory) arg is the url. Perhaps eventually put in -% a hypertex \special here. -% -\def\uref#1{\douref #1,,,\finish} -\def\douref#1,#2,#3,#4\finish{\begingroup +% itself. First (mandatory) arg is the url. +% (This \urefnobreak definition isn't used now, leaving it for a while +% for comparison.) +\def\urefnobreak#1{\dourefnobreak #1,,,\finish} +\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup \unsepspaces \pdfurl{#1}% \setbox0 = \hbox{\ignorespaces #3}% @@ -2597,6 +2574,103 @@ end \endlink \endgroup} +% This \urefbreak definition is the active one. +\def\urefbreak{\begingroup \urefcatcodes \dourefbreak} +\let\uref=\urefbreak +\def\dourefbreak#1{\urefbreakfinish #1,,,\finish} +\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \urefcode{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% Allow line breaks around only a few characters (only). +\def\urefcatcodes{% + \catcode\ampChar=\active \catcode\dotChar=\active + \catcode\hashChar=\active \catcode\questChar=\active + \catcode\slashChar=\active +} +{ + \urefcatcodes + % + \global\def\urefcode{\begingroup + \setupmarkupstyle{code}% + \urefcatcodes + \let&\urefcodeamp + \let.\urefcodedot + \let#\urefcodehash + \let?\urefcodequest + \let/\urefcodeslash + \codex + } + % + % By default, they are just regular characters. + \global\def&{\normalamp} + \global\def.{\normaldot} + \global\def#{\normalhash} + \global\def?{\normalquest} + \global\def/{\normalslash} +} + +% we put a little stretch before and after the breakable chars, to help +% line breaking of long url's. The unequal skips make look better in +% cmtt at least, especially for dots. +\def\urefprestretch{\urefprebreak \hskip0pt plus.13em } +\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em } +% +\def\urefcodeamp{\urefprestretch \&\urefpoststretch} +\def\urefcodedot{\urefprestretch .\urefpoststretch} +\def\urefcodehash{\urefprestretch \#\urefpoststretch} +\def\urefcodequest{\urefprestretch ?\urefpoststretch} +\def\urefcodeslash{\futurelet\next\urefcodeslashfinish} +{ + \catcode`\/=\active + \global\def\urefcodeslashfinish{% + \urefprestretch \slashChar + % Allow line break only after the final / in a sequence of + % slashes, to avoid line break between the slashes in http://. + \ifx\next/\else \urefpoststretch \fi + } +} + +% One more complication: by default we'll break after the special +% characters, but some people like to break before the special chars, so +% allow that. Also allow no breaking at all, for manual control. +% +\parseargdef\urefbreakstyle{% + \def\txiarg{#1}% + \ifx\txiarg\wordnone + \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak} + \else\ifx\txiarg\wordbefore + \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak} + \else\ifx\txiarg\wordafter + \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak} + \else + \errhelp = \EMsimple + \errmessage{Unknown @urefbreakstyle setting `\txiarg'}% + \fi\fi\fi +} +\def\wordafter{after} +\def\wordbefore{before} +\def\wordnone{none} + +\urefbreakstyle after + % @url synonym for @uref, since that's how everyone uses it. % \let\url=\uref @@ -2618,6 +2692,51 @@ end \let\email=\uref \fi +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. +\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}} + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\parseargdef\kbdinputstyle{% + \def\txiarg{#1}% + \ifx\txiarg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\txiarg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\txiarg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle setting `\txiarg'}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is `distinct'. +\kbdinputstyle distinct + +\def\xkey{\key} +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% +\ifx\one\xkey\ifx\threex\three \key{#2}% +\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi +\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi} + +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code +\let\env=\code +\let\command=\code + +% @clicksequence{File @click{} Open ...} +\def\clicksequence#1{\begingroup #1\endgroup} + +% @clickstyle @arrow (by default) +\parseargdef\clickstyle{\def\click{#1}} +\def\click{\arrow} + % Typeset a dimension, e.g., `in' or `pt'. The only reason for the % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. % @@ -2639,6 +2758,7 @@ end \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi + \null % reset \spacefactor=1000 } % @abbr for "Comput. J." and the like. @@ -2651,6 +2771,7 @@ end \ifx\temp\empty \else \space ({\unsepspaces \ignorespaces \temp \unskip})% \fi + \null % reset \spacefactor=1000 } % @asis just yields its argument. Used with @table, for example. @@ -2715,20 +2836,48 @@ end } } +% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}. +% Ignore unless FMTNAME == tex; then it is like @iftex and @tex, +% except specified as a normal braced arg, so no newlines to worry about. +% +\def\outfmtnametex{tex} +% +\long\def\inlinefmt#1{\doinlinefmt #1,\finish} +\long\def\doinlinefmt#1,#2,\finish{% + \def\inlinefmtname{#1}% + \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi +} +% For raw, must switch into @tex before parsing the argument, to avoid +% setting catcodes prematurely. Doing it this way means that, for +% example, @inlineraw{html, foo{bar} gets a parse error instead of being +% ignored. But this isn't important because if people want a literal +% *right* brace they would have to use a command anyway, so they may as +% well use a command to get a left brace too. We could re-use the +% delimiter character idea from \verb, but it seems like overkill. +% +\long\def\inlineraw{\tex \doinlineraw} +\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish} +\def\doinlinerawtwo#1,#2,\finish{% + \def\inlinerawname{#1}% + \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi + \endgroup % close group opened by \tex. +} + \message{glyphs,} % and logos. -% @@ prints an @. +% @@ prints an @, as does @atchar{}. \def\@{\char64 } +\let\atchar=\@ -% Used to generate quoted braces. Unless we're in typewriter, use -% \ecfont because the CM text fonts do not have braces, and we don't -% want to switch into math. +% @{ @} @lbracechar{} @rbracechar{} all generate brace characters. +% Unless we're in typewriter, use \ecfont because the CM text fonts do +% not have braces, and we don't want to switch into math. \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}} \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}} -\let\{=\mylbrace -\let\}=\myrbrace +\let\{=\mylbrace \let\lbracechar=\{ +\let\}=\myrbrace \let\rbracechar=\} \begingroup % Definitions to produce \{ and \} commands for indices, % and @{ and @} for the aux/toc files. @@ -2856,7 +3005,7 @@ end {\tentt \global\dimen0 = 3em}% Width of the box. \dimen2 = .55pt % Thickness of rules % The text. (`r' is open on the right, `e' somewhat less so on the left.) -\setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt} +\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt} % \setbox\errorbox=\hbox to \dimen0{\hfil \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. @@ -3005,7 +3154,7 @@ end % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 % so we'll define it if necessary. % -\ifx\Orb\undefined +\ifx\Orb\thisisundefined \def\Orb{\mathhexbox20D} \fi @@ -3033,8 +3182,9 @@ end \newif\ifsetshortcontentsaftertitlepage \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue -\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% - \endgroup\page\hbox{}\page} +\parseargdef\shorttitlepage{% + \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} \envdef\titlepage{% % Open one extra group, as we want to close it in the middle of \Etitlepage. @@ -3094,7 +3244,7 @@ end \finishedtitlepagetrue } -%%% Macros to be used within @titlepage: +% Macros to be used within @titlepage: \let\subtitlerm=\tenrm \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} @@ -3127,7 +3277,7 @@ end } -%%% Set up page headings and footings. +% Set up page headings and footings. \let\thispage=\folio @@ -3279,7 +3429,7 @@ end % This produces Day Month Year style of output. % Only define if not already defined, in case a txi-??.tex file has set % up a different format (e.g., txi-cs.tex does this). -\ifx\today\undefined +\ifx\today\thisisundefined \def\today{% \number\day\space \ifcase\month @@ -3826,18 +3976,18 @@ end \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip \global\advance\multitablelinespace by-\ht0 \fi -%% Test to see if parskip is larger than space between lines of -%% table. If not, do nothing. -%% If so, set to same dimension as multitablelinespace. +% Test to see if parskip is larger than space between lines of +% table. If not, do nothing. +% If so, set to same dimension as multitablelinespace. \ifdim\multitableparskip>\multitablelinespace \global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. +\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller + % than skip between lines in the table. \fi% \ifdim\multitableparskip=0pt \global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. +\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller + % than skip between lines in the table. \fi} @@ -4349,6 +4499,7 @@ end % % Commands that take arguments. \definedummyword\acronym + \definedummyword\anchor \definedummyword\cite \definedummyword\code \definedummyword\command @@ -5242,7 +5393,8 @@ end \global\let\subsubsection = \appendixsubsubsec } -\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz +% normally unnmhead0 calls unnumberedzzz: +\outer\parseargdef\unnumbered{\unnmhead0{#1}} \def\unnumberedzzz#1{% \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 \global\advance\unnumberedno by 1 @@ -5286,40 +5438,47 @@ end \let\top\unnumbered % Sections. +% \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz \def\seczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% } -\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz +% normally calls appendixsectionzzz: +\outer\parseargdef\appendixsection{\apphead1{#1}} \def\appendixsectionzzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% } \let\appendixsec\appendixsection -\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz +% normally calls unnumberedseczzz: +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} \def\unnumberedseczzz#1{% \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% } % Subsections. -\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz +% +% normally calls numberedsubseczzz: +\outer\parseargdef\numberedsubsec{\numhead2{#1}} \def\numberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% } -\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz +% normally calls appendixsubseczzz: +\outer\parseargdef\appendixsubsec{\apphead2{#1}} \def\appendixsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno}% } -\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz +% normally calls unnumberedsubseczzz: +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} \def\unnumberedsubseczzz#1{% \global\subsubsecno=0 \global\advance\subsecno by 1 \sectionheading{#1}{subsec}{Ynothing}% @@ -5327,21 +5486,25 @@ end } % Subsubsections. -\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz +% +% normally numberedsubsubseczzz: +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} \def\numberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynumbered}% {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% } -\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz +% normally appendixsubsubseczzz: +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} \def\appendixsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Yappendix}% {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% } -\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz +% normally unnumberedsubsubseczzz: +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} \def\unnumberedsubsubseczzz#1{% \global\advance\subsubsecno by 1 \sectionheading{#1}{subsubsec}{Ynothing}% @@ -5391,14 +5554,13 @@ end % (including whitespace, linebreaking, etc. around it), % given all the information in convenient, parsed form. -%%% Args are the skip and penalty (usually negative) +% Args are the skip and penalty (usually negative) \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} -%%% Define plain chapter starts, and page on/off switching for it % Parameter controlling skip before chapter headings (if needed) - \newskip\chapheadingskip +% Define plain chapter starts, and page on/off switching for it. \def\chapbreak{\dobreak \chapheadingskip {-4000}} \def\chappager{\par\vfill\supereject} % Because \domark is called before \chapoddpage, the filler page will @@ -5601,6 +5763,8 @@ end % \def\sectionheading#1#2#3#4{% {% + \checkenv{}% should not be in an environment. + % % Switch to the right set of fonts. \csname #2fonts\endcsname \rmisbold % @@ -5718,7 +5882,6 @@ end % This is purely so the last item on the list is a known \penalty > % 10000. This is so \startdefun can avoid allowing breakpoints after % section headings. Otherwise, it would insert a valid breakpoint between: - % % @section sec-whatever % @deffn def-whatever \penalty 10001 @@ -6136,6 +6299,12 @@ end \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip % Flag to tell @lisp, etc., not to narrow margin. \let\nonarrowing = t% + % + % If this cartouche directly follows a sectioning command, we need the + % \parskip glue (backspaced over by default) or the cartouche can + % collide with the section heading. + \ifnum\lastpenalty>10000 \vskip\parskip \fi + % \vbox\bgroup \baselineskip=0pt\parskip=0pt\lineskip=0pt \carttop @@ -6149,7 +6318,7 @@ end \lineskip=\normlskip \parskip=\normpskip \vskip -\parskip - \comment % For explanation, see the end of \def\group. + \comment % For explanation, see the end of def\group. } \def\Ecartouche{% \ifhmode\par\fi @@ -6346,7 +6515,7 @@ end % \def\Equotation{% \par - \ifx\quotationauthor\undefined\else + \ifx\quotationauthor\thisisundefined\else % indent a bit. \leftline{\kern 2\leftskip \sl ---\quotationauthor}% \fi @@ -6505,6 +6674,7 @@ end \makevalueexpandable \setupverbatim \indexnofonts % Allow `@@' and other weird things in file names. + \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}% \input #1 \afterenvbreak }% @@ -6554,7 +6724,7 @@ end % commands also insert a nobreak penalty, and we don't want to allow % a break between a section heading and a defun. % - % As a minor refinement, we avoid "club" headers by signalling + % As a further refinement, we avoid "club" headers by signalling % with penalty of 10003 after the very first @deffn in the % sequence (see above), and penalty of 10002 after any following % @def command. @@ -6621,13 +6791,36 @@ end \def\domakedefun#1#2#3{% \envdef#1{% \startdefun + \doingtypefnfalse % distinguish typed functions from all else \parseargusing\activeparens{\printdefunline#3}% }% \def#2{\dodefunx#1}% \def#3% } -%%% Untyped functions: +\newif\ifdoingtypefn % doing typed function? +\newif\ifrettypeownline % typeset return type on its own line? + +% @deftypefnnewline on|off says whether the return type of typed functions +% are printed on their own line. This affects @deftypefn, @deftypefun, +% @deftypeop, and @deftypemethod. +% +\parseargdef\deftypefnnewline{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETtxideftypefnnl\endcsname + = \empty + \else\ifx\temp\offword + \expandafter\let\csname SETtxideftypefnnl\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @txideftypefnnl value `\temp', + must be on|off}% + \fi\fi +} + +% Untyped functions: % @deffn category name args \makedefun{deffn}{\deffngeneral{}} @@ -6646,7 +6839,7 @@ end \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% } -%%% Typed functions: +% Typed functions: % @deftypefn category type name args \makedefun{deftypefn}{\deftypefngeneral{}} @@ -6661,10 +6854,11 @@ end % \def\deftypefngeneral#1#2 #3 #4 #5\endheader{% \dosubind{fn}{\code{#4}}{#1}% + \doingtypefntrue \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } -%%% Typed variables: +% Typed variables: % @deftypevr category type var args \makedefun{deftypevr}{\deftypecvgeneral{}} @@ -6682,7 +6876,7 @@ end \defname{#2}{#3}{#4}\defunargs{#5\unskip}% } -%%% Untyped variables: +% Untyped variables: % @defvr category var args \makedefun{defvr}#1 {\deftypevrheader{#1} {} } @@ -6693,7 +6887,8 @@ end % \defcvof {category of}class var args \def\defcvof#1#2 {\deftypecvof{#1}#2 {} } -%%% Type: +% Types: + % @deftp category name args \makedefun{deftp}#1 #2 #3\endheader{% \doind{tp}{\code{#2}}% @@ -6721,25 +6916,49 @@ end % We are followed by (but not passed) the arguments, if any. % \def\defname#1#2#3{% + \par % Get the values of \leftskip and \rightskip as they were outside the @def... \advance\leftskip by -\defbodyindent % - % How we'll format the type name. Putting it in brackets helps + % Determine if we are typesetting the return type of a typed function + % on a line by itself. + \rettypeownlinefalse + \ifdoingtypefn % doing a typed function specifically? + % then check user option for putting return type on its own line: + \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else + \rettypeownlinetrue + \fi + \fi + % + % How we'll format the category name. Putting it in brackets helps % distinguish it from the body text that may end up on the next line % just below it. \def\temp{#1}% \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} % - % Figure out line sizes for the paragraph shape. + % Figure out line sizes for the paragraph shape. We'll always have at + % least two. + \tempnum = 2 + % % The first line needs space for \box0; but if \rightskip is nonzero, % we need only space for the part of \box0 which exceeds it: \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % + % If doing a return type on its own line, we'll have another line. + \ifrettypeownline + \advance\tempnum by 1 + \def\maybeshapeline{0in \hsize}% + \else + \def\maybeshapeline{}% + \fi + % % The continuations: \dimen2=\hsize \advance\dimen2 by -\defargsindent - % (plain.tex says that \dimen1 should be used only as global.) - \parshape 2 0in \dimen0 \defargsindent \dimen2 % - % Put the type name to the right margin. + % The final paragraph shape: + \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2 + % + % Put the category name at the right margin. \noindent \hbox to 0pt{% \hfil\box0 \kern-\hsize @@ -6761,8 +6980,16 @@ end % . this still does not fix the ?` and !` ligatures, but so far no % one has made identifiers using them :). \df \tt - \def\temp{#2}% return value type - \ifx\temp\empty\else \tclose{\temp} \fi + \def\temp{#2}% text of the return type + \ifx\temp\empty\else + \tclose{\temp}% typeset the return type + \ifrettypeownline + % put return type on its own line; prohibit line break following: + \hfil\vadjust{\nobreak}\break + \else + \space % type on same line, so just followed by a space + \fi + \fi % no return type #3% output function name }% {\rm\enskip}% hskip 0.5 em of \tenrm @@ -6880,7 +7107,7 @@ end % To do this right we need a feature of e-TeX, \scantokens, % which we arrange to emulate with a temporary file in ordinary TeX. -\ifx\eTeXversion\undefined +\ifx\eTeXversion\thisisundefined \newwrite\macscribble \def\scantokens#1{% \toks0={#1}% @@ -6905,12 +7132,14 @@ end % ... and for \example: \spaceisspace % - % The \empty here causes a following catcode 5 newline to be eaten - % as part of reading whitespace after a control sequence. It does - % not eat a catcode 13 newline. There's no good way to handle the - % two cases. See the Macro Details node in the manual for the - % workaround we currently have to recommend for macros and + % The \empty here causes a following catcode 5 newline to be eaten as + % part of reading whitespace after a control sequence. It does not + % eat a catcode 13 newline. There's no good way to handle the two + % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX + % would then have different behavior). See the Macro Details node in + % the manual for the workaround we recommend for macros and % line-oriented commands. + % \scantokens{#1\empty}% \endgroup} @@ -7045,9 +7274,15 @@ end \def\macroxxx#1{% \getargs{#1}% now \macname is the macname and \argl the arglist \ifx\argl\empty % no arguments - \paramno=0 + \paramno=0\relax \else \expandafter\parsemargdef \argl;% + \if\paramno>256\relax + \ifx\eTeXversion\thisisundefined + \errhelp = \EMsimple + \errmessage{You need eTeX to compile a file with macros with more than 256 arguments} + \fi + \fi \fi \if1\csname ismacro.\the\macname\endcsname \message{Warning: redefining \the\macname}% @@ -7097,9 +7332,17 @@ end \def\getmacname#1 #2\relax{\macname={#1}} \def\getmacargs#1{\def\argl{#1}} +% For macro processing make @ a letter so that we can make Texinfo private macro names. +\edef\texiatcatcode{\the\catcode`\@} +\catcode `@=11\relax + % Parse the optional {params} list. Set up \paramno and \paramlist -% so \defmacro knows what to do. Define \macarg.blah for each blah -% in the params list to be ##N where N is the position in that list. +% so \defmacro knows what to do. Define \macarg.BLAH for each BLAH +% in the params list to some hook where the argument si to be expanded. If +% there are less than 10 arguments that hook is to be replaced by ##N where N +% is the position in that list, that is to say the macro arguments are to be +% defined `a la TeX in the macro body. +% % That gets used by \mbodybackslash (above). % % We need to get `macro parameter char #' into several definitions. @@ -7109,12 +7352,33 @@ end % % The same technique is used to protect \eatspaces till just before % the macro is used. - +% +% If there are 10 or more arguments, a different technique is used, where the +% hook remains in the body, and when macro is to be expanded the body is +% processed again to replace the arguments. +% +% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the +% argument N value and then \edef the body (nothing else will expand because of +% the catcode regime underwhich the body was input). +% +% If you compile with TeX (not eTeX), and you have macros with 10 or more +% arguments, you need that no macro has more than 256 arguments, otherwise an +% error is produced. \def\parsemargdef#1;{% \paramno=0\def\paramlist{}% \let\hash\relax \let\xeatspaces\relax \parsemargdefxxx#1,;,% + % In case that there are 10 or more arguments we parse again the arguments + % list to set new definitions for the \macarg.BLAH macros corresponding to + % each BLAH argument. It was anyhow needed to parse already once this list + % in order to count the arguments, and as macros with at most 9 arguments + % are by far more frequent than macro with 10 or more arguments, defining + % twice the \macarg.BLAH macros does not cost too much processing power. + \ifnum\paramno<10\relax\else + \paramno0\relax + \parsemmanyargdef@@#1,;,% 10 or more arguments + \fi } \def\parsemargdefxxx#1,{% \if#1;\let\next=\relax @@ -7125,16 +7389,205 @@ end \edef\paramlist{\paramlist\hash\the\paramno,}% \fi\next} +\def\parsemmanyargdef@@#1,{% + \if#1;\let\next=\relax + \else + \let\next=\parsemmanyargdef@@ + \edef\tempb{\eatspaces{#1}}% + \expandafter\def\expandafter\tempa + \expandafter{\csname macarg.\tempb\endcsname}% + % Note that we need some extra \noexpand\noexpand, this is because we + % don't want \the to be expanded in the \parsermacbody as it uses an + % \xdef . + \expandafter\edef\tempa + {\noexpand\noexpand\noexpand\the\toks\the\paramno}% + \advance\paramno by 1\relax + \fi\next} + % These two commands read recursive and nonrecursive macro bodies. % (They're different since rec and nonrec macros end differently.) % + +\catcode `\@\texiatcatcode \long\def\parsemacbody#1@end macro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% \long\def\parsermacbody#1@end rmacro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\catcode `\@=11\relax + +\let\endargs@\relax +\let\nil@\relax +\def\nilm@{\nil@}% +\long\def\nillm@{\nil@}% + +% This macro is expanded during the Texinfo macro expansion, not during its +% definition. It gets all the arguments values and assigns them to macros +% macarg.ARGNAME +% +% #1 is the macro name +% #2 is the list of argument names +% #3 is the list of argument values +\def\getargvals@#1#2#3{% + \def\macargdeflist@{}% + \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion. + \def\paramlist{#2,\nil@}% + \def\macroname{#1}% + \begingroup + \macroargctxt + \def\argvaluelist{#3,\nil@}% + \def\@tempa{#3}% + \ifx\@tempa\empty + \setemptyargvalues@ + \else + \getargvals@@ + \fi +} + +% +\def\getargvals@@{% + \ifx\paramlist\nilm@ + % Some sanity check needed here that \argvaluelist is also empty. + \ifx\argvaluelist\nillm@ + \else + \errhelp = \EMsimple + \errmessage{Too many arguments in macro `\macroname'!}% + \fi + \let\next\macargexpandinbody@ + \else + \ifx\argvaluelist\nillm@ + % No more arguments values passed to macro. Set remaining named-arg + % macros to empty. + \let\next\setemptyargvalues@ + \else + % pop current arg name into \@tempb + \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}% + \expandafter\@tempa\expandafter{\paramlist}% + % pop current argument value into \@tempc + \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}% + \expandafter\@tempa\expandafter{\argvaluelist}% + % Here \@tempb is the current arg name and \@tempc is the current arg value. + % First place the new argument macro definition into \@tempd + \expandafter\macname\expandafter{\@tempc}% + \expandafter\let\csname macarg.\@tempb\endcsname\relax + \expandafter\def\expandafter\@tempe\expandafter{% + \csname macarg.\@tempb\endcsname}% + \edef\@tempd{\long\def\@tempe{\the\macname}}% + \push@\@tempd\macargdeflist@ + \let\next\getargvals@@ + \fi + \fi + \next +} + +\def\push@#1#2{% + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter#2% + \expandafter\expandafter\expandafter{% + \expandafter#1#2}% +} + +% Replace arguments by their values in the macro body, and place the result +% in macro \@tempa +\def\macvalstoargs@{% + % To do this we use the property that token registers that are \the'ed + % within an \edef expand only once. So we are going to place all argument + % values into respective token registers. + % + % First we save the token context, and initialize argument numbering. + \begingroup + \paramno0\relax + % Then, for each argument number #N, we place the corresponding argument + % value into a new token list register \toks#N + \expandafter\putargsintokens@\saveparamlist@,;,% + % Then, we expand the body so that argument are replaced by their + % values. The trick for values not to be expanded themselves is that they + % are within tokens and that tokens expand only once in an \edef . + \edef\@tempc{\csname mac.\macroname .body\endcsname}% + % Now we restore the token stack pointer to free the token list registers + % which we have used, but we make sure that expanded body is saved after + % group. + \expandafter + \endgroup + \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% + } + +\def\macargexpandinbody@{% + %% Define the named-macro outside of this group and then close this group. + \expandafter + \endgroup + \macargdeflist@ + % First the replace in body the macro arguments by their values, the result + % is in \@tempa . + \macvalstoargs@ + % Then we point at the \norecurse or \gobble (for recursive) macro value + % with \@tempb . + \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname + % Depending on whether it is recursive or not, we need some tailing + % \egroup . + \ifx\@tempb\gobble + \let\@tempc\relax + \else + \let\@tempc\egroup + \fi + % And now we do the real job: + \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}% + \@tempd +} + +\def\putargsintokens@#1,{% + \if#1;\let\next\relax + \else + \let\next\putargsintokens@ + % First we allocate the new token list register, and give it a temporary + % alias \@tempb . + \toksdef\@tempb\the\paramno + % Then we place the argument value into that token list register. + \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname + \expandafter\@tempb\expandafter{\@tempa}% + \advance\paramno by 1\relax + \fi + \next +} + +% Save the token stack pointer into macro #1 +\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}} +% Restore the token stack pointer from number in macro #1 +\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax} +% newtoks that can be used non \outer . +\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi} + +% Tailing missing arguments are set to empty +\def\setemptyargvalues@{% + \ifx\paramlist\nilm@ + \let\next\macargexpandinbody@ + \else + \expandafter\setemptyargvaluesparser@\paramlist\endargs@ + \let\next\setemptyargvalues@ + \fi + \next +} + +\def\setemptyargvaluesparser@#1,#2\endargs@{% + \expandafter\def\expandafter\@tempa\expandafter{% + \expandafter\def\csname macarg.#1\endcsname{}}% + \push@\@tempa\macargdeflist@ + \def\paramlist{#2}% +} -% This defines the macro itself. There are six cases: recursive and -% nonrecursive macros of zero, one, and many arguments. +% #1 is the element target macro +% #2 is the list macro +% #3,#4\endargs@ is the list value +\def\pop@#1#2#3,#4\endargs@{% + \def#1{#3}% + \def#2{#4}% +} +\long\def\longpop@#1#2#3,#4\endargs@{% + \long\def#1{#3}% + \long\def#2{#4}% +} + +% This defines a Texinfo @macro. There are eight cases: recursive and +% nonrecursive macros of zero, one, up to nine, and many arguments. % Much magic with \expandafter here. % \xdef is used so that macro definitions will survive the file % they're defined in; @include reads the file inside a group. @@ -7153,17 +7606,25 @@ end \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% \egroup\noexpand\scanmacro{\temp}}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \else + \ifnum\paramno<10\relax % at most 9 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \else % 10 or more + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\getargvals@{\the\macname}{\argl}% + }% + \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp + \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble + \fi \fi \else \ifcase\paramno @@ -7180,23 +7641,33 @@ end \egroup \noexpand\norecurse{\the\macname}% \noexpand\scanmacro{\temp}\egroup}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \expandafter\noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% + \else % at most 9 + \ifnum\paramno<10\relax + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % 10 or more: + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\getargvals@{\the\macname}{\argl}% + }% + \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp + \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse + \fi \fi \fi} +\catcode `\@\texiatcatcode\relax + \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} % \braceorline decides whether the next nonwhitespace character is a @@ -7235,7 +7706,8 @@ end % @inforef is relatively simple. \def\inforef #1{\inforefzzz #1,,,,**} -\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, +\def\inforefzzz #1,#2,#3,#4**{% + \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, node \samp{\ignorespaces#1{}}} % @node's only job in TeX is to define \lastnode, which is used in @@ -7296,11 +7768,32 @@ end \toks0 = \expandafter{\lastsection}% \immediate \writexrdef{title}{\the\toks0 }% \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. - \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, during \shipout + \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout }% \fi } +% @xrefautosectiontitle on|off says whether @section(ing) names are used +% automatically in xrefs, if the third arg is not explicitly specified. +% This was provided as a "secret" @set xref-automatic-section-title +% variable, now it's official. +% +\parseargdef\xrefautomaticsectiontitle{% + \def\temp{#1}% + \ifx\temp\onword + \expandafter\let\csname SETxref-automatic-section-title\endcsname + = \empty + \else\ifx\temp\offword + \expandafter\let\csname SETxref-automatic-section-title\endcsname + = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @xrefautomaticsectiontitle value `\temp', + must be on|off}% + \fi\fi +} + + % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is % the node name, #2 the name of the Info cross-reference, #3 the printed % node name, #4 the name of the Info file, #5 the name of the printed @@ -7309,26 +7802,36 @@ end \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} \def\ref#1{\xrefX[#1,,,,,,,]} +% +\newbox\topbox +\newbox\printedrefnamebox +\newbox\printedmanualbox +% \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup \unsepspaces - \def\printedmanual{\ignorespaces #5}% + % \def\printedrefname{\ignorespaces #3}% - \setbox1=\hbox{\printedmanual\unskip}% - \setbox0=\hbox{\printedrefname\unskip}% - \ifdim \wd0 = 0pt + \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}% + % + \def\printedmanual{\ignorespaces #5}% + \setbox\printedmanualbox = \hbox{\printedmanual\unskip}% + % + % If the printed reference name (arg #3) was not explicitly given in + % the @xref, figure out what we want to use. + \ifdim \wd\printedrefnamebox = 0pt % No printed node name was explicitly given. - \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax - % Use the node name inside the square brackets. + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax + % Not auto section-title: use node name inside the square brackets. \def\printedrefname{\ignorespaces #1}% \else - % Use the actual chapter/section title appear inside - % the square brackets. Use the real section title if we have it. - \ifdim \wd1 > 0pt - % It is in another manual, so we don't have it. + % Auto section-title: use chapter/section title inside + % the square brackets if we have it. + \ifdim \wd\printedmanualbox > 0pt + % It is in another manual, so we don't have it; use node name. \def\printedrefname{\ignorespaces #1}% \else \ifhavexrefs - % We know the real title if we have the xref values. + % We (should) know the real title if we have the xref values. \def\printedrefname{\refx{#1-title}{}}% \else % Otherwise just copy the Info node name. @@ -7346,9 +7849,8 @@ end % etc. don't get their TeX definitions. \getfilename{#4}% % - % See comments at \activebackslashdouble. - {\activebackslashdouble \xdef\pdfxrefdest{#1}% - \backslashparens\pdfxrefdest}% + \edef\pdfxrefdest{#1}% + \txiescapepdf\pdfxrefdest % \leavevmode \startlink attr{/Border [0 0 0]}% @@ -7375,7 +7877,7 @@ end \iffloat\Xthisreftitle % If the user specified the print name (third arg) to the ref, % print it instead of our usual "Figure 1.2". - \ifdim\wd0 = 0pt + \ifdim\wd\printedrefnamebox = 0pt \refx{#1-snt}{}% \else \printedrefname @@ -7383,21 +7885,46 @@ end % % if the user also gave the printed manual name (fifth arg), append % "in MANUALNAME". - \ifdim \wd1 > 0pt + \ifdim \wd\printedmanualbox > 0pt \space \putwordin{} \cite{\printedmanual}% \fi \else % node/anchor (non-float) references. - % - % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not - % insert empty discretionaries after hyphens, which means that it will - % not find a line break at a hyphen in a node names. Since some manuals - % are best written with fairly long node names, containing hyphens, this - % is a loss. Therefore, we give the text of the node name again, so it - % is as if TeX is seeing it for the first time. - \ifdim \wd1 > 0pt - \putwordSection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + % + % If we use \unhbox to print the node names, TeX does not insert + % empty discretionaries after hyphens, which means that it will not + % find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, + % this is a loss. Therefore, we give the text of the node name + % again, so it is as if TeX is seeing it for the first time. + % + % Cross-manual reference. Only include the "Section ``foo'' in" if + % the foo is neither missing or Top. Thus, @xref{,,,foo,The Foo Manual} + % outputs simply "see The Foo Manual". + \ifdim \wd\printedmanualbox > 0pt + % What is the 7sp about? The idea is that we also want to omit + % the Section part if we would be printing "Top", since they are + % clearly trying to refer to the whole manual. But, this being + % TeX, we can't easily compare strings while ignoring the possible + % spaces before and after in the input. By adding the arbitrary + % 7sp, we make it much less likely that a real node name would + % happen to have the same width as "Top" (e.g., in a monospaced font). + % I hope it will never happen in practice. + % + % For the same basic reason, we retypeset the "Top" at every + % reference, since the current font is indeterminate. + % + \setbox\topbox = \hbox{Top\kern7sp}% + \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}% + \ifdim \wd2 > 7sp + \ifdim \wd2 = \wd\topbox \else + \putwordSection{} ``\printedrefname'' \putwordin{}\space + \fi + \fi + \cite{\printedmanual}% \else + % Reference in this manual. + % % _ (for example) has to be the character _ for the purposes of the % control sequence corresponding to the node, but it has to expand % into the usual \leavevmode...\vrule stuff for purposes of @@ -7409,7 +7936,7 @@ end \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi }% - % output the `[mynode]' via a macro so it can be overridden. + % output the `[mynode]' via the macro below so it can be overridden. \xrefprintnodename\printedrefname % % But we always want a comma and a space: @@ -7637,7 +8164,7 @@ end % space to prevent strange expansion errors.) \def\supereject{\par\penalty -20000\footnoteno =0 } -% @footnotestyle is meaningful for info output only. +% @footnotestyle is meaningful for Info output only. \let\footnotestyle=\comment {\catcode `\@=11 @@ -7700,6 +8227,8 @@ end % expands into a box, it must come within the paragraph, lest it % provide a place where TeX can split the footnote. \footstrut + % + % Invoke rest of plain TeX footnote routine. \futurelet\next\fo@t } }%end \catcode `\@=11 @@ -7787,7 +8316,7 @@ end it from ftp://tug.org/tex/epsf.tex.} % \def\image#1{% - \ifx\epsfbox\undefined + \ifx\epsfbox\thisiundefined \ifwarnednoepsf \else \errhelp = \noepsfhelp \errmessage{epsf.tex not found, images will be ignored}% @@ -8252,7 +8781,7 @@ directory should work if nowhere else does.} % % Latin1 (ISO-8859-1) character definitions. \def\latonechardefs{% - \gdef^^a0{~} + \gdef^^a0{\tie} \gdef^^a1{\exclamdown} \gdef^^a2{\missingcharmsg{CENT SIGN}} \gdef^^a3{{\pounds}} @@ -8282,7 +8811,7 @@ directory should work if nowhere else does.} \gdef^^b9{$^1$} \gdef^^ba{\ordm} % - \gdef^^bb{\guilletright} + \gdef^^bb{\guillemetright} \gdef^^bc{$1\over4$} \gdef^^bd{$1\over2$} \gdef^^be{$3\over4$} @@ -8374,7 +8903,7 @@ directory should work if nowhere else does.} % Latin2 (ISO-8859-2) character definitions. \def\lattwochardefs{% - \gdef^^a0{~} + \gdef^^a0{\tie} \gdef^^a1{\ogonek{A}} \gdef^^a2{\u{}} \gdef^^a3{\L} @@ -8547,7 +9076,7 @@ directory should work if nowhere else does.} \gdef\DeclareUnicodeCharacter#1#2{% \countUTFz = "#1\relax - \wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% + %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% \begingroup \parseXMLCharref \def\UTFviiiTwoOctets##1##2{% @@ -9223,28 +9752,21 @@ directory should work if nowhere else does.} \message{and turning on texinfo input format.} +\def^^L{\par} % remove \outer, so ^L can appear in an @comment + % DEL is a comment character, in case @c does not suffice. \catcode`\^^? = 14 % Define macros to output various characters with catcode for normal text. -\catcode`\"=\other -\catcode`\~=\other -\catcode`\^=\other -\catcode`\_=\other -\catcode`\|=\other -\catcode`\<=\other -\catcode`\>=\other -\catcode`\+=\other -\catcode`\$=\other -\def\normaldoublequote{"} -\def\normaltilde{~} -\def\normalcaret{^} -\def\normalunderscore{_} -\def\normalverticalbar{|} -\def\normalless{<} -\def\normalgreater{>} -\def\normalplus{+} -\def\normaldollar{$}%$ font-lock fix +\catcode`\"=\other \def\normaldoublequote{"} +\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix +\catcode`\+=\other \def\normalplus{+} +\catcode`\<=\other \def\normalless{<} +\catcode`\>=\other \def\normalgreater{>} +\catcode`\^=\other \def\normalcaret{^} +\catcode`\_=\other \def\normalunderscore{_} +\catcode`\|=\other \def\normalverticalbar{|} +\catcode`\~=\other \def\normaltilde{~} % This macro is used to make a character print one way in \tt % (where it can probably be output as-is), and another way in other fonts, @@ -9322,14 +9844,24 @@ directory should work if nowhere else does.} % In texinfo, backslash is an active character; it prints the backslash % in fixed width font. -\catcode`\\=\active -@def@normalbackslash{{@tt@backslashcurfont}} +\catcode`\\=\active % @ for escape char from now on. + +% The story here is that in math mode, the \char of \backslashcurfont +% ends up printing the roman \ from the math symbol font (because \char +% in math mode uses the \mathcode, and plain.tex sets +% \mathcode`\\="026E). It seems better for @backslashchar{} to always +% print a typewriter backslash, hence we use an explicit \mathchar, +% which is the decimal equivalent of "715c (class 7, e.g., use \fam; +% ignored family value; char position "5C). We can't use " for the +% usual hex value because it has already been made active. +@def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}} +@let@backslashchar = @normalbackslash % @backslashchar{} is for user documents. + % On startup, @fixbackslash assigns: % @let \ = @normalbackslash - % \rawbackslash defines an active \ to do \backslashcurfont. % \otherbackslash defines an active \ to be a literal `\' character with -% catcode other. +% catcode other. We switch back and forth between these. @gdef@rawbackslash{@let\=@backslashcurfont} @gdef@otherbackslash{@let\=@realbackslash} @@ -9337,16 +9869,16 @@ directory should work if nowhere else does.} % the literal character `\'. % @def@normalturnoffactive{% - @let\=@normalbackslash @let"=@normaldoublequote - @let~=@normaltilde + @let$=@normaldollar %$ font-lock fix + @let+=@normalplus + @let<=@normalless + @let>=@normalgreater + @let\=@normalbackslash @let^=@normalcaret @let_=@normalunderscore @let|=@normalverticalbar - @let<=@normalless - @let>=@normalgreater - @let+=@normalplus - @let$=@normaldollar %$ font-lock fix + @let~=@normaltilde @markupsetuplqdefault @markupsetuprqdefault @unsepspaces @@ -9378,10 +9910,19 @@ directory should work if nowhere else does.} % Say @foo, not \foo, in error messages. @escapechar = `@@ +% These (along with & and #) are made active for url-breaking, so need +% active definitions as the normal characters. +@def@normaldot{.} +@def@normalquest{?} +@def@normalslash{/} + % These look ok in all fonts, so just make them not special. -@catcode`@& = @other -@catcode`@# = @other -@catcode`@% = @other +% @hashchar{} gets its own user-level command, because of #line. +@catcode`@& = @other @def@normalamp{&} +@catcode`@# = @other @def@normalhash{#} +@catcode`@% = @other @def@normalpercent{%} + +@let @hashchar = @normalhash @c Finally, make ` and ' active, so that txicodequoteundirected and @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we |