summaryrefslogtreecommitdiff
path: root/systems/unix/tex-fpc/twebmac
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-04-09 03:02:31 +0000
committerNorbert Preining <norbert@preining.info>2021-04-09 03:02:31 +0000
commit8ccafc1be8d24ff0c4126d40847afbedab7fc7fb (patch)
tree06fbb0b4fc6fa3865d719139f6a1f04aaa03c963 /systems/unix/tex-fpc/twebmac
parent31d38d879db092b485e49e1b7c79f96c312fd1fb (diff)
CTAN sync 202104090302
Diffstat (limited to 'systems/unix/tex-fpc/twebmac')
-rw-r--r--systems/unix/tex-fpc/twebmac/README20
-rw-r--r--systems/unix/tex-fpc/twebmac/patch.sh92
-rw-r--r--systems/unix/tex-fpc/twebmac/report91
3 files changed, 203 insertions, 0 deletions
diff --git a/systems/unix/tex-fpc/twebmac/README b/systems/unix/tex-fpc/twebmac/README
new file mode 100644
index 0000000000..280abdbb63
--- /dev/null
+++ b/systems/unix/tex-fpc/twebmac/README
@@ -0,0 +1,20 @@
+Here is how to three bugs of the WEB macros:
+1. Excessive memory usage: TeX cannot compile tex.tex with its
+ default memory size.
+2. Module number in the header don't agree with the the first module on
+ the page.
+3. Modules starts on new pages when they shouldn't.
+
+The report describes the bugs, explains them and their fixes.
+The script patch.sh creates the file nwebmac.tex file from the original
+file TeXinputs/webmac.tex. Install nwebmac.tex in TeXinputs as webmac.tex,
+thus overwriting the original.
+
+To test the new macros cd to the tex directory, set \let\maybe=\iffalse in
+tex.ch. Then weave:
+ wve tex.web tex.ch
+It should print more than 90 pages and less than 100. Than and only then
+bug 1 and bug 3 are fixed.
+
+Happy TeXing and WEAVEing.
+Wolfgang
diff --git a/systems/unix/tex-fpc/twebmac/patch.sh b/systems/unix/tex-fpc/twebmac/patch.sh
new file mode 100644
index 0000000000..426475e155
--- /dev/null
+++ b/systems/unix/tex-fpc/twebmac/patch.sh
@@ -0,0 +1,92 @@
+ed TeXinputs/webmac.tex <<'END'
+207a
+ \let\toppart\rhead
+.
+192a
+ \let\toppart\rhead
+.
+159a
+\newif\ifdp \dptrue % writing to dummy page
+\newif\ifwp \wpfalse % writing not pending
+\edef\nextcl{}
+.
+157c
+ \ifcomp
+ \global\output{\normaloutput\page\clheader\crheader}
+ \else
+ \global\output{\normaloutput\page\lheader\rheader}
+ \fi
+}
+.
+155a
+ \global\dpfalse % not writing to dummy page
+.
+137c
+\def\rhead{WEB OUTPUT} % this running head is reset by starred sections
+\def\rrhead{WEB OUTPUT} % \rrhead and \rhead match for unchanged tex.tex
+.
+124a
+\def\toppart{\expandafter\taketwo\topmark}
+.
+123a
+% not compatible
+\def\lheader{\mainfont\the\pageno\eightrm\qquad\toppart
+ \hfill\title\qquad\mainfont\topsecno} % top line on left-hand pages
+\def\rheader{\mainfont\topsecno\eightrm\qquad\title\hfill
+ \toppart\qquad\mainfont\the\pageno} % top line on right-hand pages
+.
+122c
+\def\crheader{\mainfont\topsecno\eightrm\qquad\title\hfill
+.
+120c
+\newif\ifcomp \compfalse
+% compatible
+\def\clheader{\mainfont\the\pageno\eightrm\qquad\rhead
+.
+89,90c
+ \ifon \mark{{{\tensy x}\modno}{\rhead}}\fi}
+
+.
+87a
+ \comptrue
+.
+86c
+\def\MN#1.{\par % common code for \M, \N only called by private \N module
+.
+84d
+82a
+ \ifon\mark{{{\tensy x}\modno}{\rhead}}
+ \vfil\eject
+ \fi
+ \ifdp
+ \edef\nextcl{\nextcl\write\cont{\Z{#2}{\modno}{\the\pageno}}}
+ \wptrue
+ \else
+ \ifwp
+ \nextcl
+ \wpfalse
+ \fi
+ \edef\nextcl{\write\cont{\Z{#2}{\modno}{\the\pageno}}}\nextcl
+ % to contents file
+ \fi
+.
+79,81c
+\outer\def\M#1.{ % beginning of section
+ {\xdef\modstar{#1}\let\*=\empty\xdef\modno{#1}}
+ \ifx\modno\modstar \onmaybe \else\ontrue \fi
+ \ifon
+ \mark{{{\tensy x}\modno}{\rhead}}
+ \vfil\penalty-100\vfilneg
+ \vskip12ptminus3pt\startsection\ignorespaces
+}
+\outer\def\N#1.#2.{ % beginning of starred section
+ {\xdef\modstar{#1}\let\*=\empty\xdef\modno{#1}}% remove \* from section name
+ \ifx\modno\modstar \onmaybe \else\ontrue \fi
+.
+2c
+\xdef\fmtversion{\fmtversion+WEBMAC4.2+TeX-FPC, 4th ed.}
+ % identifies current set of macros
+\message{\fmtversion}
+.
+w nwebmac.tex
+END
diff --git a/systems/unix/tex-fpc/twebmac/report b/systems/unix/tex-fpc/twebmac/report
new file mode 100644
index 0000000000..9789534b9f
--- /dev/null
+++ b/systems/unix/tex-fpc/twebmac/report
@@ -0,0 +1,91 @@
+All bugs occur when weave prints changed modules only.
+
+bug 1: Excessive memory usage.
+reason: All modules \mark their module numbers on the current page.
+In tex.tex modules 880 to 1332 put their marks all on page 25, since
+most of these modules are unchanged. The fix is obvious: mark
+your module number only when you are going to be printed.
+
+bug 2: The module number in the header sometime differs from the first
+module on the page.
+reason: To keep it simple, we denote the four kinds of Modules with letters:
+m: unchanged unstarred Module
+n: unchanged starred Module
+M: changed unstarred Module
+N: changed starred Module
+
+The module sequence "n M", leads to the course of actions:
+1. n marks its number on page p.
+2. n \ejects p.
+3. M marks its number on page p+1
+4. M tentativly tries a page break. This break is prohibitive expensive.
+ M is still at the start of p+1.
+5. Eventually page p+1 is shipped out.
+6. The \output routine writes the last mark from the previous page as module
+ number in the header. This is the number of n.
+The fix is obvious: Don't \eject a page when you are not going to
+be printed. This way there is always some text of the previous
+module (or of the initial "\vbox to \vsize".) when it marks its
+number. If the break after the mark is performed, M will have put
+its mark on the previous page and the heading will show its number.
+If the break is not performed, there will be some text some text
+of the previous module, that is, M will not print at the start of
+the page and the heading shows correctly the number of the previous
+module.
+
+bug 3: A (nonstarred) module starts on a new page, even though there
+was enough room left for the whole module on the old page.
+The fix of bug 2 also fixes bug 3.
+
+bug 4: Some starred modules are not listed in the contents file.
+This bug is introduced by the fix of bug 2.
+This bug is triggered, when the first module of the program is starred but not
+changed.
+Writing the contents line is delayed until the current page is
+shipped out. Because only then the page number is determined. But
+the very first page, the dummy page, will never be shipped out.
+Because the dummy page is not ejected before n writes its content line, the
+write will get lost.
+The fix is obious: Maintain a flag "dp" with the meaning: "Writing
+to dummy page" and collect the lines in a macro like this:
+\ifdp
+ \edef\cline{\cline "line for this module"}
+\else
+ \edef\cline{"line for this module"}\cline
+\fi
+
+bug 5: Sometimes the heading shows the wrong part name
+The fix of bug2 introduces bug5.
+A starred module defines its part name in the macro \rhead.
+The \output-routine then displays \rhead in the heading.
+The sequence n1.p1. n2.p2 M3 N4.p3. triggers the bug: M2 is member of part p2,
+but the heading for M2 displays p3 instead of p2. That's because N4 puts p3
+in \rhead and then \ejects. The \ejected page starts with M3 but the
+\output routine includes the \rhead as defined at the time of \output.
+
+The fix is obvious: Store both the part name and the module number in
+the mark. And use both components of the mark to fill the header.
+
+bug 6: \input webmac and the say \bye. The \output will \cycle and fill your
+disk.
+The fix of bug5 triggers this bug.
+What happened? The mark (to the dummy page) is defined to contain \rhead
+and \def\rhead{\.{WEB} OUTPUT} breaks the execution of the tokenlist in
+the mark.
+
+The kludge is obvious: \def\rhead{WEB OUTPUT} saves the day. The
+\.-Macro kills the \output routine.
+
+Why and how the \. macro does its devastating deeds, you ask? Don't
+know, I answer.
+
+bug 7: weaving tex.web w/o tex.ch will give you wrong part names in the
+header, namely the one of the preceding part.
+case: N1.p1 M2 N3.p2 will display the part name WEB OUTPUT for N1.p1
+and part name p1 for N3.p2. It should show p1 and p2.
+The reason is simple: tex.tex defines a private macro \N which assumes
+the old \output routine which puts the part name via \rhead into the header.
+(See bug5)
+The fix is obvious: \NM is invoked only by the private unchanged \N of
+pure TeX or mf. This sets a flag, that controls the \output routine to
+get the part name from the topmark (not compatible) or from the \rhead.