summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/cwebdir/cwebmac.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/cwebdir/cwebmac.tex')
-rw-r--r--Build/source/texk/web2c/cwebdir/cwebmac.tex93
1 files changed, 37 insertions, 56 deletions
diff --git a/Build/source/texk/web2c/cwebdir/cwebmac.tex b/Build/source/texk/web2c/cwebdir/cwebmac.tex
index 99e899476ce..53454300a9a 100644
--- a/Build/source/texk/web2c/cwebdir/cwebmac.tex
+++ b/Build/source/texk/web2c/cwebdir/cwebmac.tex
@@ -1,26 +1,14 @@
% standard macros for CWEB listings (in addition to plain.tex)
-% Version 4.12 --- May 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
-\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
\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 % for smallish caps (NOT a caps-and-small-caps font)
\let\mainfont=\tenrm
@@ -31,6 +19,17 @@
\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
+\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
\def\&#1{\leavevmode\hbox{\bf
@@ -112,14 +111,10 @@
\let\yskip=\smallskip
\def\?{\mathrel?}
\def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi}
-\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:
@@ -136,17 +131,7 @@
\def\Black{\pdfliteral{0 g 0 G}} % use rgb colors for direct PDF output too
\def\Blue{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}}
\fi
-\ifacrohint \input cwebacromac \fi % load hypertext macros
-\def\pdfURL#1#2{\ifpdf \ifpdflua\pdfannotlink height \theheight depth \thedepth
- attr {/Border [0 0 0]} user { /Type /Annot /Subtype /Link /A
- << /S /URI /URI (#2) >>}\Blue #1\Black \pdfendlink % changed in 3.69
- \else {\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}%
- \special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight
- depth \thedepth << /Border [0 0 0] /Type /Annot /Subtype /Link /A
- << /S /URI /URI (#2) >> >>}\box0\relax}\fi
- \else #1 ({\tt#2})\fi}
-{\catcode`\~=12 \gdef\TILDE/{~}} % ~ in a URL
-{\catcode`\_=12 \gdef\UNDER/{_}} % _ in a URL
+\input cwebacromac % load hypertext macros
\def\lapstar{\rlap{*}}
\def\stsec{\rightskip=0pt % get out of C mode (cf. \B)
@@ -159,6 +144,8 @@
[ @thispage /FitH @ypos ]}\fi}}\fi}
\let\startsection=\stsec
\def\defin#1{\global\advance\ind by 2 \1\&{#1 }} % begin `define' or `format'
+\def\note#1#2.{\Y\noindent{\hangindent2em\baselineskip10pt%
+ \eightrm#1~\ifacrohint{\pdfnote#2.}\else#2\fi.\par}}
\def\A{\note{See also section}} % xref for doubly defined section name
\def\As{\note{See also sections}} % xref for multiply defined section name
\def\B{\rightskip=0pt plus 100pt minus 10pt % go into C mode
@@ -186,7 +173,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
@@ -240,15 +227,13 @@
\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
-\newif\ifon \newif\iftitle \newif\ifpagesaved
+\newif\ifon \newif\iftitle \newif\ifpagesaved \newif\ifheader
-\newif\ifheader
\def\lheader{\headertrue\mainfont\the\pageno\eightrm\qquad\grouptitle
\hfill\title\qquad\mainfont\topsecno} % top line on left-hand pages
\def\rheader{\headertrue\mainfont\topsecno\eightrm\qquad\title\hfill
@@ -317,9 +302,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
@@ -328,9 +311,9 @@
\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
+ \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
@@ -353,23 +336,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
@@ -395,9 +376,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 (@*)