summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2024-08-10 09:27:39 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2024-08-10 09:27:39 +0000
commit48ee6efa59f937f221eee9fcd92e5ce0fd06463b (patch)
treebef3ee7879c53fe37bea5f4217210d72886de836 /Build/source
parent55faacacfc9d4428aae865521cc48e0b6fa3c0ce (diff)
[CWEB] Apply new scanning macros.
Martin Ruckert (@ruckertm) has provided new macros for scanning the index entries and amending them with '\pdflink' macros for PDF and HINT. This revision applies the '\scan' macro only in the '\inx' macro. (Also in the upcoming 'pwebmac.tex'.) Of course, the heavy copy- and pasting leads to the idea of further integrating the new stuff at a more central and common spot in 'cweb*mac.tex'. We'll see... However, in this present state, the major application of the C/WEB macros for the 'knuth-pdf' and 'knuth-hint' packages delivers great results. The main run of the 'makeall' script, producing 58 PDF files, reduces the overall runtime from 1m7s to 0m45s. Thanks to Martin for the exycellent contribution! git-svn-id: svn://tug.org/texlive/trunk@72003 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/web2c/cwebdir/ChangeLog7
-rw-r--r--Build/source/texk/web2c/cwebdir/cwebacromac.tex18
-rw-r--r--Build/source/texk/web2c/cwebdir/cwebmac.tex39
-rw-r--r--Build/source/texk/web2c/cwebdir/texinputs/icwebmac.tex26
-rw-r--r--Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex28
5 files changed, 77 insertions, 41 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog
index 5312bd5fe09..1411bac5901 100644
--- a/Build/source/texk/web2c/cwebdir/ChangeLog
+++ b/Build/source/texk/web2c/cwebdir/ChangeLog
@@ -1,3 +1,10 @@
+2024-08-10 Andreas Scherer <https://ascherer.github.io>
+
+ * cwebacromac.tex,
+ * cwebmac.tex,
+ * texinputs/icwebmac.tex,
+ * texinputs/pdfctproofmac.tex: Apply new scanning macros.
+
2024-08-08 Andreas Scherer <https://ascherer.github.io>
* comm-mini.ch,
diff --git a/Build/source/texk/web2c/cwebdir/cwebacromac.tex b/Build/source/texk/web2c/cwebdir/cwebacromac.tex
index 3d6884bd3a0..075fe692647 100644
--- a/Build/source/texk/web2c/cwebdir/cwebacromac.tex
+++ b/Build/source/texk/web2c/cwebdir/cwebacromac.tex
@@ -31,11 +31,10 @@
\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
+\newtoks\toksB \newtoks\toksC \newtoks\toksD \newtoks\toksF \newtoks\sanitizer
\newif\iftokprocessed \newif\ifTnum \newif\ifinstr \newif\ifhavenum
-\ifacrohint % Common macros for \ifacro and \ifhint
+\ifacrohint % Common macros for \ifacro and \ifhint to create \pdflink's
\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{\let\space\empty
@@ -49,8 +48,7 @@
\ifnum\countB<`0
\ifhavenum\makenote\fi
\ifx\first.\let\next=\maketoksdone % fullstop
- \else \addtokens\toksB{\the\toksD}
- \ifx\first,\addtokens\toksB{\space}\fi
+ \else \addtokens\toksB{\the\toksD} \ifx\first,\addtokens\toksB{\space}\fi
\fi
\else \addtokens\toksC{\the\toksD}\global\havenumtrue
\fi
@@ -59,7 +57,7 @@
\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
+\fi % End of common pdf/hint macros
\ifacro % The following are general pdf macros
\def\thewidth{\the\wd0 \space}
@@ -74,7 +72,7 @@
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
+\def\sanitizecommand#1#2{\addtokens\sanitizer
{\noexpand\dosanitizecommand\noexpand#1{#2}}}
\def\dosanitizecommand#1#2{\ifx\nxt#1\addF{#2}\fi}
@@ -99,7 +97,7 @@
\else\if\noexpand\nxt\relax % we have a control sequence; is it one we know?
\ifx\nxt~\addF\space
\else\ifx\nxt\onespace\addF\space
- \else\the\usersanitizer
+ \else\the\sanitizer
\iftokprocessed\else\makeolproctokctli
\iftokprocessed\else\makeolproctokctlii
\iftokprocessed\else\makeolproctokctliii % if not recognised, skip it
@@ -180,13 +178,11 @@
\fi % End of pdf macros
\ifhint
-% The following uses HINT primitives to implement:
+% The following top level macros use HINT primitives to implement:
% \HINThome to mark the position of the home page
% \HINTlabel to attach a label to the top of a section
% \HINTlink to link a section number to the section label
% \HINTcontents to produce an 'outline' item
-% These are the top level HINT macros that are used in this file
-% No HINT primitives are used directly.
\def\HINThome{\HINTdest name {HINT.home}%
\HINToutline goto name {HINT.home} depth 1 {Table of Contents}}
\def\HINTlabel{{\let\*=\empty\HINTdest num \secstar top}}
diff --git a/Build/source/texk/web2c/cwebdir/cwebmac.tex b/Build/source/texk/web2c/cwebdir/cwebmac.tex
index d5a148ca951..9f9e8e1500f 100644
--- a/Build/source/texk/web2c/cwebdir/cwebmac.tex
+++ b/Build/source/texk/web2c/cwebdir/cwebmac.tex
@@ -4,9 +4,6 @@
\xdef\fmtversion{\fmtversion+CWEB4.12}
\chardef\cwebversion=4 \chardef\cwebrevision=12
-\let\:=\. % preserve a way to get the dot accent
- % (all other accents will still work as usual)
-
\parskip 0pt % no stretch between paragraphs
\parindent 1em % for paragraphs and for the first line of C text
@@ -28,9 +25,10 @@
\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\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
+\let\:=\. % preserve a way to get the dot accent
+ % (all other accents will still work as usual)
\def\\#1{\leavevmode\hbox{\it#1\/\kern.05em}} % italic type for identifiers
\def\|#1{\leavevmode\hbox{$#1$}} % one-letter identifiers look better this way
@@ -239,9 +237,8 @@
\def\oct{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}} % CWEB style
\def\hex{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}} % CWEB style
\def\bin{\hbox{$^{\scriptscriptstyle b}$\tt\aftergroup}} % new in CWEB 4.3
-\def\vb#1{\leavevmode\hbox{\kern2pt\vrule\vtop{\vbox{\hrule
- \hbox{\strut\kern2pt\.{#1}\kern2pt}}
- \hrule}\vrule\kern2pt}} % verbatim string
+\def\vb#1{\leavevmode\hbox{\kern2pt\vrule\vtop{\vbox{\hrule\hbox{\strut
+ \kern2pt\.{#1}\kern2pt}}\hrule}\vrule\kern2pt}} % verbatim string
\def\p#1{\cdot 2^{#1}} % power of two (hex exponent)
\def\onmaybe{\let\ifon=\maybe} \let\maybe=\iftrue
@@ -316,9 +313,7 @@
\vsize=\pageheight \advance\vsize by -\ht\sbox % the remaining height
\hsize=.5\pagewidth \advance\hsize by -10pt
% column width for the index (20pt between cols)
- \ifhint\else
- \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines
- \fi
+ \ifhint\else\parfillskip 0pt plus .6\hsize\fi % avoid almost empty lines
\def\lr{L} % this tells whether the left or right column is next
\output{\if L\lr\global\setbox\lbox=\page \gdef\lr{R}
\else\normaloutput{\vbox to\pageheight{\box\sbox\vss
@@ -327,9 +322,23 @@
\message{Index:}
\parskip 0pt plus .5pt
\outer\def\I##1, ##2.{\par\hangindent2em\noindent##1:\kern1em
- \ifacrohint\pdfnote##2.\else##2\fi.} % index entry
- \def\[##1]{$\underline{##1}$} % underlined index item
- \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar
+ \scan##2!.} % index entry
+ \def\[##1]{$\underline{\scan##1!}$\scan} % underlined index item
+ \ifacrohint\def\digits{\pdflink{\the\countA}\scan}
+ \else\def\digits{{\the\countA}\scan}\fi
+ \def\scan##1{\begingroup
+ \ifx!##1% exit on exclamation point
+ \else\ifx,##1,\space\aftergroup\scan %insert,\space}\scan ...
+ \else\ifx\[##1\aftergroup##1%{% insert }\[...
+ \else\ifx\*##1\aftergroup\lapstar\aftergroup\scan %insert }\lapstar\scan ...
+ \else\ifnum`##1>`9##1\aftergroup\scan %{% insert #1}\scan ...
+ \else\ifnum`##1<`0##1\aftergroup\scan %{% insert #1}\scan ...
+ \else
+ \afterassignment\digits \aftergroup\countA
+ \aftergroup##1%{% insert }\countA=#1...\digits ...
+ \fi\fi\fi\fi\fi \fi
+ \endgroup}
+ \rm \rightskip0pt plus 2.5em \tolerance 10000
\hyphenpenalty 10000 \parindent0pt
\readindex}
\def\fin{\par\vfill\eject % this is done when we are ending the index
diff --git a/Build/source/texk/web2c/cwebdir/texinputs/icwebmac.tex b/Build/source/texk/web2c/cwebdir/texinputs/icwebmac.tex
index 5f2e7d3a45a..5a3cc5cd285 100644
--- a/Build/source/texk/web2c/cwebdir/texinputs/icwebmac.tex
+++ b/Build/source/texk/web2c/cwebdir/texinputs/icwebmac.tex
@@ -73,7 +73,7 @@
\def\inx{\par\vskip6pt plus 1fil % we are beginning the index
\def\page{\box255 } \normalbottom
\write\cont{} % ensure that the contents file isn't empty
- \write\cont{\catcode `\noexpand\@=12\relax} % \makeatother
+ \write\cont{\catcode `\noexpand\@=12\relax} % \makeatother
\closeout\cont % the contents information has been fully gathered
\output{\ifpagesaved\normaloutput{\box\sbox}\lheader\rheader\fi
\global\setbox\sbox=\page \global\pagesavedtrue \mark{\topmark}}
@@ -82,9 +82,7 @@
\vsize=\pageheight \advance\vsize by -\ht\sbox % the remaining height
\hsize=.5\pagewidth \advance\hsize by -10pt
% column width for the index (20pt between cols)
- \ifhint\else
- \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines
- \fi
+ \ifhint\else\parfillskip 0pt plus .6\hsize\fi % avoid almost empty lines
\def\lr{L} % this tells whether the left or right column is next
\output{\if L\lr\global\setbox\lbox=\page \gdef\lr{R}
\else\normaloutput{\vbox to\pageheight{\box\sbox\vss
@@ -93,9 +91,23 @@
\message{Indice Analitico:}
\parskip 0pt plus .5pt
\outer\def\I##1, ##2.{\par\hangindent2em\noindent##1:\kern1em
- \ifacrohint\pdfnote##2.\else##2\fi.} % index entry
- \def\[##1]{$\underline{##1}$} % underlined index item
- \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar
+ \scan##2!.} % index entry
+ \def\[##1]{$\underline{\scan##1!}$\scan} % underlined index item
+ \ifacrohint\def\digits{\pdflink{\the\countA}\scan}
+ \else\def\digits{{\the\countA}\scan}\fi
+ \def\scan##1{\begingroup
+ \ifx!##1% exit on exclamation point
+ \else\ifx,##1,\space\aftergroup\scan %insert,\space}\scan ...
+ \else\ifx\[##1\aftergroup##1%{% insert }\[...
+ \else\ifx\*##1\aftergroup\lapstar\aftergroup\scan %insert }\lapstar\scan ...
+ \else\ifnum`##1>`9##1\aftergroup\scan %{% insert #1}\scan ...
+ \else\ifnum`##1<`0##1\aftergroup\scan %{% insert #1}\scan ...
+ \else
+ \afterassignment\digits \aftergroup\countA
+ \aftergroup##1%{% insert }\countA=#1...\digits ...
+ \fi\fi\fi\fi\fi \fi
+ \endgroup}
+ \rm \rightskip0pt plus 2.5em \tolerance 10000
\hyphenpenalty 10000 \parindent0pt
\readindex}
\def\fin{\par\vfill\eject % this is done when we are ending the index
diff --git a/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex b/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex
index 98ef6544b29..d60d1703368 100644
--- a/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex
+++ b/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex
@@ -326,18 +326,16 @@
\newbox\lbox % lefthand column in the index
\def\inx{\par\vskip6pt plus 1fil % we are beginning the index
\write\cont{} % ensure that the contents file isn't empty
- \write\cont{\catcode `\noexpand\@=12\relax} % \makeatother
+ \write\cont{\catcode `\noexpand\@=12\relax} % \makeatother
\closeout\cont % the contents information has been fully gathered
\output{\ifpagesaved\normaloutput{\box\sbox}\lheader\rheader\fi
- \global\setbox\sbox=\page \global\pagesavedtrue}
+ \global\setbox\sbox=\page \global\pagesavedtrue \mark{\topmark}}
\pagesavedfalse \eject % eject the page-so-far and predecessors
\setbox\sbox\vbox{\unvbox\sbox} % take it out of its box
\vsize=\pageheight \advance\vsize by -\ht\sbox % the remaining height
\hsize=.5\pagewidth \advance\hsize by -10pt
% column width for the index (20pt between cols)
- \ifhint\else
- \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines
- \fi
+ \ifhint\else\parfillskip 0pt plus .6\hsize\fi % avoid almost empty lines
\def\lr{L} % this tells whether the left or right column is next
\output{\if L\lr\global\setbox\lbox=\page \gdef\lr{R}
\else\normaloutput{\vbox to\pageheight{\box\sbox\vss
@@ -346,9 +344,23 @@
\message{Index:}
\parskip 0pt plus .5pt
\outer\def\I##1, ##2.{\par\hangindent2em\noindent##1:\kern1em
- \ifacrohint\pdfnote##2.\else##2\fi.} % index entry
- \def\[##1]{$\underline{##1}$} % underlined index item
- \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar
+ \scan##2!.} % index entry
+ \def\[##1]{$\underline{\scan##1!}$\scan} % underlined index item
+ \ifacrohint\def\digits{\pdflink{\the\countA}\scan}
+ \else\def\digits{{\the\countA}\scan}\fi
+ \def\scan##1{\begingroup
+ \ifx!##1% exit on exclamation point
+ \else\ifx,##1,\space\aftergroup\scan %insert,\space}\scan ...
+ \else\ifx\[##1\aftergroup##1%{% insert }\[...
+ \else\ifx\*##1\aftergroup\lapstar\aftergroup\scan %insert }\lapstar\scan ...
+ \else\ifnum`##1>`9##1\aftergroup\scan %{% insert #1}\scan ...
+ \else\ifnum`##1<`0##1\aftergroup\scan %{% insert #1}\scan ...
+ \else
+ \afterassignment\digits \aftergroup\countA
+ \aftergroup##1%{% insert }\countA=#1...\digits ...
+ \fi\fi\fi\fi\fi \fi
+ \endgroup}
+ \rm \rightskip0pt plus 2.5em \tolerance 10000
\hyphenpenalty 10000 \parindent0pt
\readindex}
\def\fin{\par\vfill\eject % this is done when we are ending the index