texlive[63649] Build/source/texk/web2c/cwebdir: [CWEB] Use

commits+ascherer at tug.org commits+ascherer at tug.org
Sun Jun 19 12:20:16 CEST 2022


Revision: 63649
          http://tug.org/svn/texlive?view=revision&revision=63649
Author:   ascherer
Date:     2022-06-19 12:20:16 +0200 (Sun, 19 Jun 2022)
Log Message:
-----------
[CWEB] Use 'iftex.sty' for TeX engine tests.

iftex.sty sets \ifpdf according to \pdfoutput.  This can be set _before_
'\input cwebmac.tex'.

Note that you can _not use 'pdftex "\let\pdf+\pdfoutput=0\input ..."',
because \ifpdftex is always 'true' for PDFTeX.

HINT has infinite space, so we can also show TeX code for section 31.

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/cwebdir/ChangeLog
    trunk/Build/source/texk/web2c/cwebdir/cwebmac.tex
    trunk/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch
    trunk/Build/source/texk/web2c/cwebdir/cwebman.tex
    trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex

Modified: trunk/Build/source/texk/web2c/cwebdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2022-06-18 23:50:14 UTC (rev 63648)
+++ trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2022-06-19 10:20:16 UTC (rev 63649)
@@ -1,3 +1,10 @@
+2022-06-19  Andreas Scherer  <https://ascherer.github.io>
+
+	* cwebmac.tex,
+	* cwebman-w2c.ch,
+	* cwebman.tex,
+	* texinputs/pdfctwimac.tex: Use 'iftex.sty' for TeX engine tests.
+
 2022-06-18  Andreas Scherer  <https://ascherer.github.io>
 
 	* cwebmac.tex: Fix \pdfURL for 'valid' output.

Modified: trunk/Build/source/texk/web2c/cwebdir/cwebmac.tex
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/cwebmac.tex	2022-06-18 23:50:14 UTC (rev 63648)
+++ trunk/Build/source/texk/web2c/cwebdir/cwebmac.tex	2022-06-19 10:20:16 UTC (rev 63649)
@@ -1,24 +1,19 @@
 % standard macros for CWEB listings (in addition to plain.tex)
-% Version 4.8 --- June 2022
+% Version 4.9 --- June 2022
 \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros
-\xdef\fmtversion{\fmtversion+CWEB4.8}
-\chardef\cwebversion=4 \chardef\cwebrevision=8
-\newif\ifpdf
-\ifx\pdf+\pdftrue\fi
+\xdef\fmtversion{\fmtversion+CWEB4.9}
+\chardef\cwebversion=4 \chardef\cwebrevision=9
+\input iftex.sty % TeX engine tests
+\ifx\pdf+\pdftrue\fi % for plain TeX in combination with dvipdfm
 % Uncomment the following line if you want PDF goodies to be the default
 %\ifx\pdf-\else\pdftrue\fi
 \def\pdflinkcolor{0 0 1} % the RGB values for hyperlink color
-\ifx\undefined\XeTeXrevision\else\pdftrue\fi % XeTeX produces PDF output
-\newif\ifpdftex
-\ifx\pdfoutput\undefined \pdftexfalse \else\ifnum\pdfoutput=0 \pdftexfalse
-%\else \pdftextrue \pdfoutput=1 \input pdfcolor \let\setcolor\pdfsetcolor \fi\fi
-\else \pdftextrue \pdfoutput=1 % changed in 3.69
+\ifxetex\pdftrue\fi % XeTeX produces PDF output
+\ifpdftex % pdfTeX produces PDF output if \pdfoutput>0
   \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\fi
-\newif\ifhint
-\ifx\HINTversion\undefined \hintfalse \else \hinttrue \fi
-\newif\ifacro \ifpdf\acrotrue\fi \ifpdftex\acrotrue\fi
+\fi
+\newif\ifacro \ifpdf\acrotrue\fi
 \newif\ifacrohint \ifacro\acrohinttrue\fi \ifhint\acrohinttrue\fi
 
 \let\:=\. % preserve a way to get the dot accent
@@ -433,8 +428,8 @@
 \def\title{\expandafter\uppercase\expandafter{\jobname}}
 \def\topofcontents{\centerline{\titlefont\title}\vskip.7in
   \vfill} % this material will start the table of contents page
-\def\startpdf{\ifpdftex\pdfcatalog{/PageMode /UseOutlines}\else
-    \ifpdf{\special{pdf: docview << /PageMode /UseOutlines >>}}\fi\fi}
+\def\startpdf{\ifpdftex\ifnum\pdfoutput>0 \pdfcatalog{/PageMode /UseOutlines}\fi
+  \else \ifpdf{\special{pdf: docview << /PageMode /UseOutlines >>}}\fi\fi}
 \def\botofcontents{\vfill
   \centerline{\covernote}} % this material will end the table of contents page
 \def\covernote{}
@@ -495,7 +490,8 @@
 \def\fin{\par\vfill\eject % this is done when we are ending the index
   \ifpagesaved\null\vfill\eject\fi % output a null index column
   \if L\lr\else\null\vfill\eject\fi % finish the current page
-  \ifpdftex \makebookmarks \countsections \fi % added in Version 3.68 and 4.9
+  \ifpdftex \ifnum\pdfoutput>0 \makebookmarks % added in Version 3.68
+    \countsections \fi\fi % and in Version 4.9
   \parfillskip 0pt plus 1fil
   \def\grouptitle{NAMES OF THE SECTIONS}
   \let\topsecno=\nullsec

Modified: trunk/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch	2022-06-18 23:50:14 UTC (rev 63648)
+++ trunk/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch	2022-06-19 10:20:16 UTC (rev 63649)
@@ -18,7 +18,7 @@
 
 @x
 \input cwebmac
-\acrofalse\pdffalse\pdftexfalse\hintfalse\acrohintfalse
+\acrofalse\pdffalse\acrohintfalse
 @y
 \input cwebmac
 @z
@@ -195,7 +195,7 @@
 @x
 Sometimes things don't work as smoothly, and you get a bunch of
 @y
-\acrofalse\pdftexfalse\pdffalse
+\acrofalse\pdffalse\acrohintfalse
 Sometimes things don't work as smoothly, and you get a bunch of
 @z
 
@@ -203,10 +203,9 @@
 `$\\{main}(\\{argc},\39\\{argv}{}$)'.
 @y
 `$\\{main}(\\{argc},\39\\{argv}{}$)'.
-\ifx\pdf+\pdftrue\fi
-\ifx\pdfoutput\undefined \pdftexfalse \else\ifnum\pdfoutput=0 \pdftexfalse
-\else \pdftextrue \pdfoutput=1\fi\fi
-\ifpdf\acrotrue\fi \ifpdftex\acrotrue\fi
+\ifx\pdf+\pdftrue\fi \ifxetex\pdftrue\fi
+\ifpdf\acrotrue\fi
+\ifacro\acrohinttrue\fi \ifhint\acrohinttrue\fi
 @z
 
 @x
@@ -303,7 +302,7 @@
 \def\runninghead{APPENDIX A --- FINAL DOCUMENT}
 \subsection Final document.
 
-\acrofalse\pdftexfalse\pdffalse
+\acrofalse\pdffalse\acrohintfalse
 And here's what the same excerpt looks like when typeset.
 (Can you spot the typographical niceties used in the \.{CWEB} code?)
 \let\K=\leftarrow
@@ -314,10 +313,9 @@
 \vfil\eject\titletrue
 @y
 \vfil\eject\titletrue
-\ifx\pdf+\pdftrue\fi
-\ifx\pdfoutput\undefined \pdftexfalse \else\ifnum\pdfoutput=0 \pdftexfalse
-\else \pdftextrue \pdfoutput=1\fi\fi
-\ifpdf\acrotrue\fi \ifpdftex\acrotrue\fi
+\ifx\pdf+\pdftrue\fi \ifxetex\pdftrue\fi
+\ifpdf\acrotrue\fi
+\ifacro\acrohinttrue\fi \ifhint\acrohinttrue\fi
 @z
 
 @x

Modified: trunk/Build/source/texk/web2c/cwebdir/cwebman.tex
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/cwebman.tex	2022-06-18 23:50:14 UTC (rev 63648)
+++ trunk/Build/source/texk/web2c/cwebdir/cwebman.tex	2022-06-19 10:20:16 UTC (rev 63649)
@@ -2,7 +2,7 @@
 
 \def\tangref{3} % where the main explanation of CTANGLing is given
 \input cwebmac
-\acrofalse\pdffalse\pdftexfalse\hintfalse\acrohintfalse
+\acrofalse\pdffalse\acrohintfalse
 \def\page{\box255 } \normalbottom
 \parskip 0pt plus 1pt
 \def\RA{\char'31 } % right arrow
@@ -1345,7 +1345,7 @@
 \def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CWEAVE}}
 
 Here is the corresponding excerpt from \.{common.tex}.
-(Code for section 31 is omitted for space reasons.)
+\ifhint\relax\else(Code for section 31 is omitted for space reasons.)\fi
 
 \vskip6pt
 \begingroup \def\tt{\eighttt} \baselineskip9pt
@@ -1418,6 +1418,15 @@
 \4${}\}{}$\2\5
 \&{while} ${}(\\{limit}\E\\{buffer}){}$;\par
 \U27.\fi
+!ifhint
+\M{31}\B\X31:Move \PB{\\{buffer}} and \PB{\\{limit}} to \PB{\\{change\_buffer}}
+and \PB{\\{change\_limit}}\X${}\E{}$\6
+$\\{change\_limit}\K\\{change\_buffer}+(\&{ptrdiff\_t})(\\{limit}-%
+\\{buffer});{}$\6
+${}\\{strncpy}(\\{change\_buffer},\39\\{buffer},\39(\&{size\_t})(\\{limit}-%
+\\{buffer}+\T{1})){}$;\par
+\Us27\ET32.\fi
+!fi
 !endgroup
 \endgroup
 \vfil\eject

Modified: trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex	2022-06-18 23:50:14 UTC (rev 63648)
+++ trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex	2022-06-19 10:20:16 UTC (rev 63649)
@@ -1,25 +1,22 @@
 % standard macros for CWEB listings (in addition to plain.tex)
-% Version 4.5 --- October 2021
+% Version 4.9 --- June 2022
 % modified for pages produced by CTWILL
 % further modified for page size of the MMIXware book
 % modified for PDF output with 'tex "\let\pdf+', 'pdftex', and 'xetex'
 % This file is not copyrighted and can be used freely.
 \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros
-\xdef\fmtversion{\fmtversion+CTWILL4.5+LNCS+PDF}
-
-\newif\ifpdf
-\ifx\pdf+\pdftrue\fi
+\xdef\fmtversion{\fmtversion+CTWILL4.9+LNCS+PDF}
+\input iftex.sty % TeX engine tests
+\ifx\pdf+\pdftrue\fi % for plain TeX in combination with dvipdfm
 % Uncomment the following line if you want PDF goodies to be the default
 %\ifx\pdf-\else\pdftrue\fi
 \def\pdflinkcolor{0 0 1} % the RGB values for hyperlink color
-\ifx\undefined\XeTeXrevision\else\pdftrue\fi % XeTeX produces PDF output
-\newif\ifpdftex
-\ifx\pdfoutput\undefined \pdftexfalse \else\ifnum\pdfoutput=0 \pdftexfalse
-\else \pdftextrue \pdfoutput=1
+\ifxetex\pdftrue\fi % XeTeX produces PDF output
+\ifpdftex % pdfTeX produces PDF output if \pdfoutput>0
   \def\Black{\pdfliteral{0 g 0 G}}  % use rgb colors for direct PDF output too
   \def\PDFlinkcolor{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}}
-\fi\fi
-\newif\ifacro \ifpdf\acrotrue\fi \ifpdftex\acrotrue\fi
+\fi
+\newif\ifacro \ifpdf\acrotrue\fi
 
 \let\:=\. % preserve a way to get the dot accent
  % (all other accents will still work as usual)
@@ -243,7 +240,7 @@
 \newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD
 \newtoks\toksE \newtoks\toksF \newtoks\usersanitizer
 \newcount\countA \countA=0 \newcount\countB \countB=0
-\newcount\countC \countC=0
+\newcount\countC \countC=0 \newcount\countD \countD=0
 \newif\iftokprocessed \newif\ifTnum \newif\ifinstr
 {\def\\{\global\let\spacechar= }\\ }
 
@@ -283,12 +280,12 @@
     {\noexpand\pdflink{\the\toksC}{\romannumeral\the\toksC}}\toksC={}\global\countC=0}
 \def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
 \def\pdfURL#1#2{\ifpdftex\pdfannotlink height\ht\strutbox depth\dp\strutbox
-  attr {/Border [0 0 0]} user {/Type /Action /Subtype /Link /A
+  attr {/Border [0 0 0]} user {/Type /Annot /Subtype /Link /A
       << /S /URI /URI (#2) >>}\PDFlinkcolor #1\Black \pdfendlink
   \else\ifpdf{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}%
     \special{pdf: ec}}\special{pdf: ann width \thewidth\space height \theheight
       \space depth \thedepth\space << /Border [0 0 0]
-      /Type /Action /Subtype /Link /A << /S /URI /URI (#2) >> >>}\box0\relax}%
+      /Type /Annot /Subtype /Link /A << /S /URI /URI (#2) >> >>}\box0\relax}%
   \else #1 ({\tt#2})\fi\fi}
 {\catcode`\~=12 \gdef\TILDE/{~}} % ~ in a URL
 {\catcode`\_=12 \gdef\UNDER/{_}} % _ in a URL
@@ -652,8 +649,8 @@
   %\global\advance\pageno by1}
 %\def\topofcontents{\centerline{\titlefont\title}\vskip.7in
   %\vfill} % this material will start the table of contents page
-%\def\startpdf{\ifpdftex\pdfcatalog{/PageMode /UseOutlines}\else
-    %\ifpdf{\special{pdf: docview << /PageMode /UseOutlines >>}}\fi\fi}
+%\def\startpdf{\ifpdftex\ifnum\pdfoutput>0 \pdfcatalog{/PageMode /UseOutlines}\fi
+  %\else \ifpdf{\special{pdf: docview << /PageMode /UseOutlines >>}}\fi\fi}
 %\def\botofcontents{\vfill
   %\centerline{\covernote}} % this material will end the table of contents page
 %\def\covernote{}
@@ -679,8 +676,9 @@
 \def\fin{\ifacro \message{Section names:}
   \def\U##1.{} \def\Us##1.{} \let\I=\relax \let\*=*
   \def\outsecname{Names of the sections}
-  \ifpdftex \makebookmarks
-    \pdfoutline goto num 1 count -\secno {\outsecname}
+  \ifpdftex \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}}
@@ -692,6 +690,10 @@
         /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\Q##1.{\relax}\def\Qs##1.{\relax}\def\U##1.{\relax}\def\Us##1.{\relax}
+  \readsections\relax}\message{\the\countD}}
 \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}}}



More information about the tex-live-commits mailing list.