diff options
Diffstat (limited to 'texinfo.tex')
-rw-r--r-- | texinfo.tex | 275 |
1 files changed, 241 insertions, 34 deletions
diff --git a/texinfo.tex b/texinfo.tex index 3e5019e..49e20b8 100644 --- a/texinfo.tex +++ b/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{1999-03-31.13}% +\def\texinfoversion{1999-07-06.19}% % % Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 % Free Software Foundation, Inc. @@ -67,7 +67,6 @@ \catcode`+=\active \catcode`\_=\active} % Save some parts of plain tex whose names we will redefine. - \let\ptexb=\b \let\ptexbullet=\bullet \let\ptexc=\c @@ -87,6 +86,13 @@ % For @tex, we can use \tabalign. \let\+ = \relax +% Get ready for pdf. +\newif\ifpdf +\ifx\pdfoutput\undefined\else + \input pdfcolor + \pdfoutput=1 + \pdftrue +\fi \message{Basics,} \chardef\other=12 @@ -245,6 +251,8 @@ \unvbox\footlinebox \fi % + \ifpdf\pdfmkdest{\the\pageno}\fi + % \ifcropmarks \egroup % end of \vbox\bgroup \hfil\egroup % end of (centering) \line\bgroup @@ -842,6 +850,119 @@ where each line of input produces a line of output.} \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} +\message{pdf,} +% adobe `portable' document format + +\newcount\tempnum +\newcount\lnkcount +\newtoks\filename +\newcount\filenamelength +\newcount\pgn + +\ifpdf +\def\pdfmkdest#1{\pdfdest name{#1@} xyz} +\def\pdfmkpgn#1{#1@} + +% Adding outlines to PDF; macros for calculating structure of outlines +% come from Petr Olsak +\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% + \else \csname#1\endcsname \fi} +\def\advancenumber#1{\tempnum=\expnumber{#1}\relax + \advance\tempnum by1 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}} +\def\pdfmakeoutlines{{% + \openin 1 \jobname.toc + \ifeof 1\else\bgroup + \closein 1 + \indexnofonts + \def\char{char}% because \expnumber uses the section title in a \csname + \def\chapentry ##1##2##3{} + \def\unnumbchapentry ##1##2{} + \def\secentry ##1##2##3##4{\advancenumber{chap##2}} + \def\unnumbsecentry ##1##2{} + \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}} + \def\unnumbsubsecentry ##1##2{} + \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}} + \def\unnumbsubsubsecentry ##1##2{} + \input \jobname.toc + \def\chapentry ##1##2##3{% + \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}} + \def\unnumbchapentry ##1##2{% + \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} + \def\secentry ##1##2##3##4{% + \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}} + \def\unnumbsecentry ##1##2{% + \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} + \def\subsecentry ##1##2##3##4##5{% + \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}} + \def\unnumbsubsecentry ##1##2{% + \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} + \def\subsubsecentry ##1##2##3##4##5##6{% + \pdfoutline goto name{\pdfmkpgn{##6}}{##1}} + \def\unnumbsubsubsecentry ##1##2{% + \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} + \input \jobname.toc + \egroup\fi +}} + +\def\makelinks #1,{% + \def\params{#1}\def\E{END}% + \ifx\params\E + \let\nextmakelinks=\relax + \else + \let\nextmakelinks=\makelinks + \ifnum\lnkcount>0,\fi + \picknum{#1}% + \Blue\pdfannotlink attr{/Border [0 0 0]} + goto name{\pdfmkpgn{\the\pgn}}% + #1% + \advance\lnkcount by 1% + \Black\pdfendlink + \fi + \nextmakelinks +} + +\def\picknum#1{\expandafter\pn#1} +\def\pn#1{% + \def\p{#1}% + \ifx\p\lbrace + \let\nextpn=\ppn + \else + \let\nextpn=\ppnn + \def\first{#1} + \fi + \nextpn +} +\def\ppn#1{\pgn=#1\gobble} +\def\ppnn{\pgn=\first} +\def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} + +\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} +\def\skipspaces#1{\def\PP{#1}\def\D{|}% + \ifx\PP\D\let\nextsp\relax + \else\let\nextsp\skipspaces + \ifx\p\space\else\addtokens{\filename}{\PP}% + \advance\filenamelength by 1 + \fi + \fi + \nextsp} +\def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + +\def\pdflink#1{% + \leavevmode\Red + \begingroup + \normalturnoffactive\def\@{@}% + \pdfannotlink + attr{/Border [0 0 0]}% + user{/Subtype /Link /A << /S /URI /URI (#1) >>}% + \endgroup +} + +\else + \let\pdflink = \gobble + \let\pdfmakeoutlines = \relax +\fi % end \ifpdf + \message{fonts,} % Font-change commands. @@ -1208,23 +1329,43 @@ where each line of input produces a line of output.} % \def\uref#1{\douref #1,,,\finish} \def\douref#1,#2,#3,#4\finish{% + \pdflink{#1}% \setbox0 = \hbox{\ignorespaces #3}% \ifdim\wd0 > 0pt \unhbox0 % third arg given, show only that \else \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt - \unhbox0\ (\code{#1})% second arg given, show both it and url + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url + \fi \else \code{#1}% only url given, so show it \fi \fi + % + \ifpdf + \Black\pdfendlink + \fi } -% rms does not like the angle brackets --karl, 17may97. -% So now @email is just like @uref. +% rms does not like angle brackets --karl, 17may97. +% So now @email is just like @uref, unless we are pdf. +% %\def\email#1{\angleleft{\tt #1}\angleright} -\let\email=\uref +\ifpdf + \def\email#1{\doemail#1,,\finish} + \def\doemail#1,#2,#3\finish{% + \pdflink{mailto:#1}% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi + \Black\pdfendlink + } +\else + \let\email=\uref +\fi % Check if we are currently using a typewriter font. Since all the % Computer Modern typewriter fonts have zero interword stretch (and @@ -1908,10 +2049,11 @@ where each line of input produces a line of output.} \go } -% multitable syntax -\def\tab{&\hskip1sp\relax} % 2/2/96 - % tiny skip here makes sure this column space is - % maintained, even if it is never used. +% This used to have \hskip1sp. But then the space in a template line is +% not enough. That is bad. So let's go back to just & until we +% encounter the problem it was intended to solve again. +% --karl, nathan@acm.org, 20apr99. +\def\tab{&} % @multitable ... @end multitable definitions: % @@ -2063,6 +2205,7 @@ width0pt\relax} \fi \let\deftypefn = \relax \let\deftypefun = \relax \let\deftypeivar = \relax + \let\deftypeop = \relax \let\deftypevar = \relax \let\deftypevr = \relax \let\defun = \relax @@ -3029,7 +3172,7 @@ width0pt\relax} \fi \message{sectioning,} -% Define chapters, sections, etc. +% Chapters, sections, etc. \newcount\chapno \newcount\secno \secno=0 @@ -3037,8 +3180,12 @@ width0pt\relax} \fi \newcount\subsubsecno \subsubsecno=0 % This counter is funny since it counts through charcodes of letters A, B, ... +% The \the is necessary, despite appearances, because \appendixletter is +% expanded while writing the .toc file. \char\appendixno is not +% expandable, thus it is written literally, thus all appendixes come out +% with the same letter (or @) in the toc without it. \newcount\appendixno \appendixno = `\@ -\def\appendixletter{\char\appendixno} +\def\appendixletter{\char\the\appendixno} % Each @chapter defines this as the name of the chapter. % page headings and footings can use it. @section does likewise. @@ -3511,6 +3658,7 @@ width0pt\relax} \fi \message{toc,} +% Table of contents. \newwrite\tocfile % Write an entry to the toc file, opening it if necessary. @@ -3571,6 +3719,7 @@ width0pt\relax} \fi \fi \vfill \eject \contentsalignmacro % in case @setchapternewpage odd is in effect + \pdfmakeoutlines \endgroup \lastnegativepageno = \pageno \pageno = \savepageno @@ -3607,6 +3756,10 @@ width0pt\relax} \fi } \let\shortcontents = \summarycontents +\ifpdf + \pdfcatalog{/PageMode /UseOutlines}% +\fi + % These macros generate individual entries in the table of contents. % The first argument is the chapter or section name. % The last argument is the page number. @@ -3715,6 +3868,7 @@ width0pt\relax} \fi \message{environments,} +% @foo ... @end foo. % Since these characters are used in examples, it should be an even number of % \tt widths. Each \tt character is 1en, so two makes it 1em. @@ -4038,8 +4192,9 @@ width0pt\relax} \fi \message{defuns,} -% Define formatter for defuns -% First, allow user to change definition object font (\df) internally +% @defun etc. + +% Allow user to change definition object font (\df) internally \def\setdeffont #1 {\csname DEF#1\endcsname} \newskip\defbodyindent \defbodyindent=.4in @@ -4166,23 +4321,39 @@ width0pt\relax} \fi \exdentamount=\defbodyindent \begingroup\obeylines\activeparens\spacesplit{#3{#4}}} -% @deftypemethod has an extra argument that nothing else does. Sigh. +% Used for @deftypemethod and @deftypeivar. % #1 is the \E... control sequence to end the definition (which we define). % #2 is the \...x control sequence for consecutive fns (which we define). % #3 is the control sequence to call to resume processing. -% #4, delimited by the space, is the class name. +% #4, delimited by a space, is the class name. % #5 is the method's return type. % -\def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}} +\def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV + \medbreak + \def#1{\endgraf\endgroup\medbreak}% + \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}% + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent + \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}} + +% Used for @deftypeop. The change from \deftypemethparsebody is an +% extra argument at the beginning which is the `category', instead of it +% being the hardwired string `Method' or `Instance Variable'. We have +% to account for this both in the \...x definition and in parsing the +% input at hand. Thus also need a control sequence (passed as #5) for +% the \E... definition to assign the category name to. +% +\def\deftypeopparsebody#1#2#3#4#5 #6 {\begingroup\inENV + \medbreak + \def#1{\endgraf\endgroup\medbreak}% + \def#2##1 ##2 ##3 {% + \def#4{##1}% + \begingroup\obeylines\activeparens\spacesplit{#3{##2}{##3}}}% + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent + \begingroup\obeylines\activeparens\spacesplit{#3{#5}{#6}}} \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV % \medbreak % @@ -4293,12 +4464,13 @@ width0pt\relax} \fi % First, define the processing that is wanted for arguments of \defun % Use this to expand the args and terminate the paragraph they make up -\def\defunargs #1{\functionparens \sl +\def\defunargs#1{\functionparens \sl % Expand, preventing hyphenation at `-' chars. % Note that groups don't affect changes in \hyphenchar. -\hyphenchar\tensl=0 +% Set the font temporarily and use \font in case \setfont made \tensl a macro. +{\tensl\hyphenchar\font=0}% #1% -\hyphenchar\tensl=45 +{\tensl\hyphenchar\font=45}% \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% \interlinepenalty=10000 \advance\rightskip by 0pt plus 1fil @@ -4397,13 +4569,29 @@ width0pt\relax} \fi \def\defop #1 {\def\defoptype{#1}% \defopparsebody\Edefop\defopx\defopheader\defoptype} % -\def\defopheader #1#2#3{% +\def\defopheader#1#2#3{% \dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index \begingroup\defname {#2}{\defoptype\ \putwordon\ #1}% \defunargs {#3}\endgroup % } -% @deftypemethod CLASS RETURN-TYPE METHOD ARG... +% @deftypeop CATEGORY CLASS TYPE OPERATION ARG... +% +\def\deftypeop #1 {\def\deftypeopcategory{#1}% + \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader + \deftypeopcategory} +% +% #1 is the class name, #2 the data type, #3 the operation name, #4 the args. +\def\deftypeopheader#1#2#3#4{% + \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index + \begingroup + \defname{\defheaderxcond#2\relax$$$#3} + {\deftypeopcategory\ \putwordon\ \code{#1}}% + \deftypefunargs{#4}% + \endgroup +} + +% @deftypemethod CLASS TYPE METHOD ARG... % \def\deftypemethod{% \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader} @@ -4552,6 +4740,7 @@ width0pt\relax} \fi \def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}} \def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}} \def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}} +\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}} \def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}} \def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}} \def\defunx#1 {\errmessage{@defunx in invalid context}} @@ -4843,6 +5032,8 @@ width0pt\relax} \fi \message{cross references,} +% @xref etc. + \newwrite\auxfile \newif\ifhavexrefs % True if xref values are known. @@ -4908,6 +5099,7 @@ width0pt\relax} \fi % \def\setref#1#2{{% \indexdummies + \ifpdf \pdfmkdest{#1}\fi \dosetq{#1-title}{Ytitle}% \dosetq{#1-pg}{Ypagenumber}% \dosetq{#1-snt}{#2}% @@ -4955,6 +5147,19 @@ width0pt\relax} \fi % are best written with fairly long node names, containing hyphens, this % is a loss. Therefore, we give the text of the node name again, so it % is as if TeX is seeing it for the first time. + \ifpdf + \leavevmode + \getfilename{#4}% + \ifnum\filenamelength>0 + \pdfannotlink attr{/Border [0 0 0]}% + goto file{\the\filename.pdf} name{#1@}% + \else + \pdfannotlink attr{/Border [0 0 0]}% + goto name{#1@}% + \fi + \BlueGreen + \fi + % \ifdim \wd1 > 0pt \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}% \else @@ -4974,6 +5179,7 @@ width0pt\relax} \fi % page 3 \turnoffactive \putwordpage\tie\refx{#1-pg}{}% \fi + \ifpdf \Black\pdfendlink \fi \endgroup} % \dosetq is the interface for calls from other macros @@ -5347,6 +5553,7 @@ width0pt\relax} \fi \message{localization,} +% and i18n. % @documentlanguage is usually given very early, just after % @setfilename. If done too late, it may not override everything @@ -5406,8 +5613,7 @@ should work if nowhere else does.} % Allow us to assign to \emergencystretch anyway. \def\emergencystretch{\dimen0}% \else - \emergencystretch = \hsize - \divide\emergencystretch by 40 + \emergencystretch = .15\hsize \fi } @@ -5517,6 +5723,7 @@ should work if nowhere else does.} % \letterpaper + \message{and turning on texinfo input format.} % Define macros to output various characters with catcode for normal text. @@ -5684,6 +5891,6 @@ should work if nowhere else does.} @c eval: (add-hook 'write-file-hooks 'time-stamp) @c page-delimiter: "^\\\\message" @c time-stamp-start: "def\\\\texinfoversion{" -@c time-stamp-format: "%:y-%02m-%02d.%H" +@c time-stamp-format: "%:y-%02m-%02d.%02H" @c time-stamp-end: "}" @c End: |