diff options
| author | Paul Eggert | 2015-09-25 00:21:58 -0700 |
|---|---|---|
| committer | Paul Eggert | 2015-09-25 00:23:18 -0700 |
| commit | 1657ba799a873a7758219dc0bdebf6ab91908fa2 (patch) | |
| tree | 3605280690680eb218a5353dff1d981ae112593b | |
| parent | da38b6a7cdcdc7670a3e9088777b3f2829b08bbd (diff) | |
| download | emacs-1657ba799a873a7758219dc0bdebf6ab91908fa2.tar.gz emacs-1657ba799a873a7758219dc0bdebf6ab91908fa2.zip | |
Merge from gnulib
This incorporates:
2015-09-25 c-ctype: rewrite to use inline functions
2015-09-24 maint: add coding cookies to non-ASCII sources
2015-09-24 gitlog-to-changelog: trim only trailing whitespaces
* build-aux/gitlog-to-changelog, doc/misc/texinfo.tex:
* lib/acl-internal.c, lib/acl-internal.h, lib/c-ctype.c:
* lib/c-ctype.h, lib/get-permissions.c, lib/qcopy-acl.c:
* lib/set-permissions.c:
Copy from gnulib.
| -rwxr-xr-x | build-aux/gitlog-to-changelog | 2 | ||||
| -rw-r--r-- | doc/misc/texinfo.tex | 602 | ||||
| -rw-r--r-- | lib/acl-internal.c | 2 | ||||
| -rw-r--r-- | lib/acl-internal.h | 2 | ||||
| -rw-r--r-- | lib/c-ctype.c | 394 | ||||
| -rw-r--r-- | lib/c-ctype.h | 850 | ||||
| -rw-r--r-- | lib/get-permissions.c | 2 | ||||
| -rw-r--r-- | lib/qcopy-acl.c | 2 | ||||
| -rw-r--r-- | lib/set-permissions.c | 2 |
9 files changed, 1083 insertions, 775 deletions
diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog index 0cab1bf17cd..a0e0a05df8f 100755 --- a/build-aux/gitlog-to-changelog +++ b/build-aux/gitlog-to-changelog | |||
| @@ -333,7 +333,7 @@ sub git_dir_option($) | |||
| 333 | $rest =~ s/^\s*\(cherry picked from commit [\da-f]+\)\n//m; | 333 | $rest =~ s/^\s*\(cherry picked from commit [\da-f]+\)\n//m; |
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | my @line = split /\s*\n/, $rest; | 336 | my @line = split /[ \t]*\n/, $rest; |
| 337 | my $author_line = shift @line; | 337 | my $author_line = shift @line; |
| 338 | defined $author_line | 338 | defined $author_line |
| 339 | or die "$ME:$.: unexpected EOF\n"; | 339 | or die "$ME:$.: unexpected EOF\n"; |
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index aaabbc9c9f5..bff8eb017a0 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex | |||
| @@ -3,7 +3,7 @@ | |||
| 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{2015-09-05.20} | 6 | \def\texinfoversion{2015-09-20.17} |
| 7 | % | 7 | % |
| 8 | % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, | 8 | % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, |
| 9 | % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, | 9 | % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
| @@ -196,17 +196,6 @@ | |||
| 196 | wide-spread wrap-around | 196 | wide-spread wrap-around |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | % Margin to add to right of even pages, to left of odd pages. | ||
| 200 | \newdimen\bindingoffset | ||
| 201 | \newdimen\normaloffset | ||
| 202 | \newdimen\pagewidth \newdimen\pageheight | ||
| 203 | |||
| 204 | % For a final copy, take out the rectangles | ||
| 205 | % that mark overfull boxes (in case you have decided | ||
| 206 | % that the text looks ok even though it passes the margin). | ||
| 207 | % | ||
| 208 | \def\finalout{\overfullrule=0pt } | ||
| 209 | |||
| 210 | % Sometimes it is convenient to have everything in the transcript file | 199 | % Sometimes it is convenient to have everything in the transcript file |
| 211 | % and nothing on the terminal. We don't just call \tracingall here, | 200 | % and nothing on the terminal. We don't just call \tracingall here, |
| 212 | % since that produces some useless output on the terminal. We also make | 201 | % since that produces some useless output on the terminal. We also make |
| @@ -251,6 +240,15 @@ | |||
| 251 | \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount | 240 | \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount |
| 252 | \removelastskip\penalty-200\bigskip\fi\fi} | 241 | \removelastskip\penalty-200\bigskip\fi\fi} |
| 253 | 242 | ||
| 243 | % Output routine | ||
| 244 | % | ||
| 245 | |||
| 246 | % For a final copy, take out the rectangles | ||
| 247 | % that mark overfull boxes (in case you have decided | ||
| 248 | % that the text looks ok even though it passes the margin). | ||
| 249 | % | ||
| 250 | \def\finalout{\overfullrule=0pt } | ||
| 251 | |||
| 254 | % Do @cropmarks to get crop marks. | 252 | % Do @cropmarks to get crop marks. |
| 255 | % | 253 | % |
| 256 | \newif\ifcropmarks | 254 | \newif\ifcropmarks |
| @@ -290,6 +288,9 @@ | |||
| 290 | \noexpand\else \the\toks8 % 2: color marks | 288 | \noexpand\else \the\toks8 % 2: color marks |
| 291 | }% | 289 | }% |
| 292 | } | 290 | } |
| 291 | |||
| 292 | % \gettopheadingmarks, \getbottomheadingmarks - extract needed part of mark. | ||
| 293 | % | ||
| 293 | % \topmark doesn't work for the very first chapter (after the title | 294 | % \topmark doesn't work for the very first chapter (after the title |
| 294 | % page or the contents), so we use \firstmark there -- this gets us | 295 | % page or the contents), so we use \firstmark there -- this gets us |
| 295 | % the mark with the chapter defs, unless the user sneaks in, e.g., | 296 | % the mark with the chapter defs, unless the user sneaks in, e.g., |
| @@ -310,6 +311,10 @@ | |||
| 310 | \def\prevsectiondefs{} | 311 | \def\prevsectiondefs{} |
| 311 | \def\lastcolordefs{} | 312 | \def\lastcolordefs{} |
| 312 | 313 | ||
| 314 | % Margin to add to right of even pages, to left of odd pages. | ||
| 315 | \newdimen\bindingoffset | ||
| 316 | \newdimen\normaloffset | ||
| 317 | \newdimen\pagewidth \newdimen\pageheight | ||
| 313 | 318 | ||
| 314 | % Main output routine. | 319 | % Main output routine. |
| 315 | % | 320 | % |
| @@ -319,25 +324,56 @@ | |||
| 319 | \newbox\headlinebox | 324 | \newbox\headlinebox |
| 320 | \newbox\footlinebox | 325 | \newbox\footlinebox |
| 321 | 326 | ||
| 322 | % \onepageout takes a vbox as an argument. Note that \pagecontents | 327 | % \onepageout takes a vbox as an argument. |
| 323 | % does insertions, but you have to call it yourself. | 328 | % \shipout a vbox for a single page, adding an optional header, footer, |
| 329 | % cropmarks, and footnote. This also causes index entries for this page | ||
| 330 | % to be written to the auxiliary files. | ||
| 331 | % | ||
| 324 | \def\onepageout#1{% | 332 | \def\onepageout#1{% |
| 325 | \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi | 333 | \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi |
| 326 | % | 334 | % |
| 327 | \ifodd\pageno \advance\hoffset by \bindingoffset | 335 | \ifodd\pageno \advance\hoffset by \bindingoffset |
| 328 | \else \advance\hoffset by -\bindingoffset\fi | 336 | \else \advance\hoffset by -\bindingoffset\fi |
| 329 | % | 337 | % |
| 338 | % Common context changes for both heading and footing. | ||
| 330 | % 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 |
| 331 | % the headline as they should be, not taken literally (outputting ''code). | 340 | % the headline as they should be, not taken literally (outputting ''code). |
| 332 | \def\commmonheadfootline{\let\hsize=\pagewidth \texinfochars} | 341 | \def\commmonheadfootline{\let\hsize=\pagewidth \texinfochars} |
| 333 | % | 342 | % |
| 334 | \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi | 343 | % Retrieve the information for the headings from the marks in the page, |
| 335 | \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}% | 344 | % and call Plain TeX's \makeheadline and \makefootline, which use the |
| 345 | % values in \headline and \footline. | ||
| 346 | % | ||
| 347 | % This is used to check if we are on the first page of a chapter. | ||
| 348 | \ifcase0\topmark\fi | ||
| 349 | \ifx\thischapter\empty | ||
| 350 | % See comment for \gettopheadingmarks | ||
| 351 | \ifcase0\firstmark\fi | ||
| 352 | \let\curchaptername\thischaptername | ||
| 353 | \ifcase1\firstmark\fi | ||
| 354 | \let\prevchaptername\thischaptername | ||
| 355 | \else | ||
| 356 | \let\curchaptername\thischaptername | ||
| 357 | \ifcase1\topmark\fi | ||
| 358 | \let\prevchaptername\thischaptername | ||
| 359 | \fi | ||
| 336 | % | 360 | % |
| 361 | \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi | ||
| 337 | \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi | 362 | \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi |
| 363 | % | ||
| 364 | \ifx\curchaptername\prevchaptername | ||
| 365 | \else | ||
| 366 | % If on the first page of a chapter, clear @thischapter so it | ||
| 367 | % doesn't appear in the headline, because the chapter is already | ||
| 368 | % shown in the chapter heading. | ||
| 369 | \def\thischapter{}% | ||
| 370 | \fi | ||
| 371 | % | ||
| 372 | \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}% | ||
| 338 | \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}% | 373 | \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}% |
| 339 | % | 374 | % |
| 340 | {% | 375 | {% |
| 376 | % Set context for writing to auxiliary files like index files. | ||
| 341 | % Have to do this stuff outside the \shipout because we want it to | 377 | % Have to do this stuff outside the \shipout because we want it to |
| 342 | % take effect in \write's, yet the group defined by the \vbox ends | 378 | % take effect in \write's, yet the group defined by the \vbox ends |
| 343 | % before the \shipout runs. | 379 | % before the \shipout runs. |
| @@ -407,6 +443,7 @@ | |||
| 407 | 443 | ||
| 408 | \newinsert\margin \dimen\margin=\maxdimen | 444 | \newinsert\margin \dimen\margin=\maxdimen |
| 409 | 445 | ||
| 446 | % Main part of page, including any footnotes | ||
| 410 | \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} | 447 | \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} |
| 411 | {\catcode`\@ =11 | 448 | {\catcode`\@ =11 |
| 412 | \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi | 449 | \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi |
| @@ -690,6 +727,12 @@ | |||
| 690 | \endgraf % Not \par, as it may have been set to \lisppar. | 727 | \endgraf % Not \par, as it may have been set to \lisppar. |
| 691 | \global\dimen1 = \prevdepth | 728 | \global\dimen1 = \prevdepth |
| 692 | \egroup % End the \vtop. | 729 | \egroup % End the \vtop. |
| 730 | \addgroupbox | ||
| 731 | \prevdepth = \dimen1 | ||
| 732 | \checkinserts | ||
| 733 | } | ||
| 734 | |||
| 735 | \def\addgroupbox{ | ||
| 693 | % \dimen0 is the vertical size of the group's box. | 736 | % \dimen0 is the vertical size of the group's box. |
| 694 | \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox | 737 | \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox |
| 695 | % \dimen2 is how much space is left on the page (more or less). | 738 | % \dimen2 is how much space is left on the page (more or less). |
| @@ -702,9 +745,8 @@ | |||
| 702 | \fi | 745 | \fi |
| 703 | \fi | 746 | \fi |
| 704 | \box\groupbox | 747 | \box\groupbox |
| 705 | \prevdepth = \dimen1 | ||
| 706 | \checkinserts | ||
| 707 | } | 748 | } |
| 749 | |||
| 708 | % | 750 | % |
| 709 | % TeX puts in an \escapechar (i.e., `@') at the beginning of the help | 751 | % TeX puts in an \escapechar (i.e., `@') at the beginning of the help |
| 710 | % message, so this ends up printing `@group can only ...'. | 752 | % message, so this ends up printing `@group can only ...'. |
| @@ -1046,32 +1088,8 @@ where each line of input produces a line of output.} | |||
| 1046 | % @refill is a no-op. | 1088 | % @refill is a no-op. |
| 1047 | \let\refill=\relax | 1089 | \let\refill=\relax |
| 1048 | 1090 | ||
| 1049 | % If working on a large document in chapters, it is convenient to | 1091 | % @setfilename INFO-FILENAME - ignored |
| 1050 | % be able to disable indexing, cross-referencing, and contents, for test runs. | 1092 | \let\setfilename=\comment |
| 1051 | % This is done with @novalidate (before @setfilename). | ||
| 1052 | % | ||
| 1053 | \newif\iflinks \linkstrue % by default we want the aux files. | ||
| 1054 | \let\novalidate = \linksfalse | ||
| 1055 | |||
| 1056 | % @setfilename is done at the beginning of every texinfo file. So open | ||
| 1057 | % here some of the files we need to have open while reading the input. | ||
| 1058 | % This makes it possible to make a .fmt file for texinfo. | ||
| 1059 | \def\setfilename{% | ||
| 1060 | \iflinks | ||
| 1061 | \tryauxfile | ||
| 1062 | % Open the new aux file. TeX will close it automatically at exit. | ||
| 1063 | \immediate\openout\auxfile=\jobname.aux | ||
| 1064 | \fi % \openindices needs to do some work in any case. | ||
| 1065 | \let\setfilename=\comment % Ignore extra @setfilename cmds. | ||
| 1066 | % | ||
| 1067 | % If texinfo.cnf is present on the system, read it. | ||
| 1068 | % Useful for site-wide @afourpaper, etc. | ||
| 1069 | \openin 1 texinfo.cnf | ||
| 1070 | \ifeof 1 \else \input texinfo.cnf \fi | ||
| 1071 | \closein 1 | ||
| 1072 | % | ||
| 1073 | \comment % Ignore the actual filename. | ||
| 1074 | } | ||
| 1075 | 1093 | ||
| 1076 | % @bye. | 1094 | % @bye. |
| 1077 | \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} | 1095 | \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} |
| @@ -1825,8 +1843,10 @@ end | |||
| 1825 | % A few fonts for @defun names and args. | 1843 | % A few fonts for @defun names and args. |
| 1826 | \setfont\defbf\bfshape{10}{\magstep1}{OT1} | 1844 | \setfont\defbf\bfshape{10}{\magstep1}{OT1} |
| 1827 | \setfont\deftt\ttshape{10}{\magstep1}{OT1TT} | 1845 | \setfont\deftt\ttshape{10}{\magstep1}{OT1TT} |
| 1846 | \setfont\defsl\slshape{10}{\magstep1}{OT1TT} | ||
| 1828 | \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} | 1847 | \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT} |
| 1829 | \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} | 1848 | \def\df{\let\tentt=\deftt \let\tenbf = \defbf |
| 1849 | \let\tenttsl=\defttsl \let\tensl=\defsl \bf} | ||
| 1830 | 1850 | ||
| 1831 | % Fonts for indices, footnotes, small examples (9pt). | 1851 | % Fonts for indices, footnotes, small examples (9pt). |
| 1832 | \def\smallnominalsize{9pt} | 1852 | \def\smallnominalsize{9pt} |
| @@ -1957,8 +1977,10 @@ end | |||
| 1957 | % A few fonts for @defun names and args. | 1977 | % A few fonts for @defun names and args. |
| 1958 | \setfont\defbf\bfshape{10}{\magstephalf}{OT1} | 1978 | \setfont\defbf\bfshape{10}{\magstephalf}{OT1} |
| 1959 | \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} | 1979 | \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT} |
| 1980 | \setfont\defsl\slshape{10}{\magstephalf}{OT1TT} | ||
| 1960 | \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} | 1981 | \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT} |
| 1961 | \def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} | 1982 | \def\df{\let\tentt=\deftt \let\tenbf = \defbf |
| 1983 | \let\tensl=\defsl \let\tenttsl=\defttsl \bf} | ||
| 1962 | 1984 | ||
| 1963 | % Fonts for indices, footnotes, small examples (9pt). | 1985 | % Fonts for indices, footnotes, small examples (9pt). |
| 1964 | \def\smallnominalsize{9pt} | 1986 | \def\smallnominalsize{9pt} |
| @@ -2777,11 +2799,6 @@ end | |||
| 2777 | % | 2799 | % |
| 2778 | \def\dmn#1{\thinspace #1} | 2800 | \def\dmn#1{\thinspace #1} |
| 2779 | 2801 | ||
| 2780 | % @l was never documented to mean ``switch to the Lisp font'', | ||
| 2781 | % and it is not used as such in any manual I can find. We need it for | ||
| 2782 | % Polish suppressed-l. --karl, 22sep96. | ||
| 2783 | %\def\l#1{{\li #1}\null} | ||
| 2784 | |||
| 2785 | % @acronym for "FBI", "NATO", and the like. | 2802 | % @acronym for "FBI", "NATO", and the like. |
| 2786 | % We print this one point size smaller, since it's intended for | 2803 | % We print this one point size smaller, since it's intended for |
| 2787 | % all-uppercase. | 2804 | % all-uppercase. |
| @@ -3392,7 +3409,7 @@ end | |||
| 3392 | \newtoks\evenfootline % footline on even pages | 3409 | \newtoks\evenfootline % footline on even pages |
| 3393 | \newtoks\oddfootline % footline on odd pages | 3410 | \newtoks\oddfootline % footline on odd pages |
| 3394 | 3411 | ||
| 3395 | % Now make TeX use those variables | 3412 | % Now make \makeheadline and \makefootline in Plain TeX use those variables |
| 3396 | \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline | 3413 | \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline |
| 3397 | \else \the\evenheadline \fi}} | 3414 | \else \the\evenheadline \fi}} |
| 3398 | \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline | 3415 | \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline |
| @@ -3448,6 +3465,10 @@ end | |||
| 3448 | % @everyheadingmarks | 3465 | % @everyheadingmarks |
| 3449 | % @everyfootingmarks | 3466 | % @everyfootingmarks |
| 3450 | 3467 | ||
| 3468 | % These define \getoddheadingmarks, \getevenheadingmarks, | ||
| 3469 | % \getoddfootingmarks, and \getevenfootingmarks, each to one of | ||
| 3470 | % \gettopheadingmarks, \getbottomheadingmarks. | ||
| 3471 | % | ||
| 3451 | \def\evenheadingmarks{\headingmarks{even}{heading}} | 3472 | \def\evenheadingmarks{\headingmarks{even}{heading}} |
| 3452 | \def\oddheadingmarks{\headingmarks{odd}{heading}} | 3473 | \def\oddheadingmarks{\headingmarks{odd}{heading}} |
| 3453 | \def\evenfootingmarks{\headingmarks{even}{footing}} | 3474 | \def\evenfootingmarks{\headingmarks{even}{footing}} |
| @@ -3737,7 +3758,12 @@ end | |||
| 3737 | \noindent | 3758 | \noindent |
| 3738 | \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% | 3759 | \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% |
| 3739 | % | 3760 | % |
| 3740 | \vadjust{\penalty 1200}}% not good to break after first line of item. | 3761 | \ifinner\else |
| 3762 | \vadjust{\penalty 1200}% not good to break after first line of item. | ||
| 3763 | \fi | ||
| 3764 | % We can be in inner vertical mode in a footnote, although an | ||
| 3765 | % @itemize looks awful there. | ||
| 3766 | }% | ||
| 3741 | \flushcr | 3767 | \flushcr |
| 3742 | } | 3768 | } |
| 3743 | 3769 | ||
| @@ -4436,8 +4462,6 @@ end | |||
| 4436 | 4462 | ||
| 4437 | % Used when writing an index entry out to an index file, to prevent | 4463 | % Used when writing an index entry out to an index file, to prevent |
| 4438 | % expansion of Texinfo commands that can appear in an index entry. | 4464 | % expansion of Texinfo commands that can appear in an index entry. |
| 4439 | % Since there are some commands we want to expand, and others we don't, | ||
| 4440 | % we have to laboriously prevent expansion for those that we don't. | ||
| 4441 | % | 4465 | % |
| 4442 | \def\indexdummies{% | 4466 | \def\indexdummies{% |
| 4443 | \escapechar = `\\ % use backslash in output files. | 4467 | \escapechar = `\\ % use backslash in output files. |
| @@ -4659,6 +4683,7 @@ end | |||
| 4659 | % that we make for arg2 (see \parsemargdef ff.). We want all this to be | 4683 | % that we make for arg2 (see \parsemargdef ff.). We want all this to be |
| 4660 | % expanded for the sake of the index, so we end up just seeing "bar". | 4684 | % expanded for the sake of the index, so we end up just seeing "bar". |
| 4661 | \let\xeatspaces = \eatspaces | 4685 | \let\xeatspaces = \eatspaces |
| 4686 | \let\xprocessmacroarg\eatspaces | ||
| 4662 | } | 4687 | } |
| 4663 | 4688 | ||
| 4664 | % For testing: output @{ and @} in index sort strings as \{ and \}. | 4689 | % For testing: output @{ and @} in index sort strings as \{ and \}. |
| @@ -4679,12 +4704,14 @@ end | |||
| 4679 | \backslashdisappear | 4704 | \backslashdisappear |
| 4680 | \def-{}% | 4705 | \def-{}% |
| 4681 | \def<{}% | 4706 | \def<{}% |
| 4707 | \def\@{}% | ||
| 4682 | } | 4708 | } |
| 4683 | 4709 | ||
| 4684 | \gdef\indexnonalnumreappear{% | 4710 | \gdef\indexnonalnumreappear{% |
| 4685 | \useindexbackslash | 4711 | \useindexbackslash |
| 4686 | \let-\normaldash | 4712 | \let-\normaldash |
| 4687 | \let<\normalless | 4713 | \let<\normalless |
| 4714 | \def\@{@}% | ||
| 4688 | } | 4715 | } |
| 4689 | } | 4716 | } |
| 4690 | 4717 | ||
| @@ -4837,7 +4864,10 @@ end | |||
| 4837 | \def\requireopenindexfile#1{% | 4864 | \def\requireopenindexfile#1{% |
| 4838 | \ifnum\csname #1indfile\endcsname=0 | 4865 | \ifnum\csname #1indfile\endcsname=0 |
| 4839 | \expandafter\newwrite \csname#1indfile\endcsname | 4866 | \expandafter\newwrite \csname#1indfile\endcsname |
| 4840 | \openout \csname#1indfile\endcsname \jobname.#1 % Open the file | 4867 | \immediate\openout\csname#1indfile\endcsname \jobname.#1 % Open the file |
| 4868 | % Using \immediate here prevents an object entering into the current box, | ||
| 4869 | % which could confound checks such as those in \safewhatsit for preceding | ||
| 4870 | % skips. | ||
| 4841 | \fi} | 4871 | \fi} |
| 4842 | 4872 | ||
| 4843 | % Output \ as {\indexbackslash}, because \ is an escape character in | 4873 | % Output \ as {\indexbackslash}, because \ is an escape character in |
| @@ -5037,11 +5067,13 @@ end | |||
| 5037 | % there is some text. | 5067 | % there is some text. |
| 5038 | \putwordIndexNonexistent | 5068 | \putwordIndexNonexistent |
| 5039 | \else | 5069 | \else |
| 5070 | \catcode`\\ = 0 | ||
| 5071 | \escapechar = `\\ | ||
| 5040 | % | 5072 | % |
| 5041 | % If the index file exists but is empty, then \openin leaves \ifeof | 5073 | % If the index file exists but is empty, then \openin leaves \ifeof |
| 5042 | % false. We have to make TeX try to read something from the file, so | 5074 | % false. We have to make TeX try to read something from the file, so |
| 5043 | % it can discover if there is anything in it. | 5075 | % it can discover if there is anything in it. |
| 5044 | \read 1 to \temp | 5076 | \read 1 to \thisline |
| 5045 | \ifeof 1 | 5077 | \ifeof 1 |
| 5046 | \putwordIndexIsEmpty | 5078 | \putwordIndexIsEmpty |
| 5047 | \else | 5079 | \else |
| @@ -5051,16 +5083,36 @@ end | |||
| 5051 | \def\indexbackslash{\ttbackslash}% | 5083 | \def\indexbackslash{\ttbackslash}% |
| 5052 | \let\indexlbrace\{ % Likewise, set these sequences for braces | 5084 | \let\indexlbrace\{ % Likewise, set these sequences for braces |
| 5053 | \let\indexrbrace\} % used in the sort key. | 5085 | \let\indexrbrace\} % used in the sort key. |
| 5054 | \catcode`\\ = 0 | ||
| 5055 | \escapechar = `\\ | ||
| 5056 | \begindoublecolumns | 5086 | \begindoublecolumns |
| 5057 | \input \jobname.#1s | 5087 | \let\entryorphanpenalty=\indexorphanpenalty |
| 5088 | % | ||
| 5089 | % Read input from the index file line by line. | ||
| 5090 | \loopdo | ||
| 5091 | \ifeof1 | ||
| 5092 | \let\firsttoken\relax | ||
| 5093 | \else | ||
| 5094 | \read 1 to \nextline | ||
| 5095 | \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}% | ||
| 5096 | \act | ||
| 5097 | \fi | ||
| 5098 | \thisline | ||
| 5099 | % | ||
| 5100 | \ifeof1\else | ||
| 5101 | \let\thisline\nextline | ||
| 5102 | \repeat | ||
| 5103 | %% | ||
| 5058 | \enddoublecolumns | 5104 | \enddoublecolumns |
| 5059 | \fi | 5105 | \fi |
| 5060 | \fi | 5106 | \fi |
| 5061 | \closein 1 | 5107 | \closein 1 |
| 5062 | \endgroup} | 5108 | \endgroup} |
| 5063 | 5109 | ||
| 5110 | \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken} | ||
| 5111 | \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1} | ||
| 5112 | |||
| 5113 | \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx} | ||
| 5114 | \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next} | ||
| 5115 | |||
| 5064 | % These macros are used by the sorted index file itself. | 5116 | % These macros are used by the sorted index file itself. |
| 5065 | % Change them to control the appearance of the index. | 5117 | % Change them to control the appearance of the index. |
| 5066 | 5118 | ||
| @@ -5078,8 +5130,8 @@ end | |||
| 5078 | \catcode`\/=13 | 5130 | \catcode`\/=13 |
| 5079 | \def/{{\secrmnotbold \normalslash}}% | 5131 | \def/{{\secrmnotbold \normalslash}}% |
| 5080 | \def-{{\normaldash\normaldash}}% en dash `--' | 5132 | \def-{{\normaldash\normaldash}}% en dash `--' |
| 5081 | \def^{{\chapbf \normalcaret}} | 5133 | \def^{{\chapbf \normalcaret}}% |
| 5082 | \let~=\normaltilde | 5134 | \def~{{\chapbf \normaltilde}}% |
| 5083 | \def\_{% | 5135 | \def\_{% |
| 5084 | \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }% | 5136 | \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }% |
| 5085 | \def|{$\vert$}% | 5137 | \def|{$\vert$}% |
| @@ -5102,9 +5154,9 @@ end | |||
| 5102 | % The glue before the bonus allows a little bit of space at the | 5154 | % The glue before the bonus allows a little bit of space at the |
| 5103 | % bottom of a column to reduce an increase in inter-line spacing. | 5155 | % bottom of a column to reduce an increase in inter-line spacing. |
| 5104 | \nobreak | 5156 | \nobreak |
| 5105 | \vskip 0pt plus 6\baselineskip | 5157 | \vskip 0pt plus 5\baselineskip |
| 5106 | \penalty -300 | 5158 | \penalty -300 |
| 5107 | \vskip 0pt plus -6\baselineskip | 5159 | \vskip 0pt plus -5\baselineskip |
| 5108 | % | 5160 | % |
| 5109 | % Typeset the initial. Making this add up to a whole number of | 5161 | % Typeset the initial. Making this add up to a whole number of |
| 5110 | % baselineskips increases the chance of the dots lining up from column | 5162 | % baselineskips increases the chance of the dots lining up from column |
| @@ -5112,8 +5164,8 @@ end | |||
| 5112 | % we need before each entry, but it's better. | 5164 | % we need before each entry, but it's better. |
| 5113 | % | 5165 | % |
| 5114 | % No shrink because it confuses \balancecolumns. | 5166 | % No shrink because it confuses \balancecolumns. |
| 5115 | \vskip 1.67\baselineskip plus .5\baselineskip | 5167 | \vskip 1.67\baselineskip plus 1\baselineskip |
| 5116 | \leftline{\secfonts \secbf #1}% | 5168 | \leftline{\secfonts \kern-0.05em \secbf #1}% |
| 5117 | % \secfonts is inside the argument of \leftline so that the change of | 5169 | % \secfonts is inside the argument of \leftline so that the change of |
| 5118 | % \baselineskip will not affect any glue inserted before the vbox that | 5170 | % \baselineskip will not affect any glue inserted before the vbox that |
| 5119 | % \leftline creates. | 5171 | % \leftline creates. |
| @@ -5123,6 +5175,9 @@ end | |||
| 5123 | \egroup % \initialglyphs | 5175 | \egroup % \initialglyphs |
| 5124 | } | 5176 | } |
| 5125 | 5177 | ||
| 5178 | \newdimen\entryrightmargin | ||
| 5179 | \entryrightmargin=0pt | ||
| 5180 | |||
| 5126 | % \entry typesets a paragraph consisting of the text (#1), dot leaders, and | 5181 | % \entry typesets a paragraph consisting of the text (#1), dot leaders, and |
| 5127 | % then page number (#2) flushed to the right margin. It is used for index | 5182 | % then page number (#2) flushed to the right margin. It is used for index |
| 5128 | % and table of contents entries. The paragraph is indented by \leftskip. | 5183 | % and table of contents entries. The paragraph is indented by \leftskip. |
| @@ -5134,38 +5189,46 @@ end | |||
| 5134 | % affect previous text. | 5189 | % affect previous text. |
| 5135 | \par | 5190 | \par |
| 5136 | % | 5191 | % |
| 5137 | % Do not fill out the last line with white space. | ||
| 5138 | \parfillskip = 0in | ||
| 5139 | % | ||
| 5140 | % No extra space above this paragraph. | 5192 | % No extra space above this paragraph. |
| 5141 | \parskip = 0in | 5193 | \parskip = 0in |
| 5142 | % | 5194 | % |
| 5195 | % When reading the text of entry, convert explicit line breaks | ||
| 5196 | % from @* into spaces. The user might give these in long section | ||
| 5197 | % titles, for instance. | ||
| 5198 | \def\*{\unskip\space\ignorespaces}% | ||
| 5199 | \def\entrybreak{\hfil\break}% | ||
| 5200 | % | ||
| 5201 | % A bit of stretch before each entry for the benefit of balancing | ||
| 5202 | % columns. | ||
| 5203 | \vskip 0pt plus0.5pt | ||
| 5204 | % | ||
| 5205 | % Badness calculation for paragraph affected by - | ||
| 5206 | % How much \indexdotfill is stretched, or how much \parfillskip is shrunk | ||
| 5207 | % Number of lines (\linepenalty) | ||
| 5208 | % | ||
| 5143 | % Do not prefer a separate line ending with a hyphen to fewer lines. | 5209 | % Do not prefer a separate line ending with a hyphen to fewer lines. |
| 5144 | \finalhyphendemerits = 0 | 5210 | \finalhyphendemerits = 0 |
| 5145 | % | 5211 | % |
| 5146 | % \hangindent is only relevant when the entry text and page number | 5212 | % Word spacing - no stretch |
| 5147 | % don't both fit on one line. In that case, bob suggests starting the | 5213 | \spaceskip=\fontdimen2\font minus \fontdimen4\font |
| 5148 | % dots pretty far over on the line. Unfortunately, a large | ||
| 5149 | % indentation looks wrong when the entry text itself is broken across | ||
| 5150 | % lines. So we use a small indentation and put up with long leaders. | ||
| 5151 | % | 5214 | % |
| 5152 | % \hangafter is reset to 1 (which is the value we want) at the start | 5215 | \linepenalty=1000 % Discourage line breaks. |
| 5153 | % of each paragraph, so we need not do anything with that. | 5216 | \hyphenpenalty=5000 % Discourage hyphenation. |
| 5154 | \hangindent = 2em | ||
| 5155 | % | 5217 | % |
| 5156 | % When the entry text needs to be broken, just fill out the first line | 5218 | % Ragged right margin, but not for the last line with the leaders in it. |
| 5157 | % with blank space. | 5219 | % When an index entry spans lines, this stretch competes with the stretch |
| 5158 | \rightskip = 0pt plus1fil | 5220 | % in \indexdotfill to determine how the line will be split. |
| 5221 | \rightskip=\entryrightmargin | ||
| 5222 | \advance\rightskip by 0pt plus .6\hsize | ||
| 5159 | % | 5223 | % |
| 5160 | % A bit of stretch before each entry for the benefit of balancing | 5224 | % \parfillskip is at the end of the line with the page number |
| 5161 | % columns. | 5225 | \parfillskip=0pt |
| 5162 | \vskip 0pt plus0.5pt | 5226 | % Cancel the \rightskip stretch |
| 5163 | % | 5227 | \advance \parfillskip by 0pt plus -.6\hsize |
| 5164 | % When reading the text of entry, convert explicit line breaks | 5228 | % Determine how far we can stretch into the margin. |
| 5165 | % from @* into spaces. The user might give these in long section | 5229 | % This allows, e.g., "Appendix H GNU Free Documentation License" to fit |
| 5166 | % titles, for instance. | 5230 | % on one line. |
| 5167 | \def\*{\unskip\space\ignorespaces}% | 5231 | \advance \parfillskip by 0pt minus .6\entryrightmargin |
| 5168 | \def\entrybreak{\hfil\break}% | ||
| 5169 | % | 5232 | % |
| 5170 | % Swallow the left brace of the text (first parameter): | 5233 | % Swallow the left brace of the text (first parameter): |
| 5171 | \afterassignment\doentry | 5234 | \afterassignment\doentry |
| @@ -5173,6 +5236,8 @@ end | |||
| 5173 | } | 5236 | } |
| 5174 | \def\entrybreak{\unskip\space\ignorespaces}% | 5237 | \def\entrybreak{\unskip\space\ignorespaces}% |
| 5175 | \def\doentry{% | 5238 | \def\doentry{% |
| 5239 | % Save the text of the entry in a \vtop. | ||
| 5240 | \global\setbox\entryindexbox=\vtop\bgroup | ||
| 5176 | \bgroup % Instead of the swallowed brace. | 5241 | \bgroup % Instead of the swallowed brace. |
| 5177 | \noindent | 5242 | \noindent |
| 5178 | \aftergroup\finishentry | 5243 | \aftergroup\finishentry |
| @@ -5189,29 +5254,70 @@ end | |||
| 5189 | \ % | 5254 | \ % |
| 5190 | \else | 5255 | \else |
| 5191 | % | 5256 | % |
| 5192 | % If we must, put the page number on a line of its own, and fill out | ||
| 5193 | % this line with blank space. (The \hfil is overwhelmed with the | ||
| 5194 | % fill leaders glue in \indexdotfill if the page number does fit.) | ||
| 5195 | \hfil\penalty50 | ||
| 5196 | \null\nobreak\indexdotfill % Have leaders before the page number. | 5257 | \null\nobreak\indexdotfill % Have leaders before the page number. |
| 5197 | % | 5258 | % |
| 5198 | % The `\ ' here is removed by the implicit \unskip that TeX does as | ||
| 5199 | % part of (the primitive) \par. Without it, a spurious underfull | ||
| 5200 | % \hbox ensues. | ||
| 5201 | \ifpdf | 5259 | \ifpdf |
| 5202 | \pdfgettoks#1.% | 5260 | \pdfgettoks#1.% |
| 5203 | \ \the\toksA | 5261 | \hskip\skip\thinshrinkable\the\toksA |
| 5204 | \else | 5262 | \else |
| 5205 | \ #1% | 5263 | \hskip\skip\thinshrinkable #1% |
| 5206 | \fi | 5264 | \fi |
| 5207 | \fi | 5265 | \fi |
| 5266 | % Parameters for formatting this paragraph, reset for each paragraph. | ||
| 5267 | % | ||
| 5268 | % \hangindent is only relevant when the entry text and page number | ||
| 5269 | % don't both fit on one line. In that case, bob suggests starting the | ||
| 5270 | % dots pretty far over on the line. Unfortunately, a large | ||
| 5271 | % indentation looks wrong when the entry text itself is broken across | ||
| 5272 | % lines. So we use a small indentation and put up with long leaders. | ||
| 5273 | % | ||
| 5274 | \hangafter = 1 | ||
| 5275 | \hangindent = 1em | ||
| 5208 | \par | 5276 | \par |
| 5277 | \egroup % The \vtop | ||
| 5209 | \endgroup | 5278 | \endgroup |
| 5279 | % delay text of entry until after penalty | ||
| 5280 | \bgroup\aftergroup\insertindexentrybox | ||
| 5281 | \entryorphanpenalty | ||
| 5282 | } | ||
| 5283 | |||
| 5284 | \newskip\thinshrinkable | ||
| 5285 | \skip\thinshrinkable=.15em minus .15em | ||
| 5286 | |||
| 5287 | \newbox\entryindexbox | ||
| 5288 | \def\insertindexentrybox{% | ||
| 5289 | \lineskip=.8ex plus .6ex % This comes into effect when the \vtop has a large | ||
| 5290 | % depth due to the paragraph in it having several | ||
| 5291 | % lines. | ||
| 5292 | \box\entryindexbox} | ||
| 5293 | |||
| 5294 | % Default is no penalty | ||
| 5295 | \let\entryorphanpenalty\egroup | ||
| 5296 | |||
| 5297 | % Used from \printindex. \firsttoken should be the first token | ||
| 5298 | % after the \entry. If it's not another \entry, we are at the last | ||
| 5299 | % line of a group of index entries, so insert a penalty to discourage | ||
| 5300 | % orphaned index entries. | ||
| 5301 | \long\def\indexorphanpenalty{% | ||
| 5302 | \def\isentry{\entry}% | ||
| 5303 | \ifx\firsttoken\isentry | ||
| 5304 | \else | ||
| 5305 | \unskip\penalty 9000 | ||
| 5306 | % The \unskip here stops breaking before the glue. It relies on the | ||
| 5307 | % \vskip above being there, otherwise there is an error | ||
| 5308 | % "You can't use `\unskip' in vertical mode". There has to be glue | ||
| 5309 | % in the current vertical list that hasn't been added to the | ||
| 5310 | % "current page". See Chapter 24 of the TeXbook. This contradicts | ||
| 5311 | % Section 8.3.7 in "TeX by Topic," though. | ||
| 5312 | \fi | ||
| 5313 | \egroup % now comes the box added with \aftergroup | ||
| 5210 | } | 5314 | } |
| 5211 | 5315 | ||
| 5212 | % Like plain.tex's \dotfill, except uses up at least 1 em. | 5316 | % Like plain.tex's \dotfill, except uses up at least 1 em. |
| 5317 | % Using a finite stretch encourages several words to appear on a second line | ||
| 5318 | % if the entry is broken. | ||
| 5213 | \def\indexdotfill{\cleaders | 5319 | \def\indexdotfill{\cleaders |
| 5214 | \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill} | 5320 | \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus .4\hsize} |
| 5215 | 5321 | ||
| 5216 | \def\primary #1{\line{#1\hfil}} | 5322 | \def\primary #1{\line{#1\hfil}} |
| 5217 | 5323 | ||
| @@ -5238,6 +5344,9 @@ end | |||
| 5238 | \newbox\partialpage | 5344 | \newbox\partialpage |
| 5239 | \newdimen\doublecolumnhsize | 5345 | \newdimen\doublecolumnhsize |
| 5240 | 5346 | ||
| 5347 | \newtoks\savedtopmark % Used in \begindoublecolumns | ||
| 5348 | \newtoks\savedfirstmark | ||
| 5349 | |||
| 5241 | \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns | 5350 | \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns |
| 5242 | % Grab any single-column material above us. | 5351 | % Grab any single-column material above us. |
| 5243 | \output = {% | 5352 | \output = {% |
| @@ -5258,9 +5367,23 @@ end | |||
| 5258 | \unvbox\PAGE | 5367 | \unvbox\PAGE |
| 5259 | \kern-\topskip \kern\baselineskip | 5368 | \kern-\topskip \kern\baselineskip |
| 5260 | }% | 5369 | }% |
| 5370 | % Save \topmark and \firstmark | ||
| 5371 | \global\savedtopmark=\expandafter{\topmark}% | ||
| 5372 | \global\savedfirstmark=\expandafter{\firstmark}% | ||
| 5261 | }% | 5373 | }% |
| 5262 | \eject % run that output routine to set \partialpage | 5374 | \eject % run that output routine to set \partialpage |
| 5263 | % | 5375 | % |
| 5376 | % We recover the two marks that the last output routine saved in order | ||
| 5377 | % to propagate the information in marks added around a chapter heading, | ||
| 5378 | % which could be otherwise be lost by the time the final page is output. | ||
| 5379 | % | ||
| 5380 | \mark{\the\savedtopmark}% Only mark in page passed to following \output. | ||
| 5381 | \output = {% | ||
| 5382 | \setbox0=\box\PAGE % clear box 255 | ||
| 5383 | }abc\eject | ||
| 5384 | % | ||
| 5385 | \mark{\the\savedfirstmark}% | ||
| 5386 | % | ||
| 5264 | % Use the double-column output routine for subsequent pages. | 5387 | % Use the double-column output routine for subsequent pages. |
| 5265 | \output = {\doublecolumnout}% | 5388 | \output = {\doublecolumnout}% |
| 5266 | % | 5389 | % |
| @@ -5404,9 +5527,11 @@ end | |||
| 5404 | \divide\dimen@ii by 5 | 5527 | \divide\dimen@ii by 5 |
| 5405 | \ifdim\ht3<\dimen@ii | 5528 | \ifdim\ht3<\dimen@ii |
| 5406 | % Column heights are too different, so don't make their bottoms | 5529 | % Column heights are too different, so don't make their bottoms |
| 5407 | % flush with each other | 5530 | % flush with each other. The glue at the end of the second column |
| 5531 | % allows a second column to stretch, reducing the difference in | ||
| 5532 | % height between the two. | ||
| 5408 | \setbox0=\vbox to\dimen@{\unvbox1\vfill}% | 5533 | \setbox0=\vbox to\dimen@{\unvbox1\vfill}% |
| 5409 | \setbox2=\vbox to\dimen@{\unvbox3\vfill}% | 5534 | \setbox2=\vbox to\dimen@{\unvbox3\vskip 0pt plus 0.3\ht0}% |
| 5410 | \else | 5535 | \else |
| 5411 | \setbox0=\vbox to\dimen@{\unvbox1}% | 5536 | \setbox0=\vbox to\dimen@{\unvbox1}% |
| 5412 | \setbox2=\vbox to\dimen@{\unvbox3}% | 5537 | \setbox2=\vbox to\dimen@{\unvbox3}% |
| @@ -5432,6 +5557,9 @@ end | |||
| 5432 | \let\lastnode=\empty % no node to associate with | 5557 | \let\lastnode=\empty % no node to associate with |
| 5433 | \writetocentry{part}{#1}{}% but put it in the toc | 5558 | \writetocentry{part}{#1}{}% but put it in the toc |
| 5434 | \headingsoff % no headline or footline on the part page | 5559 | \headingsoff % no headline or footline on the part page |
| 5560 | % This outputs a mark at the end of the page that clears \thischapter | ||
| 5561 | % and \thissection, like is done in \startcontents. | ||
| 5562 | \chapmacro{}{Yomitfromtoc}{}% | ||
| 5435 | \chapoddpage | 5563 | \chapoddpage |
| 5436 | \endgroup | 5564 | \endgroup |
| 5437 | } | 5565 | } |
| @@ -5676,9 +5804,6 @@ end | |||
| 5676 | 5804 | ||
| 5677 | % @centerchap is like @unnumbered, but the heading is centered. | 5805 | % @centerchap is like @unnumbered, but the heading is centered. |
| 5678 | \outer\parseargdef\centerchap{% | 5806 | \outer\parseargdef\centerchap{% |
| 5679 | % Well, we could do the following in a group, but that would break | ||
| 5680 | % an assumption that \chapmacro is called at the outermost level. | ||
| 5681 | % Thus we are safer this way: --kasal, 24feb04 | ||
| 5682 | \let\centerparametersmaybe = \centerparameters | 5807 | \let\centerparametersmaybe = \centerparameters |
| 5683 | \unnmhead0{#1}% | 5808 | \unnmhead0{#1}% |
| 5684 | \let\centerparametersmaybe = \relax | 5809 | \let\centerparametersmaybe = \relax |
| @@ -5802,7 +5927,11 @@ end | |||
| 5802 | 5927 | ||
| 5803 | % Define plain chapter starts, and page on/off switching for it. | 5928 | % Define plain chapter starts, and page on/off switching for it. |
| 5804 | \def\chapbreak{\dobreak \chapheadingskip {-4000}} | 5929 | \def\chapbreak{\dobreak \chapheadingskip {-4000}} |
| 5930 | |||
| 5931 | % Start a new page | ||
| 5805 | \def\chappager{\par\vfill\supereject} | 5932 | \def\chappager{\par\vfill\supereject} |
| 5933 | |||
| 5934 | % \chapoddpage - start on an odd page for a new chapter | ||
| 5806 | % Because \domark is called before \chapoddpage, the filler page will | 5935 | % Because \domark is called before \chapoddpage, the filler page will |
| 5807 | % get the headings for the next chapter, which is wrong. But we don't | 5936 | % get the headings for the next chapter, which is wrong. But we don't |
| 5808 | % care -- we just disable all headings on the filler page. | 5937 | % care -- we just disable all headings on the filler page. |
| @@ -5838,7 +5967,7 @@ end | |||
| 5838 | 5967 | ||
| 5839 | \CHAPPAGon | 5968 | \CHAPPAGon |
| 5840 | 5969 | ||
| 5841 | % Chapter opening. | 5970 | % \chapmacro - Chapter opening. |
| 5842 | % | 5971 | % |
| 5843 | % #1 is the text, #2 is the section type (Ynumbered, Ynothing, | 5972 | % #1 is the text, #2 is the section type (Ynumbered, Ynothing, |
| 5844 | % Yappendix, Yomitfromtoc), #3 the chapter number. | 5973 | % Yappendix, Yomitfromtoc), #3 the chapter number. |
| @@ -6232,7 +6361,7 @@ end | |||
| 6232 | \savepageno = \pageno | 6361 | \savepageno = \pageno |
| 6233 | \begingroup % Set up to handle contents files properly. | 6362 | \begingroup % Set up to handle contents files properly. |
| 6234 | \raggedbottom % Worry more about breakpoints than the bottom. | 6363 | \raggedbottom % Worry more about breakpoints than the bottom. |
| 6235 | \advance\hsize by -\contentsrightmargin % Don't use the full line length. | 6364 | \entryrightmargin=\contentsrightmargin % Don't use the full line length. |
| 6236 | % | 6365 | % |
| 6237 | % Roman numerals for page numbers. | 6366 | % Roman numerals for page numbers. |
| 6238 | \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi | 6367 | \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi |
| @@ -6337,7 +6466,7 @@ end | |||
| 6337 | 6466 | ||
| 6338 | % Chapters, in the main contents. | 6467 | % Chapters, in the main contents. |
| 6339 | \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} | 6468 | \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} |
| 6340 | % | 6469 | |
| 6341 | % Chapters, in the short toc. | 6470 | % Chapters, in the short toc. |
| 6342 | % See comments in \dochapentry re vbox and related settings. | 6471 | % See comments in \dochapentry re vbox and related settings. |
| 6343 | \def\shortchapentry#1#2#3#4{% | 6472 | \def\shortchapentry#1#2#3#4{% |
| @@ -6352,7 +6481,7 @@ end | |||
| 6352 | \setbox0 = \hbox{\putwordAppendix{} M}% | 6481 | \setbox0 = \hbox{\putwordAppendix{} M}% |
| 6353 | \hbox to \wd0{\putwordAppendix{} #1\hss}} | 6482 | \hbox to \wd0{\putwordAppendix{} #1\hss}} |
| 6354 | % | 6483 | % |
| 6355 | \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} | 6484 | \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}} |
| 6356 | 6485 | ||
| 6357 | % Unnumbered chapters. | 6486 | % Unnumbered chapters. |
| 6358 | \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} | 6487 | \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} |
| @@ -6385,6 +6514,8 @@ end | |||
| 6385 | \def\dochapentry#1#2{% | 6514 | \def\dochapentry#1#2{% |
| 6386 | \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip | 6515 | \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip |
| 6387 | \begingroup | 6516 | \begingroup |
| 6517 | % Move the page numbers slightly to the right | ||
| 6518 | \advance\entryrightmargin by -0.05em | ||
| 6388 | \chapentryfonts | 6519 | \chapentryfonts |
| 6389 | \tocentry{#1}{\dopageno\bgroup#2\egroup}% | 6520 | \tocentry{#1}{\dopageno\bgroup#2\egroup}% |
| 6390 | \endgroup | 6521 | \endgroup |
| @@ -6504,6 +6635,24 @@ end | |||
| 6504 | \endgraf | 6635 | \endgraf |
| 6505 | \ifdim\lastskip<\envskipamount | 6636 | \ifdim\lastskip<\envskipamount |
| 6506 | \removelastskip | 6637 | \removelastskip |
| 6638 | \ifnum\lastpenalty<10000 | ||
| 6639 | % Penalize breaking before the environment, because preceding text | ||
| 6640 | % often leads into it. | ||
| 6641 | \penalty100 | ||
| 6642 | \fi | ||
| 6643 | \vskip\envskipamount | ||
| 6644 | \fi | ||
| 6645 | \fi | ||
| 6646 | }} | ||
| 6647 | |||
| 6648 | \def\afterenvbreak{{% | ||
| 6649 | % =10000 instead of <10000 because of a special case in \itemzzz and | ||
| 6650 | % \sectionheading, q.v. | ||
| 6651 | \ifnum \lastpenalty=10000 \else | ||
| 6652 | \advance\envskipamount by \parskip | ||
| 6653 | \endgraf | ||
| 6654 | \ifdim\lastskip<\envskipamount | ||
| 6655 | \removelastskip | ||
| 6507 | % it's not a good place to break if the last penalty was \nobreak | 6656 | % it's not a good place to break if the last penalty was \nobreak |
| 6508 | % or better ... | 6657 | % or better ... |
| 6509 | \ifnum\lastpenalty<10000 \penalty-50 \fi | 6658 | \ifnum\lastpenalty<10000 \penalty-50 \fi |
| @@ -6512,8 +6661,6 @@ end | |||
| 6512 | \fi | 6661 | \fi |
| 6513 | }} | 6662 | }} |
| 6514 | 6663 | ||
| 6515 | \let\afterenvbreak = \aboveenvbreak | ||
| 6516 | |||
| 6517 | % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will | 6664 | % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will |
| 6518 | % also clear it, so that its embedded environments do the narrowing again. | 6665 | % also clear it, so that its embedded environments do the narrowing again. |
| 6519 | \let\nonarrowing=\relax | 6666 | \let\nonarrowing=\relax |
| @@ -6557,7 +6704,7 @@ end | |||
| 6557 | % collide with the section heading. | 6704 | % collide with the section heading. |
| 6558 | \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi | 6705 | \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi |
| 6559 | % | 6706 | % |
| 6560 | \vbox\bgroup | 6707 | \setbox\groupbox=\vbox\bgroup |
| 6561 | \baselineskip=0pt\parskip=0pt\lineskip=0pt | 6708 | \baselineskip=0pt\parskip=0pt\lineskip=0pt |
| 6562 | \carttop | 6709 | \carttop |
| 6563 | \hbox\bgroup | 6710 | \hbox\bgroup |
| @@ -6581,6 +6728,7 @@ end | |||
| 6581 | \egroup | 6728 | \egroup |
| 6582 | \cartbot | 6729 | \cartbot |
| 6583 | \egroup | 6730 | \egroup |
| 6731 | \addgroupbox | ||
| 6584 | \checkinserts | 6732 | \checkinserts |
| 6585 | } | 6733 | } |
| 6586 | 6734 | ||
| @@ -7058,7 +7206,7 @@ end | |||
| 7058 | \temp | 7206 | \temp |
| 7059 | } | 7207 | } |
| 7060 | 7208 | ||
| 7061 | % \domakedefun \deffn \deffnx \deffnheader | 7209 | % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) } |
| 7062 | % | 7210 | % |
| 7063 | % Define \deffn and \deffnx, without parameters. | 7211 | % Define \deffn and \deffnx, without parameters. |
| 7064 | % \deffnheader has to be defined explicitly. | 7212 | % \deffnheader has to be defined explicitly. |
| @@ -7407,6 +7555,8 @@ end | |||
| 7407 | \def\scanmacro#1{% | 7555 | \def\scanmacro#1{% |
| 7408 | \newlinechar`\^^M | 7556 | \newlinechar`\^^M |
| 7409 | \let\xeatspaces\eatspaces | 7557 | \let\xeatspaces\eatspaces |
| 7558 | % Reduce doubled backslashes to one | ||
| 7559 | \def\xprocessmacroarg{\passargtomacro\eatspaces}% | ||
| 7410 | % | 7560 | % |
| 7411 | % Process the macro body under the current catcode regime. | 7561 | % Process the macro body under the current catcode regime. |
| 7412 | \scantokens{#1\texinfoc}\aftermacro% | 7562 | \scantokens{#1\texinfoc}\aftermacro% |
| @@ -7526,6 +7676,7 @@ end | |||
| 7526 | % an argument to another Texinfo command. | 7676 | % an argument to another Texinfo command. |
| 7527 | \def\macroargctxt{% | 7677 | \def\macroargctxt{% |
| 7528 | \scanctxt | 7678 | \scanctxt |
| 7679 | \catcode`\^^M=\other | ||
| 7529 | \catcode`\\=\active | 7680 | \catcode`\\=\active |
| 7530 | } | 7681 | } |
| 7531 | 7682 | ||
| @@ -7605,59 +7756,36 @@ end | |||
| 7605 | \fi | 7756 | \fi |
| 7606 | } | 7757 | } |
| 7607 | 7758 | ||
| 7608 | % This makes use of the obscure feature that if the last token of a | 7759 | % \getargs -- Parse the arguments to a @macro line. Set \macname to |
| 7609 | % <parameter list> is #, then the preceding argument is delimited by | 7760 | % the name of the macro, and \argl to the braced argument list. |
| 7610 | % an opening brace, and that opening brace is not consumed. | ||
| 7611 | % | ||
| 7612 | \def\getargs#1{\getargsxxx#1{}} | 7761 | \def\getargs#1{\getargsxxx#1{}} |
| 7613 | \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} | 7762 | \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} |
| 7614 | \def\getmacname#1 #2\relax{\macname={#1}} | 7763 | \def\getmacname#1 #2\relax{\macname={#1}} |
| 7615 | \def\getmacargs#1{\def\argl{#1}} | 7764 | \def\getmacargs#1{\def\argl{#1}} |
| 7765 | % This made use of the feature that if the last token of a | ||
| 7766 | % <parameter list> is #, then the preceding argument is delimited by | ||
| 7767 | % an opening brace, and that opening brace is not consumed. | ||
| 7616 | 7768 | ||
| 7617 | % For macro processing make @ a letter so that we can make | 7769 | % Parse the optional {params} list to @macro or @rmacro. |
| 7618 | % private-to-Texinfo macro names. | 7770 | % Set \paramno to the number of arguments, |
| 7619 | \edef\texiatcatcode{\the\catcode`\@} | 7771 | % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a |
| 7620 | \catcode `@=11\relax | 7772 | % three-param macro.) Define \macarg.BLAH for each BLAH in the params |
| 7621 | 7773 | % list to some hook where the argument is to be expanded. If there are | |
| 7622 | % Parse the optional {params} list. Set up \paramno and \paramlist | 7774 | % less than 10 arguments that hook is to be replaced by ##N where N |
| 7623 | % so \defmacro knows what to do. Define \macarg.BLAH for each BLAH | ||
| 7624 | % in the params list to some hook where the argument is to be expanded. If | ||
| 7625 | % there are less than 10 arguments that hook is to be replaced by ##N where N | ||
| 7626 | % is the position in that list, that is to say the macro arguments are to be | 7775 | % is the position in that list, that is to say the macro arguments are to be |
| 7627 | % defined `a la TeX in the macro body. | 7776 | % defined `a la TeX in the macro body. |
| 7628 | % | 7777 | % |
| 7629 | % That gets used by \mbodybackslash (above). | 7778 | % That gets used by \mbodybackslash (above). |
| 7630 | % | 7779 | % |
| 7631 | % We need to get `macro parameter char #' into several definitions. | 7780 | % If there are 10 or more arguments, a different technique is used: see |
| 7632 | % The technique used is stolen from LaTeX: let \hash be something | 7781 | % \parsemmanyargdef. |
| 7633 | % unexpandable, insert that wherever you need a #, and then redefine | ||
| 7634 | % it to # just before using the token list produced. | ||
| 7635 | % | ||
| 7636 | % The same technique is used to protect \eatspaces till just before | ||
| 7637 | % the macro is used. | ||
| 7638 | % | ||
| 7639 | % If there are 10 or more arguments, a different technique is used, where the | ||
| 7640 | % hook remains in the body, and when macro is to be expanded the body is | ||
| 7641 | % processed again to replace the arguments. | ||
| 7642 | % | ||
| 7643 | % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the | ||
| 7644 | % argument N value and then \edef the body (nothing else will expand because of | ||
| 7645 | % the catcode regime underwhich the body was input). | ||
| 7646 | % | 7782 | % |
| 7647 | % If you compile with TeX (not eTeX), and you have macros with 10 or more | ||
| 7648 | % arguments, no macro can have more than 256 arguments (else error). | ||
| 7649 | % | ||
| 7650 | \def\parsemargdef#1;{% | 7783 | \def\parsemargdef#1;{% |
| 7651 | \paramno=0\def\paramlist{}% | 7784 | \paramno=0\def\paramlist{}% |
| 7652 | \let\hash\relax | 7785 | \let\hash\relax |
| 7653 | \let\xeatspaces\relax | 7786 | % \hash is redefined to `#' later to get it into definitions |
| 7787 | \let\processmacroarg\relax | ||
| 7654 | \parsemargdefxxx#1,;,% | 7788 | \parsemargdefxxx#1,;,% |
| 7655 | % In case that there are 10 or more arguments we parse again the arguments | ||
| 7656 | % list to set new definitions for the \macarg.BLAH macros corresponding to | ||
| 7657 | % each BLAH argument. It was anyhow needed to parse already once this list | ||
| 7658 | % in order to count the arguments, and as macros with at most 9 arguments | ||
| 7659 | % are by far more frequent than macro with 10 or more arguments, defining | ||
| 7660 | % twice the \macarg.BLAH macros does not cost too much processing power. | ||
| 7661 | \ifnum\paramno<10\relax\else | 7789 | \ifnum\paramno<10\relax\else |
| 7662 | \paramno0\relax | 7790 | \paramno0\relax |
| 7663 | \parsemmanyargdef@@#1,;,% 10 or more arguments | 7791 | \parsemmanyargdef@@#1,;,% 10 or more arguments |
| @@ -7668,10 +7796,47 @@ end | |||
| 7668 | \else \let\next=\parsemargdefxxx | 7796 | \else \let\next=\parsemargdefxxx |
| 7669 | \advance\paramno by 1 | 7797 | \advance\paramno by 1 |
| 7670 | \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname | 7798 | \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname |
| 7671 | {\xeatspaces{\hash\the\paramno}}% | 7799 | {\processmacroarg{\hash\the\paramno}}% |
| 7672 | \edef\paramlist{\paramlist\hash\the\paramno,}% | 7800 | \edef\paramlist{\paramlist\hash\the\paramno,}% |
| 7673 | \fi\next} | 7801 | \fi\next} |
| 7674 | 7802 | ||
| 7803 | % \parsemacbody, \parsermacbody | ||
| 7804 | % | ||
| 7805 | % Read recursive and nonrecursive macro bodies. (They're different since | ||
| 7806 | % rec and nonrec macros end differently.) | ||
| 7807 | % | ||
| 7808 | % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro | ||
| 7809 | % body to be transformed. | ||
| 7810 | % Set \macrobody to the body of the macro, and call \defmacro. | ||
| 7811 | % | ||
| 7812 | {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{% | ||
| 7813 | \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}% | ||
| 7814 | {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{% | ||
| 7815 | \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}% | ||
| 7816 | |||
| 7817 | % Make @ a letter, so that we can make private-to-Texinfo macro names. | ||
| 7818 | \edef\texiatcatcode{\the\catcode`\@} | ||
| 7819 | \catcode `@=11\relax | ||
| 7820 | |||
| 7821 | %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%% | ||
| 7822 | |||
| 7823 | % If there are 10 or more arguments, a different technique is used, where the | ||
| 7824 | % hook remains in the body, and when macro is to be expanded the body is | ||
| 7825 | % processed again to replace the arguments. | ||
| 7826 | % | ||
| 7827 | % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the | ||
| 7828 | % argument N value and then \edef the body (nothing else will expand because of | ||
| 7829 | % the catcode regime under which the body was input). | ||
| 7830 | % | ||
| 7831 | % If you compile with TeX (not eTeX), and you have macros with 10 or more | ||
| 7832 | % arguments, no macro can have more than 256 arguments (else error). | ||
| 7833 | % | ||
| 7834 | % In case that there are 10 or more arguments we parse again the arguments | ||
| 7835 | % list to set new definitions for the \macarg.BLAH macros corresponding to | ||
| 7836 | % each BLAH argument. It was anyhow needed to parse already once this list | ||
| 7837 | % in order to count the arguments, and as macros with at most 9 arguments | ||
| 7838 | % are by far more frequent than macro with 10 or more arguments, defining | ||
| 7839 | % twice the \macarg.BLAH macros does not cost too much processing power. | ||
| 7675 | \def\parsemmanyargdef@@#1,{% | 7840 | \def\parsemmanyargdef@@#1,{% |
| 7676 | \if#1;\let\next=\relax | 7841 | \if#1;\let\next=\relax |
| 7677 | \else | 7842 | \else |
| @@ -7687,15 +7852,6 @@ end | |||
| 7687 | \advance\paramno by 1\relax | 7852 | \advance\paramno by 1\relax |
| 7688 | \fi\next} | 7853 | \fi\next} |
| 7689 | 7854 | ||
| 7690 | % These two commands read recursive and nonrecursive macro bodies. | ||
| 7691 | % (They're different since rec and nonrec macros end differently.) | ||
| 7692 | % Set \temp to the body of the macro, and call \defmacro. | ||
| 7693 | \catcode `\@\texiatcatcode | ||
| 7694 | {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{% | ||
| 7695 | \xdef\temp{\eatcr{#1}}\endgroup\defmacro}}% | ||
| 7696 | {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{% | ||
| 7697 | \xdef\temp{\eatcr{#1}}\endgroup\defmacro}}% | ||
| 7698 | \catcode `\@=11\relax | ||
| 7699 | 7855 | ||
| 7700 | \let\endargs@\relax | 7856 | \let\endargs@\relax |
| 7701 | \let\nil@\relax | 7857 | \let\nil@\relax |
| @@ -7724,9 +7880,6 @@ end | |||
| 7724 | \getargvals@@ | 7880 | \getargvals@@ |
| 7725 | \fi | 7881 | \fi |
| 7726 | } | 7882 | } |
| 7727 | |||
| 7728 | % Internal for \getargsval@. | ||
| 7729 | % | ||
| 7730 | \def\getargvals@@{% | 7883 | \def\getargvals@@{% |
| 7731 | \ifx\paramlist\nilm@ | 7884 | \ifx\paramlist\nilm@ |
| 7732 | % Some sanity check needed here that \argvaluelist is also empty. | 7885 | % Some sanity check needed here that \argvaluelist is also empty. |
| @@ -7834,16 +7987,7 @@ end | |||
| 7834 | \next | 7987 | \next |
| 7835 | } | 7988 | } |
| 7836 | 7989 | ||
| 7837 | % Save the token stack pointer into macro #1: | 7990 | % Trailing missing arguments are set to empty. |
| 7838 | \def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}} | ||
| 7839 | % | ||
| 7840 | % Restore the token stack pointer from number in macro #1: | ||
| 7841 | \def\texirestoretoksstackpoint#1{\expandafter\mathchardef | ||
| 7842 | \expandafter\@cclvi#1\relax} | ||
| 7843 | % Variant \newtoks that can be used non-\outer: | ||
| 7844 | \def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi} | ||
| 7845 | |||
| 7846 | % Tailing missing arguments are set to empty. | ||
| 7847 | % | 7991 | % |
| 7848 | \def\setemptyargvalues@{% | 7992 | \def\setemptyargvalues@{% |
| 7849 | \ifx\paramlist\nilm@ | 7993 | \ifx\paramlist\nilm@ |
| @@ -7874,44 +8018,73 @@ end | |||
| 7874 | \long\def#2{#4}% | 8018 | \long\def#2{#4}% |
| 7875 | } | 8019 | } |
| 7876 | 8020 | ||
| 7877 | % This defines a Texinfo @macro. \temp has the body of the macro in it. | 8021 | |
| 8022 | %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%% | ||
| 8023 | |||
| 8024 | |||
| 8025 | |||
| 8026 | % Remove following spaces at the expansion stage. | ||
| 8027 | % This works because spaces are discarded before each argument when TeX is | ||
| 8028 | % getting the arguments for a macro. | ||
| 8029 | % This must not be immediately followed by a }. | ||
| 8030 | \long\def\gobblespaces#1{#1} | ||
| 8031 | |||
| 8032 | % This defines a Texinfo @macro or @rmacro, called by \parsemacbody. | ||
| 8033 | % \macrobody has the body of the macro in it, with placeholders for | ||
| 8034 | % its parameters, looking like "\processmacroarg{\hash 1}". | ||
| 8035 | % \paramno is the number of parameters | ||
| 8036 | % \paramlist is a TeX parameter text, e.g. "#1,#2,#3," | ||
| 7878 | % There are eight cases: recursive and nonrecursive macros of zero, one, | 8037 | % There are eight cases: recursive and nonrecursive macros of zero, one, |
| 7879 | % up to nine, and many arguments. | 8038 | % up to nine, and many arguments. |
| 7880 | % Much magic with \expandafter here. | ||
| 7881 | % \xdef is used so that macro definitions will survive the file | 8039 | % \xdef is used so that macro definitions will survive the file |
| 7882 | % they're defined in; @include reads the file inside a group. | 8040 | % they're defined in: @include reads the file inside a group. |
| 7883 | % | 8041 | % |
| 7884 | \def\defmacro{% | 8042 | \def\defmacro{% |
| 7885 | \let\hash=##% convert placeholders to macro parameter chars | 8043 | \let\hash=##% convert placeholders to macro parameter chars |
| 8044 | \ifnum\paramno=1 | ||
| 8045 | \def\processmacroarg{\gobblespaces}% | ||
| 8046 | % This removes the pair of braces around the argument. We don't | ||
| 8047 | % use \eatspaces, because this can cause ends of lines to be lost | ||
| 8048 | % when the argument to \eatspaces is read, leading to line-based | ||
| 8049 | % commands like "@itemize" not being read correctly. | ||
| 8050 | \else | ||
| 8051 | \def\processmacroarg{\xprocessmacroarg}% | ||
| 8052 | \let\xprocessmacroarg\relax | ||
| 8053 | \fi | ||
| 7886 | \ifrecursive %%%%%%%%%%%%%% Recursive %%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 8054 | \ifrecursive %%%%%%%%%%%%%% Recursive %%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 7887 | \ifcase\paramno | 8055 | \ifcase\paramno |
| 7888 | % 0 | 8056 | % 0 |
| 7889 | \expandafter\xdef\csname\the\macname\endcsname{% | 8057 | \expandafter\xdef\csname\the\macname\endcsname{% |
| 7890 | \noexpand\scanmacro{\temp}}% | 8058 | \noexpand\scanmacro{\macrobody}}% |
| 7891 | \or % 1 | 8059 | \or % 1 |
| 7892 | \expandafter\xdef\csname\the\macname\endcsname{% | 8060 | \expandafter\xdef\csname\the\macname\endcsname{% |
| 7893 | \bgroup | 8061 | \bgroup |
| 7894 | \noexpand\braceorline | 8062 | \noexpand\braceorline |
| 7895 | \expandafter\noexpand\csname\the\macname xxx\endcsname}% | 8063 | \expandafter\noexpand\csname\the\macname @@@\endcsname}% |
| 7896 | \expandafter\xdef\csname\the\macname xxx\endcsname##1{% | 8064 | \expandafter\xdef\csname\the\macname @@@\endcsname##1{% |
| 7897 | \egroup\noexpand\scanmacro{\temp}}% | 8065 | \expandafter\noexpand\csname\the\macname @@@@\endcsname{% |
| 8066 | \noexpand\gobblespaces##1\empty}% | ||
| 8067 | % The \empty is for \gobblespaces in case #1 is empty | ||
| 8068 | }% | ||
| 8069 | \expandafter\xdef\csname\the\macname @@@@\endcsname##1{% | ||
| 8070 | \egroup\noexpand\scanmacro{\macrobody}}% | ||
| 7898 | \else | 8071 | \else |
| 7899 | \ifnum\paramno<10\relax % at most 9 | 8072 | \ifnum\paramno<10\relax % at most 9 |
| 7900 | \expandafter\xdef\csname\the\macname\endcsname{% | 8073 | \expandafter\xdef\csname\the\macname\endcsname{% |
| 7901 | \bgroup\noexpand\macroargctxt | 8074 | \bgroup\noexpand\macroargctxt |
| 7902 | \noexpand\csname\the\macname xx\endcsname}% | 8075 | \noexpand\csname\the\macname @@\endcsname}% |
| 7903 | \expandafter\xdef\csname\the\macname xx\endcsname##1{% | 8076 | \expandafter\xdef\csname\the\macname @@\endcsname##1{% |
| 7904 | \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% | 8077 | \expandafter\noexpand\csname\the\macname @@@\endcsname ##1,}% |
| 7905 | \expandafter\expandafter | 8078 | \expandafter\expandafter |
| 7906 | \expandafter\xdef | 8079 | \expandafter\xdef |
| 7907 | \expandafter\expandafter | 8080 | \expandafter\expandafter |
| 7908 | \csname\the\macname xxx\endcsname | 8081 | \csname\the\macname @@@\endcsname |
| 7909 | \paramlist{\egroup\noexpand\scanmacro{\temp}}% | 8082 | \paramlist{\egroup\noexpand\scanmacro{\macrobody}}% |
| 7910 | \else % 10 or more | 8083 | \else % 10 or more |
| 7911 | \expandafter\xdef\csname\the\macname\endcsname{% | 8084 | \expandafter\xdef\csname\the\macname\endcsname{% |
| 7912 | \noexpand\getargvals@{\the\macname}{\argl}% | 8085 | \noexpand\getargvals@{\the\macname}{\argl}% |
| 7913 | }% | 8086 | }% |
| 7914 | \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp | 8087 | \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody |
| 7915 | \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble | 8088 | \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble |
| 7916 | \fi | 8089 | \fi |
| 7917 | \fi | 8090 | \fi |
| @@ -7919,36 +8092,41 @@ end | |||
| 7919 | \ifcase\paramno | 8092 | \ifcase\paramno |
| 7920 | % 0 | 8093 | % 0 |
| 7921 | \expandafter\xdef\csname\the\macname\endcsname{% | 8094 | \expandafter\xdef\csname\the\macname\endcsname{% |
| 7922 | \noexpand\scanmacro{\temp}}% | 8095 | \noexpand\scanmacro{\macrobody}}% |
| 7923 | \or % 1 | 8096 | \or % 1 |
| 7924 | \expandafter\xdef\csname\the\macname\endcsname{% | 8097 | \expandafter\xdef\csname\the\macname\endcsname{% |
| 7925 | \bgroup | 8098 | \bgroup |
| 7926 | \noexpand\braceorline | 8099 | \noexpand\braceorline |
| 7927 | \expandafter\noexpand\csname\the\macname xxx\endcsname}% | 8100 | \expandafter\noexpand\csname\the\macname @@@\endcsname}% |
| 7928 | \expandafter\xdef\csname\the\macname xxx\endcsname##1{% | 8101 | \expandafter\xdef\csname\the\macname @@@\endcsname##1{% |
| 8102 | \expandafter\noexpand\csname\the\macname @@@@\endcsname{% | ||
| 8103 | \noexpand\gobblespaces##1\empty}% | ||
| 8104 | % The \empty is for \gobblespaces in case #1 is empty | ||
| 8105 | }% | ||
| 8106 | \expandafter\xdef\csname\the\macname @@@@\endcsname##1{% | ||
| 7929 | \egroup | 8107 | \egroup |
| 7930 | \noexpand\scanmacro{\temp}% | 8108 | \noexpand\scanmacro{\macrobody}% |
| 7931 | }% | 8109 | }% |
| 7932 | \else % at most 9 | 8110 | \else % at most 9 |
| 7933 | \ifnum\paramno<10\relax | 8111 | \ifnum\paramno<10\relax |
| 7934 | \expandafter\xdef\csname\the\macname\endcsname{% | 8112 | \expandafter\xdef\csname\the\macname\endcsname{% |
| 7935 | \bgroup\noexpand\macroargctxt | 8113 | \bgroup\noexpand\macroargctxt |
| 7936 | \expandafter\noexpand\csname\the\macname xx\endcsname}% | 8114 | \expandafter\noexpand\csname\the\macname @@\endcsname}% |
| 7937 | \expandafter\xdef\csname\the\macname xx\endcsname##1{% | 8115 | \expandafter\xdef\csname\the\macname @@\endcsname##1{% |
| 7938 | \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% | 8116 | \expandafter\noexpand\csname\the\macname @@@\endcsname ##1,}% |
| 7939 | \expandafter\expandafter | 8117 | \expandafter\expandafter |
| 7940 | \expandafter\xdef | 8118 | \expandafter\xdef |
| 7941 | \expandafter\expandafter | 8119 | \expandafter\expandafter |
| 7942 | \csname\the\macname xxx\endcsname | 8120 | \csname\the\macname @@@\endcsname |
| 7943 | \paramlist{% | 8121 | \paramlist{% |
| 7944 | \egroup | 8122 | \egroup |
| 7945 | \noexpand\scanmacro{\temp}% | 8123 | \noexpand\scanmacro{\macrobody}% |
| 7946 | }% | 8124 | }% |
| 7947 | \else % 10 or more: | 8125 | \else % 10 or more: |
| 7948 | \expandafter\xdef\csname\the\macname\endcsname{% | 8126 | \expandafter\xdef\csname\the\macname\endcsname{% |
| 7949 | \noexpand\getargvals@{\the\macname}{\argl}% | 8127 | \noexpand\getargvals@{\the\macname}{\argl}% |
| 7950 | }% | 8128 | }% |
| 7951 | \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp | 8129 | \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody |
| 7952 | \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse | 8130 | \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse |
| 7953 | \fi | 8131 | \fi |
| 7954 | \fi | 8132 | \fi |
| @@ -8119,6 +8297,7 @@ end | |||
| 8119 | \pdfmkdest{#1}% | 8297 | \pdfmkdest{#1}% |
| 8120 | \iflinks | 8298 | \iflinks |
| 8121 | {% | 8299 | {% |
| 8300 | \requireauxfile | ||
| 8122 | \atdummies % preserve commands, but don't expand them | 8301 | \atdummies % preserve commands, but don't expand them |
| 8123 | \edef\writexrdef##1##2{% | 8302 | \edef\writexrdef##1##2{% |
| 8124 | \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef | 8303 | \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef |
| @@ -8383,6 +8562,7 @@ end | |||
| 8383 | % If its value is nonempty, SUFFIX is output afterward. | 8562 | % If its value is nonempty, SUFFIX is output afterward. |
| 8384 | % | 8563 | % |
| 8385 | \def\refx#1#2{% | 8564 | \def\refx#1#2{% |
| 8565 | \requireauxfile | ||
| 8386 | {% | 8566 | {% |
| 8387 | \indexnofonts | 8567 | \indexnofonts |
| 8388 | \otherbackslash | 8568 | \otherbackslash |
| @@ -8446,6 +8626,23 @@ end | |||
| 8446 | \fi | 8626 | \fi |
| 8447 | } | 8627 | } |
| 8448 | 8628 | ||
| 8629 | % If working on a large document in chapters, it is convenient to | ||
| 8630 | % be able to disable indexing, cross-referencing, and contents, for test runs. | ||
| 8631 | % This is done with @novalidate at the beginning of the file. | ||
| 8632 | % | ||
| 8633 | \newif\iflinks \linkstrue % by default we want the aux files. | ||
| 8634 | \let\novalidate = \linksfalse | ||
| 8635 | |||
| 8636 | % Used when writing to the aux file, or when using data from it. | ||
| 8637 | \def\requireauxfile{% | ||
| 8638 | \iflinks | ||
| 8639 | \tryauxfile | ||
| 8640 | % Open the new aux file. TeX will close it automatically at exit. | ||
| 8641 | \immediate\openout\auxfile=\jobname.aux | ||
| 8642 | \fi | ||
| 8643 | \global\let\requireauxfile=\relax % Only do this once. | ||
| 8644 | } | ||
| 8645 | |||
| 8449 | % Read the last existing aux file, if any. No error if none exists. | 8646 | % Read the last existing aux file, if any. No error if none exists. |
| 8450 | % | 8647 | % |
| 8451 | \def\tryauxfile{% | 8648 | \def\tryauxfile{% |
| @@ -8919,6 +9116,7 @@ end | |||
| 8919 | % \floatlabel-lof. Besides \floatident, we include the short | 9116 | % \floatlabel-lof. Besides \floatident, we include the short |
| 8920 | % caption if specified, else the full caption if specified, else nothing. | 9117 | % caption if specified, else the full caption if specified, else nothing. |
| 8921 | {% | 9118 | {% |
| 9119 | \requireauxfile | ||
| 8922 | \atdummies | 9120 | \atdummies |
| 8923 | % | 9121 | % |
| 8924 | % since we read the caption text in the macro world, where ^^M | 9122 | % since we read the caption text in the macro world, where ^^M |
| @@ -10477,6 +10675,16 @@ directory should work if nowhere else does.} | |||
| 10477 | % file name, in case not using a pre-dumped format. | 10675 | % file name, in case not using a pre-dumped format. |
| 10478 | @catcode`+=@active | 10676 | @catcode`+=@active |
| 10479 | @catcode`@_=@active | 10677 | @catcode`@_=@active |
| 10678 | % | ||
| 10679 | % If texinfo.cnf is present on the system, read it. | ||
| 10680 | % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets | ||
| 10681 | % called at the beginning of every Texinfo file. Not opening texinfo.cnf | ||
| 10682 | % directly in this file, texinfo.tex, makes it possible to make a format | ||
| 10683 | % file for Texinfo. | ||
| 10684 | % | ||
| 10685 | @openin 1 texinfo.cnf | ||
| 10686 | @ifeof 1 @else @input texinfo.cnf @fi | ||
| 10687 | @closein 1 | ||
| 10480 | } | 10688 | } |
| 10481 | 10689 | ||
| 10482 | 10690 | ||
diff --git a/lib/acl-internal.c b/lib/acl-internal.c index 1eaa671bd37..c1b70176ac0 100644 --- a/lib/acl-internal.c +++ b/lib/acl-internal.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Test whether a file has a nontrivial access control list. | 1 | /* Test whether a file has a nontrivial ACL. -*- coding: utf-8 -*- |
| 2 | 2 | ||
| 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. |
| 4 | 4 | ||
diff --git a/lib/acl-internal.h b/lib/acl-internal.h index 38a4ab2eb3a..560d1464daa 100644 --- a/lib/acl-internal.h +++ b/lib/acl-internal.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Internal implementation of access control lists. | 1 | /* Internal implementation of access control lists. -*- coding: utf-8 -*- |
| 2 | 2 | ||
| 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. |
| 4 | 4 | ||
diff --git a/lib/c-ctype.c b/lib/c-ctype.c index 1fb5fe675e9..5d9d4d87a61 100644 --- a/lib/c-ctype.c +++ b/lib/c-ctype.c | |||
| @@ -1,395 +1,3 @@ | |||
| 1 | /* Character handling in C locale. | ||
| 2 | |||
| 3 | Copyright 2000-2003, 2006, 2009-2015 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This program is free software; you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation; either version 3 of the License, or | ||
| 8 | (at your option) any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | ||
| 17 | |||
| 18 | #include <config.h> | 1 | #include <config.h> |
| 19 | 2 | #define C_CTYPE_INLINE _GL_EXTERN_INLINE | |
| 20 | /* Specification. */ | ||
| 21 | #define NO_C_CTYPE_MACROS | ||
| 22 | #include "c-ctype.h" | 3 | #include "c-ctype.h" |
| 23 | |||
| 24 | /* The function isascii is not locale dependent. Its use in EBCDIC is | ||
| 25 | questionable. */ | ||
| 26 | bool | ||
| 27 | c_isascii (int c) | ||
| 28 | { | ||
| 29 | return (c >= 0x00 && c <= 0x7f); | ||
| 30 | } | ||
| 31 | |||
| 32 | bool | ||
| 33 | c_isalnum (int c) | ||
| 34 | { | ||
| 35 | #if C_CTYPE_CONSECUTIVE_DIGITS \ | ||
| 36 | && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
| 37 | #if C_CTYPE_ASCII | ||
| 38 | return ((c >= '0' && c <= '9') | ||
| 39 | || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z')); | ||
| 40 | #else | ||
| 41 | return ((c >= '0' && c <= '9') | ||
| 42 | || (c >= 'A' && c <= 'Z') | ||
| 43 | || (c >= 'a' && c <= 'z')); | ||
| 44 | #endif | ||
| 45 | #else | ||
| 46 | switch (c) | ||
| 47 | { | ||
| 48 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
| 49 | case '6': case '7': case '8': case '9': | ||
| 50 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
| 51 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
| 52 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
| 53 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
| 54 | case 'Y': case 'Z': | ||
| 55 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
| 56 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
| 57 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
| 58 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
| 59 | case 'y': case 'z': | ||
| 60 | return 1; | ||
| 61 | default: | ||
| 62 | return 0; | ||
| 63 | } | ||
| 64 | #endif | ||
| 65 | } | ||
| 66 | |||
| 67 | bool | ||
| 68 | c_isalpha (int c) | ||
| 69 | { | ||
| 70 | #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
| 71 | #if C_CTYPE_ASCII | ||
| 72 | return ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'); | ||
| 73 | #else | ||
| 74 | return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); | ||
| 75 | #endif | ||
| 76 | #else | ||
| 77 | switch (c) | ||
| 78 | { | ||
| 79 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
| 80 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
| 81 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
| 82 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
| 83 | case 'Y': case 'Z': | ||
| 84 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
| 85 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
| 86 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
| 87 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
| 88 | case 'y': case 'z': | ||
| 89 | return 1; | ||
| 90 | default: | ||
| 91 | return 0; | ||
| 92 | } | ||
| 93 | #endif | ||
| 94 | } | ||
| 95 | |||
| 96 | bool | ||
| 97 | c_isblank (int c) | ||
| 98 | { | ||
| 99 | return (c == ' ' || c == '\t'); | ||
| 100 | } | ||
| 101 | |||
| 102 | bool | ||
| 103 | c_iscntrl (int c) | ||
| 104 | { | ||
| 105 | #if C_CTYPE_ASCII | ||
| 106 | return ((c & ~0x1f) == 0 || c == 0x7f); | ||
| 107 | #else | ||
| 108 | switch (c) | ||
| 109 | { | ||
| 110 | case ' ': case '!': case '"': case '#': case '$': case '%': | ||
| 111 | case '&': case '\'': case '(': case ')': case '*': case '+': | ||
| 112 | case ',': case '-': case '.': case '/': | ||
| 113 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
| 114 | case '6': case '7': case '8': case '9': | ||
| 115 | case ':': case ';': case '<': case '=': case '>': case '?': | ||
| 116 | case '@': | ||
| 117 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
| 118 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
| 119 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
| 120 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
| 121 | case 'Y': case 'Z': | ||
| 122 | case '[': case '\\': case ']': case '^': case '_': case '`': | ||
| 123 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
| 124 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
| 125 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
| 126 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
| 127 | case 'y': case 'z': | ||
| 128 | case '{': case '|': case '}': case '~': | ||
| 129 | return 0; | ||
| 130 | default: | ||
| 131 | return 1; | ||
| 132 | } | ||
| 133 | #endif | ||
| 134 | } | ||
| 135 | |||
| 136 | bool | ||
| 137 | c_isdigit (int c) | ||
| 138 | { | ||
| 139 | #if C_CTYPE_CONSECUTIVE_DIGITS | ||
| 140 | return (c >= '0' && c <= '9'); | ||
| 141 | #else | ||
| 142 | switch (c) | ||
| 143 | { | ||
| 144 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
| 145 | case '6': case '7': case '8': case '9': | ||
| 146 | return 1; | ||
| 147 | default: | ||
| 148 | return 0; | ||
| 149 | } | ||
| 150 | #endif | ||
| 151 | } | ||
| 152 | |||
| 153 | bool | ||
| 154 | c_islower (int c) | ||
| 155 | { | ||
| 156 | #if C_CTYPE_CONSECUTIVE_LOWERCASE | ||
| 157 | return (c >= 'a' && c <= 'z'); | ||
| 158 | #else | ||
| 159 | switch (c) | ||
| 160 | { | ||
| 161 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
| 162 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
| 163 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
| 164 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
| 165 | case 'y': case 'z': | ||
| 166 | return 1; | ||
| 167 | default: | ||
| 168 | return 0; | ||
| 169 | } | ||
| 170 | #endif | ||
| 171 | } | ||
| 172 | |||
| 173 | bool | ||
| 174 | c_isgraph (int c) | ||
| 175 | { | ||
| 176 | #if C_CTYPE_ASCII | ||
| 177 | return (c >= '!' && c <= '~'); | ||
| 178 | #else | ||
| 179 | switch (c) | ||
| 180 | { | ||
| 181 | case '!': case '"': case '#': case '$': case '%': case '&': | ||
| 182 | case '\'': case '(': case ')': case '*': case '+': case ',': | ||
| 183 | case '-': case '.': case '/': | ||
| 184 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
| 185 | case '6': case '7': case '8': case '9': | ||
| 186 | case ':': case ';': case '<': case '=': case '>': case '?': | ||
| 187 | case '@': | ||
| 188 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
| 189 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
| 190 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
| 191 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
| 192 | case 'Y': case 'Z': | ||
| 193 | case '[': case '\\': case ']': case '^': case '_': case '`': | ||
| 194 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
| 195 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
| 196 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
| 197 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
| 198 | case 'y': case 'z': | ||
| 199 | case '{': case '|': case '}': case '~': | ||
| 200 | return 1; | ||
| 201 | default: | ||
| 202 | return 0; | ||
| 203 | } | ||
| 204 | #endif | ||
| 205 | } | ||
| 206 | |||
| 207 | bool | ||
| 208 | c_isprint (int c) | ||
| 209 | { | ||
| 210 | #if C_CTYPE_ASCII | ||
| 211 | return (c >= ' ' && c <= '~'); | ||
| 212 | #else | ||
| 213 | switch (c) | ||
| 214 | { | ||
| 215 | case ' ': case '!': case '"': case '#': case '$': case '%': | ||
| 216 | case '&': case '\'': case '(': case ')': case '*': case '+': | ||
| 217 | case ',': case '-': case '.': case '/': | ||
| 218 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
| 219 | case '6': case '7': case '8': case '9': | ||
| 220 | case ':': case ';': case '<': case '=': case '>': case '?': | ||
| 221 | case '@': | ||
| 222 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
| 223 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
| 224 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
| 225 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
| 226 | case 'Y': case 'Z': | ||
| 227 | case '[': case '\\': case ']': case '^': case '_': case '`': | ||
| 228 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
| 229 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
| 230 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
| 231 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
| 232 | case 'y': case 'z': | ||
| 233 | case '{': case '|': case '}': case '~': | ||
| 234 | return 1; | ||
| 235 | default: | ||
| 236 | return 0; | ||
| 237 | } | ||
| 238 | #endif | ||
| 239 | } | ||
| 240 | |||
| 241 | bool | ||
| 242 | c_ispunct (int c) | ||
| 243 | { | ||
| 244 | #if C_CTYPE_ASCII | ||
| 245 | return ((c >= '!' && c <= '~') | ||
| 246 | && !((c >= '0' && c <= '9') | ||
| 247 | || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'))); | ||
| 248 | #else | ||
| 249 | switch (c) | ||
| 250 | { | ||
| 251 | case '!': case '"': case '#': case '$': case '%': case '&': | ||
| 252 | case '\'': case '(': case ')': case '*': case '+': case ',': | ||
| 253 | case '-': case '.': case '/': | ||
| 254 | case ':': case ';': case '<': case '=': case '>': case '?': | ||
| 255 | case '@': | ||
| 256 | case '[': case '\\': case ']': case '^': case '_': case '`': | ||
| 257 | case '{': case '|': case '}': case '~': | ||
| 258 | return 1; | ||
| 259 | default: | ||
| 260 | return 0; | ||
| 261 | } | ||
| 262 | #endif | ||
| 263 | } | ||
| 264 | |||
| 265 | bool | ||
| 266 | c_isspace (int c) | ||
| 267 | { | ||
| 268 | return (c == ' ' || c == '\t' | ||
| 269 | || c == '\n' || c == '\v' || c == '\f' || c == '\r'); | ||
| 270 | } | ||
| 271 | |||
| 272 | bool | ||
| 273 | c_isupper (int c) | ||
| 274 | { | ||
| 275 | #if C_CTYPE_CONSECUTIVE_UPPERCASE | ||
| 276 | return (c >= 'A' && c <= 'Z'); | ||
| 277 | #else | ||
| 278 | switch (c) | ||
| 279 | { | ||
| 280 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
| 281 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
| 282 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
| 283 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
| 284 | case 'Y': case 'Z': | ||
| 285 | return 1; | ||
| 286 | default: | ||
| 287 | return 0; | ||
| 288 | } | ||
| 289 | #endif | ||
| 290 | } | ||
| 291 | |||
| 292 | bool | ||
| 293 | c_isxdigit (int c) | ||
| 294 | { | ||
| 295 | #if C_CTYPE_CONSECUTIVE_DIGITS \ | ||
| 296 | && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
| 297 | #if C_CTYPE_ASCII | ||
| 298 | return ((c >= '0' && c <= '9') | ||
| 299 | || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'F')); | ||
| 300 | #else | ||
| 301 | return ((c >= '0' && c <= '9') | ||
| 302 | || (c >= 'A' && c <= 'F') | ||
| 303 | || (c >= 'a' && c <= 'f')); | ||
| 304 | #endif | ||
| 305 | #else | ||
| 306 | switch (c) | ||
| 307 | { | ||
| 308 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
| 309 | case '6': case '7': case '8': case '9': | ||
| 310 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
| 311 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
| 312 | return 1; | ||
| 313 | default: | ||
| 314 | return 0; | ||
| 315 | } | ||
| 316 | #endif | ||
| 317 | } | ||
| 318 | |||
| 319 | int | ||
| 320 | c_tolower (int c) | ||
| 321 | { | ||
| 322 | #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
| 323 | return (c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c); | ||
| 324 | #else | ||
| 325 | switch (c) | ||
| 326 | { | ||
| 327 | case 'A': return 'a'; | ||
| 328 | case 'B': return 'b'; | ||
| 329 | case 'C': return 'c'; | ||
| 330 | case 'D': return 'd'; | ||
| 331 | case 'E': return 'e'; | ||
| 332 | case 'F': return 'f'; | ||
| 333 | case 'G': return 'g'; | ||
| 334 | case 'H': return 'h'; | ||
| 335 | case 'I': return 'i'; | ||
| 336 | case 'J': return 'j'; | ||
| 337 | case 'K': return 'k'; | ||
| 338 | case 'L': return 'l'; | ||
| 339 | case 'M': return 'm'; | ||
| 340 | case 'N': return 'n'; | ||
| 341 | case 'O': return 'o'; | ||
| 342 | case 'P': return 'p'; | ||
| 343 | case 'Q': return 'q'; | ||
| 344 | case 'R': return 'r'; | ||
| 345 | case 'S': return 's'; | ||
| 346 | case 'T': return 't'; | ||
| 347 | case 'U': return 'u'; | ||
| 348 | case 'V': return 'v'; | ||
| 349 | case 'W': return 'w'; | ||
| 350 | case 'X': return 'x'; | ||
| 351 | case 'Y': return 'y'; | ||
| 352 | case 'Z': return 'z'; | ||
| 353 | default: return c; | ||
| 354 | } | ||
| 355 | #endif | ||
| 356 | } | ||
| 357 | |||
| 358 | int | ||
| 359 | c_toupper (int c) | ||
| 360 | { | ||
| 361 | #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
| 362 | return (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c); | ||
| 363 | #else | ||
| 364 | switch (c) | ||
| 365 | { | ||
| 366 | case 'a': return 'A'; | ||
| 367 | case 'b': return 'B'; | ||
| 368 | case 'c': return 'C'; | ||
| 369 | case 'd': return 'D'; | ||
| 370 | case 'e': return 'E'; | ||
| 371 | case 'f': return 'F'; | ||
| 372 | case 'g': return 'G'; | ||
| 373 | case 'h': return 'H'; | ||
| 374 | case 'i': return 'I'; | ||
| 375 | case 'j': return 'J'; | ||
| 376 | case 'k': return 'K'; | ||
| 377 | case 'l': return 'L'; | ||
| 378 | case 'm': return 'M'; | ||
| 379 | case 'n': return 'N'; | ||
| 380 | case 'o': return 'O'; | ||
| 381 | case 'p': return 'P'; | ||
| 382 | case 'q': return 'Q'; | ||
| 383 | case 'r': return 'R'; | ||
| 384 | case 's': return 'S'; | ||
| 385 | case 't': return 'T'; | ||
| 386 | case 'u': return 'U'; | ||
| 387 | case 'v': return 'V'; | ||
| 388 | case 'w': return 'W'; | ||
| 389 | case 'x': return 'X'; | ||
| 390 | case 'y': return 'Y'; | ||
| 391 | case 'z': return 'Z'; | ||
| 392 | default: return c; | ||
| 393 | } | ||
| 394 | #endif | ||
| 395 | } | ||
diff --git a/lib/c-ctype.h b/lib/c-ctype.h index 47644731782..50ebbb58293 100644 --- a/lib/c-ctype.h +++ b/lib/c-ctype.h | |||
| @@ -25,6 +25,13 @@ along with this program; if not, see <http://www.gnu.org/licenses/>. */ | |||
| 25 | 25 | ||
| 26 | #include <stdbool.h> | 26 | #include <stdbool.h> |
| 27 | 27 | ||
| 28 | #ifndef _GL_INLINE_HEADER_BEGIN | ||
| 29 | #error "Please include config.h first." | ||
| 30 | #endif | ||
| 31 | _GL_INLINE_HEADER_BEGIN | ||
| 32 | #ifndef C_CTYPE_INLINE | ||
| 33 | # define C_CTYPE_INLINE _GL_INLINE | ||
| 34 | #endif | ||
| 28 | 35 | ||
| 29 | #ifdef __cplusplus | 36 | #ifdef __cplusplus |
| 30 | extern "C" { | 37 | extern "C" { |
| @@ -39,38 +46,6 @@ extern "C" { | |||
| 39 | characters. */ | 46 | characters. */ |
| 40 | 47 | ||
| 41 | 48 | ||
| 42 | /* Check whether the ASCII optimizations apply. */ | ||
| 43 | |||
| 44 | /* ANSI C89 (and ISO C99 5.2.1.3 too) already guarantees that | ||
| 45 | '0', '1', ..., '9' have consecutive integer values. */ | ||
| 46 | #define C_CTYPE_CONSECUTIVE_DIGITS 1 | ||
| 47 | |||
| 48 | #if ('A' <= 'Z') \ | ||
| 49 | && ('A' + 1 == 'B') && ('B' + 1 == 'C') && ('C' + 1 == 'D') \ | ||
| 50 | && ('D' + 1 == 'E') && ('E' + 1 == 'F') && ('F' + 1 == 'G') \ | ||
| 51 | && ('G' + 1 == 'H') && ('H' + 1 == 'I') && ('I' + 1 == 'J') \ | ||
| 52 | && ('J' + 1 == 'K') && ('K' + 1 == 'L') && ('L' + 1 == 'M') \ | ||
| 53 | && ('M' + 1 == 'N') && ('N' + 1 == 'O') && ('O' + 1 == 'P') \ | ||
| 54 | && ('P' + 1 == 'Q') && ('Q' + 1 == 'R') && ('R' + 1 == 'S') \ | ||
| 55 | && ('S' + 1 == 'T') && ('T' + 1 == 'U') && ('U' + 1 == 'V') \ | ||
| 56 | && ('V' + 1 == 'W') && ('W' + 1 == 'X') && ('X' + 1 == 'Y') \ | ||
| 57 | && ('Y' + 1 == 'Z') | ||
| 58 | #define C_CTYPE_CONSECUTIVE_UPPERCASE 1 | ||
| 59 | #endif | ||
| 60 | |||
| 61 | #if ('a' <= 'z') \ | ||
| 62 | && ('a' + 1 == 'b') && ('b' + 1 == 'c') && ('c' + 1 == 'd') \ | ||
| 63 | && ('d' + 1 == 'e') && ('e' + 1 == 'f') && ('f' + 1 == 'g') \ | ||
| 64 | && ('g' + 1 == 'h') && ('h' + 1 == 'i') && ('i' + 1 == 'j') \ | ||
| 65 | && ('j' + 1 == 'k') && ('k' + 1 == 'l') && ('l' + 1 == 'm') \ | ||
| 66 | && ('m' + 1 == 'n') && ('n' + 1 == 'o') && ('o' + 1 == 'p') \ | ||
| 67 | && ('p' + 1 == 'q') && ('q' + 1 == 'r') && ('r' + 1 == 's') \ | ||
| 68 | && ('s' + 1 == 't') && ('t' + 1 == 'u') && ('u' + 1 == 'v') \ | ||
| 69 | && ('v' + 1 == 'w') && ('w' + 1 == 'x') && ('x' + 1 == 'y') \ | ||
| 70 | && ('y' + 1 == 'z') | ||
| 71 | #define C_CTYPE_CONSECUTIVE_LOWERCASE 1 | ||
| 72 | #endif | ||
| 73 | |||
| 74 | #if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | 49 | #if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ |
| 75 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | 50 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ |
| 76 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | 51 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ |
| @@ -96,11 +71,99 @@ extern "C" { | |||
| 96 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126) | 71 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126) |
| 97 | /* The character set is ASCII or one of its variants or extensions, not EBCDIC. | 72 | /* The character set is ASCII or one of its variants or extensions, not EBCDIC. |
| 98 | Testing the value of '\n' and '\r' is not relevant. */ | 73 | Testing the value of '\n' and '\r' is not relevant. */ |
| 99 | #define C_CTYPE_ASCII 1 | 74 | # define C_CTYPE_ASCII 1 |
| 75 | #elif ! (' ' == '\x40' && '0' == '\xf0' \ | ||
| 76 | && 'A' == '\xc1' && 'J' == '\xd1' && 'S' == '\xe2' \ | ||
| 77 | && 'a' == '\x81' && 'j' == '\x91' && 's' == '\xa2') | ||
| 78 | # error "Only ASCII and EBCDIC are supported" | ||
| 79 | #endif | ||
| 80 | |||
| 81 | #define _C_CTYPE_SIGNED_EBCDIC ('A' < 0) | ||
| 82 | |||
| 83 | #if C_CTYPE_ASCII | ||
| 84 | # define _C_CTYPE_CNTRL \ | ||
| 85 | case '\x00': case '\x01': case '\x02': case '\x03': \ | ||
| 86 | case '\x04': case '\x05': case '\x06': case '\x07': \ | ||
| 87 | case '\x08': case '\x09': case '\x0a': case '\x0b': \ | ||
| 88 | case '\x0c': case '\x0d': case '\x0e': case '\x0f': \ | ||
| 89 | case '\x10': case '\x11': case '\x12': case '\x13': \ | ||
| 90 | case '\x14': case '\x15': case '\x16': case '\x17': \ | ||
| 91 | case '\x18': case '\x19': case '\x1a': case '\x1b': \ | ||
| 92 | case '\x1c': case '\x1d': case '\x1e': case '\x1f': \ | ||
| 93 | case '\x7f' | ||
| 94 | #else | ||
| 95 | /* Use EBCDIC code page 1047's assignments for ASCII control chars; | ||
| 96 | assume all EBCDIC code pages agree about these assignments. */ | ||
| 97 | # define _C_CTYPE_CNTRL \ | ||
| 98 | case '\x00': case '\x01': case '\x02': case '\x03': \ | ||
| 99 | case '\x05': case '\x07': case '\x0b': case '\x0c': \ | ||
| 100 | case '\x0d': case '\x0e': case '\x0f': case '\x10': \ | ||
| 101 | case '\x11': case '\x12': case '\x13': case '\x16': \ | ||
| 102 | case '\x18': case '\x19': case '\x1c': case '\x1d': \ | ||
| 103 | case '\x1e': case '\x1f': case '\x25': case '\x26': \ | ||
| 104 | case '\x27': case '\x2d': case '\x2e': case '\x2f': \ | ||
| 105 | case '\x32': case '\x37': case '\x3c': case '\x3d': \ | ||
| 106 | case '\x3f' | ||
| 100 | #endif | 107 | #endif |
| 101 | 108 | ||
| 109 | /* Cases for hex letter digits, digits, lower, and upper, offset by N. */ | ||
| 110 | |||
| 111 | #define _C_CTYPE_A_THRU_F_N(n) \ | ||
| 112 | case 'a' + (n): case 'b' + (n): case 'c' + (n): case 'd' + (n): \ | ||
| 113 | case 'e' + (n): case 'f' + (n): \ | ||
| 114 | case 'A' + (n): case 'B' + (n): case 'C' + (n): case 'D' + (n): \ | ||
| 115 | case 'E' + (n): case 'F' + (n) | ||
| 116 | #define _C_CTYPE_DIGIT_N(n) \ | ||
| 117 | case '0' + (n): case '1' + (n): case '2' + (n): case '3' + (n): \ | ||
| 118 | case '4' + (n): case '5' + (n): case '6' + (n): case '7' + (n): \ | ||
| 119 | case '8' + (n): case '9' + (n) | ||
| 120 | #define _C_CTYPE_LOWER_N(n) \ | ||
| 121 | case 'a' + (n): case 'b' + (n): case 'c' + (n): case 'd' + (n): \ | ||
| 122 | case 'e' + (n): case 'f' + (n): case 'g' + (n): case 'h' + (n): \ | ||
| 123 | case 'i' + (n): case 'j' + (n): case 'k' + (n): case 'l' + (n): \ | ||
| 124 | case 'm' + (n): case 'n' + (n): case 'o' + (n): case 'p' + (n): \ | ||
| 125 | case 'q' + (n): case 'r' + (n): case 's' + (n): case 't' + (n): \ | ||
| 126 | case 'u' + (n): case 'v' + (n): case 'w' + (n): case 'x' + (n): \ | ||
| 127 | case 'y' + (n): case 'z' + (n) | ||
| 128 | #define _C_CTYPE_UPPER_N(n) \ | ||
| 129 | case 'A' + (n): case 'B' + (n): case 'C' + (n): case 'D' + (n): \ | ||
| 130 | case 'E' + (n): case 'F' + (n): case 'G' + (n): case 'H' + (n): \ | ||
| 131 | case 'I' + (n): case 'J' + (n): case 'K' + (n): case 'L' + (n): \ | ||
| 132 | case 'M' + (n): case 'N' + (n): case 'O' + (n): case 'P' + (n): \ | ||
| 133 | case 'Q' + (n): case 'R' + (n): case 'S' + (n): case 'T' + (n): \ | ||
| 134 | case 'U' + (n): case 'V' + (n): case 'W' + (n): case 'X' + (n): \ | ||
| 135 | case 'Y' + (n): case 'Z' + (n) | ||
| 136 | |||
| 137 | /* Given MACRO_N, expand to all the cases for the corresponding class. */ | ||
| 138 | #if _C_CTYPE_SIGNED_EBCDIC | ||
| 139 | # define _C_CTYPE_CASES(macro_n) macro_n (0): macro_n (256) | ||
| 140 | #else | ||
| 141 | # define _C_CTYPE_CASES(macro_n) macro_n (0) | ||
| 142 | #endif | ||
| 102 | 143 | ||
| 103 | /* Function declarations. */ | 144 | /* Cases for hex letter digits, digits, lower, and upper, with another |
| 145 | case for unsigned char if the original char is negative. */ | ||
| 146 | |||
| 147 | #define _C_CTYPE_A_THRU_F _C_CTYPE_CASES (_C_CTYPE_A_THRU_F_N) | ||
| 148 | #define _C_CTYPE_DIGIT _C_CTYPE_CASES (_C_CTYPE_DIGIT_N) | ||
| 149 | #define _C_CTYPE_LOWER _C_CTYPE_CASES (_C_CTYPE_LOWER_N) | ||
| 150 | #define _C_CTYPE_UPPER _C_CTYPE_CASES (_C_CTYPE_UPPER_N) | ||
| 151 | |||
| 152 | /* The punct class differs because some punctuation characters may be | ||
| 153 | negative while others are nonnegative. Instead of attempting to | ||
| 154 | define _C_CTYPE_PUNCT, define just the plain chars here, and do any | ||
| 155 | cases-plus-256 by hand after using this macro. */ | ||
| 156 | #define _C_CTYPE_PUNCT_PLAIN \ | ||
| 157 | case '!': case '"': case '#': case '$': \ | ||
| 158 | case '%': case '&': case '\'': case '(': \ | ||
| 159 | case ')': case '*': case '+': case ',': \ | ||
| 160 | case '-': case '.': case '/': case ':': \ | ||
| 161 | case ';': case '<': case '=': case '>': \ | ||
| 162 | case '?': case '@': case '[': case '\\': \ | ||
| 163 | case ']': case '^': case '_': case '`': \ | ||
| 164 | case '{': case '|': case '}': case '~' | ||
| 165 | |||
| 166 | /* Function definitions. */ | ||
| 104 | 167 | ||
| 105 | /* Unlike the functions in <ctype.h>, which require an argument in the range | 168 | /* Unlike the functions in <ctype.h>, which require an argument in the range |
| 106 | of the 'unsigned char' type, the functions here operate on values that are | 169 | of the 'unsigned char' type, the functions here operate on values that are |
| @@ -117,179 +180,608 @@ extern "C" { | |||
| 117 | if (c_isalpha (*s)) ... | 180 | if (c_isalpha (*s)) ... |
| 118 | */ | 181 | */ |
| 119 | 182 | ||
| 120 | extern bool c_isascii (int c) _GL_ATTRIBUTE_CONST; /* not locale dependent */ | 183 | C_CTYPE_INLINE bool |
| 184 | c_isalnum (int c) | ||
| 185 | { | ||
| 186 | switch (c) | ||
| 187 | { | ||
| 188 | _C_CTYPE_DIGIT: | ||
| 189 | _C_CTYPE_LOWER: | ||
| 190 | _C_CTYPE_UPPER: | ||
| 191 | return true; | ||
| 192 | |||
| 193 | default: | ||
| 194 | return false; | ||
| 195 | } | ||
| 196 | } | ||
| 121 | 197 | ||
| 122 | extern bool c_isalnum (int c) _GL_ATTRIBUTE_CONST; | 198 | C_CTYPE_INLINE bool |
| 123 | extern bool c_isalpha (int c) _GL_ATTRIBUTE_CONST; | 199 | c_isalpha (int c) |
| 124 | extern bool c_isblank (int c) _GL_ATTRIBUTE_CONST; | 200 | { |
| 125 | extern bool c_iscntrl (int c) _GL_ATTRIBUTE_CONST; | 201 | switch (c) |
| 126 | extern bool c_isdigit (int c) _GL_ATTRIBUTE_CONST; | 202 | { |
| 127 | extern bool c_islower (int c) _GL_ATTRIBUTE_CONST; | 203 | _C_CTYPE_LOWER: |
| 128 | extern bool c_isgraph (int c) _GL_ATTRIBUTE_CONST; | 204 | _C_CTYPE_UPPER: |
| 129 | extern bool c_isprint (int c) _GL_ATTRIBUTE_CONST; | 205 | return true; |
| 130 | extern bool c_ispunct (int c) _GL_ATTRIBUTE_CONST; | 206 | |
| 131 | extern bool c_isspace (int c) _GL_ATTRIBUTE_CONST; | 207 | default: |
| 132 | extern bool c_isupper (int c) _GL_ATTRIBUTE_CONST; | 208 | return false; |
| 133 | extern bool c_isxdigit (int c) _GL_ATTRIBUTE_CONST; | 209 | } |
| 210 | } | ||
| 134 | 211 | ||
| 135 | extern int c_tolower (int c) _GL_ATTRIBUTE_CONST; | 212 | /* The function isascii is not locale dependent. |
| 136 | extern int c_toupper (int c) _GL_ATTRIBUTE_CONST; | 213 | Its use in EBCDIC is questionable. */ |
| 214 | C_CTYPE_INLINE bool | ||
| 215 | c_isascii (int c) | ||
| 216 | { | ||
| 217 | switch (c) | ||
| 218 | { | ||
| 219 | case ' ': | ||
| 220 | _C_CTYPE_CNTRL: | ||
| 221 | _C_CTYPE_DIGIT: | ||
| 222 | _C_CTYPE_LOWER: | ||
| 223 | _C_CTYPE_UPPER: | ||
| 224 | |||
| 225 | _C_CTYPE_PUNCT_PLAIN: | ||
| 226 | #if '!' < 0 | ||
| 227 | case '!' + 256: | ||
| 228 | #endif | ||
| 229 | #if '"' < 0 | ||
| 230 | case '"' + 256: | ||
| 231 | #endif | ||
| 232 | #if '#' < 0 | ||
| 233 | case '#' + 256: | ||
| 234 | #endif | ||
| 235 | #if '$' < 0 | ||
| 236 | case '$' + 256: | ||
| 237 | #endif | ||
| 238 | #if '%' < 0 | ||
| 239 | case '%' + 256: | ||
| 240 | #endif | ||
| 241 | #if '&' < 0 | ||
| 242 | case '&' + 256: | ||
| 243 | #endif | ||
| 244 | #if '\'' < 0 | ||
| 245 | case '\'' + 256: | ||
| 246 | #endif | ||
| 247 | #if '(' < 0 | ||
| 248 | case '(' + 256: | ||
| 249 | #endif | ||
| 250 | #if ')' < 0 | ||
| 251 | case ')' + 256: | ||
| 252 | #endif | ||
| 253 | #if '*' < 0 | ||
| 254 | case '*' + 256: | ||
| 255 | #endif | ||
| 256 | #if '+' < 0 | ||
| 257 | case '+' + 256: | ||
| 258 | #endif | ||
| 259 | #if ',' < 0 | ||
| 260 | case ',' + 256: | ||
| 261 | #endif | ||
| 262 | #if '-' < 0 | ||
| 263 | case '-' + 256: | ||
| 264 | #endif | ||
| 265 | #if '.' < 0 | ||
| 266 | case '.' + 256: | ||
| 267 | #endif | ||
| 268 | #if '/' < 0 | ||
| 269 | case '/' + 256: | ||
| 270 | #endif | ||
| 271 | #if ':' < 0 | ||
| 272 | case ':' + 256: | ||
| 273 | #endif | ||
| 274 | #if ';' < 0 | ||
| 275 | case ';' + 256: | ||
| 276 | #endif | ||
| 277 | #if '<' < 0 | ||
| 278 | case '<' + 256: | ||
| 279 | #endif | ||
| 280 | #if '=' < 0 | ||
| 281 | case '=' + 256: | ||
| 282 | #endif | ||
| 283 | #if '>' < 0 | ||
| 284 | case '>' + 256: | ||
| 285 | #endif | ||
| 286 | #if '?' < 0 | ||
| 287 | case '?' + 256: | ||
| 288 | #endif | ||
| 289 | #if '@' < 0 | ||
| 290 | case '@' + 256: | ||
| 291 | #endif | ||
| 292 | #if '[' < 0 | ||
| 293 | case '[' + 256: | ||
| 294 | #endif | ||
| 295 | #if '\\' < 0 | ||
| 296 | case '\\' + 256: | ||
| 297 | #endif | ||
| 298 | #if ']' < 0 | ||
| 299 | case ']' + 256: | ||
| 300 | #endif | ||
| 301 | #if '^' < 0 | ||
| 302 | case '^' + 256: | ||
| 303 | #endif | ||
| 304 | #if '_' < 0 | ||
| 305 | case '_' + 256: | ||
| 306 | #endif | ||
| 307 | #if '`' < 0 | ||
| 308 | case '`' + 256: | ||
| 309 | #endif | ||
| 310 | #if '{' < 0 | ||
| 311 | case '{' + 256: | ||
| 312 | #endif | ||
| 313 | #if '|' < 0 | ||
| 314 | case '|' + 256: | ||
| 315 | #endif | ||
| 316 | #if '}' < 0 | ||
| 317 | case '}' + 256: | ||
| 318 | #endif | ||
| 319 | #if '~' < 0 | ||
| 320 | case '~' + 256: | ||
| 321 | #endif | ||
| 322 | return true; | ||
| 137 | 323 | ||
| 324 | default: | ||
| 325 | return false; | ||
| 326 | } | ||
| 327 | } | ||
| 138 | 328 | ||
| 139 | #if (defined __GNUC__ && !defined __STRICT_ANSI__ && defined __OPTIMIZE__ \ | 329 | C_CTYPE_INLINE bool |
| 140 | && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS) | 330 | c_isblank (int c) |
| 331 | { | ||
| 332 | return c == ' ' || c == '\t'; | ||
| 333 | } | ||
| 141 | 334 | ||
| 142 | /* ASCII optimizations. */ | 335 | C_CTYPE_INLINE bool |
| 336 | c_iscntrl (int c) | ||
| 337 | { | ||
| 338 | switch (c) | ||
| 339 | { | ||
| 340 | _C_CTYPE_CNTRL: | ||
| 341 | return true; | ||
| 342 | default: | ||
| 343 | return false; | ||
| 344 | } | ||
| 345 | } | ||
| 143 | 346 | ||
| 144 | #undef c_isascii | 347 | C_CTYPE_INLINE bool |
| 145 | #define c_isascii(c) \ | 348 | c_isdigit (int c) |
| 146 | ({ int __c = (c); \ | 349 | { |
| 147 | (__c >= 0x00 && __c <= 0x7f); \ | 350 | switch (c) |
| 148 | }) | 351 | { |
| 352 | _C_CTYPE_DIGIT: | ||
| 353 | return true; | ||
| 354 | default: | ||
| 355 | return false; | ||
| 356 | } | ||
| 357 | } | ||
| 149 | 358 | ||
| 150 | #if C_CTYPE_CONSECUTIVE_DIGITS \ | 359 | C_CTYPE_INLINE bool |
| 151 | && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | 360 | c_isgraph (int c) |
| 152 | #if C_CTYPE_ASCII | 361 | { |
| 153 | #undef c_isalnum | 362 | switch (c) |
| 154 | #define c_isalnum(c) \ | 363 | { |
| 155 | ({ int __c = (c); \ | 364 | _C_CTYPE_DIGIT: |
| 156 | ((__c >= '0' && __c <= '9') \ | 365 | _C_CTYPE_LOWER: |
| 157 | || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z')); \ | 366 | _C_CTYPE_UPPER: |
| 158 | }) | 367 | |
| 159 | #else | 368 | _C_CTYPE_PUNCT_PLAIN: |
| 160 | #undef c_isalnum | 369 | #if '!' < 0 |
| 161 | #define c_isalnum(c) \ | 370 | case '!' + 256: |
| 162 | ({ int __c = (c); \ | ||
| 163 | ((__c >= '0' && __c <= '9') \ | ||
| 164 | || (__c >= 'A' && __c <= 'Z') \ | ||
| 165 | || (__c >= 'a' && __c <= 'z')); \ | ||
| 166 | }) | ||
| 167 | #endif | 371 | #endif |
| 372 | #if '"' < 0 | ||
| 373 | case '"' + 256: | ||
| 168 | #endif | 374 | #endif |
| 169 | 375 | #if '#' < 0 | |
| 170 | #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | 376 | case '#' + 256: |
| 171 | #if C_CTYPE_ASCII | 377 | #endif |
| 172 | #undef c_isalpha | 378 | #if '$' < 0 |
| 173 | #define c_isalpha(c) \ | 379 | case '$' + 256: |
| 174 | ({ int __c = (c); \ | 380 | #endif |
| 175 | ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z'); \ | 381 | #if '%' < 0 |
| 176 | }) | 382 | case '%' + 256: |
| 177 | #else | 383 | #endif |
| 178 | #undef c_isalpha | 384 | #if '&' < 0 |
| 179 | #define c_isalpha(c) \ | 385 | case '&' + 256: |
| 180 | ({ int __c = (c); \ | 386 | #endif |
| 181 | ((__c >= 'A' && __c <= 'Z') || (__c >= 'a' && __c <= 'z')); \ | 387 | #if '\'' < 0 |
| 182 | }) | 388 | case '\'' + 256: |
| 389 | #endif | ||
| 390 | #if '(' < 0 | ||
| 391 | case '(' + 256: | ||
| 392 | #endif | ||
| 393 | #if ')' < 0 | ||
| 394 | case ')' + 256: | ||
| 395 | #endif | ||
| 396 | #if '*' < 0 | ||
| 397 | case '*' + 256: | ||
| 398 | #endif | ||
| 399 | #if '+' < 0 | ||
| 400 | case '+' + 256: | ||
| 401 | #endif | ||
| 402 | #if ',' < 0 | ||
| 403 | case ',' + 256: | ||
| 404 | #endif | ||
| 405 | #if '-' < 0 | ||
| 406 | case '-' + 256: | ||
| 407 | #endif | ||
| 408 | #if '.' < 0 | ||
| 409 | case '.' + 256: | ||
| 410 | #endif | ||
| 411 | #if '/' < 0 | ||
| 412 | case '/' + 256: | ||
| 413 | #endif | ||
| 414 | #if ':' < 0 | ||
| 415 | case ':' + 256: | ||
| 416 | #endif | ||
| 417 | #if ';' < 0 | ||
| 418 | case ';' + 256: | ||
| 419 | #endif | ||
| 420 | #if '<' < 0 | ||
| 421 | case '<' + 256: | ||
| 422 | #endif | ||
| 423 | #if '=' < 0 | ||
| 424 | case '=' + 256: | ||
| 425 | #endif | ||
| 426 | #if '>' < 0 | ||
| 427 | case '>' + 256: | ||
| 428 | #endif | ||
| 429 | #if '?' < 0 | ||
| 430 | case '?' + 256: | ||
| 431 | #endif | ||
| 432 | #if '@' < 0 | ||
| 433 | case '@' + 256: | ||
| 434 | #endif | ||
| 435 | #if '[' < 0 | ||
| 436 | case '[' + 256: | ||
| 437 | #endif | ||
| 438 | #if '\\' < 0 | ||
| 439 | case '\\' + 256: | ||
| 440 | #endif | ||
| 441 | #if ']' < 0 | ||
| 442 | case ']' + 256: | ||
| 443 | #endif | ||
| 444 | #if '^' < 0 | ||
| 445 | case '^' + 256: | ||
| 446 | #endif | ||
| 447 | #if '_' < 0 | ||
| 448 | case '_' + 256: | ||
| 449 | #endif | ||
| 450 | #if '`' < 0 | ||
| 451 | case '`' + 256: | ||
| 452 | #endif | ||
| 453 | #if '{' < 0 | ||
| 454 | case '{' + 256: | ||
| 455 | #endif | ||
| 456 | #if '|' < 0 | ||
| 457 | case '|' + 256: | ||
| 458 | #endif | ||
| 459 | #if '}' < 0 | ||
| 460 | case '}' + 256: | ||
| 183 | #endif | 461 | #endif |
| 462 | #if '~' < 0 | ||
| 463 | case '~' + 256: | ||
| 184 | #endif | 464 | #endif |
| 465 | return true; | ||
| 185 | 466 | ||
| 186 | #undef c_isblank | 467 | default: |
| 187 | #define c_isblank(c) \ | 468 | return false; |
| 188 | ({ int __c = (c); \ | 469 | } |
| 189 | (__c == ' ' || __c == '\t'); \ | 470 | } |
| 190 | }) | ||
| 191 | 471 | ||
| 192 | #if C_CTYPE_ASCII | 472 | C_CTYPE_INLINE bool |
| 193 | #undef c_iscntrl | 473 | c_islower (int c) |
| 194 | #define c_iscntrl(c) \ | 474 | { |
| 195 | ({ int __c = (c); \ | 475 | switch (c) |
| 196 | ((__c & ~0x1f) == 0 || __c == 0x7f); \ | 476 | { |
| 197 | }) | 477 | _C_CTYPE_LOWER: |
| 198 | #endif | 478 | return true; |
| 479 | default: | ||
| 480 | return false; | ||
| 481 | } | ||
| 482 | } | ||
| 199 | 483 | ||
| 200 | #if C_CTYPE_CONSECUTIVE_DIGITS | 484 | C_CTYPE_INLINE bool |
| 201 | #undef c_isdigit | 485 | c_isprint (int c) |
| 202 | #define c_isdigit(c) \ | 486 | { |
| 203 | ({ int __c = (c); \ | 487 | switch (c) |
| 204 | (__c >= '0' && __c <= '9'); \ | 488 | { |
| 205 | }) | 489 | case ' ': |
| 490 | _C_CTYPE_DIGIT: | ||
| 491 | _C_CTYPE_LOWER: | ||
| 492 | _C_CTYPE_UPPER: | ||
| 493 | |||
| 494 | _C_CTYPE_PUNCT_PLAIN: | ||
| 495 | #if '!' < 0 | ||
| 496 | case '!' + 256: | ||
| 206 | #endif | 497 | #endif |
| 207 | 498 | #if '"' < 0 | |
| 208 | #if C_CTYPE_CONSECUTIVE_LOWERCASE | 499 | case '"' + 256: |
| 209 | #undef c_islower | ||
| 210 | #define c_islower(c) \ | ||
| 211 | ({ int __c = (c); \ | ||
| 212 | (__c >= 'a' && __c <= 'z'); \ | ||
| 213 | }) | ||
| 214 | #endif | 500 | #endif |
| 215 | 501 | #if '#' < 0 | |
| 216 | #if C_CTYPE_ASCII | 502 | case '#' + 256: |
| 217 | #undef c_isgraph | ||
| 218 | #define c_isgraph(c) \ | ||
| 219 | ({ int __c = (c); \ | ||
| 220 | (__c >= '!' && __c <= '~'); \ | ||
| 221 | }) | ||
| 222 | #endif | 503 | #endif |
| 223 | 504 | #if '$' < 0 | |
| 224 | #if C_CTYPE_ASCII | 505 | case '$' + 256: |
| 225 | #undef c_isprint | 506 | #endif |
| 226 | #define c_isprint(c) \ | 507 | #if '%' < 0 |
| 227 | ({ int __c = (c); \ | 508 | case '%' + 256: |
| 228 | (__c >= ' ' && __c <= '~'); \ | 509 | #endif |
| 229 | }) | 510 | #if '&' < 0 |
| 511 | case '&' + 256: | ||
| 512 | #endif | ||
| 513 | #if '\'' < 0 | ||
| 514 | case '\'' + 256: | ||
| 515 | #endif | ||
| 516 | #if '(' < 0 | ||
| 517 | case '(' + 256: | ||
| 518 | #endif | ||
| 519 | #if ')' < 0 | ||
| 520 | case ')' + 256: | ||
| 521 | #endif | ||
| 522 | #if '*' < 0 | ||
| 523 | case '*' + 256: | ||
| 524 | #endif | ||
| 525 | #if '+' < 0 | ||
| 526 | case '+' + 256: | ||
| 527 | #endif | ||
| 528 | #if ',' < 0 | ||
| 529 | case ',' + 256: | ||
| 530 | #endif | ||
| 531 | #if '-' < 0 | ||
| 532 | case '-' + 256: | ||
| 533 | #endif | ||
| 534 | #if '.' < 0 | ||
| 535 | case '.' + 256: | ||
| 536 | #endif | ||
| 537 | #if '/' < 0 | ||
| 538 | case '/' + 256: | ||
| 539 | #endif | ||
| 540 | #if ':' < 0 | ||
| 541 | case ':' + 256: | ||
| 542 | #endif | ||
| 543 | #if ';' < 0 | ||
| 544 | case ';' + 256: | ||
| 230 | #endif | 545 | #endif |
| 546 | #if '<' < 0 | ||
| 547 | case '<' + 256: | ||
| 548 | #endif | ||
| 549 | #if '=' < 0 | ||
| 550 | case '=' + 256: | ||
| 551 | #endif | ||
| 552 | #if '>' < 0 | ||
| 553 | case '>' + 256: | ||
| 554 | #endif | ||
| 555 | #if '?' < 0 | ||
| 556 | case '?' + 256: | ||
| 557 | #endif | ||
| 558 | #if '@' < 0 | ||
| 559 | case '@' + 256: | ||
| 560 | #endif | ||
| 561 | #if '[' < 0 | ||
| 562 | case '[' + 256: | ||
| 563 | #endif | ||
| 564 | #if '\\' < 0 | ||
| 565 | case '\\' + 256: | ||
| 566 | #endif | ||
| 567 | #if ']' < 0 | ||
| 568 | case ']' + 256: | ||
| 569 | #endif | ||
| 570 | #if '^' < 0 | ||
| 571 | case '^' + 256: | ||
| 572 | #endif | ||
| 573 | #if '_' < 0 | ||
| 574 | case '_' + 256: | ||
| 575 | #endif | ||
| 576 | #if '`' < 0 | ||
| 577 | case '`' + 256: | ||
| 578 | #endif | ||
| 579 | #if '{' < 0 | ||
| 580 | case '{' + 256: | ||
| 581 | #endif | ||
| 582 | #if '|' < 0 | ||
| 583 | case '|' + 256: | ||
| 584 | #endif | ||
| 585 | #if '}' < 0 | ||
| 586 | case '}' + 256: | ||
| 587 | #endif | ||
| 588 | #if '~' < 0 | ||
| 589 | case '~' + 256: | ||
| 590 | #endif | ||
| 591 | return true; | ||
| 231 | 592 | ||
| 232 | #if C_CTYPE_ASCII | 593 | default: |
| 233 | #undef c_ispunct | 594 | return false; |
| 234 | #define c_ispunct(c) \ | 595 | } |
| 235 | ({ int _c = (c); \ | 596 | } |
| 236 | (c_isgraph (_c) && ! c_isalnum (_c)); \ | 597 | |
| 237 | }) | 598 | C_CTYPE_INLINE bool |
| 238 | #endif | 599 | c_ispunct (int c) |
| 239 | 600 | { | |
| 240 | #undef c_isspace | 601 | switch (c) |
| 241 | #define c_isspace(c) \ | 602 | { |
| 242 | ({ int __c = (c); \ | 603 | _C_CTYPE_PUNCT_PLAIN: |
| 243 | (__c == ' ' || __c == '\t' \ | 604 | #if '!' < 0 |
| 244 | || __c == '\n' || __c == '\v' || __c == '\f' || __c == '\r'); \ | 605 | case '!' + 256: |
| 245 | }) | 606 | #endif |
| 246 | 607 | #if '"' < 0 | |
| 247 | #if C_CTYPE_CONSECUTIVE_UPPERCASE | 608 | case '"' + 256: |
| 248 | #undef c_isupper | ||
| 249 | #define c_isupper(c) \ | ||
| 250 | ({ int __c = (c); \ | ||
| 251 | (__c >= 'A' && __c <= 'Z'); \ | ||
| 252 | }) | ||
| 253 | #endif | ||
| 254 | |||
| 255 | #if C_CTYPE_CONSECUTIVE_DIGITS \ | ||
| 256 | && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
| 257 | #if C_CTYPE_ASCII | ||
| 258 | #undef c_isxdigit | ||
| 259 | #define c_isxdigit(c) \ | ||
| 260 | ({ int __c = (c); \ | ||
| 261 | ((__c >= '0' && __c <= '9') \ | ||
| 262 | || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'F')); \ | ||
| 263 | }) | ||
| 264 | #else | ||
| 265 | #undef c_isxdigit | ||
| 266 | #define c_isxdigit(c) \ | ||
| 267 | ({ int __c = (c); \ | ||
| 268 | ((__c >= '0' && __c <= '9') \ | ||
| 269 | || (__c >= 'A' && __c <= 'F') \ | ||
| 270 | || (__c >= 'a' && __c <= 'f')); \ | ||
| 271 | }) | ||
| 272 | #endif | 609 | #endif |
| 610 | #if '#' < 0 | ||
| 611 | case '#' + 256: | ||
| 273 | #endif | 612 | #endif |
| 613 | #if '$' < 0 | ||
| 614 | case '$' + 256: | ||
| 615 | #endif | ||
| 616 | #if '%' < 0 | ||
| 617 | case '%' + 256: | ||
| 618 | #endif | ||
| 619 | #if '&' < 0 | ||
| 620 | case '&' + 256: | ||
| 621 | #endif | ||
| 622 | #if '\'' < 0 | ||
| 623 | case '\'' + 256: | ||
| 624 | #endif | ||
| 625 | #if '(' < 0 | ||
| 626 | case '(' + 256: | ||
| 627 | #endif | ||
| 628 | #if ')' < 0 | ||
| 629 | case ')' + 256: | ||
| 630 | #endif | ||
| 631 | #if '*' < 0 | ||
| 632 | case '*' + 256: | ||
| 633 | #endif | ||
| 634 | #if '+' < 0 | ||
| 635 | case '+' + 256: | ||
| 636 | #endif | ||
| 637 | #if ',' < 0 | ||
| 638 | case ',' + 256: | ||
| 639 | #endif | ||
| 640 | #if '-' < 0 | ||
| 641 | case '-' + 256: | ||
| 642 | #endif | ||
| 643 | #if '.' < 0 | ||
| 644 | case '.' + 256: | ||
| 645 | #endif | ||
| 646 | #if '/' < 0 | ||
| 647 | case '/' + 256: | ||
| 648 | #endif | ||
| 649 | #if ':' < 0 | ||
| 650 | case ':' + 256: | ||
| 651 | #endif | ||
| 652 | #if ';' < 0 | ||
| 653 | case ';' + 256: | ||
| 654 | #endif | ||
| 655 | #if '<' < 0 | ||
| 656 | case '<' + 256: | ||
| 657 | #endif | ||
| 658 | #if '=' < 0 | ||
| 659 | case '=' + 256: | ||
| 660 | #endif | ||
| 661 | #if '>' < 0 | ||
| 662 | case '>' + 256: | ||
| 663 | #endif | ||
| 664 | #if '?' < 0 | ||
| 665 | case '?' + 256: | ||
| 666 | #endif | ||
| 667 | #if '@' < 0 | ||
| 668 | case '@' + 256: | ||
| 669 | #endif | ||
| 670 | #if '[' < 0 | ||
| 671 | case '[' + 256: | ||
| 672 | #endif | ||
| 673 | #if '\\' < 0 | ||
| 674 | case '\\' + 256: | ||
| 675 | #endif | ||
| 676 | #if ']' < 0 | ||
| 677 | case ']' + 256: | ||
| 678 | #endif | ||
| 679 | #if '^' < 0 | ||
| 680 | case '^' + 256: | ||
| 681 | #endif | ||
| 682 | #if '_' < 0 | ||
| 683 | case '_' + 256: | ||
| 684 | #endif | ||
| 685 | #if '`' < 0 | ||
| 686 | case '`' + 256: | ||
| 687 | #endif | ||
| 688 | #if '{' < 0 | ||
| 689 | case '{' + 256: | ||
| 690 | #endif | ||
| 691 | #if '|' < 0 | ||
| 692 | case '|' + 256: | ||
| 693 | #endif | ||
| 694 | #if '}' < 0 | ||
| 695 | case '}' + 256: | ||
| 696 | #endif | ||
| 697 | #if '~' < 0 | ||
| 698 | case '~' + 256: | ||
| 699 | #endif | ||
| 700 | return true; | ||
| 274 | 701 | ||
| 275 | #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | 702 | default: |
| 276 | #undef c_tolower | 703 | return false; |
| 277 | #define c_tolower(c) \ | 704 | } |
| 278 | ({ int __c = (c); \ | 705 | } |
| 279 | (__c >= 'A' && __c <= 'Z' ? __c - 'A' + 'a' : __c); \ | 706 | |
| 280 | }) | 707 | C_CTYPE_INLINE bool |
| 281 | #undef c_toupper | 708 | c_isspace (int c) |
| 282 | #define c_toupper(c) \ | 709 | { |
| 283 | ({ int __c = (c); \ | 710 | switch (c) |
| 284 | (__c >= 'a' && __c <= 'z' ? __c - 'a' + 'A' : __c); \ | 711 | { |
| 285 | }) | 712 | case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': |
| 713 | return true; | ||
| 714 | default: | ||
| 715 | return false; | ||
| 716 | } | ||
| 717 | } | ||
| 718 | |||
| 719 | C_CTYPE_INLINE bool | ||
| 720 | c_isupper (int c) | ||
| 721 | { | ||
| 722 | switch (c) | ||
| 723 | { | ||
| 724 | _C_CTYPE_UPPER: | ||
| 725 | return true; | ||
| 726 | default: | ||
| 727 | return false; | ||
| 728 | } | ||
| 729 | } | ||
| 730 | |||
| 731 | C_CTYPE_INLINE bool | ||
| 732 | c_isxdigit (int c) | ||
| 733 | { | ||
| 734 | switch (c) | ||
| 735 | { | ||
| 736 | _C_CTYPE_DIGIT: | ||
| 737 | _C_CTYPE_A_THRU_F: | ||
| 738 | return true; | ||
| 739 | |||
| 740 | default: | ||
| 741 | return false; | ||
| 742 | } | ||
| 743 | } | ||
| 744 | |||
| 745 | C_CTYPE_INLINE int | ||
| 746 | c_tolower (int c) | ||
| 747 | { | ||
| 748 | switch (c) | ||
| 749 | { | ||
| 750 | _C_CTYPE_UPPER_N (0): | ||
| 751 | #if _C_CTYPE_SIGNED_EBCDIC | ||
| 752 | c += 256; | ||
| 753 | /* Fall through. */ | ||
| 754 | _C_CTYPE_UPPER_N (256): | ||
| 286 | #endif | 755 | #endif |
| 756 | return c - 'A' + 'a'; | ||
| 287 | 757 | ||
| 288 | #endif /* optimizing for speed */ | 758 | default: |
| 759 | return c; | ||
| 760 | } | ||
| 761 | } | ||
| 289 | 762 | ||
| 763 | C_CTYPE_INLINE int | ||
| 764 | c_toupper (int c) | ||
| 765 | { | ||
| 766 | switch (c) | ||
| 767 | { | ||
| 768 | _C_CTYPE_LOWER_N (0): | ||
| 769 | #if _C_CTYPE_SIGNED_EBCDIC | ||
| 770 | c += 256; | ||
| 771 | /* Fall through. */ | ||
| 772 | _C_CTYPE_LOWER_N (256): | ||
| 773 | #endif | ||
| 774 | return c - 'a' + 'A'; | ||
| 775 | |||
| 776 | default: | ||
| 777 | return c; | ||
| 778 | } | ||
| 779 | } | ||
| 290 | 780 | ||
| 291 | #ifdef __cplusplus | 781 | #ifdef __cplusplus |
| 292 | } | 782 | } |
| 293 | #endif | 783 | #endif |
| 294 | 784 | ||
| 785 | _GL_INLINE_HEADER_END | ||
| 786 | |||
| 295 | #endif /* C_CTYPE_H */ | 787 | #endif /* C_CTYPE_H */ |
diff --git a/lib/get-permissions.c b/lib/get-permissions.c index 459513c9251..9dfb0764ce4 100644 --- a/lib/get-permissions.c +++ b/lib/get-permissions.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* get-permissions.c - get permissions of a file | 1 | /* Get permissions of a file. -*- coding: utf-8 -*- |
| 2 | 2 | ||
| 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. |
| 4 | 4 | ||
diff --git a/lib/qcopy-acl.c b/lib/qcopy-acl.c index c4507424719..9db9033816d 100644 --- a/lib/qcopy-acl.c +++ b/lib/qcopy-acl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* copy-acl.c - copy access control list from one file to another file | 1 | /* Copy access control list from one file to another. -*- coding: utf-8 -*- |
| 2 | 2 | ||
| 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. |
| 4 | 4 | ||
diff --git a/lib/set-permissions.c b/lib/set-permissions.c index 1aa5b4941c7..8e6ecf365d1 100644 --- a/lib/set-permissions.c +++ b/lib/set-permissions.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* set-permissions.c - set permissions of a file | 1 | /* Set permissions of a file. -*- coding: utf-8 -*- |
| 2 | 2 | ||
| 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2003, 2005-2015 Free Software Foundation, Inc. |
| 4 | 4 | ||