summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/plain/pwebmac/README.md2
-rw-r--r--Master/texmf-dist/doc/plain/pwebmac/makeall19
-rw-r--r--Master/texmf-dist/doc/plain/pwebmac/webman.ch14
-rw-r--r--Master/texmf-dist/tex/plain/pwebmac/pwebmac.tex57
4 files changed, 55 insertions, 37 deletions
diff --git a/Master/texmf-dist/doc/plain/pwebmac/README.md b/Master/texmf-dist/doc/plain/pwebmac/README.md
index 470bba611dc..7468ba8092a 100644
--- a/Master/texmf-dist/doc/plain/pwebmac/README.md
+++ b/Master/texmf-dist/doc/plain/pwebmac/README.md
@@ -34,4 +34,4 @@ creates HINT output that can be viewed with the `hintview` program.
The `pwebmac` package is free software and may be used without constraints.
-This is version “4.8” of the `pwebmac` package — 2022-06-05, Andreas Scherer.
+This is version “4.8.1” of the `pwebmac` package — 2022-06-25, Andreas Scherer.
diff --git a/Master/texmf-dist/doc/plain/pwebmac/makeall b/Master/texmf-dist/doc/plain/pwebmac/makeall
index eeed9c76bc4..0f857db24f3 100644
--- a/Master/texmf-dist/doc/plain/pwebmac/makeall
+++ b/Master/texmf-dist/doc/plain/pwebmac/makeall
@@ -19,13 +19,14 @@ Options are (--long options only with GNU getopt):
-o, --outdir ARG Create tarballs in path ARG
-p, --pdftocfront Place TOC page at the front (PDF only)
-t, --tex ARG Use TeX variant ARG=[(hi|pdf|xe)]tex
+ -v, --validpdf Use correct number of entries in NOS node
Public domain. Originally written by Andreas Scherer, 2020.
HELP
}
-LONGOPTS=changes,files:,help,new,outdir:,pdftocfront,tex:
-SHRTOPTS=cf:hno:pt:
+LONGOPTS=changes,files:,help,new,outdir:,pdftocfront,tex:,validpdf
+SHRTOPTS=cf:hno:pt:v
CHANGES=false # apply changefile to C/WEB source
FILESELECT=false # user-defined '--files' selection
@@ -33,6 +34,7 @@ NEW=false # '\input pwebmac' instead of '\input webmac' for PDF et al.
OUTDIR=. # path where the resulting tarballs are placed
PDFTOCFRONT=false # push table-of-contents to front of PDF output
TEX=tex # or 'pdftex' or 'xetex' or 'hitex'
+VALID=false # give 'pdftex' a chance to produce valid output
# Initial list of C/WEB sources to process, overridable with option '-f':
KNUTHWHERE=$(locate /bibtex.web)
@@ -78,6 +80,7 @@ do
-o | --outdir ) OUTDIR="$2"; shift 2 ;;
-p | --pdftocfront ) PDFTOCFRONT=true; shift ;;
-t | --tex ) TEX=$2; shift 2 ;;
+ -v | --validpdf ) VALID=true; shift ;;
-- ) shift; break ;;
* ) usage; exit 1 ;;
esac
@@ -97,6 +100,13 @@ then
PDF=hnt # default extension for 'knuth-hint'
fi
+# Valid PDF output from 'pdftex': In 'pwebmac.tex' set '\countD' to the actual
+# number of @<named modules@>, not the number of all sections.
+if ( [ pdftex = $TEX ] && $VALID )
+then
+ TEX="$TEX --shell-escape"
+fi
+
# WEB and CWEB programs we want to get formatted
for f in $FILES
do
@@ -185,7 +195,7 @@ do
# active links in PDF outlines/bookmarks
cat > texmf-pdf.patch << FI
- \ifacro{\toksF={}\makeoutlinetoks{[#2] #3}\outlinedone\outlinedone}\fi
+ \ifpdf{\toksF={}\makeoutlinetoks{[#2] #3}\outlinedone\outlinedone}\fi
FI
$SED_I -e "/\\\\outer\\\\def\\\\N/ {
r texmf-pdf.patch
@@ -194,8 +204,9 @@ FI
$SED_I -e "s/{\\\\the\\\\pageno}}}\\\\next/{\\\\the\\\\pageno}{\\\\the\\\\toksE}}}\\\\next/" $f.tex
cat > texmf-pdf.patch << FI
+ \ifpdftex\relax\else
\ifpdf\special{pdf: outline 0 << /Title (\the\toksE) /Dest
- [ @thispage /FitH @ypos ] >>}\fi
+ [ @thispage /FitH @ypos ] >>}\fi\fi
FI
$SED_I -e "/ \\\\edef\\\\next/ {
r texmf-pdf.patch
diff --git a/Master/texmf-dist/doc/plain/pwebmac/webman.ch b/Master/texmf-dist/doc/plain/pwebmac/webman.ch
index 0ccae2847d1..e781ee01dc3 100644
--- a/Master/texmf-dist/doc/plain/pwebmac/webman.ch
+++ b/Master/texmf-dist/doc/plain/pwebmac/webman.ch
@@ -2,7 +2,7 @@
\input webmac
@y
\input pwebmac
-\ifacro
+\ifpdf
\pdfpagewidth=\pagewidth \advance\pdfpagewidth by 2cm
\pdfpageheight=\pageheight \advance\pdfpageheight by 3cm
\ifpdftex \pdfhorigin=1cm \pdfvorigin=1cm
@@ -19,7 +19,7 @@
\def\bkminfo{}
\outer\def\section #1.{\penalty-50\vskip 12pt plus 3pt minus 3pt
- \noindent\ifacro\vbox to 0pt{\kern-2.5ex\relax
+ \noindent\ifpdf\vbox to 0pt{\kern-2.5ex\relax
\ifpdftex\pdfdest num \destcount fitbh\relax
\else\special{pdf: dest (\the\destcount) [ @thispage /FitBH @ypos ]}\fi
\def\.##1{##1}%
@@ -43,7 +43,7 @@
\def\Appendix#1{\leavevmode
\ifnum\csname app#1\endcsname>0 %
- \ifacro\ifpdftex
+ \ifpdf\ifpdftex
\pdfstartlink attr{/Border[0 0 0]} goto num\csname app#1\endcsname\relax
\PDFlinkcolor\hbox{Appendix}~#1\Black
\pdfendlink
@@ -56,6 +56,14 @@
\else Appendix~#1\fi}
@z
+@x l.34
+\vskip 15pt plus 3pt minus 3pt
+\noindent This memo describes how to write programs in the
+@y
+ \section Introduction.
+This memo describes how to write programs in the
+@z
+
@x l.180
\yskip\item{1)} A \TeX\ part, containing explanatory material about what
@y
diff --git a/Master/texmf-dist/tex/plain/pwebmac/pwebmac.tex b/Master/texmf-dist/tex/plain/pwebmac/pwebmac.tex
index 6c951058f96..3143de696bc 100644
--- a/Master/texmf-dist/tex/plain/pwebmac/pwebmac.tex
+++ b/Master/texmf-dist/tex/plain/pwebmac/pwebmac.tex
@@ -5,23 +5,18 @@
% macro integration \`a la CWEB by Andreas Scherer <andreas_tex@freenet.de>.
% This file is not copyrighted and can be used freely.
\ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros
-\xdef\fmtversion{\fmtversion+WEBMAC4.7}
-\newif\ifpdf
+\xdef\fmtversion{\fmtversion+WEBMAC4.8}
+\input iftex.sty % TeX engine tests
\ifx\pdf+\pdftrue\fi
% 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\ifhint
-\ifx\HINTversion\undefined \hintfalse \else \hinttrue \fi
-\newif\ifacro \ifpdf\acrotrue\fi \ifpdftex\acrotrue\fi
-\newif\ifacrohint \ifacro\acrohinttrue\fi \ifhint\acrohinttrue\fi
+\fi
+\newif\ifacrohint \ifpdf\acrohinttrue\fi \ifhint\acrohinttrue\fi
\parskip 0pt % no stretch between paragraphs
\parindent 1em % for paragraphs and for the first line of Pascal text
@@ -90,17 +85,19 @@
\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
+\ifpdftex \ifnum\pdfshellescape=1 {\let\\=\BS
+ \global\countD=\input{|grep -c -e '\\:\\X' \jobname.tex}} \fi\fi
\newif\iftokprocessed \newif\ifTnum \newif\ifinstr
{\def\\{\global\let\spacechar= }\\ }
-\ifacro % The following are pdf macros from 'cwebmac.tex 3.70'
+\ifpdf % The following are pdf macros from 'cwebmac.tex 3.70'
\def\thewidth{\the\wd0 \space}
\def\theheight{\the\ht\strutbox\space}
\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 \PDFlinkcolor #1\Black\pdfendlink}}
\else\def\pdflink#1#2{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}%
\special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight
@@ -191,7 +188,7 @@
\let\pdflink=\HINTlink
\fi % End of HINT macros
-% Common macros for \ifacro and \ifhint
+% Common macros for \ifpdf and \ifhint
\ifacrohint
\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA}
\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}%
@@ -219,14 +216,14 @@
\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
- attr {/Border [0 0 0]} user { /Type /Action /Subtype /Link /A
+\def\pdfURL#1#2{\ifpdf \ifpdftex\pdfannotlink height \theheight depth \thedepth
+ 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}%
- \else #1 ({\tt#2})\fi\fi}
+ \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
@@ -235,7 +232,7 @@
\sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50
\ifhint\HINTlabel\fi% Start page before section
\noindent{\let\*=\lapstar\bf\modstar.\quad}%
- \ifacro \smash{\raise\baselineskip\hbox to0pt{\let\*=\empty
+ \ifpdf \smash{\raise\baselineskip\hbox to0pt{\let\*=\empty
\ifpdftex \pdfdest num \modstar fith%
\else \special{pdf: dest (\romannumeral\modstar)
[ @thispage /FitH @ypos ]}\fi}}\fi}
@@ -260,15 +257,16 @@
\outer\def\M#1.{\MN#1.\ifon\vfil\penalty-100\vfilneg % beginning of section
\vskip\intersecskip\startsection\ignorespaces}
\outer\def\N#1.#2.{% beginning of starred section
- \ifacro{\toksF={}\makeoutlinetoks#2\outlinedone\outlinedone}\fi
+ \ifpdf{\toksF={}\makeoutlinetoks#2\outlinedone\outlinedone}\fi
\gtitle={#2}\MN#1.\vfil\eject % define running headline
\message{*\modno} % progress report
\def\stripprefix##1>{}\def\gtitletoks{#2}%
\edef\gtitletoks{\expandafter\stripprefix\meaning\gtitletoks}%
\edef\next{\write\cont{\Z{\gtitletoks}{\modno}% write to contents file
{\noexpand\the\pageno}{\the\toksE}}}\next % \Z{title}{sec}{page}{ss}
+ \ifpdftex\relax\else
\ifpdf\special{pdf: outline 0 << /Title (\the\toksE) /Dest
- [ @thispage /FitH @ypos ] >>}\fi
+ [ @thispage /FitH @ypos ] >>}\fi\fi
\ifon\startsection{\bf\ignorespaces#2.\quad}\ignorespaces}
\def\MN#1.{\par % common code for \M, \N
{\xdef\modstar{#1}\let\*=\empty\xdef\modno{#1}}% remove \* from section name
@@ -330,8 +328,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{\ifpdf \ifpdftex\pdfcatalog{/PageMode /UseOutlines}
+ \else {\special{pdf: docview << /PageMode /UseOutlines >>}}\fi\fi}
\def\botofcontents{\vfill
\centerline{\covernote}} % this material will end the table of contents page
\def\covernote{}
@@ -402,8 +400,9 @@
\def\U{\note{Used in section}} % crossref for use of a section
\def\Us{\note{Used in sections}} % crossref for uses of a section
\def\:{\par\hangindent 2em}\let\*=*\let\.=\ttentry
- \ifacro \def\outsecname{Names of the sections} \let\Xpdf\X
+ \ifpdf \def\outsecname{Names of the sections} \let\Xpdf\X
\ifpdftex \pdfdest name {NOS} fith
+ \ifnum \the\countD>0 \xdef\modno{\the\countD} \fi
\pdfoutline goto name {NOS} count -\modno {\outsecname}
\def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.%
{\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
@@ -444,7 +443,7 @@
\ \ifhint
\HINTlink{#2}{\romannumeral#2}% No page numbers in HINT
\HINTcontents{#1}{#2}{#3}%
- \else\ifacro\pdflink{#2}{\romannumeral#2}\else#2\fi
+ \else\ifpdf\pdflink{#2}{\romannumeral#2}\else#2\fi
\hbox to3em{\hss#3}\fi}}
\def\today{\ifcase\month\or
January\or February\or March\or April\or May\or June\or