aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--README24
-rw-r--r--configure.ac208
-rw-r--r--contrib/Makefile.am1
-rw-r--r--contrib/ascebc11
-rw-r--r--contrib/xcc2
-rw-r--r--doc/texinfo.tex2424
-rw-r--r--src/daemon/connection.c114
-rw-r--r--src/daemon/connection_https.c92
-rw-r--r--src/daemon/daemon.c202
-rw-r--r--src/daemon/https/tls/gnutls_buffers.c11
-rw-r--r--src/daemon/internal.h37
12 files changed, 2470 insertions, 658 deletions
diff --git a/Makefile.am b/Makefile.am
index bc0e019b..7cd847ec 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
1ACLOCAL_AMFLAGS = -I m4 1ACLOCAL_AMFLAGS = -I m4
2SUBDIRS = src doc m4 . 2SUBDIRS = contrib src doc m4 .
3EXTRA_DIST = acinclude.m4 3EXTRA_DIST = acinclude.m4
4 4
diff --git a/README b/README
index 71aee37c..0d2d1ab5 100644
--- a/README
+++ b/README
@@ -35,8 +35,28 @@ sockets. This should work on OS X, Linux and recent BSD systems (at
35least). On other systems that may trigger a SIGPIPE on send/recv, the 35least). On other systems that may trigger a SIGPIPE on send/recv, the
36main application should install a signal handler to handle SIGPIPE. 36main application should install a signal handler to handle SIGPIPE.
37 37
38libmicrohttpd should work well on GNU/Linux, BSD, OS X and W32. 38libmicrohttpd should work well on GNU/Linux, BSD, OS X, W32 and z/OS.
39We also have reports of users using it on vxWorks and z/OS. 39Note that HTTPS is not supported on z/OS (yet).
40We also have reports of users using it on vxWorks.
41
42
43Notes on compiling on z/OS:
44---------------------------
45
46After extracting the archive, run
47
48iconv -f UTF-8 -t IBM-1047 contrib/ascebc > /tmp/ascebc.sh
49chmod +x /tmp/ascebc.sh
50for n in `find * -type f`
51do
52 /tmp/ascebc.sh $n
53done
54
55to convert all source files to EBCDIC. Note that you must run
56"configure" from the directory where the configure script is
57located. Otherwise, configure will fail to find the
58"contrib/xcc" script (which is a wrapper around the z/OS c89
59compiler).
40 60
41 61
42Development Status 62Development Status
diff --git a/configure.ac b/configure.ac
index 33473834..344a95f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,17 +27,24 @@ AM_CONFIG_HEADER([MHD_config.h])
27 27
28AH_TOP([#define _GNU_SOURCE 1]) 28AH_TOP([#define _GNU_SOURCE 1])
29 29
30if test `uname -s` == "OS/S390"
31then
32# configure binaries for z/OS
33 CC=`pwd`"/contrib/xcc"
34 chmod +x $CC || true
35 CPP="c89 -E"
36 CXXCPP="c++ -E -+"
37# _CCC_CCMODE=1
38# _C89_CCMODE=1
39fi
40
30# Checks for programs. 41# Checks for programs.
31AC_PROG_AWK 42AC_PROG_AWK
32
33
34AM_PROG_CC_C_O
35
36
37AC_PROG_INSTALL 43AC_PROG_INSTALL
38AC_PROG_LN_S 44AC_PROG_LN_S
39AC_PROG_MAKE_SET 45AC_PROG_MAKE_SET
40AC_CANONICAL_HOST 46AC_CANONICAL_HOST
47AM_PROG_CC_C_O
41AC_PROG_LIBTOOL 48AC_PROG_LIBTOOL
42 49
43# set GCC options 50# set GCC options
@@ -47,6 +54,7 @@ then
47 CFLAGS="-fno-strict-aliasing $CFLAGS" 54 CFLAGS="-fno-strict-aliasing $CFLAGS"
48fi 55fi
49 56
57
50# Check system type 58# Check system type
51case "$host_os" in 59case "$host_os" in
52*darwin* | *rhapsody* | *macosx*) 60*darwin* | *rhapsody* | *macosx*)
@@ -97,6 +105,10 @@ netbsd*)
97 LDFLAGS="$LDFLAGS -no-undefined -Wl,--export-all-symbols -lws2_32 -lplibc" 105 LDFLAGS="$LDFLAGS -no-undefined -Wl,--export-all-symbols -lws2_32 -lplibc"
98 AM_CONDITIONAL(HAVE_GNU_LD, true) 106 AM_CONDITIONAL(HAVE_GNU_LD, true)
99 ;; 107 ;;
108*openedition*)
109 AC_DEFINE_UNQUOTED(OS390,1,[This is a OS/390 system])
110 AM_CONDITIONAL(HAVE_GNU_LD, false)
111 ;;
100*) 112*)
101 AC_MSG_RESULT(Unrecognised OS $host_os) 113 AC_MSG_RESULT(Unrecognised OS $host_os)
102 AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS]) 114 AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS])
@@ -104,6 +116,9 @@ netbsd*)
104;; 116;;
105esac 117esac
106 118
119
120
121
107CHECK_PTHREAD 122CHECK_PTHREAD
108LIBS="$PTHREAD_LIBS $LIBS" 123LIBS="$PTHREAD_LIBS $LIBS"
109AC_SUBST(PTHREAD_LIBS) 124AC_SUBST(PTHREAD_LIBS)
@@ -119,7 +134,7 @@ AC_CHECK_HEADERS([sys/select.h sys/types.h sys/time.h sys/msg.h netdb.h netinet/
119# libcurl (required for testing) 134# libcurl (required for testing)
120SAVE_LIBS=$LIBS 135SAVE_LIBS=$LIBS
121LIBCURL_CHECK_CONFIG(,,curl=1,curl=0) 136LIBCURL_CHECK_CONFIG(,,curl=1,curl=0)
122AM_CONDITIONAL(HAVE_CURL, test x$curl = x1) 137AM_CONDITIONAL(HAVE_CURL, test x$curl == x1)
123LIBS=$SAVE_LIBS 138LIBS=$SAVE_LIBS
124 139
125# Lib cURL & cURL - OpenSSL versions 140# Lib cURL & cURL - OpenSSL versions
@@ -142,51 +157,107 @@ AC_ARG_ENABLE(messages,
142 [enable_messages=$enableval], 157 [enable_messages=$enableval],
143 [enable_messages="no"]) 158 [enable_messages="no"])
144AC_MSG_RESULT($enable_messages) 159AC_MSG_RESULT($enable_messages)
145if test "$enable_messages" = "yes" 160if test "$enable_messages" == "yes"
146then 161then
147 AC_DEFINE([HAVE_MESSAGES],[1],[Include error messages]) 162 AC_DEFINE([HAVE_MESSAGES],[1],[Include error messages])
148fi 163fi
149 164
150# optional: compile TLS client side code [only for test running] ?
151AC_MSG_CHECKING(--enable-client-side argument)
152AC_ARG_ENABLE(client-side,
153 [AS_HELP_STRING([--enable-client-side],
154 [Compile client side code])],
155 [enable_client_side=$enableval],
156 [enable_client_side="no"])
157AC_MSG_RESULT($enable_client_side)
158if test "$enable_client_side" = "no"
159then
160 AC_DEFINE([MHD_DEBUG_TLS],[0],[Compile client side code. This will enable running some test cases.])
161 MSG_CLIENT_SIDE="disabled. running some test cases won't be possible"
162else
163 AC_DEFINE([MHD_DEBUG_TLS],[1],[Compile client side code. This will enable running some test cases.])
164 MSG_CLIENT_SIDE="enabled"
165fi
166AM_CONDITIONAL(MHD_DEBUG_TLS, test "$enable_client_side" != "no")
167 165
168# optional: have zzuf, socat? 166# optional: have zzuf, socat?
169AC_CHECK_PROG([HAVE_ZZUF],[zzuf], 1, 0) 167AC_CHECK_PROG([HAVE_ZZUF],[zzuf], 1, 0)
170AC_CHECK_PROG([HAVE_SOCAT],[socat], 1, 0) 168AC_CHECK_PROG([HAVE_SOCAT],[socat], 1, 0)
171
172AM_CONDITIONAL(HAVE_ZZUF, test 0 != $HAVE_ZZUF) 169AM_CONDITIONAL(HAVE_ZZUF, test 0 != $HAVE_ZZUF)
173AM_CONDITIONAL(HAVE_SOCAT, test 0 != $HAVE_SOCAT) 170AM_CONDITIONAL(HAVE_SOCAT, test 0 != $HAVE_SOCAT)
174 171
175# optional: HTTPS support. Included by default 172
173# libgcrypt linkage: required for HTTPS support
174AC_MSG_CHECKING(--with-libgcrypt argument)
175AC_ARG_WITH(libgcrypt,
176 [AS_HELP_STRING([--with-libgcrypt=PFX],
177 [Base of libgcrypt installation])],
178 [AC_MSG_RESULT("$with_libgcrypt")
179 case $with_libgcrypt in
180 no)
181 gcrypt=false
182 ;;
183 yes)
184 AC_CHECK_HEADERS([gcrypt.h],
185 AC_CHECK_LIB(gcrypt,gcry_prime_generate,
186 gcrypt=true,
187 gcrypt=false))
188 ;;
189 *)
190 LDFLAGS="-L${with_libgcrypt}lib $LDFLAGS"
191 CPPFLAGS="-I${with_libgcrypt}/include $CPPFLAGS"
192 AC_CHECK_HEADERS(gcrypt.h,
193 # check for 'gcry_prime_generate' in gcrypt.la
194 AC_CHECK_LIB(gcrypt,gcry_prime_generate,
195 GCRYPT_LIB_PATH="${with_libgcrypt}/lib"
196 GCRYPT_LDFLAGS="-L${with_libgcrypt}/lib"
197 GCRYPT_CPPFLAGS="-I${with_libgcrypt}/include"
198 gcrypt=true,
199 gcrypt=false))
200 LDFLAGS=$SAVE_LDFLAGS
201 CPPFLAGS=$SAVE_CPPFLAGS
202 ;;
203 esac
204 ],
205 [AC_MSG_RESULT([not specified])
206 AC_CHECK_HEADERS([gcrypt.h],
207 AC_CHECK_LIB(gcrypt,gcry_prime_generate,
208 gcrypt=true,
209 gcrypt=false))
210 ])
211
212# define the minimal version of libgcrypt required
213MHD_GCRYPT_VERSION=1:1.2.4
214AC_DEFINE_UNQUOTED([MHD_GCRYPT_VERSION], "$MHD_GCRYPT_VERSION", [gcrypt lib version])
215AC_SUBST(GCRYPT_LIB_PATH)
216AC_SUBST(GCRYPT_LDFLAGS)
217AC_SUBST(GCRYPT_CPPFLAGS)
218
219
220# optional: HTTPS support. Enabled by default
176AC_MSG_CHECKING(--enable-HTTPS argument) 221AC_MSG_CHECKING(--enable-HTTPS argument)
177AC_ARG_ENABLE([HTTPS], 222AC_ARG_ENABLE([HTTPS],
178 [AS_HELP_STRING([--enable-HTTPS], 223 [AS_HELP_STRING([--enable-HTTPS],
179 [enable HTTPS support (default is yes)])], 224 [enable HTTPS support (default is yes)])],
180 [enable_HTTPS=$enableval], 225 [enable_HTTPS=$enableval],
181 [enable_HTTPS="yes"]) 226 [enable_HTTPS="yes"])
182AC_MSG_RESULT($enable_HTTPS) 227if test "$enable_HTTPS" == "yes"
183if test "$enable_HTTPS" = "yes"
184then 228then
185 AC_DEFINE([HTTPS_SUPPORT],[1],[include HTTPS support]) 229 if test "$gcrypt" == "true"
230 then
231 AC_DEFINE([HTTPS_SUPPORT],[1],[include HTTPS support])
232 else
233 AC_DEFINE([HTTPS_SUPPORT],[0],[no libgcrypt])
234 enable_HTTPS="no (lacking libgcrypt)"
235 fi
186else 236else
187 AC_DEFINE([HTTPS_SUPPORT],[0],[disable HTTPS support]) 237 AC_DEFINE([HTTPS_SUPPORT],[0],[disable HTTPS support])
188fi 238fi
189AM_CONDITIONAL(ENABLE_HTTPS, test "$enable_HTTPS" = "yes") 239AC_MSG_RESULT($enable_HTTPS)
240
241AM_CONDITIONAL(ENABLE_HTTPS, test "$enable_HTTPS" == "yes")
242
243# optional: compile TLS client side code [only for test running] ?
244AC_MSG_CHECKING(--enable-client-side argument)
245AC_ARG_ENABLE(client-side,
246 [AS_HELP_STRING([--enable-client-side],
247 [Compile client side code])],
248 [enable_client_side=$enableval],
249 [enable_client_side="no"])
250AC_MSG_RESULT($enable_client_side)
251if test "$enable_client_side" == "no"
252then
253 AC_DEFINE([MHD_DEBUG_TLS],[0],[Compile client side code. This will enable running some test cases.])
254 MSG_CLIENT_SIDE="disabled. running some test cases won't be possible"
255else
256 AC_DEFINE([MHD_DEBUG_TLS],[1],[Compile client side code. This will enable running some test cases.])
257 MSG_CLIENT_SIDE="enabled"
258fi
259AM_CONDITIONAL(MHD_DEBUG_TLS, test "$enable_client_side" != "no")
260
190 261
191# optional: TLS support. Included by default 262# optional: TLS support. Included by default
192AC_MSG_CHECKING(--enable-TLS argument) 263AC_MSG_CHECKING(--enable-TLS argument)
@@ -218,51 +289,12 @@ AC_ARG_ENABLE([x509],
218AC_MSG_RESULT($enable_x509) 289AC_MSG_RESULT($enable_x509)
219 290
220 291
221# Libgcrypt linkage : required for HTTPS support
222AC_CHECK_HEADERS(gcrypt.h,gcrypt=true,gcrypt=false)
223AC_ARG_WITH(libgcrypt,
224 [AS_HELP_STRING([--with-libgcrypt=PFX],
225 [Base of libgcrypt installation])],
226 [AC_MSG_RESULT("$with_libgcrypt")
227 case $with_libgcrypt in
228 no)
229 gcrypt=false
230 ;;
231 yes)
232 ;;
233 *)
234 LDFLAGS="-L$with_libgcrypt/lib $LDFLAGS"
235 CPPFLAGS="-I$with_libgcrypt/include $CPPFLAGS"
236 AC_CHECK_HEADERS(gcrypt.h,
237 # check for 'gcry_prime_generate' in gcrypt.la
238 AC_CHECK_LIB(gcrypt,gcry_prime_generate,
239 GCRYPT_LIB_PATH="$with_libgcrypt/lib"
240 GCRYPT_LDFLAGS="-L$with_libgcrypt/lib"
241 GCRYPT_CPPFLAGS="-I$with_libgcrypt/include"
242 gcrypt=true,
243 gcrypt=false))
244 LDFLAGS=$SAVE_LDFLAGS
245 CPPFLAGS=$SAVE_CPPFLAGS
246 ;;
247 esac
248 ],
249 [AC_MSG_RESULT([--with_libgcrypt not specified])])
250
251# define the minimal version of libgcrypt required
252MHD_GCRYPT_VERSION=1:1.2.4
253AC_DEFINE_UNQUOTED([MHD_GCRYPT_VERSION], "$MHD_GCRYPT_VERSION", [gcrypt lib version])
254
255AC_SUBST(GCRYPT_LIB_PATH)
256AC_SUBST(GCRYPT_LDFLAGS)
257AC_SUBST(GCRYPT_CPPFLAGS)
258
259# Symbols required by GNU_TLS 292# Symbols required by GNU_TLS
260AC_DEFINE([ENABLE_MINITASN1],[1],[Include minitasn1 support]) 293AC_DEFINE([ENABLE_MINITASN1],[1],[Include minitasn1 support])
261AC_DEFINE([GNULIB_GC_HMAC_SHA1],[1],[GNULIB_GC_HMAC_SHA1]) 294AC_DEFINE([GNULIB_GC_HMAC_SHA1],[1],[GNULIB_GC_HMAC_SHA1])
262AC_DEFINE([GNULIB_GC_RANDOM],[1],[GNULIB_GC_RANDOM]) 295AC_DEFINE([GNULIB_GC_RANDOM],[1],[GNULIB_GC_RANDOM])
263AC_DEFINE([ENABLE_ANON],[1],[Enable anonymous authentication]) 296AC_DEFINE([ENABLE_ANON],[1],[Enable anonymous authentication])
264AC_DEFINE([ENABLE_PKI],[0],[Include PKI support]) 297AC_DEFINE([ENABLE_PKI],[0],[Include PKI support])
265AC_DEFINE([ENABLE_INCLUDED_OPENCDK],[1],[Include ENABLE_INCLUDED_OPENCDK support])
266# gnutls debug support 298# gnutls debug support
267AC_DEFINE([DEBUG],[1],[Include gnutls debug message support]) 299AC_DEFINE([DEBUG],[1],[Include gnutls debug message support])
268AC_DEFINE([C99_MACROS],[1],[Include gnutls debug message support]) 300AC_DEFINE([C99_MACROS],[1],[Include gnutls debug message support])
@@ -280,6 +312,7 @@ AC_SUBST(EXT_LIBS)
280 312
281AC_CONFIG_FILES([ 313AC_CONFIG_FILES([
282Makefile 314Makefile
315contrib/Makefile
283doc/Makefile 316doc/Makefile
284m4/Makefile 317m4/Makefile
285src/Makefile 318src/Makefile
@@ -300,35 +333,38 @@ AM_CONDITIONAL(ENABLE_MINITASN1, [test -n " " ] )
300AM_CONDITIONAL(ENABLE_OPENSSL, [test -n "" ] ) 333AM_CONDITIONAL(ENABLE_OPENSSL, [test -n "" ] )
301AM_CONDITIONAL(HAVE_LD_OUTPUT_DEF, [test -n "" ] ) 334AM_CONDITIONAL(HAVE_LD_OUTPUT_DEF, [test -n "" ] )
302AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, [test -n "" ] ) 335AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, [test -n "" ] )
303AM_CONDITIONAL(ENABLE_INCLUDED_OPENCDK, [test -n "" ] )
304 336
305# Finally: summary 337# Finally: summary
306if test "$curl" != 1 ; then 338if test "$curl" != 1 ; then
307 MSG_CURL="libcurl not found, building test won't be possible" 339 MSG_CURL="no, many unit tests will not run"
308else 340else
309 MSG_CURL="${_libcurl_with}/lib" 341 MSG_CURL="yes"
310fi 342fi
343
311if test "$gcrypt" != true 344if test "$gcrypt" != true
312then 345then
313 MSG_GCRYPT="libgcrypt not found, HTTPS supprot cannot be built" 346 MSG_GCRYPT="no, HTTPS will not be built"
314else 347else
315 MSG_GCRYPT="${with_libgcrypt}/lib" 348 MSG_GCRYPT="yes"
316fi 349fi
317 350
318AC_MSG_NOTICE([Configured to build curl/libcurl: 351AC_MSG_NOTICE([Configuration Summary:
319 Configuration Summery: 352 Operating System: ${host_os}
320 353 Target directory: ${prefix}
321 os: ${host_os} 354 Messages: ${enable_messages}
322 target dir: ${prefix} 355 libgcrypt: ${MSG_GCRYPT}
323 messages: ${enable_messages} 356 libcurl (testing): ${MSG_CURL}
324 HTTPS support: ${enable_HTTPS} 357 HTTPS support: ${enable_HTTPS}
358])
359
360if test "$enable_HTTPS" == "yes"
361then
362AC_MSG_NOTICE([HTTPS subsystem configuration:
325 TLS support: ${enable_TLS} 363 TLS support: ${enable_TLS}
326 SSLv3 support: ${enable_SSL} 364 SSLv3 support: ${enable_SSL}
327 x509 support: ${enable_x509} 365 x509 support: ${enable_x509}
328 libgcrypt: ${MSG_GCRYPT} 366 Client code dep.: ${MSG_CLIENT_SIDE}
329
330 # Testing
331 libcurl: ${MSG_CURL}
332 client code dep.: ${MSG_CLIENT_SIDE}
333]) 367])
368fi
369
334 370
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
new file mode 100644
index 00000000..0f4bd738
--- /dev/null
+++ b/contrib/Makefile.am
@@ -0,0 +1 @@
EXTRA_DIST = xcc ascebc \ No newline at end of file
diff --git a/contrib/ascebc b/contrib/ascebc
new file mode 100644
index 00000000..a8c3f143
--- /dev/null
+++ b/contrib/ascebc
@@ -0,0 +1,11 @@
1#!/bin/sh
2iconv -f UTF-8 -t IBM-1047 $1 > temp.file
3if test -x $1
4then
5 rm $1
6 mv temp.file $1
7 chmod +x $1
8else
9 rm $1
10 mv temp.file $1
11fi
diff --git a/contrib/xcc b/contrib/xcc
new file mode 100644
index 00000000..591bc564
--- /dev/null
+++ b/contrib/xcc
@@ -0,0 +1,2 @@
1#!/bin/sh
2c89 -Wc,'LANGLVL(EXTENDED),XPLINK' -Wl,'XPLINK' -D__STRING_CODE_SET__="ISO8859-1" -Wc,"ASCII" $@
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index ff2c4065..d2b264dd 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -3,16 +3,16 @@
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{2005-07-05.19} 6\def\texinfoversion{2007-12-02.17}
7% 7%
8% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 8% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 2007,
9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software 9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
10% Foundation, Inc. 10% 2007 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
14% published by the Free Software Foundation; either version 2, or (at 14% published by the Free Software Foundation, either version 3 of the
15% your option) any later version. 15% License, or (at your option) any later version.
16% 16%
17% This texinfo.tex file is distributed in the hope that it will be 17% This texinfo.tex file is distributed in the hope that it will be
18% useful, but WITHOUT ANY WARRANTY; without even the implied warranty 18% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
@@ -20,9 +20,7 @@
20% General Public License for more details. 20% General Public License for more details.
21% 21%
22% You should have received a copy of the GNU General Public License 22% You should have received a copy of the GNU General Public License
23% along with this texinfo.tex file; see the file COPYING. If not, write 23% along with this program. If not, see <http://www.gnu.org/licenses/>.
24% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25% Boston, MA 02110-1301, USA.
26% 24%
27% As a special exception, when this file is read by TeX when processing 25% As a special exception, when this file is read by TeX when processing
28% a Texinfo source document, you may use the result without 26% a Texinfo source document, you may use the result without
@@ -67,7 +65,7 @@
67\everyjob{\message{[Texinfo version \texinfoversion]}% 65\everyjob{\message{[Texinfo version \texinfoversion]}%
68 \catcode`+=\active \catcode`\_=\active} 66 \catcode`+=\active \catcode`\_=\active}
69 67
70\message{Basics,} 68
71\chardef\other=12 69\chardef\other=12
72 70
73% We never want plain's \outer definition of \+ in Texinfo. 71% We never want plain's \outer definition of \+ in Texinfo.
@@ -153,28 +151,22 @@
153\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi 151\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
154\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi 152\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
155 153
156% In some macros, we cannot use the `\? notation---the left quote is 154% Since the category of space is not known, we have to be careful.
157% in some cases the escape char. 155\chardef\spacecat = 10
158\chardef\backChar = `\\ 156\def\spaceisspace{\catcode`\ =\spacecat}
157
158% sometimes characters are active, so we need control sequences.
159\chardef\colonChar = `\: 159\chardef\colonChar = `\:
160\chardef\commaChar = `\, 160\chardef\commaChar = `\,
161\chardef\dashChar = `\-
161\chardef\dotChar = `\. 162\chardef\dotChar = `\.
162\chardef\exclamChar= `\! 163\chardef\exclamChar= `\!
163\chardef\plusChar = `\+ 164\chardef\lquoteChar= `\`
164\chardef\questChar = `\? 165\chardef\questChar = `\?
166\chardef\rquoteChar= `\'
165\chardef\semiChar = `\; 167\chardef\semiChar = `\;
166\chardef\underChar = `\_ 168\chardef\underChar = `\_
167 169
168\chardef\spaceChar = `\ %
169\chardef\spacecat = 10
170\def\spaceisspace{\catcode\spaceChar=\spacecat}
171
172{% for help with debugging.
173 % example usage: \expandafter\show\activebackslash
174 \catcode`\! = 0 \catcode`\\ = \active
175 !global!def!activebackslash{\}
176}
177
178% Ignore a token. 170% Ignore a token.
179% 171%
180\def\gobble#1{} 172\def\gobble#1{}
@@ -285,6 +277,50 @@
285\newdimen\cornerthick \cornerthick=.3pt 277\newdimen\cornerthick \cornerthick=.3pt
286\newdimen\topandbottommargin \topandbottommargin=.75in 278\newdimen\topandbottommargin \topandbottommargin=.75in
287 279
280% Output a mark which sets \thischapter, \thissection and \thiscolor.
281% We dump everything together because we only have one kind of mark.
282% This works because we only use \botmark / \topmark, not \firstmark.
283%
284% A mark contains a subexpression of the \ifcase ... \fi construct.
285% \get*marks macros below extract the needed part using \ifcase.
286%
287% Another complication is to let the user choose whether \thischapter
288% (\thissection) refers to the chapter (section) in effect at the top
289% of a page, or that at the bottom of a page. The solution is
290% described on page 260 of The TeXbook. It involves outputting two
291% marks for the sectioning macros, one before the section break, and
292% one after. I won't pretend I can describe this better than DEK...
293\def\domark{%
294 \toks0=\expandafter{\lastchapterdefs}%
295 \toks2=\expandafter{\lastsectiondefs}%
296 \toks4=\expandafter{\prevchapterdefs}%
297 \toks6=\expandafter{\prevsectiondefs}%
298 \toks8=\expandafter{\lastcolordefs}%
299 \mark{%
300 \the\toks0 \the\toks2
301 \noexpand\or \the\toks4 \the\toks6
302 \noexpand\else \the\toks8
303 }%
304}
305% \topmark doesn't work for the very first chapter (after the title
306% page or the contents), so we use \firstmark there -- this gets us
307% the mark with the chapter defs, unless the user sneaks in, e.g.,
308% @setcolor (or @url, or @link, etc.) between @contents and the very
309% first @chapter.
310\def\gettopheadingmarks{%
311 \ifcase0\topmark\fi
312 \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
313}
314\def\getbottomheadingmarks{\ifcase1\botmark\fi}
315\def\getcolormarks{\ifcase2\topmark\fi}
316
317% Avoid "undefined control sequence" errors.
318\def\lastchapterdefs{}
319\def\lastsectiondefs{}
320\def\prevchapterdefs{}
321\def\prevsectiondefs{}
322\def\lastcolordefs{}
323
288% Main output routine. 324% Main output routine.
289\chardef\PAGE = 255 325\chardef\PAGE = 255
290\output = {\onepageout{\pagecontents\PAGE}} 326\output = {\onepageout{\pagecontents\PAGE}}
@@ -302,7 +338,9 @@
302 % 338 %
303 % Do this outside of the \shipout so @code etc. will be expanded in 339 % Do this outside of the \shipout so @code etc. will be expanded in
304 % the headline as they should be, not taken literally (outputting ''code). 340 % the headline as they should be, not taken literally (outputting ''code).
341 \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
305 \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% 342 \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
343 \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
306 \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% 344 \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
307 % 345 %
308 {% 346 {%
@@ -311,6 +349,13 @@
311 % before the \shipout runs. 349 % before the \shipout runs.
312 % 350 %
313 \indexdummies % don't expand commands in the output. 351 \indexdummies % don't expand commands in the output.
352 \normalturnoffactive % \ in index entries must not stay \, e.g., if
353 % the page break happens to be in the middle of an example.
354 % We don't want .vr (or whatever) entries like this:
355 % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
356 % "\acronym" won't work when it's read back in;
357 % it needs to be
358 % {\code {{\tt \backslashcurfont }acronym}
314 \shipout\vbox{% 359 \shipout\vbox{%
315 % Do this early so pdf references go to the beginning of the page. 360 % Do this early so pdf references go to the beginning of the page.
316 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi 361 \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
@@ -338,9 +383,9 @@
338 \pagebody{#1}% 383 \pagebody{#1}%
339 \ifdim\ht\footlinebox > 0pt 384 \ifdim\ht\footlinebox > 0pt
340 % Only leave this space if the footline is nonempty. 385 % Only leave this space if the footline is nonempty.
341 % (We lessened \vsize for it in \oddfootingxxx.) 386 % (We lessened \vsize for it in \oddfootingyyy.)
342 % The \baselineskip=24pt in plain's \makefootline has no effect. 387 % The \baselineskip=24pt in plain's \makefootline has no effect.
343 \vskip 2\baselineskip 388 \vskip 24pt
344 \unvbox\footlinebox 389 \unvbox\footlinebox
345 \fi 390 \fi
346 % 391 %
@@ -374,7 +419,7 @@
374% marginal hacks, juha@viisa.uucp (Juha Takala) 419% marginal hacks, juha@viisa.uucp (Juha Takala)
375\ifvoid\margin\else % marginal info is present 420\ifvoid\margin\else % marginal info is present
376 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi 421 \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
377\dimen@=\dp#1 \unvbox#1 422\dimen@=\dp#1\relax \unvbox#1\relax
378\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi 423\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
379\ifr@ggedbottom \kern-\dimen@ \vfil \fi} 424\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
380} 425}
@@ -396,7 +441,7 @@
396% 441%
397\def\parsearg{\parseargusing{}} 442\def\parsearg{\parseargusing{}}
398\def\parseargusing#1#2{% 443\def\parseargusing#1#2{%
399 \def\next{#2}% 444 \def\argtorun{#2}%
400 \begingroup 445 \begingroup
401 \obeylines 446 \obeylines
402 \spaceisspace 447 \spaceisspace
@@ -427,8 +472,7 @@
427\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% 472\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
428 \def\temp{#3}% 473 \def\temp{#3}%
429 \ifx\temp\empty 474 \ifx\temp\empty
430 % We cannot use \next here, as it holds the macro to run; 475 % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
431 % thus we reuse \temp.
432 \let\temp\finishparsearg 476 \let\temp\finishparsearg
433 \else 477 \else
434 \let\temp\argcheckspaces 478 \let\temp\argcheckspaces
@@ -440,14 +484,14 @@
440% If a _delimited_ argument is enclosed in braces, they get stripped; so 484% If a _delimited_ argument is enclosed in braces, they get stripped; so
441% to get _exactly_ the rest of the line, we had to prevent such situation. 485% to get _exactly_ the rest of the line, we had to prevent such situation.
442% We prepended an \empty token at the very beginning and we expand it now, 486% We prepended an \empty token at the very beginning and we expand it now,
443% just before passing the control to \next. 487% just before passing the control to \argtorun.
444% (Similarily, we have to think about #3 of \argcheckspacesY above: it is 488% (Similarily, we have to think about #3 of \argcheckspacesY above: it is
445% either the null string, or it ends with \^^M---thus there is no danger 489% either the null string, or it ends with \^^M---thus there is no danger
446% that a pair of braces would be stripped. 490% that a pair of braces would be stripped.
447% 491%
448% But first, we have to remove the trailing space token. 492% But first, we have to remove the trailing space token.
449% 493%
450\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} 494\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
451 495
452% \parseargdef\foo{...} 496% \parseargdef\foo{...}
453% is roughly equivalent to 497% is roughly equivalent to
@@ -1051,9 +1095,9 @@ where each line of input produces a line of output.}
1051% _ active, and distinguish by seeing if the current family is \slfam, 1095% _ active, and distinguish by seeing if the current family is \slfam,
1052% which is what @var uses. 1096% which is what @var uses.
1053{ 1097{
1054 \catcode\underChar = \active 1098 \catcode`\_ = \active
1055 \gdef\mathunderscore{% 1099 \gdef\mathunderscore{%
1056 \catcode\underChar=\active 1100 \catcode`\_=\active
1057 \def_{\ifnum\fam=\slfam \_\else\sb\fi}% 1101 \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
1058 } 1102 }
1059} 1103}
@@ -1096,15 +1140,24 @@ where each line of input produces a line of output.}
1096\def\minus{$-$} 1140\def\minus{$-$}
1097 1141
1098% @dots{} outputs an ellipsis using the current font. 1142% @dots{} outputs an ellipsis using the current font.
1099% We do .5em per period so that it has the same spacing in a typewriter 1143% We do .5em per period so that it has the same spacing in the cm
1100% font as three actual period characters. 1144% typewriter fonts as three actual period characters; on the other hand,
1145% in other typewriter fonts three periods are wider than 1.5em. So do
1146% whichever is larger.
1101% 1147%
1102\def\dots{% 1148\def\dots{%
1103 \leavevmode 1149 \leavevmode
1104 \hbox to 1.5em{% 1150 \setbox0=\hbox{...}% get width of three periods
1105 \hskip 0pt plus 0.25fil 1151 \ifdim\wd0 > 1.5em
1106 .\hfil.\hfil.% 1152 \dimen0 = \wd0
1107 \hskip 0pt plus 0.5fil 1153 \else
1154 \dimen0 = 1.5em
1155 \fi
1156 \hbox to \dimen0{%
1157 \hskip 0pt plus.25fil
1158 .\hskip 0pt plus1fil
1159 .\hskip 0pt plus1fil
1160 .\hskip 0pt plus.5fil
1108 }% 1161 }%
1109} 1162}
1110 1163
@@ -1197,28 +1250,28 @@ where each line of input produces a line of output.}
1197 \fi 1250 \fi
1198\fi 1251\fi
1199 1252
1200% PDF uses PostScript string constants for the names of xref targets, to 1253% PDF uses PostScript string constants for the names of xref targets,
1201% for display in the outlines, and in other places. Thus, we have to 1254% for display in the outlines, and in other places. Thus, we have to
1202% double any backslashes. Otherwise, a name like "\node" will be 1255% double any backslashes. Otherwise, a name like "\node" will be
1203% interpreted as a newline (\n), followed by o, d, e. Not good. 1256% interpreted as a newline (\n), followed by o, d, e. Not good.
1204% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html 1257% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html
1205% (and related messages, the final outcome is that it is up to the TeX 1258% (and related messages, the final outcome is that it is up to the TeX
1206% user to double the backslashes and otherwise make the string valid, so 1259% user to double the backslashes and otherwise make the string valid, so
1207% that's we do). 1260% that's what we do).
1208 1261
1209% double active backslashes. 1262% double active backslashes.
1210% 1263%
1211{\catcode`\@=0 \catcode`\\=\active 1264{\catcode`\@=0 \catcode`\\=\active
1212 @gdef@activebackslash{@catcode`@\=@active @otherbackslash}
1213 @gdef@activebackslashdouble{% 1265 @gdef@activebackslashdouble{%
1214 @catcode@backChar=@active 1266 @catcode`@\=@active
1215 @let\=@doublebackslash} 1267 @let\=@doublebackslash}
1216} 1268}
1217 1269
1218% To handle parens, we must adopt a different approach, since parens are 1270% To handle parens, we must adopt a different approach, since parens are
1219% not active characters. hyperref.dtx (which has the same problem as 1271% not active characters. hyperref.dtx (which has the same problem as
1220% us) handles it with this amazing macro to replace tokens. I've 1272% us) handles it with this amazing macro to replace tokens, with minor
1221% tinkered with it a little for texinfo, but it's definitely from there. 1273% changes for Texinfo. It is included here under the GPL by permission
1274% from the author, Heiko Oberdiek.
1222% 1275%
1223% #1 is the tokens to replace. 1276% #1 is the tokens to replace.
1224% #2 is the replacement. 1277% #2 is the replacement.
@@ -1243,21 +1296,87 @@ where each line of input produces a line of output.}
1243\def\backslashparens#1{% 1296\def\backslashparens#1{%
1244 \xdef#1{#1}% redefine it as its expansion; the definition is simply 1297 \xdef#1{#1}% redefine it as its expansion; the definition is simply
1245 % \lastnode when called from \setref -> \pdfmkdest. 1298 % \lastnode when called from \setref -> \pdfmkdest.
1246 \HyPsdSubst{(}{\backslashlparen}{#1}% 1299 \HyPsdSubst{(}{\realbackslash(}{#1}%
1247 \HyPsdSubst{)}{\backslashrparen}{#1}% 1300 \HyPsdSubst{)}{\realbackslash)}{#1}%
1248} 1301}
1249 1302
1250{\catcode\exclamChar = 0 \catcode\backChar = \other 1303\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
1251 !gdef!backslashlparen{\(}% 1304with PDF output, and none of those formats could be found. (.eps cannot
1252 !gdef!backslashrparen{\)}% 1305be supported due to the design of the PDF format; use regular TeX (DVI
1253} 1306output) for that.)}
1254 1307
1255\ifpdf 1308\ifpdf
1256 \input pdfcolor 1309 %
1257 \pdfcatalog{/PageMode /UseOutlines}% 1310 % Color manipulation macros based on pdfcolor.tex.
1311 \def\cmykDarkRed{0.28 1 1 0.35}
1312 \def\cmykBlack{0 0 0 1}
1313 %
1314 \def\pdfsetcolor#1{\pdfliteral{#1 k}}
1315 % Set color, and create a mark which defines \thiscolor accordingly,
1316 % so that \makeheadline knows which color to restore.
1317 \def\setcolor#1{%
1318 \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
1319 \domark
1320 \pdfsetcolor{#1}%
1321 }
1322 %
1323 \def\maincolor{\cmykBlack}
1324 \pdfsetcolor{\maincolor}
1325 \edef\thiscolor{\maincolor}
1326 \def\lastcolordefs{}
1327 %
1328 \def\makefootline{%
1329 \baselineskip24pt
1330 \line{\pdfsetcolor{\maincolor}\the\footline}%
1331 }
1332 %
1333 \def\makeheadline{%
1334 \vbox to 0pt{%
1335 \vskip-22.5pt
1336 \line{%
1337 \vbox to8.5pt{}%
1338 % Extract \thiscolor definition from the marks.
1339 \getcolormarks
1340 % Typeset the headline with \maincolor, then restore the color.
1341 \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
1342 }%
1343 \vss
1344 }%
1345 \nointerlineskip
1346 }
1347 %
1348 %
1349 \pdfcatalog{/PageMode /UseOutlines}
1350 %
1351 % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
1258 \def\dopdfimage#1#2#3{% 1352 \def\dopdfimage#1#2#3{%
1259 \def\imagewidth{#2}% 1353 \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
1260 \def\imageheight{#3}% 1354 \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
1355 %
1356 % pdftex (and the PDF format) support .png, .jpg, .pdf (among
1357 % others). Let's try in that order.
1358 \let\pdfimgext=\empty
1359 \begingroup
1360 \openin 1 #1.png \ifeof 1
1361 \openin 1 #1.jpg \ifeof 1
1362 \openin 1 #1.jpeg \ifeof 1
1363 \openin 1 #1.JPG \ifeof 1
1364 \openin 1 #1.pdf \ifeof 1
1365 \errhelp = \nopdfimagehelp
1366 \errmessage{Could not find image file #1 for pdf}%
1367 \else \gdef\pdfimgext{pdf}%
1368 \fi
1369 \else \gdef\pdfimgext{JPG}%
1370 \fi
1371 \else \gdef\pdfimgext{jpeg}%
1372 \fi
1373 \else \gdef\pdfimgext{jpg}%
1374 \fi
1375 \else \gdef\pdfimgext{png}%
1376 \fi
1377 \closein 1
1378 \endgroup
1379 %
1261 % without \immediate, pdftex seg faults when the same image is 1380 % without \immediate, pdftex seg faults when the same image is
1262 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) 1381 % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
1263 \ifnum\pdftexversion < 14 1382 \ifnum\pdftexversion < 14
@@ -1265,31 +1384,38 @@ where each line of input produces a line of output.}
1265 \else 1384 \else
1266 \immediate\pdfximage 1385 \immediate\pdfximage
1267 \fi 1386 \fi
1268 \ifx\empty\imagewidth\else width \imagewidth \fi 1387 \ifdim \wd0 >0pt width \imagewidth \fi
1269 \ifx\empty\imageheight\else height \imageheight \fi 1388 \ifdim \wd2 >0pt height \imageheight \fi
1270 \ifnum\pdftexversion<13 1389 \ifnum\pdftexversion<13
1271 #1.pdf% 1390 #1.\pdfimgext
1272 \else 1391 \else
1273 {#1.pdf}% 1392 {#1.\pdfimgext}%
1274 \fi 1393 \fi
1275 \ifnum\pdftexversion < 14 \else 1394 \ifnum\pdftexversion < 14 \else
1276 \pdfrefximage \pdflastximage 1395 \pdfrefximage \pdflastximage
1277 \fi} 1396 \fi}
1397 %
1278 \def\pdfmkdest#1{{% 1398 \def\pdfmkdest#1{{%
1279 % We have to set dummies so commands such as @code, and characters 1399 % We have to set dummies so commands such as @code, and characters
1280 % such as \, aren't expanded when present in a section title. 1400 % such as \, aren't expanded when present in a section title.
1281 \atdummies 1401 \indexnofonts
1402 \turnoffactive
1282 \activebackslashdouble 1403 \activebackslashdouble
1404 \makevalueexpandable
1283 \def\pdfdestname{#1}% 1405 \def\pdfdestname{#1}%
1284 \backslashparens\pdfdestname 1406 \backslashparens\pdfdestname
1285 \pdfdest name{\pdfdestname} xyz% 1407 \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
1286 }}% 1408 }}
1287 % 1409 %
1288 % used to mark target names; must be expandable. 1410 % used to mark target names; must be expandable.
1289 \def\pdfmkpgn#1{#1}% 1411 \def\pdfmkpgn#1{#1}
1412 %
1413 % by default, use a color that is dark enough to print on paper as
1414 % nearly black, but still distinguishable for online viewing.
1415 \def\urlcolor{\cmykDarkRed}
1416 \def\linkcolor{\cmykDarkRed}
1417 \def\endlink{\setcolor{\maincolor}\pdfendlink}
1290 % 1418 %
1291 \let\linkcolor = \Blue % was Cyan, but that seems light?
1292 \def\endlink{\Black\pdfendlink}
1293 % Adding outlines to PDF; macros for calculating structure of outlines 1419 % Adding outlines to PDF; macros for calculating structure of outlines
1294 % come from Petr Olsak 1420 % come from Petr Olsak
1295 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% 1421 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
@@ -1390,8 +1516,8 @@ where each line of input produces a line of output.}
1390 % now, I guess we'll just let the pdf reader have its way. 1516 % now, I guess we'll just let the pdf reader have its way.
1391 \indexnofonts 1517 \indexnofonts
1392 \setupdatafile 1518 \setupdatafile
1393 \activebackslash 1519 \catcode`\\=\active \otherbackslash
1394 \input \jobname.toc 1520 \input \tocreadfilename
1395 \endgroup 1521 \endgroup
1396 } 1522 }
1397 % 1523 %
@@ -1409,11 +1535,19 @@ where each line of input produces a line of output.}
1409 \else 1535 \else
1410 \let \startlink \pdfstartlink 1536 \let \startlink \pdfstartlink
1411 \fi 1537 \fi
1538 % make a live url in pdf output.
1412 \def\pdfurl#1{% 1539 \def\pdfurl#1{%
1413 \begingroup 1540 \begingroup
1414 \normalturnoffactive\def\@{@}% 1541 % it seems we really need yet another set of dummies; have not
1542 % tried to figure out what each command should do in the context
1543 % of @url. for now, just make @/ a no-op, that's the only one
1544 % people have actually reported a problem with.
1545 %
1546 \normalturnoffactive
1547 \def\@{@}%
1548 \let\/=\empty
1415 \makevalueexpandable 1549 \makevalueexpandable
1416 \leavevmode\Red 1550 \leavevmode\setcolor{\urlcolor}%
1417 \startlink attr{/Border [0 0 0]}% 1551 \startlink attr{/Border [0 0 0]}%
1418 user{/Subtype /Link /A << /S /URI /URI (#1) >>}% 1552 user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
1419 \endgroup} 1553 \endgroup}
@@ -1440,13 +1574,14 @@ where each line of input produces a line of output.}
1440 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} 1574 {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
1441 \def\pdflink#1{% 1575 \def\pdflink#1{%
1442 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} 1576 \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
1443 \linkcolor #1\endlink} 1577 \setcolor{\linkcolor}#1\endlink}
1444 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} 1578 \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
1445\else 1579\else
1446 \let\pdfmkdest = \gobble 1580 \let\pdfmkdest = \gobble
1447 \let\pdfurl = \gobble 1581 \let\pdfurl = \gobble
1448 \let\endlink = \relax 1582 \let\endlink = \relax
1449 \let\linkcolor = \relax 1583 \let\setcolor = \gobble
1584 \let\pdfsetcolor = \gobble
1450 \let\pdfmakeoutlines = \relax 1585 \let\pdfmakeoutlines = \relax
1451\fi % \ifx\pdfoutput 1586\fi % \ifx\pdfoutput
1452 1587
@@ -1481,6 +1616,7 @@ where each line of input produces a line of output.}
1481% We don't need math for this font style. 1616% We don't need math for this font style.
1482\def\ttsl{\setfontstyle{ttsl}} 1617\def\ttsl{\setfontstyle{ttsl}}
1483 1618
1619
1484% Default leading. 1620% Default leading.
1485\newdimen\textleading \textleading = 13.2pt 1621\newdimen\textleading \textleading = 13.2pt
1486 1622
@@ -1492,8 +1628,12 @@ where each line of input produces a line of output.}
1492\def\strutheightpercent{.70833} 1628\def\strutheightpercent{.70833}
1493\def\strutdepthpercent {.29167} 1629\def\strutdepthpercent {.29167}
1494% 1630%
1631% can get a sort of poor man's double spacing by redefining this.
1632\def\baselinefactor{1}
1633%
1495\def\setleading#1{% 1634\def\setleading#1{%
1496 \normalbaselineskip = #1\relax 1635 \dimen0 = #1\relax
1636 \normalbaselineskip = \baselinefactor\dimen0
1497 \normallineskip = \lineskipfactor\normalbaselineskip 1637 \normallineskip = \lineskipfactor\normalbaselineskip
1498 \normalbaselines 1638 \normalbaselines
1499 \setbox\strutbox =\hbox{% 1639 \setbox\strutbox =\hbox{%
@@ -1502,10 +1642,279 @@ where each line of input produces a line of output.}
1502 }% 1642 }%
1503} 1643}
1504 1644
1645% PDF CMaps. See also LaTeX's t1.cmap.
1646%
1647% do nothing with this by default.
1648\expandafter\let\csname cmapOT1\endcsname\gobble
1649\expandafter\let\csname cmapOT1IT\endcsname\gobble
1650\expandafter\let\csname cmapOT1TT\endcsname\gobble
1651
1652% if we are producing pdf, and we have \pdffontattr, then define cmaps.
1653% (\pdffontattr was introduced many years ago, but people still run
1654% older pdftex's; it's easy to conditionalize, so we do.)
1655\ifpdf \ifx\pdffontattr\undefined \else
1656 \begingroup
1657 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1658 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1659%%DocumentNeededResources: ProcSet (CIDInit)
1660%%IncludeResource: ProcSet (CIDInit)
1661%%BeginResource: CMap (TeX-OT1-0)
1662%%Title: (TeX-OT1-0 TeX OT1 0)
1663%%Version: 1.000
1664%%EndComments
1665/CIDInit /ProcSet findresource begin
166612 dict begin
1667begincmap
1668/CIDSystemInfo
1669<< /Registry (TeX)
1670/Ordering (OT1)
1671/Supplement 0
1672>> def
1673/CMapName /TeX-OT1-0 def
1674/CMapType 2 def
16751 begincodespacerange
1676<00> <7F>
1677endcodespacerange
16788 beginbfrange
1679<00> <01> <0393>
1680<09> <0A> <03A8>
1681<23> <26> <0023>
1682<28> <3B> <0028>
1683<3F> <5B> <003F>
1684<5D> <5E> <005D>
1685<61> <7A> <0061>
1686<7B> <7C> <2013>
1687endbfrange
168840 beginbfchar
1689<02> <0398>
1690<03> <039B>
1691<04> <039E>
1692<05> <03A0>
1693<06> <03A3>
1694<07> <03D2>
1695<08> <03A6>
1696<0B> <00660066>
1697<0C> <00660069>
1698<0D> <0066006C>
1699<0E> <006600660069>
1700<0F> <00660066006C>
1701<10> <0131>
1702<11> <0237>
1703<12> <0060>
1704<13> <00B4>
1705<14> <02C7>
1706<15> <02D8>
1707<16> <00AF>
1708<17> <02DA>
1709<18> <00B8>
1710<19> <00DF>
1711<1A> <00E6>
1712<1B> <0153>
1713<1C> <00F8>
1714<1D> <00C6>
1715<1E> <0152>
1716<1F> <00D8>
1717<21> <0021>
1718<22> <201D>
1719<27> <2019>
1720<3C> <00A1>
1721<3D> <003D>
1722<3E> <00BF>
1723<5C> <201C>
1724<5F> <02D9>
1725<60> <2018>
1726<7D> <02DD>
1727<7E> <007E>
1728<7F> <00A8>
1729endbfchar
1730endcmap
1731CMapName currentdict /CMap defineresource pop
1732end
1733end
1734%%EndResource
1735%%EOF
1736 }\endgroup
1737 \expandafter\edef\csname cmapOT1\endcsname#1{%
1738 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1739 }%
1740%
1741% \cmapOT1IT
1742 \begingroup
1743 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1744 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1745%%DocumentNeededResources: ProcSet (CIDInit)
1746%%IncludeResource: ProcSet (CIDInit)
1747%%BeginResource: CMap (TeX-OT1IT-0)
1748%%Title: (TeX-OT1IT-0 TeX OT1IT 0)
1749%%Version: 1.000
1750%%EndComments
1751/CIDInit /ProcSet findresource begin
175212 dict begin
1753begincmap
1754/CIDSystemInfo
1755<< /Registry (TeX)
1756/Ordering (OT1IT)
1757/Supplement 0
1758>> def
1759/CMapName /TeX-OT1IT-0 def
1760/CMapType 2 def
17611 begincodespacerange
1762<00> <7F>
1763endcodespacerange
17648 beginbfrange
1765<00> <01> <0393>
1766<09> <0A> <03A8>
1767<25> <26> <0025>
1768<28> <3B> <0028>
1769<3F> <5B> <003F>
1770<5D> <5E> <005D>
1771<61> <7A> <0061>
1772<7B> <7C> <2013>
1773endbfrange
177442 beginbfchar
1775<02> <0398>
1776<03> <039B>
1777<04> <039E>
1778<05> <03A0>
1779<06> <03A3>
1780<07> <03D2>
1781<08> <03A6>
1782<0B> <00660066>
1783<0C> <00660069>
1784<0D> <0066006C>
1785<0E> <006600660069>
1786<0F> <00660066006C>
1787<10> <0131>
1788<11> <0237>
1789<12> <0060>
1790<13> <00B4>
1791<14> <02C7>
1792<15> <02D8>
1793<16> <00AF>
1794<17> <02DA>
1795<18> <00B8>
1796<19> <00DF>
1797<1A> <00E6>
1798<1B> <0153>
1799<1C> <00F8>
1800<1D> <00C6>
1801<1E> <0152>
1802<1F> <00D8>
1803<21> <0021>
1804<22> <201D>
1805<23> <0023>
1806<24> <00A3>
1807<27> <2019>
1808<3C> <00A1>
1809<3D> <003D>
1810<3E> <00BF>
1811<5C> <201C>
1812<5F> <02D9>
1813<60> <2018>
1814<7D> <02DD>
1815<7E> <007E>
1816<7F> <00A8>
1817endbfchar
1818endcmap
1819CMapName currentdict /CMap defineresource pop
1820end
1821end
1822%%EndResource
1823%%EOF
1824 }\endgroup
1825 \expandafter\edef\csname cmapOT1IT\endcsname#1{%
1826 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1827 }%
1828%
1829% \cmapOT1TT
1830 \begingroup
1831 \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
1832 \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
1833%%DocumentNeededResources: ProcSet (CIDInit)
1834%%IncludeResource: ProcSet (CIDInit)
1835%%BeginResource: CMap (TeX-OT1TT-0)
1836%%Title: (TeX-OT1TT-0 TeX OT1TT 0)
1837%%Version: 1.000
1838%%EndComments
1839/CIDInit /ProcSet findresource begin
184012 dict begin
1841begincmap
1842/CIDSystemInfo
1843<< /Registry (TeX)
1844/Ordering (OT1TT)
1845/Supplement 0
1846>> def
1847/CMapName /TeX-OT1TT-0 def
1848/CMapType 2 def
18491 begincodespacerange
1850<00> <7F>
1851endcodespacerange
18525 beginbfrange
1853<00> <01> <0393>
1854<09> <0A> <03A8>
1855<21> <26> <0021>
1856<28> <5F> <0028>
1857<61> <7E> <0061>
1858endbfrange
185932 beginbfchar
1860<02> <0398>
1861<03> <039B>
1862<04> <039E>
1863<05> <03A0>
1864<06> <03A3>
1865<07> <03D2>
1866<08> <03A6>
1867<0B> <2191>
1868<0C> <2193>
1869<0D> <0027>
1870<0E> <00A1>
1871<0F> <00BF>
1872<10> <0131>
1873<11> <0237>
1874<12> <0060>
1875<13> <00B4>
1876<14> <02C7>
1877<15> <02D8>
1878<16> <00AF>
1879<17> <02DA>
1880<18> <00B8>
1881<19> <00DF>
1882<1A> <00E6>
1883<1B> <0153>
1884<1C> <00F8>
1885<1D> <00C6>
1886<1E> <0152>
1887<1F> <00D8>
1888<20> <2423>
1889<27> <2019>
1890<60> <2018>
1891<7F> <00A8>
1892endbfchar
1893endcmap
1894CMapName currentdict /CMap defineresource pop
1895end
1896end
1897%%EndResource
1898%%EOF
1899 }\endgroup
1900 \expandafter\edef\csname cmapOT1TT\endcsname#1{%
1901 \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
1902 }%
1903\fi\fi
1904
1905
1505% Set the font macro #1 to the font named #2, adding on the 1906% Set the font macro #1 to the font named #2, adding on the
1506% specified font prefix (normally `cm'). 1907% specified font prefix (normally `cm').
1507% #3 is the font's design size, #4 is a scale factor 1908% #3 is the font's design size, #4 is a scale factor, #5 is the CMap
1508\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} 1909% encoding (currently only OT1, OT1IT and OT1TT are allowed, pass
1910% empty to omit).
1911\def\setfont#1#2#3#4#5{%
1912 \font#1=\fontprefix#2#3 scaled #4
1913 \csname cmap#5\endcsname#1%
1914}
1915% This is what gets called when #5 of \setfont is empty.
1916\let\cmap\gobble
1917% emacs-page end of cmaps
1509 1918
1510% Use cm as the default font prefix. 1919% Use cm as the default font prefix.
1511% To specify the font prefix, you must define \fontprefix 1920% To specify the font prefix, you must define \fontprefix
@@ -1530,118 +1939,297 @@ where each line of input produces a line of output.}
1530\def\scshape{csc} 1939\def\scshape{csc}
1531\def\scbshape{csc} 1940\def\scbshape{csc}
1532 1941
1942% Definitions for a main text size of 11pt. This is the default in
1943% Texinfo.
1944%
1945\def\definetextfontsizexi{%
1533% Text fonts (11.2pt, magstep1). 1946% Text fonts (11.2pt, magstep1).
1534\def\textnominalsize{11pt} 1947\def\textnominalsize{11pt}
1535\edef\mainmagstep{\magstephalf} 1948\edef\mainmagstep{\magstephalf}
1536\setfont\textrm\rmshape{10}{\mainmagstep} 1949\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
1537\setfont\texttt\ttshape{10}{\mainmagstep} 1950\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
1538\setfont\textbf\bfshape{10}{\mainmagstep} 1951\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
1539\setfont\textit\itshape{10}{\mainmagstep} 1952\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
1540\setfont\textsl\slshape{10}{\mainmagstep} 1953\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
1541\setfont\textsf\sfshape{10}{\mainmagstep} 1954\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
1542\setfont\textsc\scshape{10}{\mainmagstep} 1955\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
1543\setfont\textttsl\ttslshape{10}{\mainmagstep} 1956\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
1544\font\texti=cmmi10 scaled \mainmagstep 1957\font\texti=cmmi10 scaled \mainmagstep
1545\font\textsy=cmsy10 scaled \mainmagstep 1958\font\textsy=cmsy10 scaled \mainmagstep
1959\def\textecsize{1095}
1546 1960
1547% A few fonts for @defun names and args. 1961% A few fonts for @defun names and args.
1548\setfont\defbf\bfshape{10}{\magstep1} 1962\setfont\defbf\bfshape{10}{\magstep1}{OT1}
1549\setfont\deftt\ttshape{10}{\magstep1} 1963\setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
1550\setfont\defttsl\ttslshape{10}{\magstep1} 1964\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
1551\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} 1965\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
1552 1966
1553% Fonts for indices, footnotes, small examples (9pt). 1967% Fonts for indices, footnotes, small examples (9pt).
1554\def\smallnominalsize{9pt} 1968\def\smallnominalsize{9pt}
1555\setfont\smallrm\rmshape{9}{1000} 1969\setfont\smallrm\rmshape{9}{1000}{OT1}
1556\setfont\smalltt\ttshape{9}{1000} 1970\setfont\smalltt\ttshape{9}{1000}{OT1TT}
1557\setfont\smallbf\bfshape{10}{900} 1971\setfont\smallbf\bfshape{10}{900}{OT1}
1558\setfont\smallit\itshape{9}{1000} 1972\setfont\smallit\itshape{9}{1000}{OT1IT}
1559\setfont\smallsl\slshape{9}{1000} 1973\setfont\smallsl\slshape{9}{1000}{OT1}
1560\setfont\smallsf\sfshape{9}{1000} 1974\setfont\smallsf\sfshape{9}{1000}{OT1}
1561\setfont\smallsc\scshape{10}{900} 1975\setfont\smallsc\scshape{10}{900}{OT1}
1562\setfont\smallttsl\ttslshape{10}{900} 1976\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
1563\font\smalli=cmmi9 1977\font\smalli=cmmi9
1564\font\smallsy=cmsy9 1978\font\smallsy=cmsy9
1979\def\smallecsize{0900}
1565 1980
1566% Fonts for small examples (8pt). 1981% Fonts for small examples (8pt).
1567\def\smallernominalsize{8pt} 1982\def\smallernominalsize{8pt}
1568\setfont\smallerrm\rmshape{8}{1000} 1983\setfont\smallerrm\rmshape{8}{1000}{OT1}
1569\setfont\smallertt\ttshape{8}{1000} 1984\setfont\smallertt\ttshape{8}{1000}{OT1TT}
1570\setfont\smallerbf\bfshape{10}{800} 1985\setfont\smallerbf\bfshape{10}{800}{OT1}
1571\setfont\smallerit\itshape{8}{1000} 1986\setfont\smallerit\itshape{8}{1000}{OT1IT}
1572\setfont\smallersl\slshape{8}{1000} 1987\setfont\smallersl\slshape{8}{1000}{OT1}
1573\setfont\smallersf\sfshape{8}{1000} 1988\setfont\smallersf\sfshape{8}{1000}{OT1}
1574\setfont\smallersc\scshape{10}{800} 1989\setfont\smallersc\scshape{10}{800}{OT1}
1575\setfont\smallerttsl\ttslshape{10}{800} 1990\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
1576\font\smalleri=cmmi8 1991\font\smalleri=cmmi8
1577\font\smallersy=cmsy8 1992\font\smallersy=cmsy8
1993\def\smallerecsize{0800}
1578 1994
1579% Fonts for title page (20.4pt): 1995% Fonts for title page (20.4pt):
1580\def\titlenominalsize{20pt} 1996\def\titlenominalsize{20pt}
1581\setfont\titlerm\rmbshape{12}{\magstep3} 1997\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
1582\setfont\titleit\itbshape{10}{\magstep4} 1998\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
1583\setfont\titlesl\slbshape{10}{\magstep4} 1999\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
1584\setfont\titlett\ttbshape{12}{\magstep3} 2000\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
1585\setfont\titlettsl\ttslshape{10}{\magstep4} 2001\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
1586\setfont\titlesf\sfbshape{17}{\magstep1} 2002\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
1587\let\titlebf=\titlerm 2003\let\titlebf=\titlerm
1588\setfont\titlesc\scbshape{10}{\magstep4} 2004\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
1589\font\titlei=cmmi12 scaled \magstep3 2005\font\titlei=cmmi12 scaled \magstep3
1590\font\titlesy=cmsy10 scaled \magstep4 2006\font\titlesy=cmsy10 scaled \magstep4
1591\def\authorrm{\secrm} 2007\def\authorrm{\secrm}
1592\def\authortt{\sectt} 2008\def\authortt{\sectt}
2009\def\titleecsize{2074}
1593 2010
1594% Chapter (and unnumbered) fonts (17.28pt). 2011% Chapter (and unnumbered) fonts (17.28pt).
1595\def\chapnominalsize{17pt} 2012\def\chapnominalsize{17pt}
1596\setfont\chaprm\rmbshape{12}{\magstep2} 2013\setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
1597\setfont\chapit\itbshape{10}{\magstep3} 2014\setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
1598\setfont\chapsl\slbshape{10}{\magstep3} 2015\setfont\chapsl\slbshape{10}{\magstep3}{OT1}
1599\setfont\chaptt\ttbshape{12}{\magstep2} 2016\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
1600\setfont\chapttsl\ttslshape{10}{\magstep3} 2017\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
1601\setfont\chapsf\sfbshape{17}{1000} 2018\setfont\chapsf\sfbshape{17}{1000}{OT1}
1602\let\chapbf=\chaprm 2019\let\chapbf=\chaprm
1603\setfont\chapsc\scbshape{10}{\magstep3} 2020\setfont\chapsc\scbshape{10}{\magstep3}{OT1}
1604\font\chapi=cmmi12 scaled \magstep2 2021\font\chapi=cmmi12 scaled \magstep2
1605\font\chapsy=cmsy10 scaled \magstep3 2022\font\chapsy=cmsy10 scaled \magstep3
2023\def\chapecsize{1728}
1606 2024
1607% Section fonts (14.4pt). 2025% Section fonts (14.4pt).
1608\def\secnominalsize{14pt} 2026\def\secnominalsize{14pt}
1609\setfont\secrm\rmbshape{12}{\magstep1} 2027\setfont\secrm\rmbshape{12}{\magstep1}{OT1}
1610\setfont\secit\itbshape{10}{\magstep2} 2028\setfont\secit\itbshape{10}{\magstep2}{OT1IT}
1611\setfont\secsl\slbshape{10}{\magstep2} 2029\setfont\secsl\slbshape{10}{\magstep2}{OT1}
1612\setfont\sectt\ttbshape{12}{\magstep1} 2030\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
1613\setfont\secttsl\ttslshape{10}{\magstep2} 2031\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
1614\setfont\secsf\sfbshape{12}{\magstep1} 2032\setfont\secsf\sfbshape{12}{\magstep1}{OT1}
1615\let\secbf\secrm 2033\let\secbf\secrm
1616\setfont\secsc\scbshape{10}{\magstep2} 2034\setfont\secsc\scbshape{10}{\magstep2}{OT1}
1617\font\seci=cmmi12 scaled \magstep1 2035\font\seci=cmmi12 scaled \magstep1
1618\font\secsy=cmsy10 scaled \magstep2 2036\font\secsy=cmsy10 scaled \magstep2
2037\def\sececsize{1440}
1619 2038
1620% Subsection fonts (13.15pt). 2039% Subsection fonts (13.15pt).
1621\def\ssecnominalsize{13pt} 2040\def\ssecnominalsize{13pt}
1622\setfont\ssecrm\rmbshape{12}{\magstephalf} 2041\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
1623\setfont\ssecit\itbshape{10}{1315} 2042\setfont\ssecit\itbshape{10}{1315}{OT1IT}
1624\setfont\ssecsl\slbshape{10}{1315} 2043\setfont\ssecsl\slbshape{10}{1315}{OT1}
1625\setfont\ssectt\ttbshape{12}{\magstephalf} 2044\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
1626\setfont\ssecttsl\ttslshape{10}{1315} 2045\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
1627\setfont\ssecsf\sfbshape{12}{\magstephalf} 2046\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
1628\let\ssecbf\ssecrm 2047\let\ssecbf\ssecrm
1629\setfont\ssecsc\scbshape{10}{1315} 2048\setfont\ssecsc\scbshape{10}{1315}{OT1}
1630\font\sseci=cmmi12 scaled \magstephalf 2049\font\sseci=cmmi12 scaled \magstephalf
1631\font\ssecsy=cmsy10 scaled 1315 2050\font\ssecsy=cmsy10 scaled 1315
2051\def\ssececsize{1200}
1632 2052
1633% Reduced fonts for @acro in text (10pt). 2053% Reduced fonts for @acro in text (10pt).
1634\def\reducednominalsize{10pt} 2054\def\reducednominalsize{10pt}
1635\setfont\reducedrm\rmshape{10}{1000} 2055\setfont\reducedrm\rmshape{10}{1000}{OT1}
1636\setfont\reducedtt\ttshape{10}{1000} 2056\setfont\reducedtt\ttshape{10}{1000}{OT1TT}
1637\setfont\reducedbf\bfshape{10}{1000} 2057\setfont\reducedbf\bfshape{10}{1000}{OT1}
1638\setfont\reducedit\itshape{10}{1000} 2058\setfont\reducedit\itshape{10}{1000}{OT1IT}
1639\setfont\reducedsl\slshape{10}{1000} 2059\setfont\reducedsl\slshape{10}{1000}{OT1}
1640\setfont\reducedsf\sfshape{10}{1000} 2060\setfont\reducedsf\sfshape{10}{1000}{OT1}
1641\setfont\reducedsc\scshape{10}{1000} 2061\setfont\reducedsc\scshape{10}{1000}{OT1}
1642\setfont\reducedttsl\ttslshape{10}{1000} 2062\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
1643\font\reducedi=cmmi10 2063\font\reducedi=cmmi10
1644\font\reducedsy=cmsy10 2064\font\reducedsy=cmsy10
2065\def\reducedecsize{1000}
2066
2067% reset the current fonts
2068\textfonts
2069\rm
2070} % end of 11pt text font size definitions
2071
2072
2073% Definitions to make the main text be 10pt Computer Modern, with
2074% section, chapter, etc., sizes following suit. This is for the GNU
2075% Press printing of the Emacs 22 manual. Maybe other manuals in the
2076% future. Used with @smallbook, which sets the leading to 12pt.
2077%
2078\def\definetextfontsizex{%
2079% Text fonts (10pt).
2080\def\textnominalsize{10pt}
2081\edef\mainmagstep{1000}
2082\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
2083\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
2084\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
2085\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
2086\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
2087\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
2088\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
2089\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
2090\font\texti=cmmi10 scaled \mainmagstep
2091\font\textsy=cmsy10 scaled \mainmagstep
2092\def\textecsize{1000}
2093
2094% A few fonts for @defun names and args.
2095\setfont\defbf\bfshape{10}{\magstephalf}{OT1}
2096\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
2097\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
2098\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
2099
2100% Fonts for indices, footnotes, small examples (9pt).
2101\def\smallnominalsize{9pt}
2102\setfont\smallrm\rmshape{9}{1000}{OT1}
2103\setfont\smalltt\ttshape{9}{1000}{OT1TT}
2104\setfont\smallbf\bfshape{10}{900}{OT1}
2105\setfont\smallit\itshape{9}{1000}{OT1IT}
2106\setfont\smallsl\slshape{9}{1000}{OT1}
2107\setfont\smallsf\sfshape{9}{1000}{OT1}
2108\setfont\smallsc\scshape{10}{900}{OT1}
2109\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
2110\font\smalli=cmmi9
2111\font\smallsy=cmsy9
2112\def\smallecsize{0900}
2113
2114% Fonts for small examples (8pt).
2115\def\smallernominalsize{8pt}
2116\setfont\smallerrm\rmshape{8}{1000}{OT1}
2117\setfont\smallertt\ttshape{8}{1000}{OT1TT}
2118\setfont\smallerbf\bfshape{10}{800}{OT1}
2119\setfont\smallerit\itshape{8}{1000}{OT1IT}
2120\setfont\smallersl\slshape{8}{1000}{OT1}
2121\setfont\smallersf\sfshape{8}{1000}{OT1}
2122\setfont\smallersc\scshape{10}{800}{OT1}
2123\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
2124\font\smalleri=cmmi8
2125\font\smallersy=cmsy8
2126\def\smallerecsize{0800}
2127
2128% Fonts for title page (20.4pt):
2129\def\titlenominalsize{20pt}
2130\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
2131\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
2132\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
2133\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
2134\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
2135\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
2136\let\titlebf=\titlerm
2137\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
2138\font\titlei=cmmi12 scaled \magstep3
2139\font\titlesy=cmsy10 scaled \magstep4
2140\def\authorrm{\secrm}
2141\def\authortt{\sectt}
2142\def\titleecsize{2074}
2143
2144% Chapter fonts (14.4pt).
2145\def\chapnominalsize{14pt}
2146\setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
2147\setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
2148\setfont\chapsl\slbshape{10}{\magstep2}{OT1}
2149\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
2150\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
2151\setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
2152\let\chapbf\chaprm
2153\setfont\chapsc\scbshape{10}{\magstep2}{OT1}
2154\font\chapi=cmmi12 scaled \magstep1
2155\font\chapsy=cmsy10 scaled \magstep2
2156\def\chapecsize{1440}
2157
2158% Section fonts (12pt).
2159\def\secnominalsize{12pt}
2160\setfont\secrm\rmbshape{12}{1000}{OT1}
2161\setfont\secit\itbshape{10}{\magstep1}{OT1IT}
2162\setfont\secsl\slbshape{10}{\magstep1}{OT1}
2163\setfont\sectt\ttbshape{12}{1000}{OT1TT}
2164\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
2165\setfont\secsf\sfbshape{12}{1000}{OT1}
2166\let\secbf\secrm
2167\setfont\secsc\scbshape{10}{\magstep1}{OT1}
2168\font\seci=cmmi12
2169\font\secsy=cmsy10 scaled \magstep1
2170\def\sececsize{1200}
2171
2172% Subsection fonts (10pt).
2173\def\ssecnominalsize{10pt}
2174\setfont\ssecrm\rmbshape{10}{1000}{OT1}
2175\setfont\ssecit\itbshape{10}{1000}{OT1IT}
2176\setfont\ssecsl\slbshape{10}{1000}{OT1}
2177\setfont\ssectt\ttbshape{10}{1000}{OT1TT}
2178\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
2179\setfont\ssecsf\sfbshape{10}{1000}{OT1}
2180\let\ssecbf\ssecrm
2181\setfont\ssecsc\scbshape{10}{1000}{OT1}
2182\font\sseci=cmmi10
2183\font\ssecsy=cmsy10
2184\def\ssececsize{1000}
2185
2186% Reduced fonts for @acro in text (9pt).
2187\def\reducednominalsize{9pt}
2188\setfont\reducedrm\rmshape{9}{1000}{OT1}
2189\setfont\reducedtt\ttshape{9}{1000}{OT1TT}
2190\setfont\reducedbf\bfshape{10}{900}{OT1}
2191\setfont\reducedit\itshape{9}{1000}{OT1IT}
2192\setfont\reducedsl\slshape{9}{1000}{OT1}
2193\setfont\reducedsf\sfshape{9}{1000}{OT1}
2194\setfont\reducedsc\scshape{10}{900}{OT1}
2195\setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
2196\font\reducedi=cmmi9
2197\font\reducedsy=cmsy9
2198\def\reducedecsize{0900}
2199
2200% reduce space between paragraphs
2201\divide\parskip by 2
2202
2203% reset the current fonts
2204\textfonts
2205\rm
2206} % end of 10pt text font size definitions
2207
2208
2209% We provide the user-level command
2210% @fonttextsize 10
2211% (or 11) to redefine the text font size. pt is assumed.
2212%
2213\def\xword{10}
2214\def\xiword{11}
2215%
2216\parseargdef\fonttextsize{%
2217 \def\textsizearg{#1}%
2218 \wlog{doing @fonttextsize \textsizearg}%
2219 %
2220 % Set \globaldefs so that documents can use this inside @tex, since
2221 % makeinfo 4.8 does not support it, but we need it nonetheless.
2222 %
2223 \begingroup \globaldefs=1
2224 \ifx\textsizearg\xword \definetextfontsizex
2225 \else \ifx\textsizearg\xiword \definetextfontsizexi
2226 \else
2227 \errhelp=\EMsimple
2228 \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
2229 \fi\fi
2230 \endgroup
2231}
2232
1645 2233
1646% In order for the font changes to affect most math symbols and letters, 2234% In order for the font changes to affect most math symbols and letters,
1647% we have to define the \textfont of the standard families. Since 2235% we have to define the \textfont of the standard families. Since
@@ -1753,7 +2341,7 @@ where each line of input produces a line of output.}
1753 2341
1754% Set up the default fonts, so we can use them for creating boxes. 2342% Set up the default fonts, so we can use them for creating boxes.
1755% 2343%
1756\textfonts \rm 2344\definetextfontsizexi
1757 2345
1758% Define these so they can be easily changed for other fonts. 2346% Define these so they can be easily changed for other fonts.
1759\def\angleleft{$\langle$} 2347\def\angleleft{$\langle$}
@@ -1763,10 +2351,10 @@ where each line of input produces a line of output.}
1763\newcount\fontdepth \fontdepth=0 2351\newcount\fontdepth \fontdepth=0
1764 2352
1765% Fonts for short table of contents. 2353% Fonts for short table of contents.
1766\setfont\shortcontrm\rmshape{12}{1000} 2354\setfont\shortcontrm\rmshape{12}{1000}{OT1}
1767\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 2355\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
1768\setfont\shortcontsl\slshape{12}{1000} 2356\setfont\shortcontsl\slshape{12}{1000}{OT1}
1769\setfont\shortconttt\ttshape{12}{1000} 2357\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
1770 2358
1771%% Add scribe-like font environments, plus @l for inline lisp (usually sans 2359%% Add scribe-like font environments, plus @l for inline lisp (usually sans
1772%% serif) and @ii for TeX italic 2360%% serif) and @ii for TeX italic
@@ -1829,7 +2417,7 @@ where each line of input produces a line of output.}
1829 \null 2417 \null
1830} 2418}
1831\def\samp#1{`\tclose{#1}'\null} 2419\def\samp#1{`\tclose{#1}'\null}
1832\setfont\keyrm\rmshape{8}{1000} 2420\setfont\keyrm\rmshape{8}{1000}{OT1}
1833\font\keysy=cmsy9 2421\font\keysy=cmsy9
1834\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% 2422\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
1835 \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% 2423 \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
@@ -1837,6 +2425,7 @@ where each line of input produces a line of output.}
1837 \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% 2425 \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
1838 \kern-0.4pt\hrule}% 2426 \kern-0.4pt\hrule}%
1839 \kern-.06em\raise0.4pt\hbox{\angleright}}}} 2427 \kern-.06em\raise0.4pt\hbox{\angleright}}}}
2428\def\key #1{{\nohyphenation \uppercase{#1}}\null}
1840% The old definition, with no lozenge: 2429% The old definition, with no lozenge:
1841%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} 2430%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
1842\def\ctrl #1{{\tt \rawbackslash \hat}#1} 2431\def\ctrl #1{{\tt \rawbackslash \hat}#1}
@@ -1878,11 +2467,14 @@ where each line of input produces a line of output.}
1878% and arrange explicitly to hyphenate at a dash. 2467% and arrange explicitly to hyphenate at a dash.
1879% -- rms. 2468% -- rms.
1880{ 2469{
1881 \catcode`\-=\active 2470 \catcode`\-=\active \catcode`\_=\active
1882 \catcode`\_=\active 2471 \catcode`\'=\active \catcode`\`=\active
1883 % 2472 %
1884 \global\def\code{\begingroup 2473 \global\def\code{\begingroup
1885 \catcode`\-=\active \catcode`\_=\active 2474 \catcode\rquoteChar=\active \catcode\lquoteChar=\active
2475 \let'\codequoteright \let`\codequoteleft
2476 %
2477 \catcode\dashChar=\active \catcode\underChar=\active
1886 \ifallowcodebreaks 2478 \ifallowcodebreaks
1887 \let-\codedash 2479 \let-\codedash
1888 \let_\codeunder 2480 \let_\codeunder
@@ -2118,6 +2710,35 @@ where each line of input produces a line of output.}
2118 \thiseurofont 2710 \thiseurofont
2119} 2711}
2120 2712
2713% Hacks for glyphs from the EC fonts similar to \euro. We don't
2714% use \let for the aliases, because sometimes we redefine the original
2715% macro, and the alias should reflect the redefinition.
2716\def\guillemetleft{{\ecfont \char"13}}
2717\def\guillemotleft{\guillemetleft}
2718\def\guillemetright{{\ecfont \char"14}}
2719\def\guillemotright{\guillemetright}
2720\def\guilsinglleft{{\ecfont \char"0E}}
2721\def\guilsinglright{{\ecfont \char"0F}}
2722\def\quotedblbase{{\ecfont \char"12}}
2723\def\quotesinglbase{{\ecfont \char"0D}}
2724%
2725\def\ecfont{%
2726 % We can't distinguish serif/sanserif and italic/slanted, but this
2727 % is used for crude hacks anyway (like adding French and German
2728 % quotes to documents typeset with CM, where we lose kerning), so
2729 % hopefully nobody will notice/care.
2730 \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
2731 \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
2732 \ifx\curfontstyle\bfstylename
2733 % bold:
2734 \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
2735 \else
2736 % regular:
2737 \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
2738 \fi
2739 \thisecfont
2740}
2741
2121% @registeredsymbol - R in a circle. The font for the R should really 2742% @registeredsymbol - R in a circle. The font for the R should really
2122% be smaller yet, but lllsize is the best we can do for now. 2743% be smaller yet, but lllsize is the best we can do for now.
2123% Adapted from the plain.tex definition of \copyright. 2744% Adapted from the plain.tex definition of \copyright.
@@ -2128,6 +2749,10 @@ where each line of input produces a line of output.}
2128 }$% 2749 }$%
2129} 2750}
2130 2751
2752% @textdegree - the normal degrees sign.
2753%
2754\def\textdegree{$^\circ$}
2755
2131% Laurent Siebenmann reports \Orb undefined with: 2756% Laurent Siebenmann reports \Orb undefined with:
2132% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 2757% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
2133% so we'll define it if necessary. 2758% so we'll define it if necessary.
@@ -2136,6 +2761,12 @@ where each line of input produces a line of output.}
2136\def\Orb{\mathhexbox20D} 2761\def\Orb{\mathhexbox20D}
2137\fi 2762\fi
2138 2763
2764% Quotes.
2765\chardef\quotedblleft="5C
2766\chardef\quotedblright=`\"
2767\chardef\quoteleft=`\`
2768\chardef\quoteright=`\'
2769
2139 2770
2140\message{page headings,} 2771\message{page headings,}
2141 2772
@@ -2299,12 +2930,39 @@ where each line of input produces a line of output.}
2299 % 2930 %
2300 % Leave some space for the footline. Hopefully ok to assume 2931 % Leave some space for the footline. Hopefully ok to assume
2301 % @evenfooting will not be used by itself. 2932 % @evenfooting will not be used by itself.
2302 \global\advance\pageheight by -\baselineskip 2933 \global\advance\pageheight by -12pt
2303 \global\advance\vsize by -\baselineskip 2934 \global\advance\vsize by -12pt
2304} 2935}
2305 2936
2306\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} 2937\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
2307 2938
2939% @evenheadingmarks top \thischapter <- chapter at the top of a page
2940% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
2941%
2942% The same set of arguments for:
2943%
2944% @oddheadingmarks
2945% @evenfootingmarks
2946% @oddfootingmarks
2947% @everyheadingmarks
2948% @everyfootingmarks
2949
2950\def\evenheadingmarks{\headingmarks{even}{heading}}
2951\def\oddheadingmarks{\headingmarks{odd}{heading}}
2952\def\evenfootingmarks{\headingmarks{even}{footing}}
2953\def\oddfootingmarks{\headingmarks{odd}{footing}}
2954\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
2955 \headingmarks{odd}{heading}{#1} }
2956\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
2957 \headingmarks{odd}{footing}{#1} }
2958% #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
2959\def\headingmarks#1#2#3 {%
2960 \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
2961 \global\expandafter\let\csname get#1#2marks\endcsname \temp
2962}
2963
2964\everyheadingmarks bottom
2965\everyfootingmarks bottom
2308 2966
2309% @headings double turns headings on for double-sided printing. 2967% @headings double turns headings on for double-sided printing.
2310% @headings single turns headings on for single-sided printing. 2968% @headings single turns headings on for single-sided printing.
@@ -2959,6 +3617,7 @@ where each line of input produces a line of output.}
2959 3617
2960\def\doignore#1{\begingroup 3618\def\doignore#1{\begingroup
2961 % Scan in ``verbatim'' mode: 3619 % Scan in ``verbatim'' mode:
3620 \obeylines
2962 \catcode`\@ = \other 3621 \catcode`\@ = \other
2963 \catcode`\{ = \other 3622 \catcode`\{ = \other
2964 \catcode`\} = \other 3623 \catcode`\} = \other
@@ -2979,16 +3638,16 @@ where each line of input produces a line of output.}
2979 \gdef\dodoignore#1{% 3638 \gdef\dodoignore#1{%
2980 % #1 contains the command name as a string, e.g., `ifinfo'. 3639 % #1 contains the command name as a string, e.g., `ifinfo'.
2981 % 3640 %
2982 % Define a command to find the next `@end #1', which must be on a line 3641 % Define a command to find the next `@end #1'.
2983 % by itself. 3642 \long\def\doignoretext##1^^M@end #1{%
2984 \long\def\doignoretext##1^^M@end #1{\doignoretextyyy##1^^M@#1\_STOP_}% 3643 \doignoretextyyy##1^^M@#1\_STOP_}%
3644 %
2985 % And this command to find another #1 command, at the beginning of a 3645 % And this command to find another #1 command, at the beginning of a
2986 % line. (Otherwise, we would consider a line `@c @ifset', for 3646 % line. (Otherwise, we would consider a line `@c @ifset', for
2987 % example, to count as an @ifset for nesting.) 3647 % example, to count as an @ifset for nesting.)
2988 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% 3648 \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
2989 % 3649 %
2990 % And now expand that command. 3650 % And now expand that command.
2991 \obeylines %
2992 \doignoretext ^^M% 3651 \doignoretext ^^M%
2993 }% 3652 }%
2994} 3653}
@@ -3018,7 +3677,12 @@ where each line of input produces a line of output.}
3018} 3677}
3019 3678
3020% Finish off ignored text. 3679% Finish off ignored text.
3021\def\enddoignore{\endgroup\ignorespaces} 3680{ \obeylines%
3681 % Ignore anything after the last `@end #1'; this matters in verbatim
3682 % environments, where otherwise the newline after an ignored conditional
3683 % would result in a blank line in the output.
3684 \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
3685}
3022 3686
3023 3687
3024% @set VAR sets the variable VAR to an empty value. 3688% @set VAR sets the variable VAR to an empty value.
@@ -3221,12 +3885,39 @@ where each line of input produces a line of output.}
3221 \escapechar = `\\ % use backslash in output files. 3885 \escapechar = `\\ % use backslash in output files.
3222 \def\@{@}% change to @@ when we switch to @ as escape char in index files. 3886 \def\@{@}% change to @@ when we switch to @ as escape char in index files.
3223 \def\ {\realbackslash\space }% 3887 \def\ {\realbackslash\space }%
3888 %
3224 % Need these in case \tex is in effect and \{ is a \delimiter again. 3889 % Need these in case \tex is in effect and \{ is a \delimiter again.
3225 % But can't use \lbracecmd and \rbracecmd because texindex assumes 3890 % But can't use \lbracecmd and \rbracecmd because texindex assumes
3226 % braces and backslashes are used only as delimiters. 3891 % braces and backslashes are used only as delimiters.
3227 \let\{ = \mylbrace 3892 \let\{ = \mylbrace
3228 \let\} = \myrbrace 3893 \let\} = \myrbrace
3229 % 3894 %
3895 % I don't entirely understand this, but when an index entry is
3896 % generated from a macro call, the \endinput which \scanmacro inserts
3897 % causes processing to be prematurely terminated. This is,
3898 % apparently, because \indexsorttmp is fully expanded, and \endinput
3899 % is an expandable command. The redefinition below makes \endinput
3900 % disappear altogether for that purpose -- although logging shows that
3901 % processing continues to some further point. On the other hand, it
3902 % seems \endinput does not hurt in the printed index arg, since that
3903 % is still getting written without apparent harm.
3904 %
3905 % Sample source (mac-idx3.tex, reported by Graham Percival to
3906 % help-texinfo, 22may06):
3907 % @macro funindex {WORD}
3908 % @findex xyz
3909 % @end macro
3910 % ...
3911 % @funindex commtest
3912 %
3913 % The above is not enough to reproduce the bug, but it gives the flavor.
3914 %
3915 % Sample whatsit resulting:
3916 % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}}
3917 %
3918 % So:
3919 \let\endinput = \empty
3920 %
3230 % Do the redefinitions. 3921 % Do the redefinitions.
3231 \commondummies 3922 \commondummies
3232} 3923}
@@ -3244,6 +3935,7 @@ where each line of input produces a line of output.}
3244 % 3935 %
3245 % Do the redefinitions. 3936 % Do the redefinitions.
3246 \commondummies 3937 \commondummies
3938 \otherbackslash
3247} 3939}
3248 3940
3249% Called from \indexdummies and \atdummies. 3941% Called from \indexdummies and \atdummies.
@@ -3311,12 +4003,23 @@ where each line of input produces a line of output.}
3311 \definedummyword\equiv 4003 \definedummyword\equiv
3312 \definedummyword\error 4004 \definedummyword\error
3313 \definedummyword\euro 4005 \definedummyword\euro
4006 \definedummyword\guillemetleft
4007 \definedummyword\guillemetright
4008 \definedummyword\guilsinglleft
4009 \definedummyword\guilsinglright
3314 \definedummyword\expansion 4010 \definedummyword\expansion
3315 \definedummyword\minus 4011 \definedummyword\minus
3316 \definedummyword\pounds 4012 \definedummyword\pounds
3317 \definedummyword\point 4013 \definedummyword\point
3318 \definedummyword\print 4014 \definedummyword\print
4015 \definedummyword\quotedblbase
4016 \definedummyword\quotedblleft
4017 \definedummyword\quotedblright
4018 \definedummyword\quoteleft
4019 \definedummyword\quoteright
4020 \definedummyword\quotesinglbase
3319 \definedummyword\result 4021 \definedummyword\result
4022 \definedummyword\textdegree
3320 % 4023 %
3321 % We want to disable all macros so that they are not expanded by \write. 4024 % We want to disable all macros so that they are not expanded by \write.
3322 \macrolist 4025 \macrolist
@@ -3330,63 +4033,62 @@ where each line of input produces a line of output.}
3330 4033
3331% \commondummiesnofonts: common to \commondummies and \indexnofonts. 4034% \commondummiesnofonts: common to \commondummies and \indexnofonts.
3332% 4035%
3333% Better have this without active chars. 4036\def\commondummiesnofonts{%
3334{ 4037 % Control letters and accents.
3335 \catcode`\~=\other 4038 \definedummyletter\!%
3336 \gdef\commondummiesnofonts{% 4039 \definedummyaccent\"%
3337 % Control letters and accents. 4040 \definedummyaccent\'%
3338 \definedummyletter\!% 4041 \definedummyletter\*%
3339 \definedummyaccent\"% 4042 \definedummyaccent\,%
3340 \definedummyaccent\'% 4043 \definedummyletter\.%
3341 \definedummyletter\*% 4044 \definedummyletter\/%
3342 \definedummyaccent\,% 4045 \definedummyletter\:%
3343 \definedummyletter\.% 4046 \definedummyaccent\=%
3344 \definedummyletter\/% 4047 \definedummyletter\?%
3345 \definedummyletter\:% 4048 \definedummyaccent\^%
3346 \definedummyaccent\=% 4049 \definedummyaccent\`%
3347 \definedummyletter\?% 4050 \definedummyaccent\~%
3348 \definedummyaccent\^% 4051 \definedummyword\u
3349 \definedummyaccent\`% 4052 \definedummyword\v
3350 \definedummyaccent\~% 4053 \definedummyword\H
3351 \definedummyword\u 4054 \definedummyword\dotaccent
3352 \definedummyword\v 4055 \definedummyword\ringaccent
3353 \definedummyword\H 4056 \definedummyword\tieaccent
3354 \definedummyword\dotaccent 4057 \definedummyword\ubaraccent
3355 \definedummyword\ringaccent 4058 \definedummyword\udotaccent
3356 \definedummyword\tieaccent 4059 \definedummyword\dotless
3357 \definedummyword\ubaraccent 4060 %
3358 \definedummyword\udotaccent 4061 % Texinfo font commands.
3359 \definedummyword\dotless 4062 \definedummyword\b
3360 % 4063 \definedummyword\i
3361 % Texinfo font commands. 4064 \definedummyword\r
3362 \definedummyword\b 4065 \definedummyword\sc
3363 \definedummyword\i 4066 \definedummyword\t
3364 \definedummyword\r 4067 %
3365 \definedummyword\sc 4068 % Commands that take arguments.
3366 \definedummyword\t 4069 \definedummyword\acronym
3367 % 4070 \definedummyword\cite
3368 % Commands that take arguments. 4071 \definedummyword\code
3369 \definedummyword\acronym 4072 \definedummyword\command
3370 \definedummyword\cite 4073 \definedummyword\dfn
3371 \definedummyword\code 4074 \definedummyword\emph
3372 \definedummyword\command 4075 \definedummyword\env
3373 \definedummyword\dfn 4076 \definedummyword\file
3374 \definedummyword\emph 4077 \definedummyword\kbd
3375 \definedummyword\env 4078 \definedummyword\key
3376 \definedummyword\file 4079 \definedummyword\math
3377 \definedummyword\kbd 4080 \definedummyword\option
3378 \definedummyword\key 4081 \definedummyword\pxref
3379 \definedummyword\math 4082 \definedummyword\ref
3380 \definedummyword\option 4083 \definedummyword\samp
3381 \definedummyword\samp 4084 \definedummyword\strong
3382 \definedummyword\strong 4085 \definedummyword\tie
3383 \definedummyword\tie 4086 \definedummyword\uref
3384 \definedummyword\uref 4087 \definedummyword\url
3385 \definedummyword\url 4088 \definedummyword\var
3386 \definedummyword\var 4089 \definedummyword\verb
3387 \definedummyword\verb 4090 \definedummyword\w
3388 \definedummyword\w 4091 \definedummyword\xref
3389 }
3390} 4092}
3391 4093
3392% \indexnofonts is used when outputting the strings to sort the index 4094% \indexnofonts is used when outputting the strings to sort the index
@@ -3445,12 +4147,23 @@ where each line of input produces a line of output.}
3445 \def\equiv{==}% 4147 \def\equiv{==}%
3446 \def\error{error}% 4148 \def\error{error}%
3447 \def\euro{euro}% 4149 \def\euro{euro}%
4150 \def\guillemetleft{<<}%
4151 \def\guillemetright{>>}%
4152 \def\guilsinglleft{<}%
4153 \def\guilsinglright{>}%
3448 \def\expansion{==>}% 4154 \def\expansion{==>}%
3449 \def\minus{-}% 4155 \def\minus{-}%
3450 \def\pounds{pounds}% 4156 \def\pounds{pounds}%
3451 \def\point{.}% 4157 \def\point{.}%
3452 \def\print{-|}% 4158 \def\print{-|}%
4159 \def\quotedblbase{"}%
4160 \def\quotedblleft{"}%
4161 \def\quotedblright{"}%
4162 \def\quoteleft{`}%
4163 \def\quoteright{'}%
4164 \def\quotesinglbase{,}%
3453 \def\result{=>}% 4165 \def\result{=>}%
4166 \def\textdegree{degrees}%
3454 % 4167 %
3455 % We need to get rid of all macros, leaving only the arguments (if present). 4168 % We need to get rid of all macros, leaving only the arguments (if present).
3456 % Of course this is not nearly correct, but it is the best we can do for now. 4169 % Of course this is not nearly correct, but it is the best we can do for now.
@@ -3490,11 +4203,7 @@ where each line of input produces a line of output.}
3490 % 4203 %
3491 \edef\writeto{\csname#1indfile\endcsname}% 4204 \edef\writeto{\csname#1indfile\endcsname}%
3492 % 4205 %
3493 \ifvmode 4206 \safewhatsit\dosubindwrite
3494 \dosubindsanitize
3495 \else
3496 \dosubindwrite
3497 \fi
3498 }% 4207 }%
3499 \fi 4208 \fi
3500} 4209}
@@ -3531,13 +4240,13 @@ where each line of input produces a line of output.}
3531 \temp 4240 \temp
3532} 4241}
3533 4242
3534% Take care of unwanted page breaks: 4243% Take care of unwanted page breaks/skips around a whatsit:
3535% 4244%
3536% If a skip is the last thing on the list now, preserve it 4245% If a skip is the last thing on the list now, preserve it
3537% by backing up by \lastskip, doing the \write, then inserting 4246% by backing up by \lastskip, doing the \write, then inserting
3538% the skip again. Otherwise, the whatsit generated by the 4247% the skip again. Otherwise, the whatsit generated by the
3539% \write will make \lastskip zero. The result is that sequences 4248% \write or \pdfdest will make \lastskip zero. The result is that
3540% like this: 4249% sequences like this:
3541% @end defun 4250% @end defun
3542% @tindex whatever 4251% @tindex whatever
3543% @defun ... 4252% @defun ...
@@ -3561,25 +4270,31 @@ where each line of input produces a line of output.}
3561% 4270%
3562\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} 4271\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
3563% 4272%
4273\newskip\whatsitskip
4274\newcount\whatsitpenalty
4275%
3564% ..., ready, GO: 4276% ..., ready, GO:
3565% 4277%
3566\def\dosubindsanitize{% 4278\def\safewhatsit#1{%
4279\ifhmode
4280 #1%
4281\else
3567 % \lastskip and \lastpenalty cannot both be nonzero simultaneously. 4282 % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
3568 \skip0 = \lastskip 4283 \whatsitskip = \lastskip
3569 \edef\lastskipmacro{\the\lastskip}% 4284 \edef\lastskipmacro{\the\lastskip}%
3570 \count255 = \lastpenalty 4285 \whatsitpenalty = \lastpenalty
3571 % 4286 %
3572 % If \lastskip is nonzero, that means the last item was a 4287 % If \lastskip is nonzero, that means the last item was a
3573 % skip. And since a skip is discardable, that means this 4288 % skip. And since a skip is discardable, that means this
3574 % -\skip0 glue we're inserting is preceded by a 4289 % -\whatsitskip glue we're inserting is preceded by a
3575 % non-discardable item, therefore it is not a potential 4290 % non-discardable item, therefore it is not a potential
3576 % breakpoint, therefore no \nobreak needed. 4291 % breakpoint, therefore no \nobreak needed.
3577 \ifx\lastskipmacro\zeroskipmacro 4292 \ifx\lastskipmacro\zeroskipmacro
3578 \else 4293 \else
3579 \vskip-\skip0 4294 \vskip-\whatsitskip
3580 \fi 4295 \fi
3581 % 4296 %
3582 \dosubindwrite 4297 #1%
3583 % 4298 %
3584 \ifx\lastskipmacro\zeroskipmacro 4299 \ifx\lastskipmacro\zeroskipmacro
3585 % If \lastskip was zero, perhaps the last item was a penalty, and 4300 % If \lastskip was zero, perhaps the last item was a penalty, and
@@ -3593,13 +4308,14 @@ where each line of input produces a line of output.}
3593 % Description. 4308 % Description.
3594 % would allow a break between the index-whatever whatsit 4309 % would allow a break between the index-whatever whatsit
3595 % and the "Description." paragraph. 4310 % and the "Description." paragraph.
3596 \ifnum\count255>9999 \penalty\count255 \fi 4311 \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
3597 \else 4312 \else
3598 % On the other hand, if we had a nonzero \lastskip, 4313 % On the other hand, if we had a nonzero \lastskip,
3599 % this make-up glue would be preceded by a non-discardable item 4314 % this make-up glue would be preceded by a non-discardable item
3600 % (the whatsit from the \write), so we must insert a \nobreak. 4315 % (the whatsit from the \write), so we must insert a \nobreak.
3601 \nobreak\vskip\skip0 4316 \nobreak\vskip\whatsitskip
3602 \fi 4317 \fi
4318\fi
3603} 4319}
3604 4320
3605% The index entry written in the file actually looks like 4321% The index entry written in the file actually looks like
@@ -3642,6 +4358,7 @@ where each line of input produces a line of output.}
3642 % 4358 %
3643 \smallfonts \rm 4359 \smallfonts \rm
3644 \tolerance = 9500 4360 \tolerance = 9500
4361 \plainfrenchspacing
3645 \everypar = {}% don't want the \kern\-parindent from indentation suppression. 4362 \everypar = {}% don't want the \kern\-parindent from indentation suppression.
3646 % 4363 %
3647 % See if the index file exists and is nonempty. 4364 % See if the index file exists and is nonempty.
@@ -3771,11 +4488,8 @@ where each line of input produces a line of output.}
3771 % The following is kludged to not output a line of dots in the index if 4488 % The following is kludged to not output a line of dots in the index if
3772 % there are no page numbers. The next person who breaks this will be 4489 % there are no page numbers. The next person who breaks this will be
3773 % cursed by a Unix daemon. 4490 % cursed by a Unix daemon.
3774 \def\tempa{{\rm }}% 4491 \setbox\boxA = \hbox{#1}%
3775 \def\tempb{#1}% 4492 \ifdim\wd\boxA = 0pt
3776 \edef\tempc{\tempa}%
3777 \edef\tempd{\tempb}%
3778 \ifx\tempc\tempd
3779 \ % 4493 \ %
3780 \else 4494 \else
3781 % 4495 %
@@ -3799,9 +4513,9 @@ where each line of input produces a line of output.}
3799 \endgroup 4513 \endgroup
3800} 4514}
3801 4515
3802% Like \dotfill except takes at least 1 em. 4516% Like plain.tex's \dotfill, except uses up at least 1 em.
3803\def\indexdotfill{\cleaders 4517\def\indexdotfill{\cleaders
3804 \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} 4518 \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill}
3805 4519
3806\def\primary #1{\line{#1\hfil}} 4520\def\primary #1{\line{#1\hfil}}
3807 4521
@@ -3911,6 +4625,34 @@ where each line of input produces a line of output.}
3911% 4625%
3912% All done with double columns. 4626% All done with double columns.
3913\def\enddoublecolumns{% 4627\def\enddoublecolumns{%
4628 % The following penalty ensures that the page builder is exercised
4629 % _before_ we change the output routine. This is necessary in the
4630 % following situation:
4631 %
4632 % The last section of the index consists only of a single entry.
4633 % Before this section, \pagetotal is less than \pagegoal, so no
4634 % break occurs before the last section starts. However, the last
4635 % section, consisting of \initial and the single \entry, does not
4636 % fit on the page and has to be broken off. Without the following
4637 % penalty the page builder will not be exercised until \eject
4638 % below, and by that time we'll already have changed the output
4639 % routine to the \balancecolumns version, so the next-to-last
4640 % double-column page will be processed with \balancecolumns, which
4641 % is wrong: The two columns will go to the main vertical list, with
4642 % the broken-off section in the recent contributions. As soon as
4643 % the output routine finishes, TeX starts reconsidering the page
4644 % break. The two columns and the broken-off section both fit on the
4645 % page, because the two columns now take up only half of the page
4646 % goal. When TeX sees \eject from below which follows the final
4647 % section, it invokes the new output routine that we've set after
4648 % \balancecolumns below; \onepageout will try to fit the two columns
4649 % and the final section into the vbox of \pageheight (see
4650 % \pagebody), causing an overfull box.
4651 %
4652 % Note that glue won't work here, because glue does not exercise the
4653 % page builder, unlike penalties (see The TeXbook, pp. 280-281).
4654 \penalty0
4655 %
3914 \output = {% 4656 \output = {%
3915 % Split the last of the double-column material. Leave it on the 4657 % Split the last of the double-column material. Leave it on the
3916 % current page, no automatic page break. 4658 % current page, no automatic page break.
@@ -4020,11 +4762,15 @@ where each line of input produces a line of output.}
4020 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi 4762 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
4021 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} 4763 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
4022 4764
4023% Each @chapter defines this as the name of the chapter. 4765% Each @chapter defines these (using marks) as the number+name, number
4024% page headings and footings can use it. @section does likewise. 4766% and name of the chapter. Page headings and footings can use
4025% However, they are not reliable, because we don't use marks. 4767% these. @section does likewise.
4026\def\thischapter{} 4768\def\thischapter{}
4769\def\thischapternum{}
4770\def\thischaptername{}
4027\def\thissection{} 4771\def\thissection{}
4772\def\thissectionnum{}
4773\def\thissectionname{}
4028 4774
4029\newcount\absseclevel % used to calculate proper heading level 4775\newcount\absseclevel % used to calculate proper heading level
4030\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count 4776\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
@@ -4325,7 +5071,20 @@ where each line of input produces a line of output.}
4325 5071
4326\def\chapbreak{\dobreak \chapheadingskip {-4000}} 5072\def\chapbreak{\dobreak \chapheadingskip {-4000}}
4327\def\chappager{\par\vfill\supereject} 5073\def\chappager{\par\vfill\supereject}
4328\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} 5074% Because \domark is called before \chapoddpage, the filler page will
5075% get the headings for the next chapter, which is wrong. But we don't
5076% care -- we just disable all headings on the filler page.
5077\def\chapoddpage{%
5078 \chappager
5079 \ifodd\pageno \else
5080 \begingroup
5081 \evenheadline={\hfil}\evenfootline={\hfil}%
5082 \oddheadline={\hfil}\oddfootline={\hfil}%
5083 \hbox to 0pt{}%
5084 \chappager
5085 \endgroup
5086 \fi
5087}
4329 5088
4330\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} 5089\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
4331 5090
@@ -4359,41 +5118,72 @@ where each line of input produces a line of output.}
4359\def\Yappendixkeyword{Yappendix} 5118\def\Yappendixkeyword{Yappendix}
4360% 5119%
4361\def\chapmacro#1#2#3{% 5120\def\chapmacro#1#2#3{%
5121 % Insert the first mark before the heading break (see notes for \domark).
5122 \let\prevchapterdefs=\lastchapterdefs
5123 \let\prevsectiondefs=\lastsectiondefs
5124 \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
5125 \gdef\thissection{}}%
5126 %
5127 \def\temptype{#2}%
5128 \ifx\temptype\Ynothingkeyword
5129 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
5130 \gdef\thischapter{\thischaptername}}%
5131 \else\ifx\temptype\Yomitfromtockeyword
5132 \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
5133 \gdef\thischapter{}}%
5134 \else\ifx\temptype\Yappendixkeyword
5135 \toks0={#1}%
5136 \xdef\lastchapterdefs{%
5137 \gdef\noexpand\thischaptername{\the\toks0}%
5138 \gdef\noexpand\thischapternum{\appendixletter}%
5139 \gdef\noexpand\thischapter{\putwordAppendix{} \noexpand\thischapternum:
5140 \noexpand\thischaptername}%
5141 }%
5142 \else
5143 \toks0={#1}%
5144 \xdef\lastchapterdefs{%
5145 \gdef\noexpand\thischaptername{\the\toks0}%
5146 \gdef\noexpand\thischapternum{\the\chapno}%
5147 \gdef\noexpand\thischapter{\putwordChapter{} \noexpand\thischapternum:
5148 \noexpand\thischaptername}%
5149 }%
5150 \fi\fi\fi
5151 %
5152 % Output the mark. Pass it through \safewhatsit, to take care of
5153 % the preceding space.
5154 \safewhatsit\domark
5155 %
5156 % Insert the chapter heading break.
4362 \pchapsepmacro 5157 \pchapsepmacro
5158 %
5159 % Now the second mark, after the heading break. No break points
5160 % between here and the heading.
5161 \let\prevchapterdefs=\lastchapterdefs
5162 \let\prevsectiondefs=\lastsectiondefs
5163 \domark
5164 %
4363 {% 5165 {%
4364 \chapfonts \rm 5166 \chapfonts \rm
4365 % 5167 %
4366 % Have to define \thissection before calling \donoderef, because the 5168 % Have to define \lastsection before calling \donoderef, because the
4367 % xref code eventually uses it. On the other hand, it has to be called 5169 % xref code eventually uses it. On the other hand, it has to be called
4368 % after \pchapsepmacro, or the headline will change too soon. 5170 % after \pchapsepmacro, or the headline will change too soon.
4369 \gdef\thissection{#1}% 5171 \gdef\lastsection{#1}%
4370 \gdef\thischaptername{#1}%
4371 % 5172 %
4372 % Only insert the separating space if we have a chapter/appendix 5173 % Only insert the separating space if we have a chapter/appendix
4373 % number, and don't print the unnumbered ``number''. 5174 % number, and don't print the unnumbered ``number''.
4374 \def\temptype{#2}%
4375 \ifx\temptype\Ynothingkeyword 5175 \ifx\temptype\Ynothingkeyword
4376 \setbox0 = \hbox{}% 5176 \setbox0 = \hbox{}%
4377 \def\toctype{unnchap}% 5177 \def\toctype{unnchap}%
4378 \gdef\thischapter{#1}%
4379 \else\ifx\temptype\Yomitfromtockeyword 5178 \else\ifx\temptype\Yomitfromtockeyword
4380 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry 5179 \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
4381 \def\toctype{omit}% 5180 \def\toctype{omit}%
4382 \gdef\thischapter{}%
4383 \else\ifx\temptype\Yappendixkeyword 5181 \else\ifx\temptype\Yappendixkeyword
4384 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% 5182 \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
4385 \def\toctype{app}% 5183 \def\toctype{app}%
4386 % We don't substitute the actual chapter name into \thischapter
4387 % because we don't want its macros evaluated now. And we don't
4388 % use \thissection because that changes with each section.
4389 %
4390 \xdef\thischapter{\putwordAppendix{} \appendixletter:
4391 \noexpand\thischaptername}%
4392 \else 5184 \else
4393 \setbox0 = \hbox{#3\enspace}% 5185 \setbox0 = \hbox{#3\enspace}%
4394 \def\toctype{numchap}% 5186 \def\toctype{numchap}%
4395 \xdef\thischapter{\putwordChapter{} \the\chapno:
4396 \noexpand\thischaptername}%
4397 \fi\fi\fi 5187 \fi\fi\fi
4398 % 5188 %
4399 % Write the toc entry for this chapter. Must come before the 5189 % Write the toc entry for this chapter. Must come before the
@@ -4409,6 +5199,7 @@ where each line of input produces a line of output.}
4409 \donoderef{#2}% 5199 \donoderef{#2}%
4410 % 5200 %
4411 % Typeset the actual heading. 5201 % Typeset the actual heading.
5202 \nobreak % Avoid page breaks at the interline glue.
4412 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright 5203 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
4413 \hangindent=\wd0 \centerparametersmaybe 5204 \hangindent=\wd0 \centerparametersmaybe
4414 \unhbox0 #1\par}% 5205 \unhbox0 #1\par}%
@@ -4471,45 +5262,95 @@ where each line of input produces a line of output.}
4471% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the 5262% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the
4472% section number. 5263% section number.
4473% 5264%
5265\def\seckeyword{sec}
5266%
4474\def\sectionheading#1#2#3#4{% 5267\def\sectionheading#1#2#3#4{%
4475 {% 5268 {%
4476 % Switch to the right set of fonts. 5269 % Switch to the right set of fonts.
4477 \csname #2fonts\endcsname \rm 5270 \csname #2fonts\endcsname \rm
4478 % 5271 %
5272 \def\sectionlevel{#2}%
5273 \def\temptype{#3}%
5274 %
5275 % Insert first mark before the heading break (see notes for \domark).
5276 \let\prevsectiondefs=\lastsectiondefs
5277 \ifx\temptype\Ynothingkeyword
5278 \ifx\sectionlevel\seckeyword
5279 \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
5280 \gdef\thissection{\thissectionname}}%
5281 \fi
5282 \else\ifx\temptype\Yomitfromtockeyword
5283 % Don't redefine \thissection.
5284 \else\ifx\temptype\Yappendixkeyword
5285 \ifx\sectionlevel\seckeyword
5286 \toks0={#1}%
5287 \xdef\lastsectiondefs{%
5288 \gdef\noexpand\thissectionname{\the\toks0}%
5289 \gdef\noexpand\thissectionnum{#4}%
5290 \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum:
5291 \noexpand\thissectionname}%
5292 }%
5293 \fi
5294 \else
5295 \ifx\sectionlevel\seckeyword
5296 \toks0={#1}%
5297 \xdef\lastsectiondefs{%
5298 \gdef\noexpand\thissectionname{\the\toks0}%
5299 \gdef\noexpand\thissectionnum{#4}%
5300 \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum:
5301 \noexpand\thissectionname}%
5302 }%
5303 \fi
5304 \fi\fi\fi
5305 %
5306 % Output the mark. Pass it through \safewhatsit, to take care of
5307 % the preceding space.
5308 \safewhatsit\domark
5309 %
4479 % Insert space above the heading. 5310 % Insert space above the heading.
4480 \csname #2headingbreak\endcsname 5311 \csname #2headingbreak\endcsname
4481 % 5312 %
4482 % Only insert the space after the number if we have a section number. 5313 % Now the second mark, after the heading break. No break points
4483 \def\sectionlevel{#2}% 5314 % between here and the heading.
4484 \def\temptype{#3}% 5315 \let\prevsectiondefs=\lastsectiondefs
5316 \domark
4485 % 5317 %
5318 % Only insert the space after the number if we have a section number.
4486 \ifx\temptype\Ynothingkeyword 5319 \ifx\temptype\Ynothingkeyword
4487 \setbox0 = \hbox{}% 5320 \setbox0 = \hbox{}%
4488 \def\toctype{unn}% 5321 \def\toctype{unn}%
4489 \gdef\thissection{#1}% 5322 \gdef\lastsection{#1}%
4490 \else\ifx\temptype\Yomitfromtockeyword 5323 \else\ifx\temptype\Yomitfromtockeyword
4491 % for @headings -- no section number, don't include in toc, 5324 % for @headings -- no section number, don't include in toc,
4492 % and don't redefine \thissection. 5325 % and don't redefine \lastsection.
4493 \setbox0 = \hbox{}% 5326 \setbox0 = \hbox{}%
4494 \def\toctype{omit}% 5327 \def\toctype{omit}%
4495 \let\sectionlevel=\empty 5328 \let\sectionlevel=\empty
4496 \else\ifx\temptype\Yappendixkeyword 5329 \else\ifx\temptype\Yappendixkeyword
4497 \setbox0 = \hbox{#4\enspace}% 5330 \setbox0 = \hbox{#4\enspace}%
4498 \def\toctype{app}% 5331 \def\toctype{app}%
4499 \gdef\thissection{#1}% 5332 \gdef\lastsection{#1}%
4500 \else 5333 \else
4501 \setbox0 = \hbox{#4\enspace}% 5334 \setbox0 = \hbox{#4\enspace}%
4502 \def\toctype{num}% 5335 \def\toctype{num}%
4503 \gdef\thissection{#1}% 5336 \gdef\lastsection{#1}%
4504 \fi\fi\fi 5337 \fi\fi\fi
4505 % 5338 %
4506 % Write the toc entry (before \donoderef). See comments in \chfplain. 5339 % Write the toc entry (before \donoderef). See comments in \chapmacro.
4507 \writetocentry{\toctype\sectionlevel}{#1}{#4}% 5340 \writetocentry{\toctype\sectionlevel}{#1}{#4}%
4508 % 5341 %
4509 % Write the node reference (= pdf destination for pdftex). 5342 % Write the node reference (= pdf destination for pdftex).
4510 % Again, see comments in \chfplain. 5343 % Again, see comments in \chapmacro.
4511 \donoderef{#3}% 5344 \donoderef{#3}%
4512 % 5345 %
5346 % Interline glue will be inserted when the vbox is completed.
5347 % That glue will be a valid breakpoint for the page, since it'll be
5348 % preceded by a whatsit (usually from the \donoderef, or from the
5349 % \writetocentry if there was no node). We don't want to allow that
5350 % break, since then the whatsits could end up on page n while the
5351 % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
5352 \nobreak
5353 %
4513 % Output the actual section heading. 5354 % Output the actual section heading.
4514 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright 5355 \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
4515 \hangindent=\wd0 % zero if no section number 5356 \hangindent=\wd0 % zero if no section number
@@ -4572,7 +5413,7 @@ where each line of input produces a line of output.}
4572 \edef\temp{% 5413 \edef\temp{%
4573 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% 5414 \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
4574 \temp 5415 \temp
4575 } 5416 }%
4576 \fi 5417 \fi
4577 \fi 5418 \fi
4578 % 5419 %
@@ -4607,7 +5448,7 @@ where each line of input produces a line of output.}
4607\def\readtocfile{% 5448\def\readtocfile{%
4608 \setupdatafile 5449 \setupdatafile
4609 \activecatcodes 5450 \activecatcodes
4610 \input \jobname.toc 5451 \input \tocreadfilename
4611} 5452}
4612 5453
4613\newskip\contentsrightmargin \contentsrightmargin=1in 5454\newskip\contentsrightmargin \contentsrightmargin=1in
@@ -4626,7 +5467,6 @@ where each line of input produces a line of output.}
4626 % 5467 %
4627 % Don't need to put `Contents' or `Short Contents' in the headline. 5468 % Don't need to put `Contents' or `Short Contents' in the headline.
4628 % It is abundantly clear what they are. 5469 % It is abundantly clear what they are.
4629 \def\thischapter{}%
4630 \chapmacro{#1}{Yomitfromtoc}{}% 5470 \chapmacro{#1}{Yomitfromtoc}{}%
4631 % 5471 %
4632 \savepageno = \pageno 5472 \savepageno = \pageno
@@ -4638,11 +5478,16 @@ where each line of input produces a line of output.}
4638 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi 5478 \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
4639} 5479}
4640 5480
5481% redefined for the two-volume lispref. We always output on
5482% \jobname.toc even if this is redefined.
5483%
5484\def\tocreadfilename{\jobname.toc}
4641 5485
4642% Normal (long) toc. 5486% Normal (long) toc.
5487%
4643\def\contents{% 5488\def\contents{%
4644 \startcontents{\putwordTOC}% 5489 \startcontents{\putwordTOC}%
4645 \openin 1 \jobname.toc 5490 \openin 1 \tocreadfilename\space
4646 \ifeof 1 \else 5491 \ifeof 1 \else
4647 \readtocfile 5492 \readtocfile
4648 \fi 5493 \fi
@@ -4680,7 +5525,7 @@ where each line of input produces a line of output.}
4680 \let\numsubsubsecentry = \numsecentry 5525 \let\numsubsubsecentry = \numsecentry
4681 \let\appsubsubsecentry = \numsecentry 5526 \let\appsubsubsecentry = \numsecentry
4682 \let\unnsubsubsecentry = \numsecentry 5527 \let\unnsubsubsecentry = \numsecentry
4683 \openin 1 \jobname.toc 5528 \openin 1 \tocreadfilename\space
4684 \ifeof 1 \else 5529 \ifeof 1 \else
4685 \readtocfile 5530 \readtocfile
4686 \fi 5531 \fi
@@ -4824,7 +5669,7 @@ where each line of input produces a line of output.}
4824{\tentt \global\dimen0 = 3em}% Width of the box. 5669{\tentt \global\dimen0 = 3em}% Width of the box.
4825\dimen2 = .55pt % Thickness of rules 5670\dimen2 = .55pt % Thickness of rules
4826% The text. (`r' is open on the right, `e' somewhat less so on the left.) 5671% The text. (`r' is open on the right, `e' somewhat less so on the left.)
4827\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} 5672\setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt}
4828% 5673%
4829\setbox\errorbox=\hbox to \dimen0{\hfil 5674\setbox\errorbox=\hbox to \dimen0{\hfil
4830 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. 5675 \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
@@ -5015,12 +5860,18 @@ where each line of input produces a line of output.}
5015\let\SETdispenvsize\relax 5860\let\SETdispenvsize\relax
5016\def\setnormaldispenv{% 5861\def\setnormaldispenv{%
5017 \ifx\SETdispenvsize\smallword 5862 \ifx\SETdispenvsize\smallword
5863 % end paragraph for sake of leading, in case document has no blank
5864 % line. This is redundant with what happens in \aboveenvbreak, but
5865 % we need to do it before changing the fonts, and it's inconvenient
5866 % to change the fonts afterward.
5867 \ifnum \lastpenalty=10000 \else \endgraf \fi
5018 \smallexamplefonts \rm 5868 \smallexamplefonts \rm
5019 \fi 5869 \fi
5020} 5870}
5021\def\setsmalldispenv{% 5871\def\setsmalldispenv{%
5022 \ifx\SETdispenvsize\nosmallword 5872 \ifx\SETdispenvsize\nosmallword
5023 \else 5873 \else
5874 \ifnum \lastpenalty=10000 \else \endgraf \fi
5024 \smallexamplefonts \rm 5875 \smallexamplefonts \rm
5025 \fi 5876 \fi
5026} 5877}
@@ -5047,11 +5898,10 @@ where each line of input produces a line of output.}
5047% 5898%
5048\maketwodispenvs {lisp}{example}{% 5899\maketwodispenvs {lisp}{example}{%
5049 \nonfillstart 5900 \nonfillstart
5050 \tt 5901 \tt\quoteexpand
5051 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. 5902 \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
5052 \gobble % eat return 5903 \gobble % eat return
5053} 5904}
5054
5055% @display/@smalldisplay: same as @lisp except keep current font. 5905% @display/@smalldisplay: same as @lisp except keep current font.
5056% 5906%
5057\makedispenv {display}{% 5907\makedispenv {display}{%
@@ -5179,6 +6029,34 @@ where each line of input produces a line of output.}
5179\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount 6029\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
5180% 6030%
5181\def\starttabbox{\setbox0=\hbox\bgroup} 6031\def\starttabbox{\setbox0=\hbox\bgroup}
6032
6033% Allow an option to not replace quotes with a regular directed right
6034% quote/apostrophe (char 0x27), but instead use the undirected quote
6035% from cmtt (char 0x0d). The undirected quote is ugly, so don't make it
6036% the default, but it works for pasting with more pdf viewers (at least
6037% evince), the lilypond developers report. xpdf does work with the
6038% regular 0x27.
6039%
6040\def\codequoteright{%
6041 \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
6042 \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
6043 '%
6044 \else \char'15 \fi
6045 \else \char'15 \fi
6046}
6047%
6048% and a similar option for the left quote char vs. a grave accent.
6049% Modern fonts display ASCII 0x60 as a grave accent, so some people like
6050% the code environments to do likewise.
6051%
6052\def\codequoteleft{%
6053 \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
6054 \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
6055 `%
6056 \else \char'22 \fi
6057 \else \char'22 \fi
6058}
6059%
5182\begingroup 6060\begingroup
5183 \catcode`\^^I=\active 6061 \catcode`\^^I=\active
5184 \gdef\tabexpand{% 6062 \gdef\tabexpand{%
@@ -5191,7 +6069,16 @@ where each line of input produces a line of output.}
5191 \wd0=\dimen0 \box0 \starttabbox 6069 \wd0=\dimen0 \box0 \starttabbox
5192 }% 6070 }%
5193 } 6071 }
6072 \catcode`\'=\active
6073 \gdef\rquoteexpand{\catcode\rquoteChar=\active \def'{\codequoteright}}%
6074 %
6075 \catcode`\`=\active
6076 \gdef\lquoteexpand{\catcode\lquoteChar=\active \def`{\codequoteleft}}%
6077 %
6078 \gdef\quoteexpand{\rquoteexpand \lquoteexpand}%
5194\endgroup 6079\endgroup
6080
6081% start the verbatim environment.
5195\def\setupverbatim{% 6082\def\setupverbatim{%
5196 \let\nonarrowing = t% 6083 \let\nonarrowing = t%
5197 \nonfillstart 6084 \nonfillstart
@@ -5200,6 +6087,7 @@ where each line of input produces a line of output.}
5200 \def\par{\leavevmode\egroup\box0\endgraf}% 6087 \def\par{\leavevmode\egroup\box0\endgraf}%
5201 \catcode`\`=\active 6088 \catcode`\`=\active
5202 \tabexpand 6089 \tabexpand
6090 \quoteexpand
5203 % Respect line breaks, 6091 % Respect line breaks,
5204 % print special symbols as themselves, and 6092 % print special symbols as themselves, and
5205 % make each space count 6093 % make each space count
@@ -5284,27 +6172,35 @@ where each line of input produces a line of output.}
5284 \endgroup 6172 \endgroup
5285} 6173}
5286 6174
6175
5287\message{defuns,} 6176\message{defuns,}
5288% @defun etc. 6177% @defun etc.
5289 6178
5290\newskip\defbodyindent \defbodyindent=.4in 6179\newskip\defbodyindent \defbodyindent=.4in
5291\newskip\defargsindent \defargsindent=50pt 6180\newskip\defargsindent \defargsindent=50pt
5292\newskip\deflastargmargin \deflastargmargin=18pt 6181\newskip\deflastargmargin \deflastargmargin=18pt
6182\newcount\defunpenalty
5293 6183
5294% Start the processing of @deffn: 6184% Start the processing of @deffn:
5295\def\startdefun{% 6185\def\startdefun{%
5296 \ifnum\lastpenalty<10000 6186 \ifnum\lastpenalty<10000
5297 \medbreak 6187 \medbreak
6188 \defunpenalty=10003 % Will keep this @deffn together with the
6189 % following @def command, see below.
5298 \else 6190 \else
5299 % If there are two @def commands in a row, we'll have a \nobreak, 6191 % If there are two @def commands in a row, we'll have a \nobreak,
5300 % which is there to keep the function description together with its 6192 % which is there to keep the function description together with its
5301 % header. But if there's nothing but headers, we need to allow a 6193 % header. But if there's nothing but headers, we need to allow a
5302 % break somewhere. Check specifically for penalty 10002, inserted 6194 % break somewhere. Check specifically for penalty 10002, inserted
5303 % by \defargscommonending, instead of 10000, since the sectioning 6195 % by \printdefunline, instead of 10000, since the sectioning
5304 % commands also insert a nobreak penalty, and we don't want to allow 6196 % commands also insert a nobreak penalty, and we don't want to allow
5305 % a break between a section heading and a defun. 6197 % a break between a section heading and a defun.
5306 % 6198 %
5307 \ifnum\lastpenalty=10002 \penalty2000 \fi 6199 % As a minor refinement, we avoid "club" headers by signalling
6200 % with penalty of 10003 after the very first @deffn in the
6201 % sequence (see above), and penalty of 10002 after any following
6202 % @def command.
6203 \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
5308 % 6204 %
5309 % Similarly, after a section heading, do not allow a break. 6205 % Similarly, after a section heading, do not allow a break.
5310 % But do insert the glue. 6206 % But do insert the glue.
@@ -5322,7 +6218,7 @@ where each line of input produces a line of output.}
5322 % 6218 %
5323 % As above, allow line break if we have multiple x headers in a row. 6219 % As above, allow line break if we have multiple x headers in a row.
5324 % It's not a great place, though. 6220 % It's not a great place, though.
5325 \ifnum\lastpenalty=10002 \penalty3000 \fi 6221 \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
5326 % 6222 %
5327 % And now, it's time to reuse the body of the original defun: 6223 % And now, it's time to reuse the body of the original defun:
5328 \expandafter\gobbledefun#1% 6224 \expandafter\gobbledefun#1%
@@ -5340,7 +6236,7 @@ where each line of input produces a line of output.}
5340 \advance\rightskip by 0pt plus 1fil 6236 \advance\rightskip by 0pt plus 1fil
5341 \endgraf 6237 \endgraf
5342 \nobreak\vskip -\parskip 6238 \nobreak\vskip -\parskip
5343 \penalty 10002 % signal to \startdefun and \dodefunx 6239 \penalty\defunpenalty % signal to \startdefun and \dodefunx
5344 % Some of the @defun-type tags do not enable magic parentheses, 6240 % Some of the @defun-type tags do not enable magic parentheses,
5345 % rendering the following check redundant. But we don't optimize. 6241 % rendering the following check redundant. But we don't optimize.
5346 \checkparencounts 6242 \checkparencounts
@@ -5609,12 +6505,14 @@ where each line of input produces a line of output.}
5609 \ifnum\parencount=0 \else \badparencount \fi 6505 \ifnum\parencount=0 \else \badparencount \fi
5610 \ifnum\brackcount=0 \else \badbrackcount \fi 6506 \ifnum\brackcount=0 \else \badbrackcount \fi
5611} 6507}
6508% these should not use \errmessage; the glibc manual, at least, actually
6509% has such constructs (when documenting function pointers).
5612\def\badparencount{% 6510\def\badparencount{%
5613 \errmessage{Unbalanced parentheses in @def}% 6511 \message{Warning: unbalanced parentheses in @def...}%
5614 \global\parencount=0 6512 \global\parencount=0
5615} 6513}
5616\def\badbrackcount{% 6514\def\badbrackcount{%
5617 \errmessage{Unbalanced square braces in @def}% 6515 \message{Warning: unbalanced square brackets in @def...}%
5618 \global\brackcount=0 6516 \global\brackcount=0
5619} 6517}
5620 6518
@@ -5649,7 +6547,6 @@ where each line of input produces a line of output.}
5649 \spaceisspace 6547 \spaceisspace
5650 % 6548 %
5651 % Append \endinput to make sure that TeX does not see the ending newline. 6549 % Append \endinput to make sure that TeX does not see the ending newline.
5652 %
5653 % I've verified that it is necessary both for e-TeX and for ordinary TeX 6550 % I've verified that it is necessary both for e-TeX and for ordinary TeX
5654 % --kasal, 29nov03 6551 % --kasal, 29nov03
5655 \scantokens{#1\endinput}% 6552 \scantokens{#1\endinput}%
@@ -5710,6 +6607,10 @@ where each line of input produces a line of output.}
5710% all characters are catcode 10, 11 or 12, except \ which is active 6607% all characters are catcode 10, 11 or 12, except \ which is active
5711% (as in normal texinfo). It is necessary to change the definition of \. 6608% (as in normal texinfo). It is necessary to change the definition of \.
5712 6609
6610% Non-ASCII encodings make 8-bit characters active, so un-activate
6611% them to avoid their expansion. Must do this non-globally, to
6612% confine the change to the current group.
6613
5713% It's necessary to have hard CRs when the macro is executed. This is 6614% It's necessary to have hard CRs when the macro is executed. This is
5714% done by making ^^M (\endlinechar) catcode 12 when reading the macro 6615% done by making ^^M (\endlinechar) catcode 12 when reading the macro
5715% body, and then making it the \newlinechar in \scanmacro. 6616% body, and then making it the \newlinechar in \scanmacro.
@@ -5724,6 +6625,7 @@ where each line of input produces a line of output.}
5724 \catcode`\_=\other 6625 \catcode`\_=\other
5725 \catcode`\|=\other 6626 \catcode`\|=\other
5726 \catcode`\~=\other 6627 \catcode`\~=\other
6628 \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
5727} 6629}
5728 6630
5729\def\scanargctxt{% 6631\def\scanargctxt{%
@@ -5916,11 +6818,11 @@ where each line of input produces a line of output.}
5916% {. If so it reads up to the closing }, if not, it reads the whole 6818% {. If so it reads up to the closing }, if not, it reads the whole
5917% line. Whatever was read is then fed to the next control sequence 6819% line. Whatever was read is then fed to the next control sequence
5918% as an argument (by \parsebrace or \parsearg) 6820% as an argument (by \parsebrace or \parsearg)
5919\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} 6821\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
5920\def\braceorlinexxx{% 6822\def\braceorlinexxx{%
5921 \ifx\nchar\bgroup\else 6823 \ifx\nchar\bgroup\else
5922 \expandafter\parsearg 6824 \expandafter\parsearg
5923 \fi \next} 6825 \fi \macnamexxx}
5924 6826
5925 6827
5926% @alias. 6828% @alias.
@@ -5941,7 +6843,6 @@ where each line of input produces a line of output.}
5941\message{cross references,} 6843\message{cross references,}
5942 6844
5943\newwrite\auxfile 6845\newwrite\auxfile
5944
5945\newif\ifhavexrefs % True if xref values are known. 6846\newif\ifhavexrefs % True if xref values are known.
5946\newif\ifwarnedxrefs % True if we warned once that they aren't known. 6847\newif\ifwarnedxrefs % True if we warned once that they aren't known.
5947 6848
@@ -5986,7 +6887,7 @@ where each line of input produces a line of output.}
5986 6887
5987% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an 6888% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
5988% anchor), which consists of three parts: 6889% anchor), which consists of three parts:
5989% 1) NAME-title - the current sectioning name taken from \thissection, 6890% 1) NAME-title - the current sectioning name taken from \lastsection,
5990% or the anchor name. 6891% or the anchor name.
5991% 2) NAME-snt - section number and type, passed as the SNT arg, or 6892% 2) NAME-snt - section number and type, passed as the SNT arg, or
5992% empty for anchors. 6893% empty for anchors.
@@ -6005,10 +6906,10 @@ where each line of input produces a line of output.}
6005 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef 6906 \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
6006 ##1}{##2}}% these are parameters of \writexrdef 6907 ##1}{##2}}% these are parameters of \writexrdef
6007 }% 6908 }%
6008 \toks0 = \expandafter{\thissection}% 6909 \toks0 = \expandafter{\lastsection}%
6009 \immediate \writexrdef{title}{\the\toks0 }% 6910 \immediate \writexrdef{title}{\the\toks0 }%
6010 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. 6911 \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
6011 \writexrdef{pg}{\folio}% will be written later, during \shipout 6912 \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, during \shipout
6012 }% 6913 }%
6013 \fi 6914 \fi
6014} 6915}
@@ -6054,7 +6955,8 @@ where each line of input produces a line of output.}
6054 \ifpdf 6955 \ifpdf
6055 \leavevmode 6956 \leavevmode
6056 \getfilename{#4}% 6957 \getfilename{#4}%
6057 {\turnoffactive 6958 {\indexnofonts
6959 \turnoffactive
6058 % See comments at \activebackslashdouble. 6960 % See comments at \activebackslashdouble.
6059 {\activebackslashdouble \xdef\pdfxrefdest{#1}% 6961 {\activebackslashdouble \xdef\pdfxrefdest{#1}%
6060 \backslashparens\pdfxrefdest}% 6962 \backslashparens\pdfxrefdest}%
@@ -6067,7 +6969,7 @@ where each line of input produces a line of output.}
6067 goto name{\pdfmkpgn{\pdfxrefdest}}% 6969 goto name{\pdfmkpgn{\pdfxrefdest}}%
6068 \fi 6970 \fi
6069 }% 6971 }%
6070 \linkcolor 6972 \setcolor{\linkcolor}%
6071 \fi 6973 \fi
6072 % 6974 %
6073 % Float references are printed completely differently: "Figure 1.2" 6975 % Float references are printed completely differently: "Figure 1.2"
@@ -6085,7 +6987,7 @@ where each line of input produces a line of output.}
6085 % If the user specified the print name (third arg) to the ref, 6987 % If the user specified the print name (third arg) to the ref,
6086 % print it instead of our usual "Figure 1.2". 6988 % print it instead of our usual "Figure 1.2".
6087 \ifdim\wd0 = 0pt 6989 \ifdim\wd0 = 0pt
6088 \refx{#1-snt}% 6990 \refx{#1-snt}{}%
6089 \else 6991 \else
6090 \printedrefname 6992 \printedrefname
6091 \fi 6993 \fi
@@ -6105,7 +7007,7 @@ where each line of input produces a line of output.}
6105 % is a loss. Therefore, we give the text of the node name again, so it 7007 % is a loss. Therefore, we give the text of the node name again, so it
6106 % is as if TeX is seeing it for the first time. 7008 % is as if TeX is seeing it for the first time.
6107 \ifdim \wd1 > 0pt 7009 \ifdim \wd1 > 0pt
6108 \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% 7010 \putwordSection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}%
6109 \else 7011 \else
6110 % _ (for example) has to be the character _ for the purposes of the 7012 % _ (for example) has to be the character _ for the purposes of the
6111 % control sequence corresponding to the node, but it has to expand 7013 % control sequence corresponding to the node, but it has to expand
@@ -6201,10 +7103,18 @@ where each line of input produces a line of output.}
6201% collisions). But if this is a float type, we have more work to do. 7103% collisions). But if this is a float type, we have more work to do.
6202% 7104%
6203\def\xrdef#1#2{% 7105\def\xrdef#1#2{%
6204 \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. 7106 {% The node name might contain 8-bit characters, which in our current
7107 % implementation are changed to commands like @'e. Don't let these
7108 % mess up the control sequence name.
7109 \indexnofonts
7110 \turnoffactive
7111 \xdef\safexrefname{#1}%
7112 }%
7113 %
7114 \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
6205 % 7115 %
6206 % Was that xref control sequence that we just defined for a float? 7116 % Was that xref control sequence that we just defined for a float?
6207 \expandafter\iffloat\csname XR#1\endcsname 7117 \expandafter\iffloat\csname XR\safexrefname\endcsname
6208 % it was a float, and we have the (safe) float type in \iffloattype. 7118 % it was a float, and we have the (safe) float type in \iffloattype.
6209 \expandafter\let\expandafter\floatlist 7119 \expandafter\let\expandafter\floatlist
6210 \csname floatlist\iffloattype\endcsname 7120 \csname floatlist\iffloattype\endcsname
@@ -6219,7 +7129,8 @@ where each line of input produces a line of output.}
6219 % 7129 %
6220 % Remember this xref in the control sequence \floatlistFLOATTYPE, 7130 % Remember this xref in the control sequence \floatlistFLOATTYPE,
6221 % for later use in \listoffloats. 7131 % for later use in \listoffloats.
6222 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% 7132 \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
7133 {\safexrefname}}%
6223 \fi 7134 \fi
6224} 7135}
6225 7136
@@ -6323,6 +7234,7 @@ where each line of input produces a line of output.}
6323 \input\jobname.#1 7234 \input\jobname.#1
6324\endgroup} 7235\endgroup}
6325 7236
7237
6326\message{insertions,} 7238\message{insertions,}
6327% including footnotes. 7239% including footnotes.
6328 7240
@@ -6515,7 +7427,7 @@ where each line of input produces a line of output.}
6515 % above and below. 7427 % above and below.
6516 \nobreak\vskip\parskip 7428 \nobreak\vskip\parskip
6517 \nobreak 7429 \nobreak
6518 \line\bgroup\hss 7430 \line\bgroup
6519 \fi 7431 \fi
6520 % 7432 %
6521 % Output the image. 7433 % Output the image.
@@ -6528,7 +7440,7 @@ where each line of input produces a line of output.}
6528 \epsfbox{#1.eps}% 7440 \epsfbox{#1.eps}%
6529 \fi 7441 \fi
6530 % 7442 %
6531 \ifimagevmode \hss \egroup \bigbreak \fi % space after the image 7443 \ifimagevmode \egroup \bigbreak \fi % space after the image
6532\endgroup} 7444\endgroup}
6533 7445
6534 7446
@@ -6595,13 +7507,13 @@ where each line of input produces a line of output.}
6595 \global\advance\floatno by 1 7507 \global\advance\floatno by 1
6596 % 7508 %
6597 {% 7509 {%
6598 % This magic value for \thissection is output by \setref as the 7510 % This magic value for \lastsection is output by \setref as the
6599 % XREFLABEL-title value. \xrefX uses it to distinguish float 7511 % XREFLABEL-title value. \xrefX uses it to distinguish float
6600 % labels (which have a completely different output format) from 7512 % labels (which have a completely different output format) from
6601 % node and anchor labels. And \xrdef uses it to construct the 7513 % node and anchor labels. And \xrdef uses it to construct the
6602 % lists of floats. 7514 % lists of floats.
6603 % 7515 %
6604 \edef\thissection{\floatmagic=\safefloattype}% 7516 \edef\lastsection{\floatmagic=\safefloattype}%
6605 \setref{\floatlabel}{Yfloat}% 7517 \setref{\floatlabel}{Yfloat}%
6606 }% 7518 }%
6607 \fi 7519 \fi
@@ -6669,6 +7581,7 @@ where each line of input produces a line of output.}
6669 % caption if specified, else the full caption if specified, else nothing. 7581 % caption if specified, else the full caption if specified, else nothing.
6670 {% 7582 {%
6671 \atdummies 7583 \atdummies
7584 %
6672 % since we read the caption text in the macro world, where ^^M 7585 % since we read the caption text in the macro world, where ^^M
6673 % is turned into a normal character, we have to scan it back, so 7586 % is turned into a normal character, we have to scan it back, so
6674 % we don't write the literal three characters "^^M" into the aux file. 7587 % we don't write the literal three characters "^^M" into the aux file.
@@ -6689,8 +7602,9 @@ where each line of input produces a line of output.}
6689 % 7602 %
6690 % place the captured inserts 7603 % place the captured inserts
6691 % 7604 %
6692 % BEWARE: when the floats start float, we have to issue warning whenever an 7605 % BEWARE: when the floats start floating, we have to issue warning
6693 % insert appears inside a float which could possibly float. --kasal, 26may04 7606 % whenever an insert appears inside a float which could possibly
7607 % float. --kasal, 26may04
6694 % 7608 %
6695 \checkinserts 7609 \checkinserts
6696} 7610}
@@ -6734,7 +7648,7 @@ where each line of input produces a line of output.}
6734 7648
6735% #1 is the control sequence we are passed; we expand into a conditional 7649% #1 is the control sequence we are passed; we expand into a conditional
6736% which is true if #1 represents a float ref. That is, the magic 7650% which is true if #1 represents a float ref. That is, the magic
6737% \thissection value which we \setref above. 7651% \lastsection value which we \setref above.
6738% 7652%
6739\def\iffloat#1{\expandafter\doiffloat#1==\finish} 7653\def\iffloat#1{\expandafter\doiffloat#1==\finish}
6740% 7654%
@@ -6795,39 +7709,871 @@ where each line of input produces a line of output.}
6795 \writeentry 7709 \writeentry
6796}} 7710}}
6797 7711
7712
6798\message{localization,} 7713\message{localization,}
6799% and i18n.
6800 7714
6801% @documentlanguage is usually given very early, just after 7715% @documentlanguage is usually given very early, just after
6802% @setfilename. If done too late, it may not override everything 7716% @setfilename. If done too late, it may not override everything
6803% properly. Single argument is the language abbreviation. 7717% properly. Single argument is the language (de) or locale (de_DE)
6804% It would be nice if we could set up a hyphenation file here. 7718% abbreviation. It would be nice if we could set up a hyphenation file.
6805% 7719%
6806\parseargdef\documentlanguage{% 7720{
7721 \catcode`\_ = \active
7722 \globaldefs=1
7723\parseargdef\documentlanguage{\begingroup
7724 \let_=\normalunderscore % normal _ character for filenames
6807 \tex % read txi-??.tex file in plain TeX. 7725 \tex % read txi-??.tex file in plain TeX.
6808 % Read the file if it exists. 7726 % Read the file by the name they passed if it exists.
6809 \openin 1 txi-#1.tex 7727 \openin 1 txi-#1.tex
6810 \ifeof 1 7728 \ifeof 1
6811 \errhelp = \nolanghelp 7729 \documentlanguagetrywithoutunderscore{#1_\finish}%
6812 \errmessage{Cannot read language file txi-#1.tex}%
6813 \else 7730 \else
6814 \input txi-#1.tex 7731 \input txi-#1.tex
6815 \fi 7732 \fi
6816 \closein 1 7733 \closein 1
6817 \endgroup 7734 \endgroup
7735\endgroup}
7736}
7737%
7738% If they passed de_DE, and txi-de_DE.tex doesn't exist,
7739% try txi-de.tex.
7740%
7741\def\documentlanguagetrywithoutunderscore#1_#2\finish{%
7742 \openin 1 txi-#1.tex
7743 \ifeof 1
7744 \errhelp = \nolanghelp
7745 \errmessage{Cannot read language file txi-#1.tex}%
7746 \else
7747 \input txi-#1.tex
7748 \fi
7749 \closein 1
6818} 7750}
7751%
6819\newhelp\nolanghelp{The given language definition file cannot be found or 7752\newhelp\nolanghelp{The given language definition file cannot be found or
6820is empty. Maybe you need to install it? In the current directory 7753is empty. Maybe you need to install it? In the current directory
6821should work if nowhere else does.} 7754should work if nowhere else does.}
6822 7755
7756% Set the catcode of characters 128 through 255 to the specified number.
7757%
7758\def\setnonasciicharscatcode#1{%
7759 \count255=128
7760 \loop\ifnum\count255<256
7761 \global\catcode\count255=#1\relax
7762 \advance\count255 by 1
7763 \repeat
7764}
6823 7765
6824% @documentencoding should change something in TeX eventually, most 7766\def\setnonasciicharscatcodenonglobal#1{%
6825% likely, but for now just recognize it. 7767 \count255=128
6826\let\documentencoding = \comment 7768 \loop\ifnum\count255<256
7769 \catcode\count255=#1\relax
7770 \advance\count255 by 1
7771 \repeat
7772}
6827 7773
7774% @documentencoding sets the definition of non-ASCII characters
7775% according to the specified encoding.
7776%
7777\parseargdef\documentencoding{%
7778 % Encoding being declared for the document.
7779 \def\declaredencoding{\csname #1.enc\endcsname}%
7780 %
7781 % Supported encodings: names converted to tokens in order to be able
7782 % to compare them with \ifx.
7783 \def\ascii{\csname US-ASCII.enc\endcsname}%
7784 \def\latnine{\csname ISO-8859-15.enc\endcsname}%
7785 \def\latone{\csname ISO-8859-1.enc\endcsname}%
7786 \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
7787 \def\utfeight{\csname UTF-8.enc\endcsname}%
7788 %
7789 \ifx \declaredencoding \ascii
7790 \asciichardefs
7791 %
7792 \else \ifx \declaredencoding \lattwo
7793 \setnonasciicharscatcode\active
7794 \lattwochardefs
7795 %
7796 \else \ifx \declaredencoding \latone
7797 \setnonasciicharscatcode\active
7798 \latonechardefs
7799 %
7800 \else \ifx \declaredencoding \latnine
7801 \setnonasciicharscatcode\active
7802 \latninechardefs
7803 %
7804 \else \ifx \declaredencoding \utfeight
7805 \setnonasciicharscatcode\active
7806 \utfeightchardefs
7807 %
7808 \else
7809 \message{Unknown document encoding #1, ignoring.}%
7810 %
7811 \fi % utfeight
7812 \fi % latnine
7813 \fi % latone
7814 \fi % lattwo
7815 \fi % ascii
7816}
7817
7818% A message to be logged when using a character that isn't available
7819% the default font encoding (OT1).
7820%
7821\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
7822
7823% Take account of \c (plain) vs. \, (Texinfo) difference.
7824\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
7825
7826% First, make active non-ASCII characters in order for them to be
7827% correctly categorized when TeX reads the replacement text of
7828% macros containing the character definitions.
7829\setnonasciicharscatcode\active
7830%
7831% Latin1 (ISO-8859-1) character definitions.
7832\def\latonechardefs{%
7833 \gdef^^a0{~}
7834 \gdef^^a1{\exclamdown}
7835 \gdef^^a2{\missingcharmsg{CENT SIGN}}
7836 \gdef^^a3{{\pounds}}
7837 \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
7838 \gdef^^a5{\missingcharmsg{YEN SIGN}}
7839 \gdef^^a6{\missingcharmsg{BROKEN BAR}}
7840 \gdef^^a7{\S}
7841 \gdef^^a8{\"{}}
7842 \gdef^^a9{\copyright}
7843 \gdef^^aa{\ordf}
7844 \gdef^^ab{\missingcharmsg{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}}
7845 \gdef^^ac{$\lnot$}
7846 \gdef^^ad{\-}
7847 \gdef^^ae{\registeredsymbol}
7848 \gdef^^af{\={}}
7849 %
7850 \gdef^^b0{\textdegree}
7851 \gdef^^b1{$\pm$}
7852 \gdef^^b2{$^2$}
7853 \gdef^^b3{$^3$}
7854 \gdef^^b4{\'{}}
7855 \gdef^^b5{$\mu$}
7856 \gdef^^b6{\P}
7857 %
7858 \gdef^^b7{$^.$}
7859 \gdef^^b8{\cedilla\ }
7860 \gdef^^b9{$^1$}
7861 \gdef^^ba{\ordm}
7862 %
7863 \gdef^^bb{\missingcharmsg{RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK}}
7864 \gdef^^bc{$1\over4$}
7865 \gdef^^bd{$1\over2$}
7866 \gdef^^be{$3\over4$}
7867 \gdef^^bf{\questiondown}
7868 %
7869 \gdef^^c0{\`A}
7870 \gdef^^c1{\'A}
7871 \gdef^^c2{\^A}
7872 \gdef^^c3{\~A}
7873 \gdef^^c4{\"A}
7874 \gdef^^c5{\ringaccent A}
7875 \gdef^^c6{\AE}
7876 \gdef^^c7{\cedilla C}
7877 \gdef^^c8{\`E}
7878 \gdef^^c9{\'E}
7879 \gdef^^ca{\^E}
7880 \gdef^^cb{\"E}
7881 \gdef^^cc{\`I}
7882 \gdef^^cd{\'I}
7883 \gdef^^ce{\^I}
7884 \gdef^^cf{\"I}
7885 %
7886 \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER ETH}}
7887 \gdef^^d1{\~N}
7888 \gdef^^d2{\`O}
7889 \gdef^^d3{\'O}
7890 \gdef^^d4{\^O}
7891 \gdef^^d5{\~O}
7892 \gdef^^d6{\"O}
7893 \gdef^^d7{$\times$}
7894 \gdef^^d8{\O}
7895 \gdef^^d9{\`U}
7896 \gdef^^da{\'U}
7897 \gdef^^db{\^U}
7898 \gdef^^dc{\"U}
7899 \gdef^^dd{\'Y}
7900 \gdef^^de{\missingcharmsg{LATIN CAPITAL LETTER THORN}}
7901 \gdef^^df{\ss}
7902 %
7903 \gdef^^e0{\`a}
7904 \gdef^^e1{\'a}
7905 \gdef^^e2{\^a}
7906 \gdef^^e3{\~a}
7907 \gdef^^e4{\"a}
7908 \gdef^^e5{\ringaccent a}
7909 \gdef^^e6{\ae}
7910 \gdef^^e7{\cedilla c}
7911 \gdef^^e8{\`e}
7912 \gdef^^e9{\'e}
7913 \gdef^^ea{\^e}
7914 \gdef^^eb{\"e}
7915 \gdef^^ec{\`{\dotless i}}
7916 \gdef^^ed{\'{\dotless i}}
7917 \gdef^^ee{\^{\dotless i}}
7918 \gdef^^ef{\"{\dotless i}}
7919 %
7920 \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER ETH}}
7921 \gdef^^f1{\~n}
7922 \gdef^^f2{\`o}
7923 \gdef^^f3{\'o}
7924 \gdef^^f4{\^o}
7925 \gdef^^f5{\~o}
7926 \gdef^^f6{\"o}
7927 \gdef^^f7{$\div$}
7928 \gdef^^f8{\o}
7929 \gdef^^f9{\`u}
7930 \gdef^^fa{\'u}
7931 \gdef^^fb{\^u}
7932 \gdef^^fc{\"u}
7933 \gdef^^fd{\'y}
7934 \gdef^^fe{\missingcharmsg{LATIN SMALL LETTER THORN}}
7935 \gdef^^ff{\"y}
7936}
7937
7938% Latin9 (ISO-8859-15) encoding character definitions.
7939\def\latninechardefs{%
7940 % Encoding is almost identical to Latin1.
7941 \latonechardefs
7942 %
7943 \gdef^^a4{\euro}
7944 \gdef^^a6{\v S}
7945 \gdef^^a8{\v s}
7946 \gdef^^b4{\v Z}
7947 \gdef^^b8{\v z}
7948 \gdef^^bc{\OE}
7949 \gdef^^bd{\oe}
7950 \gdef^^be{\"Y}
7951}
7952
7953% Latin2 (ISO-8859-2) character definitions.
7954\def\lattwochardefs{%
7955 \gdef^^a0{~}
7956 \gdef^^a1{\missingcharmsg{LATIN CAPITAL LETTER A WITH OGONEK}}
7957 \gdef^^a2{\u{}}
7958 \gdef^^a3{\L}
7959 \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
7960 \gdef^^a5{\v L}
7961 \gdef^^a6{\'S}
7962 \gdef^^a7{\S}
7963 \gdef^^a8{\"{}}
7964 \gdef^^a9{\v S}
7965 \gdef^^aa{\cedilla S}
7966 \gdef^^ab{\v T}
7967 \gdef^^ac{\'Z}
7968 \gdef^^ad{\-}
7969 \gdef^^ae{\v Z}
7970 \gdef^^af{\dotaccent Z}
7971 %
7972 \gdef^^b0{\textdegree}
7973 \gdef^^b1{\missingcharmsg{LATIN SMALL LETTER A WITH OGONEK}}
7974 \gdef^^b2{\missingcharmsg{OGONEK}}
7975 \gdef^^b3{\l}
7976 \gdef^^b4{\'{}}
7977 \gdef^^b5{\v l}
7978 \gdef^^b6{\'s}
7979 \gdef^^b7{\v{}}
7980 \gdef^^b8{\cedilla\ }
7981 \gdef^^b9{\v s}
7982 \gdef^^ba{\cedilla s}
7983 \gdef^^bb{\v t}
7984 \gdef^^bc{\'z}
7985 \gdef^^bd{\H{}}
7986 \gdef^^be{\v z}
7987 \gdef^^bf{\dotaccent z}
7988 %
7989 \gdef^^c0{\'R}
7990 \gdef^^c1{\'A}
7991 \gdef^^c2{\^A}
7992 \gdef^^c3{\u A}
7993 \gdef^^c4{\"A}
7994 \gdef^^c5{\'L}
7995 \gdef^^c6{\'C}
7996 \gdef^^c7{\cedilla C}
7997 \gdef^^c8{\v C}
7998 \gdef^^c9{\'E}
7999 \gdef^^ca{\missingcharmsg{LATIN CAPITAL LETTER E WITH OGONEK}}
8000 \gdef^^cb{\"E}
8001 \gdef^^cc{\v E}
8002 \gdef^^cd{\'I}
8003 \gdef^^ce{\^I}
8004 \gdef^^cf{\v D}
8005 %
8006 \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER D WITH STROKE}}
8007 \gdef^^d1{\'N}
8008 \gdef^^d2{\v N}
8009 \gdef^^d3{\'O}
8010 \gdef^^d4{\^O}
8011 \gdef^^d5{\H O}
8012 \gdef^^d6{\"O}
8013 \gdef^^d7{$\times$}
8014 \gdef^^d8{\v R}
8015 \gdef^^d9{\ringaccent U}
8016 \gdef^^da{\'U}
8017 \gdef^^db{\H U}
8018 \gdef^^dc{\"U}
8019 \gdef^^dd{\'Y}
8020 \gdef^^de{\cedilla T}
8021 \gdef^^df{\ss}
8022 %
8023 \gdef^^e0{\'r}
8024 \gdef^^e1{\'a}
8025 \gdef^^e2{\^a}
8026 \gdef^^e3{\u a}
8027 \gdef^^e4{\"a}
8028 \gdef^^e5{\'l}
8029 \gdef^^e6{\'c}
8030 \gdef^^e7{\cedilla c}
8031 \gdef^^e8{\v c}
8032 \gdef^^e9{\'e}
8033 \gdef^^ea{\missingcharmsg{LATIN SMALL LETTER E WITH OGONEK}}
8034 \gdef^^eb{\"e}
8035 \gdef^^ec{\v e}
8036 \gdef^^ed{\'\i}
8037 \gdef^^ee{\^\i}
8038 \gdef^^ef{\v d}
8039 %
8040 \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER D WITH STROKE}}
8041 \gdef^^f1{\'n}
8042 \gdef^^f2{\v n}
8043 \gdef^^f3{\'o}
8044 \gdef^^f4{\^o}
8045 \gdef^^f5{\H o}
8046 \gdef^^f6{\"o}
8047 \gdef^^f7{$\div$}
8048 \gdef^^f8{\v r}
8049 \gdef^^f9{\ringaccent u}
8050 \gdef^^fa{\'u}
8051 \gdef^^fb{\H u}
8052 \gdef^^fc{\"u}
8053 \gdef^^fd{\'y}
8054 \gdef^^fe{\cedilla t}
8055 \gdef^^ff{\dotaccent{}}
8056}
8057
8058% UTF-8 character definitions.
8059%
8060% This code to support UTF-8 is based on LaTeX's utf8.def, with some
8061% changes for Texinfo conventions. It is included here under the GPL by
8062% permission from Frank Mittelbach and the LaTeX team.
8063%
8064\newcount\countUTFx
8065\newcount\countUTFy
8066\newcount\countUTFz
6828 8067
6829% Page size parameters. 8068\gdef\UTFviiiTwoOctets#1#2{\expandafter
8069 \UTFviiiDefined\csname u8:#1\string #2\endcsname}
8070%
8071\gdef\UTFviiiThreeOctets#1#2#3{\expandafter
8072 \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
6830% 8073%
8074\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
8075 \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
8076
8077\gdef\UTFviiiDefined#1{%
8078 \ifx #1\relax
8079 \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
8080 \else
8081 \expandafter #1%
8082 \fi
8083}
8084
8085\begingroup
8086 \catcode`\~13
8087 \catcode`\"12
8088
8089 \def\UTFviiiLoop{%
8090 \global\catcode\countUTFx\active
8091 \uccode`\~\countUTFx
8092 \uppercase\expandafter{\UTFviiiTmp}%
8093 \advance\countUTFx by 1
8094 \ifnum\countUTFx < \countUTFy
8095 \expandafter\UTFviiiLoop
8096 \fi}
8097
8098 \countUTFx = "C2
8099 \countUTFy = "E0
8100 \def\UTFviiiTmp{%
8101 \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
8102 \UTFviiiLoop
8103
8104 \countUTFx = "E0
8105 \countUTFy = "F0
8106 \def\UTFviiiTmp{%
8107 \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
8108 \UTFviiiLoop
8109
8110 \countUTFx = "F0
8111 \countUTFy = "F4
8112 \def\UTFviiiTmp{%
8113 \xdef~{\noexpand\UTFviiiFourOctets\string~}}
8114 \UTFviiiLoop
8115\endgroup
8116
8117\begingroup
8118 \catcode`\"=12
8119 \catcode`\<=12
8120 \catcode`\.=12
8121 \catcode`\,=12
8122 \catcode`\;=12
8123 \catcode`\!=12
8124 \catcode`\~=13
8125
8126 \gdef\DeclareUnicodeCharacter#1#2{%
8127 \countUTFz = "#1\relax
8128 \wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
8129 \begingroup
8130 \parseXMLCharref
8131 \def\UTFviiiTwoOctets##1##2{%
8132 \csname u8:##1\string ##2\endcsname}%
8133 \def\UTFviiiThreeOctets##1##2##3{%
8134 \csname u8:##1\string ##2\string ##3\endcsname}%
8135 \def\UTFviiiFourOctets##1##2##3##4{%
8136 \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
8137 \expandafter\expandafter\expandafter\expandafter
8138 \expandafter\expandafter\expandafter
8139 \gdef\UTFviiiTmp{#2}%
8140 \endgroup}
8141
8142 \gdef\parseXMLCharref{%
8143 \ifnum\countUTFz < "A0\relax
8144 \errhelp = \EMsimple
8145 \errmessage{Cannot define Unicode char value < 00A0}%
8146 \else\ifnum\countUTFz < "800\relax
8147 \parseUTFviiiA,%
8148 \parseUTFviiiB C\UTFviiiTwoOctets.,%
8149 \else\ifnum\countUTFz < "10000\relax
8150 \parseUTFviiiA;%
8151 \parseUTFviiiA,%
8152 \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
8153 \else
8154 \parseUTFviiiA;%
8155 \parseUTFviiiA,%
8156 \parseUTFviiiA!%
8157 \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
8158 \fi\fi\fi
8159 }
8160
8161 \gdef\parseUTFviiiA#1{%
8162 \countUTFx = \countUTFz
8163 \divide\countUTFz by 64
8164 \countUTFy = \countUTFz
8165 \multiply\countUTFz by 64
8166 \advance\countUTFx by -\countUTFz
8167 \advance\countUTFx by 128
8168 \uccode `#1\countUTFx
8169 \countUTFz = \countUTFy}
8170
8171 \gdef\parseUTFviiiB#1#2#3#4{%
8172 \advance\countUTFz by "#10\relax
8173 \uccode `#3\countUTFz
8174 \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
8175\endgroup
8176
8177\def\utfeightchardefs{%
8178 \DeclareUnicodeCharacter{00A0}{\tie}
8179 \DeclareUnicodeCharacter{00A1}{\exclamdown}
8180 \DeclareUnicodeCharacter{00A3}{\pounds}
8181 \DeclareUnicodeCharacter{00A8}{\"{ }}
8182 \DeclareUnicodeCharacter{00A9}{\copyright}
8183 \DeclareUnicodeCharacter{00AA}{\ordf}
8184 \DeclareUnicodeCharacter{00AB}{\guillemetleft}
8185 \DeclareUnicodeCharacter{00AD}{\-}
8186 \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
8187 \DeclareUnicodeCharacter{00AF}{\={ }}
8188
8189 \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
8190 \DeclareUnicodeCharacter{00B4}{\'{ }}
8191 \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
8192 \DeclareUnicodeCharacter{00BA}{\ordm}
8193 \DeclareUnicodeCharacter{00BB}{\guillemetright}
8194 \DeclareUnicodeCharacter{00BF}{\questiondown}
8195
8196 \DeclareUnicodeCharacter{00C0}{\`A}
8197 \DeclareUnicodeCharacter{00C1}{\'A}
8198 \DeclareUnicodeCharacter{00C2}{\^A}
8199 \DeclareUnicodeCharacter{00C3}{\~A}
8200 \DeclareUnicodeCharacter{00C4}{\"A}
8201 \DeclareUnicodeCharacter{00C5}{\AA}
8202 \DeclareUnicodeCharacter{00C6}{\AE}
8203 \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
8204 \DeclareUnicodeCharacter{00C8}{\`E}
8205 \DeclareUnicodeCharacter{00C9}{\'E}
8206 \DeclareUnicodeCharacter{00CA}{\^E}
8207 \DeclareUnicodeCharacter{00CB}{\"E}
8208 \DeclareUnicodeCharacter{00CC}{\`I}
8209 \DeclareUnicodeCharacter{00CD}{\'I}
8210 \DeclareUnicodeCharacter{00CE}{\^I}
8211 \DeclareUnicodeCharacter{00CF}{\"I}
8212
8213 \DeclareUnicodeCharacter{00D1}{\~N}
8214 \DeclareUnicodeCharacter{00D2}{\`O}
8215 \DeclareUnicodeCharacter{00D3}{\'O}
8216 \DeclareUnicodeCharacter{00D4}{\^O}
8217 \DeclareUnicodeCharacter{00D5}{\~O}
8218 \DeclareUnicodeCharacter{00D6}{\"O}
8219 \DeclareUnicodeCharacter{00D8}{\O}
8220 \DeclareUnicodeCharacter{00D9}{\`U}
8221 \DeclareUnicodeCharacter{00DA}{\'U}
8222 \DeclareUnicodeCharacter{00DB}{\^U}
8223 \DeclareUnicodeCharacter{00DC}{\"U}
8224 \DeclareUnicodeCharacter{00DD}{\'Y}
8225 \DeclareUnicodeCharacter{00DF}{\ss}
8226
8227 \DeclareUnicodeCharacter{00E0}{\`a}
8228 \DeclareUnicodeCharacter{00E1}{\'a}
8229 \DeclareUnicodeCharacter{00E2}{\^a}
8230 \DeclareUnicodeCharacter{00E3}{\~a}
8231 \DeclareUnicodeCharacter{00E4}{\"a}
8232 \DeclareUnicodeCharacter{00E5}{\aa}
8233 \DeclareUnicodeCharacter{00E6}{\ae}
8234 \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
8235 \DeclareUnicodeCharacter{00E8}{\`e}
8236 \DeclareUnicodeCharacter{00E9}{\'e}
8237 \DeclareUnicodeCharacter{00EA}{\^e}
8238 \DeclareUnicodeCharacter{00EB}{\"e}
8239 \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
8240 \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
8241 \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
8242 \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
8243
8244 \DeclareUnicodeCharacter{00F1}{\~n}
8245 \DeclareUnicodeCharacter{00F2}{\`o}
8246 \DeclareUnicodeCharacter{00F3}{\'o}
8247 \DeclareUnicodeCharacter{00F4}{\^o}
8248 \DeclareUnicodeCharacter{00F5}{\~o}
8249 \DeclareUnicodeCharacter{00F6}{\"o}
8250 \DeclareUnicodeCharacter{00F8}{\o}
8251 \DeclareUnicodeCharacter{00F9}{\`u}
8252 \DeclareUnicodeCharacter{00FA}{\'u}
8253 \DeclareUnicodeCharacter{00FB}{\^u}
8254 \DeclareUnicodeCharacter{00FC}{\"u}
8255 \DeclareUnicodeCharacter{00FD}{\'y}
8256 \DeclareUnicodeCharacter{00FF}{\"y}
8257
8258 \DeclareUnicodeCharacter{0100}{\=A}
8259 \DeclareUnicodeCharacter{0101}{\=a}
8260 \DeclareUnicodeCharacter{0102}{\u{A}}
8261 \DeclareUnicodeCharacter{0103}{\u{a}}
8262 \DeclareUnicodeCharacter{0106}{\'C}
8263 \DeclareUnicodeCharacter{0107}{\'c}
8264 \DeclareUnicodeCharacter{0108}{\^C}
8265 \DeclareUnicodeCharacter{0109}{\^c}
8266 \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
8267 \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
8268 \DeclareUnicodeCharacter{010C}{\v{C}}
8269 \DeclareUnicodeCharacter{010D}{\v{c}}
8270 \DeclareUnicodeCharacter{010E}{\v{D}}
8271
8272 \DeclareUnicodeCharacter{0112}{\=E}
8273 \DeclareUnicodeCharacter{0113}{\=e}
8274 \DeclareUnicodeCharacter{0114}{\u{E}}
8275 \DeclareUnicodeCharacter{0115}{\u{e}}
8276 \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
8277 \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
8278 \DeclareUnicodeCharacter{011A}{\v{E}}
8279 \DeclareUnicodeCharacter{011B}{\v{e}}
8280 \DeclareUnicodeCharacter{011C}{\^G}
8281 \DeclareUnicodeCharacter{011D}{\^g}
8282 \DeclareUnicodeCharacter{011E}{\u{G}}
8283 \DeclareUnicodeCharacter{011F}{\u{g}}
8284
8285 \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
8286 \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
8287 \DeclareUnicodeCharacter{0124}{\^H}
8288 \DeclareUnicodeCharacter{0125}{\^h}
8289 \DeclareUnicodeCharacter{0128}{\~I}
8290 \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
8291 \DeclareUnicodeCharacter{012A}{\=I}
8292 \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
8293 \DeclareUnicodeCharacter{012C}{\u{I}}
8294 \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
8295
8296 \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
8297 \DeclareUnicodeCharacter{0131}{\dotless{i}}
8298 \DeclareUnicodeCharacter{0132}{IJ}
8299 \DeclareUnicodeCharacter{0133}{ij}
8300 \DeclareUnicodeCharacter{0134}{\^J}
8301 \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
8302 \DeclareUnicodeCharacter{0139}{\'L}
8303 \DeclareUnicodeCharacter{013A}{\'l}
8304
8305 \DeclareUnicodeCharacter{0141}{\L}
8306 \DeclareUnicodeCharacter{0142}{\l}
8307 \DeclareUnicodeCharacter{0143}{\'N}
8308 \DeclareUnicodeCharacter{0144}{\'n}
8309 \DeclareUnicodeCharacter{0147}{\v{N}}
8310 \DeclareUnicodeCharacter{0148}{\v{n}}
8311 \DeclareUnicodeCharacter{014C}{\=O}
8312 \DeclareUnicodeCharacter{014D}{\=o}
8313 \DeclareUnicodeCharacter{014E}{\u{O}}
8314 \DeclareUnicodeCharacter{014F}{\u{o}}
8315
8316 \DeclareUnicodeCharacter{0150}{\H{O}}
8317 \DeclareUnicodeCharacter{0151}{\H{o}}
8318 \DeclareUnicodeCharacter{0152}{\OE}
8319 \DeclareUnicodeCharacter{0153}{\oe}
8320 \DeclareUnicodeCharacter{0154}{\'R}
8321 \DeclareUnicodeCharacter{0155}{\'r}
8322 \DeclareUnicodeCharacter{0158}{\v{R}}
8323 \DeclareUnicodeCharacter{0159}{\v{r}}
8324 \DeclareUnicodeCharacter{015A}{\'S}
8325 \DeclareUnicodeCharacter{015B}{\'s}
8326 \DeclareUnicodeCharacter{015C}{\^S}
8327 \DeclareUnicodeCharacter{015D}{\^s}
8328 \DeclareUnicodeCharacter{015E}{\cedilla{S}}
8329 \DeclareUnicodeCharacter{015F}{\cedilla{s}}
8330
8331 \DeclareUnicodeCharacter{0160}{\v{S}}
8332 \DeclareUnicodeCharacter{0161}{\v{s}}
8333 \DeclareUnicodeCharacter{0162}{\cedilla{t}}
8334 \DeclareUnicodeCharacter{0163}{\cedilla{T}}
8335 \DeclareUnicodeCharacter{0164}{\v{T}}
8336
8337 \DeclareUnicodeCharacter{0168}{\~U}
8338 \DeclareUnicodeCharacter{0169}{\~u}
8339 \DeclareUnicodeCharacter{016A}{\=U}
8340 \DeclareUnicodeCharacter{016B}{\=u}
8341 \DeclareUnicodeCharacter{016C}{\u{U}}
8342 \DeclareUnicodeCharacter{016D}{\u{u}}
8343 \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
8344 \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
8345
8346 \DeclareUnicodeCharacter{0170}{\H{U}}
8347 \DeclareUnicodeCharacter{0171}{\H{u}}
8348 \DeclareUnicodeCharacter{0174}{\^W}
8349 \DeclareUnicodeCharacter{0175}{\^w}
8350 \DeclareUnicodeCharacter{0176}{\^Y}
8351 \DeclareUnicodeCharacter{0177}{\^y}
8352 \DeclareUnicodeCharacter{0178}{\"Y}
8353 \DeclareUnicodeCharacter{0179}{\'Z}
8354 \DeclareUnicodeCharacter{017A}{\'z}
8355 \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
8356 \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
8357 \DeclareUnicodeCharacter{017D}{\v{Z}}
8358 \DeclareUnicodeCharacter{017E}{\v{z}}
8359
8360 \DeclareUnicodeCharacter{01C4}{D\v{Z}}
8361 \DeclareUnicodeCharacter{01C5}{D\v{z}}
8362 \DeclareUnicodeCharacter{01C6}{d\v{z}}
8363 \DeclareUnicodeCharacter{01C7}{LJ}
8364 \DeclareUnicodeCharacter{01C8}{Lj}
8365 \DeclareUnicodeCharacter{01C9}{lj}
8366 \DeclareUnicodeCharacter{01CA}{NJ}
8367 \DeclareUnicodeCharacter{01CB}{Nj}
8368 \DeclareUnicodeCharacter{01CC}{nj}
8369 \DeclareUnicodeCharacter{01CD}{\v{A}}
8370 \DeclareUnicodeCharacter{01CE}{\v{a}}
8371 \DeclareUnicodeCharacter{01CF}{\v{I}}
8372
8373 \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
8374 \DeclareUnicodeCharacter{01D1}{\v{O}}
8375 \DeclareUnicodeCharacter{01D2}{\v{o}}
8376 \DeclareUnicodeCharacter{01D3}{\v{U}}
8377 \DeclareUnicodeCharacter{01D4}{\v{u}}
8378
8379 \DeclareUnicodeCharacter{01E2}{\={\AE}}
8380 \DeclareUnicodeCharacter{01E3}{\={\ae}}
8381 \DeclareUnicodeCharacter{01E6}{\v{G}}
8382 \DeclareUnicodeCharacter{01E7}{\v{g}}
8383 \DeclareUnicodeCharacter{01E8}{\v{K}}
8384 \DeclareUnicodeCharacter{01E9}{\v{k}}
8385
8386 \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
8387 \DeclareUnicodeCharacter{01F1}{DZ}
8388 \DeclareUnicodeCharacter{01F2}{Dz}
8389 \DeclareUnicodeCharacter{01F3}{dz}
8390 \DeclareUnicodeCharacter{01F4}{\'G}
8391 \DeclareUnicodeCharacter{01F5}{\'g}
8392 \DeclareUnicodeCharacter{01F8}{\`N}
8393 \DeclareUnicodeCharacter{01F9}{\`n}
8394 \DeclareUnicodeCharacter{01FC}{\'{\AE}}
8395 \DeclareUnicodeCharacter{01FD}{\'{\ae}}
8396 \DeclareUnicodeCharacter{01FE}{\'{\O}}
8397 \DeclareUnicodeCharacter{01FF}{\'{\o}}
8398
8399 \DeclareUnicodeCharacter{021E}{\v{H}}
8400 \DeclareUnicodeCharacter{021F}{\v{h}}
8401
8402 \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
8403 \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
8404 \DeclareUnicodeCharacter{0228}{\cedilla{E}}
8405 \DeclareUnicodeCharacter{0229}{\cedilla{e}}
8406 \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
8407 \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
8408
8409 \DeclareUnicodeCharacter{0232}{\=Y}
8410 \DeclareUnicodeCharacter{0233}{\=y}
8411 \DeclareUnicodeCharacter{0237}{\dotless{j}}
8412
8413 \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
8414 \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
8415 \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
8416 \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
8417 \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
8418 \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
8419 \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
8420 \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
8421 \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
8422 \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
8423 \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
8424 \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
8425
8426 \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
8427 \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
8428
8429 \DeclareUnicodeCharacter{1E20}{\=G}
8430 \DeclareUnicodeCharacter{1E21}{\=g}
8431 \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
8432 \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
8433 \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
8434 \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
8435 \DeclareUnicodeCharacter{1E26}{\"H}
8436 \DeclareUnicodeCharacter{1E27}{\"h}
8437
8438 \DeclareUnicodeCharacter{1E30}{\'K}
8439 \DeclareUnicodeCharacter{1E31}{\'k}
8440 \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
8441 \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
8442 \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
8443 \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
8444 \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
8445 \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
8446 \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
8447 \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
8448 \DeclareUnicodeCharacter{1E3E}{\'M}
8449 \DeclareUnicodeCharacter{1E3F}{\'m}
8450
8451 \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
8452 \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
8453 \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
8454 \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
8455 \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
8456 \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
8457 \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
8458 \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
8459 \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
8460 \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
8461
8462 \DeclareUnicodeCharacter{1E54}{\'P}
8463 \DeclareUnicodeCharacter{1E55}{\'p}
8464 \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
8465 \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
8466 \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
8467 \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
8468 \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
8469 \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
8470 \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
8471 \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
8472
8473 \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
8474 \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
8475 \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
8476 \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
8477 \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
8478 \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
8479 \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
8480 \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
8481 \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
8482 \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
8483
8484 \DeclareUnicodeCharacter{1E7C}{\~V}
8485 \DeclareUnicodeCharacter{1E7D}{\~v}
8486 \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
8487 \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
8488
8489 \DeclareUnicodeCharacter{1E80}{\`W}
8490 \DeclareUnicodeCharacter{1E81}{\`w}
8491 \DeclareUnicodeCharacter{1E82}{\'W}
8492 \DeclareUnicodeCharacter{1E83}{\'w}
8493 \DeclareUnicodeCharacter{1E84}{\"W}
8494 \DeclareUnicodeCharacter{1E85}{\"w}
8495 \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
8496 \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
8497 \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
8498 \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
8499 \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
8500 \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
8501 \DeclareUnicodeCharacter{1E8C}{\"X}
8502 \DeclareUnicodeCharacter{1E8D}{\"x}
8503 \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
8504 \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
8505
8506 \DeclareUnicodeCharacter{1E90}{\^Z}
8507 \DeclareUnicodeCharacter{1E91}{\^z}
8508 \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
8509 \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
8510 \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
8511 \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
8512 \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
8513 \DeclareUnicodeCharacter{1E97}{\"t}
8514 \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
8515 \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
8516
8517 \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
8518 \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
8519
8520 \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
8521 \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
8522 \DeclareUnicodeCharacter{1EBC}{\~E}
8523 \DeclareUnicodeCharacter{1EBD}{\~e}
8524
8525 \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
8526 \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
8527 \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
8528 \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
8529
8530 \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
8531 \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
8532
8533 \DeclareUnicodeCharacter{1EF2}{\`Y}
8534 \DeclareUnicodeCharacter{1EF3}{\`y}
8535 \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
8536
8537 \DeclareUnicodeCharacter{1EF8}{\~Y}
8538 \DeclareUnicodeCharacter{1EF9}{\~y}
8539
8540 \DeclareUnicodeCharacter{2013}{--}
8541 \DeclareUnicodeCharacter{2014}{---}
8542 \DeclareUnicodeCharacter{2018}{\quoteleft}
8543 \DeclareUnicodeCharacter{2019}{\quoteright}
8544 \DeclareUnicodeCharacter{201A}{\quotesinglbase}
8545 \DeclareUnicodeCharacter{201C}{\quotedblleft}
8546 \DeclareUnicodeCharacter{201D}{\quotedblright}
8547 \DeclareUnicodeCharacter{201E}{\quotedblbase}
8548 \DeclareUnicodeCharacter{2022}{\bullet}
8549 \DeclareUnicodeCharacter{2026}{\dots}
8550 \DeclareUnicodeCharacter{2039}{\guilsinglleft}
8551 \DeclareUnicodeCharacter{203A}{\guilsinglright}
8552 \DeclareUnicodeCharacter{20AC}{\euro}
8553
8554 \DeclareUnicodeCharacter{2192}{\expansion}
8555 \DeclareUnicodeCharacter{21D2}{\result}
8556
8557 \DeclareUnicodeCharacter{2212}{\minus}
8558 \DeclareUnicodeCharacter{2217}{\point}
8559 \DeclareUnicodeCharacter{2261}{\equiv}
8560}% end of \utfeightchardefs
8561
8562
8563% US-ASCII character definitions.
8564\def\asciichardefs{% nothing need be done
8565 \relax
8566}
8567
8568% Make non-ASCII characters printable again for compatibility with
8569% existing Texinfo documents that may use them, even without declaring a
8570% document encoding.
8571%
8572\setnonasciicharscatcode \other
8573
8574
8575\message{formatting,}
8576
6831\newdimen\defaultparindent \defaultparindent = 15pt 8577\newdimen\defaultparindent \defaultparindent = 15pt
6832 8578
6833\chapheadingskip = 15pt plus 4pt minus 2pt 8579\chapheadingskip = 15pt plus 4pt minus 2pt
@@ -6840,7 +8586,7 @@ should work if nowhere else does.}
6840% Don't be so finicky about underfull hboxes, either. 8586% Don't be so finicky about underfull hboxes, either.
6841\hbadness = 2000 8587\hbadness = 2000
6842 8588
6843% Following George Bush, just get rid of widows and orphans. 8589% Following George Bush, get rid of widows and orphans.
6844\widowpenalty=10000 8590\widowpenalty=10000
6845\clubpenalty=10000 8591\clubpenalty=10000
6846 8592
@@ -6887,6 +8633,10 @@ should work if nowhere else does.}
6887 \ifpdf 8633 \ifpdf
6888 \pdfpageheight #7\relax 8634 \pdfpageheight #7\relax
6889 \pdfpagewidth #8\relax 8635 \pdfpagewidth #8\relax
8636 % if we don't reset these, they will remain at "1 true in" of
8637 % whatever layout pdftex was dumped with.
8638 \pdfhorigin = 1 true in
8639 \pdfvorigin = 1 true in
6890 \fi 8640 \fi
6891 % 8641 %
6892 \setleading{\textleading} 8642 \setleading{\textleading}
@@ -6901,7 +8651,7 @@ should work if nowhere else does.}
6901 \textleading = 13.2pt 8651 \textleading = 13.2pt
6902 % 8652 %
6903 % If page is nothing but text, make it come out even. 8653 % If page is nothing but text, make it come out even.
6904 \internalpagesizes{46\baselineskip}{6in}% 8654 \internalpagesizes{607.2pt}{6in}% that's 46 lines
6905 {\voffset}{.25in}% 8655 {\voffset}{.25in}%
6906 {\bindingoffset}{36pt}% 8656 {\bindingoffset}{36pt}%
6907 {11in}{8.5in}% 8657 {11in}{8.5in}%
@@ -6913,7 +8663,7 @@ should work if nowhere else does.}
6913 \textleading = 12pt 8663 \textleading = 12pt
6914 % 8664 %
6915 \internalpagesizes{7.5in}{5in}% 8665 \internalpagesizes{7.5in}{5in}%
6916 {\voffset}{.25in}% 8666 {-.2in}{0in}%
6917 {\bindingoffset}{16pt}% 8667 {\bindingoffset}{16pt}%
6918 {9.25in}{7in}% 8668 {9.25in}{7in}%
6919 % 8669 %
@@ -6957,7 +8707,7 @@ should work if nowhere else does.}
6957 % \global\normaloffset = -6mm 8707 % \global\normaloffset = -6mm
6958 % \global\bindingoffset = 10mm 8708 % \global\bindingoffset = 10mm
6959 % @end tex 8709 % @end tex
6960 \internalpagesizes{51\baselineskip}{160mm} 8710 \internalpagesizes{673.2pt}{160mm}% that's 51 lines
6961 {\voffset}{\hoffset}% 8711 {\voffset}{\hoffset}%
6962 {\bindingoffset}{44pt}% 8712 {\bindingoffset}{44pt}%
6963 {297mm}{210mm}% 8713 {297mm}{210mm}%
@@ -7022,7 +8772,7 @@ should work if nowhere else does.}
7022 \parskip = 3pt plus 2pt minus 1pt 8772 \parskip = 3pt plus 2pt minus 1pt
7023 \setleading{\textleading}% 8773 \setleading{\textleading}%
7024 % 8774 %
7025 \dimen0 = #1 8775 \dimen0 = #1\relax
7026 \advance\dimen0 by \voffset 8776 \advance\dimen0 by \voffset
7027 % 8777 %
7028 \dimen2 = \hsize 8778 \dimen2 = \hsize
@@ -7117,6 +8867,13 @@ should work if nowhere else does.}
7117% \otherifyactive is called near the end of this file. 8867% \otherifyactive is called near the end of this file.
7118\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} 8868\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
7119 8869
8870% Used sometimes to turn off (effectively) the active characters even after
8871% parsing them.
8872\def\turnoffactive{%
8873 \normalturnoffactive
8874 \otherbackslash
8875}
8876
7120\catcode`\@=0 8877\catcode`\@=0
7121 8878
7122% \backslashcurfont outputs one backslash character in current font, 8879% \backslashcurfont outputs one backslash character in current font,
@@ -7124,28 +8881,29 @@ should work if nowhere else does.}
7124\global\chardef\backslashcurfont=`\\ 8881\global\chardef\backslashcurfont=`\\
7125\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work 8882\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
7126 8883
7127% \rawbackslash defines an active \ to do \backslashcurfont.
7128% \otherbackslash defines an active \ to be a literal `\' character with
7129% catcode other.
7130{\catcode`\\=\active
7131 @gdef@rawbackslash{@let\=@backslashcurfont}
7132 @gdef@otherbackslash{@let\=@realbackslash}
7133}
7134
7135% \realbackslash is an actual character `\' with catcode other, and 8884% \realbackslash is an actual character `\' with catcode other, and
7136% \doublebackslash is two of them (for the pdf outlines). 8885% \doublebackslash is two of them (for the pdf outlines).
7137{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} 8886{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
7138 8887
7139% \normalbackslash outputs one backslash in fixed width font. 8888% In texinfo, backslash is an active character; it prints the backslash
7140\def\normalbackslash{{\tt\backslashcurfont}} 8889% in fixed width font.
7141
7142\catcode`\\=\active 8890\catcode`\\=\active
8891@def@normalbackslash{{@tt@backslashcurfont}}
8892% On startup, @fixbackslash assigns:
8893% @let \ = @normalbackslash
8894
8895% \rawbackslash defines an active \ to do \backslashcurfont.
8896% \otherbackslash defines an active \ to be a literal `\' character with
8897% catcode other.
8898@gdef@rawbackslash{@let\=@backslashcurfont}
8899@gdef@otherbackslash{@let\=@realbackslash}
7143 8900
7144% Used sometimes to turn off (effectively) the active characters 8901% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
7145% even after parsing them. 8902% the literal character `\'.
7146@def@turnoffactive{% 8903%
8904@def@normalturnoffactive{%
8905 @let\=@normalbackslash
7147 @let"=@normaldoublequote 8906 @let"=@normaldoublequote
7148 @let\=@realbackslash
7149 @let~=@normaltilde 8907 @let~=@normaltilde
7150 @let^=@normalcaret 8908 @let^=@normalcaret
7151 @let_=@normalunderscore 8909 @let_=@normalunderscore
@@ -7157,12 +8915,6 @@ should work if nowhere else does.}
7157 @unsepspaces 8915 @unsepspaces
7158} 8916}
7159 8917
7160% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
7161% the literal character `\'. (Thus, \ is not expandable when this is in
7162% effect.)
7163%
7164@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash}
7165
7166% Make _ and + \other characters, temporarily. 8918% Make _ and + \other characters, temporarily.
7167% This is canceled by @fixbackslash. 8919% This is canceled by @fixbackslash.
7168@otherifyactive 8920@otherifyactive
@@ -7175,7 +8927,7 @@ should work if nowhere else does.}
7175@global@let\ = @eatinput 8927@global@let\ = @eatinput
7176 8928
7177% On the other hand, perhaps the file did not have a `\input texinfo'. Then 8929% On the other hand, perhaps the file did not have a `\input texinfo'. Then
7178% the first `\{ in the file would cause an error. This macro tries to fix 8930% the first `\' in the file would cause an error. This macro tries to fix
7179% that, assuming it is called before the first `\' could plausibly occur. 8931% that, assuming it is called before the first `\' could plausibly occur.
7180% Also turn back on active characters that might appear in the input 8932% Also turn back on active characters that might appear in the input
7181% file name, in case not using a pre-dumped format. 8933% file name, in case not using a pre-dumped format.
diff --git a/src/daemon/connection.c b/src/daemon/connection.c
index dd75771d..8477a9d0 100644
--- a/src/daemon/connection.c
+++ b/src/daemon/connection.c
@@ -410,7 +410,8 @@ try_ready_chunked_body (struct MHD_Connection *connection)
410 } 410 }
411 if (ret > 0xFFFFFF) 411 if (ret > 0xFFFFFF)
412 ret = 0xFFFFFF; 412 ret = 0xFFFFFF;
413 cblen = snprintf (cbuf, sizeof (cbuf), "%X\r\n", ret); 413 SPRINTF (cbuf, "%X\r\n", ret);
414 cblen = strlen(cbuf);
414 EXTRA_CHECK (cblen <= sizeof (cbuf)); 415 EXTRA_CHECK (cblen <= sizeof (cbuf));
415 memcpy (&connection->write_buffer[sizeof (cbuf) - cblen], cbuf, cblen); 416 memcpy (&connection->write_buffer[sizeof (cbuf) - cblen], cbuf, cblen);
416 memcpy (&connection->write_buffer[sizeof (cbuf) + ret], "\r\n", 2); 417 memcpy (&connection->write_buffer[sizeof (cbuf) + ret], "\r\n", 2);
@@ -458,10 +459,9 @@ add_extra_headers (struct MHD_Connection *connection)
458 else if (NULL == MHD_get_response_header (connection->response, 459 else if (NULL == MHD_get_response_header (connection->response,
459 MHD_HTTP_HEADER_CONTENT_LENGTH)) 460 MHD_HTTP_HEADER_CONTENT_LENGTH))
460 { 461 {
461 _REAL_SNPRINTF (buf, 462 SPRINTF (buf,
462 128, 463 "%llu",
463 "%llu", 464 (unsigned long long) connection->response->total_size);
464 (unsigned long long) connection->response->total_size);
465 MHD_add_response_header (connection->response, 465 MHD_add_response_header (connection->response,
466 MHD_HTTP_HEADER_CONTENT_LENGTH, buf); 466 MHD_HTTP_HEADER_CONTENT_LENGTH, buf);
467 } 467 }
@@ -469,11 +469,12 @@ add_extra_headers (struct MHD_Connection *connection)
469 469
470/** 470/**
471 * Produce HTTP "Date:" header. 471 * Produce HTTP "Date:" header.
472 * @param date where to write the header 472 *
473 * @param max maximum number of characters to write 473 * @param date where to write the header, with
474 * at least 128 bytes available space.
474 */ 475 */
475static void 476static void
476get_date_string (char *date, unsigned int max) 477get_date_string (char *date)
477{ 478{
478 static const char *days[] = 479 static const char *days[] =
479 { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; 480 { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
@@ -486,17 +487,17 @@ get_date_string (char *date, unsigned int max)
486 487
487 time (&t); 488 time (&t);
488 gmtime_r (&t, &now); 489 gmtime_r (&t, &now);
489 snprintf (date, 490 SPRINTF (date,
490 max - 1, 491 "Date: %3s, %02u %3s %04u %02u:%02u:%02u GMT\r\n",
491 "Date: %3s, %02u %3s %04u %02u:%02u:%02u GMT\r\n", 492 days[now.tm_wday % 7],
492 days[now.tm_wday % 7], 493 now.tm_mday,
493 now.tm_mday, 494 mons[now.tm_mon % 12],
494 mons[now.tm_mon % 12], 495 1900 + now.tm_year, now.tm_hour, now.tm_min, now.tm_sec);
495 1900 + now.tm_year, now.tm_hour, now.tm_min, now.tm_sec);
496} 496}
497 497
498/** 498/**
499 * try growing the read buffer 499 * Try growing the read buffer
500 *
500 * @return MHD_YES on success, MHD_NO on failure 501 * @return MHD_YES on success, MHD_NO on failure
501 */ 502 */
502static int 503static int
@@ -530,7 +531,7 @@ build_header_response (struct MHD_Connection *connection)
530 size_t size; 531 size_t size;
531 size_t off; 532 size_t off;
532 struct MHD_HTTP_Header *pos; 533 struct MHD_HTTP_Header *pos;
533 char code[128]; 534 char code[256];
534 char date[128]; 535 char date[128];
535 char *data; 536 char *data;
536 enum MHD_ValueKind kind; 537 enum MHD_ValueKind kind;
@@ -540,15 +541,18 @@ build_header_response (struct MHD_Connection *connection)
540 { 541 {
541 add_extra_headers (connection); 542 add_extra_headers (connection);
542 reason_phrase = MHD_get_reason_phrase_for (connection->responseCode); 543 reason_phrase = MHD_get_reason_phrase_for (connection->responseCode);
543 _REAL_SNPRINTF (code, 128, "%s %u %s\r\n", MHD_HTTP_VERSION_1_1, 544 SPRINTF (code,
544 connection->responseCode, reason_phrase); 545 "%s %u %s\r\n",
546 MHD_HTTP_VERSION_1_1,
547 connection->responseCode,
548 reason_phrase);
545 off = strlen (code); 549 off = strlen (code);
546 /* estimate size */ 550 /* estimate size */
547 size = off + 2; /* extra \r\n at the end */ 551 size = off + 2; /* extra \r\n at the end */
548 kind = MHD_HEADER_KIND; 552 kind = MHD_HEADER_KIND;
549 if (NULL == MHD_get_response_header (connection->response, 553 if (NULL == MHD_get_response_header (connection->response,
550 MHD_HTTP_HEADER_DATE)) 554 MHD_HTTP_HEADER_DATE))
551 get_date_string (date, sizeof (date)); 555 get_date_string (date);
552 else 556 else
553 date[0] = '\0'; 557 date[0] = '\0';
554 size += strlen (date); 558 size += strlen (date);
@@ -1138,9 +1142,9 @@ call_connection_handler (struct MHD_Connection *connection)
1138 { 1142 {
1139 buffer_head[i] = '\0'; 1143 buffer_head[i] = '\0';
1140 malformed = 1144 malformed =
1141 (1 != sscanf (buffer_head, "%X", 1145 (1 != SSCANF (buffer_head, "%X",
1142 &connection->current_chunk_size)) && 1146 &connection->current_chunk_size)) &&
1143 (1 != sscanf (buffer_head, "%x", 1147 (1 != SSCANF (buffer_head, "%x",
1144 &connection->current_chunk_size)); 1148 &connection->current_chunk_size));
1145 } 1149 }
1146 if (malformed) 1150 if (malformed)
@@ -1234,8 +1238,9 @@ do_read (struct MHD_Connection *connection)
1234 if (connection->read_buffer_size == connection->read_buffer_offset) 1238 if (connection->read_buffer_size == connection->read_buffer_offset)
1235 return MHD_NO; 1239 return MHD_NO;
1236 1240
1237 bytes_read = connection->recv_cls (connection); 1241 bytes_read = connection->recv_cls (connection,
1238 1242 &connection->read_buffer[connection->read_buffer_offset],
1243 connection->read_buffer_size - connection->read_buffer_offset);
1239 if (bytes_read < 0) 1244 if (bytes_read < 0)
1240 { 1245 {
1241 if (errno == EINTR) 1246 if (errno == EINTR)
@@ -1270,7 +1275,11 @@ do_write (struct MHD_Connection *connection)
1270{ 1275{
1271 int ret; 1276 int ret;
1272 1277
1273 ret = connection->send_cls (connection); 1278 ret = connection->send_cls (connection,
1279 &connection->write_buffer
1280 [connection->write_buffer_send_offset],
1281 connection->write_buffer_append_offset
1282 - connection->write_buffer_send_offset);
1274 1283
1275 if (ret < 0) 1284 if (ret < 0)
1276 { 1285 {
@@ -1284,7 +1293,7 @@ do_write (struct MHD_Connection *connection)
1284 return MHD_YES; 1293 return MHD_YES;
1285 } 1294 }
1286#if DEBUG_SEND_DATA 1295#if DEBUG_SEND_DATA
1287 fprintf (stderr, 1296 FPRINTF (stderr,
1288 "Sent response: `%.*s'\n", 1297 "Sent response: `%.*s'\n",
1289 ret, 1298 ret,
1290 &connection->write_buffer[connection->write_buffer_send_offset]); 1299 &connection->write_buffer[connection->write_buffer_send_offset]);
@@ -1293,15 +1302,6 @@ do_write (struct MHD_Connection *connection)
1293 return MHD_YES; 1302 return MHD_YES;
1294} 1303}
1295 1304
1296static ssize_t
1297MHD_con_read (struct MHD_Connection *connection)
1298{
1299 return RECV (connection->socket_fd,
1300 &connection->read_buffer[connection->read_buffer_offset],
1301 connection->read_buffer_size -
1302 connection->read_buffer_offset, MSG_NOSIGNAL);
1303}
1304
1305/** 1305/**
1306 * Check if we are done sending the write-buffer. 1306 * Check if we are done sending the write-buffer.
1307 * If so, transition into "next_state". 1307 * If so, transition into "next_state".
@@ -1462,7 +1462,7 @@ parse_connection_headers (struct MHD_Connection *connection)
1462 MHD_HTTP_HEADER_CONTENT_LENGTH); 1462 MHD_HTTP_HEADER_CONTENT_LENGTH);
1463 if (clen != NULL) 1463 if (clen != NULL)
1464 { 1464 {
1465 if (1 != sscanf (clen, "%llu", &cval)) 1465 if (1 != SSCANF (clen, "%llu", &cval))
1466 { 1466 {
1467#if HAVE_MESSAGES 1467#if HAVE_MESSAGES
1468 MHD_DLOG (connection->daemon, 1468 MHD_DLOG (connection->daemon,
@@ -1553,16 +1553,6 @@ MHD_connection_handle_read (struct MHD_Connection *connection)
1553 return MHD_YES; 1553 return MHD_YES;
1554} 1554}
1555 1555
1556static ssize_t
1557MHD_con_write (struct MHD_Connection *connection)
1558{
1559 return SEND (connection->socket_fd,
1560 &connection->write_buffer[connection->
1561 write_buffer_send_offset],
1562 connection->write_buffer_append_offset -
1563 connection->write_buffer_send_offset, MSG_NOSIGNAL);
1564}
1565
1566/** 1556/**
1567 * This function was created to handle writes to sockets when it has 1557 * This function was created to handle writes to sockets when it has
1568 * been determined that the socket can be written to. All 1558 * been determined that the socket can be written to. All
@@ -1595,12 +1585,11 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
1595 case MHD_CONNECTION_HEADERS_PROCESSED: 1585 case MHD_CONNECTION_HEADERS_PROCESSED:
1596 break; 1586 break;
1597 case MHD_CONNECTION_CONTINUE_SENDING: 1587 case MHD_CONNECTION_CONTINUE_SENDING:
1598 ret = SEND (connection->socket_fd, 1588 ret = connection->send_cls (connection,
1599 &HTTP_100_CONTINUE 1589 &HTTP_100_CONTINUE
1600 [connection->continue_message_write_offset], 1590 [connection->continue_message_write_offset],
1601 strlen (HTTP_100_CONTINUE) - 1591 strlen (HTTP_100_CONTINUE) -
1602 connection->continue_message_write_offset, 1592 connection->continue_message_write_offset);
1603 MSG_NOSIGNAL);
1604 if (ret < 0) 1593 if (ret < 0)
1605 { 1594 {
1606 if (errno == EINTR) 1595 if (errno == EINTR)
@@ -1613,7 +1602,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
1613 return MHD_NO; 1602 return MHD_NO;
1614 } 1603 }
1615#if DEBUG_SEND_DATA 1604#if DEBUG_SEND_DATA
1616 fprintf (stderr, 1605 FPRINTF (stderr,
1617 "Sent 100 continue response: `%.*s'\n", 1606 "Sent 100 continue response: `%.*s'\n",
1618 ret, 1607 ret,
1619 &HTTP_100_CONTINUE 1608 &HTTP_100_CONTINUE
@@ -1661,17 +1650,17 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
1661 else 1650 else
1662#endif 1651#endif
1663 { 1652 {
1664 ret = SEND (connection->socket_fd, 1653 ret = connection->send_cls (connection,
1665 &response->data[connection-> 1654 &response->data[connection->
1666 response_write_position - 1655 response_write_position -
1667 response->data_start], 1656 response->data_start],
1668 response->data_size - 1657 response->data_size -
1669 (connection->response_write_position - 1658 (connection->response_write_position -
1670 response->data_start), MSG_NOSIGNAL); 1659 response->data_start));
1671 } 1660 }
1672#if DEBUG_SEND_DATA 1661#if DEBUG_SEND_DATA
1673 if (ret > 0) 1662 if (ret > 0)
1674 fprintf (stderr, 1663 FPRINTF (stderr,
1675 "Sent DATA response: `%.*s'\n", 1664 "Sent DATA response: `%.*s'\n",
1676 ret, 1665 ret,
1677 &response->data[connection->response_write_position - 1666 &response->data[connection->response_write_position -
@@ -1748,6 +1737,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
1748 unsigned int timeout; 1737 unsigned int timeout;
1749 const char *end; 1738 const char *end;
1750 char *line; 1739 char *line;
1740
1751 while (1) 1741 while (1)
1752 { 1742 {
1753#if DEBUG_STATES 1743#if DEBUG_STATES
@@ -2072,8 +2062,6 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
2072void 2062void
2073MHD_set_http_calbacks (struct MHD_Connection *connection) 2063MHD_set_http_calbacks (struct MHD_Connection *connection)
2074{ 2064{
2075 connection->recv_cls = &MHD_con_read;
2076 connection->send_cls = &MHD_con_write;
2077 connection->read_handler = &MHD_connection_handle_read; 2065 connection->read_handler = &MHD_connection_handle_read;
2078 connection->write_handler = &MHD_connection_handle_write; 2066 connection->write_handler = &MHD_connection_handle_write;
2079 connection->idle_handler = &MHD_connection_handle_idle; 2067 connection->idle_handler = &MHD_connection_handle_idle;
diff --git a/src/daemon/connection_https.c b/src/daemon/connection_https.c
index 7504031b..df91af10 100644
--- a/src/daemon/connection_https.c
+++ b/src/daemon/connection_https.c
@@ -87,46 +87,23 @@ MHD_get_connection_info (struct MHD_Connection *connection,
87/** 87/**
88 * This function is called once a secure connection has been marked 88 * This function is called once a secure connection has been marked
89 * for closure. 89 * for closure.
90 * 90 *
91 * @param connection: the connection to close 91 * NOTE: Some code duplication with connection_close_error
92 */ 92 * in connection.c
93static void
94MHD_tls_connection_close (struct MHD_Connection *connection)
95{
96 MHD_gnutls_bye (connection->tls_session, GNUTLS_SHUT_WR);
97 connection->tls_session->internals.read_eof = 1;
98
99 SHUTDOWN (connection->socket_fd, SHUT_RDWR);
100 CLOSE (connection->socket_fd);
101 connection->socket_fd = -1;
102
103 connection->state = MHD_CONNECTION_CLOSED;
104
105 /* call notify_completed callback if one was registered */
106 if (connection->daemon->notify_completed != NULL)
107 connection->daemon->notify_completed (connection->daemon->
108 notify_completed_cls, connection,
109 &connection->client_context,
110 MHD_REQUEST_TERMINATED_COMPLETED_OK);
111}
112
113/**
114 * This function is called once a secure connection has been marked
115 * for closure.
116 * 93 *
117 * @param connection: the connection to close 94 * @param connection: the connection to close
118 * @param termination_code: the termination code with which the notify completed callback function is called. 95 * @param termination_code: the termination code with which the notify completed callback function is called.
119 */ 96 */
120static void 97static void
121MHD_tls_connection_close_err (struct MHD_Connection *connection, 98MHD_tls_connection_close (struct MHD_Connection *connection,
122 enum MHD_RequestTerminationCode 99 enum MHD_RequestTerminationCode
123 termination_code) 100 termination_code)
124{ 101{
102 MHD_gnutls_bye (connection->tls_session, GNUTLS_SHUT_WR);
125 connection->tls_session->internals.read_eof = 1; 103 connection->tls_session->internals.read_eof = 1;
126 SHUTDOWN (connection->socket_fd, SHUT_RDWR); 104 SHUTDOWN (connection->socket_fd, SHUT_RDWR);
127 CLOSE (connection->socket_fd); 105 CLOSE (connection->socket_fd);
128 connection->socket_fd = -1; 106 connection->socket_fd = -1;
129
130 connection->state = MHD_CONNECTION_CLOSED; 107 connection->state = MHD_CONNECTION_CLOSED;
131 if (connection->daemon->notify_completed != NULL) 108 if (connection->daemon->notify_completed != NULL)
132 connection->daemon->notify_completed (connection->daemon-> 109 connection->daemon->notify_completed (connection->daemon->
@@ -135,39 +112,6 @@ MHD_tls_connection_close_err (struct MHD_Connection *connection,
135 termination_code); 112 termination_code);
136} 113}
137 114
138
139/**
140 * @name : MHDS_con_read
141 *
142 * reads data from the TLS record protocol
143 * @param connection: is a %MHD_Connection structure.
144 * @return: number of bytes received and zero on EOF. A negative
145 * error code is returned in case of an error.
146 **/
147static ssize_t
148MHDS_con_read (struct MHD_Connection *connection)
149{
150 /* no special handling when GNUTLS_E_AGAIN is returned since this function is called from within a select loop */
151 ssize_t size = MHD_gnutls_record_recv (connection->tls_session,
152 &connection->read_buffer
153 [connection->read_buffer_offset],
154 connection->read_buffer_size);
155 return size;
156}
157
158static ssize_t
159MHDS_con_write (struct MHD_Connection *connection)
160{
161 ssize_t sent = MHD_gnutls_record_send (connection->tls_session,
162 &connection->write_buffer
163 [connection->
164 write_buffer_send_offset],
165 connection->write_buffer_append_offset
166 -
167 connection->write_buffer_send_offset);
168 return sent;
169}
170
171/** 115/**
172 * This function was created to handle per-connection processing that 116 * This function was created to handle per-connection processing that
173 * has to happen even if the socket cannot be read or written to. All 117 * has to happen even if the socket cannot be read or written to. All
@@ -187,16 +131,14 @@ MHD_tls_connection_handle_idle (struct MHD_Connection *connection)
187 MHD_DLOG (connection->daemon, "%s: state: %s\n", 131 MHD_DLOG (connection->daemon, "%s: state: %s\n",
188 __FUNCTION__, MHD_state_to_string (connection->state)); 132 __FUNCTION__, MHD_state_to_string (connection->state));
189#endif 133#endif
190
191 timeout = connection->daemon->connection_timeout; 134 timeout = connection->daemon->connection_timeout;
192 if ((connection->socket_fd != -1) && (timeout != 0) 135 if ((connection->socket_fd != -1) && (timeout != 0)
193 && (time (NULL) - timeout > connection->last_activity)) 136 && (time (NULL) - timeout > connection->last_activity))
194 { 137 {
195 MHD_tls_connection_close_err (connection, 138 MHD_tls_connection_close (connection,
196 MHD_REQUEST_TERMINATED_TIMEOUT_REACHED); 139 MHD_REQUEST_TERMINATED_TIMEOUT_REACHED);
197 return MHD_NO; 140 return MHD_NO;
198 } 141 }
199
200 switch (connection->state) 142 switch (connection->state)
201 { 143 {
202 /* on newly created connections we might reach here before any reply has been received */ 144 /* on newly created connections we might reach here before any reply has been received */
@@ -205,10 +147,11 @@ MHD_tls_connection_handle_idle (struct MHD_Connection *connection)
205 /* close connection if necessary */ 147 /* close connection if necessary */
206 case MHD_CONNECTION_CLOSED: 148 case MHD_CONNECTION_CLOSED:
207 if (connection->socket_fd != -1) 149 if (connection->socket_fd != -1)
208 MHD_tls_connection_close (connection); 150 MHD_tls_connection_close (connection,
151 MHD_REQUEST_TERMINATED_COMPLETED_OK);
209 return MHD_NO; 152 return MHD_NO;
210 case MHD_TLS_HANDSHAKE_FAILED: 153 case MHD_TLS_HANDSHAKE_FAILED:
211 MHD_tls_connection_close_err (connection, 154 MHD_tls_connection_close (connection,
212 MHD_TLS_REQUEST_TERMINATED_WITH_ERROR); 155 MHD_TLS_REQUEST_TERMINATED_WITH_ERROR);
213 return MHD_NO; 156 return MHD_NO;
214 /* some HTTP state */ 157 /* some HTTP state */
@@ -293,14 +236,14 @@ MHD_tls_connection_handle_read (struct MHD_Connection *connection)
293 MHD_DLOG (connection->daemon, 236 MHD_DLOG (connection->daemon,
294 "Error: received handshake message out of context\n"); 237 "Error: received handshake message out of context\n");
295#endif 238#endif
296 MHD_tls_connection_close_err (connection, 239 MHD_tls_connection_close (connection,
297 MHD_TLS_REQUEST_TERMINATED_WITH_ERROR); 240 MHD_TLS_REQUEST_TERMINATED_WITH_ERROR);
298 return MHD_NO; 241 return MHD_NO;
299 } 242 }
300 243
301 /* ignore any out of bound change chiper spec messages */ 244 /* ignore any out of bound change chiper spec messages */
302 case GNUTLS_CHANGE_CIPHER_SPEC: 245 case GNUTLS_CHANGE_CIPHER_SPEC:
303 MHD_tls_connection_close_err (connection, 246 MHD_tls_connection_close (connection,
304 MHD_TLS_REQUEST_TERMINATED_WITH_ERROR); 247 MHD_TLS_REQUEST_TERMINATED_WITH_ERROR);
305 return MHD_NO; 248 return MHD_NO;
306 249
@@ -335,8 +278,8 @@ MHD_tls_connection_handle_read (struct MHD_Connection *connection)
335 else if (connection->tls_session->internals.last_alert_level == 278 else if (connection->tls_session->internals.last_alert_level ==
336 GNUTLS_AL_FATAL) 279 GNUTLS_AL_FATAL)
337 { 280 {
338 MHD_tls_connection_close_err (connection, 281 MHD_tls_connection_close (connection,
339 MHD_TLS_REQUEST_TERMINATED_WITH_FATAL_ALERT); 282 MHD_TLS_REQUEST_TERMINATED_WITH_FATAL_ALERT);
340 return MHD_NO; 283 return MHD_NO;
341 } 284 }
342 /* this should never execute */ 285 /* this should never execute */
@@ -400,16 +343,13 @@ MHD_tls_connection_handle_write (struct MHD_Connection *connection)
400 return MHD_NO; 343 return MHD_NO;
401} 344}
402 345
403/* 346/**
404 * set connection callback function to be used through out 347 * Set connection callback function to be used through out
405 * the processing of this secure connection. 348 * the processing of this secure connection.
406 *
407 */ 349 */
408void 350void
409MHD_set_https_calbacks (struct MHD_Connection *connection) 351MHD_set_https_calbacks (struct MHD_Connection *connection)
410{ 352{
411 connection->recv_cls = &MHDS_con_read;
412 connection->send_cls = &MHDS_con_write;
413 connection->read_handler = &MHD_tls_connection_handle_read; 353 connection->read_handler = &MHD_tls_connection_handle_read;
414 connection->write_handler = &MHD_tls_connection_handle_write; 354 connection->write_handler = &MHD_tls_connection_handle_write;
415 connection->idle_handler = &MHD_tls_connection_handle_idle; 355 connection->idle_handler = &MHD_tls_connection_handle_idle;
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index 7911be33..34a94922 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -60,7 +60,65 @@
60#define DEBUG_CONNECT MHD_NO 60#define DEBUG_CONNECT MHD_NO
61 61
62#if HTTPS_SUPPORT 62#if HTTPS_SUPPORT
63/* TODO unite with code in gnutls_priority.c */ 63/**
64 * Note: code duplication with code in gnutls_priority.c
65 *
66 * @return 0
67 */
68static int
69_set_priority (mhd_gtls_priority_st * st, const int *list)
70{
71 int num = 0;
72
73 while ( (list[num] != 0) &&
74 (num < MAX_ALGOS) )
75 num++;
76 st->num_algorithms = num;
77 memcpy(st->priority, list, num * sizeof(int));
78 return 0;
79}
80
81
82/**
83 * Callback for receiving data from the socket.
84 *
85 * @param conn the MHD connection structure
86 * @param other where to write received data to
87 * @param i maximum size of other (in bytes)
88 * @return number of bytes actually received
89 */
90static ssize_t
91recv_tls_adapter (struct MHD_Connection* connection,
92 void *other,
93 size_t i)
94{
95 return MHD_gnutls_record_recv(connection->tls_session,
96 other, i);
97}
98
99/**
100 * Callback for writing data to the socket.
101 *
102 * @param conn the MHD connection structure
103 * @param other data to write
104 * @param i number of bytes to write
105 * @return actual number of bytes written
106 */
107static ssize_t
108send_tls_adapter (struct MHD_Connection* connection,
109 const void *other,
110 size_t i)
111{
112 return MHD_gnutls_record_send(connection->tls_session,
113 other, i);
114}
115
116
117/**
118 * Read and setup our certificate and key.
119 *
120 * @return 0 on success
121 */
64static int 122static int
65MHD_init_daemon_certificate (struct MHD_Daemon *daemon) 123MHD_init_daemon_certificate (struct MHD_Daemon *daemon)
66{ 124{
@@ -132,27 +190,25 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon)
132} 190}
133 191
134/** 192/**
135 * initialize security aspects of the HTTPS daemon 193 * Initialize security aspects of the HTTPS daemon
194 *
195 * @return 0 on success
136 */ 196 */
137static int 197static int
138MHD_TLS_init (struct MHD_Daemon *daemon) 198MHD_TLS_init (struct MHD_Daemon *daemon)
139{ 199{
140 int ret;
141
142 switch (daemon->cred_type) 200 switch (daemon->cred_type)
143 { 201 {
144 case MHD_GNUTLS_CRD_ANON: 202 case MHD_GNUTLS_CRD_ANON:
145 ret = MHD_gnutls_anon_allocate_server_credentials (&daemon->anon_cred); 203 if ( (0 != MHD_gnutls_anon_allocate_server_credentials (&daemon->anon_cred)) ||
146 ret |= MHD_gnutls_dh_params_init (&daemon->dh_params); 204 (0 != MHD_gnutls_dh_params_init (&daemon->dh_params)) )
147 if (ret != 0)
148 return GNUTLS_E_MEMORY_ERROR; 205 return GNUTLS_E_MEMORY_ERROR;
149 MHD_gnutls_dh_params_generate2 (daemon->dh_params, 1024); 206 MHD_gnutls_dh_params_generate2 (daemon->dh_params, 1024);
150 MHD_gnutls_anon_set_server_dh_params (daemon->anon_cred, 207 MHD_gnutls_anon_set_server_dh_params (daemon->anon_cred,
151 daemon->dh_params); 208 daemon->dh_params);
152 return 0; 209 return 0;
153 case MHD_GNUTLS_CRD_CERTIFICATE: 210 case MHD_GNUTLS_CRD_CERTIFICATE:
154 ret = MHD_gnutls_certificate_allocate_credentials (&daemon->x509_cred); 211 if (0 != MHD_gnutls_certificate_allocate_credentials (&daemon->x509_cred))
155 if (ret != 0)
156 return GNUTLS_E_MEMORY_ERROR; 212 return GNUTLS_E_MEMORY_ERROR;
157 return MHD_init_daemon_certificate (daemon); 213 return MHD_init_daemon_certificate (daemon);
158 default: 214 default:
@@ -164,19 +220,6 @@ MHD_TLS_init (struct MHD_Daemon *daemon)
164 return -1; 220 return -1;
165 } 221 }
166} 222}
167
168static int
169_set_priority (mhd_gtls_priority_st * st, const int *list)
170{
171 int num = 0;
172
173 while ( (list[num] != 0) &&
174 (num < MAX_ALGOS) )
175 num++;
176 st->num_algorithms = num;
177 memcpy(st->priority, list, num * sizeof(int));
178 return 0;
179}
180#endif 223#endif
181 224
182/** 225/**
@@ -292,9 +335,8 @@ MHD_handle_connection (void *data)
292 return NULL; 335 return NULL;
293} 336}
294 337
295#if HTTPS_SUPPORT
296/** 338/**
297 * Callback for receiving data from the socket (for gnutls). 339 * Callback for receiving data from the socket.
298 * 340 *
299 * @param conn the MHD connection structure 341 * @param conn the MHD connection structure
300 * @param other where to write received data to 342 * @param other where to write received data to
@@ -302,19 +344,17 @@ MHD_handle_connection (void *data)
302 * @return number of bytes actually received 344 * @return number of bytes actually received
303 */ 345 */
304static ssize_t 346static ssize_t
305pull_param_adapter (gnutls_transport_ptr_t conn, 347recv_param_adapter (struct MHD_Connection * connection,
306 void *other, 348 void *other,
307 size_t i) 349 size_t i)
308{ 350{
309 struct MHD_Connection * connection = (struct MHD_Connection*) conn;
310
311 if (connection->socket_fd == -1) 351 if (connection->socket_fd == -1)
312 return -1; 352 return -1;
313 return RECV(connection->socket_fd, other, i, MSG_NOSIGNAL); 353 return RECV(connection->socket_fd, other, i, MSG_NOSIGNAL);
314} 354}
315 355
316/** 356/**
317 * Callback for writing data to the socket (for gnutls). 357 * Callback for writing data to the socket.
318 * 358 *
319 * @param conn the MHD connection structure 359 * @param conn the MHD connection structure
320 * @param other data to write 360 * @param other data to write
@@ -322,61 +362,16 @@ pull_param_adapter (gnutls_transport_ptr_t conn,
322 * @return actual number of bytes written 362 * @return actual number of bytes written
323 */ 363 */
324static ssize_t 364static ssize_t
325push_param_adapter (void *conn, 365send_param_adapter (struct MHD_Connection *connection,
326 const void *other, 366 const void *other,
327 size_t i) 367 size_t i)
328{ 368{
329 struct MHD_Connection * connection = (struct MHD_Connection*) conn;
330
331 if (connection->socket_fd == -1) 369 if (connection->socket_fd == -1)
332 return -1; 370 return -1;
333 return SEND(connection->socket_fd, other, i, MSG_NOSIGNAL); 371 return SEND(connection->socket_fd, other, i, MSG_NOSIGNAL);
334} 372}
335 373
336/** 374/**
337 * Handle an individual TLS connection (main function
338 * of the thread handling a TLS connection).
339 */
340static void *
341MHD_TLS_init_connection (void *data)
342{
343 struct MHD_Connection *con = data;
344
345 EXTRA_CHECK (con->state == MHD_CONNECTION_INIT);
346 con->state = MHD_TLS_CONNECTION_INIT;
347 MHD_gnutls_init (&con->tls_session, GNUTLS_SERVER);
348 MHD_gnutls_priority_set (con->tls_session, con->daemon->priority_cache);
349 switch (con->daemon->cred_type)
350 {
351 /* set needed credentials for certificate authentication. */
352 case MHD_GNUTLS_CRD_CERTIFICATE:
353 MHD_gnutls_credentials_set (con->tls_session,
354 MHD_GNUTLS_CRD_CERTIFICATE,
355 con->daemon->x509_cred);
356 break;
357 case MHD_GNUTLS_CRD_ANON:
358 /* set needed credentials for anonymous authentication. */
359 MHD_gnutls_credentials_set (con->tls_session, MHD_GNUTLS_CRD_ANON,
360 con->daemon->anon_cred);
361 MHD_gnutls_dh_set_prime_bits (con->tls_session, 1024);
362 break;
363 default:
364#if HAVE_MESSAGES
365 MHD_DLOG (con->daemon,
366 "Failed to setup TLS credentials: unknown credential type %d\n",
367 con->daemon->cred_type);
368#endif
369 abort();
370 }
371 MHD_gnutls_transport_set_ptr (con->tls_session,
372 (gnutls_transport_ptr_t) con);
373 MHD_gnutls_transport_set_pull_function(con->tls_session, &pull_param_adapter);
374 MHD_gnutls_transport_set_push_function(con->tls_session, &push_param_adapter);
375 return MHD_handle_connection (data);
376}
377#endif
378
379/**
380 * Accept an incoming connection and create the MHD_Connection object for 375 * Accept an incoming connection and create the MHD_Connection object for
381 * it. This function also enforces policy by way of checking with the 376 * it. This function also enforces policy by way of checking with the
382 * accept policy callback. 377 * accept policy callback.
@@ -519,19 +514,52 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
519 514
520 /* set default connection handlers */ 515 /* set default connection handlers */
521 MHD_set_http_calbacks (connection); 516 MHD_set_http_calbacks (connection);
517 connection->recv_cls = &recv_param_adapter;
518 connection->send_cls = &send_param_adapter;
522#if HTTPS_SUPPORT 519#if HTTPS_SUPPORT
523 if (0 != (daemon->options & MHD_USE_SSL)) 520 if (0 != (daemon->options & MHD_USE_SSL))
524 MHD_set_https_calbacks (connection); 521 {
522 connection->recv_cls = &recv_tls_adapter;
523 connection->send_cls = &send_tls_adapter;
524 connection->state = MHD_TLS_CONNECTION_INIT;
525 MHD_set_https_calbacks (connection);
526 MHD_gnutls_init (&connection->tls_session, GNUTLS_SERVER);
527 MHD_gnutls_priority_set (connection->tls_session, connection->daemon->priority_cache);
528 switch (connection->daemon->cred_type)
529 {
530 /* set needed credentials for certificate authentication. */
531 case MHD_GNUTLS_CRD_CERTIFICATE:
532 MHD_gnutls_credentials_set (connection->tls_session,
533 MHD_GNUTLS_CRD_CERTIFICATE,
534 connection->daemon->x509_cred);
535 break;
536 case MHD_GNUTLS_CRD_ANON:
537 /* set needed credentials for anonymous authentication. */
538 MHD_gnutls_credentials_set (connection->tls_session, MHD_GNUTLS_CRD_ANON,
539 connection->daemon->anon_cred);
540 MHD_gnutls_dh_set_prime_bits (connection->tls_session, 1024);
541 break;
542 default:
543#if HAVE_MESSAGES
544 MHD_DLOG (connection->daemon,
545 "Failed to setup TLS credentials: unknown credential type %d\n",
546 connection->daemon->cred_type);
547#endif
548 abort();
549 }
550 MHD_gnutls_transport_set_ptr (connection->tls_session,
551 (gnutls_transport_ptr_t) connection);
552 MHD_gnutls_transport_set_pull_function(connection->tls_session,
553 (mhd_gtls_pull_func) &recv_param_adapter);
554 MHD_gnutls_transport_set_push_function(connection->tls_session,
555 (mhd_gtls_push_func) &send_param_adapter);
556 }
525#endif 557#endif
526 558
527 /* attempt to create handler thread */ 559 /* attempt to create handler thread */
528 if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) 560 if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
529 { 561 {
530 res_thread_create = pthread_create (&connection->pid, NULL, 562 res_thread_create = pthread_create (&connection->pid, NULL,
531#if HTTPS_SUPPORT
532 (0 != (daemon->options & MHD_USE_SSL)) ?
533 &MHD_TLS_init_connection :
534#endif
535 &MHD_handle_connection, 563 &MHD_handle_connection,
536 connection); 564 connection);
537 if (res_thread_create != 0) 565 if (res_thread_create != 0)
@@ -855,7 +883,6 @@ MHD_start_daemon_va (unsigned int options,
855 retVal->max_connections = MHD_MAX_CONNECTIONS_DEFAULT; 883 retVal->max_connections = MHD_MAX_CONNECTIONS_DEFAULT;
856 retVal->pool_size = MHD_POOL_SIZE_DEFAULT; 884 retVal->pool_size = MHD_POOL_SIZE_DEFAULT;
857 retVal->connection_timeout = 0; /* no timeout */ 885 retVal->connection_timeout = 0; /* no timeout */
858
859#if HTTPS_SUPPORT 886#if HTTPS_SUPPORT
860 if (options & MHD_USE_SSL) 887 if (options & MHD_USE_SSL)
861 { 888 {
@@ -931,13 +958,13 @@ MHD_start_daemon_va (unsigned int options,
931 if ((opt >= MHD_OPTION_HTTPS_KEY_PATH) && 958 if ((opt >= MHD_OPTION_HTTPS_KEY_PATH) &&
932 (opt <= MHD_OPTION_TLS_COMP_ALGO)) 959 (opt <= MHD_OPTION_TLS_COMP_ALGO))
933 { 960 {
934 fprintf (stderr, 961 FPRINTF (stderr,
935 "MHD HTTPS option %d passed to MHD compiled without HTTPS support\n", 962 "MHD HTTPS option %d passed to MHD compiled without HTTPS support\n",
936 opt); 963 opt);
937 } 964 }
938 else 965 else
939 { 966 {
940 fprintf (stderr, 967 FPRINTF (stderr,
941 "Invalid option %d! (Did you terminate the list with MHD_OPTION_END?)\n", 968 "Invalid option %d! (Did you terminate the list with MHD_OPTION_END?)\n",
942 opt); 969 opt);
943 } 970 }
@@ -954,7 +981,7 @@ MHD_start_daemon_va (unsigned int options,
954 { 981 {
955#if HAVE_MESSAGES 982#if HAVE_MESSAGES
956 if ((options & MHD_USE_DEBUG) != 0) 983 if ((options & MHD_USE_DEBUG) != 0)
957 fprintf (stderr, "Call to socket failed: %s\n", STRERROR (errno)); 984 FPRINTF (stderr, "Call to socket failed: %s\n", STRERROR (errno));
958#endif 985#endif
959 free (retVal); 986 free (retVal);
960 return NULL; 987 return NULL;
@@ -965,7 +992,7 @@ MHD_start_daemon_va (unsigned int options,
965 &on, sizeof (on)) < 0) && (options & MHD_USE_DEBUG) != 0) 992 &on, sizeof (on)) < 0) && (options & MHD_USE_DEBUG) != 0)
966 { 993 {
967#if HAVE_MESSAGES 994#if HAVE_MESSAGES
968 fprintf (stderr, "setsockopt failed: %s\n", STRERROR (errno)); 995 FPRINTF (stderr, "setsockopt failed: %s\n", STRERROR (errno));
969#endif 996#endif
970 } 997 }
971 998
@@ -996,7 +1023,7 @@ MHD_start_daemon_va (unsigned int options,
996 { 1023 {
997#if HAVE_MESSAGES 1024#if HAVE_MESSAGES
998 if ((options & MHD_USE_DEBUG) != 0) 1025 if ((options & MHD_USE_DEBUG) != 0)
999 fprintf (stderr, 1026 FPRINTF (stderr,
1000 "Failed to bind to port %u: %s\n", port, STRERROR (errno)); 1027 "Failed to bind to port %u: %s\n", port, STRERROR (errno));
1001#endif 1028#endif
1002 CLOSE (socket_fd); 1029 CLOSE (socket_fd);
@@ -1009,7 +1036,7 @@ MHD_start_daemon_va (unsigned int options,
1009 { 1036 {
1010#if HAVE_MESSAGES 1037#if HAVE_MESSAGES
1011 if ((options & MHD_USE_DEBUG) != 0) 1038 if ((options & MHD_USE_DEBUG) != 0)
1012 fprintf (stderr, 1039 FPRINTF (stderr,
1013 "Failed to listen for connections: %s\n", STRERROR (errno)); 1040 "Failed to listen for connections: %s\n", STRERROR (errno));
1014#endif 1041#endif
1015 CLOSE (socket_fd); 1042 CLOSE (socket_fd);
@@ -1019,7 +1046,8 @@ MHD_start_daemon_va (unsigned int options,
1019 1046
1020#if HTTPS_SUPPORT 1047#if HTTPS_SUPPORT
1021 /* initialize HTTPS daemon certificate aspects & send / recv functions */ 1048 /* initialize HTTPS daemon certificate aspects & send / recv functions */
1022 if ((options & MHD_USE_SSL) && MHD_TLS_init (retVal)) 1049 if ( (0 != (options & MHD_USE_SSL)) &&
1050 (0 != MHD_TLS_init (retVal)) )
1023 { 1051 {
1024#if HAVE_MESSAGES 1052#if HAVE_MESSAGES
1025 MHD_DLOG (retVal, "Failed to initialize TLS support\n"); 1053 MHD_DLOG (retVal, "Failed to initialize TLS support\n");
diff --git a/src/daemon/https/tls/gnutls_buffers.c b/src/daemon/https/tls/gnutls_buffers.c
index da44e87c..16be8011 100644
--- a/src/daemon/https/tls/gnutls_buffers.c
+++ b/src/daemon/https/tls/gnutls_buffers.c
@@ -487,6 +487,7 @@ mhd_gtls_io_read_buffered (mhd_gtls_session_t session, opaque ** iptr,
487 if (sizeOfPtr > MAX_RECV_SIZE || sizeOfPtr == 0) 487 if (sizeOfPtr > MAX_RECV_SIZE || sizeOfPtr == 0)
488 { 488 {
489 gnutls_assert (); /* internal error */ 489 gnutls_assert (); /* internal error */
490 printf("AT %u\n", __LINE__);
490 return GNUTLS_E_INVALID_REQUEST; 491 return GNUTLS_E_INVALID_REQUEST;
491 } 492 }
492 493
@@ -537,6 +538,7 @@ mhd_gtls_io_read_buffered (mhd_gtls_session_t session, opaque ** iptr,
537 > MAX_RECV_SIZE) 538 > MAX_RECV_SIZE)
538 { 539 {
539 gnutls_assert (); /* internal error */ 540 gnutls_assert (); /* internal error */
541 printf("AT %u\n", __LINE__);
540 return GNUTLS_E_INVALID_REQUEST; 542 return GNUTLS_E_INVALID_REQUEST;
541 } 543 }
542 544
@@ -549,12 +551,14 @@ mhd_gtls_io_read_buffered (mhd_gtls_session_t session, opaque ** iptr,
549 if (session->internals.record_recv_buffer.data == NULL) 551 if (session->internals.record_recv_buffer.data == NULL)
550 { 552 {
551 gnutls_assert (); 553 gnutls_assert ();
554 printf("AT %u\n", __LINE__);
552 return GNUTLS_E_MEMORY_ERROR; 555 return GNUTLS_E_MEMORY_ERROR;
553 } 556 }
554 557
555 buf_pos = session->internals.record_recv_buffer.length; 558 buf_pos = session->internals.record_recv_buffer.length;
556 buf = session->internals.record_recv_buffer.data; 559 buf = session->internals.record_recv_buffer.data;
557 *iptr = buf; 560 *iptr = buf;
561 printf("AT %u\n", __LINE__);
558 562
559 /* READ DATA - but leave RCVLOWAT bytes in the kernel buffer. */ 563 /* READ DATA - but leave RCVLOWAT bytes in the kernel buffer. */
560 if (recvdata - recvlowat > 0) 564 if (recvdata - recvlowat > 0)
@@ -566,6 +570,7 @@ mhd_gtls_io_read_buffered (mhd_gtls_session_t session, opaque ** iptr,
566 */ 570 */
567 if (ret < 0 && MHD_gtls_error_is_fatal (ret) == 0) 571 if (ret < 0 && MHD_gtls_error_is_fatal (ret) == 0)
568 { 572 {
573 printf("AT %u\n", __LINE__);
569 return ret; 574 return ret;
570 } 575 }
571 } 576 }
@@ -593,6 +598,7 @@ mhd_gtls_io_read_buffered (mhd_gtls_session_t session, opaque ** iptr,
593 598
594 if (ret2 < 0 && MHD_gtls_error_is_fatal (ret2) == 0) 599 if (ret2 < 0 && MHD_gtls_error_is_fatal (ret2) == 0)
595 { 600 {
601 printf("AT %u\n", __LINE__);
596 return ret2; 602 return ret2;
597 } 603 }
598 604
@@ -612,6 +618,7 @@ mhd_gtls_io_read_buffered (mhd_gtls_session_t session, opaque ** iptr,
612 { 618 {
613 gnutls_assert (); 619 gnutls_assert ();
614 /* that's because they are initialized to 0 */ 620 /* that's because they are initialized to 0 */
621 printf("AT %u\n", __LINE__);
615 return MIN (ret, ret2); 622 return MIN (ret, ret2);
616 } 623 }
617 624
@@ -620,12 +627,14 @@ mhd_gtls_io_read_buffered (mhd_gtls_session_t session, opaque ** iptr,
620 if (ret > 0 && ret < recvlowat) 627 if (ret > 0 && ret < recvlowat)
621 { 628 {
622 gnutls_assert (); 629 gnutls_assert ();
630 printf("AT %u\n", __LINE__);
623 return GNUTLS_E_AGAIN; 631 return GNUTLS_E_AGAIN;
624 } 632 }
625 633
626 if (ret == 0) 634 if (ret == 0)
627 { /* EOF */ 635 { /* EOF */
628 gnutls_assert (); 636 gnutls_assert ();
637 printf("AT %u\n", __LINE__);
629 return 0; 638 return 0;
630 } 639 }
631 640
@@ -635,10 +644,12 @@ mhd_gtls_io_read_buffered (mhd_gtls_session_t session, opaque ** iptr,
635 { 644 {
636 /* Short Read */ 645 /* Short Read */
637 gnutls_assert (); 646 gnutls_assert ();
647 printf("AT %u\n", __LINE__);
638 return GNUTLS_E_AGAIN; 648 return GNUTLS_E_AGAIN;
639 } 649 }
640 else 650 else
641 { 651 {
652 printf("AT %u\n", __LINE__);
642 return ret; 653 return ret;
643 } 654 }
644} 655}
diff --git a/src/daemon/internal.h b/src/daemon/internal.h
index c2d6ab0b..76c17dbc 100644
--- a/src/daemon/internal.h
+++ b/src/daemon/internal.h
@@ -305,6 +305,33 @@ enum MHD_CONNECTION_STATE
305char *MHD_state_to_string (enum MHD_CONNECTION_STATE state); 305char *MHD_state_to_string (enum MHD_CONNECTION_STATE state);
306#endif 306#endif
307 307
308/**
309 * Function to receive plaintext data.
310 *
311 * @param conn the connection struct
312 * @param write_to where to write received data
313 * @param max_bytes maximum number of bytes to receive
314 * @return number of bytes written to write_to
315 */
316typedef ssize_t (*ReceiveCallback)(struct MHD_Connection * conn,
317 void * write_to,
318 size_t max_bytes);
319
320
321/**
322 * Function to transmit plaintext data.
323 *
324 * @param conn the connection struct
325 * @param read_from where to read data to transmit
326 * @param max_bytes maximum number of bytes to transmit
327 * @return number of bytes transmitted
328 */
329typedef ssize_t (*TransmitCallback)(struct MHD_Connection * conn,
330 const void * write_to,
331 size_t max_bytes);
332
333
334
308struct MHD_Connection 335struct MHD_Connection
309{ 336{
310 337
@@ -538,13 +565,9 @@ struct MHD_Connection
538 565
539 int (*idle_handler) (struct MHD_Connection * connection); 566 int (*idle_handler) (struct MHD_Connection * connection);
540 567
541 /** 568 ReceiveCallback recv_cls;
542 * function pointers to the appropriate send & receive funtions 569
543 * according to whether this is a HTTPS / HTTP daemon 570 TransmitCallback send_cls;
544 */
545 ssize_t (*recv_cls) (struct MHD_Connection * connection);
546
547 ssize_t (*send_cls) (struct MHD_Connection * connection);
548 571
549#if HTTPS_SUPPORT 572#if HTTPS_SUPPORT
550 /* TODO rename as this might be an SSL connection */ 573 /* TODO rename as this might be an SSL connection */