texlive[72003] Build/source/texk/web2c/cwebdir: [CWEB] Apply new
commits+ascherer at tug.org
commits+ascherer at tug.org
Sat Aug 10 11:27:39 CEST 2024
Revision: 72003
https://tug.org/svn/texlive?view=revision&revision=72003
Author: ascherer
Date: 2024-08-10 11:27:39 +0200 (Sat, 10 Aug 2024)
Log Message:
-----------
[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!
Modified Paths:
--------------
trunk/Build/source/texk/web2c/cwebdir/ChangeLog
trunk/Build/source/texk/web2c/cwebdir/cwebacromac.tex
trunk/Build/source/texk/web2c/cwebdir/cwebmac.tex
trunk/Build/source/texk/web2c/cwebdir/texinputs/icwebmac.tex
trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex
Modified: trunk/Build/source/texk/web2c/cwebdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ChangeLog 2024-08-09 23:41:52 UTC (rev 72002)
+++ trunk/Build/source/texk/web2c/cwebdir/ChangeLog 2024-08-10 09:27:39 UTC (rev 72003)
@@ -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,
Modified: trunk/Build/source/texk/web2c/cwebdir/cwebacromac.tex
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/cwebacromac.tex 2024-08-09 23:41:52 UTC (rev 72002)
+++ trunk/Build/source/texk/web2c/cwebdir/cwebacromac.tex 2024-08-10 09:27:39 UTC (rev 72003)
@@ -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}}
Modified: trunk/Build/source/texk/web2c/cwebdir/cwebmac.tex
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/cwebmac.tex 2024-08-09 23:41:52 UTC (rev 72002)
+++ trunk/Build/source/texk/web2c/cwebdir/cwebmac.tex 2024-08-10 09:27:39 UTC (rev 72003)
@@ -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
Modified: trunk/Build/source/texk/web2c/cwebdir/texinputs/icwebmac.tex
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/texinputs/icwebmac.tex 2024-08-09 23:41:52 UTC (rev 72002)
+++ trunk/Build/source/texk/web2c/cwebdir/texinputs/icwebmac.tex 2024-08-10 09:27:39 UTC (rev 72003)
@@ -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
Modified: trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex 2024-08-09 23:41:52 UTC (rev 72002)
+++ trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctproofmac.tex 2024-08-10 09:27:39 UTC (rev 72003)
@@ -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
More information about the tex-live-commits
mailing list.