summaryrefslogtreecommitdiff
path: root/Build/source/texk
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2022-06-17 17:44:16 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2022-06-17 17:44:16 +0000
commit9305acd2a6988a39f143f04920d89f99d3c1e71a (patch)
tree229676e039daf61a876e45e53ca7ec19b91ef173 /Build/source/texk
parent2cdfade0cbc5506115c92327ec6f9736d59bfea8 (diff)
[CWEB] Fix to decades-old bugs in cwebmac.tex.
While '\pdftextrue' and '\pdftrue' should be mutually exclusive in classic CWEB, this has to be programmatically expressed for the future use of 'iftex.sty'. (Introduced 2002.) And the 'count' attribute for the 'Names of Sections' bookmark should not exceed the number of subentries, lest many PDF validators will rightfully complain. So, instead of the total number of all sections, i.e., the number of the 'Index.' section, we had better calculate the actual number of '@<named sections@>'. (Introduced 2000.) (And the new 'ctan' target in the 'Makefile' should prevent any future mishaps when uploading updates of the CWEB package to CTAN.) git-svn-id: svn://tug.org/texlive/trunk@63625 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r--Build/source/texk/web2c/cwebdir/ChangeLog39
-rw-r--r--Build/source/texk/web2c/cwebdir/Makefile5
-rw-r--r--Build/source/texk/web2c/cwebdir/cwebmac.tex28
3 files changed, 24 insertions, 48 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog
index bb350bdfc4a..198a85e08ae 100644
--- a/Build/source/texk/web2c/cwebdir/ChangeLog
+++ b/Build/source/texk/web2c/cwebdir/ChangeLog
@@ -1,40 +1,7 @@
-2022-06-05 Andreas Scherer <https://ascherer.github.io>
+2022-06-17 Andreas Scherer <https://ascherer.github.io>
- * Makefile,
- * comm-mac.ch,
- * comm-mini.ch,
- * comm-ql.ch,
- * comm-w2c.ch,
- * comm-w2c.h,
- * common.h,
- * common.w,
- * ctang-bs.ch,
- * ctang-pc.ch,
- * ctang-ql.ch,
- * ctang-vms.ch,
- * ctang-w2c.ch,
- * ctang-w32.ch,
- * ctangle.c,
- * ctangle.w,
- * ctwill-w2c.ch,
- * cweav-bs.ch,
- * cweav-pc.ch,
- * cweav-ql.ch,
- * cweav-vms.ch,
- * cweav-w2c.ch,
- * cweav-w32.ch,
- * cweave.w,
- * cwebmac.tex,
- * cwebman-w2c.ch,
- * cwebman.tex,
- * po/cweb-tl.pot,
- * po/cweb.pot,
- * po/de/cweb-tl.po,
- * po/de/cweb.po,
- * po/it/cweb.po,
- * prod-cweave.w,
- * prod-twill.w,
- * prod.w: CWEB 4.8 release.
+ * Makefile: New target for CTAN packaging.
+ * cwebmac.tex: Fix two bugs from 2002 and 2000.
2022-06-05 Andreas Scherer <https://ascherer.github.io>
diff --git a/Build/source/texk/web2c/cwebdir/Makefile b/Build/source/texk/web2c/cwebdir/Makefile
index e3db8819c69..08effe531d3 100644
--- a/Build/source/texk/web2c/cwebdir/Makefile
+++ b/Build/source/texk/web2c/cwebdir/Makefile
@@ -203,3 +203,8 @@ tarfile: $(ALL) examples
tarball:
tar zcvhf /tmp/cweb.tgz $(ALL) examples
+
+ctan:
+ git archive -o ~/cweb-4.8.zip --prefix=cweb/ cweb-4.8
+ make PDF=pdf usermanual
+ cd ..; zip -r ~/cweb-4.8.zip cweb/cwebman.pdf
diff --git a/Build/source/texk/web2c/cwebdir/cwebmac.tex b/Build/source/texk/web2c/cwebdir/cwebmac.tex
index e2d2ecb3a24..adf4ec7f07d 100644
--- a/Build/source/texk/web2c/cwebdir/cwebmac.tex
+++ b/Build/source/texk/web2c/cwebdir/cwebmac.tex
@@ -1,8 +1,8 @@
% standard macros for CWEB listings (in addition to plain.tex)
-% Version 4.8--- June 2022
+% Version 4.8 --- June 2022
\ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros
\xdef\fmtversion{\fmtversion+CWEB4.8}
-\chardef\cwebversion=4 \chardef\cwebrevision=7
+\chardef\cwebversion=4 \chardef\cwebrevision=8
\newif\ifpdf
\ifx\pdf+\pdftrue\fi
% Uncomment the following line if you want PDF goodies to be the default
@@ -135,7 +135,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= }\\ }
@@ -145,7 +145,7 @@
\def\thedepth{\the\dp\strutbox\space}
\ifpdftex
\ifx\pdfannotlink\undefined\let\pdfannotlink\pdfstartlink\fi% for pdfTeX 0.14
- \def\pdflink#1#2{\hbox{\pdfannotlink height\ht\strutbox depth\dp\strutbox
+ \def\pdflink#1#2{\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}%
\special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight
@@ -294,12 +294,12 @@
\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
\fi % End of common macros
-\def\pdfURL#1#2{\ifpdftex\pdfannotlink height\ht\strutbox depth\dp\strutbox
+\def\pdfURL#1#2{\ifpdftex\pdfannotlink height \theheight depth \thedepth
attr {/Border [0 0 0]} user { /Type /Action /Subtype /Link /A
<< /S /URI /URI (#2) >>}\Blue #1\Black \pdfendlink % changed in 3.69
\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]
+ \special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight
+ depth \thedepth << /Border [0 0 0]
/Type /Action /Subtype /Link /A << /S /URI /URI (#2) >> >>}\box0\relax}%
\else #1 ({\tt#2})\fi\fi}
{\catcode`\~=12 \gdef\TILDE/{~}} % ~ in a URL
@@ -354,9 +354,9 @@
{\noexpand\the\pageno}{\the\toksE}}}\next % \ZZ{title}{depth}{sec}{page}{ss}
\ifpdftex\expandafter\xdef\csname curr#1\endcsname{\secno}
\ifnum#1>0\countB=#1 \advance\countB by-1
- \advancenumber{chunk\the\countB.\expnumber{curr\the\countB}}\fi\fi
- \ifpdf\special{pdf: outline #1 << /Title (\the\toksE) /Dest
- [ @thispage /FitH @ypos ] >>}\fi
+ \advancenumber{chunk\the\countB.\expnumber{curr\the\countB}}\fi
+ \else \ifpdf\special{pdf: outline #1 << /Title (\the\toksE) /Dest
+ [ @thispage /FitH @ypos ] >>}\fi\fi
\ifon\startsection{\bf#3.\quad}\ignorespaces}
\def\MN#1{\par % common code for \M, \N
{\xdef\secstar{#1}\let\*=\empty\xdef\secno{#1}}% remove \* from section name
@@ -495,7 +495,7 @@
\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 \fi % added in Version 3.68
+ \ifpdftex \makebookmarks \countsections \fi % added in Version 3.68 and 4.9
\parfillskip 0pt plus 1fil
\def\grouptitle{NAMES OF THE SECTIONS}
\let\topsecno=\nullsec
@@ -511,7 +511,7 @@
\ifacro \def\outsecname{Names of the sections} \let\Xpdf\X
% \ifpdftex \makebookmarks \pdfdest name {NOS} fitb % in versions < 3.68
\ifpdftex \pdfdest name {NOS} fith % changed in version 3.69
- \pdfoutline goto name {NOS} count -\secno {\outsecname}
+ \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}}
@@ -524,6 +524,10 @@
\fi\fi
\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\Q##1.{\relax}\def\Qs##1.{\relax}\def\U##1.{\relax}\def\Us##1.{\relax}
+ \readsections\relax}\message{\the\countD}}
\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