summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2024-08-06 10:30:49 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2024-08-06 10:30:49 +0000
commit04b946905552c11250d135edf71be9db23fcb55d (patch)
treeed21d203021e482963f4acf64364b7038158338c
parentc0af5e48fe35f3826c9b8b686dd10c6d47196ca1 (diff)
[CWEB] Refine PDF-related macros.
Martin Ruckert's talk at TUG'24 about 'Profiling TeX' (watch on YouTube: https://www.youtube.com/live/d7vTW7PR0B4?t=7795s) and the ensuing private discussion with him lead me to inspect the relevant parts of 'cwebacromac.tex' (and 'pwebmac.tex') more closely in order to address the performance issues with certain large C/WEB programs. The most glaring example is MP.W, where every advanced TeX engine (for PDF and HINT) virtually stops for 1--2 seconds (on my machine) at two of the index pages because of the huge lists of section references for the variable 'mp' and the type 'MP' that are used 'everywhere'. (See below.) At this point, we haven't solved the quadratic performance behavior yet. However, the main changes applied in this commit at least slightly improve the macros and their application. In the overall context of the 'knuth-pdf'/'knuth-hint' packages, the 'index issue' reported by Martin becomes more or less irrelvant. The script 'makeall' produces 58 PDF documents in the main run. With all optimizations applied, the runtime is reduced by mere seconds from '1m7s' to '0m59s' (with 'pdftex'). (a) '\pdflink' and '\HINTlink' have lost their second parameter, which was only used with 'plain TeX plus dvipdf' and 'XeTeX' anyway. This cut down the replacement strings significantly. In one example I observed a runtime improvement of about twenty percent (2--3 seconds) by this change alone. (b) Macros '\makeoutlinetoks' and 'outilnedone' swallowed the surrounding macro calls, thus simplifying their application. (c) '\newcount\countC' was replaced with '\newif\ifhavenum' to avoid arithmetic with '0' and '1' for a simple Boolean operation. (d) '\newcount\countD' was renamed to '\countNOS'. (Unrelated.) In order to address the 'worst' CWEB code MP.W mentioned above, I changed both the macros and the 'makeall' script. My local MP.CH changes the '\inx' macro to address two 'Overfull \hboxes', so it is easy to remove the use of '\pdfnote' when setting up the index. Instead, 'makeall' invokes SED to amemd the MP.IDX file created by CWEAVE with the necessary '\pdflink' macro invocations for all section numbers in one fell swoop. This cuts the processing time for MP.TEX in half (!!). However, I do not intend to incorporate this approach into 'cwebmac.tex'/'pwebmac.tex' because this would most likely require '--shell-escape' and become too system-dependent. For small to midsize C/WEB programs, this would show minor improvements anyway. Watch this space for possible further improvements. (I'll hold back the releases of 'CWEB 4.12' and 'pwebmac 5.0' for the time being.) git-svn-id: svn://tug.org/texlive/trunk@71979 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/web2c/cwebdir/ChangeLog8
-rw-r--r--Build/source/texk/web2c/cwebdir/cwebacromac.tex84
-rw-r--r--Build/source/texk/web2c/cwebdir/cwebmac.tex36
-rw-r--r--Build/source/texk/web2c/cwebdir/cwebman.tex6
-rw-r--r--Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex58
-rw-r--r--Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex53
6 files changed, 124 insertions, 121 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog
index d6342ba2017..22d94af0899 100644
--- a/Build/source/texk/web2c/cwebdir/ChangeLog
+++ b/Build/source/texk/web2c/cwebdir/ChangeLog
@@ -1,3 +1,11 @@
+2024-08-06 Andreas Scherer <https://ascherer.github.io>
+
+ * cwebacromac.tex,
+ * cwebmac.tex,
+ * cwebman.tex,
+ * texinputs/pdfctproofmac.tex,
+ * texinputs/pdfctwimac.tex: Refine PDF-related macros.
+
2024-08-02 Andreas Scherer <https://ascherer.github.io>
* ctwill-w2c.ch,
diff --git a/Build/source/texk/web2c/cwebdir/cwebacromac.tex b/Build/source/texk/web2c/cwebdir/cwebacromac.tex
index f8462d06a37..cbba1333de6 100644
--- a/Build/source/texk/web2c/cwebdir/cwebacromac.tex
+++ b/Build/source/texk/web2c/cwebdir/cwebacromac.tex
@@ -1,6 +1,8 @@
% hypertext macros for CWEB listings (in addition to cwebmac.tex)
-% Version 2.0 --- May 2024
+% Used in cwebmac.tex, pdfctwimac.tex, pdfproofmac.tex
+% Version 3.0 --- August 2024
\ifx\ifacrohint\undefined\endinput\fi % these are not standalone macros
+
\ifluatex % LuaTeX is almost like pdfTeX
\protected\def\pdfliteral {\pdfextension literal}
\protected\def\pdfstartlink {\pdfextension startlink\space}
@@ -15,7 +17,6 @@
\let\pdfoutput=\outputmode
\fi % end of LuaTeX->pdfTeX redirection macros
-% Used in cwebmac.tex, pdfctwimac.tex, pdfproofmac.tex
\def\tocpages{1} % Most programs have one-page Table-of-Contents
\def\startpdf{\def\pagemode{/PageMode /UseOutlines}
\ifnum\contentspagenumber=0 \advance \pageno by -\tocpages
@@ -24,9 +25,41 @@
\else \twodigits=\pageno \pageno=\contentspagenumber
\advance \pageno by \tocpages \advance \twodigits by -\pageno
\def\pagelabels{/PageLabels << /Nums [ 0 << /S/D/St \the\pageno >>
- \the\twodigits << /S/D/St \contentspagenumber >> ] >>} \fi
+ \the\twodigits << /S/D/St \contentspagenumber >> ] >>}
+ \fi
\ifpdflua\pdfcatalog{\pagemode\space\pagelabels}
- \else \special{pdf: docview << \pagemode\space\pagelabels >>}\fi}
+ \else\special{pdf: docview << \pagemode\space\pagelabels >>}\fi}
+
+% Local variables; there are a few externals like '\toksA' and '\countA'
+\newtoks\toksB \newtoks\toksC \newtoks\toksD \newtoks\toksF
+\newtoks\usersanitizer
+\newif\iftokprocessed \newif\ifTnum \newif\ifinstr \newif\ifhavenum
+
+\ifacrohint % Common macros for \ifacro and \ifhint
+\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA}
+\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}%
+ \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\toksD={}
+ \toksC={}\let\space\empty}\makenote}\maketoks}}
+\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
+\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}%
+ \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi\toksA={#2}}
+\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|%
+ \let\next=\maketoks % continue processing by default
+ \ifnum\countB>`9 \countB=0 \fi
+ \ifnum\countB<`0
+ \ifhavenum\makenote\fi
+ \ifx\first.\let\next=\maketoksdone % fullstop
+ \else \addtokens\toksB{\the\toksD}
+ \ifx\first,\addtokens\toksB{\space}\fi
+ \fi
+ \else \addtokens\toksC{\the\toksD}\global\havenumtrue
+ \fi
+ \next
+}
+\def\makenote{\addtokens\toksB
+ {\noexpand\pdflink{\the\toksC}}\toksC={}\global\havenumfalse}
+\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
+\fi % End of common macros
\ifacro % The following are general pdf macros
\def\thewidth{\the\wd0 \space}
@@ -34,12 +67,13 @@
\def\thedepth{\the\dp\strutbox\space}
\ifpdflua
\ifx\pdfannotlink\undefined\let\pdfannotlink\pdfstartlink\fi% for pdfTeX 0.14
- \def\pdflink#1#2{\hbox{\pdfannotlink height \theheight depth \thedepth
+ \def\pdflink#1{\hbox{\pdfannotlink height \theheight depth \thedepth
attr{/Border [0 0 0]} goto num #1 \Blue #1\Black\pdfendlink}} % changed 3.69
-\else\def\pdflink#1#2{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}%
+\else\def\pdflink#1{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}%
\special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight
- depth \thedepth << /Type /Annot /Subtype /Link
- /Border [0 0 0] /A << /S /GoTo /D (#2) >> >>}\box0\relax}\fi
+ depth \thedepth << /Type /Annot /Subtype /Link /Border [0 0 0]
+ /A << /S /GoTo /D (\romannumeral #1) >> >>}\box0\relax}
+\fi
\def\sanitizecommand#1#2{\addtokens\usersanitizer
{\noexpand\dosanitizecommand\noexpand#1{#2}}}
\def\dosanitizecommand#1#2{\ifx\nxt#1\addF{#2}\fi}
@@ -49,7 +83,8 @@
\catcode`\[=12 \catcode`\]=12 \catcode`\{=1 \catcode`\}=2
\catcode`\~=12 \def\tildechar{~} \catcode`\~=13
\catcode`\|=0 |catcode`|\=12 |def|bschar{\} |catcode`|\=0 \catcode`\|=12
-\def\makeoutlinetoks{\Tnumfalse\afterassignment\makeolproctok\let\nxt= }
+\def\makeoutlinetoks{\toksF={}\Tnumfalse
+ \afterassignment\makeolproctok\let\nxt= }
\def\makeolnexttok{\afterassignment\makeolproctok\let\nxt= }
\def\makeolgobbletok{\afterassignment\makeolnexttok\let\nxt= }
\def\addF#1{\addtokens\toksF{#1}\tokprocessedtrue}
@@ -141,7 +176,7 @@
\fi\fi\fi\fi\fi
}
\def\outlinedone{\edef\outlinest{\global\noexpand\toksE={\the\toksF}}%
- \outlinest\let\outlinedone=\relax}
+ \outlinest\let\outlinedone=\relax\outlinedone}
\fi % End of pdf macros
\ifhint
@@ -155,34 +190,7 @@
\def\HINThome{\HINTdest name {HINT.home}%
\HINToutline goto name {HINT.home} depth 1 {Table of Contents}}
\def\HINTlabel{{\let\*=\empty\HINTdest num \secstar top}}
-\def\HINTlink#1#2{\HINTstartlink goto num #1 {#1}\HINTendlink}% #2 not used ???
+\def\HINTlink#1{\HINTstartlink goto num #1 {#1}\HINTendlink}
\def\HINTcontents#1#2#3{\HINToutline goto num #3 depth #2 {#1}}
\let\pdflink=\HINTlink
\fi % End of HINT macros
-
-% Common macros for \ifacro and \ifhint
-\ifacrohint
-\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA}
-\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}%
- \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\toksD={}
- \toksC={}\let\space\empty}\makenote}\maketoks}}
-\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
-\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}%
- \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi\toksA={#2}}
-\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|%
- \ifnum\countB>`9 \countB=0 \fi
- \ifnum\countB<`0
- \ifnum0=\countC\else\makenote\fi
- \ifx\first.\let\next=\maketoksdone\else
- \let\next=\maketoks
- \addtokens\toksB{\the\toksD}
- \ifx\first,\addtokens\toksB{\space}\fi
- \fi
- \else \addtokens\toksC{\the\toksD}\global\countC=1\let\next=\maketoks
- \fi
- \next
-}
-\def\makenote{\addtokens\toksB
- {\noexpand\pdflink{\the\toksC}{\romannumeral\the\toksC}}\toksC={}\global\countC=0}
-\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
-\fi % End of common macros
diff --git a/Build/source/texk/web2c/cwebdir/cwebmac.tex b/Build/source/texk/web2c/cwebdir/cwebmac.tex
index f9891daf1bc..d5a148ca951 100644
--- a/Build/source/texk/web2c/cwebdir/cwebmac.tex
+++ b/Build/source/texk/web2c/cwebdir/cwebmac.tex
@@ -1,5 +1,5 @@
% standard macros for CWEB listings (in addition to plain.tex)
-% Version 4.12 --- July 2024
+% Version 4.12 --- August 2024
\ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros
\xdef\fmtversion{\fmtversion+CWEB4.12}
\chardef\cwebversion=4 \chardef\cwebrevision=12
@@ -114,11 +114,9 @@
\def\?{\mathrel?}
\def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi}
-\newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD
-\newtoks\toksE \newtoks\toksF \newtoks\usersanitizer
+\newtoks\toksA \newtoks\toksE
\newcount\countA \countA=0 \newcount\countB \countB=0
-\newcount\countC \countC=0 \newcount\countD \countD=0
-\newif\iftokprocessed \newif\ifTnum \newif\ifinstr
+\newcount\countNOS \countNOS=0
{\def\\{\global\let\spacechar= }\\ }
% Here we decide the output format, depending on the TeX engine in use:
@@ -187,7 +185,7 @@
\outer\def\M#1{\MN{#1}\ifon\vfil\penalty-100\vfilneg % beginning of section
\vskip\intersecskip\startsection\ignorespaces}
\outer\def\N#1#2#3.{% beginning of starred section
- \ifacro{\toksF={}\makeoutlinetoks#3\outlinedone\outlinedone}\fi
+ \ifacro{\makeoutlinetoks#3\outlinedone}\fi
\gdepth=#1\gtitle={#3}\MN{#2}%
\ifon\ifnum#1<\secpagedepth \vfil\eject % force page break if depth is small
\else\vfil\penalty-100\vfilneg\vskip\intersecskip\fi\fi
@@ -354,23 +352,21 @@
\ifacro \def\outsecname{Names of the sections} \let\Xpdf\X
% \ifpdflua \makebookmarks \pdfdest name {NOS} fitb % in versions < 3.68
\ifpdflua \pdfdest name {NOS} fith % changed in version 3.69
- \pdfoutline goto name {NOS} count -\the\countD {\outsecname}
- \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.%
- {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
- \pdfoutline goto num \the\toksA \expandafter{\the\toksE}}
+ \pdfoutline goto name {NOS} count -\the\countNOS {\outsecname}
\else \special{pdf: outline -1 << /Title (\outsecname)
- /Dest [ @thispage /FitH @ypos ] >>}
- \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.%
- {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
- \special{pdf: outline 0 << /Title (\the\toksE)
- /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}}
- \fi\fi
+ /Dest [ @thispage /FitH @ypos ] >>}\fi
+ \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.%
+ {\makeoutlinetoks##2\outlinedone}%
+ \ifpdflua \pdfoutline goto num \the\toksA \expandafter{\the\toksE}
+ \else \special{pdf: outline 0 << /Title (\the\toksE)
+ /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}\fi}
+ \fi % \ifacro
\readsections}
\def\makebookmarks{\let\ZZ=\writebookmarkline \readcontents\relax}
\def\countsections{\message{Number of named sections:}
- {\def\I{\global\advance\countD by 1}\def\X##1\X{\relax}
+ {\def\I{\global\advance\countNOS by 1}\def\X##1\X{\relax}
\def\Q##1.{\relax}\def\Qs##1.{\relax}\def\U##1.{\relax}\def\Us##1.{\relax}
- \readsections\relax}\message{\the\countD}}
+ \readsections\relax}\message{\the\countNOS}}
\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
\else \csname#1\endcsname \fi} % Petr Olsak's macros from texinfo.tex
\def\advancenumber#1{\countA=\expnumber{#1}\relax \advance\countA by1
@@ -396,9 +392,9 @@
\line{\consetup{#2}#1
\rm\leaders\hbox to .5em{.\hfil}\hfil
\ \ifhint
- \HINTlink{#3}{\romannumeral#3}% No page numbers in HINT
+ \HINTlink{#3}% No page numbers in HINT
\HINTcontents{#1}{#2}{#3}%
- \else\ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi
+ \else\ifacro\pdflink{#3}\else#3\fi
\hbox to3em{\hss#4}\fi}}
\def\consetup#1{\ifcase#1 \bf % depth -1 (@**)
\or % depth 0 (@*)
diff --git a/Build/source/texk/web2c/cwebdir/cwebman.tex b/Build/source/texk/web2c/cwebdir/cwebman.tex
index c4bc660df3b..9bf9d44d146 100644
--- a/Build/source/texk/web2c/cwebdir/cwebman.tex
+++ b/Build/source/texk/web2c/cwebdir/cwebman.tex
@@ -1527,9 +1527,9 @@ features needed by the output of \.{CWEAVE}.
\printmacs{\empty}
\vskip6pt \baselineskip12pt
-\noindent And here comes the file that extends \.{cwebmac.tex} in order to
-support the ``hypertext'' features needed by the enhanced \TEX/ engines when
-processing the output of \.{CWEAVE}.
+\noindent And here comes the file \.{cwebacromac.tex} that extends
+\.{cwebmac.tex} in order to support the ``hypertext'' features needed
+by the enhanced \TEX/ engines when processing the output of \.{CWEAVE}.
\vskip6pt \baselineskip9pt
\printmacs{acro}
diff --git a/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex b/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex
index f41ad4d6334..98ef6544b29 100644
--- a/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex
+++ b/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex
@@ -14,15 +14,6 @@
\font\ninerm=cmr9
\let\mc=\ninerm % medium caps
-\def\CEE/{{\mc C\spacefactor1000}}
-\def\UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}}
-\def\TEX/{\TeX}
-\def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}}
-\def\Cee{\CEE/} % for backward compatibility
-\def\Cpp{\CPLUSPLUS/} % for backward compatibility
-\def\9#1{}
- % with this definition of \9 you can say @:sort key}{TeX code@>
- % to alphabetize an index entry by the sort key but format with the TeX code
\font\eightrm=cmr8
\let\sc=\eightrm % small caps (NOT a caps-and-small-caps font)
\let\mainfont=\tenrm
@@ -33,6 +24,16 @@
\font\tentex=cmtex10 % TeX extended character set (used in strings)
\fontdimen7\tentex=0pt % no double space after sentences
+\def\CEE/{{\mc C\spacefactor1000}}
+\def\UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}}
+\def\TEX/{\TeX}
+\def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}}
+\def\Cee{\CEE/} % for backward compatibility
+\def\Cpp{\CPLUSPLUS/} % for backward compatibility
+\def\9#1{}
+ % with this definition of \9 you can say @:sort key}{TeX code@>
+ % to alphabetize an index entry by the sort key but format with the TeX code
+
\def\\#1{\leavevmode\hbox{\it#1\/\kern.05em}} % italic type for identifiers
\def\|#1{\leavevmode\hbox{$#1$}} % one-letter identifiers look better this way
\def\&#1{\leavevmode\hbox{\bf
@@ -116,11 +117,9 @@
\def\note#1#2.{\Y\noindent{\hangindent2em%
\baselineskip10pt\eightrm#1~\ifacrohint{\pdfnote#2.}\else#2\fi.\par}}
-\newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD
-\newtoks\toksE \newtoks\toksF \newtoks\usersanitizer
+\newtoks\toksA \newtoks\toksE
\newcount\countA \countA=0 \newcount\countB \countB=0
-\newcount\countC \countC=0 \newcount\countD \countD=0
-\newif\iftokprocessed \newif\ifTnum \newif\ifinstr
+\newcount\countNOS \countNOS=0
{\def\\{\global\let\spacechar= }\\ }
% Here we decide the output format, depending on the TeX engine in use:
@@ -187,7 +186,7 @@
\outer\def\M#1{\MN{#1}\ifon\vfil\penalty-100\vfilneg % beginning of section
\vskip\intersecskip\startsection\ignorespaces}
\outer\def\N#1#2#3.{% beginning of starred section
- \ifpdf{\toksF={}\makeoutlinetoks#3\outlinedone\outlinedone}\fi
+ \ifpdf{\makeoutlinetoks#3\outlinedone}\fi
\gdepth=#1\gtitle={#3}\MN{#2}%
\ifon\ifnum#1<\secpagedepth \vfil\eject % force page break if depth is small
\else\vfil\penalty-100\vfilneg\vskip\intersecskip\fi\fi
@@ -370,23 +369,21 @@
\def\I{\par\hangindent 2em}\let\*=*
\ifpdf \def\outsecname{Names of the sections} \let\Xpdf\X
\ifpdflua \pdfdest name {NOS} fith
- \pdfoutline goto name {NOS} count -\the\countD {\outsecname}
- \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.%
- {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
- \pdfoutline goto num \the\toksA \expandafter{\the\toksE}}
+ \pdfoutline goto name {NOS} count -\the\countNOS {\outsecname}
\else \special{pdf: outline -1 << /Title (\outsecname)
- /Dest [ @thispage /FitH @ypos ] >>}
- \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.%
- {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
- \special{pdf: outline 0 << /Title (\the\toksE)
- /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}}
- \fi\fi
+ /Dest [ @thispage /FitH @ypos ] >>}\fi
+ \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.%
+ {\makeoutlinetoks##2\outlinedone}%
+ \ifpdflua \pdfoutline goto num \the\toksA \expandafter{\the\toksE}
+ \else \special{pdf: outline 0 << /Title (\the\toksE)
+ /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}\fi}
+ \fi % \ifacro
\readsections}
\def\makebookmarks{\let\ZZ=\writebookmarkline \readcontents\relax}
\def\countsections{\message{Number of named sections:}
- {\def\I{\global\advance\countD by 1}\def\X##1\X{\relax}
+ {\def\I{\global\advance\countNOS by 1}\def\X##1\X{\relax}
\def\Q##1.{\relax}\def\Qs##1.{\relax}\def\U##1.{\relax}\def\Us##1.{\relax}
- \readsections\relax}\message{\the\countD}}
+ \readsections\relax}\message{\the\countNOS}}
\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
\else \csname#1\endcsname \fi} % Petr Olsak's macros from texinfo.tex
\def\advancenumber#1{\countA=\expnumber{#1}\relax \advance\countA by1
@@ -412,17 +409,14 @@
\line{\consetup{#2}#1
\rm\leaders\hbox to .5em{.\hfil}\hfil
\ \ifhint
- \HINTlink{#3}{\romannumeral#3}% No page numbers in HINT
+ \HINTlink{#3}% No page numbers in HINT
\HINTcontents{#1}{#2}{#3}%
- \else\ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi
+ \else\ifacro\pdflink{#3}\else#3\fi
\hbox to3em{\hss#4}\fi}}
\def\consetup#1{\ifcase#1 \bf % depth -1 (@**)
\or % depth 0 (@*)
\or \hskip2em % depth 1 (@*1)
- \or \hskip4em % depth 2 (@*2)
- \or \hskip6em % depth 3 (@*3)
- \or \hskip8em % depth 4 (@*4)
- \or \hskip10em % depth 5 (@*5)
+ \or \hskip4em \or \hskip6em \or \hskip8em \or \hskip10em % depth 2,3,4,5
\else \hskip12em \fi} % depth 6 or more
\def\noinx{\let\inx=\end} % no indexes or table of contents
\def\nosecs{\let\FIN=\fin \def\fin{\let\parfillskip=\end \FIN}}
diff --git a/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex b/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex
index 2a0499949e6..8e4fd6bcdef 100644
--- a/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex
+++ b/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex
@@ -26,15 +26,6 @@
\font\ninerm=cmr9
\let\mc=\ninerm % medium caps
-\def\CEE/{{\mc C\spacefactor1000}}
-\def\UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}}
-\def\TEX/{\TeX}
-\def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}}
-\def\Cee{\CEE/} % for backward compatibility
-\def\Cpp{\CPLUSPLUS/} % for backward compatibility
-\def\9#1{}
- % with this definition of \9 you can say @:sort key}{TeX code@>
- % to alphabetize an index entry by the sort key but format with the TeX code
\font\eightrm=cmr8
\font\sixrm=cmr6
\font\ninei=cmmi9
@@ -146,6 +137,16 @@
\font\titlefont=cmr7 scaled\magstep4 % title on the contents page
\font\ttitlefont=cmtt10 scaled\magstep2 % typewriter type in title
+\def\CEE/{{\mc C\spacefactor1000}}
+\def\UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}}
+\def\TEX/{\TeX}
+\def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}}
+\def\Cee{\CEE/} % for backward compatibility
+\def\Cpp{\CPLUSPLUS/} % for backward compatibility
+\def\9#1{}
+ % with this definition of \9 you can say @:sort key}{TeX code@>
+ % to alphabetize an index entry by the sort key but format with the TeX code
+
\def\\#1{\leavevmode\hbox{\it#1\/\kern.05em}} % italic type for identifiers
\def\|#1{\leavevmode\hbox{$#1$}} % one-letter identifiers look better this way
\def\&#1{\leavevmode\hbox{\bf
@@ -228,11 +229,9 @@
\Y\noindent{\hangindent2\em\baselineskip10pt%
\eightrm#1~\ifacro{\pdfnote#2.}\else#2\fi.\par}}
-\newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD
-\newtoks\toksE \newtoks\toksF \newtoks\usersanitizer
+\newtoks\toksA \newtoks\toksE
\newcount\countA \countA=0 \newcount\countB \countB=0
-\newcount\countC \countC=0 \newcount\countD \countD=0
-\newif\iftokprocessed \newif\ifTnum \newif\ifinstr
+\newcount\countNOS \countNOS=0
{\def\\{\global\let\spacechar= }\\ }
% Here we decide the output format, depending on the TeX engine in use:
@@ -301,7 +300,7 @@
\outer\def\NN{\ifvoid\partialpage\leftfalse
\else\ifdim\ht\partialpage<\pageht \lefttrue\else\leftfalse\fi\fi\NNN}
\outer\def\NNN#1#2#3.{% beginning of starred section
- \ifacro{\toksF={}\makeoutlinetoks#3\outlinedone\outlinedone}\fi
+ \ifacro{\makeoutlinetoks#3\outlinedone}\fi
\gdepth=#1\gtitle={#3}\def\secno{#2}\xdef\secstar{#2}
\ifleft \flushout
\gdef\rlhead{\let\i=I\uppercase{\ignorespaces#3}} % running left headline
@@ -334,7 +333,7 @@
\def\T#1{\leavevmode % octal, hex or decimal constant
\hbox{$\def\?{\kern.2em}%$%
\let\ \, % C++ digit separator becomes a little white space
- \def\$##1{\egroup_{\rm##1}\bgroup}% suffix to constant
+ \def\$##1{\egroup_{\rm##1}\bgroup}%$% suffix to constant
\def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick)
\let\~=\oct \let\^=\hex \let\\=\bin {#1}$}}%$%
\def\U{\note{This code is used in section}} % xref for use of a section
@@ -543,22 +542,20 @@
\def\outsecname{Names of the sections}
\ifpdflua \makebookmarks \countsections
\pdfdest name {NOS} fith
- \pdfoutline goto name {NOS} count -\the\countD {\outsecname}
- \def\X##1:##2\X{\firstsecno##1.%
- {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
- \pdfoutline goto num \the\toksA \expandafter{\the\toksE}}
+ \pdfoutline goto name {NOS} count -\the\countNOS {\outsecname}
\else \special{pdf: outline -1 << /Title (\outsecname)
- /Dest [ @thispage /FitH @ypos ] >>}
- \def\X##1:##2\X{\firstsecno##1.%
- {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
- \special{pdf: outline 0 << /Title (\the\toksE)
- /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}}
- \fi \readsections \fi}
+ /Dest [ @thispage /FitH @ypos ] >>}\fi
+ \def\X##1:##2\X{\firstsecno##1.%
+ {\makeoutlinetoks##2\outlinedone}%
+ \ifpdflua \pdfoutline goto num \the\toksA \expandafter{\the\toksE}
+ \else \special{pdf: outline 0 << /Title (\the\toksE)
+ /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}\fi}
+ \readsections \fi}
\def\makebookmarks{\let\ZZ=\writebookmarkline \readcontents\relax}
\def\countsections{\message{Number of named sections:}
- {\def\I{\global\advance\countD by 1}\def\X##1\X{\relax}
+ {\def\I{\global\advance\countNOS by 1}\def\X##1\X{\relax}
\def\Q##1.{\relax}\def\Qs##1.{\relax}\def\U##1.{\relax}\def\Us##1.{\relax}
- \readsections\relax}\message{\the\countD}}
+ \readsections\relax}\message{\the\countNOS}}
\def\writebookmarkline#1#2#3#4#5{{%
\let\(=\let \let\)=\let \let\[=\let \let\]=\let \let\/=\let
\pdfoutline goto num #3 count -\expnumber{chunk#2.#3} {#5}}}
@@ -579,7 +576,7 @@
%\def\contentsline#1#2#3#4#5{\ifnum#2=0 \smallbreak\fi
%\line{\consetup{#2}#1
%\rm\leaders\hbox to .5em{.\hfil}\hfil
- %\ \ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi\hbox to3em{\hss#4}}}
+ %\ \ifacro\pdflink{#3}\else#3\fi\hbox to3em{\hss#4}}}
%\def\consetup#1{\ifcase#1 \bf % depth -1 (@**)
%\or % depth 0 (@*)
%\or \hskip2em % depth 1 (@*1)