30
30
% Please try the latest version of texinfo.tex before submitting bug
31
31
% reports; you can get the latest version from:
32
32
% ftp://ftp.gnu.org/gnu/texinfo.tex
33
% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
34
% ftp://texinfo.org/tex/texinfo.tex
35
% ftp://us.ctan.org/macros/texinfo/texinfo.tex
36
% (and all CTAN mirrors, finger ctan@us.ctan.org for a list).
37
% /home/gd/gnu/doc/texinfo.tex on the GNU machines.
33
% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
34
% ftp://texinfo.org/texinfo/texinfo.tex
35
% ftp://tug.org/tex/texinfo.tex
36
% (and all CTAN mirrors, see http://www.ctan.org),
37
% and /home/gd/gnu/doc/texinfo.tex on the GNU machines.
38
39
% The texinfo.tex in any given Texinfo distribution could well be out
39
40
% of date, so if that's what you're using, please check.
40
% Texinfo has a small home page at http://texinfo.org/.
42
% Texinfo has a small home page at http://texinfo.org/ and also
43
% http://www.gnu.org/software/texinfo.
42
45
% Send bug reports to bug-texinfo@gnu.org. Please include including a
43
46
% complete document in each bug report with which we can reproduce the
836
% @math means output in math mode.
837
% We don't use $'s directly in the definition of \math because control
838
% sequences like \math are expanded when the toc file is written. Then,
839
% we read the toc file back, the $'s will be normal characters (as they
840
% should be, according to the definition of Texinfo). So we must use a
841
% control sequence to switch into and out of math mode.
843
% This isn't quite enough for @math to work properly in indices, but it
844
% seems unlikely it will ever be needed there.
846
\let\implicitmath = $
847
\def\math#1{\implicitmath #1\implicitmath}
839
% @math outputs its argument in math mode.
840
% We don't use $'s directly in the definition of \math because we need
841
% to set catcodes according to plain TeX first, to allow for subscripts,
842
% superscripts, special math chars, etc.
844
% @math does not do math typesetting in section titles, index
845
% entries, and other such contexts where the catcodes are set before
846
% @math gets a chance to work. This could perhaps be fixed, but for now
847
% at least we can have real math in the main text, where it's needed most.
849
\let\implicitmath = $%$ font-lock fix
851
% One complication: _ usually means subscripts, but it could also mean
852
% an actual _ character, as in @math{@var{some_variable} + 1}. So make
853
% _ within @math be active (mathcode "8000), and distinguish by seeing
854
% if the current family is \slfam, which is what @var uses.
856
{\catcode95 = \active % 95 = _
857
\gdef\mathunderscore{%
859
\def_{\ifnum\fam=\slfam \_\else\sb\fi}%
862
% Another complication: we want \\ (and @\) to output a \ character.
863
% FYI, plain.tex uses \\ as a temporary control sequence (why?), but
864
% this is not advertised and we don't care. Texinfo does not
865
% otherwise define @\.
867
% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
868
\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
872
\mathcode`\_="8000 \mathunderscore
873
\let\\ = \mathbackslash
874
\implicitmath\finishmath}
875
\def\finishmath#1{#1\implicitmath\Etex}
849
877
% @bullet and @minus need the same treatment as @math, just above.
850
878
\def\bullet{\implicitmath\ptexbullet\implicitmath}
965
995
\edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
967
997
\def\chapentry ##1##2##3{}
998
\let\appendixentry = \chapentry
968
999
\def\unnumbchapentry ##1##2{}
969
1000
\def\secentry ##1##2##3##4{\advancenumber{chap##2}}
970
\def\unnumbsecentry ##1##2{}
1001
\def\unnumbsecentry ##1##2##3{\advancenumber{chap##2}}
971
1002
\def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
972
\def\unnumbsubsecentry ##1##2{}
1003
\def\unnumbsubsecentry ##1##2##3##4{\advancenumber{sec##2.##3}}
973
1004
\def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
974
\def\unnumbsubsubsecentry ##1##2{}
1005
\def\unnumbsubsubsecentry ##1##2##3##4##5{\advancenumber{subsec##2.##3.##4}}
975
1006
\input \jobname.toc
976
1007
\def\chapentry ##1##2##3{%
977
1008
\pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
1009
\let\appendixentry = \chapentry
978
1010
\def\unnumbchapentry ##1##2{%
979
1011
\pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
980
1012
\def\secentry ##1##2##3##4{%
981
1013
\pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
982
\def\unnumbsecentry ##1##2{%
983
\pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
1014
\def\unnumbsecentry ##1##2##3{%
1015
\pdfoutline goto name{\pdfmkpgn{##3}}{##1}}
984
1016
\def\subsecentry ##1##2##3##4##5{%
985
1017
\pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
986
\def\unnumbsubsecentry ##1##2{%
987
\pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
1018
\def\unnumbsubsecentry ##1##2##3##4{%
1019
\pdfoutline goto name{\pdfmkpgn{##4}}{##1}}
988
1020
\def\subsubsecentry ##1##2##3##4##5##6{%
989
1021
\pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
990
\def\unnumbsubsubsecentry ##1##2{%
991
\pdfoutline goto name{\pdfmkpgn{##2}}{##1}}
1022
\def\unnumbsubsubsecentry ##1##2##3##4##5{%
1023
\pdfoutline goto name{\pdfmkpgn{##5}}{##1}}
992
1024
\input \jobname.toc
995
1027
\def\makelinks #1,{%
996
1028
\def\params{#1}\def\E{END}%
1224
1273
% In order for the font changes to affect most math symbols and letters,
1225
1274
% we have to define the \textfont of the standard families. Since
1226
% texinfo doesn't allow for producing subscripts and superscripts, we
1227
% don't bother to reset \scriptfont and \scriptscriptfont (which would
1228
% also require loading a lot more fonts).
1275
% texinfo doesn't allow for producing subscripts and superscripts except
1276
% in the main text, we don't bother to reset \scriptfont and
1277
% \scriptscriptfont (which would also require loading a lot more fonts).
1230
1279
\def\resetmathfonts{%
1231
\textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
1232
\textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
1233
\textfont\ttfam = \tentt \textfont\sffam = \tensf
1280
\textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
1281
\textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
1282
\textfont\ttfam=\tentt \textfont\sffam=\tensf
1237
1285
% The font-changing commands redefine the meanings of \tenSTYLE, instead
1238
1286
% of just \STYLE. We do this so that font changes will continue to work
1239
1287
% in math mode, where it is the current \fam that is relevant in most
2350
2413
\let\item = \relax
2353
% Ignore @ignore ... @end ignore.
2416
% Ignore @ignore, @ifhtml, @ifinfo, @ifplaintext, @ifnottex, @html, @menu,
2417
% @direntry, and @documentdescription.
2355
2419
\def\ignore{\doignore{ignore}}
2357
% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
2420
\def\ifhtml{\doignore{ifhtml}}
2359
2421
\def\ifinfo{\doignore{ifinfo}}
2360
\def\ifhtml{\doignore{ifhtml}}
2422
\def\ifplaintext{\doignore{ifplaintext}}
2361
2423
\def\ifnottex{\doignore{ifnottex}}
2362
2424
\def\html{\doignore{html}}
2363
2425
\def\menu{\doignore{menu}}
2364
2426
\def\direntry{\doignore{direntry}}
2427
\def\documentdescription{\doignore{documentdescription}}
2428
\def\documentdescriptionword{documentdescription}
2366
2430
% @dircategory CATEGORY -- specify a category of the dir file
2367
2431
% which this file should belong to. Ignore this in TeX.
2582
2657
\def\ifclearfail{\nestedignore{ifclear}}
2583
2658
\defineunmatchedend{ifclear}
2585
% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
2586
% following, through the first @end iftex (etc.). Make `@end iftex'
2587
% (etc.) valid only after an @iftex.
2660
% @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we
2661
% read the text following, through the first @end iftex (etc.). Make
2662
% `@end iftex' (etc.) valid only after an @iftex.
2589
2664
\def\iftex{\conditionalsucceed{iftex}}
2590
2665
\def\ifnothtml{\conditionalsucceed{ifnothtml}}
2591
2666
\def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
2667
\def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}}
2592
2668
\defineunmatchedend{iftex}
2593
2669
\defineunmatchedend{ifnothtml}
2594
2670
\defineunmatchedend{ifnotinfo}
2671
\defineunmatchedend{ifnotplaintext}
2596
% We can't just want to start a group at @iftex (for example) and end it
2597
% at @end iftex, since then @set commands inside the conditional have no
2673
% We can't just want to start a group at @iftex (etc.) and end it at
2674
% @end iftex, since then @set commands inside the conditional have no
2598
2675
% effect (they'd get reverted at the end of the group). So we must
2599
2676
% define \Eiftex to redefine itself to be its previous value. (We can't
2600
2677
% just define it to fail again with an ``unmatched end'' error, since
2722
2813
\def\u{\realbackslash u}%
2723
2814
\def\v{\realbackslash v}%
2724
2815
\def\H{\realbackslash H}%
2816
\def\dotless##1{\realbackslash dotless {##1}}%
2725
2817
% Take care of the plain tex special European modified letters.
2726
\def\oe{\realbackslash oe}%
2727
\def\ae{\realbackslash ae}%
2728
\def\aa{\realbackslash aa}%
2818
\def\AA{\realbackslash AA}%
2819
\def\AE{\realbackslash AE}%
2820
\def\L{\realbackslash L}%
2729
2821
\def\OE{\realbackslash OE}%
2730
\def\AE{\realbackslash AE}%
2731
\def\AA{\realbackslash AA}%
2732
\def\o{\realbackslash o}%
2733
2822
\def\O{\realbackslash O}%
2823
\def\aa{\realbackslash aa}%
2824
\def\ae{\realbackslash ae}%
2734
2825
\def\l{\realbackslash l}%
2735
\def\L{\realbackslash L}%
2826
\def\oe{\realbackslash oe}%
2827
\def\o{\realbackslash o}%
2736
2828
\def\ss{\realbackslash ss}%
2737
% Take care of texinfo commands likely to appear in an index entry.
2738
% (Must be a way to avoid doing expansion at all, and thus not have to
2739
% laboriously list every single command here.)
2740
\def\@{@}% will be @@ when we switch to @ as escape char.
2741
% Need these in case \tex is in effect and \{ is a \delimiter again.
2742
% But can't use \lbracecmd and \rbracecmd because texindex assumes
2743
% braces and backslashes are used only as delimiters.
2746
\def\_{{\realbackslash _}}%
2747
\def\w{\realbackslash w }%
2830
% Although these internals commands shouldn't show up, sometimes they do.
2748
2831
\def\bf{\realbackslash bf }%
2832
\def\gtr{\realbackslash gtr}%
2833
\def\hat{\realbackslash hat}%
2834
\def\less{\realbackslash less}%
2749
2835
%\def\rm{\realbackslash rm }%
2836
\def\sf{\realbackslash sf}%
2750
2837
\def\sl{\realbackslash sl }%
2751
\def\sf{\realbackslash sf}%
2838
\def\tclose##1{\realbackslash tclose {##1}}%
2752
2839
\def\tt{\realbackslash tt}%
2753
\def\gtr{\realbackslash gtr}%
2754
\def\less{\realbackslash less}%
2755
\def\hat{\realbackslash hat}%
2841
\def\b##1{\realbackslash b {##1}}%
2842
\def\i##1{\realbackslash i {##1}}%
2843
\def\sc##1{\realbackslash sc {##1}}%
2844
\def\t##1{\realbackslash t {##1}}%
2845
\def\r##1{\realbackslash r {##1}}%
2756
2847
\def\TeX{\realbackslash TeX}%
2848
\def\acronym##1{\realbackslash acronym {##1}}%
2849
\def\cite##1{\realbackslash cite {##1}}%
2850
\def\code##1{\realbackslash code {##1}}%
2851
\def\command##1{\realbackslash command {##1}}%
2852
\def\dfn##1{\realbackslash dfn {##1}}%
2757
2853
\def\dots{\realbackslash dots }%
2758
\def\result{\realbackslash result}%
2759
\def\equiv{\realbackslash equiv}%
2760
\def\expansion{\realbackslash expansion}%
2761
\def\print{\realbackslash print}%
2762
\def\error{\realbackslash error}%
2763
\def\point{\realbackslash point}%
2764
\def\copyright{\realbackslash copyright}%
2765
\def\tclose##1{\realbackslash tclose {##1}}%
2766
\def\code##1{\realbackslash code {##1}}%
2767
\def\uref##1{\realbackslash uref {##1}}%
2768
\def\url##1{\realbackslash url {##1}}%
2854
\def\emph##1{\realbackslash emph {##1}}%
2769
2855
\def\env##1{\realbackslash env {##1}}%
2770
\def\command##1{\realbackslash command {##1}}%
2856
\def\file##1{\realbackslash file {##1}}%
2857
\def\kbd##1{\realbackslash kbd {##1}}%
2858
\def\key##1{\realbackslash key {##1}}%
2859
\def\math##1{\realbackslash math {##1}}%
2771
2860
\def\option##1{\realbackslash option {##1}}%
2772
\def\dotless##1{\realbackslash dotless {##1}}%
2773
2861
\def\samp##1{\realbackslash samp {##1}}%
2774
\def\,##1{\realbackslash ,{##1}}%
2775
\def\t##1{\realbackslash t {##1}}%
2776
\def\r##1{\realbackslash r {##1}}%
2777
\def\i##1{\realbackslash i {##1}}%
2778
\def\b##1{\realbackslash b {##1}}%
2779
\def\sc##1{\realbackslash sc {##1}}%
2780
\def\cite##1{\realbackslash cite {##1}}%
2781
\def\key##1{\realbackslash key {##1}}%
2782
\def\file##1{\realbackslash file {##1}}%
2862
\def\strong##1{\realbackslash strong {##1}}%
2863
\def\uref##1{\realbackslash uref {##1}}%
2864
\def\url##1{\realbackslash url {##1}}%
2783
2865
\def\var##1{\realbackslash var {##1}}%
2784
\def\kbd##1{\realbackslash kbd {##1}}%
2785
\def\dfn##1{\realbackslash dfn {##1}}%
2786
\def\emph##1{\realbackslash emph {##1}}%
2787
\def\acronym##1{\realbackslash acronym {##1}}%
2866
\def\w{\realbackslash w }%
2868
% These math commands don't seem likely to be used in index entries.
2869
\def\copyright{\realbackslash copyright}%
2870
\def\equiv{\realbackslash equiv}%
2871
\def\error{\realbackslash error}%
2872
\def\expansion{\realbackslash expansion}%
2873
\def\point{\realbackslash point}%
2874
\def\print{\realbackslash print}%
2875
\def\result{\realbackslash result}%
2789
2877
% Handle some cases of @value -- where the variable name does not
2790
2878
% contain - or _, and the value does not contain any
2825
2916
\let\H=\indexdummyfont
2826
2917
\let\dotless=\indexdummyfont
2827
2918
% Take care of the plain tex special European modified letters.
2839
\let\w=\indexdummyfont
2931
% Don't no-op \tt, since it isn't a user-level command
2932
% and is used in the definitions of the active chars like <, >, |, etc.
2933
% Likewise with the other plain tex font commands.
2934
%\let\tt=\indexdummyfont
2936
\let\b=\indexdummyfont
2937
\let\i=\indexdummyfont
2938
\let\r=\indexdummyfont
2939
\let\sc=\indexdummyfont
2840
2940
\let\t=\indexdummyfont
2841
\let\r=\indexdummyfont
2842
\let\i=\indexdummyfont
2843
\let\b=\indexdummyfont
2844
\let\emph=\indexdummyfont
2845
\let\strong=\indexdummyfont
2942
\let\TeX=\indexdummytex
2943
\let\acronym=\indexdummyfont
2846
2944
\let\cite=\indexdummyfont
2847
\let\sc=\indexdummyfont
2848
%Don't no-op \tt, since it isn't a user-level command
2849
% and is used in the definitions of the active chars like <, >, |...
2850
%\let\tt=\indexdummyfont
2851
\let\tclose=\indexdummyfont
2852
2945
\let\code=\indexdummyfont
2853
\let\url=\indexdummyfont
2854
\let\uref=\indexdummyfont
2946
\let\command=\indexdummyfont
2947
\let\dfn=\indexdummyfont
2948
\let\dots=\indexdummydots
2949
\let\emph=\indexdummyfont
2855
2950
\let\env=\indexdummyfont
2856
\let\acronym=\indexdummyfont
2857
\let\command=\indexdummyfont
2858
\let\option=\indexdummyfont
2859
2951
\let\file=\indexdummyfont
2860
\let\samp=\indexdummyfont
2861
2952
\let\kbd=\indexdummyfont
2862
2953
\let\key=\indexdummyfont
2954
\let\math=\indexdummyfont
2955
\let\option=\indexdummyfont
2956
\let\samp=\indexdummyfont
2957
\let\strong=\indexdummyfont
2958
\let\uref=\indexdummyfont
2959
\let\url=\indexdummyfont
2863
2960
\let\var=\indexdummyfont
2864
\let\TeX=\indexdummytex
2865
\let\dots=\indexdummydots
2961
\let\w=\indexdummyfont
2869
2964
% To define \realbackslash, we must make \ not be an escape.
3934
4039
% The last argument is the page number.
3935
4040
% The arguments in between are the chapter number, section number, ...
3937
% Chapter-level things, for both the long and short contents.
4042
% Chapters, in the main contents.
3938
4043
\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
3940
% See comments in \dochapentry re vbox and related settings
4045
% Chapters, in the short toc.
4046
% See comments in \dochapentry re vbox and related settings.
3941
4047
\def\shortchapentry#1#2#3{%
3942
4048
\tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}%
4051
% Appendices, in the main contents.
4052
\def\appendixentry#1#2#3{\dochapentry{\putwordAppendix{} #2\labelspace#1}{#3}}
4054
% Appendices, in the short toc.
4055
\let\shortappendixentry = \shortchapentry
3945
4057
% Typeset the label for a chapter or appendix for the short contents.
3946
% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
4058
% The arg is, e.g., `Appendix A' for an appendix, or `3' for a chapter.
3947
4059
% We could simplify the code here by writing out an \appendixentry
3948
4060
% command in the toc file for appendices, instead of using \chapentry
3949
4061
% for both, but it doesn't seem worth it.
3951
4063
\newdimen\shortappendixwidth
3953
4065
\def\shortchaplabel#1{%
3954
% Compute width of word "Appendix", may change with language.
3955
\setbox0 = \hbox{\shortcontrm \putwordAppendix}%
3956
\shortappendixwidth = \wd0
3958
% We typeset #1 in a box of constant width, regardless of the text of
3959
% #1, so the chapter titles will come out aligned.
3960
\setbox0 = \hbox{#1}%
3961
\dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
3963
% This space should be plenty, since a single number is .5em, and the
4066
% This space should be enough, since a single number is .5em, and the
3964
4067
% widest letter (M) is 1em, at least in the Computer Modern fonts.
4068
% But use \hss just in case.
3965
4069
% (This space doesn't include the extra space that gets added after
3966
4070
% the label; that gets put in by \shortchapentry above.)
3967
\advance\dimen0 by 1.1em
3968
\hbox to \dimen0{#1\hfil}%
4072
\hbox to \dimen0{#1\hss}%
4075
% Unnumbered chapters.
3971
4076
\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
3972
4077
\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno\bgroup#2\egroup}}
3975
4080
\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
3976
\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
4081
\def\unnumbsecentry#1#2#3{\dosecentry{#1}{#3}}
3979
4084
\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
3980
\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
4085
\def\unnumbsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
3982
4087
% And subsubsections.
3983
4088
\def\subsubsecentry#1#2#3#4#5#6{%
3984
4089
\dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
3985
\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
4090
\def\unnumbsubsubsecentry#1#2#3#4#5{\dosubsubsecentry{#1}{#5}}
3987
4092
% This parameter controls the indentation of the various levels.
3988
4093
\newdimen\tocindent \tocindent = 3pc
4043
4148
\message{environments,}
4044
4149
% @foo ... @end foo.
4151
% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
4046
4153
% Since these characters are used in examples, it should be an even number of
4047
4154
% \tt widths. Each \tt character is 1en, so two makes it 1em.
4048
% Furthermore, these definitions must come after we define our fonts.
4049
\newbox\dblarrowbox \newbox\longdblarrowbox
4050
\newbox\pushcharbox \newbox\bullbox
4051
\newbox\equivbox \newbox\errorbox
4054
%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
4055
%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
4056
%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
4057
%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
4058
% Adapted from the manmac format (p.420 of TeXbook)
4059
%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
4063
% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
4064
4156
\def\point{$\star$}
4065
4157
\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
4066
4158
\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
4067
4159
\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
4068
4160
\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
4162
% The @error{} command.
4070
4163
% Adapted from the TeXbook's \boxit.
4071
4167
{\tentt \global\dimen0 = 3em}% Width of the box.
4072
4168
\dimen2 = .55pt % Thickness of rules
4073
4169
% The text. (`r' is open on the right, `e' somewhat less so on the left.)
4074
4170
\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
4076
4172
\global\setbox\errorbox=\hbox to \dimen0{\hfil
4077
4173
\hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
4078
4174
\advance\hsize by -2\dimen2 % Rules.
4620
4730
{\df #1}\enskip % Generate function name
4623
% Actually process the body of a definition
4624
% #1 should be the terminating control sequence, such as \Edefun.
4625
% #2 should be the "another name" control sequence, such as \defunx.
4626
% #3 should be the control sequence that actually processes the header,
4627
% such as \defunheader.
4629
\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
4631
% Define the end token that this defining construct specifies
4632
% so that it will exit this group.
4633
\def#1{\endgraf\endgroup\medbreak}%
4634
\def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
4636
\advance\leftskip by \defbodyindent
4637
\exdentamount=\defbodyindent
4639
\catcode 61=\active % 61 is `='
4640
\obeylines\activeparens\spacesplit#3}
4733
% Common pieces to start any @def...
4642
4734
% #1 is the \E... control sequence to end the definition (which we define).
4643
% #2 is the \...x control sequence for consecutive fns (which we define).
4644
% #3 is the control sequence to call to resume processing.
4735
% #2 is the \...x control sequence (which our caller defines).
4736
% #3 is the control sequence to process the header, such as \defunheader.
4738
\def\parsebodycommon#1#2#3{%
4740
% If there are two @def commands in a row, we'll have a \nobreak,
4741
% which is there to keep the function description together with its
4742
% header. But if there's nothing but headers, we want to allow a
4744
\ifnum\lastpenalty = 10000 \penalty0 \fi
4747
% Define the \E... end token that this defining construct specifies
4748
% so that it will exit this group.
4749
\def#1{\endgraf\endgroup\medbreak}%
4752
\advance\leftskip by \defbodyindent
4753
\exdentamount=\defbodyindent
4756
% Process body of @defun, @deffn, @defmac, etc.
4758
\def\defparsebody#1#2#3{%
4759
\parsebodycommon{#1}{#2}{#3}%
4760
\def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
4761
\catcode61=\active % 61 is `='
4762
\begingroup\obeylines\activeparens
4766
% #1, #2, #3 are the common arguments (see \defparsebody).
4645
4767
% #4, delimited by the space, is the class name.
4647
\def\defmethparsebody#1#2#3#4 {\begingroup\inENV %
4649
% Define the end token that this defining construct specifies
4650
% so that it will exit this group.
4651
\def#1{\endgraf\endgroup\medbreak}%
4652
\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
4654
\advance\leftskip by \defbodyindent
4655
\exdentamount=\defbodyindent
4656
\begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
4769
\def\defmethparsebody#1#2#3#4 {%
4770
\parsebodycommon{#1}{#2}{#3}%
4771
\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
4772
\begingroup\obeylines\activeparens
4773
\spacesplit{#3{#4}}%
4658
4776
% Used for @deftypemethod and @deftypeivar.
4659
% #1 is the \E... control sequence to end the definition (which we define).
4660
% #2 is the \...x control sequence for consecutive fns (which we define).
4661
% #3 is the control sequence to call to resume processing.
4777
% #1, #2, #3 are the common arguments (see \defparsebody).
4662
4778
% #4, delimited by a space, is the class name.
4663
4779
% #5 is the method's return type.
4665
\def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV
4667
\def#1{\endgraf\endgroup\medbreak}%
4781
\def\deftypemethparsebody#1#2#3#4 #5 {%
4782
\parsebodycommon{#1}{#2}{#3}%
4668
4783
\def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}%
4670
\advance\leftskip by \defbodyindent
4671
\exdentamount=\defbodyindent
4672
\begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}}
4784
\begingroup\obeylines\activeparens
4785
\spacesplit{#3{#4}{#5}}%
4674
4788
% Used for @deftypeop. The change from \deftypemethparsebody is an
4675
4789
% extra argument at the beginning which is the `category', instead of it
4678
4792
% input at hand. Thus also need a control sequence (passed as #5) for
4679
4793
% the \E... definition to assign the category name to.
4681
\def\deftypeopparsebody#1#2#3#4#5 #6 {\begingroup\inENV
4683
\def#1{\endgraf\endgroup\medbreak}%
4795
\def\deftypeopparsebody#1#2#3#4#5 #6 {%
4796
\parsebodycommon{#1}{#2}{#3}%
4684
4797
\def#2##1 ##2 ##3 {%
4686
4799
\begingroup\obeylines\activeparens\spacesplit{#3{##2}{##3}}}%
4688
\advance\leftskip by \defbodyindent
4689
\exdentamount=\defbodyindent
4690
\begingroup\obeylines\activeparens\spacesplit{#3{#5}{#6}}}
4800
\begingroup\obeylines\activeparens
4801
\spacesplit{#3{#5}{#6}}%
4692
\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
4694
% Define the end token that this defining construct specifies
4695
% so that it will exit this group.
4696
\def#1{\endgraf\endgroup\medbreak}%
4697
\def#2##1 ##2 {\def#4{##1}%
4698
\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
4700
\advance\leftskip by \defbodyindent
4701
\exdentamount=\defbodyindent
4702
\begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
4805
\def\defopparsebody #1#2#3#4#5 {%
4806
\parsebodycommon{#1}{#2}{#3}%
4807
\def#2##1 ##2 {\def#4{##1}%
4808
\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
4809
\begingroup\obeylines\activeparens
4810
\spacesplit{#3{#5}}%
4704
4813
% These parsing functions are similar to the preceding ones
4705
4814
% except that they do not make parens into active characters.
4706
4815
% These are used for "variables" since they have no arguments.
4708
\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
4710
% Define the end token that this defining construct specifies
4711
% so that it will exit this group.
4712
\def#1{\endgraf\endgroup\medbreak}%
4713
\def#2{\begingroup\obeylines\spacesplit#3}%
4715
\advance\leftskip by \defbodyindent
4716
\exdentamount=\defbodyindent
4718
\catcode 61=\active %
4719
\obeylines\spacesplit#3}
4721
% This is used for \def{tp,vr}parsebody. It could probably be used for
4722
% some of the others, too, with some judicious conditionals.
4724
\def\parsebodycommon#1#2#3{%
4727
% Define the end token that this defining construct specifies
4728
% so that it will exit this group.
4729
\def#1{\endgraf\endgroup\medbreak}%
4730
\def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
4732
\advance\leftskip by \defbodyindent
4733
\exdentamount=\defbodyindent
4734
\begingroup\obeylines
4817
\def\defvarparsebody #1#2#3{%
4818
\parsebodycommon{#1}{#2}{#3}%
4819
\def#2{\begingroup\obeylines\spacesplit#3}%
4820
\catcode61=\active %
4821
\begingroup\obeylines
4826
\def\defopvarparsebody #1#2#3#4#5 {%
4827
\parsebodycommon{#1}{#2}{#3}%
4828
\def#2##1 ##2 {\def#4{##1}%
4829
\begingroup\obeylines\spacesplit{#3{##2}}}%
4830
\begingroup\obeylines
4831
\spacesplit{#3{#5}}%
4737
4834
\def\defvrparsebody#1#2#3#4 {%
4738
4835
\parsebodycommon{#1}{#2}{#3}%
4836
\def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
4837
\begingroup\obeylines
4739
4838
\spacesplit{#3{#4}}%
4766
4867
#1{\removeemptybraces#2\relax}{#3}%
4769
\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
4771
% Define the end token that this defining construct specifies
4772
% so that it will exit this group.
4773
\def#1{\endgraf\endgroup\medbreak}%
4774
\def#2##1 ##2 {\def#4{##1}%
4775
\begingroup\obeylines\spacesplit{#3{##2}}}%
4777
\advance\leftskip by \defbodyindent
4778
\exdentamount=\defbodyindent
4779
\begingroup\obeylines\spacesplit{#3{#5}}}
4781
4870
% Split up #2 at the first space token.
4782
4871
% call #1 with two arguments:
4783
4872
% the first is all of #2 before the space token,
4784
4873
% the second is all of #2 after that space token.
4785
4874
% If #2 contains no space token, all of it is passed as the first arg
4786
4875
% and the second is passed as empty.
4789
4878
\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
4790
4879
\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
4792
4881
#1{#2}{}\else #1{#2}{#3#4}\fi}}
4794
% So much for the things common to all kinds of definitions.
4796
4883
% Define @defun.
4798
4885
% First, define the processing that is wanted for arguments of \defun
5851
5929
\global\warnednoepsftrue
5854
\imagexxx #1,,,\finish
5932
\imagexxx #1,,,,,\finish
5858
5936
% Arguments to @image:
5859
5937
% #1 is (mandatory) image filename; we tack on .eps extension.
5860
5938
% #2 is (optional) width, #3 is (optional) height.
5861
% #4 is just the usual extra ignored arg for parsing this stuff.
5862
\def\imagexxx#1,#2,#3,#4\finish{%
5939
% #4 is (ignored optional) html alt text.
5940
% #5 is (ignored optional) extension.
5941
% #6 is just the usual extra ignored arg for parsing this stuff.
5943
\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
5944
\catcode`\^^M = 5 % in case we're inside an example
5945
\normalturnoffactive % allow _ et al. in names
5946
% If the image is by itself, center it.
5950
% Usually we'll have text after the image which will insert
5951
% \parskip glue, so insert it here too to equalize the space
5953
\nobreak\vskip\parskip
5864
\centerline{\dopdfimage{#1}{#2}{#3}}%
5960
\dopdfimage{#1}{#2}{#3}%
5866
5962
% \epsfbox itself resets \epsf?size at each figure.
5867
5963
\setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
5868
5964
\setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
5870
\catcode`\^^M = 5 % in case we're inside an example
5871
\normalturnoffactive % allow _ et al. in names
5872
% If the image is by itself, center it.
5875
% Usually we'll have text after the image which will insert
5876
% \parskip glue, so insert it here too to equalize the space
5878
\nobreak\vskip\parskip
5880
\centerline{\epsfbox{#1.eps}}%
5883
% In the middle of a paragraph, no extra space.
5968
\ifimagevmode \hss \egroup \bigbreak \fi % space after the image
5891
5972
\message{localization,}