aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/Makefile.am12
-rw-r--r--doc/libmicrohttpd-tutorial.texi (renamed from doc/microhttpd-tutorial.texi)24
-rw-r--r--doc/libmicrohttpd.texi (renamed from doc/microhttpd.texi)339
-rw-r--r--doc/texinfo.tex2056
4 files changed, 1536 insertions, 895 deletions
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 4ea5c249..f8ac28a1 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -2,13 +2,13 @@ man_MANS = libmicrohttpd.3
2EXTRA_DIST = $(man_MANS) Doxyfile 2EXTRA_DIST = $(man_MANS) Doxyfile
3 3
4DISTCLEANFILES = \ 4DISTCLEANFILES = \
5 microhttpd.cps \ 5 libmicrohttpd.cps \
6 microhttpd.dvi \ 6 libmicrohttpd.dvi \
7 microhttpd-tutorial.cps \ 7 libmicrohttpd-tutorial.cps \
8 microhttpd-tutorial.dvi 8 libmicrohttpd-tutorial.dvi
9info_TEXINFOS = \ 9info_TEXINFOS = \
10 microhttpd.texi \ 10 libmicrohttpd.texi \
11 microhttpd-tutorial.texi 11 libmicrohttpd-tutorial.texi
12microhttpd_TEXINFOS = \ 12microhttpd_TEXINFOS = \
13 chapters/basicauthentication.inc \ 13 chapters/basicauthentication.inc \
14 chapters/bibliography.inc \ 14 chapters/bibliography.inc \
diff --git a/doc/microhttpd-tutorial.texi b/doc/libmicrohttpd-tutorial.texi
index 1dc64daa..8527e9c4 100644
--- a/doc/microhttpd-tutorial.texi
+++ b/doc/libmicrohttpd-tutorial.texi
@@ -1,15 +1,18 @@
1\input texinfo @c -*-texinfo-*- 1\input texinfo @c -*-texinfo-*-
2@finalout 2@finalout
3@setfilename microhttpd-tutorial.info 3@setfilename libmicrohttpd-tutorial.info
4@set UPDATED 2 Nov 2011 4@include version.texi
5@set UPDATED-MONTH Nov 2011
6@set EDITION 0.9.16
7@set VERSION 0.9.16
8@settitle A tutorial for GNU libmicrohttpd 5@settitle A tutorial for GNU libmicrohttpd
9 6@c Unify all the indices into concept index.
10@dircategory GNU Libraries 7@syncodeindex fn cp
8@syncodeindex vr cp
9@syncodeindex ky cp
10@syncodeindex pg cp
11@syncodeindex tp cp
12
13@dircategory Software libraries
11@direntry 14@direntry
12* libmicrohttpdtutorial: (microhttpd). A tutorial for GNU libmicrohttpd. 15* libmicrohttpdtutorial: (libmicrohttpd). A tutorial for GNU libmicrohttpd.
13@end direntry 16@end direntry
14 17
15@copying 18@copying
@@ -18,7 +21,7 @@ updated @value{UPDATED}.
18 21
19Copyright (c) 2008 Sebastian Gerhardt. 22Copyright (c) 2008 Sebastian Gerhardt.
20 23
21Copyright (c) 2010, 2011 Christian Grothoff. 24Copyright (c) 2010, 2011, 2012 Christian Grothoff.
22@quotation 25@quotation
23Permission is granted to copy, distribute and/or modify this document 26Permission is granted to copy, distribute and/or modify this document
24under the terms of the GNU Free Documentation License, Version 1.3 27under the terms of the GNU Free Documentation License, Version 1.3
@@ -48,7 +51,8 @@ Free Documentation License".
48 51
49@ifnottex 52@ifnottex
50@node Top 53@node Top
51@top Top 54@top A Tutorial for GNU libmicrohttpd
55@insertcopying
52@end ifnottex 56@end ifnottex
53 57
54@menu 58@menu
diff --git a/doc/microhttpd.texi b/doc/libmicrohttpd.texi
index 753bdfa5..f9b99bea 100644
--- a/doc/microhttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -1,15 +1,19 @@
1\input texinfo 1\input texinfo
2@setfilename microhttpd.info 2@setfilename libmicrohttpd.info
3@include version.texi 3@include version.texi
4@settitle The GNU libmicrohttpd Reference Manual 4@settitle The GNU libmicrohttpd Reference Manual
5@c Unify all the indices into concept index.
6@syncodeindex fn cp
7@syncodeindex vr cp
8@syncodeindex ky cp
9@syncodeindex pg cp
10@syncodeindex tp cp
5@copying 11@copying
6This manual documents GNU libmicrohttpd version @value{VERSION}, last 12This manual is for GNU libmicrohttpd
7updated @value{UPDATED}. It is built upon the documentation in the 13(version @value{VERSION}, @value{UPDATED}), a library for embedding
8header file @file{microhttpd.h}. 14an HTTP(S) server into C applications.
9 15
10@noindent 16Copyright @copyright{} 2007--2012 Christian Grothoff
11
12Copyright @copyright{} 2007, 2008, 2009, 2010, 2011 Christian Grothoff
13 17
14@quotation 18@quotation
15Permission is granted to copy, distribute and/or modify this document 19Permission is granted to copy, distribute and/or modify this document
@@ -19,12 +23,11 @@ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
19Texts. A copy of the license is included in the section entitled "GNU 23Texts. A copy of the license is included in the section entitled "GNU
20Free Documentation License". 24Free Documentation License".
21@end quotation 25@end quotation
22GNU libmicrohttpd is a GNU package.
23@end copying 26@end copying
24 27
25@dircategory GNU Libraries 28@dircategory Software libraries
26@direntry 29@direntry
27* libmicrohttpd: (microhttpd). Embedded HTTP server library. 30* libmicrohttpd: (libmicrohttpd). Embedded HTTP server library.
28@end direntry 31@end direntry
29 32
30@c 33@c
@@ -36,7 +39,6 @@ GNU libmicrohttpd is a GNU package.
36@subtitle @value{UPDATED} 39@subtitle @value{UPDATED}
37@author Marco Maggi (@email{marco.maggi-ipsu@@poste.it}) 40@author Marco Maggi (@email{marco.maggi-ipsu@@poste.it})
38@author Christian Grothoff (@email{christian@@grothoff.org}) 41@author Christian Grothoff (@email{christian@@grothoff.org})
39
40@page 42@page
41@vskip 0pt plus 1filll 43@vskip 0pt plus 1filll
42@insertcopying 44@insertcopying
@@ -45,56 +47,6 @@ GNU libmicrohttpd is a GNU package.
45@summarycontents 47@summarycontents
46@contents 48@contents
47 49
48
49@macro gnu{}
50@acronym{GNU}
51@end macro
52
53@macro gpl{}
54@acronym{LGPL}
55@end macro
56
57@macro http{}
58@acronym{HTTP}
59@end macro
60
61@macro tcp{}
62@acronym{TCP}
63@end macro
64
65@macro api{}
66@acronym{API}
67@end macro
68
69@macro urloc{}
70@acronym{URL}
71@end macro
72
73@macro uri{}
74@acronym{URI}
75@end macro
76
77@macro ascii{}
78@acronym{ASCII}
79@end macro
80
81@c ............................................................
82
83@macro cfunction{arg}
84@code{\arg\()}
85@end macro
86
87@macro mynull{}
88@code{NULL}
89@end macro
90
91@macro mhd{}
92@acronym{MHD}
93@end macro
94
95@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
96
97
98@c ------------------------------------------------------------ 50@c ------------------------------------------------------------
99@ifnottex 51@ifnottex
100@node Top 52@node Top
@@ -139,40 +91,40 @@ Indices
139 91
140 92
141@noindent 93@noindent
142All symbols defined in the public @api{} start with @code{MHD_}. @mhd{} 94All symbols defined in the public API start with @code{MHD_}. MHD
143is a small @http{} daemon library. As such, it does not have any @api{} 95is a small HTTP daemon library. As such, it does not have any API
144for logging errors (you can only enable or disable logging to stderr). 96for logging errors (you can only enable or disable logging to stderr).
145Also, it may not support all of the @http{} features directly, where 97Also, it may not support all of the HTTP features directly, where
146applicable, portions of @http{} may have to be handled by clients of the 98applicable, portions of HTTP may have to be handled by clients of the
147library. 99library.
148 100
149The library is supposed to handle everything that it must handle 101The library is supposed to handle everything that it must handle
150(because the @api{} would not allow clients to do this), such as basic 102(because the API would not allow clients to do this), such as basic
151connection management; however, detailed interpretations of headers --- 103connection management; however, detailed interpretations of headers ---
152such as range requests --- and @http{} methods are left to clients. The 104such as range requests --- and HTTP methods are left to clients. The
153library does understand @code{HEAD} and will only send the headers of 105library does understand @code{HEAD} and will only send the headers of
154the response and not the body, even if the client supplied a body. The 106the response and not the body, even if the client supplied a body. The
155library also understands headers that control connection management 107library also understands headers that control connection management
156(specifically, @code{Connection: close} and @code{Expect: 100 continue} 108(specifically, @code{Connection: close} and @code{Expect: 100 continue}
157are understood and handled automatically). 109are understood and handled automatically).
158 110
159@mhd{} understands @code{POST} data and is able to decode certain 111MHD understands @code{POST} data and is able to decode certain
160formats (at the moment only @code{application/x-www-form-urlencoded} 112formats (at the moment only @code{application/x-www-form-urlencoded}
161and @code{multipart/form-data}) using the post processor API. The 113and @code{multipart/form-data}) using the post processor API. The
162data stream of a POST is also provided directly to the main 114data stream of a POST is also provided directly to the main
163application, so unsupported encodings could still be processed, just 115application, so unsupported encodings could still be processed, just
164not conveniently by @mhd{}. 116not conveniently by MHD.
165 117
166The header file defines various constants used by the @http{} protocol. 118The header file defines various constants used by the HTTP protocol.
167This does not mean that @mhd{} actually interprets all of these values. 119This does not mean that MHD actually interprets all of these values.
168The provided constants are exported as a convenience for users of the 120The provided constants are exported as a convenience for users of the
169library. @mhd{} does not verify that transmitted @http{} headers are 121library. MHD does not verify that transmitted HTTP headers are
170part of the standard specification; users of the library are free to 122part of the standard specification; users of the library are free to
171define their own extensions of the @http{} standard and use those with 123define their own extensions of the HTTP standard and use those with
172@mhd{}. 124MHD.
173 125
174All functions are guaranteed to be completely reentrant and 126All functions are guaranteed to be completely reentrant and
175thread-safe. @mhd{} checks for allocation failures and tries to 127thread-safe. MHD checks for allocation failures and tries to
176recover gracefully (for example, by closing the connection). 128recover gracefully (for example, by closing the connection).
177Additionally, clients can specify resource limits on the overall 129Additionally, clients can specify resource limits on the overall
178number of connections, number of connections per IP address and memory 130number of connections, number of connections per IP address and memory
@@ -180,7 +132,7 @@ used per connection to avoid resource exhaustion.
180 132
181@section Scope 133@section Scope
182 134
183@mhd{} is currently used in a wide range of implementations. 135MHD is currently used in a wide range of implementations.
184Examples based on reports we've received from developers include: 136Examples based on reports we've received from developers include:
185@itemize 137@itemize
186@item Embedded HTTP server on a cortex M3 (128 KB code space) 138@item Embedded HTTP server on a cortex M3 (128 KB code space)
@@ -196,7 +148,7 @@ Examples based on reports we've received from developers include:
196@cindex embedded systems 148@cindex embedded systems
197@cindex portability 149@cindex portability
198 150
199@mhd{} uses the standard GNU system where the usual build process 151MHD uses the standard GNU system where the usual build process
200involves running 152involves running
201@verbatim 153@verbatim
202$ ./configure 154$ ./configure
@@ -204,16 +156,16 @@ $ make
204$ make install 156$ make install
205@end verbatim 157@end verbatim
206 158
207@mhd{} supports various options to be given to configure to tailor the 159MHD supports various options to be given to configure to tailor the
208binary to a specific situation. Note that some of these options will 160binary to a specific situation. Note that some of these options will
209remove portions of the @mhd{} code that are required for 161remove portions of the MHD code that are required for
210binary-compatibility. They should only be used on embedded systems 162binary-compatibility. They should only be used on embedded systems
211with tight resource constraints and no concerns about library 163with tight resource constraints and no concerns about library
212versioning. Standard distributions including @mhd{} are expected to 164versioning. Standard distributions including MHD are expected to
213always ship with all features enabled, otherwise unexpected 165always ship with all features enabled, otherwise unexpected
214incompatibilities can arise! 166incompatibilities can arise!
215 167
216Here is a list of @mhd{}-specific options that can be given to configure 168Here is a list of MHD-specific options that can be given to configure
217(canonical configure options such as ``--prefix'' are also supported, for a 169(canonical configure options such as ``--prefix'' are also supported, for a
218full list of options run ``./configure --help''): 170full list of options run ``./configure --help''):
219 171
@@ -273,11 +225,11 @@ causing problems when porting to other platforms).
273 225
274@section SIGPIPE 226@section SIGPIPE
275@cindex signals 227@cindex signals
276@mhd{} does not install a signal handler for SIGPIPE. On platforms 228MHD does not install a signal handler for SIGPIPE. On platforms
277where this is possible (such as GNU/Linux), it disables SIGPIPE for 229where this is possible (such as GNU/Linux), it disables SIGPIPE for
278its I/O operations (by passing MSG_NOSIGNAL). On other platforms, 230its I/O operations (by passing MSG_NOSIGNAL). On other platforms,
279SIGPIPE signals may be generated from network operations by 231SIGPIPE signals may be generated from network operations by
280@mhd{} and will cause the process to die unless the developer 232MHD and will cause the process to die unless the developer
281explicitly installs a signal handler for SIGPIPE. 233explicitly installs a signal handler for SIGPIPE.
282 234
283Hence portable code using MHD must install a SIGPIPE handler or 235Hence portable code using MHD must install a SIGPIPE handler or
@@ -333,7 +285,7 @@ the percent sign).
333 285
334 286
335@deftp {Enumeration} MHD_FLAG 287@deftp {Enumeration} MHD_FLAG
336Options for the @mhd{} daemon. 288Options for the MHD daemon.
337 289
338Note that if neither @code{MHD_USE_THREAD_PER_CONNECTION} nor 290Note that if neither @code{MHD_USE_THREAD_PER_CONNECTION} nor
339@code{MHD_USE_SELECT_INTERNALLY} is used, the client wants control over 291@code{MHD_USE_SELECT_INTERNALLY} is used, the client wants control over
@@ -342,7 +294,7 @@ the process and will call the appropriate microhttpd callbacks.
342Starting the daemon may also fail if a particular option is not 294Starting the daemon may also fail if a particular option is not
343implemented or not supported on the target platform (i.e. no support for 295implemented or not supported on the target platform (i.e. no support for
344@acronym{SSL}, threads or IPv6). SSL support generally depends on 296@acronym{SSL}, threads or IPv6). SSL support generally depends on
345options given during @mhd{} compilation. Threaded operations 297options given during MHD compilation. Threaded operations
346(including @code{MHD_USE_SELECT_INTERNALLY}) are not supported on 298(including @code{MHD_USE_SELECT_INTERNALLY}) are not supported on
347Symbian. 299Symbian.
348 300
@@ -354,7 +306,7 @@ No options selected.
354@cindex debugging 306@cindex debugging
355Run in debug mode. If this flag is used, the library should print error 307Run in debug mode. If this flag is used, the library should print error
356messages and warnings to stderr. Note that for this 308messages and warnings to stderr. Note that for this
357run-time option to have any effect, @mhd{} needs to be 309run-time option to have any effect, MHD needs to be
358compiled with messages enabled. This is done by default except you ran 310compiled with messages enabled. This is done by default except you ran
359configure with the @code{--disable-messages} flag set. 311configure with the @code{--disable-messages} flag set.
360 312
@@ -369,16 +321,16 @@ Run using an internal thread doing @code{SELECT}.
369 321
370@item MHD_USE_IPv6 322@item MHD_USE_IPv6
371@cindex IPv6 323@cindex IPv6
372Run using the IPv6 protocol (otherwise, @mhd{} will just support IPv4). 324Run using the IPv6 protocol (otherwise, MHD will just support IPv4).
373 325
374 326
375@item MHD_USE_PEDANTIC_CHECKS 327@item MHD_USE_PEDANTIC_CHECKS
376Be pedantic about the protocol (as opposed to as tolerant as possible). 328Be pedantic about the protocol (as opposed to as tolerant as possible).
377Specifically, at the moment, this flag causes @mhd{} to reject @http{} 329Specifically, at the moment, this flag causes MHD to reject HTTP
3781.1 connections without a @code{Host} header. This is required by the 3301.1 connections without a @code{Host} header. This is required by the
379standard, but of course in violation of the ``be as liberal as possible 331standard, but of course in violation of the ``be as liberal as possible
380in what you accept'' norm. It is recommended to turn this @strong{ON} 332in what you accept'' norm. It is recommended to turn this @strong{ON}
381if you are testing clients against @mhd{}, and @strong{OFF} in 333if you are testing clients against MHD, and @strong{OFF} in
382production. 334production.
383 335
384@item MHD_USE_POLL 336@item MHD_USE_POLL
@@ -414,8 +366,8 @@ with using a thread pool; if it is used,
414 366
415 367
416@deftp {Enumeration} MHD_OPTION 368@deftp {Enumeration} MHD_OPTION
417@mhd{} options. Passed in the varargs portion of 369MHD options. Passed in the varargs portion of
418@cfunction{MHD_start_daemon}. 370@code{MHD_start_daemon()}.
419 371
420@table @code 372@table @code
421@item MHD_OPTION_END 373@item MHD_OPTION_END
@@ -467,13 +419,13 @@ timeout). The default is zero (no timeout).
467Register a function that should be called whenever a request has been 419Register a function that should be called whenever a request has been
468completed (this can be used for application-specific clean up). 420completed (this can be used for application-specific clean up).
469Requests that have never been presented to the application (via 421Requests that have never been presented to the application (via
470@cfunction{MHD_AccessHandlerCallback}) will not result in 422@code{MHD_AccessHandlerCallback()}) will not result in
471notifications. 423notifications.
472 424
473This option should be followed by @strong{TWO} pointers. First a 425This option should be followed by @strong{TWO} pointers. First a
474pointer to a function of type @cfunction{MHD_RequestCompletedCallback} 426pointer to a function of type @code{MHD_RequestCompletedCallback()}
475and second a pointer to a closure to pass to the request completed 427and second a pointer to a closure to pass to the request completed
476callback. The second pointer maybe @mynull{}. 428callback. The second pointer maybe @code{NULL}.
477 429
478 430
479@item MHD_OPTION_PER_IP_CONNECTION_LIMIT 431@item MHD_OPTION_PER_IP_CONNECTION_LIMIT
@@ -512,8 +464,8 @@ one must be of the form
512where the return value will be passed as 464where the return value will be passed as
513@code{*con_cls} in calls to the @code{MHD_AccessHandlerCallback} 465@code{*con_cls} in calls to the @code{MHD_AccessHandlerCallback}
514when this request is processed later; returning a 466when this request is processed later; returning a
515value of NULL has no special significance; (however, 467value of @code{NULL} has no special significance; (however,
516note that if you return non-NULL, you can no longer 468note that if you return non-@code{NULL}, you can no longer
517rely on the first call to the access handler having 469rely on the first call to the access handler having
518@code{NULL == *con_cls} on entry) 470@code{NULL == *con_cls} on entry)
519@code{cls} will be set to the second argument following 471@code{cls} will be set to the second argument following
@@ -629,7 +581,7 @@ Number (unsigned int) of threads in thread pool. Enable
629thread pooling by setting this value to to something 581thread pooling by setting this value to to something
630greater than 1. Currently, thread model must be 582greater than 1. Currently, thread model must be
631MHD_USE_SELECT_INTERNALLY if thread pooling is enabled 583MHD_USE_SELECT_INTERNALLY if thread pooling is enabled
632(MHD_start_daemon returns NULL for an unsupported thread 584(MHD_start_daemon returns @code{NULL} for an unsupported thread
633model). 585model).
634 586
635@item MHD_OPTION_ARRAY 587@item MHD_OPTION_ARRAY
@@ -710,34 +662,34 @@ pass the two pointers.
710 662
711@deftp {Enumeration} MHD_ValueKind 663@deftp {Enumeration} MHD_ValueKind
712The @code{MHD_ValueKind} specifies the source of the key-value pairs in 664The @code{MHD_ValueKind} specifies the source of the key-value pairs in
713the @http{} protocol. 665the HTTP protocol.
714 666
715@table @code 667@table @code
716@item MHD_RESPONSE_HEADER_KIND 668@item MHD_RESPONSE_HEADER_KIND
717Response header. 669Response header.
718 670
719@item MHD_HEADER_KIND 671@item MHD_HEADER_KIND
720@http{} header. 672HTTP header.
721 673
722@item MHD_COOKIE_KIND 674@item MHD_COOKIE_KIND
723@cindex cookie 675@cindex cookie
724Cookies. Note that the original @http{} header containing the cookie(s) 676Cookies. Note that the original HTTP header containing the cookie(s)
725will still be available and intact. 677will still be available and intact.
726 678
727@item MHD_POSTDATA_KIND 679@item MHD_POSTDATA_KIND
728@cindex POST method 680@cindex POST method
729@code{POST} data. This is available only if a content encoding 681@code{POST} data. This is available only if a content encoding
730supported by @mhd{} is used (currently only @acronym{URL} encoding), and 682supported by MHD is used (currently only @acronym{URL} encoding), and
731only if the posted content fits within the available memory pool. Note 683only if the posted content fits within the available memory pool. Note
732that in that case, the upload data given to the 684that in that case, the upload data given to the
733@cfunction{MHD_AccessHandlerCallback} will be empty (since it has 685@code{MHD_AccessHandlerCallback()} will be empty (since it has
734already been processed). 686already been processed).
735 687
736@item MHD_GET_ARGUMENT_KIND 688@item MHD_GET_ARGUMENT_KIND
737@code{GET} (@uri{}) arguments. 689@code{GET} (URI) arguments.
738 690
739@item MHD_FOOTER_KIND 691@item MHD_FOOTER_KIND
740@http{} footer (only for http 1.1 chunked encodings). 692HTTP footer (only for http 1.1 chunked encodings).
741 693
742@end table 694@end table
743@end deftp 695@end deftp
@@ -760,7 +712,7 @@ No activity on the connection for the number of seconds specified using
760@code{MHD_OPTION_CONNECTION_TIMEOUT}. 712@code{MHD_OPTION_CONNECTION_TIMEOUT}.
761 713
762@item MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN 714@item MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN
763We had to close the session since @mhd{} was being shut down. 715We had to close the session since MHD was being shut down.
764@end table 716@end table
765@end deftp 717@end deftp
766 718
@@ -801,14 +753,14 @@ own private copy of the data for processing.
801 753
802 754
803@deftp {C Struct} MHD_Daemon 755@deftp {C Struct} MHD_Daemon
804Handle for the daemon (listening on a socket for @http{} traffic). 756Handle for the daemon (listening on a socket for HTTP traffic).
805@end deftp 757@end deftp
806 758
807 759
808@deftp {C Struct} MHD_Connection 760@deftp {C Struct} MHD_Connection
809Handle for a connection / @http{} request. With @http{}/1.1, multiple 761Handle for a connection / HTTP request. With HTTP/1.1, multiple
810requests can be run over the same connection. However, @mhd{} will only 762requests can be run over the same connection. However, MHD will only
811show one request per @tcp{} connection to the client at any given time. 763show one request per TCP connection to the client at any given time.
812@end deftp 764@end deftp
813 765
814 766
@@ -858,9 +810,9 @@ length of the address information.
858 810
859@deftypefn {Function Pointer} int {*MHD_AccessHandlerCallback} (void *cls, struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) 811@deftypefn {Function Pointer} int {*MHD_AccessHandlerCallback} (void *cls, struct MHD_Connection * connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls)
860Invoked in the context of a connection to answer a request from the 812Invoked in the context of a connection to answer a request from the
861client. This callback must call @mhd{} functions (example: the 813client. This callback must call MHD functions (example: the
862@code{MHD_Response} ones) to provide content to give back to the client 814@code{MHD_Response} ones) to provide content to give back to the client
863and return an @http{} status code (i.e. @code{200} for OK, @code{404}, 815and return an HTTP status code (i.e. @code{200} for OK, @code{404},
864etc.). 816etc.).
865 817
866@ref{microhttpd-post}, for details on how to code this callback. 818@ref{microhttpd-post}, for details on how to code this callback.
@@ -874,14 +826,14 @@ handling the request
874custom value selected at callback registration time; 826custom value selected at callback registration time;
875 827
876@item url 828@item url
877the @urloc{} requested by the client; 829the URL requested by the client;
878 830
879@item method 831@item method
880the @http{} method used by the client (@code{GET}, @code{PUT}, 832the HTTP method used by the client (@code{GET}, @code{PUT},
881@code{DELETE}, @code{POST}, etc.); 833@code{DELETE}, @code{POST}, etc.);
882 834
883@item version 835@item version
884the @http{} version string (i.e. @code{HTTP/1.1}); 836the HTTP version string (i.e. @code{HTTP/1.1});
885 837
886@item upload_data 838@item upload_data
887the data being uploaded (excluding headers): 839the data being uploaded (excluding headers):
@@ -893,7 +845,7 @@ the data being uploaded (excluding headers):
893for a @code{POST} that fits into memory and that is encoded with a 845for a @code{POST} that fits into memory and that is encoded with a
894supported encoding, the @code{POST} data will @strong{NOT} be given in 846supported encoding, the @code{POST} data will @strong{NOT} be given in
895@var{upload_data} and is instead available as part of 847@var{upload_data} and is instead available as part of
896@cfunction{MHD_get_connection_values}; 848@code{MHD_get_connection_values()};
897 849
898@item 850@item
899very large @code{POST} data @strong{will} be made available 851very large @code{POST} data @strong{will} be made available
@@ -914,8 +866,8 @@ avoid this, clients must be able to process upload data incrementally
914and reduce the value of @code{upload_data_size}. 866and reduce the value of @code{upload_data_size}.
915 867
916@item con_cls 868@item con_cls
917reference to a pointer, initially set to @mynull{}, that this callback can 869reference to a pointer, initially set to @code{NULL}, that this callback can
918set to some address and that will be preserved by @mhd{} for future 870set to some address and that will be preserved by MHD for future
919calls for this request; 871calls for this request;
920 872
921since the access handler may be called many times (i.e., for a 873since the access handler may be called many times (i.e., for a
@@ -930,7 +882,7 @@ if necessary, this state can be cleaned up in the global
930 882
931 883
932@deftypefn {Function Pointer} void {*MHD_RequestCompletedCallback} (void *cls, struct MHD_Connectionconnection, void **con_cls, enum MHD_RequestTerminationCode toe) 884@deftypefn {Function Pointer} void {*MHD_RequestCompletedCallback} (void *cls, struct MHD_Connectionconnection, void **con_cls, enum MHD_RequestTerminationCode toe)
933Signature of the callback used by @mhd{} to notify the application about 885Signature of the callback used by MHD to notify the application about
934completed requests. 886completed requests.
935 887
936@table @var 888@table @var
@@ -962,17 +914,17 @@ iteration.
962 914
963 915
964@deftypefn {Function Pointer} int {*MHD_ContentReaderCallback} (void *cls, uint64_t pos, char *buf, size_t max) 916@deftypefn {Function Pointer} int {*MHD_ContentReaderCallback} (void *cls, uint64_t pos, char *buf, size_t max)
965Callback used by @mhd{} in order to obtain content. The callback has to 917Callback used by MHD in order to obtain content. The callback has to
966copy at most @var{max} bytes of content into @var{buf}. The total 918copy at most @var{max} bytes of content into @var{buf}. The total
967number of bytes that has been placed into @var{buf} should be returned. 919number of bytes that has been placed into @var{buf} should be returned.
968 920
969Note that returning zero will cause @mhd{} to try again, either 921Note that returning zero will cause MHD to try again, either
970``immediately'' if in multi-threaded mode (in which case the callback 922``immediately'' if in multi-threaded mode (in which case the callback
971may want to do blocking operations to avoid busy waiting) or in the 923may want to do blocking operations to avoid busy waiting) or in the
972next round if @code{MHD_run} is used. Returning zero for a daemon 924next round if @code{MHD_run} is used. Returning zero for a daemon
973that runs in internal @cfunction{select} mode is an error (since it 925that runs in internal @code{select}-mode is an error (since it
974would result in busy waiting) and cause the program to be aborted 926would result in busy waiting) and cause the program to be aborted
975(@cfunction{abort}). 927(@code{abort()}).
976 928
977While usually the callback simply returns the number of bytes written 929While usually the callback simply returns the number of bytes written
978into @var{buf}, there are two special return value: 930into @var{buf}, there are two special return value:
@@ -981,13 +933,13 @@ into @var{buf}, there are two special return value:
981for the regular end of transmission (with chunked encoding, MHD will then 933for the regular end of transmission (with chunked encoding, MHD will then
982terminate the chunk and send any HTTP footers that might be 934terminate the chunk and send any HTTP footers that might be
983present; without chunked encoding and given an unknown 935present; without chunked encoding and given an unknown
984response size, @mhd{} will simply close the connection; note 936response size, MHD will simply close the connection; note
985that while returning @code{MHD_CONTENT_READER_END_OF_STREAM} is not technically 937that while returning @code{MHD_CONTENT_READER_END_OF_STREAM} is not technically
986legal if a response size was specified, MHD accepts this 938legal if a response size was specified, MHD accepts this
987and treats it just as @code{MHD_CONTENT_READER_END_WITH_ERROR}. 939and treats it just as @code{MHD_CONTENT_READER_END_WITH_ERROR}.
988 940
989@code{MHD_CONTENT_READER_END_WITH_ERROR} (-2) is used to indicate a server 941@code{MHD_CONTENT_READER_END_WITH_ERROR} (-2) is used to indicate a server
990error generating the response; this will cause @mhd{} to simply 942error generating the response; this will cause MHD to simply
991close the connection immediately. If a response size was 943close the connection immediately. If a response size was
992given or if chunked encoding is in use, this will indicate 944given or if chunked encoding is in use, this will indicate
993an error to the client. Note, however, that if the client 945an error to the client. Note, however, that if the client
@@ -995,7 +947,7 @@ does not know a response size and chunked encoding is not in
995use, then clients will not be able to tell the difference between 947use, then clients will not be able to tell the difference between
996@code{MHD_CONTENT_READER_END_WITH_ERROR} and 948@code{MHD_CONTENT_READER_END_WITH_ERROR} and
997@code{MHD_CONTENT_READER_END_OF_STREAM}. 949@code{MHD_CONTENT_READER_END_OF_STREAM}.
998This is not a limitation of @mhd{} but rather of the HTTP protocol. 950This is not a limitation of MHD but rather of the HTTP protocol.
999 951
1000@table @var 952@table @var
1001@item cls 953@item cls
@@ -1005,18 +957,18 @@ custom value selected at callback registration time;
1005position in the datastream to access; note that if an 957position in the datastream to access; note that if an
1006@code{MHD_Response} object is re-used, it is possible for the same 958@code{MHD_Response} object is re-used, it is possible for the same
1007content reader to be queried multiple times for the same data; however, 959content reader to be queried multiple times for the same data; however,
1008if an @code{MHD_Response} is not re-used, @mhd{} guarantees that 960if an @code{MHD_Response} is not re-used, MHD guarantees that
1009@var{pos} will be the sum of all non-negative return values obtained 961@var{pos} will be the sum of all non-negative return values obtained
1010from the content reader so far. 962from the content reader so far.
1011@end table 963@end table
1012 964
1013Return @code{-1} on error (@mhd{} will no longer try to read content and 965Return @code{-1} on error (MHD will no longer try to read content and
1014instead close the connection with the client). 966instead close the connection with the client).
1015@end deftypefn 967@end deftypefn
1016 968
1017 969
1018@deftypefn {Function Pointer} void {*MHD_ContentReaderFreeCallback} (void *cls) 970@deftypefn {Function Pointer} void {*MHD_ContentReaderFreeCallback} (void *cls)
1019This method is called by @mhd{} if we are done with a content reader. 971This method is called by MHD if we are done with a content reader.
1020It should be used to free resources associated with the content reader. 972It should be used to free resources associated with the content reader.
1021@end deftypefn 973@end deftypefn
1022 974
@@ -1037,13 +989,13 @@ type of the value;
1037zero-terminated key for the value; 989zero-terminated key for the value;
1038 990
1039@item filename 991@item filename
1040name of the uploaded file, @mynull{} if not known; 992name of the uploaded file, @code{NULL} if not known;
1041 993
1042@item content_type 994@item content_type
1043mime-type of the data, @mynull{} if not known; 995mime-type of the data, @code{NULL} if not known;
1044 996
1045@item transfer_encoding 997@item transfer_encoding
1046encoding of the data, @mynull{} if not known; 998encoding of the data, @code{NULL} if not known;
1047 999
1048@item data 1000@item data
1049pointer to size bytes of data at the specified offset; 1001pointer to size bytes of data at the specified offset;
@@ -1074,7 +1026,7 @@ Set a handler for fatal errors.
1074function to call if MHD encounters a fatal internal error. If no handler was set explicitly, MHD will call @code{abort}. 1026function to call if MHD encounters a fatal internal error. If no handler was set explicitly, MHD will call @code{abort}.
1075 1027
1076@item cls 1028@item cls
1077closure argument for cb; the other arguments are the name of the source file, line number and a string describing the nature of the fatal error (which can be NULL) 1029closure argument for cb; the other arguments are the name of the source file, line number and a string describing the nature of the fatal error (which can be @code{NULL})
1078@end table 1030@end table
1079@end deftypefun 1031@end deftypefun
1080 1032
@@ -1090,14 +1042,14 @@ port to bind to;
1090 1042
1091@item apc 1043@item apc
1092callback to call to check which clients will be allowed to connect; you 1044callback to call to check which clients will be allowed to connect; you
1093can pass @mynull{} in which case connections from any @acronym{IP} will be 1045can pass @code{NULL} in which case connections from any @acronym{IP} will be
1094accepted; 1046accepted;
1095 1047
1096@item apc_cls 1048@item apc_cls
1097extra argument to @var{apc}; 1049extra argument to @var{apc};
1098 1050
1099@item dh 1051@item dh
1100default handler for all @uri{}s; 1052default handler for all URIs;
1101 1053
1102@item dh_cls 1054@item dh_cls
1103extra argument to @var{dh}. 1055extra argument to @var{dh}.
@@ -1108,20 +1060,19 @@ terminated with @code{MHD_OPTION_END}). It is mandatory to use
1108@code{MHD_OPTION_END} as last argument, even when there are no 1060@code{MHD_OPTION_END} as last argument, even when there are no
1109additional arguments. 1061additional arguments.
1110 1062
1111Return @mynull{} on error, handle to daemon on success. 1063Return @code{NULL} on error, handle to daemon on success.
1112@end deftypefun 1064@end deftypefun
1113 1065
1114 1066
1115@deftypefun void MHD_stop_daemon (struct MHD_Daemon *daemon) 1067@deftypefun void MHD_stop_daemon (struct MHD_Daemon *daemon)
1116Shutdown an @http{} daemon. 1068Shutdown an HTTP daemon.
1117@end deftypefun 1069@end deftypefun
1118 1070
1119 1071
1120@deftypefun int MHD_run (struct MHD_Daemon *daemon) 1072@deftypefun int MHD_run (struct MHD_Daemon *daemon)
1121Run webserver operations (without blocking unless in client callbacks). 1073Run webserver operations (without blocking unless in client callbacks).
1122This method should be called by clients in combination with 1074This method should be called by clients in combination with
1123@cfunction{MHD_get_fdset} if the client-controlled @cfunction{select} 1075@code{MHD_get_fdset()} if the client-controlled @code{select}-method is used.
1124method is used.
1125 1076
1126Return @code{MHD_YES} on success, @code{MHD_NO} if this daemon was not 1077Return @code{MHD_YES} on success, @code{MHD_NO} if this daemon was not
1127started with the right options for this call. 1078started with the right options for this call.
@@ -1166,7 +1117,7 @@ The socket will be closed in any case.
1166 1117
1167 1118
1168@deftypefun int MHD_get_fdset (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd) 1119@deftypefun int MHD_get_fdset (struct MHD_Daemon *daemon, fd_set * read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd)
1169Obtain the @cfunction{select} sets for this daemon. The daemon's socket 1120Obtain the @code{select()} sets for this daemon. The daemon's socket
1170is added to @var{read_fd_set}. The list of currently existent 1121is added to @var{read_fd_set}. The list of currently existent
1171connections is scanned and their file descriptors added to the correct 1122connections is scanned and their file descriptors added to the correct
1172set. 1123set.
@@ -1177,7 +1128,7 @@ identifier. The variable must be set to zero before invoking this
1177function. 1128function.
1178 1129
1179Return @code{MHD_YES} on success, @code{MHD_NO} if: the arguments are 1130Return @code{MHD_YES} on success, @code{MHD_NO} if: the arguments are
1180invalid (example: @mynull{} pointers); this daemon was not started with 1131invalid (example: @code{NULL} pointers); this daemon was not started with
1181the right options for this call. 1132the right options for this call.
1182@end deftypefun 1133@end deftypefun
1183 1134
@@ -1186,7 +1137,7 @@ the right options for this call.
1186@cindex timeout 1137@cindex timeout
1187Obtain timeout value for select for this daemon (only needed if 1138Obtain timeout value for select for this daemon (only needed if
1188connection timeout is used). The returned value is how long 1139connection timeout is used). The returned value is how long
1189@cfunction{select} should at most block, not the timeout value set for 1140@code{select} should at most block, not the timeout value set for
1190connections. This function must not be called if the 1141connections. This function must not be called if the
1191@code{MHD_USE_THREAD_PER_CONNECTION} mode is in use (since then it 1142@code{MHD_USE_THREAD_PER_CONNECTION} mode is in use (since then it
1192is not meaningful to ask for a timeout, after all, there is 1143is not meaningful to ask for a timeout, after all, there is
@@ -1225,13 +1176,13 @@ order.
1225iterated over; this can be less than the number of headers if, while 1176iterated over; this can be less than the number of headers if, while
1226iterating, @var{iterator} returns @code{MHD_NO}. 1177iterating, @var{iterator} returns @code{MHD_NO}.
1227 1178
1228@var{iterator} can be @mynull{}: in this case this function just counts 1179@var{iterator} can be @code{NULL}: in this case this function just counts
1229and returns the number of headers. 1180and returns the number of headers.
1230 1181
1231In the case of @code{MHD_GET_ARGUMENT_KIND}, the @var{value} argument 1182In the case of @code{MHD_GET_ARGUMENT_KIND}, the @var{value} argument
1232will be NULL if the URL contained a key without an equals operator. 1183will be @code{NULL} if the URL contained a key without an equals operator.
1233For example, for a HTTP request to the URL ``http://foo/bar?key'', the 1184For example, for a HTTP request to the URL ``http://foo/bar?key'', the
1234@var{value} argument is NULL; in contrast, a HTTP request to the URL 1185@var{value} argument is @code{NULL}; in contrast, a HTTP request to the URL
1235``http://foo/bar?key='', the @var{value} argument is the empty string. 1186``http://foo/bar?key='', the @var{value} argument is the empty string.
1236The normal case is that the URL contains ``http://foo/bar?key=value'' 1187The normal case is that the URL contains ``http://foo/bar?key=value''
1237in which case @var{value} would be the string ``value'' and @var{key} 1188in which case @var{value} would be the string ``value'' and @var{key}
@@ -1272,13 +1223,13 @@ and @code{MHD_YES} on success.
1272@deftypefun {const char *} MHD_lookup_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key) 1223@deftypefun {const char *} MHD_lookup_connection_value (struct MHD_Connection *connection, enum MHD_ValueKind kind, const char *key)
1273Get a particular header value. If multiple values match the 1224Get a particular header value. If multiple values match the
1274@var{kind}, return one of them (the ``first'', whatever that means). 1225@var{kind}, return one of them (the ``first'', whatever that means).
1275@var{key} must reference a zero-terminated @ascii{}-coded string 1226@var{key} must reference a zero-terminated ASCII-coded string
1276representing the header to look for: it is compared against the 1227representing the header to look for: it is compared against the
1277headers using @cfunction{strcasecmp}, so case is ignored. A value of 1228headers using @code{strcasecmp()}, so case is ignored. A value of
1278NULL for @var{key} can be used to lookup 'trailing' values without a 1229@code{NULL} for @var{key} can be used to lookup 'trailing' values without a
1279key, for example if a URI is of the form 1230key, for example if a URI is of the form
1280``http://example.com/?trailer'', a @var{key} of NULL can be used to 1231``http://example.com/?trailer'', a @var{key} of @code{NULL} can be used to
1281access ``tailer" The function returns @mynull{} if no matching item 1232access ``tailer" The function returns @code{NULL} if no matching item
1282was found. 1233was found.
1283@end deftypefun 1234@end deftypefun
1284 1235
@@ -1291,7 +1242,7 @@ was found.
1291 1242
1292 1243
1293@noindent 1244@noindent
1294Response objects handling by @mhd{} is asynchronous with respect to the 1245Response objects handling by MHD is asynchronous with respect to the
1295application execution flow. Instances of the @code{MHD_Response} 1246application execution flow. Instances of the @code{MHD_Response}
1296structure are not associated to a daemon and neither to a client 1247structure are not associated to a daemon and neither to a client
1297connection: they are managed with reference counting. 1248connection: they are managed with reference counting.
@@ -1299,7 +1250,7 @@ connection: they are managed with reference counting.
1299In the simplest case: we allocate a new @code{MHD_Response} structure 1250In the simplest case: we allocate a new @code{MHD_Response} structure
1300for each response, we use it once and finally we destroy it. 1251for each response, we use it once and finally we destroy it.
1301 1252
1302@mhd{} allows more efficient resources usages. 1253MHD allows more efficient resources usages.
1303 1254
1304Example: we allocate a new @code{MHD_Response} structure for each 1255Example: we allocate a new @code{MHD_Response} structure for each
1305response @strong{kind}, we use it every time we have to give that 1256response @strong{kind}, we use it every time we have to give that
@@ -1332,31 +1283,31 @@ automatically once the response has been transmitted).
1332the connection identifying the client; 1283the connection identifying the client;
1333 1284
1334@item status_code 1285@item status_code
1335@http{} status code (i.e. @code{200} for OK); 1286HTTP status code (i.e. @code{200} for OK);
1336 1287
1337@item response 1288@item response
1338response to transmit. 1289response to transmit.
1339@end table 1290@end table
1340 1291
1341Return @code{MHD_YES} on success or if message has been queued. Return 1292Return @code{MHD_YES} on success or if message has been queued. Return
1342@code{MHD_NO}: if arguments are invalid (example: @mynull{} pointer); on 1293@code{MHD_NO}: if arguments are invalid (example: @code{NULL} pointer); on
1343error (i.e. reply already sent). 1294error (i.e. reply already sent).
1344@end deftypefun 1295@end deftypefun
1345 1296
1346 1297
1347@deftypefun void MHD_destroy_response (struct MHD_Response *response) 1298@deftypefun void MHD_destroy_response (struct MHD_Response *response)
1348Destroy a response object and associated resources (decrement the 1299Destroy a response object and associated resources (decrement the
1349reference counter). Note that @mhd{} may keep some of the resources 1300reference counter). Note that MHD may keep some of the resources
1350around if the response is still in the queue for some clients, so the 1301around if the response is still in the queue for some clients, so the
1351memory may not necessarily be freed immediately. 1302memory may not necessarily be freed immediately.
1352@end deftypefun 1303@end deftypefun
1353 1304
1354 1305
1355An explanation of reference counting@footnote{Note to readers acquainted 1306An explanation of reference counting@footnote{Note to readers acquainted
1356to the Tcl @api{}: reference counting on @code{MHD_Connection} 1307to the Tcl API: reference counting on @code{MHD_Connection}
1357structures is handled in the same way as Tcl handles @code{Tcl_Obj} 1308structures is handled in the same way as Tcl handles @code{Tcl_Obj}
1358structures through @cfunction{Tcl_IncrRefCount} and 1309structures through @code{Tcl_IncrRefCount()} and
1359@cfunction{Tcl_DecrRefCount}.}: 1310@code{Tcl_DecrRefCount()}.}:
1360 1311
1361@enumerate 1312@enumerate
1362@item 1313@item
@@ -1386,7 +1337,7 @@ MHD_destroy_response(response);
1386@item 1337@item
1387the daemon handles the connection sending the response's data to the 1338the daemon handles the connection sending the response's data to the
1388client then decrements the reference counter by calling 1339client then decrements the reference counter by calling
1389@cfunction{MHD_destroy_response}: the counter's value drops to zero and 1340@code{MHD_destroy_response()}: the counter's value drops to zero and
1390the @code{MHD_Response} object is released. 1341the @code{MHD_Response} object is released.
1391@end enumerate 1342@end enumerate
1392 1343
@@ -1407,7 +1358,7 @@ header information and then it can be used any number of times.
1407size of the data portion of the response, @code{-1} for unknown; 1358size of the data portion of the response, @code{-1} for unknown;
1408 1359
1409@item block_size 1360@item block_size
1410preferred block size for querying @var{crc} (advisory only, @mhd{} may 1361preferred block size for querying @var{crc} (advisory only, MHD may
1411still call @var{crc} using smaller chunks); this is essentially the 1362still call @var{crc} using smaller chunks); this is essentially the
1412buffer size used for @acronym{IO}, clients should pick a value that is 1363buffer size used for @acronym{IO}, clients should pick a value that is
1413appropriate for @acronym{IO} and memory performance requirements; 1364appropriate for @acronym{IO} and memory performance requirements;
@@ -1422,7 +1373,7 @@ extra argument to @var{crc};
1422callback to call to free @var{crc_cls} resources. 1373callback to call to free @var{crc_cls} resources.
1423@end table 1374@end table
1424 1375
1425Return @mynull{} on error (i.e. invalid arguments, out of memory). 1376Return @code{NULL} on error (i.e. invalid arguments, out of memory).
1426@end deftypefun 1377@end deftypefun
1427 1378
1428 1379
@@ -1443,7 +1394,7 @@ file descriptor (not a pipe or socket) since MHD might use 'sendfile'
1443or 'seek' on it. The descriptor should be in blocking-IO mode. 1394or 'seek' on it. The descriptor should be in blocking-IO mode.
1444@end table 1395@end table
1445 1396
1446Return @mynull{} on error (i.e. invalid arguments, out of memory). 1397Return @code{NULL} on error (i.e. invalid arguments, out of memory).
1447@end deftypefun 1398@end deftypefun
1448 1399
1449 1400
@@ -1451,7 +1402,7 @@ Return @mynull{} on error (i.e. invalid arguments, out of memory).
1451Create a response object. The response object can be extended with 1402Create a response object. The response object can be extended with
1452header information and then it can be used any number of times. 1403header information and then it can be used any number of times.
1453Note that you need to be a bit careful about @code{off_t} when 1404Note that you need to be a bit careful about @code{off_t} when
1454writing this code. Depending on your platform, @mhd{} is likely 1405writing this code. Depending on your platform, MHD is likely
1455to have been compiled with support for 64-bit files. When you 1406to have been compiled with support for 64-bit files. When you
1456compile your own application, you must make sure that @code{off_t} 1407compile your own application, you must make sure that @code{off_t}
1457is also a 64-bit value. If not, your compiler may pass a 32-bit 1408is also a 64-bit value. If not, your compiler may pass a 32-bit
@@ -1470,8 +1421,8 @@ also use
1470#include <microhttpd.h> 1421#include <microhttpd.h>
1471@end verbatim 1422@end verbatim
1472to ensure 64-bit @code{off_t}. Note that if your operating system 1423to ensure 64-bit @code{off_t}. Note that if your operating system
1473does not support 64-bit files, @mhd{} will be compiled with a 32-bit 1424does not support 64-bit files, MHD will be compiled with a 32-bit
1474@code{off_t} (in which case the above would be wrong...). 1425@code{off_t} (in which case the above would be wrong).
1475 1426
1476@table @var 1427@table @var
1477@item size 1428@item size
@@ -1488,7 +1439,7 @@ or 'seek' on it. The descriptor should be in blocking-IO mode.
1488offset to start reading from in the file 1439offset to start reading from in the file
1489@end table 1440@end table
1490 1441
1491Return @mynull{} on error (i.e. invalid arguments, out of memory). 1442Return @code{NULL} on error (i.e. invalid arguments, out of memory).
1492@end deftypefun 1443@end deftypefun
1493 1444
1494 1445
@@ -1507,12 +1458,12 @@ the data itself;
1507memory management options for buffer; use 1458memory management options for buffer; use
1508MHD_RESPMEM_PERSISTENT if the buffer is static/global memory, 1459MHD_RESPMEM_PERSISTENT if the buffer is static/global memory,
1509use MHD_RESPMEM_MUST_FREE if the buffer is heap-allocated and 1460use MHD_RESPMEM_MUST_FREE if the buffer is heap-allocated and
1510should be freed by @mhd{} and MHD_RESPMEM_MUST_COPY if the 1461should be freed by MHD and MHD_RESPMEM_MUST_COPY if the
1511buffer is in transient memory (i.e. on the stack) and must 1462buffer is in transient memory (i.e. on the stack) and must
1512be copied by @mhd{}; 1463be copied by MHD;
1513@end table 1464@end table
1514 1465
1515Return @mynull{} on error (i.e. invalid arguments, out of memory). 1466Return @code{NULL} on error (i.e. invalid arguments, out of memory).
1516@end deftypefun 1467@end deftypefun
1517 1468
1518 1469
@@ -1529,16 +1480,16 @@ size of the data portion of the response;
1529the data itself; 1480the data itself;
1530 1481
1531@item must_free 1482@item must_free
1532if true: @mhd{} should free data when done; 1483if true: MHD should free data when done;
1533 1484
1534@item must_copy 1485@item must_copy
1535if true: @mhd{} allocates a block of memory and use it to make a copy of 1486if true: MHD allocates a block of memory and use it to make a copy of
1536@var{data} embedded in the returned @code{MHD_Response} structure; 1487@var{data} embedded in the returned @code{MHD_Response} structure;
1537handling of the embedded memory is responsibility of @mhd{}; @var{data} 1488handling of the embedded memory is responsibility of MHD; @var{data}
1538can be released anytime after this call returns. 1489can be released anytime after this call returns.
1539@end table 1490@end table
1540 1491
1541Return @mynull{} on error (i.e. invalid arguments, out of memory). 1492Return @code{NULL} on error (i.e. invalid arguments, out of memory).
1542@end deftypefun 1493@end deftypefun
1543 1494
1544 1495
@@ -1614,7 +1565,7 @@ Get all of the headers added to a response.
1614 1565
1615Invoke the @var{iterator} callback for each header in the response, 1566Invoke the @var{iterator} callback for each header in the response,
1616using @var{iterator_cls} as first argument. Return number of entries 1567using @var{iterator_cls} as first argument. Return number of entries
1617iterated over. @var{iterator} can be @mynull{}: in this case the function 1568iterated over. @var{iterator} can be @code{NULL}: in this case the function
1618just counts headers. 1569just counts headers.
1619 1570
1620@var{iterator} should not modify the its key and value arguments, unless 1571@var{iterator} should not modify the its key and value arguments, unless
@@ -1626,7 +1577,7 @@ we know what we are doing.
1626Find and return a pointer to the value of a particular header from the 1577Find and return a pointer to the value of a particular header from the
1627response. @var{key} must reference a zero-terminated string 1578response. @var{key} must reference a zero-terminated string
1628representing the header to look for. The search is case sensitive. 1579representing the header to look for. The search is case sensitive.
1629Return @mynull{} if header does not exist or @var{key} is @mynull{}. 1580Return @code{NULL} if header does not exist or @var{key} is @code{NULL}.
1630 1581
1631We should not modify the value, unless we know what we are doing. 1582We should not modify the value, unless we know what we are doing.
1632@end deftypefun 1583@end deftypefun
@@ -1639,13 +1590,13 @@ We should not modify the value, unless we know what we are doing.
1639@chapter Utilizing Authentication 1590@chapter Utilizing Authentication
1640 1591
1641@noindent 1592@noindent
1642@mhd{} support three types of client authentication. 1593MHD support three types of client authentication.
1643 1594
1644Basic authentication uses a simple authentication method based 1595Basic authentication uses a simple authentication method based
1645on BASE64 algorithm. Username and password are exchanged in clear 1596on BASE64 algorithm. Username and password are exchanged in clear
1646between the client and the server, so this method must only be used 1597between the client and the server, so this method must only be used
1647for non-sensitive content or when the session is protected with https. 1598for non-sensitive content or when the session is protected with https.
1648When using basic authentication @mhd{} will have access to the clear 1599When using basic authentication MHD will have access to the clear
1649password, possibly allowing to create a chained authentication 1600password, possibly allowing to create a chained authentication
1650toward an external authentication server. 1601toward an external authentication server.
1651 1602
@@ -1661,7 +1612,7 @@ requires the use of HTTPS. Client certificate authentication can
1661be used simultaneously with Basic or Digest Authentication in order 1612be used simultaneously with Basic or Digest Authentication in order
1662to provide a two levels authentication (like for instance separate 1613to provide a two levels authentication (like for instance separate
1663machine and user authentication). A code example for using 1614machine and user authentication). A code example for using
1664client certificates is presented in the @mhd{} tutorial. 1615client certificates is presented in the MHD tutorial.
1665 1616
1666@menu 1617@menu
1667* microhttpd-dauth basic:: Using Basic Authentication. 1618* microhttpd-dauth basic:: Using Basic Authentication.
@@ -1676,11 +1627,11 @@ client certificates is presented in the @mhd{} tutorial.
1676 1627
1677@deftypefun {char *} MHD_basic_auth_get_username_password (struct MHD_Connection *connection, char** password) 1628@deftypefun {char *} MHD_basic_auth_get_username_password (struct MHD_Connection *connection, char** password)
1678Get the username and password from the basic authorization header sent by the client. 1629Get the username and password from the basic authorization header sent by the client.
1679Return @mynull{} if no username could be found, a pointer to the username if found. 1630Return @code{NULL} if no username could be found, a pointer to the username if found.
1680If returned value is not @mynull{}, the value must be @code{free()}'ed. 1631If returned value is not @code{NULL}, the value must be @code{free()}'ed.
1681 1632
1682@var{password} reference a buffer to store the password. It can be @mynull{}. 1633@var{password} reference a buffer to store the password. It can be @code{NULL}.
1683If returned value is not @mynull{}, the value must be @code{free()}'ed. 1634If returned value is not @code{NULL}, the value must be @code{free()}'ed.
1684@end deftypefun 1635@end deftypefun
1685 1636
1686@deftypefun {int} MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, const char *realm, struct MHD_Response *response) 1637@deftypefun {int} MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection, const char *realm, struct MHD_Response *response)
@@ -1701,8 +1652,8 @@ client with a 401 HTTP status.
1701 1652
1702@deftypefun {char *} MHD_digest_auth_get_username (struct MHD_Connection *connection) 1653@deftypefun {char *} MHD_digest_auth_get_username (struct MHD_Connection *connection)
1703Find and return a pointer to the username value from the request header. 1654Find and return a pointer to the username value from the request header.
1704Return @mynull{} if the value is not found or header does not exist. 1655Return @code{NULL} if the value is not found or header does not exist.
1705If returned value is not @mynull{}, the value must be @code{free()}'ed. 1656If returned value is not @code{NULL}, the value must be @code{free()}'ed.
1706@end deftypefun 1657@end deftypefun
1707 1658
1708@deftypefun int MHD_digest_auth_check (struct MHD_Connection *connection, const char *realm, const char *username, const char *password, unsigned int nonce_timeout) 1659@deftypefun int MHD_digest_auth_check (struct MHD_Connection *connection, const char *realm, const char *username, const char *password, unsigned int nonce_timeout)
@@ -1816,7 +1767,7 @@ ahc_echo (void *cls,
1816 1767
1817 1768
1818@noindent 1769@noindent
1819@mhd{} provides the post processor API to make it easier for applications to 1770MHD provides the post processor API to make it easier for applications to
1820parse the data of a client's @code{POST} request: the 1771parse the data of a client's @code{POST} request: the
1821@code{MHD_AccessHandlerCallback} will be invoked multiple times to 1772@code{MHD_AccessHandlerCallback} will be invoked multiple times to
1822process data as it arrives; at each invocation a new chunk of data must 1773process data as it arrives; at each invocation a new chunk of data must
@@ -1824,10 +1775,10 @@ be processed. The arguments @var{upload_data} and @var{upload_data_size}
1824are used to reference the chunk of data. 1775are used to reference the chunk of data.
1825 1776
1826When @code{MHD_AccessHandlerCallback} is invoked for a new connection: 1777When @code{MHD_AccessHandlerCallback} is invoked for a new connection:
1827its @code{*@var{con_cls}} argument is set to @mynull{}. When @code{POST} 1778its @code{*@var{con_cls}} argument is set to @code{NULL}. When @code{POST}
1828data comes in the upload buffer it is @strong{mandatory} to use the 1779data comes in the upload buffer it is @strong{mandatory} to use the
1829@var{con_cls} to store a reference to per-connection data. The fact 1780@var{con_cls} to store a reference to per-connection data. The fact
1830that the pointer was initially @mynull{} can be used to detect that 1781that the pointer was initially @code{NULL} can be used to detect that
1831this is a new request. 1782this is a new request.
1832 1783
1833One method to detect that a new connection was established is 1784One method to detect that a new connection was established is
@@ -1843,7 +1794,7 @@ access_handler (void *cls,
1843 void **con_cls) 1794 void **con_cls)
1844@{ 1795@{
1845 static int old_connection_marker; 1796 static int old_connection_marker;
1846 int new_connection = (MYNULL == *con_cls); 1797 int new_connection = (NULL == *con_cls);
1847 1798
1848 if (new_connection) 1799 if (new_connection)
1849 @{ 1800 @{
@@ -1921,13 +1872,13 @@ should be sufficient; do @strong{NOT} use a value smaller than 256;
1921 1872
1922@item iterator 1873@item iterator
1923iterator to be called with the parsed data; must @strong{NOT} be 1874iterator to be called with the parsed data; must @strong{NOT} be
1924@mynull{}; 1875@code{NULL};
1925 1876
1926@item iterator_cls 1877@item iterator_cls
1927custom value to be used as first argument to @var{iterator}. 1878custom value to be used as first argument to @var{iterator}.
1928@end table 1879@end table
1929 1880
1930Return @mynull{} on error (out of memory, unsupported encoding), otherwise 1881Return @code{NULL} on error (out of memory, unsupported encoding), otherwise
1931a PP handle. 1882a PP handle.
1932@end deftypefun 1883@end deftypefun
1933 1884
@@ -2007,7 +1958,7 @@ infoType)
2007@end table 1958@end table
2008 1959
2009Returns a union with the respective member (depending on 1960Returns a union with the respective member (depending on
2010infoType) set to the desired information), or NULL 1961infoType) set to the desired information), or @code{NULL}
2011in case the desired information is not available or 1962in case the desired information is not available or
2012applicable. 1963applicable.
2013@end deftypefun 1964@end deftypefun
@@ -2061,7 +2012,7 @@ infoType)
2061@end table 2012@end table
2062 2013
2063Returns a union with the respective member (depending on 2014Returns a union with the respective member (depending on
2064infoType) set to the desired information), or NULL 2015infoType) set to the desired information), or @code{NULL}
2065in case the desired information is not available or 2016in case the desired information is not available or
2066applicable. 2017applicable.
2067@end deftypefun 2018@end deftypefun
@@ -2075,12 +2026,12 @@ connection is desired.
2075@item MHD_CONNECTION_INFO_CIPHER_ALGO 2026@item MHD_CONNECTION_INFO_CIPHER_ALGO
2076What cipher algorithm is being used (HTTPS connections only). 2027What cipher algorithm is being used (HTTPS connections only).
2077Takes no extra arguments. 2028Takes no extra arguments.
2078NULL is returned for non-HTTPS connections. 2029@code{NULL} is returned for non-HTTPS connections.
2079 2030
2080@item MHD_CONNECTION_INFO_PROTOCOL, 2031@item MHD_CONNECTION_INFO_PROTOCOL,
2081Takes no extra arguments. Allows finding out the TLS/SSL protocol used 2032Takes no extra arguments. Allows finding out the TLS/SSL protocol used
2082(HTTPS connections only). 2033(HTTPS connections only).
2083NULL is returned for non-HTTPS connections. 2034@code{NULL} is returned for non-HTTPS connections.
2084 2035
2085@item MHD_CONNECTION_INFO_CLIENT_ADDRESS 2036@item MHD_CONNECTION_INFO_CLIENT_ADDRESS
2086Returns information about the address of the client. Returns 2037Returns information about the address of the client. Returns
@@ -2092,7 +2043,7 @@ a @code{struct sockaddr *}).
2092Takes no extra arguments. Allows access to the underlying GNUtls session, 2043Takes no extra arguments. Allows access to the underlying GNUtls session,
2093including access to the underlying GNUtls client certificate 2044including access to the underlying GNUtls client certificate
2094(HTTPS connections only). Takes no extra arguments. 2045(HTTPS connections only). Takes no extra arguments.
2095NULL is returned for non-HTTPS connections. 2046@code{NULL} is returned for non-HTTPS connections.
2096 2047
2097@item MHD_CONNECTION_INFO_GNUTLS_CLIENT_CERT, 2048@item MHD_CONNECTION_INFO_GNUTLS_CLIENT_CERT,
2098Dysfunctional (never implemented, deprecated). Use 2049Dysfunctional (never implemented, deprecated). Use
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index 91408263..85b68e79 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -3,11 +3,11 @@
3% Load plain if necessary, i.e., if running under initex. 3% Load plain if necessary, i.e., if running under initex.
4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi 4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
5% 5%
6\def\texinfoversion{2009-08-14.15} 6\def\texinfoversion{2012-03-11.15}
7% 7%
8% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 8% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
10% 2007, 2008, 2009 Free Software Foundation, Inc. 10% 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
11% 11%
12% This texinfo.tex file is free software: you can redistribute it and/or 12% This texinfo.tex file is free software: you can redistribute it and/or
13% modify it under the terms of the GNU General Public License as 13% modify it under the terms of the GNU General Public License as
@@ -65,7 +65,6 @@
65\everyjob{\message{[Texinfo version \texinfoversion]}% 65\everyjob{\message{[Texinfo version \texinfoversion]}%
66 \catcode`+=\active \catcode`\_=\active} 66 \catcode`+=\active \catcode`\_=\active}
67 67
68
69\chardef\other=12 68\chardef\other=12
70 69
71% We never want plain's \outer definition of \+ in Texinfo. 70% We never want plain's \outer definition of \+ in Texinfo.
@@ -93,14 +92,13 @@
93\let\ptexnewwrite\newwrite 92\let\ptexnewwrite\newwrite
94\let\ptexnoindent=\noindent 93\let\ptexnoindent=\noindent
95\let\ptexplus=+ 94\let\ptexplus=+
95\let\ptexraggedright=\raggedright
96\let\ptexrbrace=\} 96\let\ptexrbrace=\}
97\let\ptexslash=\/ 97\let\ptexslash=\/
98\let\ptexstar=\* 98\let\ptexstar=\*
99\let\ptext=\t 99\let\ptext=\t
100\let\ptextop=\top 100\let\ptextop=\top
101{\catcode`\'=\active 101{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
102\global\let\ptexquoteright'}% Math-mode def from plain.tex.
103\let\ptexraggedright=\raggedright
104 102
105% If this character appears in an error message or help string, it 103% If this character appears in an error message or help string, it
106% starts a new line in the output. 104% starts a new line in the output.
@@ -118,10 +116,11 @@
118% Set up fixed words for English if not already set. 116% Set up fixed words for English if not already set.
119\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi 117\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
120\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi 118\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
119\ifx\putworderror\undefined \gdef\putworderror{error}\fi
121\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi 120\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
122\ifx\putwordin\undefined \gdef\putwordin{in}\fi 121\ifx\putwordin\undefined \gdef\putwordin{in}\fi
123\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi 122\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
124\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi 123\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
125\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi 124\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
126\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi 125\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
127\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi 126\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
@@ -160,15 +159,18 @@
160\def\spaceisspace{\catcode`\ =\spacecat} 159\def\spaceisspace{\catcode`\ =\spacecat}
161 160
162% sometimes characters are active, so we need control sequences. 161% sometimes characters are active, so we need control sequences.
162\chardef\ampChar = `\&
163\chardef\colonChar = `\: 163\chardef\colonChar = `\:
164\chardef\commaChar = `\, 164\chardef\commaChar = `\,
165\chardef\dashChar = `\- 165\chardef\dashChar = `\-
166\chardef\dotChar = `\. 166\chardef\dotChar = `\.
167\chardef\exclamChar= `\! 167\chardef\exclamChar= `\!
168\chardef\hashChar = `\#
168\chardef\lquoteChar= `\` 169\chardef\lquoteChar= `\`
169\chardef\questChar = `\? 170\chardef\questChar = `\?
170\chardef\rquoteChar= `\' 171\chardef\rquoteChar= `\'
171\chardef\semiChar = `\; 172\chardef\semiChar = `\;
173\chardef\slashChar = `\/
172\chardef\underChar = `\_ 174\chardef\underChar = `\_
173 175
174% Ignore a token. 176% Ignore a token.
@@ -199,36 +201,7 @@
199% that mark overfull boxes (in case you have decided 201% that mark overfull boxes (in case you have decided
200% that the text looks ok even though it passes the margin). 202% that the text looks ok even though it passes the margin).
201% 203%
202\def\finalout{\overfullrule=0pt} 204\def\finalout{\overfullrule=0pt }
203
204% @| inserts a changebar to the left of the current line. It should
205% surround any changed text. This approach does *not* work if the
206% change spans more than two lines of output. To handle that, we would
207% have adopt a much more difficult approach (putting marks into the main
208% vertical list for the beginning and end of each change).
209%
210\def\|{%
211 % \vadjust can only be used in horizontal mode.
212 \leavevmode
213 %
214 % Append this vertical mode material after the current line in the output.
215 \vadjust{%
216 % We want to insert a rule with the height and depth of the current
217 % leading; that is exactly what \strutbox is supposed to record.
218 \vskip-\baselineskip
219 %
220 % \vadjust-items are inserted at the left edge of the type. So
221 % the \llap here moves out into the left-hand margin.
222 \llap{%
223 %
224 % For a thicker or thinner bar, change the `1pt'.
225 \vrule height\baselineskip width1pt
226 %
227 % This is the space between the bar and the text.
228 \hskip 12pt
229 }%
230 }%
231}
232 205
233% Sometimes it is convenient to have everything in the transcript file 206% Sometimes it is convenient to have everything in the transcript file
234% and nothing on the terminal. We don't just call \tracingall here, 207% and nothing on the terminal. We don't just call \tracingall here,
@@ -246,7 +219,7 @@
246 \tracingmacros2 219 \tracingmacros2
247 \tracingrestores1 220 \tracingrestores1
248 \showboxbreadth\maxdimen \showboxdepth\maxdimen 221 \showboxbreadth\maxdimen \showboxdepth\maxdimen
249 \ifx\eTeXversion\undefined\else % etex gives us more logging 222 \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
250 \tracingscantokens1 223 \tracingscantokens1
251 \tracingifs1 224 \tracingifs1
252 \tracinggroups1 225 \tracinggroups1
@@ -257,6 +230,13 @@
257 \errorcontextlines16 230 \errorcontextlines16
258}% 231}%
259 232
233% @errormsg{MSG}. Do the index-like expansions on MSG, but if things
234% aren't perfect, it's not the end of the world, being an error message,
235% after all.
236%
237\def\errormsg{\begingroup \indexnofonts \doerrormsg}
238\def\doerrormsg#1{\errmessage{#1}}
239
260% add check for \lastpenalty to plain's definitions. If the last thing 240% add check for \lastpenalty to plain's definitions. If the last thing
261% we did was a \nobreak, we don't want to insert more space. 241% we did was a \nobreak, we don't want to insert more space.
262% 242%
@@ -267,7 +247,6 @@
267\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount 247\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
268 \removelastskip\penalty-200\bigskip\fi\fi} 248 \removelastskip\penalty-200\bigskip\fi\fi}
269 249
270% For @cropmarks command.
271% Do @cropmarks to get crop marks. 250% Do @cropmarks to get crop marks.
272% 251%
273\newif\ifcropmarks 252\newif\ifcropmarks
@@ -577,7 +556,7 @@
577} 556}
578\def\inenvironment#1{% 557\def\inenvironment#1{%
579 \ifx#1\empty 558 \ifx#1\empty
580 out of any environment% 559 outside of any environment%
581 \else 560 \else
582 in environment \expandafter\string#1% 561 in environment \expandafter\string#1%
583 \fi 562 \fi
@@ -589,7 +568,7 @@
589\parseargdef\end{% 568\parseargdef\end{%
590 \if 1\csname iscond.#1\endcsname 569 \if 1\csname iscond.#1\endcsname
591 \else 570 \else
592 % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 571 % The general wording of \badenverr may not be ideal.
593 \expandafter\checkenv\csname#1\endcsname 572 \expandafter\checkenv\csname#1\endcsname
594 \csname E#1\endcsname 573 \csname E#1\endcsname
595 \endgroup 574 \endgroup
@@ -599,85 +578,6 @@
599\newhelp\EMsimple{Press RETURN to continue.} 578\newhelp\EMsimple{Press RETURN to continue.}
600 579
601 580
602%% Simple single-character @ commands
603
604% @@ prints an @
605% Kludge this until the fonts are right (grr).
606\def\@{{\tt\char64}}
607
608% This is turned off because it was never documented
609% and you can use @w{...} around a quote to suppress ligatures.
610%% Define @` and @' to be the same as ` and '
611%% but suppressing ligatures.
612%\def\`{{`}}
613%\def\'{{'}}
614
615% Used to generate quoted braces.
616\def\mylbrace {{\tt\char123}}
617\def\myrbrace {{\tt\char125}}
618\let\{=\mylbrace
619\let\}=\myrbrace
620\begingroup
621 % Definitions to produce \{ and \} commands for indices,
622 % and @{ and @} for the aux/toc files.
623 \catcode`\{ = \other \catcode`\} = \other
624 \catcode`\[ = 1 \catcode`\] = 2
625 \catcode`\! = 0 \catcode`\\ = \other
626 !gdef!lbracecmd[\{]%
627 !gdef!rbracecmd[\}]%
628 !gdef!lbraceatcmd[@{]%
629 !gdef!rbraceatcmd[@}]%
630!endgroup
631
632% @comma{} to avoid , parsing problems.
633\let\comma = ,
634
635% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
636% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
637\let\, = \c
638\let\dotaccent = \.
639\def\ringaccent#1{{\accent23 #1}}
640\let\tieaccent = \t
641\let\ubaraccent = \b
642\let\udotaccent = \d
643
644% Other special characters: @questiondown @exclamdown @ordf @ordm
645% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
646\def\questiondown{?`}
647\def\exclamdown{!`}
648\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
649\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
650
651% Dotless i and dotless j, used for accents.
652\def\imacro{i}
653\def\jmacro{j}
654\def\dotless#1{%
655 \def\temp{#1}%
656 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
657 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
658 \else \errmessage{@dotless can be used only with i or j}%
659 \fi\fi
660}
661
662% The \TeX{} logo, as in plain, but resetting the spacing so that a
663% period following counts as ending a sentence. (Idea found in latex.)
664%
665\edef\TeX{\TeX \spacefactor=1000 }
666
667% @LaTeX{} logo. Not quite the same results as the definition in
668% latex.ltx, since we use a different font for the raised A; it's most
669% convenient for us to use an explicitly smaller font, rather than using
670% the \scriptstyle font (since we don't reset \scriptstyle and
671% \scriptscriptstyle).
672%
673\def\LaTeX{%
674 L\kern-.36em
675 {\setbox0=\hbox{T}%
676 \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}%
677 \kern-.15em
678 \TeX
679}
680
681% Be sure we're in horizontal mode when doing a tie, since we make space 581% Be sure we're in horizontal mode when doing a tie, since we make space
682% equivalent to this in @example-like environments. Otherwise, a space 582% equivalent to this in @example-like environments. Otherwise, a space
683% at the beginning of a line will start with \penalty -- and 583% at the beginning of a line will start with \penalty -- and
@@ -719,7 +619,7 @@
719 \else\ifx\temp\offword \plainnonfrenchspacing 619 \else\ifx\temp\offword \plainnonfrenchspacing
720 \else 620 \else
721 \errhelp = \EMsimple 621 \errhelp = \EMsimple
722 \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% 622 \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
723 \fi\fi 623 \fi\fi
724} 624}
725 625
@@ -801,15 +701,6 @@ where each line of input produces a line of output.}
801 701
802\newdimen\mil \mil=0.001in 702\newdimen\mil \mil=0.001in
803 703
804% Old definition--didn't work.
805%\parseargdef\need{\par %
806%% This method tries to make TeX break the page naturally
807%% if the depth of the box does not fit.
808%{\baselineskip=0pt%
809%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
810%\prevdepth=-1000pt
811%}}
812
813\parseargdef\need{% 704\parseargdef\need{%
814 % Ensure vertical mode, so we don't make a big box in the middle of a 705 % Ensure vertical mode, so we don't make a big box in the middle of a
815 % paragraph. 706 % paragraph.
@@ -873,7 +764,7 @@ where each line of input produces a line of output.}
873 764
874% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current 765% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
875% paragraph. For more general purposes, use the \margin insertion 766% paragraph. For more general purposes, use the \margin insertion
876% class. WHICH is `l' or `r'. 767% class. WHICH is `l' or `r'. Not documented, written for gawk manual.
877% 768%
878\newskip\inmarginspacing \inmarginspacing=1cm 769\newskip\inmarginspacing \inmarginspacing=1cm
879\def\strutdepth{\dp\strutbox} 770\def\strutdepth{\dp\strutbox}
@@ -920,6 +811,36 @@ where each line of input produces a line of output.}
920 \temp 811 \temp
921} 812}
922 813
814% @| inserts a changebar to the left of the current line. It should
815% surround any changed text. This approach does *not* work if the
816% change spans more than two lines of output. To handle that, we would
817% have adopt a much more difficult approach (putting marks into the main
818% vertical list for the beginning and end of each change). This command
819% is not documented, not supported, and doesn't work.
820%
821\def\|{%
822 % \vadjust can only be used in horizontal mode.
823 \leavevmode
824 %
825 % Append this vertical mode material after the current line in the output.
826 \vadjust{%
827 % We want to insert a rule with the height and depth of the current
828 % leading; that is exactly what \strutbox is supposed to record.
829 \vskip-\baselineskip
830 %
831 % \vadjust-items are inserted at the left edge of the type. So
832 % the \llap here moves out into the left-hand margin.
833 \llap{%
834 %
835 % For a thicker or thinner bar, change the `1pt'.
836 \vrule height\baselineskip width1pt
837 %
838 % This is the space between the bar and the text.
839 \hskip 12pt
840 }%
841 }%
842}
843
923% @include FILE -- \input text of FILE. 844% @include FILE -- \input text of FILE.
924% 845%
925\def\include{\parseargusing\filenamecatcodes\includezzz} 846\def\include{\parseargusing\filenamecatcodes\includezzz}
@@ -930,6 +851,7 @@ where each line of input produces a line of output.}
930 \makevalueexpandable % we want to expand any @value in FILE. 851 \makevalueexpandable % we want to expand any @value in FILE.
931 \turnoffactive % and allow special characters in the expansion 852 \turnoffactive % and allow special characters in the expansion
932 \indexnofonts % Allow `@@' and other weird things in file names. 853 \indexnofonts % Allow `@@' and other weird things in file names.
854 \wlog{texinfo.tex: doing @include of #1^^J}%
933 \edef\temp{\noexpand\input #1 }% 855 \edef\temp{\noexpand\input #1 }%
934 % 856 %
935 % This trickery is to read FILE outside of a group, in case it makes 857 % This trickery is to read FILE outside of a group, in case it makes
@@ -965,7 +887,7 @@ where each line of input produces a line of output.}
965\def\popthisfilestack{\errthisfilestackempty} 887\def\popthisfilestack{\errthisfilestackempty}
966\def\errthisfilestackempty{\errmessage{Internal error: 888\def\errthisfilestackempty{\errmessage{Internal error:
967 the stack of filenames is empty.}} 889 the stack of filenames is empty.}}
968 890%
969\def\thisfile{} 891\def\thisfile{}
970 892
971% @center line 893% @center line
@@ -973,36 +895,46 @@ where each line of input produces a line of output.}
973% 895%
974\parseargdef\center{% 896\parseargdef\center{%
975 \ifhmode 897 \ifhmode
976 \let\next\centerH 898 \let\centersub\centerH
977 \else 899 \else
978 \let\next\centerV 900 \let\centersub\centerV
979 \fi 901 \fi
980 \next{\hfil \ignorespaces#1\unskip \hfil}% 902 \centersub{\hfil \ignorespaces#1\unskip \hfil}%
903 \let\centersub\relax % don't let the definition persist, just in case
981} 904}
982\def\centerH#1{% 905\def\centerH#1{{%
983 {% 906 \hfil\break
984 \hfil\break 907 \advance\hsize by -\leftskip
985 \advance\hsize by -\leftskip 908 \advance\hsize by -\rightskip
986 \advance\hsize by -\rightskip 909 \line{#1}%
987 \line{#1}% 910 \break
988 \break 911}}
989 }% 912%
913\newcount\centerpenalty
914\def\centerV#1{%
915 % The idea here is the same as in \startdefun, \cartouche, etc.: if
916 % @center is the first thing after a section heading, we need to wipe
917 % out the negative parskip inserted by \sectionheading, but still
918 % prevent a page break here.
919 \centerpenalty = \lastpenalty
920 \ifnum\centerpenalty>10000 \vskip\parskip \fi
921 \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
922 \line{\kern\leftskip #1\kern\rightskip}%
990} 923}
991\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}}
992 924
993% @sp n outputs n lines of vertical space 925% @sp n outputs n lines of vertical space
994 926%
995\parseargdef\sp{\vskip #1\baselineskip} 927\parseargdef\sp{\vskip #1\baselineskip}
996 928
997% @comment ...line which is ignored... 929% @comment ...line which is ignored...
998% @c is the same as @comment 930% @c is the same as @comment
999% @ignore ... @end ignore is another way to write a comment 931% @ignore ... @end ignore is another way to write a comment
1000 932%
1001\def\comment{\begingroup \catcode`\^^M=\other% 933\def\comment{\begingroup \catcode`\^^M=\other%
1002\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% 934\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
1003\commentxxx} 935\commentxxx}
1004{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} 936{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
1005 937%
1006\let\c=\comment 938\let\c=\comment
1007 939
1008% @paragraphindent NCHARS 940% @paragraphindent NCHARS
@@ -1095,109 +1027,6 @@ where each line of input produces a line of output.}
1095} 1027}
1096 1028
1097 1029
1098% @asis just yields its argument. Used with @table, for example.
1099%
1100\def\asis#1{#1}
1101
1102% @math outputs its argument in math mode.
1103%
1104% One complication: _ usually means subscripts, but it could also mean
1105% an actual _ character, as in @math{@var{some_variable} + 1}. So make
1106% _ active, and distinguish by seeing if the current family is \slfam,
1107% which is what @var uses.
1108{
1109 \catcode`\_ = \active
1110 \gdef\mathunderscore{%
1111 \catcode`\_=\active
1112 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
1113 }
1114}
1115% Another complication: we want \\ (and @\) to output a \ character.
1116% FYI, plain.tex uses \\ as a temporary control sequence (why?), but
1117% this is not advertised and we don't care. Texinfo does not
1118% otherwise define @\.
1119%
1120% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
1121\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
1122%
1123\def\math{%
1124 \tex
1125 \mathunderscore
1126 \let\\ = \mathbackslash
1127 \mathactive
1128 % make the texinfo accent commands work in math mode
1129 \let\"=\ddot
1130 \let\'=\acute
1131 \let\==\bar
1132 \let\^=\hat
1133 \let\`=\grave
1134 \let\u=\breve
1135 \let\v=\check
1136 \let\~=\tilde
1137 \let\dotaccent=\dot
1138 $\finishmath
1139}
1140\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
1141
1142% Some active characters (such as <) are spaced differently in math.
1143% We have to reset their definitions in case the @math was an argument
1144% to a command which sets the catcodes (such as @item or @section).
1145%
1146{
1147 \catcode`^ = \active
1148 \catcode`< = \active
1149 \catcode`> = \active
1150 \catcode`+ = \active
1151 \catcode`' = \active
1152 \gdef\mathactive{%
1153 \let^ = \ptexhat
1154 \let< = \ptexless
1155 \let> = \ptexgtr
1156 \let+ = \ptexplus
1157 \let' = \ptexquoteright
1158 }
1159}
1160
1161% Some math mode symbols.
1162\def\bullet{$\ptexbullet$}
1163\def\geq{\ifmmode \ge\else $\ge$\fi}
1164\def\leq{\ifmmode \le\else $\le$\fi}
1165\def\minus{\ifmmode -\else $-$\fi}
1166
1167% @dots{} outputs an ellipsis using the current font.
1168% We do .5em per period so that it has the same spacing in the cm
1169% typewriter fonts as three actual period characters; on the other hand,
1170% in other typewriter fonts three periods are wider than 1.5em. So do
1171% whichever is larger.
1172%
1173\def\dots{%
1174 \leavevmode
1175 \setbox0=\hbox{...}% get width of three periods
1176 \ifdim\wd0 > 1.5em
1177 \dimen0 = \wd0
1178 \else
1179 \dimen0 = 1.5em
1180 \fi
1181 \hbox to \dimen0{%
1182 \hskip 0pt plus.25fil
1183 .\hskip 0pt plus1fil
1184 .\hskip 0pt plus1fil
1185 .\hskip 0pt plus.5fil
1186 }%
1187}
1188
1189% @enddots{} is an end-of-sentence ellipsis.
1190%
1191\def\enddots{%
1192 \dots
1193 \spacefactor=\endofsentencespacefactor
1194}
1195
1196% @comma{} is so commas can be inserted into text without messing up
1197% Texinfo's parsing.
1198%
1199\let\comma = ,
1200
1201% @refill is a no-op. 1030% @refill is a no-op.
1202\let\refill=\relax 1031\let\refill=\relax
1203 1032
@@ -1262,9 +1091,8 @@ where each line of input produces a line of output.}
1262\newif\ifpdfmakepagedest 1091\newif\ifpdfmakepagedest
1263 1092
1264% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 1093% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
1265% can be set). So we test for \relax and 0 as well as \undefined, 1094% can be set). So we test for \relax and 0 as well as being undefined.
1266% borrowed from ifpdf.sty. 1095\ifx\pdfoutput\thisisundefined
1267\ifx\pdfoutput\undefined
1268\else 1096\else
1269 \ifx\pdfoutput\relax 1097 \ifx\pdfoutput\relax
1270 \else 1098 \else
@@ -1279,50 +1107,24 @@ where each line of input produces a line of output.}
1279% for display in the outlines, and in other places. Thus, we have to 1107% for display in the outlines, and in other places. Thus, we have to
1280% double any backslashes. Otherwise, a name like "\node" will be 1108% double any backslashes. Otherwise, a name like "\node" will be
1281% interpreted as a newline (\n), followed by o, d, e. Not good. 1109% interpreted as a newline (\n), followed by o, d, e. Not good.
1282% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html 1110%
1283% (and related messages, the final outcome is that it is up to the TeX 1111% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
1284% user to double the backslashes and otherwise make the string valid, so 1112% related messages. The final outcome is that it is up to the TeX user
1285% that's what we do). 1113% to double the backslashes and otherwise make the string valid, so
1286 1114% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
1287% double active backslashes. 1115% do this reliably, so we use it.
1288% 1116
1289{\catcode`\@=0 \catcode`\\=\active 1117% #1 is a control sequence in which to do the replacements,
1290 @gdef@activebackslashdouble{% 1118% which we \xdef.
1291 @catcode`@\=@active 1119\def\txiescapepdf#1{%
1292 @let\=@doublebackslash} 1120 \ifx\pdfescapestring\relax
1293} 1121 % No primitive available; should we give a warning or log?
1294 1122 % Many times it won't matter.
1295% To handle parens, we must adopt a different approach, since parens are 1123 \else
1296% not active characters. hyperref.dtx (which has the same problem as 1124 % The expandable \pdfescapestring primitive escapes parentheses,
1297% us) handles it with this amazing macro to replace tokens, with minor 1125 % backslashes, and other special chars.
1298% changes for Texinfo. It is included here under the GPL by permission 1126 \xdef#1{\pdfescapestring{#1}}%
1299% from the author, Heiko Oberdiek. 1127 \fi
1300%
1301% #1 is the tokens to replace.
1302% #2 is the replacement.
1303% #3 is the control sequence with the string.
1304%
1305\def\HyPsdSubst#1#2#3{%
1306 \def\HyPsdReplace##1#1##2\END{%
1307 ##1%
1308 \ifx\\##2\\%
1309 \else
1310 #2%
1311 \HyReturnAfterFi{%
1312 \HyPsdReplace##2\END
1313 }%
1314 \fi
1315 }%
1316 \xdef#3{\expandafter\HyPsdReplace#3#1\END}%
1317}
1318\long\def\HyReturnAfterFi#1\fi{\fi#1}
1319
1320% #1 is a control sequence in which to do the replacements.
1321\def\backslashparens#1{%
1322 \xdef#1{#1}% redefine it as its expansion; the definition is simply
1323 % \lastnode when called from \setref -> \pdfmkdest.
1324 \HyPsdSubst{(}{\realbackslash(}{#1}%
1325 \HyPsdSubst{)}{\realbackslash)}{#1}%
1326} 1128}
1327 1129
1328\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images 1130\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
@@ -1381,32 +1183,34 @@ output) for that.)}
1381 % 1183 %
1382 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto). 1184 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1383 \def\dopdfimage#1#2#3{% 1185 \def\dopdfimage#1#2#3{%
1384 \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}% 1186 \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1385 \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}% 1187 \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1386 % 1188 %
1387 % pdftex (and the PDF format) support .png, .jpg, .pdf (among 1189 % pdftex (and the PDF format) support .pdf, .png, .jpg (among
1388 % others). Let's try in that order. 1190 % others). Let's try in that order, PDF first since if
1191 % someone has a scalable image, presumably better to use that than a
1192 % bitmap.
1389 \let\pdfimgext=\empty 1193 \let\pdfimgext=\empty
1390 \begingroup 1194 \begingroup
1391 \openin 1 #1.png \ifeof 1 1195 \openin 1 #1.pdf \ifeof 1
1392 \openin 1 #1.jpg \ifeof 1 1196 \openin 1 #1.PDF \ifeof 1
1393 \openin 1 #1.jpeg \ifeof 1 1197 \openin 1 #1.png \ifeof 1
1394 \openin 1 #1.JPG \ifeof 1 1198 \openin 1 #1.jpg \ifeof 1
1395 \openin 1 #1.pdf \ifeof 1 1199 \openin 1 #1.jpeg \ifeof 1
1396 \openin 1 #1.PDF \ifeof 1 1200 \openin 1 #1.JPG \ifeof 1
1397 \errhelp = \nopdfimagehelp 1201 \errhelp = \nopdfimagehelp
1398 \errmessage{Could not find image file #1 for pdf}% 1202 \errmessage{Could not find image file #1 for pdf}%
1399 \else \gdef\pdfimgext{PDF}% 1203 \else \gdef\pdfimgext{JPG}%
1400 \fi 1204 \fi
1401 \else \gdef\pdfimgext{pdf}% 1205 \else \gdef\pdfimgext{jpeg}%
1402 \fi 1206 \fi
1403 \else \gdef\pdfimgext{JPG}% 1207 \else \gdef\pdfimgext{jpg}%
1404 \fi 1208 \fi
1405 \else \gdef\pdfimgext{jpeg}% 1209 \else \gdef\pdfimgext{png}%
1406 \fi 1210 \fi
1407 \else \gdef\pdfimgext{jpg}% 1211 \else \gdef\pdfimgext{PDF}%
1408 \fi 1212 \fi
1409 \else \gdef\pdfimgext{png}% 1213 \else \gdef\pdfimgext{pdf}%
1410 \fi 1214 \fi
1411 \closein 1 1215 \closein 1
1412 \endgroup 1216 \endgroup
@@ -1418,8 +1222,8 @@ output) for that.)}
1418 \else 1222 \else
1419 \immediate\pdfximage 1223 \immediate\pdfximage
1420 \fi 1224 \fi
1421 \ifdim \wd0 >0pt width \imagewidth \fi 1225 \ifdim \wd0 >0pt width \pdfimagewidth \fi
1422 \ifdim \wd2 >0pt height \imageheight \fi 1226 \ifdim \wd2 >0pt height \pdfimageheight \fi
1423 \ifnum\pdftexversion<13 1227 \ifnum\pdftexversion<13
1424 #1.\pdfimgext 1228 #1.\pdfimgext
1425 \else 1229 \else
@@ -1434,10 +1238,9 @@ output) for that.)}
1434 % such as \, aren't expanded when present in a section title. 1238 % such as \, aren't expanded when present in a section title.
1435 \indexnofonts 1239 \indexnofonts
1436 \turnoffactive 1240 \turnoffactive
1437 \activebackslashdouble
1438 \makevalueexpandable 1241 \makevalueexpandable
1439 \def\pdfdestname{#1}% 1242 \def\pdfdestname{#1}%
1440 \backslashparens\pdfdestname 1243 \txiescapepdf\pdfdestname
1441 \safewhatsit{\pdfdest name{\pdfdestname} xyz}% 1244 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1442 }} 1245 }}
1443 % 1246 %
@@ -1469,29 +1272,24 @@ output) for that.)}
1469 % page number. We could generate a destination for the section 1272 % page number. We could generate a destination for the section
1470 % text in the case where a section has no node, but it doesn't 1273 % text in the case where a section has no node, but it doesn't
1471 % seem worth the trouble, since most documents are normally structured. 1274 % seem worth the trouble, since most documents are normally structured.
1472 \def\pdfoutlinedest{#3}% 1275 \edef\pdfoutlinedest{#3}%
1473 \ifx\pdfoutlinedest\empty 1276 \ifx\pdfoutlinedest\empty
1474 \def\pdfoutlinedest{#4}% 1277 \def\pdfoutlinedest{#4}%
1475 \else 1278 \else
1476 % Doubled backslashes in the name. 1279 \txiescapepdf\pdfoutlinedest
1477 {\activebackslashdouble \xdef\pdfoutlinedest{#3}%
1478 \backslashparens\pdfoutlinedest}%
1479 \fi 1280 \fi
1480 % 1281 %
1481 % Also double the backslashes in the display string. 1282 % Also escape PDF chars in the display string.
1482 {\activebackslashdouble \xdef\pdfoutlinetext{#1}% 1283 \edef\pdfoutlinetext{#1}%
1483 \backslashparens\pdfoutlinetext}% 1284 \txiescapepdf\pdfoutlinetext
1484 % 1285 %
1485 \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% 1286 \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
1486 } 1287 }
1487 % 1288 %
1488 \def\pdfmakeoutlines{% 1289 \def\pdfmakeoutlines{%
1489 \begingroup 1290 \begingroup
1490 % Thanh's hack / proper braces in bookmarks
1491 \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
1492 \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
1493 %
1494 % Read toc silently, to get counts of subentries for \pdfoutline. 1291 % Read toc silently, to get counts of subentries for \pdfoutline.
1292 \def\partentry##1##2##3##4{}% ignore parts in the outlines
1495 \def\numchapentry##1##2##3##4{% 1293 \def\numchapentry##1##2##3##4{%
1496 \def\thischapnum{##2}% 1294 \def\thischapnum{##2}%
1497 \def\thissecnum{0}% 1295 \def\thissecnum{0}%
@@ -1545,15 +1343,26 @@ output) for that.)}
1545 % Latin 2 (0xea) gets translated to a | character. Info from 1343 % Latin 2 (0xea) gets translated to a | character. Info from
1546 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. 1344 % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
1547 % 1345 %
1548 % xx to do this right, we have to translate 8-bit characters to 1346 % TODO this right, we have to translate 8-bit characters to
1549 % their "best" equivalent, based on the @documentencoding. Right 1347 % their "best" equivalent, based on the @documentencoding. Too
1550 % now, I guess we'll just let the pdf reader have its way. 1348 % much work for too little return. Just use the ASCII equivalents
1349 % we use for the index sort strings.
1350 %
1551 \indexnofonts 1351 \indexnofonts
1552 \setupdatafile 1352 \setupdatafile
1353 % We can have normal brace characters in the PDF outlines, unlike
1354 % Texinfo index files. So set that up.
1355 \def\{{\lbracecharliteral}%
1356 \def\}{\rbracecharliteral}%
1553 \catcode`\\=\active \otherbackslash 1357 \catcode`\\=\active \otherbackslash
1554 \input \tocreadfilename 1358 \input \tocreadfilename
1555 \endgroup 1359 \endgroup
1556 } 1360 }
1361 {\catcode`[=1 \catcode`]=2
1362 \catcode`{=\other \catcode`}=\other
1363 \gdef\lbracecharliteral[{]%
1364 \gdef\rbracecharliteral[}]%
1365 ]
1557 % 1366 %
1558 \def\skipspaces#1{\def\PP{#1}\def\D{|}% 1367 \def\skipspaces#1{\def\PP{#1}\def\D{|}%
1559 \ifx\PP\D\let\nextsp\relax 1368 \ifx\PP\D\let\nextsp\relax
@@ -1563,7 +1372,13 @@ output) for that.)}
1563 \fi 1372 \fi
1564 \fi 1373 \fi
1565 \nextsp} 1374 \nextsp}
1566 \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} 1375 \def\getfilename#1{%
1376 \filenamelength=0
1377 % If we don't expand the argument now, \skipspaces will get
1378 % snagged on things like "@value{foo}".
1379 \edef\temp{#1}%
1380 \expandafter\skipspaces\temp|\relax
1381 }
1567 \ifnum\pdftexversion < 14 1382 \ifnum\pdftexversion < 14
1568 \let \startlink \pdfannotlink 1383 \let \startlink \pdfannotlink
1569 \else 1384 \else
@@ -1695,7 +1510,7 @@ output) for that.)}
1695% if we are producing pdf, and we have \pdffontattr, then define cmaps. 1510% if we are producing pdf, and we have \pdffontattr, then define cmaps.
1696% (\pdffontattr was introduced many years ago, but people still run 1511% (\pdffontattr was introduced many years ago, but people still run
1697% older pdftex's; it's easy to conditionalize, so we do.) 1512% older pdftex's; it's easy to conditionalize, so we do.)
1698\ifpdf \ifx\pdffontattr\undefined \else 1513\ifpdf \ifx\pdffontattr\thisisundefined \else
1699 \begingroup 1514 \begingroup
1700 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char. 1515 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1701 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap 1516 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
@@ -1962,7 +1777,7 @@ end
1962% Use cm as the default font prefix. 1777% Use cm as the default font prefix.
1963% To specify the font prefix, you must define \fontprefix 1778% To specify the font prefix, you must define \fontprefix
1964% before you read in texinfo.tex. 1779% before you read in texinfo.tex.
1965\ifx\fontprefix\undefined 1780\ifx\fontprefix\thisisundefined
1966\def\fontprefix{cm} 1781\def\fontprefix{cm}
1967\fi 1782\fi
1968% Support font families that don't use the same naming scheme as CM. 1783% Support font families that don't use the same naming scheme as CM.
@@ -2105,8 +1920,8 @@ end
2105\font\reducedsy=cmsy10 1920\font\reducedsy=cmsy10
2106\def\reducedecsize{1000} 1921\def\reducedecsize{1000}
2107 1922
2108% reset the current fonts 1923\textleading = 13.2pt % line spacing for 11pt CM
2109\textfonts 1924\textfonts % reset the current fonts
2110\rm 1925\rm
2111} % end of 11pt text font size definitions 1926} % end of 11pt text font size definitions
2112 1927
@@ -2236,11 +2051,9 @@ end
2236\font\reducedsy=cmsy9 2051\font\reducedsy=cmsy9
2237\def\reducedecsize{0900} 2052\def\reducedecsize{0900}
2238 2053
2239% reduce space between paragraphs 2054\divide\parskip by 2 % reduce space between paragraphs
2240\divide\parskip by 2 2055\textleading = 12pt % line spacing for 10pt CM
2241 2056\textfonts % reset the current fonts
2242% reset the current fonts
2243\textfonts
2244\rm 2057\rm
2245} % end of 10pt text font size definitions 2058} % end of 10pt text font size definitions
2246 2059
@@ -2249,12 +2062,13 @@ end
2249% @fonttextsize 10 2062% @fonttextsize 10
2250% (or 11) to redefine the text font size. pt is assumed. 2063% (or 11) to redefine the text font size. pt is assumed.
2251% 2064%
2252\def\xword{10}
2253\def\xiword{11} 2065\def\xiword{11}
2066\def\xword{10}
2067\def\xwordpt{10pt}
2254% 2068%
2255\parseargdef\fonttextsize{% 2069\parseargdef\fonttextsize{%
2256 \def\textsizearg{#1}% 2070 \def\textsizearg{#1}%
2257 \wlog{doing @fonttextsize \textsizearg}% 2071 %\wlog{doing @fonttextsize \textsizearg}%
2258 % 2072 %
2259 % Set \globaldefs so that documents can use this inside @tex, since 2073 % Set \globaldefs so that documents can use this inside @tex, since
2260 % makeinfo 4.8 does not support it, but we need it nonetheless. 2074 % makeinfo 4.8 does not support it, but we need it nonetheless.
@@ -2308,7 +2122,7 @@ end
2308 \let\tenttsl=\titlettsl 2122 \let\tenttsl=\titlettsl
2309 \def\curfontsize{title}% 2123 \def\curfontsize{title}%
2310 \def\lsize{chap}\def\lllsize{subsec}% 2124 \def\lsize{chap}\def\lllsize{subsec}%
2311 \resetmathfonts \setleading{25pt}} 2125 \resetmathfonts \setleading{27pt}}
2312\def\titlefont#1{{\titlefonts\rmisbold #1}} 2126\def\titlefont#1{{\titlefonts\rmisbold #1}}
2313\def\chapfonts{% 2127\def\chapfonts{%
2314 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl 2128 \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
@@ -2436,12 +2250,14 @@ end
2436 2250
2437% Markup style setup for left and right quotes. 2251% Markup style setup for left and right quotes.
2438\defmarkupstylesetup\markupsetuplq{% 2252\defmarkupstylesetup\markupsetuplq{%
2439 \expandafter\let\expandafter \temp \csname markupsetuplq\currentmarkupstyle\endcsname 2253 \expandafter\let\expandafter \temp
2254 \csname markupsetuplq\currentmarkupstyle\endcsname
2440 \ifx\temp\relax \markupsetuplqdefault \else \temp \fi 2255 \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
2441} 2256}
2442 2257
2443\defmarkupstylesetup\markupsetuprq{% 2258\defmarkupstylesetup\markupsetuprq{%
2444 \expandafter\let\expandafter \temp \csname markupsetuprq\currentmarkupstyle\endcsname 2259 \expandafter\let\expandafter \temp
2260 \csname markupsetuprq\currentmarkupstyle\endcsname
2445 \ifx\temp\relax \markupsetuprqdefault \else \temp \fi 2261 \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
2446} 2262}
2447 2263
@@ -2460,22 +2276,26 @@ end
2460 2276
2461\let\markupsetuplqcode \markupsetcodequoteleft 2277\let\markupsetuplqcode \markupsetcodequoteleft
2462\let\markupsetuprqcode \markupsetcodequoteright 2278\let\markupsetuprqcode \markupsetcodequoteright
2279%
2463\let\markupsetuplqexample \markupsetcodequoteleft 2280\let\markupsetuplqexample \markupsetcodequoteleft
2464\let\markupsetuprqexample \markupsetcodequoteright 2281\let\markupsetuprqexample \markupsetcodequoteright
2282%
2283\let\markupsetuplqsamp \markupsetcodequoteleft
2284\let\markupsetuprqsamp \markupsetcodequoteright
2285%
2465\let\markupsetuplqverb \markupsetcodequoteleft 2286\let\markupsetuplqverb \markupsetcodequoteleft
2466\let\markupsetuprqverb \markupsetcodequoteright 2287\let\markupsetuprqverb \markupsetcodequoteright
2288%
2467\let\markupsetuplqverbatim \markupsetcodequoteleft 2289\let\markupsetuplqverbatim \markupsetcodequoteleft
2468\let\markupsetuprqverbatim \markupsetcodequoteright 2290\let\markupsetuprqverbatim \markupsetcodequoteright
2469 2291
2470\let\markupsetuplqsamp \markupsetnoligaturesquoteleft
2471\let\markupsetuplqkbd \markupsetnoligaturesquoteleft 2292\let\markupsetuplqkbd \markupsetnoligaturesquoteleft
2472 2293
2473% Allow an option to not replace quotes with a regular directed right 2294% Allow an option to not use regular directed right quote/apostrophe
2474% quote/apostrophe (char 0x27), but instead use the undirected quote 2295% (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
2475% from cmtt (char 0x0d). The undirected quote is ugly, so don't make it 2296% The undirected quote is ugly, so don't make it the default, but it
2476% the default, but it works for pasting with more pdf viewers (at least 2297% works for pasting with more pdf viewers (at least evince), the
2477% evince), the lilypond developers report. xpdf does work with the 2298% lilypond developers report. xpdf does work with the regular 0x27.
2478% regular 0x27.
2479% 2299%
2480\def\codequoteright{% 2300\def\codequoteright{%
2481 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax 2301 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
@@ -2499,33 +2319,84 @@ end
2499 \else \char'22 \fi 2319 \else \char'22 \fi
2500} 2320}
2501 2321
2322% Commands to set the quote options.
2323%
2324\parseargdef\codequoteundirected{%
2325 \def\temp{#1}%
2326 \ifx\temp\onword
2327 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2328 = t%
2329 \else\ifx\temp\offword
2330 \expandafter\let\csname SETtxicodequoteundirected\endcsname
2331 = \relax
2332 \else
2333 \errhelp = \EMsimple
2334 \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
2335 \fi\fi
2336}
2337%
2338\parseargdef\codequotebacktick{%
2339 \def\temp{#1}%
2340 \ifx\temp\onword
2341 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2342 = t%
2343 \else\ifx\temp\offword
2344 \expandafter\let\csname SETtxicodequotebacktick\endcsname
2345 = \relax
2346 \else
2347 \errhelp = \EMsimple
2348 \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
2349 \fi\fi
2350}
2351
2502% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font. 2352% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
2503\def\noligaturesquoteleft{\relax\lq} 2353\def\noligaturesquoteleft{\relax\lq}
2504 2354
2505% Count depth in font-changes, for error checks 2355% Count depth in font-changes, for error checks
2506\newcount\fontdepth \fontdepth=0 2356\newcount\fontdepth \fontdepth=0
2507 2357
2508%% Add scribe-like font environments, plus @l for inline lisp (usually sans 2358% Font commands.
2509%% serif) and @ii for TeX italic 2359
2360% #1 is the font command (\sl or \it), #2 is the text to slant.
2361% If we are in a monospaced environment, however, 1) always use \ttsl,
2362% and 2) do not add an italic correction.
2363\def\dosmartslant#1#2{%
2364 \ifusingtt
2365 {{\ttsl #2}\let\next=\relax}%
2366 {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
2367 \next
2368}
2369\def\smartslanted{\dosmartslant\sl}
2370\def\smartitalic{\dosmartslant\it}
2510 2371
2511% \smartitalic{ARG} outputs arg in italics, followed by an italic correction 2372% Output an italic correction unless \next (presumed to be the following
2512% unless the following character is such as not to need one. 2373% character) is such as not to need one.
2513\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else 2374\def\smartitaliccorrection{%
2514 \ptexslash\fi\fi\fi} 2375 \ifx\next,%
2515\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} 2376 \else\ifx\next-%
2516\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} 2377 \else\ifx\next.%
2378 \else\ptexslash
2379 \fi\fi\fi
2380 \aftersmartic
2381}
2517 2382
2518% like \smartslanted except unconditionally uses \ttsl. 2383% like \smartslanted except unconditionally uses \ttsl, and no ic.
2519% @var is set to this for defun arguments. 2384% @var is set to this for defun arguments.
2520\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} 2385\def\ttslanted#1{{\ttsl #1}}
2521 2386
2522% @cite is like \smartslanted except unconditionally use \sl. We never want 2387% @cite is like \smartslanted except unconditionally use \sl. We never want
2523% ttsl for book titles, do we? 2388% ttsl for book titles, do we?
2524\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} 2389\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
2390
2391\def\aftersmartic{}
2392\def\var#1{%
2393 \let\saveaftersmartic = \aftersmartic
2394 \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
2395 \smartslanted{#1}%
2396}
2525 2397
2526\let\i=\smartitalic 2398\let\i=\smartitalic
2527\let\slanted=\smartslanted 2399\let\slanted=\smartslanted
2528\def\var#1{{\setupmarkupstyle{var}\smartslanted{#1}}}
2529\let\dfn=\smartslanted 2400\let\dfn=\smartslanted
2530\let\emph=\smartitalic 2401\let\emph=\smartitalic
2531 2402
@@ -2621,7 +2492,7 @@ end
2621 \plainfrenchspacing 2492 \plainfrenchspacing
2622 #1% 2493 #1%
2623 }% 2494 }%
2624 \null 2495 \null % reset spacefactor to 1000
2625} 2496}
2626 2497
2627% We *must* turn on hyphenation at `-' and `_' in @code. 2498% We *must* turn on hyphenation at `-' and `_' in @code.
@@ -2653,6 +2524,8 @@ end
2653 } 2524 }
2654} 2525}
2655 2526
2527\def\codex #1{\tclose{#1}\endgroup}
2528
2656\def\realdash{-} 2529\def\realdash{-}
2657\def\codedash{-\discretionary{}{}{}} 2530\def\codedash{-\discretionary{}{}{}}
2658\def\codeunder{% 2531\def\codeunder{%
@@ -2666,7 +2539,6 @@ end
2666 \discretionary{}{}{}}% 2539 \discretionary{}{}{}}%
2667 {\_}% 2540 {\_}%
2668} 2541}
2669\def\codex #1{\tclose{#1}\endgroup}
2670 2542
2671% An additional complication: the above will allow breaks after, e.g., 2543% An additional complication: the above will allow breaks after, e.g.,
2672% each of the four underscores in __typeof__. This is undesirable in 2544% each of the four underscores in __typeof__. This is undesirable in
@@ -2686,63 +2558,18 @@ end
2686 \allowcodebreaksfalse 2558 \allowcodebreaksfalse
2687 \else 2559 \else
2688 \errhelp = \EMsimple 2560 \errhelp = \EMsimple
2689 \errmessage{Unknown @allowcodebreaks option `\txiarg'}% 2561 \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
2690 \fi\fi 2562 \fi\fi
2691} 2563}
2692 2564
2693% @kbd is like @code, except that if the argument is just one @key command,
2694% then @kbd has no effect.
2695\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}}
2696
2697% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
2698% `example' (@kbd uses ttsl only inside of @example and friends),
2699% or `code' (@kbd uses normal tty font always).
2700\parseargdef\kbdinputstyle{%
2701 \def\txiarg{#1}%
2702 \ifx\txiarg\worddistinct
2703 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
2704 \else\ifx\txiarg\wordexample
2705 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
2706 \else\ifx\txiarg\wordcode
2707 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
2708 \else
2709 \errhelp = \EMsimple
2710 \errmessage{Unknown @kbdinputstyle option `\txiarg'}%
2711 \fi\fi\fi
2712}
2713\def\worddistinct{distinct}
2714\def\wordexample{example}
2715\def\wordcode{code}
2716
2717% Default is `distinct'.
2718\kbdinputstyle distinct
2719
2720\def\xkey{\key}
2721\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
2722\ifx\one\xkey\ifx\threex\three \key{#2}%
2723\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2724\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi}
2725
2726% For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
2727\let\indicateurl=\code
2728\let\env=\code
2729\let\command=\code
2730
2731% @clicksequence{File @click{} Open ...}
2732\def\clicksequence#1{\begingroup #1\endgroup}
2733
2734% @clickstyle @arrow (by default)
2735\parseargdef\clickstyle{\def\click{#1}}
2736\def\click{\arrow}
2737
2738% @uref (abbreviation for `urlref') takes an optional (comma-separated) 2565% @uref (abbreviation for `urlref') takes an optional (comma-separated)
2739% second argument specifying the text to display and an optional third 2566% second argument specifying the text to display and an optional third
2740% arg as text to display instead of (rather than in addition to) the url 2567% arg as text to display instead of (rather than in addition to) the url
2741% itself. First (mandatory) arg is the url. Perhaps eventually put in 2568% itself. First (mandatory) arg is the url.
2742% a hypertex \special here. 2569% (This \urefnobreak definition isn't used now, leaving it for a while
2743% 2570% for comparison.)
2744\def\uref#1{\douref #1,,,\finish} 2571\def\urefnobreak#1{\dourefnobreak #1,,,\finish}
2745\def\douref#1,#2,#3,#4\finish{\begingroup 2572\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup
2746 \unsepspaces 2573 \unsepspaces
2747 \pdfurl{#1}% 2574 \pdfurl{#1}%
2748 \setbox0 = \hbox{\ignorespaces #3}% 2575 \setbox0 = \hbox{\ignorespaces #3}%
@@ -2763,6 +2590,103 @@ end
2763 \endlink 2590 \endlink
2764\endgroup} 2591\endgroup}
2765 2592
2593% This \urefbreak definition is the active one.
2594\def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
2595\let\uref=\urefbreak
2596\def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
2597\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
2598 \unsepspaces
2599 \pdfurl{#1}%
2600 \setbox0 = \hbox{\ignorespaces #3}%
2601 \ifdim\wd0 > 0pt
2602 \unhbox0 % third arg given, show only that
2603 \else
2604 \setbox0 = \hbox{\ignorespaces #2}%
2605 \ifdim\wd0 > 0pt
2606 \ifpdf
2607 \unhbox0 % PDF: 2nd arg given, show only it
2608 \else
2609 \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url
2610 \fi
2611 \else
2612 \urefcode{#1}% only url given, so show it
2613 \fi
2614 \fi
2615 \endlink
2616\endgroup}
2617
2618% Allow line breaks around only a few characters (only).
2619\def\urefcatcodes{%
2620 \catcode\ampChar=\active \catcode\dotChar=\active
2621 \catcode\hashChar=\active \catcode\questChar=\active
2622 \catcode\slashChar=\active
2623}
2624{
2625 \urefcatcodes
2626 %
2627 \global\def\urefcode{\begingroup
2628 \setupmarkupstyle{code}%
2629 \urefcatcodes
2630 \let&\urefcodeamp
2631 \let.\urefcodedot
2632 \let#\urefcodehash
2633 \let?\urefcodequest
2634 \let/\urefcodeslash
2635 \codex
2636 }
2637 %
2638 % By default, they are just regular characters.
2639 \global\def&{\normalamp}
2640 \global\def.{\normaldot}
2641 \global\def#{\normalhash}
2642 \global\def?{\normalquest}
2643 \global\def/{\normalslash}
2644}
2645
2646% we put a little stretch before and after the breakable chars, to help
2647% line breaking of long url's. The unequal skips make look better in
2648% cmtt at least, especially for dots.
2649\def\urefprestretch{\urefprebreak \hskip0pt plus.13em }
2650\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em }
2651%
2652\def\urefcodeamp{\urefprestretch \&\urefpoststretch}
2653\def\urefcodedot{\urefprestretch .\urefpoststretch}
2654\def\urefcodehash{\urefprestretch \#\urefpoststretch}
2655\def\urefcodequest{\urefprestretch ?\urefpoststretch}
2656\def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
2657{
2658 \catcode`\/=\active
2659 \global\def\urefcodeslashfinish{%
2660 \urefprestretch \slashChar
2661 % Allow line break only after the final / in a sequence of
2662 % slashes, to avoid line break between the slashes in http://.
2663 \ifx\next/\else \urefpoststretch \fi
2664 }
2665}
2666
2667% One more complication: by default we'll break after the special
2668% characters, but some people like to break before the special chars, so
2669% allow that. Also allow no breaking at all, for manual control.
2670%
2671\parseargdef\urefbreakstyle{%
2672 \def\txiarg{#1}%
2673 \ifx\txiarg\wordnone
2674 \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
2675 \else\ifx\txiarg\wordbefore
2676 \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
2677 \else\ifx\txiarg\wordafter
2678 \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
2679 \else
2680 \errhelp = \EMsimple
2681 \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
2682 \fi\fi\fi
2683}
2684\def\wordafter{after}
2685\def\wordbefore{before}
2686\def\wordnone{none}
2687
2688\urefbreakstyle after
2689
2766% @url synonym for @uref, since that's how everyone uses it. 2690% @url synonym for @uref, since that's how everyone uses it.
2767% 2691%
2768\let\url=\uref 2692\let\url=\uref
@@ -2784,6 +2708,51 @@ end
2784 \let\email=\uref 2708 \let\email=\uref
2785\fi 2709\fi
2786 2710
2711% @kbd is like @code, except that if the argument is just one @key command,
2712% then @kbd has no effect.
2713\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}}
2714
2715% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
2716% `example' (@kbd uses ttsl only inside of @example and friends),
2717% or `code' (@kbd uses normal tty font always).
2718\parseargdef\kbdinputstyle{%
2719 \def\txiarg{#1}%
2720 \ifx\txiarg\worddistinct
2721 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
2722 \else\ifx\txiarg\wordexample
2723 \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
2724 \else\ifx\txiarg\wordcode
2725 \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
2726 \else
2727 \errhelp = \EMsimple
2728 \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
2729 \fi\fi\fi
2730}
2731\def\worddistinct{distinct}
2732\def\wordexample{example}
2733\def\wordcode{code}
2734
2735% Default is `distinct'.
2736\kbdinputstyle distinct
2737
2738\def\xkey{\key}
2739\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
2740\ifx\one\xkey\ifx\threex\three \key{#2}%
2741\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
2742\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi}
2743
2744% For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
2745\let\indicateurl=\code
2746\let\env=\code
2747\let\command=\code
2748
2749% @clicksequence{File @click{} Open ...}
2750\def\clicksequence#1{\begingroup #1\endgroup}
2751
2752% @clickstyle @arrow (by default)
2753\parseargdef\clickstyle{\def\click{#1}}
2754\def\click{\arrow}
2755
2787% Typeset a dimension, e.g., `in' or `pt'. The only reason for the 2756% Typeset a dimension, e.g., `in' or `pt'. The only reason for the
2788% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. 2757% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
2789% 2758%
@@ -2805,6 +2774,7 @@ end
2805 \ifx\temp\empty \else 2774 \ifx\temp\empty \else
2806 \space ({\unsepspaces \ignorespaces \temp \unskip})% 2775 \space ({\unsepspaces \ignorespaces \temp \unskip})%
2807 \fi 2776 \fi
2777 \null % reset \spacefactor=1000
2808} 2778}
2809 2779
2810% @abbr for "Comput. J." and the like. 2780% @abbr for "Comput. J." and the like.
@@ -2817,10 +2787,219 @@ end
2817 \ifx\temp\empty \else 2787 \ifx\temp\empty \else
2818 \space ({\unsepspaces \ignorespaces \temp \unskip})% 2788 \space ({\unsepspaces \ignorespaces \temp \unskip})%
2819 \fi 2789 \fi
2790 \null % reset \spacefactor=1000
2791}
2792
2793% @asis just yields its argument. Used with @table, for example.
2794%
2795\def\asis#1{#1}
2796
2797% @math outputs its argument in math mode.
2798%
2799% One complication: _ usually means subscripts, but it could also mean
2800% an actual _ character, as in @math{@var{some_variable} + 1}. So make
2801% _ active, and distinguish by seeing if the current family is \slfam,
2802% which is what @var uses.
2803{
2804 \catcode`\_ = \active
2805 \gdef\mathunderscore{%
2806 \catcode`\_=\active
2807 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
2808 }
2809}
2810% Another complication: we want \\ (and @\) to output a math (or tt) \.
2811% FYI, plain.tex uses \\ as a temporary control sequence (for no
2812% particular reason), but this is not advertised and we don't care.
2813%
2814% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
2815\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
2816%
2817\def\math{%
2818 \tex
2819 \mathunderscore
2820 \let\\ = \mathbackslash
2821 \mathactive
2822 % make the texinfo accent commands work in math mode
2823 \let\"=\ddot
2824 \let\'=\acute
2825 \let\==\bar
2826 \let\^=\hat
2827 \let\`=\grave
2828 \let\u=\breve
2829 \let\v=\check
2830 \let\~=\tilde
2831 \let\dotaccent=\dot
2832 $\finishmath
2833}
2834\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
2835
2836% Some active characters (such as <) are spaced differently in math.
2837% We have to reset their definitions in case the @math was an argument
2838% to a command which sets the catcodes (such as @item or @section).
2839%
2840{
2841 \catcode`^ = \active
2842 \catcode`< = \active
2843 \catcode`> = \active
2844 \catcode`+ = \active
2845 \catcode`' = \active
2846 \gdef\mathactive{%
2847 \let^ = \ptexhat
2848 \let< = \ptexless
2849 \let> = \ptexgtr
2850 \let+ = \ptexplus
2851 \let' = \ptexquoteright
2852 }
2853}
2854
2855% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
2856% Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
2857% except specified as a normal braced arg, so no newlines to worry about.
2858%
2859\def\outfmtnametex{tex}
2860%
2861\long\def\inlinefmt#1{\doinlinefmt #1,\finish}
2862\long\def\doinlinefmt#1,#2,\finish{%
2863 \def\inlinefmtname{#1}%
2864 \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
2865}
2866% For raw, must switch into @tex before parsing the argument, to avoid
2867% setting catcodes prematurely. Doing it this way means that, for
2868% example, @inlineraw{html, foo{bar} gets a parse error instead of being
2869% ignored. But this isn't important because if people want a literal
2870% *right* brace they would have to use a command anyway, so they may as
2871% well use a command to get a left brace too. We could re-use the
2872% delimiter character idea from \verb, but it seems like overkill.
2873%
2874\long\def\inlineraw{\tex \doinlineraw}
2875\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
2876\def\doinlinerawtwo#1,#2,\finish{%
2877 \def\inlinerawname{#1}%
2878 \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
2879 \endgroup % close group opened by \tex.
2820} 2880}
2821 2881
2822 2882
2823\message{glyphs,} 2883\message{glyphs,}
2884% and logos.
2885
2886% @@ prints an @, as does @atchar{}.
2887\def\@{\char64 }
2888\let\atchar=\@
2889
2890% @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
2891% Unless we're in typewriter, use \ecfont because the CM text fonts do
2892% not have braces, and we don't want to switch into math.
2893\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
2894\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
2895\let\{=\mylbrace \let\lbracechar=\{
2896\let\}=\myrbrace \let\rbracechar=\}
2897\begingroup
2898 % Definitions to produce \{ and \} commands for indices,
2899 % and @{ and @} for the aux/toc files.
2900 \catcode`\{ = \other \catcode`\} = \other
2901 \catcode`\[ = 1 \catcode`\] = 2
2902 \catcode`\! = 0 \catcode`\\ = \other
2903 !gdef!lbracecmd[\{]%
2904 !gdef!rbracecmd[\}]%
2905 !gdef!lbraceatcmd[@{]%
2906 !gdef!rbraceatcmd[@}]%
2907!endgroup
2908
2909% @comma{} to avoid , parsing problems.
2910\let\comma = ,
2911
2912% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
2913% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
2914\let\, = \ptexc
2915\let\dotaccent = \ptexdot
2916\def\ringaccent#1{{\accent23 #1}}
2917\let\tieaccent = \ptext
2918\let\ubaraccent = \ptexb
2919\let\udotaccent = \d
2920
2921% Other special characters: @questiondown @exclamdown @ordf @ordm
2922% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
2923\def\questiondown{?`}
2924\def\exclamdown{!`}
2925\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
2926\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
2927
2928% Dotless i and dotless j, used for accents.
2929\def\imacro{i}
2930\def\jmacro{j}
2931\def\dotless#1{%
2932 \def\temp{#1}%
2933 \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
2934 \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
2935 \else \errmessage{@dotless can be used only with i or j}%
2936 \fi\fi
2937}
2938
2939% The \TeX{} logo, as in plain, but resetting the spacing so that a
2940% period following counts as ending a sentence. (Idea found in latex.)
2941%
2942\edef\TeX{\TeX \spacefactor=1000 }
2943
2944% @LaTeX{} logo. Not quite the same results as the definition in
2945% latex.ltx, since we use a different font for the raised A; it's most
2946% convenient for us to use an explicitly smaller font, rather than using
2947% the \scriptstyle font (since we don't reset \scriptstyle and
2948% \scriptscriptstyle).
2949%
2950\def\LaTeX{%
2951 L\kern-.36em
2952 {\setbox0=\hbox{T}%
2953 \vbox to \ht0{\hbox{%
2954 \ifx\textnominalsize\xwordpt
2955 % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
2956 % Revert to plain's \scriptsize, which is 7pt.
2957 \count255=\the\fam $\fam\count255 \scriptstyle A$%
2958 \else
2959 % For 11pt, we can use our lllsize.
2960 \selectfonts\lllsize A%
2961 \fi
2962 }%
2963 \vss
2964 }}%
2965 \kern-.15em
2966 \TeX
2967}
2968
2969% Some math mode symbols.
2970\def\bullet{$\ptexbullet$}
2971\def\geq{\ifmmode \ge\else $\ge$\fi}
2972\def\leq{\ifmmode \le\else $\le$\fi}
2973\def\minus{\ifmmode -\else $-$\fi}
2974
2975% @dots{} outputs an ellipsis using the current font.
2976% We do .5em per period so that it has the same spacing in the cm
2977% typewriter fonts as three actual period characters; on the other hand,
2978% in other typewriter fonts three periods are wider than 1.5em. So do
2979% whichever is larger.
2980%
2981\def\dots{%
2982 \leavevmode
2983 \setbox0=\hbox{...}% get width of three periods
2984 \ifdim\wd0 > 1.5em
2985 \dimen0 = \wd0
2986 \else
2987 \dimen0 = 1.5em
2988 \fi
2989 \hbox to \dimen0{%
2990 \hskip 0pt plus.25fil
2991 .\hskip 0pt plus1fil
2992 .\hskip 0pt plus1fil
2993 .\hskip 0pt plus.5fil
2994 }%
2995}
2996
2997% @enddots{} is an end-of-sentence ellipsis.
2998%
2999\def\enddots{%
3000 \dots
3001 \spacefactor=\endofsentencespacefactor
3002}
2824 3003
2825% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. 3004% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
2826% 3005%
@@ -2842,7 +3021,7 @@ end
2842{\tentt \global\dimen0 = 3em}% Width of the box. 3021{\tentt \global\dimen0 = 3em}% Width of the box.
2843\dimen2 = .55pt % Thickness of rules 3022\dimen2 = .55pt % Thickness of rules
2844% The text. (`r' is open on the right, `e' somewhat less so on the left.) 3023% The text. (`r' is open on the right, `e' somewhat less so on the left.)
2845\setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt} 3024\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
2846% 3025%
2847\setbox\errorbox=\hbox to \dimen0{\hfil 3026\setbox\errorbox=\hbox to \dimen0{\hfil
2848 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. 3027 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
@@ -2991,7 +3170,7 @@ end
2991% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 3170% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
2992% so we'll define it if necessary. 3171% so we'll define it if necessary.
2993% 3172%
2994\ifx\Orb\undefined 3173\ifx\Orb\thisisundefined
2995\def\Orb{\mathhexbox20D} 3174\def\Orb{\mathhexbox20D}
2996\fi 3175\fi
2997 3176
@@ -3019,8 +3198,9 @@ end
3019\newif\ifsetshortcontentsaftertitlepage 3198\newif\ifsetshortcontentsaftertitlepage
3020 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue 3199 \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
3021 3200
3022\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% 3201\parseargdef\shorttitlepage{%
3023 \endgroup\page\hbox{}\page} 3202 \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
3203 \endgroup\page\hbox{}\page}
3024 3204
3025\envdef\titlepage{% 3205\envdef\titlepage{%
3026 % Open one extra group, as we want to close it in the middle of \Etitlepage. 3206 % Open one extra group, as we want to close it in the middle of \Etitlepage.
@@ -3080,7 +3260,7 @@ end
3080 \finishedtitlepagetrue 3260 \finishedtitlepagetrue
3081} 3261}
3082 3262
3083%%% Macros to be used within @titlepage: 3263% Macros to be used within @titlepage:
3084 3264
3085\let\subtitlerm=\tenrm 3265\let\subtitlerm=\tenrm
3086\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} 3266\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
@@ -3113,7 +3293,7 @@ end
3113} 3293}
3114 3294
3115 3295
3116%%% Set up page headings and footings. 3296% Set up page headings and footings.
3117 3297
3118\let\thispage=\folio 3298\let\thispage=\folio
3119 3299
@@ -3207,10 +3387,14 @@ end
3207 3387
3208\def\headings #1 {\csname HEADINGS#1\endcsname} 3388\def\headings #1 {\csname HEADINGS#1\endcsname}
3209 3389
3210\def\HEADINGSoff{% 3390\def\headingsoff{% non-global headings elimination
3211\global\evenheadline={\hfil} \global\evenfootline={\hfil} 3391 \evenheadline={\hfil}\evenfootline={\hfil}%
3212\global\oddheadline={\hfil} \global\oddfootline={\hfil}} 3392 \oddheadline={\hfil}\oddfootline={\hfil}%
3213\HEADINGSoff 3393}
3394
3395\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
3396\HEADINGSoff % it's the default
3397
3214% When we turn headings on, set the page number to 1. 3398% When we turn headings on, set the page number to 1.
3215% For double-sided printing, put current file name in lower left corner, 3399% For double-sided printing, put current file name in lower left corner,
3216% chapter name on inside top of right hand pages, document 3400% chapter name on inside top of right hand pages, document
@@ -3261,7 +3445,7 @@ end
3261% This produces Day Month Year style of output. 3445% This produces Day Month Year style of output.
3262% Only define if not already defined, in case a txi-??.tex file has set 3446% Only define if not already defined, in case a txi-??.tex file has set
3263% up a different format (e.g., txi-cs.tex does this). 3447% up a different format (e.g., txi-cs.tex does this).
3264\ifx\today\undefined 3448\ifx\today\thisisundefined
3265\def\today{% 3449\def\today{%
3266 \number\day\space 3450 \number\day\space
3267 \ifcase\month 3451 \ifcase\month
@@ -3322,7 +3506,7 @@ end
3322 \begingroup 3506 \begingroup
3323 \advance\leftskip by-\tableindent 3507 \advance\leftskip by-\tableindent
3324 \advance\hsize by\tableindent 3508 \advance\hsize by\tableindent
3325 \advance\rightskip by0pt plus1fil 3509 \advance\rightskip by0pt plus1fil\relax
3326 \leavevmode\unhbox0\par 3510 \leavevmode\unhbox0\par
3327 \endgroup 3511 \endgroup
3328 % 3512 %
@@ -3808,18 +3992,18 @@ end
3808\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip 3992\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
3809\global\advance\multitablelinespace by-\ht0 3993\global\advance\multitablelinespace by-\ht0
3810\fi 3994\fi
3811%% Test to see if parskip is larger than space between lines of 3995% Test to see if parskip is larger than space between lines of
3812%% table. If not, do nothing. 3996% table. If not, do nothing.
3813%% If so, set to same dimension as multitablelinespace. 3997% If so, set to same dimension as multitablelinespace.
3814\ifdim\multitableparskip>\multitablelinespace 3998\ifdim\multitableparskip>\multitablelinespace
3815\global\multitableparskip=\multitablelinespace 3999\global\multitableparskip=\multitablelinespace
3816\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller 4000\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
3817 %% than skip between lines in the table. 4001 % than skip between lines in the table.
3818\fi% 4002\fi%
3819\ifdim\multitableparskip=0pt 4003\ifdim\multitableparskip=0pt
3820\global\multitableparskip=\multitablelinespace 4004\global\multitableparskip=\multitablelinespace
3821\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller 4005\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
3822 %% than skip between lines in the table. 4006 % than skip between lines in the table.
3823\fi} 4007\fi}
3824 4008
3825 4009
@@ -4134,11 +4318,14 @@ end
4134 \def\@{@}% change to @@ when we switch to @ as escape char in index files. 4318 \def\@{@}% change to @@ when we switch to @ as escape char in index files.
4135 \def\ {\realbackslash\space }% 4319 \def\ {\realbackslash\space }%
4136 % 4320 %
4137 % Need these in case \tex is in effect and \{ is a \delimiter again. 4321 % Need these unexpandable (because we define \tt as a dummy)
4138 % But can't use \lbracecmd and \rbracecmd because texindex assumes 4322 % definitions when @{ or @} appear in index entry text. Also, more
4139 % braces and backslashes are used only as delimiters. 4323 % complicated, when \tex is in effect and \{ is a \delimiter again.
4140 \let\{ = \mylbrace 4324 % We can't use \lbracecmd and \rbracecmd because texindex assumes
4141 \let\} = \myrbrace 4325 % braces and backslashes are used only as delimiters. Perhaps we
4326 % should define @lbrace and @rbrace commands a la @comma.
4327 \def\{{{\tt\char123}}%
4328 \def\}{{\tt\char125}}%
4142 % 4329 %
4143 % I don't entirely understand this, but when an index entry is 4330 % I don't entirely understand this, but when an index entry is
4144 % generated from a macro call, the \endinput which \scanmacro inserts 4331 % generated from a macro call, the \endinput which \scanmacro inserts
@@ -4191,7 +4378,7 @@ end
4191\def\commondummies{% 4378\def\commondummies{%
4192 % 4379 %
4193 % \definedummyword defines \#1 as \string\#1\space, thus effectively 4380 % \definedummyword defines \#1 as \string\#1\space, thus effectively
4194 % preventing its expansion. This is used only for control% words, 4381 % preventing its expansion. This is used only for control words,
4195 % not control letters, because the \space would be incorrect for 4382 % not control letters, because the \space would be incorrect for
4196 % control characters, but is needed to separate the control word 4383 % control characters, but is needed to separate the control word
4197 % from whatever follows. 4384 % from whatever follows.
@@ -4210,6 +4397,7 @@ end
4210 \commondummiesnofonts 4397 \commondummiesnofonts
4211 % 4398 %
4212 \definedummyletter\_% 4399 \definedummyletter\_%
4400 \definedummyletter\-%
4213 % 4401 %
4214 % Non-English letters. 4402 % Non-English letters.
4215 \definedummyword\AA 4403 \definedummyword\AA
@@ -4246,20 +4434,24 @@ end
4246 \definedummyword\TeX 4434 \definedummyword\TeX
4247 % 4435 %
4248 % Assorted special characters. 4436 % Assorted special characters.
4437 \definedummyword\arrow
4249 \definedummyword\bullet 4438 \definedummyword\bullet
4250 \definedummyword\comma 4439 \definedummyword\comma
4251 \definedummyword\copyright 4440 \definedummyword\copyright
4252 \definedummyword\registeredsymbol 4441 \definedummyword\registeredsymbol
4253 \definedummyword\dots 4442 \definedummyword\dots
4254 \definedummyword\enddots 4443 \definedummyword\enddots
4444 \definedummyword\entrybreak
4255 \definedummyword\equiv 4445 \definedummyword\equiv
4256 \definedummyword\error 4446 \definedummyword\error
4257 \definedummyword\euro 4447 \definedummyword\euro
4448 \definedummyword\expansion
4449 \definedummyword\geq
4258 \definedummyword\guillemetleft 4450 \definedummyword\guillemetleft
4259 \definedummyword\guillemetright 4451 \definedummyword\guillemetright
4260 \definedummyword\guilsinglleft 4452 \definedummyword\guilsinglleft
4261 \definedummyword\guilsinglright 4453 \definedummyword\guilsinglright
4262 \definedummyword\expansion 4454 \definedummyword\leq
4263 \definedummyword\minus 4455 \definedummyword\minus
4264 \definedummyword\ogonek 4456 \definedummyword\ogonek
4265 \definedummyword\pounds 4457 \definedummyword\pounds
@@ -4316,19 +4508,24 @@ end
4316 \definedummyword\b 4508 \definedummyword\b
4317 \definedummyword\i 4509 \definedummyword\i
4318 \definedummyword\r 4510 \definedummyword\r
4511 \definedummyword\sansserif
4319 \definedummyword\sc 4512 \definedummyword\sc
4513 \definedummyword\slanted
4320 \definedummyword\t 4514 \definedummyword\t
4321 % 4515 %
4322 % Commands that take arguments. 4516 % Commands that take arguments.
4323 \definedummyword\acronym 4517 \definedummyword\acronym
4518 \definedummyword\anchor
4324 \definedummyword\cite 4519 \definedummyword\cite
4325 \definedummyword\code 4520 \definedummyword\code
4326 \definedummyword\command 4521 \definedummyword\command
4327 \definedummyword\dfn 4522 \definedummyword\dfn
4523 \definedummyword\dmn
4328 \definedummyword\email 4524 \definedummyword\email
4329 \definedummyword\emph 4525 \definedummyword\emph
4330 \definedummyword\env 4526 \definedummyword\env
4331 \definedummyword\file 4527 \definedummyword\file
4528 \definedummyword\indicateurl
4332 \definedummyword\kbd 4529 \definedummyword\kbd
4333 \definedummyword\key 4530 \definedummyword\key
4334 \definedummyword\math 4531 \definedummyword\math
@@ -4356,7 +4553,7 @@ end
4356 \def\definedummyaccent##1{\let##1\asis}% 4553 \def\definedummyaccent##1{\let##1\asis}%
4357 % We can just ignore other control letters. 4554 % We can just ignore other control letters.
4358 \def\definedummyletter##1{\let##1\empty}% 4555 \def\definedummyletter##1{\let##1\empty}%
4359 % Hopefully, all control words can become @asis. 4556 % All control words become @asis by default; overrides below.
4360 \let\definedummyword\definedummyaccent 4557 \let\definedummyword\definedummyaccent
4361 % 4558 %
4362 \commondummiesnofonts 4559 \commondummiesnofonts
@@ -4368,8 +4565,14 @@ end
4368 % 4565 %
4369 \def\ { }% 4566 \def\ { }%
4370 \def\@{@}% 4567 \def\@{@}%
4371 % how to handle braces?
4372 \def\_{\normalunderscore}% 4568 \def\_{\normalunderscore}%
4569 \def\-{}% @- shouldn't affect sorting
4570 %
4571 % Unfortunately, texindex is not prepared to handle braces in the
4572 % content at all. So for index sorting, we map @{ and @} to strings
4573 % starting with |, since that ASCII character is between ASCII { and }.
4574 \def\{{|a}%
4575 \def\}{|b}%
4373 % 4576 %
4374 % Non-English letters. 4577 % Non-English letters.
4375 \def\AA{AA}% 4578 \def\AA{AA}%
@@ -4397,6 +4600,7 @@ end
4397 % 4600 %
4398 % Assorted special characters. 4601 % Assorted special characters.
4399 % (The following {} will end up in the sort string, but that's ok.) 4602 % (The following {} will end up in the sort string, but that's ok.)
4603 \def\arrow{->}%
4400 \def\bullet{bullet}% 4604 \def\bullet{bullet}%
4401 \def\comma{,}% 4605 \def\comma{,}%
4402 \def\copyright{copyright}% 4606 \def\copyright{copyright}%
@@ -4406,10 +4610,12 @@ end
4406 \def\error{error}% 4610 \def\error{error}%
4407 \def\euro{euro}% 4611 \def\euro{euro}%
4408 \def\expansion{==>}% 4612 \def\expansion{==>}%
4613 \def\geq{>=}%
4409 \def\guillemetleft{<<}% 4614 \def\guillemetleft{<<}%
4410 \def\guillemetright{>>}% 4615 \def\guillemetright{>>}%
4411 \def\guilsinglleft{<}% 4616 \def\guilsinglleft{<}%
4412 \def\guilsinglright{>}% 4617 \def\guilsinglright{>}%
4618 \def\leq{<=}%
4413 \def\minus{-}% 4619 \def\minus{-}%
4414 \def\point{.}% 4620 \def\point{.}%
4415 \def\pounds{pounds}% 4621 \def\pounds{pounds}%
@@ -4424,6 +4630,9 @@ end
4424 \def\result{=>}% 4630 \def\result{=>}%
4425 \def\textdegree{o}% 4631 \def\textdegree{o}%
4426 % 4632 %
4633 \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax
4634 \else \indexlquoteignore \fi
4635 %
4427 % We need to get rid of all macros, leaving only the arguments (if present). 4636 % We need to get rid of all macros, leaving only the arguments (if present).
4428 % Of course this is not nearly correct, but it is the best we can do for now. 4637 % Of course this is not nearly correct, but it is the best we can do for now.
4429 % makeinfo does not expand macros in the argument to @deffn, which ends up 4638 % makeinfo does not expand macros in the argument to @deffn, which ends up
@@ -4437,6 +4646,11 @@ end
4437 \macrolist 4646 \macrolist
4438} 4647}
4439 4648
4649% Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us
4650% ignore left quotes in the sort term.
4651{\catcode`\`=\active
4652 \gdef\indexlquoteignore{\let`=\empty}}
4653
4440\let\indexbackslash=0 %overridden during \printindex. 4654\let\indexbackslash=0 %overridden during \printindex.
4441\let\SETmarginindex=\relax % put index entries in margin (undocumented)? 4655\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
4442 4656
@@ -4534,10 +4748,9 @@ end
4534% 4748%
4535% ..., ready, GO: 4749% ..., ready, GO:
4536% 4750%
4537\def\safewhatsit#1{% 4751\def\safewhatsit#1{\ifhmode
4538\ifhmode
4539 #1% 4752 #1%
4540\else 4753 \else
4541 % \lastskip and \lastpenalty cannot both be nonzero simultaneously. 4754 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
4542 \whatsitskip = \lastskip 4755 \whatsitskip = \lastskip
4543 \edef\lastskipmacro{\the\lastskip}% 4756 \edef\lastskipmacro{\the\lastskip}%
@@ -4561,7 +4774,6 @@ end
4561 % to re-insert the same penalty (values >10000 are used for various 4774 % to re-insert the same penalty (values >10000 are used for various
4562 % signals); since we just inserted a non-discardable item, any 4775 % signals); since we just inserted a non-discardable item, any
4563 % following glue (such as a \parskip) would be a breakpoint. For example: 4776 % following glue (such as a \parskip) would be a breakpoint. For example:
4564 %
4565 % @deffn deffn-whatever 4777 % @deffn deffn-whatever
4566 % @vindex index-whatever 4778 % @vindex index-whatever
4567 % Description. 4779 % Description.
@@ -4574,8 +4786,7 @@ end
4574 % (the whatsit from the \write), so we must insert a \nobreak. 4786 % (the whatsit from the \write), so we must insert a \nobreak.
4575 \nobreak\vskip\whatsitskip 4787 \nobreak\vskip\whatsitskip
4576 \fi 4788 \fi
4577\fi 4789\fi}
4578}
4579 4790
4580% The index entry written in the file actually looks like 4791% The index entry written in the file actually looks like
4581% \entry {sortstring}{page}{topic} 4792% \entry {sortstring}{page}{topic}
@@ -4694,7 +4905,6 @@ end
4694% But this freezes the catcodes in the argument, and can cause problems to 4905% But this freezes the catcodes in the argument, and can cause problems to
4695% @code, which sets - active. This problem was fixed by a kludge--- 4906% @code, which sets - active. This problem was fixed by a kludge---
4696% ``-'' was active throughout whole index, but this isn't really right. 4907% ``-'' was active throughout whole index, but this isn't really right.
4697%
4698% The right solution is to prevent \entry from swallowing the whole text. 4908% The right solution is to prevent \entry from swallowing the whole text.
4699% --kasal, 21nov03 4909% --kasal, 21nov03
4700\def\entry{% 4910\def\entry{%
@@ -4731,10 +4941,17 @@ end
4731 % columns. 4941 % columns.
4732 \vskip 0pt plus1pt 4942 \vskip 0pt plus1pt
4733 % 4943 %
4944 % When reading the text of entry, convert explicit line breaks
4945 % from @* into spaces. The user might give these in long section
4946 % titles, for instance.
4947 \def\*{\unskip\space\ignorespaces}%
4948 \def\entrybreak{\hfil\break}%
4949 %
4734 % Swallow the left brace of the text (first parameter): 4950 % Swallow the left brace of the text (first parameter):
4735 \afterassignment\doentry 4951 \afterassignment\doentry
4736 \let\temp = 4952 \let\temp =
4737} 4953}
4954\def\entrybreak{\unskip\space\ignorespaces}%
4738\def\doentry{% 4955\def\doentry{%
4739 \bgroup % Instead of the swallowed brace. 4956 \bgroup % Instead of the swallowed brace.
4740 \noindent 4957 \noindent
@@ -4967,7 +5184,22 @@ end
4967\message{sectioning,} 5184\message{sectioning,}
4968% Chapters, sections, etc. 5185% Chapters, sections, etc.
4969 5186
4970% \unnumberedno is an oxymoron, of course. But we count the unnumbered 5187% Let's start with @part.
5188\outer\parseargdef\part{\partzzz{#1}}
5189\def\partzzz#1{%
5190 \chapoddpage
5191 \null
5192 \vskip.3\vsize % move it down on the page a bit
5193 \begingroup
5194 \noindent \titlefonts\rmisbold #1\par % the text
5195 \let\lastnode=\empty % no node to associate with
5196 \writetocentry{part}{#1}{}% but put it in the toc
5197 \headingsoff % no headline or footline on the part page
5198 \chapoddpage
5199 \endgroup
5200}
5201
5202% \unnumberedno is an oxymoron. But we count the unnumbered
4971% sections so that we can refer to them unambiguously in the pdf 5203% sections so that we can refer to them unambiguously in the pdf
4972% outlines by their "section number". We avoid collisions with chapter 5204% outlines by their "section number". We avoid collisions with chapter
4973% numbers by starting them at 10000. (If a document ever has 10000 5205% numbers by starting them at 10000. (If a document ever has 10000
@@ -5046,8 +5278,8 @@ end
5046\chardef\maxseclevel = 3 5278\chardef\maxseclevel = 3
5047% 5279%
5048% A numbered section within an unnumbered changes to unnumbered too. 5280% A numbered section within an unnumbered changes to unnumbered too.
5049% To achive this, remember the "biggest" unnum. sec. we are currently in: 5281% To achieve this, remember the "biggest" unnum. sec. we are currently in:
5050\chardef\unmlevel = \maxseclevel 5282\chardef\unnlevel = \maxseclevel
5051% 5283%
5052% Trace whether the current chapter is an appendix or not: 5284% Trace whether the current chapter is an appendix or not:
5053% \chapheadtype is "N" or "A", unnumbered chapters are ignored. 5285% \chapheadtype is "N" or "A", unnumbered chapters are ignored.
@@ -5072,8 +5304,8 @@ end
5072 % The heading type: 5304 % The heading type:
5073 \def\headtype{#1}% 5305 \def\headtype{#1}%
5074 \if \headtype U% 5306 \if \headtype U%
5075 \ifnum \absseclevel < \unmlevel 5307 \ifnum \absseclevel < \unnlevel
5076 \chardef\unmlevel = \absseclevel 5308 \chardef\unnlevel = \absseclevel
5077 \fi 5309 \fi
5078 \else 5310 \else
5079 % Check for appendix sections: 5311 % Check for appendix sections:
@@ -5085,10 +5317,10 @@ end
5085 \fi\fi 5317 \fi\fi
5086 \fi 5318 \fi
5087 % Check for numbered within unnumbered: 5319 % Check for numbered within unnumbered:
5088 \ifnum \absseclevel > \unmlevel 5320 \ifnum \absseclevel > \unnlevel
5089 \def\headtype{U}% 5321 \def\headtype{U}%
5090 \else 5322 \else
5091 \chardef\unmlevel = 3 5323 \chardef\unnlevel = 3
5092 \fi 5324 \fi
5093 \fi 5325 \fi
5094 % Now print the heading: 5326 % Now print the heading:
@@ -5174,7 +5406,8 @@ end
5174 \global\let\subsubsection = \appendixsubsubsec 5406 \global\let\subsubsection = \appendixsubsubsec
5175} 5407}
5176 5408
5177\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz 5409% normally unnmhead0 calls unnumberedzzz:
5410\outer\parseargdef\unnumbered{\unnmhead0{#1}}
5178\def\unnumberedzzz#1{% 5411\def\unnumberedzzz#1{%
5179 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 5412 \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
5180 \global\advance\unnumberedno by 1 5413 \global\advance\unnumberedno by 1
@@ -5218,40 +5451,47 @@ end
5218\let\top\unnumbered 5451\let\top\unnumbered
5219 5452
5220% Sections. 5453% Sections.
5454%
5221\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz 5455\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
5222\def\seczzz#1{% 5456\def\seczzz#1{%
5223 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 5457 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
5224 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% 5458 \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
5225} 5459}
5226 5460
5227\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz 5461% normally calls appendixsectionzzz:
5462\outer\parseargdef\appendixsection{\apphead1{#1}}
5228\def\appendixsectionzzz#1{% 5463\def\appendixsectionzzz#1{%
5229 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 5464 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
5230 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% 5465 \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
5231} 5466}
5232\let\appendixsec\appendixsection 5467\let\appendixsec\appendixsection
5233 5468
5234\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz 5469% normally calls unnumberedseczzz:
5470\outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
5235\def\unnumberedseczzz#1{% 5471\def\unnumberedseczzz#1{%
5236 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 5472 \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
5237 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% 5473 \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
5238} 5474}
5239 5475
5240% Subsections. 5476% Subsections.
5241\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz 5477%
5478% normally calls numberedsubseczzz:
5479\outer\parseargdef\numberedsubsec{\numhead2{#1}}
5242\def\numberedsubseczzz#1{% 5480\def\numberedsubseczzz#1{%
5243 \global\subsubsecno=0 \global\advance\subsecno by 1 5481 \global\subsubsecno=0 \global\advance\subsecno by 1
5244 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% 5482 \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
5245} 5483}
5246 5484
5247\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz 5485% normally calls appendixsubseczzz:
5486\outer\parseargdef\appendixsubsec{\apphead2{#1}}
5248\def\appendixsubseczzz#1{% 5487\def\appendixsubseczzz#1{%
5249 \global\subsubsecno=0 \global\advance\subsecno by 1 5488 \global\subsubsecno=0 \global\advance\subsecno by 1
5250 \sectionheading{#1}{subsec}{Yappendix}% 5489 \sectionheading{#1}{subsec}{Yappendix}%
5251 {\appendixletter.\the\secno.\the\subsecno}% 5490 {\appendixletter.\the\secno.\the\subsecno}%
5252} 5491}
5253 5492
5254\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz 5493% normally calls unnumberedsubseczzz:
5494\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
5255\def\unnumberedsubseczzz#1{% 5495\def\unnumberedsubseczzz#1{%
5256 \global\subsubsecno=0 \global\advance\subsecno by 1 5496 \global\subsubsecno=0 \global\advance\subsecno by 1
5257 \sectionheading{#1}{subsec}{Ynothing}% 5497 \sectionheading{#1}{subsec}{Ynothing}%
@@ -5259,21 +5499,25 @@ end
5259} 5499}
5260 5500
5261% Subsubsections. 5501% Subsubsections.
5262\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz 5502%
5503% normally numberedsubsubseczzz:
5504\outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
5263\def\numberedsubsubseczzz#1{% 5505\def\numberedsubsubseczzz#1{%
5264 \global\advance\subsubsecno by 1 5506 \global\advance\subsubsecno by 1
5265 \sectionheading{#1}{subsubsec}{Ynumbered}% 5507 \sectionheading{#1}{subsubsec}{Ynumbered}%
5266 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% 5508 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
5267} 5509}
5268 5510
5269\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz 5511% normally appendixsubsubseczzz:
5512\outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
5270\def\appendixsubsubseczzz#1{% 5513\def\appendixsubsubseczzz#1{%
5271 \global\advance\subsubsecno by 1 5514 \global\advance\subsubsecno by 1
5272 \sectionheading{#1}{subsubsec}{Yappendix}% 5515 \sectionheading{#1}{subsubsec}{Yappendix}%
5273 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% 5516 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
5274} 5517}
5275 5518
5276\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz 5519% normally unnumberedsubsubseczzz:
5520\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
5277\def\unnumberedsubsubseczzz#1{% 5521\def\unnumberedsubsubseczzz#1{%
5278 \global\advance\subsubsecno by 1 5522 \global\advance\subsubsecno by 1
5279 \sectionheading{#1}{subsubsec}{Ynothing}% 5523 \sectionheading{#1}{subsubsec}{Ynothing}%
@@ -5323,14 +5567,13 @@ end
5323% (including whitespace, linebreaking, etc. around it), 5567% (including whitespace, linebreaking, etc. around it),
5324% given all the information in convenient, parsed form. 5568% given all the information in convenient, parsed form.
5325 5569
5326%%% Args are the skip and penalty (usually negative) 5570% Args are the skip and penalty (usually negative)
5327\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} 5571\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
5328 5572
5329%%% Define plain chapter starts, and page on/off switching for it
5330% Parameter controlling skip before chapter headings (if needed) 5573% Parameter controlling skip before chapter headings (if needed)
5331
5332\newskip\chapheadingskip 5574\newskip\chapheadingskip
5333 5575
5576% Define plain chapter starts, and page on/off switching for it.
5334\def\chapbreak{\dobreak \chapheadingskip {-4000}} 5577\def\chapbreak{\dobreak \chapheadingskip {-4000}}
5335\def\chappager{\par\vfill\supereject} 5578\def\chappager{\par\vfill\supereject}
5336% Because \domark is called before \chapoddpage, the filler page will 5579% Because \domark is called before \chapoddpage, the filler page will
@@ -5340,9 +5583,8 @@ end
5340 \chappager 5583 \chappager
5341 \ifodd\pageno \else 5584 \ifodd\pageno \else
5342 \begingroup 5585 \begingroup
5343 \evenheadline={\hfil}\evenfootline={\hfil}% 5586 \headingsoff
5344 \oddheadline={\hfil}\oddfootline={\hfil}% 5587 \null
5345 \hbox to 0pt{}%
5346 \chappager 5588 \chappager
5347 \endgroup 5589 \endgroup
5348 \fi 5590 \fi
@@ -5534,6 +5776,8 @@ end
5534% 5776%
5535\def\sectionheading#1#2#3#4{% 5777\def\sectionheading#1#2#3#4{%
5536 {% 5778 {%
5779 \checkenv{}% should not be in an environment.
5780 %
5537 % Switch to the right set of fonts. 5781 % Switch to the right set of fonts.
5538 \csname #2fonts\endcsname \rmisbold 5782 \csname #2fonts\endcsname \rmisbold
5539 % 5783 %
@@ -5645,15 +5889,15 @@ end
5645 % 5889 %
5646 % We'll almost certainly start a paragraph next, so don't let that 5890 % We'll almost certainly start a paragraph next, so don't let that
5647 % glue accumulate. (Not a breakpoint because it's preceded by a 5891 % glue accumulate. (Not a breakpoint because it's preceded by a
5648 % discardable item.) 5892 % discardable item.) However, when a paragraph is not started next
5893 % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
5894 % or the negative glue will cause weirdly wrong output, typically
5895 % obscuring the section heading with something else.
5649 \vskip-\parskip 5896 \vskip-\parskip
5650 % 5897 %
5651 % This is purely so the last item on the list is a known \penalty > 5898 % This is so the last item on the main vertical list is a known
5652 % 10000. This is so \startdefun can avoid allowing breakpoints after 5899 % \penalty > 10000, so \startdefun, etc., can recognize the situation
5653 % section headings. Otherwise, it would insert a valid breakpoint between: 5900 % and do the needful.
5654 %
5655 % @section sec-whatever
5656 % @deffn def-whatever
5657 \penalty 10001 5901 \penalty 10001
5658} 5902}
5659 5903
@@ -5785,6 +6029,7 @@ end
5785\def\summarycontents{% 6029\def\summarycontents{%
5786 \startcontents{\putwordShortTOC}% 6030 \startcontents{\putwordShortTOC}%
5787 % 6031 %
6032 \let\partentry = \shortpartentry
5788 \let\numchapentry = \shortchapentry 6033 \let\numchapentry = \shortchapentry
5789 \let\appentry = \shortchapentry 6034 \let\appentry = \shortchapentry
5790 \let\unnchapentry = \shortunnchapentry 6035 \let\unnchapentry = \shortunnchapentry
@@ -5840,6 +6085,19 @@ end
5840% The last argument is the page number. 6085% The last argument is the page number.
5841% The arguments in between are the chapter number, section number, ... 6086% The arguments in between are the chapter number, section number, ...
5842 6087
6088% Parts, in the main contents. Replace the part number, which doesn't
6089% exist, with an empty box. Let's hope all the numbers have the same width.
6090% Also ignore the page number, which is conventionally not printed.
6091\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
6092\def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
6093%
6094% Parts, in the short toc.
6095\def\shortpartentry#1#2#3#4{%
6096 \penalty-300
6097 \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
6098 \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
6099}
6100
5843% Chapters, in the main contents. 6101% Chapters, in the main contents.
5844\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} 6102\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
5845% 6103%
@@ -5929,9 +6187,9 @@ end
5929\message{environments,} 6187\message{environments,}
5930% @foo ... @end foo. 6188% @foo ... @end foo.
5931 6189
5932% @tex ... @end tex escapes into raw Tex temporarily. 6190% @tex ... @end tex escapes into raw TeX temporarily.
5933% One exception: @ is still an escape character, so that @end tex works. 6191% One exception: @ is still an escape character, so that @end tex works.
5934% But \@ or @@ will get a plain tex @ character. 6192% But \@ or @@ will get a plain @ character.
5935 6193
5936\envdef\tex{% 6194\envdef\tex{%
5937 \setupmarkupstyle{tex}% 6195 \setupmarkupstyle{tex}%
@@ -5948,6 +6206,10 @@ end
5948 \catcode`\'=\other 6206 \catcode`\'=\other
5949 \escapechar=`\\ 6207 \escapechar=`\\
5950 % 6208 %
6209 % ' is active in math mode (mathcode"8000). So reset it, and all our
6210 % other math active characters (just in case), to plain's definitions.
6211 \mathactive
6212 %
5951 \let\b=\ptexb 6213 \let\b=\ptexb
5952 \let\bullet=\ptexbullet 6214 \let\bullet=\ptexbullet
5953 \let\c=\ptexc 6215 \let\c=\ptexc
@@ -6051,6 +6313,12 @@ end
6051 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip 6313 \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
6052 % Flag to tell @lisp, etc., not to narrow margin. 6314 % Flag to tell @lisp, etc., not to narrow margin.
6053 \let\nonarrowing = t% 6315 \let\nonarrowing = t%
6316 %
6317 % If this cartouche directly follows a sectioning command, we need the
6318 % \parskip glue (backspaced over by default) or the cartouche can
6319 % collide with the section heading.
6320 \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
6321 %
6054 \vbox\bgroup 6322 \vbox\bgroup
6055 \baselineskip=0pt\parskip=0pt\lineskip=0pt 6323 \baselineskip=0pt\parskip=0pt\lineskip=0pt
6056 \carttop 6324 \carttop
@@ -6064,7 +6332,7 @@ end
6064 \lineskip=\normlskip 6332 \lineskip=\normlskip
6065 \parskip=\normpskip 6333 \parskip=\normpskip
6066 \vskip -\parskip 6334 \vskip -\parskip
6067 \comment % For explanation, see the end of \def\group. 6335 \comment % For explanation, see the end of def\group.
6068} 6336}
6069\def\Ecartouche{% 6337\def\Ecartouche{%
6070 \ifhmode\par\fi 6338 \ifhmode\par\fi
@@ -6150,41 +6418,42 @@ end
6150} 6418}
6151 6419
6152% We often define two environments, @foo and @smallfoo. 6420% We often define two environments, @foo and @smallfoo.
6153% Let's do it by one command: 6421% Let's do it in one command. #1 is the env name, #2 the definition.
6154\def\makedispenv #1#2{ 6422\def\makedispenvdef#1#2{%
6155 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} 6423 \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
6156 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} 6424 \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
6157 \expandafter\let\csname E#1\endcsname \afterenvbreak 6425 \expandafter\let\csname E#1\endcsname \afterenvbreak
6158 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak 6426 \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
6159} 6427}
6160 6428
6161% Define two synonyms: 6429% Define two environment synonyms (#1 and #2) for an environment.
6162\def\maketwodispenvs #1#2#3{ 6430\def\maketwodispenvdef#1#2#3{%
6163 \makedispenv{#1}{#3} 6431 \makedispenvdef{#1}{#3}%
6164 \makedispenv{#2}{#3} 6432 \makedispenvdef{#2}{#3}%
6165} 6433}
6166 6434%
6167% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. 6435% @lisp: indented, narrowed, typewriter font;
6436% @example: same as @lisp.
6168% 6437%
6169% @smallexample and @smalllisp: use smaller fonts. 6438% @smallexample and @smalllisp: use smaller fonts.
6170% Originally contributed by Pavel@xerox. 6439% Originally contributed by Pavel@xerox.
6171% 6440%
6172\maketwodispenvs {lisp}{example}{% 6441\maketwodispenvdef{lisp}{example}{%
6173 \nonfillstart 6442 \nonfillstart
6174 \tt\setupmarkupstyle{example}% 6443 \tt\setupmarkupstyle{example}%
6175 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. 6444 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
6176 \gobble % eat return 6445 \gobble % eat return
6177} 6446}
6178% @display/@smalldisplay: same as @lisp except keep current font. 6447% @display/@smalldisplay: same as @lisp except keep current font.
6179% 6448%
6180\makedispenv {display}{% 6449\makedispenvdef{display}{%
6181 \nonfillstart 6450 \nonfillstart
6182 \gobble 6451 \gobble
6183} 6452}
6184 6453
6185% @format/@smallformat: same as @display except don't narrow margins. 6454% @format/@smallformat: same as @display except don't narrow margins.
6186% 6455%
6187\makedispenv{format}{% 6456\makedispenvdef{format}{%
6188 \let\nonarrowing = t% 6457 \let\nonarrowing = t%
6189 \nonfillstart 6458 \nonfillstart
6190 \gobble 6459 \gobble
@@ -6203,7 +6472,7 @@ end
6203\envdef\flushright{% 6472\envdef\flushright{%
6204 \let\nonarrowing = t% 6473 \let\nonarrowing = t%
6205 \nonfillstart 6474 \nonfillstart
6206 \advance\leftskip by 0pt plus 1fill 6475 \advance\leftskip by 0pt plus 1fill\relax
6207 \gobble 6476 \gobble
6208} 6477}
6209\let\Eflushright = \afterenvbreak 6478\let\Eflushright = \afterenvbreak
@@ -6238,6 +6507,8 @@ end
6238% we're doing normal filling. So, when using \aboveenvbreak and 6507% we're doing normal filling. So, when using \aboveenvbreak and
6239% \afterenvbreak, temporarily make \parskip 0. 6508% \afterenvbreak, temporarily make \parskip 0.
6240% 6509%
6510\makedispenvdef{quotation}{\quotationstart}
6511%
6241\def\quotationstart{% 6512\def\quotationstart{%
6242 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip 6513 {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
6243 \parindent=0pt 6514 \parindent=0pt
@@ -6253,28 +6524,18 @@ end
6253 \parsearg\quotationlabel 6524 \parsearg\quotationlabel
6254} 6525}
6255 6526
6256\envdef\quotation{%
6257 \setnormaldispenv
6258 \quotationstart
6259}
6260
6261\envdef\smallquotation{%
6262 \setsmalldispenv
6263 \quotationstart
6264}
6265\let\Esmallquotation = \Equotation
6266
6267% We have retained a nonzero parskip for the environment, since we're 6527% We have retained a nonzero parskip for the environment, since we're
6268% doing normal filling. 6528% doing normal filling.
6269% 6529%
6270\def\Equotation{% 6530\def\Equotation{%
6271 \par 6531 \par
6272 \ifx\quotationauthor\undefined\else 6532 \ifx\quotationauthor\thisisundefined\else
6273 % indent a bit. 6533 % indent a bit.
6274 \leftline{\kern 2\leftskip \sl ---\quotationauthor}% 6534 \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
6275 \fi 6535 \fi
6276 {\parskip=0pt \afterenvbreak}% 6536 {\parskip=0pt \afterenvbreak}%
6277} 6537}
6538\def\Esmallquotation{\Equotation}
6278 6539
6279% If we're given an argument, typeset it in bold with a colon after. 6540% If we're given an argument, typeset it in bold with a colon after.
6280\def\quotationlabel#1{% 6541\def\quotationlabel#1{%
@@ -6331,21 +6592,28 @@ end
6331 6592
6332% Setup for the @verbatim environment 6593% Setup for the @verbatim environment
6333% 6594%
6334% Real tab expansion 6595% Real tab expansion.
6335\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount 6596\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
6336% 6597%
6337\def\starttabbox{\setbox0=\hbox\bgroup} 6598% We typeset each line of the verbatim in an \hbox, so we can handle
6599% tabs. The \global is in case the verbatim line starts with an accent,
6600% or some other command that starts with a begin-group. Otherwise, the
6601% entire \verbbox would disappear at the corresponding end-group, before
6602% it is typeset. Meanwhile, we can't have nested verbatim commands
6603% (can we?), so the \global won't be overwriting itself.
6604\newbox\verbbox
6605\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
6338% 6606%
6339\begingroup 6607\begingroup
6340 \catcode`\^^I=\active 6608 \catcode`\^^I=\active
6341 \gdef\tabexpand{% 6609 \gdef\tabexpand{%
6342 \catcode`\^^I=\active 6610 \catcode`\^^I=\active
6343 \def^^I{\leavevmode\egroup 6611 \def^^I{\leavevmode\egroup
6344 \dimen0=\wd0 % the width so far, or since the previous tab 6612 \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
6345 \divide\dimen0 by\tabw 6613 \divide\dimen\verbbox by\tabw
6346 \multiply\dimen0 by\tabw % compute previous multiple of \tabw 6614 \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
6347 \advance\dimen0 by\tabw % advance to next multiple of \tabw 6615 \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
6348 \wd0=\dimen0 \box0 \starttabbox 6616 \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
6349 }% 6617 }%
6350 } 6618 }
6351\endgroup 6619\endgroup
@@ -6354,15 +6622,16 @@ end
6354\def\setupverbatim{% 6622\def\setupverbatim{%
6355 \let\nonarrowing = t% 6623 \let\nonarrowing = t%
6356 \nonfillstart 6624 \nonfillstart
6357 % Easiest (and conventionally used) font for verbatim 6625 \tt % easiest (and conventionally used) font for verbatim
6358 \tt 6626 % The \leavevmode here is for blank lines. Otherwise, we would
6359 \def\par{\leavevmode\egroup\box0\endgraf}% 6627 % never \starttabox and the \egroup would end verbatim mode.
6628 \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
6360 \tabexpand 6629 \tabexpand
6361 \setupmarkupstyle{verbatim}% 6630 \setupmarkupstyle{verbatim}%
6362 % Respect line breaks, 6631 % Respect line breaks,
6363 % print special symbols as themselves, and 6632 % print special symbols as themselves, and
6364 % make each space count 6633 % make each space count.
6365 % must do in this order: 6634 % Must do in this order:
6366 \obeylines \uncatcodespecials \sepspaces 6635 \obeylines \uncatcodespecials \sepspaces
6367 \everypar{\starttabbox}% 6636 \everypar{\starttabbox}%
6368} 6637}
@@ -6419,6 +6688,7 @@ end
6419 \makevalueexpandable 6688 \makevalueexpandable
6420 \setupverbatim 6689 \setupverbatim
6421 \indexnofonts % Allow `@@' and other weird things in file names. 6690 \indexnofonts % Allow `@@' and other weird things in file names.
6691 \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
6422 \input #1 6692 \input #1
6423 \afterenvbreak 6693 \afterenvbreak
6424 }% 6694 }%
@@ -6468,7 +6738,7 @@ end
6468 % commands also insert a nobreak penalty, and we don't want to allow 6738 % commands also insert a nobreak penalty, and we don't want to allow
6469 % a break between a section heading and a defun. 6739 % a break between a section heading and a defun.
6470 % 6740 %
6471 % As a minor refinement, we avoid "club" headers by signalling 6741 % As a further refinement, we avoid "club" headers by signalling
6472 % with penalty of 10003 after the very first @deffn in the 6742 % with penalty of 10003 after the very first @deffn in the
6473 % sequence (see above), and penalty of 10002 after any following 6743 % sequence (see above), and penalty of 10002 after any following
6474 % @def command. 6744 % @def command.
@@ -6505,7 +6775,7 @@ end
6505 #1#2 \endheader 6775 #1#2 \endheader
6506 % common ending: 6776 % common ending:
6507 \interlinepenalty = 10000 6777 \interlinepenalty = 10000
6508 \advance\rightskip by 0pt plus 1fil 6778 \advance\rightskip by 0pt plus 1fil\relax
6509 \endgraf 6779 \endgraf
6510 \nobreak\vskip -\parskip 6780 \nobreak\vskip -\parskip
6511 \penalty\defunpenalty % signal to \startdefun and \dodefunx 6781 \penalty\defunpenalty % signal to \startdefun and \dodefunx
@@ -6535,13 +6805,36 @@ end
6535\def\domakedefun#1#2#3{% 6805\def\domakedefun#1#2#3{%
6536 \envdef#1{% 6806 \envdef#1{%
6537 \startdefun 6807 \startdefun
6808 \doingtypefnfalse % distinguish typed functions from all else
6538 \parseargusing\activeparens{\printdefunline#3}% 6809 \parseargusing\activeparens{\printdefunline#3}%
6539 }% 6810 }%
6540 \def#2{\dodefunx#1}% 6811 \def#2{\dodefunx#1}%
6541 \def#3% 6812 \def#3%
6542} 6813}
6543 6814
6544%%% Untyped functions: 6815\newif\ifdoingtypefn % doing typed function?
6816\newif\ifrettypeownline % typeset return type on its own line?
6817
6818% @deftypefnnewline on|off says whether the return type of typed functions
6819% are printed on their own line. This affects @deftypefn, @deftypefun,
6820% @deftypeop, and @deftypemethod.
6821%
6822\parseargdef\deftypefnnewline{%
6823 \def\temp{#1}%
6824 \ifx\temp\onword
6825 \expandafter\let\csname SETtxideftypefnnl\endcsname
6826 = \empty
6827 \else\ifx\temp\offword
6828 \expandafter\let\csname SETtxideftypefnnl\endcsname
6829 = \relax
6830 \else
6831 \errhelp = \EMsimple
6832 \errmessage{Unknown @txideftypefnnl value `\temp',
6833 must be on|off}%
6834 \fi\fi
6835}
6836
6837% Untyped functions:
6545 6838
6546% @deffn category name args 6839% @deffn category name args
6547\makedefun{deffn}{\deffngeneral{}} 6840\makedefun{deffn}{\deffngeneral{}}
@@ -6560,7 +6853,7 @@ end
6560 \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% 6853 \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
6561} 6854}
6562 6855
6563%%% Typed functions: 6856% Typed functions:
6564 6857
6565% @deftypefn category type name args 6858% @deftypefn category type name args
6566\makedefun{deftypefn}{\deftypefngeneral{}} 6859\makedefun{deftypefn}{\deftypefngeneral{}}
@@ -6575,10 +6868,11 @@ end
6575% 6868%
6576\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% 6869\def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
6577 \dosubind{fn}{\code{#4}}{#1}% 6870 \dosubind{fn}{\code{#4}}{#1}%
6871 \doingtypefntrue
6578 \defname{#2}{#3}{#4}\defunargs{#5\unskip}% 6872 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
6579} 6873}
6580 6874
6581%%% Typed variables: 6875% Typed variables:
6582 6876
6583% @deftypevr category type var args 6877% @deftypevr category type var args
6584\makedefun{deftypevr}{\deftypecvgeneral{}} 6878\makedefun{deftypevr}{\deftypecvgeneral{}}
@@ -6596,7 +6890,7 @@ end
6596 \defname{#2}{#3}{#4}\defunargs{#5\unskip}% 6890 \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
6597} 6891}
6598 6892
6599%%% Untyped variables: 6893% Untyped variables:
6600 6894
6601% @defvr category var args 6895% @defvr category var args
6602\makedefun{defvr}#1 {\deftypevrheader{#1} {} } 6896\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
@@ -6607,7 +6901,8 @@ end
6607% \defcvof {category of}class var args 6901% \defcvof {category of}class var args
6608\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } 6902\def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
6609 6903
6610%%% Type: 6904% Types:
6905
6611% @deftp category name args 6906% @deftp category name args
6612\makedefun{deftp}#1 #2 #3\endheader{% 6907\makedefun{deftp}#1 #2 #3\endheader{%
6613 \doind{tp}{\code{#2}}% 6908 \doind{tp}{\code{#2}}%
@@ -6635,25 +6930,49 @@ end
6635% We are followed by (but not passed) the arguments, if any. 6930% We are followed by (but not passed) the arguments, if any.
6636% 6931%
6637\def\defname#1#2#3{% 6932\def\defname#1#2#3{%
6933 \par
6638 % Get the values of \leftskip and \rightskip as they were outside the @def... 6934 % Get the values of \leftskip and \rightskip as they were outside the @def...
6639 \advance\leftskip by -\defbodyindent 6935 \advance\leftskip by -\defbodyindent
6640 % 6936 %
6641 % How we'll format the type name. Putting it in brackets helps 6937 % Determine if we are typesetting the return type of a typed function
6938 % on a line by itself.
6939 \rettypeownlinefalse
6940 \ifdoingtypefn % doing a typed function specifically?
6941 % then check user option for putting return type on its own line:
6942 \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
6943 \rettypeownlinetrue
6944 \fi
6945 \fi
6946 %
6947 % How we'll format the category name. Putting it in brackets helps
6642 % distinguish it from the body text that may end up on the next line 6948 % distinguish it from the body text that may end up on the next line
6643 % just below it. 6949 % just below it.
6644 \def\temp{#1}% 6950 \def\temp{#1}%
6645 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} 6951 \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
6646 % 6952 %
6647 % Figure out line sizes for the paragraph shape. 6953 % Figure out line sizes for the paragraph shape. We'll always have at
6954 % least two.
6955 \tempnum = 2
6956 %
6648 % The first line needs space for \box0; but if \rightskip is nonzero, 6957 % The first line needs space for \box0; but if \rightskip is nonzero,
6649 % we need only space for the part of \box0 which exceeds it: 6958 % we need only space for the part of \box0 which exceeds it:
6650 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip 6959 \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
6960 %
6961 % If doing a return type on its own line, we'll have another line.
6962 \ifrettypeownline
6963 \advance\tempnum by 1
6964 \def\maybeshapeline{0in \hsize}%
6965 \else
6966 \def\maybeshapeline{}%
6967 \fi
6968 %
6651 % The continuations: 6969 % The continuations:
6652 \dimen2=\hsize \advance\dimen2 by -\defargsindent 6970 \dimen2=\hsize \advance\dimen2 by -\defargsindent
6653 % (plain.tex says that \dimen1 should be used only as global.)
6654 \parshape 2 0in \dimen0 \defargsindent \dimen2
6655 % 6971 %
6656 % Put the type name to the right margin. 6972 % The final paragraph shape:
6973 \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
6974 %
6975 % Put the category name at the right margin.
6657 \noindent 6976 \noindent
6658 \hbox to 0pt{% 6977 \hbox to 0pt{%
6659 \hfil\box0 \kern-\hsize 6978 \hfil\box0 \kern-\hsize
@@ -6675,8 +6994,16 @@ end
6675 % . this still does not fix the ?` and !` ligatures, but so far no 6994 % . this still does not fix the ?` and !` ligatures, but so far no
6676 % one has made identifiers using them :). 6995 % one has made identifiers using them :).
6677 \df \tt 6996 \df \tt
6678 \def\temp{#2}% return value type 6997 \def\temp{#2}% text of the return type
6679 \ifx\temp\empty\else \tclose{\temp} \fi 6998 \ifx\temp\empty\else
6999 \tclose{\temp}% typeset the return type
7000 \ifrettypeownline
7001 % put return type on its own line; prohibit line break following:
7002 \hfil\vadjust{\nobreak}\break
7003 \else
7004 \space % type on same line, so just followed by a space
7005 \fi
7006 \fi % no return type
6680 #3% output function name 7007 #3% output function name
6681 }% 7008 }%
6682 {\rm\enskip}% hskip 0.5 em of \tenrm 7009 {\rm\enskip}% hskip 0.5 em of \tenrm
@@ -6794,7 +7121,7 @@ end
6794 7121
6795% To do this right we need a feature of e-TeX, \scantokens, 7122% To do this right we need a feature of e-TeX, \scantokens,
6796% which we arrange to emulate with a temporary file in ordinary TeX. 7123% which we arrange to emulate with a temporary file in ordinary TeX.
6797\ifx\eTeXversion\undefined 7124\ifx\eTeXversion\thisisundefined
6798 \newwrite\macscribble 7125 \newwrite\macscribble
6799 \def\scantokens#1{% 7126 \def\scantokens#1{%
6800 \toks0={#1}% 7127 \toks0={#1}%
@@ -6805,25 +7132,30 @@ end
6805 } 7132 }
6806\fi 7133\fi
6807 7134
6808\def\scanmacro#1{% 7135\def\scanmacro#1{\begingroup
6809 \begingroup 7136 \newlinechar`\^^M
6810 \newlinechar`\^^M 7137 \let\xeatspaces\eatspaces
6811 \let\xeatspaces\eatspaces 7138 %
6812 % Undo catcode changes of \startcontents and \doprintindex 7139 % Undo catcode changes of \startcontents and \doprintindex
6813 % When called from @insertcopying or (short)caption, we need active 7140 % When called from @insertcopying or (short)caption, we need active
6814 % backslash to get it printed correctly. Previously, we had 7141 % backslash to get it printed correctly. Previously, we had
6815 % \catcode`\\=\other instead. We'll see whether a problem appears 7142 % \catcode`\\=\other instead. We'll see whether a problem appears
6816 % with macro expansion. --kasal, 19aug04 7143 % with macro expansion. --kasal, 19aug04
6817 \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ 7144 \catcode`\@=0 \catcode`\\=\active \escapechar=`\@
6818 % ... and \example 7145 %
6819 \spaceisspace 7146 % ... and for \example:
6820 % 7147 \spaceisspace
6821 % Append \endinput to make sure that TeX does not see the ending newline. 7148 %
6822 % I've verified that it is necessary both for e-TeX and for ordinary TeX 7149 % The \empty here causes a following catcode 5 newline to be eaten as
6823 % --kasal, 29nov03 7150 % part of reading whitespace after a control sequence. It does not
6824 \scantokens{#1\endinput}% 7151 % eat a catcode 13 newline. There's no good way to handle the two
6825 \endgroup 7152 % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX
6826} 7153 % would then have different behavior). See the Macro Details node in
7154 % the manual for the workaround we recommend for macros and
7155 % line-oriented commands.
7156 %
7157 \scantokens{#1\empty}%
7158\endgroup}
6827 7159
6828\def\scanexp#1{% 7160\def\scanexp#1{%
6829 \edef\temp{\noexpand\scanmacro{#1}}% 7161 \edef\temp{\noexpand\scanmacro{#1}}%
@@ -6877,17 +7209,18 @@ end
6877 7209
6878% Macro bodies are absorbed as an argument in a context where 7210% Macro bodies are absorbed as an argument in a context where
6879% all characters are catcode 10, 11 or 12, except \ which is active 7211% all characters are catcode 10, 11 or 12, except \ which is active
6880% (as in normal texinfo). It is necessary to change the definition of \. 7212% (as in normal texinfo). It is necessary to change the definition of \
6881 7213% to recognize macro arguments; this is the job of \mbodybackslash.
7214%
6882% Non-ASCII encodings make 8-bit characters active, so un-activate 7215% Non-ASCII encodings make 8-bit characters active, so un-activate
6883% them to avoid their expansion. Must do this non-globally, to 7216% them to avoid their expansion. Must do this non-globally, to
6884% confine the change to the current group. 7217% confine the change to the current group.
6885 7218%
6886% It's necessary to have hard CRs when the macro is executed. This is 7219% It's necessary to have hard CRs when the macro is executed. This is
6887% done by making ^^M (\endlinechar) catcode 12 when reading the macro 7220% done by making ^^M (\endlinechar) catcode 12 when reading the macro
6888% body, and then making it the \newlinechar in \scanmacro. 7221% body, and then making it the \newlinechar in \scanmacro.
6889 7222%
6890\def\scanctxt{% 7223\def\scanctxt{% used as subroutine
6891 \catcode`\"=\other 7224 \catcode`\"=\other
6892 \catcode`\+=\other 7225 \catcode`\+=\other
6893 \catcode`\<=\other 7226 \catcode`\<=\other
@@ -6900,13 +7233,13 @@ end
6900 \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi 7233 \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
6901} 7234}
6902 7235
6903\def\scanargctxt{% 7236\def\scanargctxt{% used for copying and captions, not macros.
6904 \scanctxt 7237 \scanctxt
6905 \catcode`\\=\other 7238 \catcode`\\=\other
6906 \catcode`\^^M=\other 7239 \catcode`\^^M=\other
6907} 7240}
6908 7241
6909\def\macrobodyctxt{% 7242\def\macrobodyctxt{% used for @macro definitions
6910 \scanctxt 7243 \scanctxt
6911 \catcode`\{=\other 7244 \catcode`\{=\other
6912 \catcode`\}=\other 7245 \catcode`\}=\other
@@ -6914,32 +7247,56 @@ end
6914 \usembodybackslash 7247 \usembodybackslash
6915} 7248}
6916 7249
6917\def\macroargctxt{% 7250\def\macroargctxt{% used when scanning invocations
6918 \scanctxt 7251 \scanctxt
6919 \catcode`\\=\other 7252 \catcode`\\=0
6920} 7253}
7254% why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes"
7255% for the single characters \ { }. Thus, we end up with the "commands"
7256% that would be written @\ @{ @} in a Texinfo document.
7257%
7258% We already have @{ and @}. For @\, we define it here, and only for
7259% this purpose, to produce a typewriter backslash (so, the @\ that we
7260% define for @math can't be used with @macro calls):
7261%
7262\def\\{\normalbackslash}%
7263%
7264% We would like to do this for \, too, since that is what makeinfo does.
7265% But it is not possible, because Texinfo already has a command @, for a
7266% cedilla accent. Documents must use @comma{} instead.
7267%
7268% \anythingelse will almost certainly be an error of some kind.
7269
6921 7270
6922% \mbodybackslash is the definition of \ in @macro bodies. 7271% \mbodybackslash is the definition of \ in @macro bodies.
6923% It maps \foo\ => \csname macarg.foo\endcsname => #N 7272% It maps \foo\ => \csname macarg.foo\endcsname => #N
6924% where N is the macro parameter number. 7273% where N is the macro parameter number.
6925% We define \csname macarg.\endcsname to be \realbackslash, so 7274% We define \csname macarg.\endcsname to be \realbackslash, so
6926% \\ in macro replacement text gets you a backslash. 7275% \\ in macro replacement text gets you a backslash.
6927 7276%
6928{\catcode`@=0 @catcode`@\=@active 7277{\catcode`@=0 @catcode`@\=@active
6929 @gdef@usembodybackslash{@let\=@mbodybackslash} 7278 @gdef@usembodybackslash{@let\=@mbodybackslash}
6930 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} 7279 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
6931} 7280}
6932\expandafter\def\csname macarg.\endcsname{\realbackslash} 7281\expandafter\def\csname macarg.\endcsname{\realbackslash}
6933 7282
7283\def\margbackslash#1{\char`\#1 }
7284
6934\def\macro{\recursivefalse\parsearg\macroxxx} 7285\def\macro{\recursivefalse\parsearg\macroxxx}
6935\def\rmacro{\recursivetrue\parsearg\macroxxx} 7286\def\rmacro{\recursivetrue\parsearg\macroxxx}
6936 7287
6937\def\macroxxx#1{% 7288\def\macroxxx#1{%
6938 \getargs{#1}% now \macname is the macname and \argl the arglist 7289 \getargs{#1}% now \macname is the macname and \argl the arglist
6939 \ifx\argl\empty % no arguments 7290 \ifx\argl\empty % no arguments
6940 \paramno=0% 7291 \paramno=0\relax
6941 \else 7292 \else
6942 \expandafter\parsemargdef \argl;% 7293 \expandafter\parsemargdef \argl;%
7294 \if\paramno>256\relax
7295 \ifx\eTeXversion\thisisundefined
7296 \errhelp = \EMsimple
7297 \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
7298 \fi
7299 \fi
6943 \fi 7300 \fi
6944 \if1\csname ismacro.\the\macname\endcsname 7301 \if1\csname ismacro.\the\macname\endcsname
6945 \message{Warning: redefining \the\macname}% 7302 \message{Warning: redefining \the\macname}%
@@ -6986,46 +7343,269 @@ end
6986% an opening brace, and that opening brace is not consumed. 7343% an opening brace, and that opening brace is not consumed.
6987\def\getargs#1{\getargsxxx#1{}} 7344\def\getargs#1{\getargsxxx#1{}}
6988\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} 7345\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
6989\def\getmacname #1 #2\relax{\macname={#1}} 7346\def\getmacname#1 #2\relax{\macname={#1}}
6990\def\getmacargs#1{\def\argl{#1}} 7347\def\getmacargs#1{\def\argl{#1}}
6991 7348
7349% For macro processing make @ a letter so that we can make Texinfo private macro names.
7350\edef\texiatcatcode{\the\catcode`\@}
7351\catcode `@=11\relax
7352
6992% Parse the optional {params} list. Set up \paramno and \paramlist 7353% Parse the optional {params} list. Set up \paramno and \paramlist
6993% so \defmacro knows what to do. Define \macarg.blah for each blah 7354% so \defmacro knows what to do. Define \macarg.BLAH for each BLAH
6994% in the params list, to be ##N where N is the position in that list. 7355% in the params list to some hook where the argument si to be expanded. If
7356% there are less than 10 arguments that hook is to be replaced by ##N where N
7357% is the position in that list, that is to say the macro arguments are to be
7358% defined `a la TeX in the macro body.
7359%
6995% That gets used by \mbodybackslash (above). 7360% That gets used by \mbodybackslash (above).
6996 7361%
6997% We need to get `macro parameter char #' into several definitions. 7362% We need to get `macro parameter char #' into several definitions.
6998% The technique used is stolen from LaTeX: let \hash be something 7363% The technique used is stolen from LaTeX: let \hash be something
6999% unexpandable, insert that wherever you need a #, and then redefine 7364% unexpandable, insert that wherever you need a #, and then redefine
7000% it to # just before using the token list produced. 7365% it to # just before using the token list produced.
7001% 7366%
7002% The same technique is used to protect \eatspaces till just before 7367% The same technique is used to protect \eatspaces till just before
7003% the macro is used. 7368% the macro is used.
7004 7369%
7005\def\parsemargdef#1;{\paramno=0\def\paramlist{}% 7370% If there are 10 or more arguments, a different technique is used, where the
7006 \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} 7371% hook remains in the body, and when macro is to be expanded the body is
7372% processed again to replace the arguments.
7373%
7374% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
7375% argument N value and then \edef the body (nothing else will expand because of
7376% the catcode regime underwhich the body was input).
7377%
7378% If you compile with TeX (not eTeX), and you have macros with 10 or more
7379% arguments, you need that no macro has more than 256 arguments, otherwise an
7380% error is produced.
7381\def\parsemargdef#1;{%
7382 \paramno=0\def\paramlist{}%
7383 \let\hash\relax
7384 \let\xeatspaces\relax
7385 \parsemargdefxxx#1,;,%
7386 % In case that there are 10 or more arguments we parse again the arguments
7387 % list to set new definitions for the \macarg.BLAH macros corresponding to
7388 % each BLAH argument. It was anyhow needed to parse already once this list
7389 % in order to count the arguments, and as macros with at most 9 arguments
7390 % are by far more frequent than macro with 10 or more arguments, defining
7391 % twice the \macarg.BLAH macros does not cost too much processing power.
7392 \ifnum\paramno<10\relax\else
7393 \paramno0\relax
7394 \parsemmanyargdef@@#1,;,% 10 or more arguments
7395 \fi
7396}
7007\def\parsemargdefxxx#1,{% 7397\def\parsemargdefxxx#1,{%
7008 \if#1;\let\next=\relax 7398 \if#1;\let\next=\relax
7009 \else \let\next=\parsemargdefxxx 7399 \else \let\next=\parsemargdefxxx
7010 \advance\paramno by 1% 7400 \advance\paramno by 1
7011 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname 7401 \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
7012 {\xeatspaces{\hash\the\paramno}}% 7402 {\xeatspaces{\hash\the\paramno}}%
7013 \edef\paramlist{\paramlist\hash\the\paramno,}% 7403 \edef\paramlist{\paramlist\hash\the\paramno,}%
7014 \fi\next} 7404 \fi\next}
7015 7405
7406\def\parsemmanyargdef@@#1,{%
7407 \if#1;\let\next=\relax
7408 \else
7409 \let\next=\parsemmanyargdef@@
7410 \edef\tempb{\eatspaces{#1}}%
7411 \expandafter\def\expandafter\tempa
7412 \expandafter{\csname macarg.\tempb\endcsname}%
7413 % Note that we need some extra \noexpand\noexpand, this is because we
7414 % don't want \the to be expanded in the \parsermacbody as it uses an
7415 % \xdef .
7416 \expandafter\edef\tempa
7417 {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
7418 \advance\paramno by 1\relax
7419 \fi\next}
7420
7016% These two commands read recursive and nonrecursive macro bodies. 7421% These two commands read recursive and nonrecursive macro bodies.
7017% (They're different since rec and nonrec macros end differently.) 7422% (They're different since rec and nonrec macros end differently.)
7423%
7018 7424
7425\catcode `\@\texiatcatcode
7019\long\def\parsemacbody#1@end macro% 7426\long\def\parsemacbody#1@end macro%
7020{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% 7427{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
7021\long\def\parsermacbody#1@end rmacro% 7428\long\def\parsermacbody#1@end rmacro%
7022{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% 7429{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
7430\catcode `\@=11\relax
7431
7432\let\endargs@\relax
7433\let\nil@\relax
7434\def\nilm@{\nil@}%
7435\long\def\nillm@{\nil@}%
7436
7437% This macro is expanded during the Texinfo macro expansion, not during its
7438% definition. It gets all the arguments values and assigns them to macros
7439% macarg.ARGNAME
7440%
7441% #1 is the macro name
7442% #2 is the list of argument names
7443% #3 is the list of argument values
7444\def\getargvals@#1#2#3{%
7445 \def\macargdeflist@{}%
7446 \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
7447 \def\paramlist{#2,\nil@}%
7448 \def\macroname{#1}%
7449 \begingroup
7450 \macroargctxt
7451 \def\argvaluelist{#3,\nil@}%
7452 \def\@tempa{#3}%
7453 \ifx\@tempa\empty
7454 \setemptyargvalues@
7455 \else
7456 \getargvals@@
7457 \fi
7458}
7459
7460%
7461\def\getargvals@@{%
7462 \ifx\paramlist\nilm@
7463 % Some sanity check needed here that \argvaluelist is also empty.
7464 \ifx\argvaluelist\nillm@
7465 \else
7466 \errhelp = \EMsimple
7467 \errmessage{Too many arguments in macro `\macroname'!}%
7468 \fi
7469 \let\next\macargexpandinbody@
7470 \else
7471 \ifx\argvaluelist\nillm@
7472 % No more arguments values passed to macro. Set remaining named-arg
7473 % macros to empty.
7474 \let\next\setemptyargvalues@
7475 \else
7476 % pop current arg name into \@tempb
7477 \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
7478 \expandafter\@tempa\expandafter{\paramlist}%
7479 % pop current argument value into \@tempc
7480 \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
7481 \expandafter\@tempa\expandafter{\argvaluelist}%
7482 % Here \@tempb is the current arg name and \@tempc is the current arg value.
7483 % First place the new argument macro definition into \@tempd
7484 \expandafter\macname\expandafter{\@tempc}%
7485 \expandafter\let\csname macarg.\@tempb\endcsname\relax
7486 \expandafter\def\expandafter\@tempe\expandafter{%
7487 \csname macarg.\@tempb\endcsname}%
7488 \edef\@tempd{\long\def\@tempe{\the\macname}}%
7489 \push@\@tempd\macargdeflist@
7490 \let\next\getargvals@@
7491 \fi
7492 \fi
7493 \next
7494}
7495
7496\def\push@#1#2{%
7497 \expandafter\expandafter\expandafter\def
7498 \expandafter\expandafter\expandafter#2%
7499 \expandafter\expandafter\expandafter{%
7500 \expandafter#1#2}%
7501}
7502
7503% Replace arguments by their values in the macro body, and place the result
7504% in macro \@tempa
7505\def\macvalstoargs@{%
7506 % To do this we use the property that token registers that are \the'ed
7507 % within an \edef expand only once. So we are going to place all argument
7508 % values into respective token registers.
7509 %
7510 % First we save the token context, and initialize argument numbering.
7511 \begingroup
7512 \paramno0\relax
7513 % Then, for each argument number #N, we place the corresponding argument
7514 % value into a new token list register \toks#N
7515 \expandafter\putargsintokens@\saveparamlist@,;,%
7516 % Then, we expand the body so that argument are replaced by their
7517 % values. The trick for values not to be expanded themselves is that they
7518 % are within tokens and that tokens expand only once in an \edef .
7519 \edef\@tempc{\csname mac.\macroname .body\endcsname}%
7520 % Now we restore the token stack pointer to free the token list registers
7521 % which we have used, but we make sure that expanded body is saved after
7522 % group.
7523 \expandafter
7524 \endgroup
7525 \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
7526 }
7527
7528\def\macargexpandinbody@{%
7529 %% Define the named-macro outside of this group and then close this group.
7530 \expandafter
7531 \endgroup
7532 \macargdeflist@
7533 % First the replace in body the macro arguments by their values, the result
7534 % is in \@tempa .
7535 \macvalstoargs@
7536 % Then we point at the \norecurse or \gobble (for recursive) macro value
7537 % with \@tempb .
7538 \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
7539 % Depending on whether it is recursive or not, we need some tailing
7540 % \egroup .
7541 \ifx\@tempb\gobble
7542 \let\@tempc\relax
7543 \else
7544 \let\@tempc\egroup
7545 \fi
7546 % And now we do the real job:
7547 \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
7548 \@tempd
7549}
7023 7550
7024% This defines the macro itself. There are six cases: recursive and 7551\def\putargsintokens@#1,{%
7025% nonrecursive macros of zero, one, and many arguments. 7552 \if#1;\let\next\relax
7553 \else
7554 \let\next\putargsintokens@
7555 % First we allocate the new token list register, and give it a temporary
7556 % alias \@tempb .
7557 \toksdef\@tempb\the\paramno
7558 % Then we place the argument value into that token list register.
7559 \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
7560 \expandafter\@tempb\expandafter{\@tempa}%
7561 \advance\paramno by 1\relax
7562 \fi
7563 \next
7564}
7565
7566% Save the token stack pointer into macro #1
7567\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}}
7568% Restore the token stack pointer from number in macro #1
7569\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax}
7570% newtoks that can be used non \outer .
7571\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi}
7572
7573% Tailing missing arguments are set to empty
7574\def\setemptyargvalues@{%
7575 \ifx\paramlist\nilm@
7576 \let\next\macargexpandinbody@
7577 \else
7578 \expandafter\setemptyargvaluesparser@\paramlist\endargs@
7579 \let\next\setemptyargvalues@
7580 \fi
7581 \next
7582}
7583
7584\def\setemptyargvaluesparser@#1,#2\endargs@{%
7585 \expandafter\def\expandafter\@tempa\expandafter{%
7586 \expandafter\def\csname macarg.#1\endcsname{}}%
7587 \push@\@tempa\macargdeflist@
7588 \def\paramlist{#2}%
7589}
7590
7591% #1 is the element target macro
7592% #2 is the list macro
7593% #3,#4\endargs@ is the list value
7594\def\pop@#1#2#3,#4\endargs@{%
7595 \def#1{#3}%
7596 \def#2{#4}%
7597}
7598\long\def\longpop@#1#2#3,#4\endargs@{%
7599 \long\def#1{#3}%
7600 \long\def#2{#4}%
7601}
7602
7603% This defines a Texinfo @macro. There are eight cases: recursive and
7604% nonrecursive macros of zero, one, up to nine, and many arguments.
7026% Much magic with \expandafter here. 7605% Much magic with \expandafter here.
7027% \xdef is used so that macro definitions will survive the file 7606% \xdef is used so that macro definitions will survive the file
7028% they're defined in; @include reads the file inside a group. 7607% they're defined in; @include reads the file inside a group.
7608%
7029\def\defmacro{% 7609\def\defmacro{%
7030 \let\hash=##% convert placeholders to macro parameter chars 7610 \let\hash=##% convert placeholders to macro parameter chars
7031 \ifrecursive 7611 \ifrecursive
@@ -7040,17 +7620,25 @@ end
7040 \expandafter\noexpand\csname\the\macname xxx\endcsname}% 7620 \expandafter\noexpand\csname\the\macname xxx\endcsname}%
7041 \expandafter\xdef\csname\the\macname xxx\endcsname##1{% 7621 \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
7042 \egroup\noexpand\scanmacro{\temp}}% 7622 \egroup\noexpand\scanmacro{\temp}}%
7043 \else % many 7623 \else
7044 \expandafter\xdef\csname\the\macname\endcsname{% 7624 \ifnum\paramno<10\relax % at most 9
7045 \bgroup\noexpand\macroargctxt 7625 \expandafter\xdef\csname\the\macname\endcsname{%
7046 \noexpand\csname\the\macname xx\endcsname}% 7626 \bgroup\noexpand\macroargctxt
7047 \expandafter\xdef\csname\the\macname xx\endcsname##1{% 7627 \noexpand\csname\the\macname xx\endcsname}%
7048 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% 7628 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
7049 \expandafter\expandafter 7629 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
7050 \expandafter\xdef 7630 \expandafter\expandafter
7051 \expandafter\expandafter 7631 \expandafter\xdef
7052 \csname\the\macname xxx\endcsname 7632 \expandafter\expandafter
7053 \paramlist{\egroup\noexpand\scanmacro{\temp}}% 7633 \csname\the\macname xxx\endcsname
7634 \paramlist{\egroup\noexpand\scanmacro{\temp}}%
7635 \else % 10 or more
7636 \expandafter\xdef\csname\the\macname\endcsname{%
7637 \noexpand\getargvals@{\the\macname}{\argl}%
7638 }%
7639 \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
7640 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
7641 \fi
7054 \fi 7642 \fi
7055 \else 7643 \else
7056 \ifcase\paramno 7644 \ifcase\paramno
@@ -7067,29 +7655,40 @@ end
7067 \egroup 7655 \egroup
7068 \noexpand\norecurse{\the\macname}% 7656 \noexpand\norecurse{\the\macname}%
7069 \noexpand\scanmacro{\temp}\egroup}% 7657 \noexpand\scanmacro{\temp}\egroup}%
7070 \else % many 7658 \else % at most 9
7071 \expandafter\xdef\csname\the\macname\endcsname{% 7659 \ifnum\paramno<10\relax
7072 \bgroup\noexpand\macroargctxt 7660 \expandafter\xdef\csname\the\macname\endcsname{%
7073 \expandafter\noexpand\csname\the\macname xx\endcsname}% 7661 \bgroup\noexpand\macroargctxt
7074 \expandafter\xdef\csname\the\macname xx\endcsname##1{% 7662 \expandafter\noexpand\csname\the\macname xx\endcsname}%
7075 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% 7663 \expandafter\xdef\csname\the\macname xx\endcsname##1{%
7076 \expandafter\expandafter 7664 \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
7077 \expandafter\xdef 7665 \expandafter\expandafter
7078 \expandafter\expandafter 7666 \expandafter\xdef
7079 \csname\the\macname xxx\endcsname 7667 \expandafter\expandafter
7080 \paramlist{% 7668 \csname\the\macname xxx\endcsname
7081 \egroup 7669 \paramlist{%
7082 \noexpand\norecurse{\the\macname}% 7670 \egroup
7083 \noexpand\scanmacro{\temp}\egroup}% 7671 \noexpand\norecurse{\the\macname}%
7672 \noexpand\scanmacro{\temp}\egroup}%
7673 \else % 10 or more:
7674 \expandafter\xdef\csname\the\macname\endcsname{%
7675 \noexpand\getargvals@{\the\macname}{\argl}%
7676 }%
7677 \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
7678 \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse
7679 \fi
7084 \fi 7680 \fi
7085 \fi} 7681 \fi}
7086 7682
7683\catcode `\@\texiatcatcode\relax
7684
7087\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} 7685\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
7088 7686
7089% \braceorline decides whether the next nonwhitespace character is a 7687% \braceorline decides whether the next nonwhitespace character is a
7090% {. If so it reads up to the closing }, if not, it reads the whole 7688% {. If so it reads up to the closing }, if not, it reads the whole
7091% line. Whatever was read is then fed to the next control sequence 7689% line. Whatever was read is then fed to the next control sequence
7092% as an argument (by \parsebrace or \parsearg) 7690% as an argument (by \parsebrace or \parsearg).
7691%
7093\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} 7692\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
7094\def\braceorlinexxx{% 7693\def\braceorlinexxx{%
7095 \ifx\nchar\bgroup\else 7694 \ifx\nchar\bgroup\else
@@ -7099,7 +7698,8 @@ end
7099 7698
7100% @alias. 7699% @alias.
7101% We need some trickery to remove the optional spaces around the equal 7700% We need some trickery to remove the optional spaces around the equal
7102% sign. Just make them active and then expand them all to nothing. 7701% sign. Make them active and then expand them all to nothing.
7702%
7103\def\alias{\parseargusing\obeyspaces\aliasxxx} 7703\def\alias{\parseargusing\obeyspaces\aliasxxx}
7104\def\aliasxxx #1{\aliasyyy#1\relax} 7704\def\aliasxxx #1{\aliasyyy#1\relax}
7105\def\aliasyyy #1=#2\relax{% 7705\def\aliasyyy #1=#2\relax{%
@@ -7120,7 +7720,8 @@ end
7120 7720
7121% @inforef is relatively simple. 7721% @inforef is relatively simple.
7122\def\inforef #1{\inforefzzz #1,,,,**} 7722\def\inforef #1{\inforefzzz #1,,,,**}
7123\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, 7723\def\inforefzzz #1,#2,#3,#4**{%
7724 \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
7124 node \samp{\ignorespaces#1{}}} 7725 node \samp{\ignorespaces#1{}}}
7125 7726
7126% @node's only job in TeX is to define \lastnode, which is used in 7727% @node's only job in TeX is to define \lastnode, which is used in
@@ -7181,11 +7782,32 @@ end
7181 \toks0 = \expandafter{\lastsection}% 7782 \toks0 = \expandafter{\lastsection}%
7182 \immediate \writexrdef{title}{\the\toks0 }% 7783 \immediate \writexrdef{title}{\the\toks0 }%
7183 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. 7784 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
7184 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, during \shipout 7785 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
7185 }% 7786 }%
7186 \fi 7787 \fi
7187} 7788}
7188 7789
7790% @xrefautosectiontitle on|off says whether @section(ing) names are used
7791% automatically in xrefs, if the third arg is not explicitly specified.
7792% This was provided as a "secret" @set xref-automatic-section-title
7793% variable, now it's official.
7794%
7795\parseargdef\xrefautomaticsectiontitle{%
7796 \def\temp{#1}%
7797 \ifx\temp\onword
7798 \expandafter\let\csname SETxref-automatic-section-title\endcsname
7799 = \empty
7800 \else\ifx\temp\offword
7801 \expandafter\let\csname SETxref-automatic-section-title\endcsname
7802 = \relax
7803 \else
7804 \errhelp = \EMsimple
7805 \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
7806 must be on|off}%
7807 \fi\fi
7808}
7809
7810
7189% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is 7811% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
7190% the node name, #2 the name of the Info cross-reference, #3 the printed 7812% the node name, #2 the name of the Info cross-reference, #3 the printed
7191% node name, #4 the name of the Info file, #5 the name of the printed 7813% node name, #4 the name of the Info file, #5 the name of the printed
@@ -7194,26 +7816,36 @@ end
7194\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} 7816\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
7195\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} 7817\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
7196\def\ref#1{\xrefX[#1,,,,,,,]} 7818\def\ref#1{\xrefX[#1,,,,,,,]}
7819%
7820\newbox\topbox
7821\newbox\printedrefnamebox
7822\newbox\printedmanualbox
7823%
7197\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup 7824\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
7198 \unsepspaces 7825 \unsepspaces
7199 \def\printedmanual{\ignorespaces #5}% 7826 %
7200 \def\printedrefname{\ignorespaces #3}% 7827 \def\printedrefname{\ignorespaces #3}%
7201 \setbox1=\hbox{\printedmanual\unskip}% 7828 \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
7202 \setbox0=\hbox{\printedrefname\unskip}% 7829 %
7203 \ifdim \wd0 = 0pt 7830 \def\printedmanual{\ignorespaces #5}%
7831 \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
7832 %
7833 % If the printed reference name (arg #3) was not explicitly given in
7834 % the @xref, figure out what we want to use.
7835 \ifdim \wd\printedrefnamebox = 0pt
7204 % No printed node name was explicitly given. 7836 % No printed node name was explicitly given.
7205 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax 7837 \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
7206 % Use the node name inside the square brackets. 7838 % Not auto section-title: use node name inside the square brackets.
7207 \def\printedrefname{\ignorespaces #1}% 7839 \def\printedrefname{\ignorespaces #1}%
7208 \else 7840 \else
7209 % Use the actual chapter/section title appear inside 7841 % Auto section-title: use chapter/section title inside
7210 % the square brackets. Use the real section title if we have it. 7842 % the square brackets if we have it.
7211 \ifdim \wd1 > 0pt 7843 \ifdim \wd\printedmanualbox > 0pt
7212 % It is in another manual, so we don't have it. 7844 % It is in another manual, so we don't have it; use node name.
7213 \def\printedrefname{\ignorespaces #1}% 7845 \def\printedrefname{\ignorespaces #1}%
7214 \else 7846 \else
7215 \ifhavexrefs 7847 \ifhavexrefs
7216 % We know the real title if we have the xref values. 7848 % We (should) know the real title if we have the xref values.
7217 \def\printedrefname{\refx{#1-title}{}}% 7849 \def\printedrefname{\refx{#1-title}{}}%
7218 \else 7850 \else
7219 % Otherwise just copy the Info node name. 7851 % Otherwise just copy the Info node name.
@@ -7227,13 +7859,13 @@ end
7227 \ifpdf 7859 \ifpdf
7228 {\indexnofonts 7860 {\indexnofonts
7229 \turnoffactive 7861 \turnoffactive
7862 \makevalueexpandable
7230 % This expands tokens, so do it after making catcode changes, so _ 7863 % This expands tokens, so do it after making catcode changes, so _
7231 % etc. don't get their TeX definitions. 7864 % etc. don't get their TeX definitions.
7232 \getfilename{#4}% 7865 \getfilename{#4}%
7233 % 7866 %
7234 % See comments at \activebackslashdouble. 7867 \edef\pdfxrefdest{#1}%
7235 {\activebackslashdouble \xdef\pdfxrefdest{#1}% 7868 \txiescapepdf\pdfxrefdest
7236 \backslashparens\pdfxrefdest}%
7237 % 7869 %
7238 \leavevmode 7870 \leavevmode
7239 \startlink attr{/Border [0 0 0]}% 7871 \startlink attr{/Border [0 0 0]}%
@@ -7260,7 +7892,7 @@ end
7260 \iffloat\Xthisreftitle 7892 \iffloat\Xthisreftitle
7261 % If the user specified the print name (third arg) to the ref, 7893 % If the user specified the print name (third arg) to the ref,
7262 % print it instead of our usual "Figure 1.2". 7894 % print it instead of our usual "Figure 1.2".
7263 \ifdim\wd0 = 0pt 7895 \ifdim\wd\printedrefnamebox = 0pt
7264 \refx{#1-snt}{}% 7896 \refx{#1-snt}{}%
7265 \else 7897 \else
7266 \printedrefname 7898 \printedrefname
@@ -7268,21 +7900,46 @@ end
7268 % 7900 %
7269 % if the user also gave the printed manual name (fifth arg), append 7901 % if the user also gave the printed manual name (fifth arg), append
7270 % "in MANUALNAME". 7902 % "in MANUALNAME".
7271 \ifdim \wd1 > 0pt 7903 \ifdim \wd\printedmanualbox > 0pt
7272 \space \putwordin{} \cite{\printedmanual}% 7904 \space \putwordin{} \cite{\printedmanual}%
7273 \fi 7905 \fi
7274 \else 7906 \else
7275 % node/anchor (non-float) references. 7907 % node/anchor (non-float) references.
7276 % 7908 %
7277 % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not 7909 % If we use \unhbox to print the node names, TeX does not insert
7278 % insert empty discretionaries after hyphens, which means that it will 7910 % empty discretionaries after hyphens, which means that it will not
7279 % not find a line break at a hyphen in a node names. Since some manuals 7911 % find a line break at a hyphen in a node names. Since some manuals
7280 % are best written with fairly long node names, containing hyphens, this 7912 % are best written with fairly long node names, containing hyphens,
7281 % is a loss. Therefore, we give the text of the node name again, so it 7913 % this is a loss. Therefore, we give the text of the node name
7282 % is as if TeX is seeing it for the first time. 7914 % again, so it is as if TeX is seeing it for the first time.
7283 \ifdim \wd1 > 0pt 7915 %
7284 \putwordSection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% 7916 % Cross-manual reference. Only include the "Section ``foo'' in" if
7917 % the foo is neither missing or Top. Thus, @xref{,,,foo,The Foo Manual}
7918 % outputs simply "see The Foo Manual".
7919 \ifdim \wd\printedmanualbox > 0pt
7920 % What is the 7sp about? The idea is that we also want to omit
7921 % the Section part if we would be printing "Top", since they are
7922 % clearly trying to refer to the whole manual. But, this being
7923 % TeX, we can't easily compare strings while ignoring the possible
7924 % spaces before and after in the input. By adding the arbitrary
7925 % 7sp, we make it much less likely that a real node name would
7926 % happen to have the same width as "Top" (e.g., in a monospaced font).
7927 % I hope it will never happen in practice.
7928 %
7929 % For the same basic reason, we retypeset the "Top" at every
7930 % reference, since the current font is indeterminate.
7931 %
7932 \setbox\topbox = \hbox{Top\kern7sp}%
7933 \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
7934 \ifdim \wd2 > 7sp
7935 \ifdim \wd2 = \wd\topbox \else
7936 \putwordSection{} ``\printedrefname'' \putwordin{}\space
7937 \fi
7938 \fi
7939 \cite{\printedmanual}%
7285 \else 7940 \else
7941 % Reference in this manual.
7942 %
7286 % _ (for example) has to be the character _ for the purposes of the 7943 % _ (for example) has to be the character _ for the purposes of the
7287 % control sequence corresponding to the node, but it has to expand 7944 % control sequence corresponding to the node, but it has to expand
7288 % into the usual \leavevmode...\vrule stuff for purposes of 7945 % into the usual \leavevmode...\vrule stuff for purposes of
@@ -7294,7 +7951,7 @@ end
7294 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% 7951 \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
7295 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi 7952 \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
7296 }% 7953 }%
7297 % output the `[mynode]' via a macro so it can be overridden. 7954 % output the `[mynode]' via the macro below so it can be overridden.
7298 \xrefprintnodename\printedrefname 7955 \xrefprintnodename\printedrefname
7299 % 7956 %
7300 % But we always want a comma and a space: 7957 % But we always want a comma and a space:
@@ -7357,7 +8014,8 @@ end
7357 \angleleft un\-de\-fined\angleright 8014 \angleleft un\-de\-fined\angleright
7358 \iflinks 8015 \iflinks
7359 \ifhavexrefs 8016 \ifhavexrefs
7360 \message{\linenumber Undefined cross reference `#1'.}% 8017 {\toks0 = {#1}% avoid expansion of possibly-complex value
8018 \message{\linenumber Undefined cross reference `\the\toks0'.}}%
7361 \else 8019 \else
7362 \ifwarnedxrefs\else 8020 \ifwarnedxrefs\else
7363 \global\warnedxrefstrue 8021 \global\warnedxrefstrue
@@ -7521,7 +8179,7 @@ end
7521% space to prevent strange expansion errors.) 8179% space to prevent strange expansion errors.)
7522\def\supereject{\par\penalty -20000\footnoteno =0 } 8180\def\supereject{\par\penalty -20000\footnoteno =0 }
7523 8181
7524% @footnotestyle is meaningful for info output only. 8182% @footnotestyle is meaningful for Info output only.
7525\let\footnotestyle=\comment 8183\let\footnotestyle=\comment
7526 8184
7527{\catcode `\@=11 8185{\catcode `\@=11
@@ -7584,6 +8242,8 @@ end
7584 % expands into a box, it must come within the paragraph, lest it 8242 % expands into a box, it must come within the paragraph, lest it
7585 % provide a place where TeX can split the footnote. 8243 % provide a place where TeX can split the footnote.
7586 \footstrut 8244 \footstrut
8245 %
8246 % Invoke rest of plain TeX footnote routine.
7587 \futurelet\next\fo@t 8247 \futurelet\next\fo@t
7588} 8248}
7589}%end \catcode `\@=11 8249}%end \catcode `\@=11
@@ -7671,7 +8331,7 @@ end
7671 it from ftp://tug.org/tex/epsf.tex.} 8331 it from ftp://tug.org/tex/epsf.tex.}
7672% 8332%
7673\def\image#1{% 8333\def\image#1{%
7674 \ifx\epsfbox\undefined 8334 \ifx\epsfbox\thisisundefined
7675 \ifwarnednoepsf \else 8335 \ifwarnednoepsf \else
7676 \errhelp = \noepsfhelp 8336 \errhelp = \noepsfhelp
7677 \errmessage{epsf.tex not found, images will be ignored}% 8337 \errmessage{epsf.tex not found, images will be ignored}%
@@ -7687,7 +8347,7 @@ end
7687% #2 is (optional) width, #3 is (optional) height. 8347% #2 is (optional) width, #3 is (optional) height.
7688% #4 is (ignored optional) html alt text. 8348% #4 is (ignored optional) html alt text.
7689% #5 is (ignored optional) extension. 8349% #5 is (ignored optional) extension.
7690% #6 is just the usual extra ignored arg for parsing this stuff. 8350% #6 is just the usual extra ignored arg for parsing stuff.
7691\newif\ifimagevmode 8351\newif\ifimagevmode
7692\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup 8352\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
7693 \catcode`\^^M = 5 % in case we're inside an example 8353 \catcode`\^^M = 5 % in case we're inside an example
@@ -7695,6 +8355,13 @@ end
7695 % If the image is by itself, center it. 8355 % If the image is by itself, center it.
7696 \ifvmode 8356 \ifvmode
7697 \imagevmodetrue 8357 \imagevmodetrue
8358 \else \ifx\centersub\centerV
8359 % for @center @image, we need a vbox so we can have our vertical space
8360 \imagevmodetrue
8361 \vbox\bgroup % vbox has better behavior than vtop herev
8362 \fi\fi
8363 %
8364 \ifimagevmode
7698 \nobreak\medskip 8365 \nobreak\medskip
7699 % Usually we'll have text after the image which will insert 8366 % Usually we'll have text after the image which will insert
7700 % \parskip glue, so insert it here too to equalize the space 8367 % \parskip glue, so insert it here too to equalize the space
@@ -7704,9 +8371,13 @@ end
7704 \fi 8371 \fi
7705 % 8372 %
7706 % Leave vertical mode so that indentation from an enclosing 8373 % Leave vertical mode so that indentation from an enclosing
7707 % environment such as @quotation is respected. On the other hand, if 8374 % environment such as @quotation is respected.
7708 % it's at the top level, we don't want the normal paragraph indentation. 8375 % However, if we're at the top level, we don't want the
7709 \noindent 8376 % normal paragraph indentation.
8377 % On the other hand, if we are in the case of @center @image, we don't
8378 % want to start a paragraph, which will create a hsize-width box and
8379 % eradicate the centering.
8380 \ifx\centersub\centerV\else \noindent \fi
7710 % 8381 %
7711 % Output the image. 8382 % Output the image.
7712 \ifpdf 8383 \ifpdf
@@ -7718,7 +8389,10 @@ end
7718 \epsfbox{#1.eps}% 8389 \epsfbox{#1.eps}%
7719 \fi 8390 \fi
7720 % 8391 %
7721 \ifimagevmode \medskip \fi % space after the standalone image 8392 \ifimagevmode
8393 \medskip % space after a standalone image
8394 \fi
8395 \ifx\centersub\centerV \egroup \fi
7722\endgroup} 8396\endgroup}
7723 8397
7724 8398
@@ -8136,7 +8810,7 @@ directory should work if nowhere else does.}
8136% 8810%
8137% Latin1 (ISO-8859-1) character definitions. 8811% Latin1 (ISO-8859-1) character definitions.
8138\def\latonechardefs{% 8812\def\latonechardefs{%
8139 \gdef^^a0{~} 8813 \gdef^^a0{\tie}
8140 \gdef^^a1{\exclamdown} 8814 \gdef^^a1{\exclamdown}
8141 \gdef^^a2{\missingcharmsg{CENT SIGN}} 8815 \gdef^^a2{\missingcharmsg{CENT SIGN}}
8142 \gdef^^a3{{\pounds}} 8816 \gdef^^a3{{\pounds}}
@@ -8166,7 +8840,7 @@ directory should work if nowhere else does.}
8166 \gdef^^b9{$^1$} 8840 \gdef^^b9{$^1$}
8167 \gdef^^ba{\ordm} 8841 \gdef^^ba{\ordm}
8168 % 8842 %
8169 \gdef^^bb{\guilletright} 8843 \gdef^^bb{\guillemetright}
8170 \gdef^^bc{$1\over4$} 8844 \gdef^^bc{$1\over4$}
8171 \gdef^^bd{$1\over2$} 8845 \gdef^^bd{$1\over2$}
8172 \gdef^^be{$3\over4$} 8846 \gdef^^be{$3\over4$}
@@ -8258,7 +8932,7 @@ directory should work if nowhere else does.}
8258 8932
8259% Latin2 (ISO-8859-2) character definitions. 8933% Latin2 (ISO-8859-2) character definitions.
8260\def\lattwochardefs{% 8934\def\lattwochardefs{%
8261 \gdef^^a0{~} 8935 \gdef^^a0{\tie}
8262 \gdef^^a1{\ogonek{A}} 8936 \gdef^^a1{\ogonek{A}}
8263 \gdef^^a2{\u{}} 8937 \gdef^^a2{\u{}}
8264 \gdef^^a3{\L} 8938 \gdef^^a3{\L}
@@ -8339,8 +9013,8 @@ directory should work if nowhere else does.}
8339 \gdef^^ea{\ogonek{e}} 9013 \gdef^^ea{\ogonek{e}}
8340 \gdef^^eb{\"e} 9014 \gdef^^eb{\"e}
8341 \gdef^^ec{\v e} 9015 \gdef^^ec{\v e}
8342 \gdef^^ed{\'\i} 9016 \gdef^^ed{\'{\dotless{i}}}
8343 \gdef^^ee{\^\i} 9017 \gdef^^ee{\^{\dotless{i}}}
8344 \gdef^^ef{\v d} 9018 \gdef^^ef{\v d}
8345 % 9019 %
8346 \gdef^^f0{\dh} 9020 \gdef^^f0{\dh}
@@ -8431,7 +9105,7 @@ directory should work if nowhere else does.}
8431 9105
8432 \gdef\DeclareUnicodeCharacter#1#2{% 9106 \gdef\DeclareUnicodeCharacter#1#2{%
8433 \countUTFz = "#1\relax 9107 \countUTFz = "#1\relax
8434 \wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}% 9108 %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
8435 \begingroup 9109 \begingroup
8436 \parseXMLCharref 9110 \parseXMLCharref
8437 \def\UTFviiiTwoOctets##1##2{% 9111 \def\UTFviiiTwoOctets##1##2{%
@@ -8899,8 +9573,8 @@ directory should work if nowhere else does.}
8899% Prevent underfull vbox error messages. 9573% Prevent underfull vbox error messages.
8900\vbadness = 10000 9574\vbadness = 10000
8901 9575
8902% Don't be so finicky about underfull hboxes, either. 9576% Don't be very finicky about underfull hboxes, either.
8903\hbadness = 2000 9577\hbadness = 6666
8904 9578
8905% Following George Bush, get rid of widows and orphans. 9579% Following George Bush, get rid of widows and orphans.
8906\widowpenalty=10000 9580\widowpenalty=10000
@@ -9107,28 +9781,21 @@ directory should work if nowhere else does.}
9107 9781
9108\message{and turning on texinfo input format.} 9782\message{and turning on texinfo input format.}
9109 9783
9784\def^^L{\par} % remove \outer, so ^L can appear in an @comment
9785
9110% DEL is a comment character, in case @c does not suffice. 9786% DEL is a comment character, in case @c does not suffice.
9111\catcode`\^^? = 14 9787\catcode`\^^? = 14
9112 9788
9113% Define macros to output various characters with catcode for normal text. 9789% Define macros to output various characters with catcode for normal text.
9114\catcode`\"=\other 9790\catcode`\"=\other \def\normaldoublequote{"}
9115\catcode`\~=\other 9791\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
9116\catcode`\^=\other 9792\catcode`\+=\other \def\normalplus{+}
9117\catcode`\_=\other 9793\catcode`\<=\other \def\normalless{<}
9118\catcode`\|=\other 9794\catcode`\>=\other \def\normalgreater{>}
9119\catcode`\<=\other 9795\catcode`\^=\other \def\normalcaret{^}
9120\catcode`\>=\other 9796\catcode`\_=\other \def\normalunderscore{_}
9121\catcode`\+=\other 9797\catcode`\|=\other \def\normalverticalbar{|}
9122\catcode`\$=\other 9798\catcode`\~=\other \def\normaltilde{~}
9123\def\normaldoublequote{"}
9124\def\normaltilde{~}
9125\def\normalcaret{^}
9126\def\normalunderscore{_}
9127\def\normalverticalbar{|}
9128\def\normalless{<}
9129\def\normalgreater{>}
9130\def\normalplus{+}
9131\def\normaldollar{$}%$ font-lock fix
9132 9799
9133% This macro is used to make a character print one way in \tt 9800% This macro is used to make a character print one way in \tt
9134% (where it can probably be output as-is), and another way in other fonts, 9801% (where it can probably be output as-is), and another way in other fonts,
@@ -9206,14 +9873,24 @@ directory should work if nowhere else does.}
9206 9873
9207% In texinfo, backslash is an active character; it prints the backslash 9874% In texinfo, backslash is an active character; it prints the backslash
9208% in fixed width font. 9875% in fixed width font.
9209\catcode`\\=\active 9876\catcode`\\=\active % @ for escape char from now on.
9210@def@normalbackslash{{@tt@backslashcurfont}} 9877
9878% The story here is that in math mode, the \char of \backslashcurfont
9879% ends up printing the roman \ from the math symbol font (because \char
9880% in math mode uses the \mathcode, and plain.tex sets
9881% \mathcode`\\="026E). It seems better for @backslashchar{} to always
9882% print a typewriter backslash, hence we use an explicit \mathchar,
9883% which is the decimal equivalent of "715c (class 7, e.g., use \fam;
9884% ignored family value; char position "5C). We can't use " for the
9885% usual hex value because it has already been made active.
9886@def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
9887@let@backslashchar = @normalbackslash % @backslashchar{} is for user documents.
9888
9211% On startup, @fixbackslash assigns: 9889% On startup, @fixbackslash assigns:
9212% @let \ = @normalbackslash 9890% @let \ = @normalbackslash
9213
9214% \rawbackslash defines an active \ to do \backslashcurfont. 9891% \rawbackslash defines an active \ to do \backslashcurfont.
9215% \otherbackslash defines an active \ to be a literal `\' character with 9892% \otherbackslash defines an active \ to be a literal `\' character with
9216% catcode other. 9893% catcode other. We switch back and forth between these.
9217@gdef@rawbackslash{@let\=@backslashcurfont} 9894@gdef@rawbackslash{@let\=@backslashcurfont}
9218@gdef@otherbackslash{@let\=@realbackslash} 9895@gdef@otherbackslash{@let\=@realbackslash}
9219 9896
@@ -9221,16 +9898,16 @@ directory should work if nowhere else does.}
9221% the literal character `\'. 9898% the literal character `\'.
9222% 9899%
9223@def@normalturnoffactive{% 9900@def@normalturnoffactive{%
9224 @let\=@normalbackslash
9225 @let"=@normaldoublequote 9901 @let"=@normaldoublequote
9226 @let~=@normaltilde 9902 @let$=@normaldollar %$ font-lock fix
9903 @let+=@normalplus
9904 @let<=@normalless
9905 @let>=@normalgreater
9906 @let\=@normalbackslash
9227 @let^=@normalcaret 9907 @let^=@normalcaret
9228 @let_=@normalunderscore 9908 @let_=@normalunderscore
9229 @let|=@normalverticalbar 9909 @let|=@normalverticalbar
9230 @let<=@normalless 9910 @let~=@normaltilde
9231 @let>=@normalgreater
9232 @let+=@normalplus
9233 @let$=@normaldollar %$ font-lock fix
9234 @markupsetuplqdefault 9911 @markupsetuplqdefault
9235 @markupsetuprqdefault 9912 @markupsetuprqdefault
9236 @unsepspaces 9913 @unsepspaces
@@ -9262,10 +9939,19 @@ directory should work if nowhere else does.}
9262% Say @foo, not \foo, in error messages. 9939% Say @foo, not \foo, in error messages.
9263@escapechar = `@@ 9940@escapechar = `@@
9264 9941
9942% These (along with & and #) are made active for url-breaking, so need
9943% active definitions as the normal characters.
9944@def@normaldot{.}
9945@def@normalquest{?}
9946@def@normalslash{/}
9947
9265% These look ok in all fonts, so just make them not special. 9948% These look ok in all fonts, so just make them not special.
9266@catcode`@& = @other 9949% @hashchar{} gets its own user-level command, because of #line.
9267@catcode`@# = @other 9950@catcode`@& = @other @def@normalamp{&}
9268@catcode`@% = @other 9951@catcode`@# = @other @def@normalhash{#}
9952@catcode`@% = @other @def@normalpercent{%}
9953
9954@let @hashchar = @normalhash
9269 9955
9270@c Finally, make ` and ' active, so that txicodequoteundirected and 9956@c Finally, make ` and ' active, so that txicodequoteundirected and
9271@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we 9957@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we