summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/c_cpp/cweb/Makefile6
-rw-r--r--web/c_cpp/cweb/comm-mac.ch4
-rw-r--r--web/c_cpp/cweb/comm-ql.ch8
-rw-r--r--web/c_cpp/cweb/common.h2
-rw-r--r--web/c_cpp/cweb/common.w6
-rw-r--r--web/c_cpp/cweb/ctang-bs.ch4
-rw-r--r--web/c_cpp/cweb/ctang-pc.ch4
-rw-r--r--web/c_cpp/cweb/ctang-ql.ch8
-rw-r--r--web/c_cpp/cweb/ctang-vms.ch4
-rw-r--r--web/c_cpp/cweb/ctang-w32.ch4
-rw-r--r--web/c_cpp/cweb/ctangle.c2
-rw-r--r--web/c_cpp/cweb/ctangle.w8
-rw-r--r--web/c_cpp/cweb/cweav-bs.ch4
-rw-r--r--web/c_cpp/cweb/cweav-pc.ch4
-rw-r--r--web/c_cpp/cweb/cweav-ql.ch8
-rw-r--r--web/c_cpp/cweb/cweav-vms.ch4
-rw-r--r--web/c_cpp/cweb/cweav-w32.ch4
-rw-r--r--web/c_cpp/cweb/cweave.w32
-rw-r--r--web/c_cpp/cweb/cweb.19
-rw-r--r--web/c_cpp/cweb/cwebacromac.tex111
-rw-r--r--web/c_cpp/cweb/cwebmac.tex96
-rw-r--r--web/c_cpp/cweb/cwebman.pdfbin347143 -> 355516 bytes
-rw-r--r--web/c_cpp/cweb/cwebman.tex38
-rw-r--r--web/c_cpp/cweb/prod.w11
-rw-r--r--web/pwebmac/README.md2
-rw-r--r--web/pwebmac/editorsnote.tex22
-rw-r--r--web/pwebmac/index.md17
-rwxr-xr-xweb/pwebmac/makeall380
-rw-r--r--web/pwebmac/pwebmac.tex126
-rw-r--r--web/pwebmac/webman.ch82
30 files changed, 560 insertions, 450 deletions
diff --git a/web/c_cpp/cweb/Makefile b/web/c_cpp/cweb/Makefile
index 28ea97d554..a11936f989 100644
--- a/web/c_cpp/cweb/Makefile
+++ b/web/c_cpp/cweb/Makefile
@@ -1,6 +1,6 @@
# This file is part of CWEB.
# It is distributed WITHOUT ANY WARRANTY, express or implied.
-# Version 4.11 --- December 2023
+# Version 4.12 --- August 2024
# Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth
@@ -216,6 +216,6 @@ tarball:
tar zcvhf /tmp/cweb.tgz $(ALL) examples
ctan:
- git archive -o ~/cweb-4.11.zip --prefix=cweb/ cweb-4.11
+ git archive -o ~/cweb-4.12.zip --prefix=cweb/ cweb-4.12
make PDF=pdf usermanual
- cd ..; zip -r ~/cweb-4.11.zip cweb/cwebman.pdf
+ cd ..; zip -r ~/cweb-4.12.zip cweb/cwebman.pdf
diff --git a/web/c_cpp/cweb/comm-mac.ch b/web/c_cpp/cweb/comm-mac.ch
index 79b1ec945e..1540a9a4e2 100644
--- a/web/c_cpp/cweb/comm-mac.ch
+++ b/web/c_cpp/cweb/comm-mac.ch
@@ -4,9 +4,9 @@ No changes to CTANGLE or CWEAVE are needed.
(Contributed 13 Oct 2000 by AndPio@aol.com; slightly edited by Don Knuth)
@x in limbo, change the title page document to specify Mac version
- \centerline{(Version 4.11)}
+ \centerline{(Version 4.12)}
@y
- \centerline{(Version 4.11 for MacOS)}
+ \centerline{(Version 4.12 for MacOS)}
@z
@x section 23: Make input_ln accept \n, \r, \n\r, or \r\n as line endings
diff --git a/web/c_cpp/cweb/comm-ql.ch b/web/c_cpp/cweb/comm-ql.ch
index 44cc39ec45..8510fc093a 100644
--- a/web/c_cpp/cweb/comm-ql.ch
+++ b/web/c_cpp/cweb/comm-ql.ch
@@ -10,24 +10,24 @@ ex <dev_>cc;'-v -h -c -=500000 -DCWEBINPUTS=flp2_ common_c'
@x
\def\v{\char'174} % vertical (|) in typewriter font
-\def\title{Common code for CTANGLE and CWEAVE (Version 4.11)}
+\def\title{Common code for CTANGLE and CWEAVE (Version 4.12)}
\def\topofcontents{\null\vfill
\centerline{\titlefont Common code for {\ttitlefont CTANGLE} and
{\ttitlefont CWEAVE}}
\vskip 15pt
- \centerline{(Version 4.11)}
+ \centerline{(Version 4.12)}
\vfill}
\def\botofcontents{\vfill
\noindent
@y
\def\v{\char'174} % vertical (|) in typewriter font
-\def\title{Common code for CTANGLE and CWEAVE (QL Version 4.11)}
+\def\title{Common code for CTANGLE and CWEAVE (QL Version 4.12)}
\def\topofcontents{\null\vfill
\centerline{\titlefont Common code for {\ttitlefont CTANGLE} and
{\ttitlefont CWEAVE}}
\vskip 15pt
- \centerline{(Version 4.11)}
+ \centerline{(Version 4.12)}
\vfill}
\def\botofcontents{\vfill
\noindent
diff --git a/web/c_cpp/cweb/common.h b/web/c_cpp/cweb/common.h
index 97fda82e75..2e02af934f 100644
--- a/web/c_cpp/cweb/common.h
+++ b/web/c_cpp/cweb/common.h
@@ -2,7 +2,7 @@
% This program by Silvio Levy and Donald E. Knuth
% is based on a program by Knuth.
% It is distributed WITHOUT ANY WARRANTY, express or implied.
-% Version 4.11 --- December 2023 (works also with later versions)
+% Version 4.12 --- August 2024 (works also with later versions)
% Copyright (C) 1987,1990,1993 Silvio Levy and Donald E. Knuth
diff --git a/web/c_cpp/cweb/common.w b/web/c_cpp/cweb/common.w
index 88932f3118..1c077736bb 100644
--- a/web/c_cpp/cweb/common.w
+++ b/web/c_cpp/cweb/common.w
@@ -2,7 +2,7 @@
% This program by Silvio Levy and Donald E. Knuth
% is based on a program by Knuth.
% It is distributed WITHOUT ANY WARRANTY, express or implied.
-% Version 4.11 --- December 2023
+% Version 4.12 --- August 2024
% Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth
@@ -22,12 +22,12 @@
\def\v{\char'174} % vertical (|) in typewriter font
-\def\title{Common code for CTANGLE and CWEAVE (Version 4.11)}
+\def\title{Common code for CTANGLE and CWEAVE (Version 4.12)}
\def\topofcontents{\null\vfill
\centerline{\titlefont Common code for {\ttitlefont CTANGLE} and
{\ttitlefont CWEAVE}}
\vskip 15pt
- \centerline{(Version 4.11)}
+ \centerline{(Version 4.12)}
\vfill}
\def\botofcontents{\vfill
\noindent
diff --git a/web/c_cpp/cweb/ctang-bs.ch b/web/c_cpp/cweb/ctang-bs.ch
index c70a87fe1d..234f41039e 100644
--- a/web/c_cpp/cweb/ctang-bs.ch
+++ b/web/c_cpp/cweb/ctang-bs.ch
@@ -17,12 +17,12 @@ by using "huge" pointers.
The ``banner line'' defined here should be changed whenever \.{CTANGLE}
is modified.
-@d banner "This is CTANGLE (Version 4.11)"
+@d banner "This is CTANGLE (Version 4.12)"
@y
The ``banner line'' defined here should be changed whenever \.{CTANGLE}
is modified.
-@d banner "This is CTANGLE (Version 4.11pc/big)"
+@d banner "This is CTANGLE (Version 4.12pc/big)"
@z
diff --git a/web/c_cpp/cweb/ctang-pc.ch b/web/c_cpp/cweb/ctang-pc.ch
index 3e6e7ac5ef..61db92aa7e 100644
--- a/web/c_cpp/cweb/ctang-pc.ch
+++ b/web/c_cpp/cweb/ctang-pc.ch
@@ -9,9 +9,9 @@ that allows >64K arrays. If you need lots of bytes and toks, try the
alternate change files with -bs suffix instead of -pc.
@x section 1
-@d banner "This is CTANGLE (Version 4.11)"
+@d banner "This is CTANGLE (Version 4.12)"
@y
-@d banner "This is CTANGLE (Version 4.11pc)"
+@d banner "This is CTANGLE (Version 4.12pc)"
@z
@x section 17
@d max_bytes 100000 /* the number of bytes in identifiers,
diff --git a/web/c_cpp/cweb/ctang-ql.ch b/web/c_cpp/cweb/ctang-ql.ch
index 8072aff51a..41831c850d 100644
--- a/web/c_cpp/cweb/ctang-ql.ch
+++ b/web/c_cpp/cweb/ctang-ql.ch
@@ -7,15 +7,15 @@ ex <dev_>cc;"-v -h -c -=500000 ctangle_c"
@x
-\def\title{CTANGLE (Version 4.11)}
+\def\title{CTANGLE (Version 4.12)}
@y
-\def\title{CTANGLE (QL Version 4.11)}
+\def\title{CTANGLE (QL Version 4.12)}
@z
@x section 1
-@d banner "This is CTANGLE (Version 4.11)"
+@d banner "This is CTANGLE (Version 4.12)"
@y
-@d banner "This is CTANGLE (QL Version 4.11)"
+@d banner "This is CTANGLE (QL Version 4.12)"
@z
@x
diff --git a/web/c_cpp/cweb/ctang-vms.ch b/web/c_cpp/cweb/ctang-vms.ch
index 2c4df3bf60..7f142df49a 100644
--- a/web/c_cpp/cweb/ctang-vms.ch
+++ b/web/c_cpp/cweb/ctang-vms.ch
@@ -10,9 +10,9 @@ created:
(these changes not necessary for initial bootstrapping)
@x section 1 (01-FEB-1992 ST)
-@d banner "This is CTANGLE (Version 4.11)"
+@d banner "This is CTANGLE (Version 4.12)"
@y
-@d banner "This is CTANGLE (VAX/VMS Version 4.11)"
+@d banner "This is CTANGLE (VAX/VMS Version 4.12)"
@z
@x section 5 (01-FEB-1992 ST)
diff --git a/web/c_cpp/cweb/ctang-w32.ch b/web/c_cpp/cweb/ctang-w32.ch
index c0384b4888..2a5c6f1186 100644
--- a/web/c_cpp/cweb/ctang-w32.ch
+++ b/web/c_cpp/cweb/ctang-w32.ch
@@ -4,9 +4,9 @@ This is the change file for CWEB's CTANGLE under Win32
Changes necessary for compiling with Borland C/C++
@x section 1
-@d banner "This is CTANGLE (Version 4.11)"
+@d banner "This is CTANGLE (Version 4.12)"
@y
-@d banner "This is CTANGLE (Version 4.11win32)"
+@d banner "This is CTANGLE (Version 4.12win32)"
@z
@x section 24
diff --git a/web/c_cpp/cweb/ctangle.c b/web/c_cpp/cweb/ctangle.c
index 58e37b27b4..d1cf6c6769 100644
--- a/web/c_cpp/cweb/ctangle.c
+++ b/web/c_cpp/cweb/ctangle.c
@@ -15,7 +15,7 @@
/*:5*/
#line 67 "ctangle.w"
-#define banner "This is CTANGLE (Version 4.11)" \
+#define banner "This is CTANGLE (Version 4.12)" \
#define ctangle false
#define cweave true \
diff --git a/web/c_cpp/cweb/ctangle.w b/web/c_cpp/cweb/ctangle.w
index 37b09e7fc0..b42595baa9 100644
--- a/web/c_cpp/cweb/ctangle.w
+++ b/web/c_cpp/cweb/ctangle.w
@@ -2,7 +2,7 @@
% This program by Silvio Levy and Donald E. Knuth
% is based on a program by Knuth.
% It is distributed WITHOUT ANY WARRANTY, express or implied.
-% Version 4.11 --- December 2023
+% Version 4.12 --- August 2024
% Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth
@@ -27,11 +27,11 @@
\mathchardef\RA="3221 % right arrow
\mathchardef\BA="3224 % double arrow
-\def\title{CTANGLE (Version 4.11)}
+\def\title{CTANGLE (Version 4.12)}
\def\topofcontents{\null\vfill
\centerline{\titlefont The {\ttitlefont CTANGLE} processor}
\vskip 15pt
- \centerline{(Version 4.11)}
+ \centerline{(Version 4.12)}
\vfill}
\def\botofcontents{\vfill
\noindent
@@ -61,7 +61,7 @@ Joachim Schrod, Lee Wittenberg, and others who have contributed improvements.
The ``banner line'' defined here should be changed whenever \.{CTANGLE}
is modified.
-@d banner "This is CTANGLE (Version 4.11)"
+@d banner "This is CTANGLE (Version 4.12)"
@c
@<Include files@>@/
diff --git a/web/c_cpp/cweb/cweav-bs.ch b/web/c_cpp/cweb/cweav-bs.ch
index c2f3214c79..458a0a7e60 100644
--- a/web/c_cpp/cweb/cweav-bs.ch
+++ b/web/c_cpp/cweb/cweav-bs.ch
@@ -20,12 +20,12 @@ This file contributed by Barry Schwartz, trashman@crud.mn.org, 28 Jun 94.
The ``banner line'' defined here should be changed whenever \.{CWEAVE}
is modified.
-@d banner "This is CWEAVE (Version 4.11)"
+@d banner "This is CWEAVE (Version 4.12)"
@y
The ``banner line'' defined here should be changed whenever \.{CWEAVE}
is modified.
-@d banner "This is CWEAVE (Version 4.11pc/big)"
+@d banner "This is CWEAVE (Version 4.12pc/big)"
@z
diff --git a/web/c_cpp/cweb/cweav-pc.ch b/web/c_cpp/cweb/cweav-pc.ch
index 165b8a54ee..ae1fb9f45c 100644
--- a/web/c_cpp/cweb/cweav-pc.ch
+++ b/web/c_cpp/cweb/cweav-pc.ch
@@ -11,9 +11,9 @@ that allows >64K arrays. (If you need lots more bytes, try the alternate
change files that have -bs in their name instead of -pc.)
@x section 1
-@d banner "This is CWEAVE (Version 4.11)"
+@d banner "This is CWEAVE (Version 4.12)"
@y
-@d banner "This is CWEAVE (Version 4.11pc)"
+@d banner "This is CWEAVE (Version 4.12pc)"
@z
@x section 17
diff --git a/web/c_cpp/cweb/cweav-ql.ch b/web/c_cpp/cweb/cweav-ql.ch
index 31bd6138a2..fd369064de 100644
--- a/web/c_cpp/cweb/cweav-ql.ch
+++ b/web/c_cpp/cweb/cweav-ql.ch
@@ -7,15 +7,15 @@ ex <dev_>cc;"-v -h -c =500000 cweave_c"
@x
-\def\title{CWEAVE (Version 4.11)}
+\def\title{CWEAVE (Version 4.12)}
@y
-\def\title{CWEAVE (QL Version 4.11)}
+\def\title{CWEAVE (QL Version 4.12)}
@z
@x section 1
-@d banner "This is CWEAVE (Version 4.11)"
+@d banner "This is CWEAVE (Version 4.12)"
@y
-@d banner "This is CWEAVE (QL Version 4.11)"
+@d banner "This is CWEAVE (QL Version 4.12)"
@z
@x
diff --git a/web/c_cpp/cweb/cweav-vms.ch b/web/c_cpp/cweb/cweav-vms.ch
index b944f83815..f4630f9866 100644
--- a/web/c_cpp/cweb/cweav-vms.ch
+++ b/web/c_cpp/cweb/cweav-vms.ch
@@ -13,9 +13,9 @@ modified:
(also modified by Don Knuth to keep version numbers uptodate)
@x section 1 (01-FEB-1992 ST)
-@d banner "This is CWEAVE (Version 4.11)"
+@d banner "This is CWEAVE (Version 4.12)"
@y
-@d banner "This is CWEAVE (VAX/VMS Version 4.11)"
+@d banner "This is CWEAVE (VAX/VMS Version 4.12)"
@z
@x section 5 (01-FEB-1992 ST)
diff --git a/web/c_cpp/cweb/cweav-w32.ch b/web/c_cpp/cweb/cweav-w32.ch
index 1bf1471e18..2f9a2127ac 100644
--- a/web/c_cpp/cweb/cweav-w32.ch
+++ b/web/c_cpp/cweb/cweav-w32.ch
@@ -2,9 +2,9 @@ This is the change file for CWEB's CWEAVE under Win32
(Contributed by Fabrice Popineau, February 2002)
@x section 1
-@d banner "This is CWEAVE (Version 4.11)"
+@d banner "This is CWEAVE (Version 4.12)"
@y
-@d banner "This is CWEAVE (Version 4.11win32)"
+@d banner "This is CWEAVE (Version 4.12win32)"
@z
@x section 32
diff --git a/web/c_cpp/cweb/cweave.w b/web/c_cpp/cweb/cweave.w
index 2048c6bb2f..627fa1fa81 100644
--- a/web/c_cpp/cweb/cweave.w
+++ b/web/c_cpp/cweb/cweave.w
@@ -2,7 +2,7 @@
% This program by Silvio Levy and Donald E. Knuth
% is based on a program by Knuth.
% It is distributed WITHOUT ANY WARRANTY, express or implied.
-% Version 4.11 --- December 2023
+% Version 4.12 --- August 2024
% Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth
@@ -27,16 +27,15 @@
\def\dleft{[\![} \def\dright{]\!]} % double brackets
\mathchardef\RA="3221 % right arrow
\mathchardef\BA="3224 % double arrow
-\def\({} % ) kludge for alphabetizing certain section names
\def\TeXxstring{\\{\TEX/\_string}}
\def\skipxTeX{\\{skip\_\TEX/}}
\def\copyxTeX{\\{copy\_\TEX/}}
-\def\title{CWEAVE (Version 4.11)}
+\def\title{CWEAVE (Version 4.12)}
\def\topofcontents{\null\vfill
\centerline{\titlefont The {\ttitlefont CWEAVE} processor}
\vskip 15pt
- \centerline{(Version 4.11)}
+ \centerline{(Version 4.12)}
\vfill}
\def\botofcontents{\vfill
\noindent
@@ -67,7 +66,7 @@ Crusius, and others who have contributed improvements.
The ``banner line'' defined here should be changed whenever \.{CWEAVE}
is modified.
-@d banner "This is CWEAVE (Version 4.11)"
+@d banner "This is CWEAVE (Version 4.12)"
@c
@<Include files@>@/
@@ -1813,6 +1812,10 @@ static char cat_name[256][12]; /* |12==strlen("struct_head")+1| */
strcpy(cat_name[typedef_like],"typedef");
strcpy(cat_name[define_like],"define");
strcpy(cat_name[template_like],"template");
+ strcpy(cat_name[alignas_like],"alignas");
+ strcpy(cat_name[using_like],"using");
+ strcpy(cat_name[default_like],"default");
+ strcpy(cat_name[attr],"attr");
strcpy(cat_name[ftemplate],"ftemplate");
strcpy(cat_name[new_exp],"new_exp");
strcpy(cat_name[begin_arg],"@@["@q]@>);
@@ -1820,10 +1823,6 @@ static char cat_name[256][12]; /* |12==strlen("struct_head")+1| */
strcpy(cat_name[lbrack],"[");
strcpy(cat_name[rbrack],"]");
strcpy(cat_name[attr_head],"attr_head");
- strcpy(cat_name[attr],"attr");
- strcpy(cat_name[alignas_like],"alignas");
- strcpy(cat_name[using_like],"using");
- strcpy(cat_name[default_like],"default");
strcpy(cat_name[0],"zero");
@ This code allows \.{CWEAVE} to display its parsing steps.
@@ -2855,7 +2854,8 @@ if (cat1==rbrace) {
reduce(pp,2,stmt,-1,54);
}
else if ((cat1==stmt||cat1==decl||cat1==function) && cat2==rbrace) {
- big_app(force); big_app1(pp); big_app(indent); big_app(force);
+ big_app(force); big_app1(pp); big_app(indent);
+ big_app(force_first ? force : break_space);
big_app1(pp+1); big_app(force); big_app(backup); big_app1(pp+2);
big_app(outdent); big_app(force); reduce(pp,3,stmt,-1,55);
}
@@ -2917,9 +2917,12 @@ if (cat1==stmt || cat1==exp) {
@ @<Cases for |do_like|@>=
if (cat1==stmt && cat2==else_like && cat3==semi) {
+ if (!force_lines) big_app(force);
big_app1(pp); big_app(break_space); app(noop); big_app(cancel);
big_app1(pp+1); big_app(cancel); app(noop); big_app(break_space);
- big_app2(pp+2); reduce(pp,4,stmt,-1,69);
+ big_app2(pp+2);
+ if (!force_lines) big_app(force);
+ reduce(pp,4,stmt,-1,69);
}
@ @<Cases for |case_like|@>=
@@ -2945,12 +2948,15 @@ else if (cat1==stmt||cat1==decl||cat1==function) {
else if (cat1==rbrace) reduce(pp,0,decl,-1,156);
@ The user can decide at run-time whether short statements should be
-grouped together on the same line.
+grouped together on the same line. Another form of compaction places
+the first line of a `compound statement', a.k.a.\ `block', next to
+the opening curly brace.
@d force_lines flags['f'] /* should each statement be on its own line? */
+@d force_first flags['F'] /* should compound statement start on new line? */
@<Set init...@>=
-force_lines=true;
+force_lines=force_first=true;
@ @<Cases for |stmt|@>=
if (cat1==stmt || cat1==decl || cat1==function) {
diff --git a/web/c_cpp/cweb/cweb.1 b/web/c_cpp/cweb/cweb.1
index 192c7c9597..70ed7ad030 100644
--- a/web/c_cpp/cweb/cweb.1
+++ b/web/c_cpp/cweb/cweb.1
@@ -1,4 +1,4 @@
-.TH CWEB 1 2023-Aug-20
+.TH CWEB 1 2024-Mar-09
.
.SH NAME
ctangle, cweave \- translate CWEB to C and/or TeX
@@ -14,7 +14,7 @@ ctangle, cweave \- translate CWEB to C and/or TeX
.br
.B cweave
[
-.B \-befhpx
+.B \-befFhpx
] [
.B +st
] webfile[.w] [{changefile[.ch]|-} [outputfile[.tex]]]
@@ -86,11 +86,14 @@ only:
.B +k
means keep '-separators in numeric literals in the C/C++\ output.
.PP
-There are four other options applicable to
+There are five other options applicable to
.I cweave
only:
.B \-f
means do not force a newline after every statement in the formatted output.
+.B \-F
+means do not force a compound statement to start on a new line in the
+formatted output.
.B \-e
inhibits the enclosure of C\ material formatted by
.I cweave
diff --git a/web/c_cpp/cweb/cwebacromac.tex b/web/c_cpp/cweb/cwebacromac.tex
index 4c12e41382..3e8baad77c 100644
--- a/web/c_cpp/cweb/cwebacromac.tex
+++ b/web/c_cpp/cweb/cwebacromac.tex
@@ -1,6 +1,8 @@
% hypertext macros for CWEB listings (in addition to cwebmac.tex)
-% Version 1.1 --- September 2023
+% Used in cwebmac.tex, pdfctwimac.tex, pdfproofmac.tex
+% Version 3.0 --- August 2024
\ifx\ifacrohint\undefined\endinput\fi % these are not standalone macros
+
\ifluatex % LuaTeX is almost like pdfTeX
\protected\def\pdfliteral {\pdfextension literal}
\protected\def\pdfstartlink {\pdfextension startlink\space}
@@ -15,19 +17,76 @@
\let\pdfoutput=\outputmode
\fi % end of LuaTeX->pdfTeX redirection macros
+\def\tocpages{1} % Most programs have one-page Table-of-Contents
+\def\startpdf{\def\pagemode{/PageMode /UseOutlines}
+ \ifnum\contentspagenumber=0 \advance \pageno by -\tocpages
+ \def\pagelabels{/PageLabels << /Nums [ 0 << /S/D/St \tocpages >>
+ \the\pageno << /P(Contents) >> ] >>}
+ \else \twodigits=\pageno \pageno=\contentspagenumber
+ \advance \pageno by \tocpages \advance \twodigits by -\pageno
+ \def\pagelabels{/PageLabels << /Nums [ 0 << /S/D/St \the\pageno >>
+ \the\twodigits << /S/D/St \contentspagenumber >> ] >>}
+ \fi
+ \ifpdflua\pdfcatalog{\pagemode\space\pagelabels}
+ \else\special{pdf: docview << \pagemode\space\pagelabels >>}\fi}
+\ifacrohint\def\digits{\pdflink{\the\countA}\scan}
+\else\def\digits{{\the\countA}\scan}\fi
+\def\scan#1{\begingroup
+ \ifx!#1% exit on exclamation point
+ \else\ifx,#1,\space\aftergroup\scan % insert ,\space}\scan ...
+ \else\ifx\[#1\aftergroup#1% insert }\[...
+ \else\ifx\*#1\aftergroup\lapstar\aftergroup\scan % insert }\lapstar\scan ...
+ \else\ifnum`#1>`9#1\aftergroup\scan % insert #1}\scan ...
+ \else\ifnum`#1<`0#1\aftergroup\scan % insert #1}\scan ...
+ \else
+ \afterassignment\digits \aftergroup\countA
+ \aftergroup#1% insert }\countA=#1...\digits ...
+ \fi\fi\fi\fi\fi \fi
+ \endgroup}
+
+% Local variables; there are a few externals like '\toksA' and '\countA'
+\newtoks\toksB \newtoks\toksC \newtoks\toksD \newtoks\toksF \newtoks\sanitizer
+\newif\iftokprocessed \newif\ifTnum \newif\ifinstr \newif\ifhavenum
+
+\ifacrohint % Common macros for \ifacro and \ifhint to create \pdflink's
+\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA}
+\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}%
+ \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\let\space\empty
+ \toksC={}\toksD={}}\makenote}\maketoks}}
+\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
+\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}%
+ \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi}
+\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|%
+ \let\next=\maketoks % continue processing by default
+ \ifnum\countB>`9 \countB=0 \fi
+ \ifnum\countB<`0
+ \ifhavenum\makenote\fi
+ \ifx\first.\let\next=\maketoksdone % fullstop
+ \else \addtokens\toksB{\the\toksD} \ifx\first,\addtokens\toksB{\space}\fi
+ \fi
+ \else \addtokens\toksC{\the\toksD}\global\havenumtrue
+ \fi
+ \next
+}
+\def\makenote{\addtokens\toksB
+ {\noexpand\pdflink{\the\toksC}}\toksC={}\global\havenumfalse}
+\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
+\fi % End of common pdf/hint macros
+
\ifacro % The following are general pdf macros
\def\thewidth{\the\wd0 \space}
\def\theheight{\the\ht\strutbox\space}
\def\thedepth{\the\dp\strutbox\space}
\ifpdflua
\ifx\pdfannotlink\undefined\let\pdfannotlink\pdfstartlink\fi% for pdfTeX 0.14
- \def\pdflink#1#2{\hbox{\pdfannotlink height \theheight depth \thedepth
+ \def\pdflink#1{\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}%
+\else\def\pdflink#1{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}%
\special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight
- depth \thedepth << /Type /Annot /Subtype /Link
- /Border [0 0 0] /A << /S /GoTo /D (#2) >> >>}\box0\relax}\fi
-\def\sanitizecommand#1#2{\addtokens\usersanitizer
+ depth \thedepth << /Type /Annot /Subtype /Link /Border [0 0 0]
+ /A << /S /GoTo /D (\romannumeral#1) >> >>}\box0\relax}
+\fi
+\def\sanitizecommand#1#2{\addtokens\sanitizer
{\noexpand\dosanitizecommand\noexpand#1{#2}}}
\def\dosanitizecommand#1#2{\ifx\nxt#1\addF{#2}\fi}
@@ -36,7 +95,8 @@
\catcode`\[=12 \catcode`\]=12 \catcode`\{=1 \catcode`\}=2
\catcode`\~=12 \def\tildechar{~} \catcode`\~=13
\catcode`\|=0 |catcode`|\=12 |def|bschar{\} |catcode`|\=0 \catcode`\|=12
-\def\makeoutlinetoks{\Tnumfalse\afterassignment\makeolproctok\let\nxt= }
+\def\makeoutlinetoks{\toksF={}\Tnumfalse
+ \afterassignment\makeolproctok\let\nxt= }
\def\makeolnexttok{\afterassignment\makeolproctok\let\nxt= }
\def\makeolgobbletok{\afterassignment\makeolnexttok\let\nxt= }
\def\addF#1{\addtokens\toksF{#1}\tokprocessedtrue}
@@ -51,7 +111,7 @@
\else\if\noexpand\nxt\relax % we have a control sequence; is it one we know?
\ifx\nxt~\addF\space
\else\ifx\nxt\onespace\addF\space
- \else\the\usersanitizer
+ \else\the\sanitizer
\iftokprocessed\else\makeolproctokctli
\iftokprocessed\else\makeolproctokctlii
\iftokprocessed\else\makeolproctokctliii % if not recognised, skip it
@@ -128,48 +188,19 @@
\fi\fi\fi\fi\fi
}
\def\outlinedone{\edef\outlinest{\global\noexpand\toksE={\the\toksF}}%
- \outlinest\let\outlinedone=\relax}
+ \outlinest\let\outlinedone=\relax\outlinedone}
\fi % End of pdf macros
\ifhint
-% The following uses HINT primitives to implement:
+% The following top level macros use HINT primitives to implement:
% \HINThome to mark the position of the home page
% \HINTlabel to attach a label to the top of a section
% \HINTlink to link a section number to the section label
% \HINTcontents to produce an 'outline' item
-% These are the top level HINT macros that are used in this file
-% No HINT primitives are used directly.
\def\HINThome{\HINTdest name {HINT.home}%
\HINToutline goto name {HINT.home} depth 1 {Table of Contents}}
\def\HINTlabel{{\let\*=\empty\HINTdest num \secstar top}}
-\def\HINTlink#1#2{\HINTstartlink goto num #1 {#1}\HINTendlink}% #2 not used ???
+\def\HINTlink#1{\HINTstartlink goto num #1 {#1}\HINTendlink}
\def\HINTcontents#1#2#3{\HINToutline goto num #3 depth #2 {#1}}
\let\pdflink=\HINTlink
\fi % End of HINT macros
-
-% Common macros for \ifacro and \ifhint
-\ifacrohint
-\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA}
-\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}%
- \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\toksD={}
- \toksC={}\let\space\empty}\makenote}\maketoks}}
-\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
-\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}%
- \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi\toksA={#2}}
-\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|%
- \ifnum\countB>`9 \countB=0 \fi
- \ifnum\countB<`0
- \ifnum0=\countC\else\makenote\fi
- \ifx\first.\let\next=\maketoksdone\else
- \let\next=\maketoks
- \addtokens\toksB{\the\toksD}
- \ifx\first,\addtokens\toksB{\space}\fi
- \fi
- \else \addtokens\toksC{\the\toksD}\global\countC=1\let\next=\maketoks
- \fi
- \next
-}
-\def\makenote{\addtokens\toksB
- {\noexpand\pdflink{\the\toksC}{\romannumeral\the\toksC}}\toksC={}\global\countC=0}
-\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
-\fi % End of common macros
diff --git a/web/c_cpp/cweb/cwebmac.tex b/web/c_cpp/cweb/cwebmac.tex
index e079a80ef5..a46dc4b782 100644
--- a/web/c_cpp/cweb/cwebmac.tex
+++ b/web/c_cpp/cweb/cwebmac.tex
@@ -1,26 +1,14 @@
% standard macros for CWEB listings (in addition to plain.tex)
-% Version 4.11 --- October 2023
+% Version 4.12 --- August 2024
\ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros
-\xdef\fmtversion{\fmtversion+CWEB4.11}
-\chardef\cwebversion=4 \chardef\cwebrevision=11
-
-\let\:=\. % preserve a way to get the dot accent
- % (all other accents will still work as usual)
+\xdef\fmtversion{\fmtversion+CWEB4.12}
+\chardef\cwebversion=4 \chardef\cwebrevision=12
\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
@@ -98,7 +97,7 @@
\def\2{\global\advance\ind by-1} % indent one less notch
\def\3#1{\hfil\penalty#10\hfilneg} % optional break within a statement
\def\4{\copy\bak} % backspace one notch
-\def\5{\hfil\penalty-1\hfilneg\kern2.5em\copy\bakk\ignorespaces}% optional break
+\def\5{\hfil\penalty-1\hfilneg\kern2.4em\copy\bakk\ignorespaces}% optional break
\def\6{\ifmmode\else\par % forced break
\hangindent\ind em\noindent\kern\ind em\copy\bakk\ignorespaces\fi}
\def\7{\Y\6} % forced break and a little extra space
@@ -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,7 +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
+\input cwebacromac % 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
@@ -159,6 +154,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 +183,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
@@ -215,8 +212,8 @@
\def\T#1{\leavevmode % octal, hex or decimal constant
\hbox{$\def\?{\kern.2em}%$%
\let\ \, % C++ digit separator becomes a little white space
-% \def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant % versions < 3.67
- \def\$##1{\egroup_{\rm##1}\bgroup}% suffix to constant % in version 3.67
+% \def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant %$% versions < 3.67
+ \def\$##1{\egroup_{\rm##1}\bgroup}% suffix to constant %$% in version 3.67
\def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick)
\let\~=\oct \let\^=\hex \let\\=\bin {#1}$}}%$%
\def\U{\note{This code is used in section}} % xref for use of a section
@@ -240,9 +237,8 @@
\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
@@ -276,8 +272,6 @@
\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{\ifpdf \ifpdflua\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{}
@@ -319,9 +313,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
@@ -330,9 +322,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
@@ -355,23 +347,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
@@ -383,12 +373,12 @@
% \ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers
\rightskip 0pt \hyphenpenalty 50 \tolerance 200
\setpage \output={\normaloutput\page\lheader\rheader}
- \titletrue % prepare to output the table of contents
+ \ifpdf\startpdf\fi \titletrue % prepare to output the table of contents
\pageno=\contentspagenumber
\def\grouptitle{TABLE OF CONTENTS}
\message{Table of contents:}
\ifhint\HINThome\fi% Mark the Table of contents as home page
- \topofcontents \startpdf
+ \topofcontents
\line{\hfil Section\ifhint\else\hbox to3em{\hss Page}\fi}% No Page in HINT
\let\ZZ=\contentsline
\readcontents\relax % read the contents info
@@ -397,9 +387,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 (@*)
diff --git a/web/c_cpp/cweb/cwebman.pdf b/web/c_cpp/cweb/cwebman.pdf
index 8201815b56..c76368ec76 100644
--- a/web/c_cpp/cweb/cwebman.pdf
+++ b/web/c_cpp/cweb/cwebman.pdf
Binary files differ
diff --git a/web/c_cpp/cweb/cwebman.tex b/web/c_cpp/cweb/cwebman.tex
index 7a906cc954..25654a5317 100644
--- a/web/c_cpp/cweb/cwebman.tex
+++ b/web/c_cpp/cweb/cwebman.tex
@@ -7,13 +7,9 @@
\parskip 0pt plus 1pt
\def\RA{\char'31 } % right arrow
\def\hang{\hangindent 4em\ignorespaces}
-\font\eightrm=cmr8
-\font\ninerm=cmr9
-\font\ninett=cmtt9
\font\eighttt=cmtt8
+\font\ninett=cmtt9
\font\twelvett=cmtt12
-\font\quoterm=cmssq8
-\font\quoteit=cmssqi8
\font\authorfont=cmr12
\font\sectionfont=cmbx12
@@ -35,7 +31,7 @@
\def\lheader{\mainfont\the\pageno\hfill\sc\runninghead\hfill}
\def\rheader{\hfill\sc\runninghead\hfill\mainfont\the\pageno}
-\def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 4.11)}
+\def\runninghead{{\ninett CWEB} USER MANUAL (VERSION 4.12)}
% This verbatim mode assumes that ! marks are !! in the text being copied.
\def\verbatim{\begingroup
@@ -49,7 +45,7 @@
\null\vfill
\centerline{\titlefont The {\ttitlefont CWEB} System of
Structured Documentation}
-\vskip 18pt\centerline{(Version 4.11 --- December 2023)}
+\vskip 18pt\centerline{(Version 4.12 --- August 2024)}
\vskip 24pt
\centerline{\authorfont Donald E. Knuth and Silvio Levy}
\vfill
@@ -1048,6 +1044,10 @@ brackets \.{\\PB\{...\}}, so that special hooks can be used.
by \.{CWEAVE}. (On by default; \.{-f} saves paper but looks less \CEE/-like
to some people.) (Has no effect on \.{CTANGLE}.)
+\option F Force the first statement in a `compound statement' (a.k.a.\
+`block') on a line of its own. (On by default; some people prefer the
+\.{-F} layout.) (Has no effect on \.{CTANGLE}.)
+
\option h Print a happy message at the conclusion of a successful
run. (On by default.)
@@ -1193,7 +1193,7 @@ appendices D, E, and~F, which exhibit the complete source code for
\vfil\eject\titletrue
-\def\runninghead{APPENDIX A --- {\tentt CWEB} FILE FORMAT}
+\def\runninghead{APPENDIX A --- {\ninett CWEB} FILE FORMAT}
\section Appendix A: Excerpts from a \.{CWEB} Program.
This appendix consists
@@ -1267,9 +1267,9 @@ change_limit=change_buffer+(ptrdiff_t)(limit-buffer);
strncpy(change_buffer,buffer,(size_t)(limit-buffer+1));
!endgroup
\endgroup
-\vfill\eject
+\vfil\eject
-\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CTANGLE}}
+\def\runninghead{APPENDIX A --- TRANSLATION BY {\ninett CTANGLE}}
Here's the portion of the \CEE/ code generated by \.{CTANGLE} that corresponds
to the source on the preceding page. Notice that sections~29, 30 and~31
@@ -1335,9 +1335,9 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1));
#line 296 "common.w"
!endgroup
\endgroup
-\vfill\eject
+\vfil\eject
-\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CWEAVE}}
+\def\runninghead{APPENDIX A --- TRANSLATION BY {\ninett CWEAVE}}
Here is the corresponding excerpt from \.{common.tex}.
\ifhint\relax\else(Code for section 31 is omitted for space reasons.)\fi
@@ -1527,14 +1527,14 @@ features needed by the output of \.{CWEAVE}.
\printmacs{\empty}
\vskip6pt \baselineskip12pt
-\noindent And here comes the file that extends \.{cwebmac.tex} in order to
-support the ``hypertext'' features needed by the enhanced \TEX/ engines when
-processing the output of \.{CWEAVE}.
+\noindent And here comes the file \.{cwebacromac.tex} that extends
+\.{cwebmac.tex} in order to support the ``hypertext'' features needed
+by the enhanced \TEX/ engines when processing the output of \.{CWEAVE}.
\vskip6pt \baselineskip9pt
\printmacs{acro}
\endgroup
-\vfill\eject
+\vfil\eject\titletrue
\def\runninghead{APPENDIX C --- NOTES ON FORMATTING}
\section Appendix C: How to use \.{CWEB} macros.
@@ -1610,7 +1610,7 @@ $$\lpile{\.{\\def\\topofcontents\{\\null\\vfill}\cr
\.{ { }\\titlefalse \% include headline on the contents page}\cr
\.{ { }\\def\\rheader\{\\mainfont The \{\\tt CWEAVE\}{ }processor\\hfil\}}\cr
\.{ { }\\centerline\{\\titlefont The \{\\ttitlefont CWEAVE\}{ }processor\}}\cr
- \.{ { }\\vskip 15pt \\centerline\{(Version 4.11)\}{ }\\vfill\}}\cr}$$
+ \.{ { }\\vskip 15pt \\centerline\{(Version 4.12)\}{ }\\vfill\}}\cr}$$
Redefining \.{\\rheader}, which is the headline for right-hand pages,
suffices in this case to put the desired information at the top of the
contents page.
@@ -1788,6 +1788,4 @@ running headline `{\eightrm CHINESE FOO}' and table-of-contents entry
`Chinese foo'. The corresponding bookmark is, however, `\.{Chinese} \.{bar}'.
And the corresponding \.{.toc} file entry is
`\.{\\ZZ \{Chinese \\klujj bar\\\\\}\{1\}\{1\}\{1\}\{Chinese bar\}}'.
-
-\vfill\end
-
+\bye
diff --git a/web/c_cpp/cweb/prod.w b/web/c_cpp/cweb/prod.w
index 711d6477e7..851c5ffe23 100644
--- a/web/c_cpp/cweb/prod.w
+++ b/web/c_cpp/cweb/prod.w
@@ -2,7 +2,7 @@
% This program by Silvio Levy and Donald E. Knuth
% is based on a program by Knuth.
% It is distributed WITHOUT ANY WARRANTY, express or implied.
-% Version 4.11 --- December 2023
+% Version 4.12 --- August 2024
%
@ Here is a table of all the productions. Each production that
combines two or more consecutive scraps implicitly inserts a {\tt \$}
@@ -154,7 +154,7 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for
\hfill $F\,|big_force|\,$\altt $S$ $D$ $F$ \unskip & outer block\cr
\+& |lbrace| |rbrace| & |stmt| \hfill $L\.{\\,}R$ & empty statement\cr
\advance\midcol35pt
-\+& |lbrace| \altt|stmt| |decl| |function| |rbrace| & |stmt| \hfill
+\+\dagit& |lbrace| \altt|stmt| |decl| |function| |rbrace| & |stmt| \hfill
$|force|\,L\,\\{in}\,|force|\,S\,
|force|\,\\{back}\,R\,\\{out}\,|force|$ & compound statement\cr
\advance\midcol-20pt
@@ -185,7 +185,7 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for
\+& |if_head| \alt|stmt| |exp| & |else_head| \alt|stmt| |exp|
& $\!\!$ \&{if} ($x$) ${}\{\,y\,\}{}$\cr
\advance\midcol20pt
-\+& |do_like| |stmt| |else_like| |semi| & |stmt| \hfill
+\+\dagit& |do_like| |stmt| |else_like| |semi| & |stmt| \hfill
$D\,\\{bsp}\,|noop|\,|cancel|\,S\,|cancel|\,|noop|\,\\{bsp}\,ES$%
& \&{do} $f$($x$); \&{while} ($g$($x$));\cr
\advance\midcol-20pt
@@ -334,6 +334,11 @@ Rules 35, 117: The |exp| must not be immediately followed by |lpar|, |lbrack|,
Rule 48: The |exp| or |int_like| must not be immediately followed by |base|.
+Rule 55: The second |force| becomes \\{bsp} if \.{CWEAVE} has been invoked
+with the \.{-F} option.
+
+Rule 69: The $|do|\ldots|while|$ loop is wrapped in |force| if \.{CWEAVE} is invoked with the \.{-f} option.
+
Rule 76: The |force| in the |stmt| line becomes \\{bsp} if \.{CWEAVE} has
been invoked with the \.{-f} option.
diff --git a/web/pwebmac/README.md b/web/pwebmac/README.md
index f2554f6fb9..8d0c1d1667 100644
--- a/web/pwebmac/README.md
+++ b/web/pwebmac/README.md
@@ -38,4 +38,4 @@ file), and `hitex` creates HINT output that can be viewed with the
The `pwebmac` package is free software and may be used without constraints.
-This is version **4.12** of the `pwebmac` package — 2024-05-24, Andreas Scherer.
+This is version **5.0** of the `pwebmac` package — 2024-08-12, Andreas Scherer.
diff --git a/web/pwebmac/editorsnote.tex b/web/pwebmac/editorsnote.tex
new file mode 100644
index 0000000000..06c21010d9
--- /dev/null
+++ b/web/pwebmac/editorsnote.tex
@@ -0,0 +1,22 @@
+\font\ninett=cmtt9
+
+\def\editorsnote{\noindent Editor's Note: The present variant of
+ this {\ninett C/WEB} source file has been modified for use in
+ the \TeX~Live system.}
+
+\def\changedsections{\jobname.chs}
+\def\readchanges{\input \changedsections}
+\newread\testread \newwrite\writechanges
+\openin\testread=\changedsections\relax
+\ifeof\testread % First run
+ \let\readchanges=\relax
+ \let\CH=\ch
+ \def\ch#1.{\begingroup
+ \let\\=\BS \let\*=\let \let\ch=\relax
+ \immediate\openout\writechanges=\changedsections
+ \immediate\write\writechanges{\par\noindent\ch#1.}
+ \immediate\closeout\writechanges
+ \let\ch=\CH \ch#1.
+ \endgroup}
+\else\closein\testread % Second run
+\fi
diff --git a/web/pwebmac/index.md b/web/pwebmac/index.md
index 711e0c2ba9..870b524af0 100644
--- a/web/pwebmac/index.md
+++ b/web/pwebmac/index.md
@@ -61,7 +61,9 @@ directly.
[`WEBMAN`](web/webman.pdf) \|
[`WEAVE`](web/weave.pdf)+[`chg`](web/weave-changes.pdf) \|
[`TANGLE`](web/tangle.pdf)+[`chg`](web/tangle-changes.pdf) \|
- [`TWILL`](web/twill.pdf) \]
+ [`TWILL`](web/twill.pdf)[^1] \]
+
+[^1]: `TWILL` is presented here as a changed variant of `WEAVE`.
## Complementary WEB programs by other authors
@@ -81,13 +83,20 @@ directly.
[`COMMON`](cweb/common.pdf)+[`chg`](cweb/common-changes.pdf) \|
[`CTANGLE`](cweb/ctangle.pdf)+[`chg`](cweb/ctangle-changes.pdf) \|
[`CWEAVE`](cweb/cweave.pdf)+[`chg`](cweb/cweave-changes.pdf) \|\
- [`CTWILL`](cweb/ctwill.pdf) \|
+ [`CTWILL`](cweb/ctwill.pdf)[^2] \|
[`REFSORT`](cweb/refsort.pdf)+[`chg`](cweb/refsort-changes.pdf) \|
[`TWINX`](cweb/twinx.pdf)+[`chg`](cweb/twinx-changes.pdf) \]
* `ctie/` \[ [`CTIE`](ctie/ctie.pdf)+[`chg`](ctie/ctie-changes.pdf) \]
* `tie/` \[ [`TIE`](tie/tie.pdf)+[`chg`](tie/tie-changes.pdf) \]
* `hitex/` \[ [`HiTeX`](hitex/hitex.pdf) \]
-* `mp/` \[ [`MetaPost`](mp/mp.pdf) \]
+* `mp/` \[ [`MP`](mp/mp.pdf) \| [`MPOST`](mp/mpost.pdf) \][^3]
+
+[^2]: `CTWILL` is presented here in its own format with “mini-indexes” for
+ every two consecutive pages.
+
+[^3]: `MP` and `MPOST` have received quite a few changes “behind the scenes” in
+ order to present them in this collection; see project
+ [`mplibdir`](https://github.com/ascherer/mplibdir) for details.
## Errata for “Computers & Typesetting” by Donald E.\ Knuth
@@ -109,4 +118,4 @@ directly.
## Happy C/WEB Programming!
-2024-05-20 Andreas Scherer
+2024-08-11 Andreas Scherer
diff --git a/web/pwebmac/makeall b/web/pwebmac/makeall
index 6be5b6e91a..0b42f35ee8 100755
--- a/web/pwebmac/makeall
+++ b/web/pwebmac/makeall
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -e
PROG=$(basename $0)
@@ -11,7 +11,7 @@ Test driver for 'pwebmac.tex' in combination with various TeX engines.
Produce TeX output in DVI, PDF or HINT format from a set of C/WEB programs
included in the 'TeX Live' source tree.
-Options are (--long options only with GNU getopt):
+Options are (--long options only with Linux-getopt):
-c, --changes Apply change file to C/WEB source
-f, --files STRING Process only subset of C/WEB programs
-h, --help Print this help message and exit
@@ -28,7 +28,7 @@ HELP
LONGOPTS=changes,files:,help,new,outdir:,pdftocfront,tex:,validpdf
SHRTOPTS=cf:hno:pt:v
-CHANGES=false # apply changefile to C/WEB source
+CHANGES= # apply changefile to C/WEB source
FILESELECT=false # user-defined '--files' selection
NEW=false # '\input pwebmac' instead of '\input webmac' for PDF et al.
OUTDIR=. # path where the resulting tarballs are placed
@@ -36,6 +36,9 @@ PDFTOCFRONT=false # push table-of-contents to front of PDF output
TEX=tex # or 'pdftex' or 'xetex' or 'hitex' or 'luatex'
VALID=false # give 'pdftex' a chance to produce valid output
+# Extra material -- unpublished
+LOCALSTUFF=/opt/github/web
+
# Initial list of C/WEB sources to process, overridable with option '-f':
KNUTHWHERE=$(locate /bibtex.web)
if [ -z "$KNUTHWHERE" ]
@@ -46,7 +49,8 @@ KNUTHWARE=$(dirname $KNUTHWHERE)
FILES="$KNUTHWARE/*.web pdftex.web xetex.web twill"
WEBINPUTS=$KNUTHWARE//:
-FILES="$FILES common ctangle cweave ctwill refsort twinx ctie tie hitex mp"
+FILES="$FILES common ctangle cweave ctwill refsort twinx ctie tie hitex \
+ mp mpost mpmath mpmathbinary mpmathdecimal mpmathdouble mpstrings tfmin"
CWEBINPUTS=$KNUTHWARE//:
KNUTHWHERE=$(locate /glue.web)
@@ -58,7 +62,7 @@ fi
export WEBINPUTS CWEBINPUTS
-getopt -T >/dev/null
+getopt -T >/dev/null && true # keep going
if [ $? -eq 4 ] # Check for Linux-getopt with extensions
then OPTS=$(getopt -n $PROG -o $SHRTOPTS -l $LONGOPTS -- "$@")
@@ -73,7 +77,7 @@ fi
while true
do
case "$1" in
- -c | --changes ) CHANGES=true; shift ;;
+ -c | --changes ) CHANGES="-changes"; shift ;;
-f | --files ) FILES="$2"; FILESELECT=true; shift 2 ;;
-h | --help ) usage; exit 0 ;;
-n | --new ) NEW=true; shift ;;
@@ -106,50 +110,51 @@ case "$TEX" in
pdftex | luatex ) # actually only necessary for 'pwebmac.tex'
VALID=true ;;
- tex ) # plain TeX
- XETEX="$XETEX --no-pdf" # XeTeX's extended DVI format
+ * ) # plain TeX and XeTeX use different approaches
+ [ tex = "$TEX" ] && XETEX="$XETEX --no-pdf"
+ # XeTeX's extended DVI format
VALID=false ;;
-
- * ) VALID=false ;; # plain TeX and XeTeX use different approach
esac
# Valid PDF output from 'pdftex' and 'luatex': In 'pwebmac.tex' set '\countD'
# to the actual number of @<named modules@>, not the number of all sections.
-if $VALID
+if $VALID && { [ pdftex = "$TEX" ] || [ luatex = "$TEX" ]; }
then
NEW=true # PDF output requires 'pwebmac.tex'
TEX="$TEX --shell-escape"
fi
# Use alternative TeX macros more suited for PDF output.
-if $NEW
-then WEAVE="$WEAVE -p"
-fi
+[ -n "$CHANGES" ] && NEW=true
+$NEW && WEAVE="$WEAVE -p"
-# WEB and CWEB programs we want to get formatted
+# Loop over WEB and CWEB programs we want to get formatted
for f in $FILES
do
f=$(basename $f .web)
case $f in
pdftex ) # Fix several 'Overfull \hbox'es
- tie -m $f.web $f.web /opt/github/web/$f.ch ;;
+ tie -m $f.web $f.web $LOCALSTUFF/$f.ch ;;
- hitex | mp ) # Beautifications for 'hitex.w' and 'mp.w'
- tie -m $f.w $f.w /opt/github/web/$f.ch ;;
+ mp | mpost | mpmath* | mpstrings | tfmin )
+ # Beautifications for MetaPost
+ tie -m $f.w $f.w $LOCALSTUFF/$f.ch ;;
weave | twill )
- cp $KNUTHWARE/weave.web .
if [ "$HITEX" = "$TEX" ] # Fix non-constant factor
- then $SED_I -e "s/\\\\the\\\\hsize/460pt/" weave.web
+ then
+ cp $KNUTHWARE/weave.web .
+ $SED_I weave.web -e 's/\\the\\hsize/460pt/'
fi ;;
esac
- if $CHANGES
+ if [ -n "$CHANGES" ]
then
case $f in
# These are changes in and of themselves
- ctwill | twill | glue | hitex | mp ) continue ;;
+ ctwill | twill | glue | hitex | mp | mpost | \
+ mpmath* | mpstrings | tfmin ) continue ;;
# CWEB programs have individual changefiles
common ) $CWEAVE $f comm-w2c ;;
@@ -162,93 +167,82 @@ do
# main WEB programs have complex change files
tex | mf | pdftex | xetex )
WEBINPUTS=.:$KNUTHWARE/../../Work//:$WEBINPUTS: \
- $WEAVE $f $f-final
-
- # FIX: XeTeX uses '\pdfTeX' from section 114,
- # which is not changed and thus 'disappears';
- # repeat in preamble.
- if [ xetex = $f ]
- then $SED_I -e "s/\(\\\\let\\\\maybe\)/\\\\def\\\\pdfTeX{pdf\\\\TeX}\n\1/" $f.tex
- fi ;;
+ $WEAVE $f $f-final ;;
# all other WEB codes have singular changefiles
* ) $WEAVE $f $f ;;
esac
# only document changed modules/sections
- $SED_I -e "s/\(\\\\let\\\\maybe=\)\\\\iftrue/\1\\\\iffalse/" \
- $f.tex
- else
+ $SED_I $f.tex -e '/\\let\\maybe/s/\\iftrue/\\iffalse/'
+ else # -z $CHANGES
case $f in
- ctwill )
- # apply tons of editorial changes to 'ctwill.w'
- if [ "$HITEX" = "$TEX" ]
- then ctie -m $f.w cweave.w $f-w2c.ch $f-hint.ch
- else ctie -m $f.w cweave.w $f-w2c.ch $f-mini.ch
- fi
+ ctwill ) # apply tons of editorial changes to 'ctwill.w'
+ [ "$HITEX" = "$TEX" ] &&
+ ctie -m $f.w cweave.w $f-w2c.ch $f-hint.ch ||
+ ctie -m $f.w cweave.w $f-w2c.ch $f-mini.ch
$CTWILL $f # prime the pump
$CTWILL $f ;; # get decent answers
c* | refsort | twinx | tie ) $CWEAVE $f ;;
+ hitex ) $CWEAVE $f || true ;; # lots of unused sections
- hitex | mp ) CWEBINPUTS=.: $CWEAVE $f ;;
+ mp | mpost | mpmath* | mpstrings | tfmin )
+ CWEBINPUTS=.: $CWEAVE $f ;;
- twill )
- WEBINPUTS=.:$WEBINPUTS \
- tie -m $f.web weave.web weave.ch weav-$f.ch
- WEBINPUTS=.: $WEAVE $f ;;
+ twill ) WEBINPUTS=.:$WEBINPUTS \
+ tie -c $f.ch weave.web weave.ch weav-$f.ch
+ WEBINPUTS=.:$WEBINPUTS $WEAVE weave $f $f ;;
- pdftex | weave ) WEBINPUTS=.: $WEAVE $f ;;
+ pdftex | weave ) WEBINPUTS=.:$WEBINPUTS $WEAVE $f ;;
* ) $WEAVE $f ;;
esac
- fi
+ fi # $CHANGES
# 'pwebmac' is for WEB only; do nothing for CWEB programs
- if $NEW && echo $f | grep -v -q -E '^c|refsort|twinx|tie|hitex|mp'
+ if $NEW && echo $f | grep -v -q -E \
+ '^c|refsort|twinx|tie|hitex|^mp|tfmin'
then
# timestamp on table-of-contents page or the first page
case $f in
bibtex | patgen | tangle | weave | twill )
- $SED_I -e "s/\(\\\\def\\\\title\)/\\\\datecontentspage\n\1/" $f.tex ;;
+ $SED_I $f.tex -e 's/\\def\\title{/\\datecontentspage\n&/' ;; # }
mf | tex | pdftex | xetex )
- $SED_I -e "s/\(\\\\def\\\\topofcontents\)/\\\\datethis\n\\\\emergencystretch=.1\\\\hsize\n\1/" $f.tex
-
# amend '\N' redefinition for PDF outlines in
# Metafont and TeX (also pdfTeX and XeTeX)
# 'pwebmac' defines headers differently
- $SED_I -e "s/\(\\\\outer\\\\def\\\\N.*{\)/\1%/" \
- -e "s/\\\\def\\\\rhead\(.*}\)/\\\\gtitle=\1\\\\MN#1.\\\\vfill\\\\eject/" \
- $f.tex
-
+ cat > texmf-pdf.sed << 'FI'
+s/\\outer\\def\\N.*{/&%/
+s/\\def\\rhead\({.*}\)/\\gtitle=\1\\MN#1.\\vfill\\eject/
+s/\\def\\title{/\\datethis\n\\emergencystretch=.1\\hsize\n&/
+FI
# active links in PDF outlines/bookmarks
- cat > texmf-pdf.patch << FI
- \ifpdf{\toksF={}\makeoutlinetoks{[#2] #3}\outlinedone\outlinedone}\fi
+ cat > texmf-pdf.patch1 << FI
+ \ifpdf{\makeoutlinetoks{[#2] #3}\outlinedone}\fi
FI
- $SED_I -e "/\\\\outer\\\\def\\\\N/ {
- r texmf-pdf.patch
- }" $f.tex
-
- $SED_I -e "s/{\\\\the\\\\pageno}}}\\\\next/{\\\\the\\\\pageno}{\\\\the\\\\toksE}}}\\\\next/" $f.tex
-
- cat > texmf-pdf.patch << FI
+ cat >> texmf-pdf.sed << 'FI'
+/\\outer\\def\\N/r texmf-pdf.patch1
+s/{\\the\\pageno}/&{\\the\\toksE}/
+FI
+ cat > texmf-pdf.patch2 << FI
\ifpdflua\relax\else
\ifpdf\special{pdf: outline 0 << /Title (\the\toksE) /Dest
[ @thispage /FitH @ypos ] >>}\fi\fi
FI
- $SED_I -e "/ \\\\edef\\\\next/ {
- r texmf-pdf.patch
- }" $f.tex
- rm texmf-pdf.patch ;;
-
- * ) $SED_I -e "s/\(\\\\def\\\\botofcontents\)/%\1/" \
- -e "s/ \\\\centerline{\(\\\\hsize\)/\\\\def\\\\covernote{\1/" \
- -e "s/\(Publishing Company.}}\)}/\1\n\\\\datecontentspage/" \
- -e "s/\(trademark of the American Mathematical Society.}}\)}/\1\n\\\\datecontentspage/" \
- $f.tex ;;
+ cat >> texmf-pdf.sed << 'FI'
+/\\edef\\next/r texmf-pdf.patch2
+FI
+ $SED_I $f.tex -f texmf-pdf.sed
+ rm -f texmf-pdf.* ;;
+
+ * ) $SED_I $f.tex -e '/\\def\\botofcontents/d' \
+ -e 's/ \\centerline{\(\\hsize\)/\\def\\covernote{\1/' \
+ -e 's/\(Publishing Company.}}\)}/\1\n\\datecontentspage/' \
+ -e 's/\(Mathematical Society.}}\)}/\1\n\\datecontentspage/' ;;
esac
- fi
+ fi # $NEW
# special treatment for individual C/WEB programs
case $f in
@@ -258,56 +252,92 @@ FI
# 'E' no longer free to be active character
# fix table-of-contents page for bibtex
# FIX: don't wait for Oren Patashnik.
- bibtex ) $SED_I -e "s/\\\\def\\\\titlepage{F}/\\\\titletrue/" $f.tex
- if ! $CHANGES
- then $SED_I -e "71,78d" $f.tex
- fi ;;
+ bibtex ) $SED_I $f.tex -e 's/\\def\\titlepage{F}/\\titletrue/'
+ [ -z "$CHANGES" ] && $SED_I $f.tex -e "71,78d" ;;
+
+ # FIX: GFtoDVI uses 'Metafont' in a module name;
+ # this should appear correctly in the bookmarks, too.
+ gftodvi ) $NEW && $SED_I $f.tex \
+ -e 's/\\def\\(/\\ifpdf\\sanitizecommand\\MF{Metafont}\\fi\n\n&/' ;; # )
# FIX: 'glue.web' obviously uses an old 'webmac.tex'.
- glue ) $SED_I -e "s/\(\\\\def\\\\title{GLUE}\)/\1\n\\\\pageno=\\\\contentspagenumber \\\\advance\\\\pageno by1\\\\relax/" \
- -e "s/titlefalse/titletrue/" $f.tex ;;
+ glue ) $SED_I $f.tex -e 's/titlefalse/titletrue/' \
+ -e 's/\\def\\title{GLUE}/&\n\\pageno=\\contentspagenumber \\advance\\pageno by1\\relax/' ;;
+
+ # FIX: Metafont uses '\over' in several module names;
+ # this should appear correctly in the bookmarks, too.
+ mf ) $NEW && $SED_I $f.tex \
+ -e 's/\\def\\(/\\ifpdf\n\\sanitizecommand\\MF{Metafont}\n\\sanitizecommand\\over{\/}\n\\sanitizecommand\\langle{<}\n\\sanitizecommand\\rangle{>}\n\\fi\n\n&/' ;; # )
+
+ # FIX: MFT uses '\pb' in several module names;
+ # this should appear correctly in the bookmarks, too.
+ mft ) $NEW && $SED_I $f.tex \
+ -e 's/\\def\\pb.*/&\n\\ifpdf\\sanitizecommand\\pb{\|...\|}\\fi/' ;;
# FIX: pdfTeX uses '\pdfTeX' in section names; these should
# appear correctly in the bookmarks, too.
- pdftex )
- if $NEW && [ tex != "$TEX" ] && [ "$HITEX" != "$TEX" ]
- then $SED_I -e "s/\(\\\\def\\\\pdfTeX{pdf\\\\TeX}\)/\1 \\\\sanitizecommand\\\\pdfTeX{pdfTeX}\\\\sanitizecommand\\\\eTeX{e-TeX}/" $f.tex
- fi ;;
+ pdftex ) $NEW && $SED_I $f.tex \
+ -e 's/\\def\\pdfeTeX{pdf\\eTeX}/&\n\\ifpdf\n\\sanitizecommand\\pdfTeX{pdfTeX}\n\\sanitizecommand\\eTeX{e-TeX}\n\\sanitizecommand\\over{\/}\n\\fi/' ;;
# FIX: weave uses '\max' in name of module 173; this should
# appear correctly in the bookmarks, too.
- weave )
- if $NEW && [ tex != "$TEX" ] && [ "$HITEX" != "$TEX" ]
- then $SED_I -e "s/\(\\\\def\\\\({}\)/\\\\sanitizecommand\\\\max{max}\n\1/" $f.tex
- fi ;;
+ weave ) $NEW && $SED_I $f.tex \
+ -e 's/\\def\\({}/\\ifpdf\\sanitizecommand\\max{max}\\fi\n&/' ;; # )
# FIX: purge obsolete macros from XeTeX.
- xetex ) $SED_I -e "/\\\\input xewebmac/d" $f.tex ;;
+ # FIX: XeTeX uses '\pdfTeX' from section 114, which is not
+ # changed and thus 'disappears'; repeat in preamble.
+ # FIX: apply '\sanitizecommand' for bookmarks.
+ xetex ) $SED_I $f.tex -e '/\\input xewebmac/d' \
+ -e 's/\\let\\maybe/\\def\\pdfTeX{pdf\\TeX}\n&/'
+ $NEW && $SED_I $f.tex \
+ -e 's/\\def\\pdfTeX{pdf\\TeX}/&\n\\ifpdf\\sanitizecommand\\pdfTeX{pdfTeX}\\fi/' \
+ -e 's/\\def\\eTeX/\\ifpdf\n\\sanitizecommand\\eTeX{e-TeX}\n\\sanitizecommand\\over{\/}\n\\fi\n&/' ;;
# timestamp on table-of-contents page or the first page
- hitex | mp ) $SED_I -e "s/\(\\\\def\\\\topofcontents\)/\\\\datethis\n\\\\emergencystretch=.1\\\\hsize\n\1/" $f.tex ;;
+ hitex | mp ) $SED_I $f.tex -e 's/\\def\\topofcontents/\\datethis\n\\emergencystretch=.1\\hsize\n&/' ;;
+ common | ctangle | cweave | ctie | tie ) $SED_I $f.tex -e 's/\\def\\botofcontents/\\datethis\n&/' ;;
+ mpost | mpmath* | mpstrings | tfmin ) $SED_I $f.tex -e 's/\\def\\title{/\\datecontentspage\n\n&/' ;; # }
esac
# shift table-of-contents pages to the front in PDF
if $PDFTOCFRONT && echo $f | grep -v -q -E 'ctwill|hitex'
+ then $SED_I $f.tex \
+ -e '0,/\\N[1{]/s/\\N[1{]/\\input pdfwebtocfront\n\n&/'
+ fi # $PDFTOCFRONT
+
+ if [ -n "$CHANGES" ] || [ twill = "$f" ]
then
- $SED_I -e "0,/\\\\N[1{]/s/\(\\\\N[1{]\)/\\\\input pdfwebtocfront\n\n\1/" $f.tex
+ # We add an Editor's Note and the list of changed
+ # sections on the ToC page.
+ cp $LOCALSTUFF/editorsnote.tex .
- # only XeTeX can process XETEX.WEB
- if [ xetex = $f ]
- then $XETEX $f # run XeTeX twice
- else $TEX $f # run TeX twice
- fi
+ case $f in
+ mf ) $SED_I $f.tex -e 's/\\datethis/\\input editorsnote.tex\n\\def&{\\def\\startsection{\\leftline{\\sc\\today\\ at \\hours}\n \\medskip\\editorsnote\\readchanges\\bigskip\n \\let\\startsection=\\stsec\\stsec}}\n&/' ;;
- # run TEX.WEB three times to fix table-of-contents
- if [ tex = $f ]
- then $TEX $f
- fi
- fi
+ # TeX and XeTeX grow significantly for TeX Live
+ # so there's enough room on the last ToC page.
+ pdftex | tex | xetex ) $SED_I $f.tex \
+ -e '/\\datethis/d' \
+ -e 's/\(\\def\\botofcontents\).*/\\input editorsnote.tex\n\1{\\hsize6.5in\\vskip 0pt plus 1filll\n \\editorsnote\\readchanges\\medskip\\noindent\\sc\\today\\ at \\hours}/' \
+ -e 's/\\input pdfwebtocfront/&\n\n\\def\\tocpages{2}/' ;;
- case $f in
- xetex ) $XETEX $f ;; # only XeTeX can process XETEX.WEB
+ bibtex | patgen | tangle | weave | refsort | twinx ) $SED_I $f.tex -e 's/\\date.*/\\input editorsnote\n\\def\\covernote{\\vbox{\\editorsnote\\readchanges\\par}}\n\\datecontentspage/' ;;
+
+ common | ctangle | cweave | ctie | tie ) $SED_I $f.tex \
+ -e 's/\\def\\covernote/\\input editorsnote.tex\n&/' \
+ -e 's/^}}/\\bigskip\\editorsnote\\readchanges\\par&/' ;;
+
+ twill ) $SED_I $f.tex \
+ -e 's/\\datecontentspage/\\input editorsnote.tex\n\\def\\covernote{\\vbox{\\editorsnote\\readchanges\\par}}\n&/' ;;
+ * ) $SED_I $f.tex \
+ -e 's/\\def\\title{/\\input editorsnote.tex\n&/' \
+ -e 's/\\vbox{\\ninerm/&\\editorsnote\\readchanges\\medskip/' ;;
+ esac
+ fi # $CHANGES
+
+ case $f in
ctwill ) # gives two different outcomes
if [ "$HITEX" = "$TEX" ] # sort mini-indexes
then # directly in the TeX file
@@ -318,124 +348,98 @@ FI
fi
$TEX $f ;;
- refsort ) $TEX -interaction nonstopmode $f ;;
-
- * ) $TEX $f ;;
+ * ) # run TeX twice
+ if $PDFTOCFRONT || [ -n "$CHANGES" ]
+ then # only XeTeX can process XETEX.WEB
+ [ xetex = $f ] && $XETEX $f || $TEX $f
+ fi
+ [ xetex = $f ] && $XETEX $f || $TEX $f ;;
esac
done
+# create tarballs w/o changes for publication
if ( $PDFTOCFRONT || [ "$HITEX" = "$TEX" ] ) && ! $FILESELECT
then
- # create tarballs w/o changes for publication
- if $CHANGES
+ if [ -z "$CHANGES" ]
then
- for f in *.$PDF
- do
- case $f in *-changes.$PDF ) rm -f $f; continue ;;
- esac
- mv $f $(basename $f .$PDF)-changes.$PDF
+ export TEXINPUTS=.:$(kpsewhich --var-value=TEXMFDIST)//:$KNUTHWARE//
+ touch pages.tex # let 'manmac' produce output at all
+
+ $TEX -jobname=errorlog $LOCALSTUFF/Xerrorlog.tex
+ for f in one two three four five six seven eight nine ten \
+ eleven twelve
+ do $TEX -jobname errata.$f errata.$f
done
- if [ "$HITEX" = "$TEX" ]
- then
- rm -f xetex-changes.pdf
- mv xetex.pdf xetex-changes.pdf
- fi
- $PAX "$OUTDIR/etc-changes.tar.gz" -s ,^,etc/, \
- vftovp-changes.$PDF vptovf-changes.$PDF
- $PAX "$OUTDIR/mf-changes.tar.gz" -s ,^,mf/, \
- mf-changes.$PDF
- $PAX "$OUTDIR/mfware-changes.tar.gz" -s ,^,mfware/, \
- gftodvi-changes.$PDF gftopk-changes.$PDF \
- gftype-changes.$PDF mft-changes.$PDF
- $PAX "$OUTDIR/tex-changes.tar.gz" -s ,^,tex/, \
- tex-changes.$PDF
- $PAX "$OUTDIR/texware-changes.tar.gz" -s ,^,texware/, \
- dvitype-changes.$PDF pltotf-changes.$PDF \
- pooltype-changes.$PDF tftopl-changes.$PDF
- $PAX "$OUTDIR/web-changes.tar.gz" -s ,^,web/, \
- tangle-changes.$PDF weave-changes.$PDF
- $PAX "$OUTDIR/bibtex-changes.tar.gz" -s ,^,bibtex/, \
- bibtex-changes.$PDF
- $PAX "$OUTDIR/other-changes.tar.gz" -s ,^,other/, \
- dvicopy-changes.$PDF patgen-changes.$PDF \
- pktogf-changes.$PDF pktype-changes.$PDF
- $PAX "$OUTDIR/pdftex-changes.tar.gz" -s ,^,pdftex/, \
- pdftex-changes.$PDF
- $PAX "$OUTDIR/xetex-changes.tar.gz" -s ,^,xetex/, \
- xetex-changes.pdf
- $PAX "$OUTDIR/ctie-changes.tar.gz" -s ,^,ctie/, \
- ctie-changes.$PDF
- $PAX "$OUTDIR/tie-changes.tar.gz" -s ,^,tie/, \
- tie-changes.$PDF
- $PAX "$OUTDIR/cweb-changes.tar.gz" -s ,^,cweb/, \
- common-changes.$PDF ctangle-changes.$PDF \
- cweave-changes.$PDF refsort-changes.$PDF \
- twinx-changes.$PDF
- else
+ $TEX errata
+ $PAX "$OUTDIR/errata.tar.gz" -s ,^,errata/, err*.$PDF
+
+ $PAX "$OUTDIR/hitex.tar.gz" -s ,^,hitex/, hitex.$PDF
+ $PAX "$OUTDIR/mp.tar.gz" -s ,^,mp/, mp.$PDF mpost.$PDF
+
# Finally, build the remaining documents
# * TeX and Metafont test routines
# * WEB and CWEB manuals
- export TEXINPUTS=.:$(kpsewhich --var-value=TEXMFDIST)//:$KNUTHWARE//
-
rm -f trapman.tex webman.tex cwebman.tex
# FIX: Prepare 'trapman' for automatic processing; several
# input files are renamed in TeX Live (in fact, there are
# additional files for MetaPost).
- f=$(kpsewhich -engine tex trapman)
- tie -m $(basename $f) $f /opt/github/web/$(basename $f .tex).ch
-
# Prepare 'webman' with section links and bookmarks.
- f=$(kpsewhich -engine tex webman)
- tie -m $(basename $f) $f /opt/github/web/$(basename $f .tex).ch
+ for f in trapman webman
+ do
+ f=$(kpsewhich -engine tex $f)
+ tie -m $(basename $f) $f $LOCALSTUFF/$(basename $f .tex).ch
+ done
# Prepare 'cwebman' with footnotes describing the extended CWEB.
f=$(kpsewhich -engine tex cwebman)
tie -m $(basename $f) $f $(basename $f .tex)-w2c.ch
- if [ "$HITEX" = "$TEX" ]
- then $SED_I -e "s/\(\\\\input cwebmac\)/\1\n\\\\input hiplainpage/" cwebman.tex
- fi
-
- touch pages.tex # let 'manmac' produce output at all
for f in tripman trapman webman cwebman
do $TEX $f
done
- $TEX -jobname=errorlog /opt/github/web/Xerrorlog.tex
-
- for f in one two three four five six seven eight nine ten \
- eleven twelve
- do $TEX -jobname errata.$f errata.$f
- done
-
- $TEX errata
-
- $PAX "$OUTDIR/errata.tar.gz" -s ,^,errata/, \
- errorlog.$PDF errata.*.$PDF errata.$PDF
- $PAX "$OUTDIR/etc.tar.gz" -s ,^,etc/, vftovp.$PDF vptovf.$PDF
$PAX "$OUTDIR/mf.tar.gz" -s ,^,mf/, mf.$PDF trapman.$PDF
- $PAX "$OUTDIR/mfware.tar.gz" -s ,^,mfware/, \
- gftodvi.$PDF gftopk.$PDF gftype.$PDF mft.$PDF
$PAX "$OUTDIR/tex.tar.gz" -s ,^,tex/, \
glue.$PDF tex.$PDF tripman.$PDF
- $PAX "$OUTDIR/texware.tar.gz" -s ,^,texware/, \
- dvitype.$PDF pltotf.$PDF pooltype.$PDF tftopl.$PDF
$PAX "$OUTDIR/web.tar.gz" -s ,^,web/, \
webman.$PDF tangle.$PDF weave.$PDF twill.$PDF
- $PAX "$OUTDIR/bibtex.tar.gz" -s ,^,bibtex/, bibtex.$PDF
- $PAX "$OUTDIR/other.tar.gz" -s ,^,other/, \
- dvicopy.$PDF patgen.$PDF pktogf.$PDF pktype.$PDF
- $PAX "$OUTDIR/hitex.tar.gz" -s ,^,hitex/, hitex.$PDF
- $PAX "$OUTDIR/mp.tar.gz" -s ,^,mp/, mp.$PDF
- $PAX "$OUTDIR/pdftex.tar.gz" -s ,^,pdftex/, pdftex.$PDF
- $PAX "$OUTDIR/xetex.tar.gz" -s ,^,xetex/, xetex.pdf
- $PAX "$OUTDIR/ctie.tar.gz" -s ,^,ctie/, ctie.$PDF
- $PAX "$OUTDIR/tie.tar.gz" -s ,^,tie/, tie.$PDF
$PAX "$OUTDIR/cweb.tar.gz" -s ,^,cweb/, \
cwebman.$PDF common.$PDF ctangle.$PDF cweave.$PDF \
ctwill.$PDF refsort.$PDF twinx.$PDF
- fi
+ else # -n $CHANGES
+ for f in *.$PDF
+ do
+ case $f in *$CHANGES.$PDF ) rm -f $f; continue ;; esac
+ mv $f $(basename $f .$PDF)$CHANGES.$PDF
+ done
+ [ "$HITEX" = "$TEX" ] && mv -f xetex.pdf xetex$CHANGES.pdf
+ $PAX "$OUTDIR/mf$CHANGES.tar.gz" -s ,^,mf/, mf$CHANGES.$PDF
+ $PAX "$OUTDIR/tex$CHANGES.tar.gz" -s ,^,tex/, tex$CHANGES.$PDF
+ $PAX "$OUTDIR/web$CHANGES.tar.gz" -s ,^,web/, \
+ tangle$CHANGES.$PDF weave$CHANGES.$PDF
+ $PAX "$OUTDIR/cweb$CHANGES.tar.gz" -s ,^,cweb/, \
+ common$CHANGES.$PDF ctangle$CHANGES.$PDF \
+ cweave$CHANGES.$PDF refsort$CHANGES.$PDF \
+ twinx$CHANGES.$PDF
+ fi # $CHANGES
+
+ $PAX "$OUTDIR/etc$CHANGES.tar.gz" -s ,^,etc/, \
+ vftovp$CHANGES.$PDF vptovf$CHANGES.$PDF
+ $PAX "$OUTDIR/mfware$CHANGES.tar.gz" -s ,^,mfware/, \
+ gftodvi$CHANGES.$PDF gftopk$CHANGES.$PDF \
+ gftype$CHANGES.$PDF mft$CHANGES.$PDF
+ $PAX "$OUTDIR/texware$CHANGES.tar.gz" -s ,^,texware/, \
+ dvitype$CHANGES.$PDF pltotf$CHANGES.$PDF \
+ pooltype$CHANGES.$PDF tftopl$CHANGES.$PDF
+ $PAX "$OUTDIR/other$CHANGES.tar.gz" -s ,^,other/, \
+ dvicopy$CHANGES.$PDF patgen$CHANGES.$PDF \
+ pktogf$CHANGES.$PDF pktype$CHANGES.$PDF
+ $PAX "$OUTDIR/xetex$CHANGES.tar.gz" -s ,^,xetex/, \
+ xetex$CHANGES.pdf
+ for f in bibtex pdftex ctie tie
+ do $PAX "$OUTDIR/$f$CHANGES.tar.gz" -s ,^,$f/, $f$CHANGES.$PDF
+ done
# Notes to self:
# (1) Create a user-friendly central entrypoint with
diff --git a/web/pwebmac/pwebmac.tex b/web/pwebmac/pwebmac.tex
index 01bba0e19f..50070a7dc2 100644
--- a/web/pwebmac/pwebmac.tex
+++ b/web/pwebmac/pwebmac.tex
@@ -5,7 +5,7 @@
% 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+PWEBMAC4.12}
+\xdef\fmtversion{\fmtversion+PWEBMAC5.0}
\parskip 0pt % no stretch between paragraphs
\parindent 1em % for paragraphs and for the first line of Pascal text
@@ -74,8 +74,8 @@
\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\countD \countD=0
-\newif\iftokprocessed \newif\ifTnum \newif\ifinstr
+\newcount\countNOS \countNOS=0
+\newif\iftokprocessed \newif\ifTnum \newif\ifinstr \newif\ifhavenum
{\def\\{\global\let\spacechar= }\\ }
% Here we decide the output format, depending on the TeX engine in use:
@@ -89,8 +89,7 @@
\newif\ifpdflua \ifluatex\pdfluatrue\fi \ifpdftex\pdfluatrue\fi
\ifpdflua % pdfTeX and luaTeX produce PDF output if \pdfoutput>0 (default)
\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
+ \def\Blue{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}} \fi
\ifluatex % LuaTeX is almost like pdfTeX
\protected\def\pdfliteral {\pdfextension literal}
@@ -108,28 +107,56 @@
\let\pdfoutput=\outputmode
\fi % end of LuaTeX->pdfTeX redirection macros
+\ifacrohint % Common macros for \ifpdf and \ifhint for \pdflink's
+\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA}
+\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}%
+ \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\let\space\empty
+ \toksC={}\toksD={}}\makenote}\maketoks}}
+\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
+\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}%
+ \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi}
+\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|%
+ \let\next=\maketoks % continue processing by default
+ \ifnum\countB>`9 \countB=0 \fi
+ \ifnum\countB<`0
+ \ifhavenum\makenote\fi
+ \ifx\first.\let\next=\maketoksdone % fullstop
+ \else \addtokens\toksB{\the\toksD}
+ \ifx\first,\addtokens\toksB{\space}\fi
+ \fi
+ \else \addtokens\toksC{\the\toksD}\global\havenumtrue
+ \fi
+ \next
+}
+\def\makenote{\addtokens\toksB
+ {\noexpand\pdflink{\the\toksC}}\toksC={}\global\havenumfalse}
+\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
+\fi % End of common pdf/hint macros
+
\ifpdf % The following are general pdf macros from 'cwebmac.tex 3.70'
\def\thewidth{\the\wd0 \space}
\def\theheight{\the\ht\strutbox\space}
\def\thedepth{\the\dp\strutbox\space}
\ifpdflua
\ifx\pdfannotlink\undefined\let\pdfannotlink\pdfstartlink\fi% for pdfTeX 0.14
- \def\pdflink#1#2{\hbox{\pdfannotlink height \theheight depth \thedepth
+ \def\pdflink#1{\hbox{\pdfannotlink height \theheight depth \thedepth
attr{/Border [0 0 0]} goto num #1 \Blue #1\Black\pdfendlink}}
-\else\def\pdflink#1#2{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}%
+\else\def\pdflink#1{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}%
\special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight
- depth \thedepth << /Type /Annot /Subtype /Link
- /Border [0 0 0] /A << /S /GoTo /D (#2) >> >>}\box0\relax}\fi
+ depth \thedepth << /Type /Annot /Subtype /Link /Border [0 0 0]
+ /A << /S /GoTo /D (\romannumeral#1) >> >>}\box0\relax}\fi
\def\sanitizecommand#1#2{\addtokens\usersanitizer
{\noexpand\dosanitizecommand\noexpand#1{#2}}}
\def\dosanitizecommand#1#2{\ifx\nxt#1\addF{#2}\fi}
+\ifhint\else\sanitizecommand\to{..}\fi % a trivial example; requires \addtokens
\catcode`\[=1 \catcode`\]=2 \catcode`\{=12 \catcode`\}=12
\def\lbchar[{] \def\rbchar[}]
\catcode`\[=12 \catcode`\]=12 \catcode`\{=1 \catcode`\}=2
\catcode`\~=12 \def\tildechar{~} \catcode`\~=13
\catcode`\|=0 |catcode`|\=12 |def|bschar{\} |catcode`|\=0 \catcode`\|=12
-\def\makeoutlinetoks{\Tnumfalse\afterassignment\makeolproctok\let\nxt= }
+\def\makeoutlinetoks{\toksF={}\Tnumfalse
+ \afterassignment\makeolproctok\let\nxt= }
\def\makeolnexttok{\afterassignment\makeolproctok\let\nxt= }
\def\makeolgobbletok{\afterassignment\makeolnexttok\let\nxt= }
\def\addF#1{\addtokens\toksF{#1}\tokprocessedtrue}
@@ -191,7 +218,7 @@
}
\def\makeolproctokchar#1 #2 #3{\addF{#3}}
\def\outlinedone{\edef\outlinest{\global\noexpand\toksE={\the\toksF}}%
- \outlinest\let\outlinedone=\relax}
+ \outlinest\let\outlinedone=\relax\outlinedone}
\fi % End of general pdf macros
\ifhint
@@ -205,40 +232,11 @@
\def\HINThome{\HINTdest name {HINT.home}%
\HINToutline goto name {HINT.home} depth 1 {Table of Contents}}
\def\HINTlabel{{\let\*=\empty\HINTdest num \modstar top}}
-\def\HINTlink#1#2{\HINTstartlink goto num #1 {#1}\HINTendlink}% #2 not used ???
+\def\HINTlink#1{\HINTstartlink goto num #1 {#1}\HINTendlink}
\def\HINTcontents#1#2{\HINToutline goto num #2 depth 1 {#1}}
\let\pdflink=\HINTlink
\fi % End of HINT macros
-% 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={}%
- \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\toksD={}
- \toksC={}\let\space\empty}\makenote}\maketoks}}
-\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
-\ifhint\else\sanitizecommand\to{..}\fi % a trivial example; requires \addtokens
-\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}%
- \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi\toksA={#2}}
-\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|%
- \ifnum\countB>`9 \countB=0 \fi
- \ifnum\countB<`0
- \ifnum0=\countC\else\makenote\fi
- \ifx\first.\let\next=\maketoksdone\else
- \let\next=\maketoks
- \addtokens\toksB{\the\toksD}
- \ifx\first,\addtokens\toksB{\space}\fi
- \fi
- \else \addtokens\toksC{\the\toksD}\global\countC=1\let\next=\maketoks
- \fi
- \next
-}
-\def\makenote{\addtokens\toksB
- {\noexpand\pdflink{\the\toksC}{\romannumeral\the\toksC}}%
- \toksC={}\global\countC=0}
-\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
-\fi % End of common pdf/hint 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
@@ -280,7 +278,7 @@
\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
- \ifpdf{\toksF={}\makeoutlinetoks#2\outlinedone\outlinedone}\fi
+ \ifpdf{\makeoutlinetoks#2\outlinedone}\fi
\gtitle={#2}\MN#1.\vfil\eject % define running headline
\message{*\modno} % progress report
\def\stripprefix##1>{}\def\gtitletoks{#2}%
@@ -411,17 +409,31 @@
\message{Index:}
\parskip 0pt plus .5pt
\outer\def\:##1, ##2.{\par\hangindent2em\noindent##1:\kern1em
- \ifacrohint\pdfnote##2.\else##2\fi.} % index entry
+ \scan##2!.} % index entry
\let\ttentry=\. \def\.##1{\ttentry{##1\kern.2em}} % give \tt a little room
- \def\[##1]{$\underline{##1}$} % underlined index item
- \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar
+ \def\[##1]{$\underline{\scan##1!}$\scan} % underlined index item
+ \ifacrohint\def\digits{\pdflink{\the\countA}\scan}
+ \else\def\digits{{\the\countA}\scan}\fi
+ \def\scan##1{\begingroup
+ \ifx!##1% exit on exclamation point
+ \else\ifx,##1,\space\aftergroup\scan % insert ,\space}\scan...
+ \else\ifx\[##1\aftergroup##1% insert }\[...
+ \else\ifx\*##1\aftergroup\lapstar\aftergroup\scan % insert }\lapstar\scan...
+ \else\ifnum`##1>`9##1\aftergroup\scan % insert #1}\scan...
+ \else\ifnum`##1<`0##1\aftergroup\scan % insert #1}\scan...
+ \else
+ \afterassignment\digits \aftergroup\countA
+ \aftergroup##1% insert }\countA=#1\digits...
+ \fi\fi\fi\fi\fi \fi
+ \endgroup}
+ \rm \rightskip0pt plus 2.5em \tolerance 10000
\hyphenpenalty 10000 \parindent0pt}
\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
\ifpdflua \makebookmarks % added in Version 4.5
\ifnum\pdfshellescape=1 {\let\\=\BS % count the @<named sections@>
- \global\countD=\input{|grep -c -e '\\:\\X' \jobname.tex}} \fi\fi
+ \global\countNOS=\input{|grep -c -e '\\:\\X' \jobname.tex}} \fi\fi
\parfillskip 0pt plus 1fil
\def\grouptitle{NAMES OF THE SECTIONS}
\let\topsecno=\nullsec
@@ -435,18 +447,16 @@
\def\:{\par\hangindent 2em}\let\*=*\let\.=\ttentry
\ifpdf \def\outsecname{Names of the sections} \let\Xpdf\X
\ifpdflua \pdfdest name {NOS} fith
- \ifnum \the\countD>0 \xdef\modno{\the\countD} \fi
+ \ifnum \countNOS>0 \xdef\modno{\the\countNOS} \fi
\pdfoutline goto name {NOS} count -\modno {\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}}
\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}
\def\makebookmarks{\def\?##1]{[##1]}%
\let\Z=\writebookmarkline \readcontents\relax}
\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
@@ -474,9 +484,9 @@
\line{\ignorespaces#1
\rm\leaders\hbox to .5em{.\hfil}\hfil
\ \ifhint
- \HINTlink{#2}{\romannumeral#2}% No page numbers in HINT
+ \HINTlink{#2}% No page numbers in HINT
\HINTcontents{#1}{#2}%
- \else\ifpdf\pdflink{#2}{\romannumeral#2}\else#2\fi
+ \else\ifpdf\pdflink{#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
diff --git a/web/pwebmac/webman.ch b/web/pwebmac/webman.ch
index 1817ab4665..f3e5a8a31e 100644
--- a/web/pwebmac/webman.ch
+++ b/web/pwebmac/webman.ch
@@ -56,6 +56,12 @@
\else Appendix~#1\fi}
@z
+@x l.21
+\def\runninghead{{\tentt WEB} USER MANUAL}
+@y
+\def\runninghead{{\ninett WEB} USER MANUAL}
+@z
+
@x l.34
\vskip 15pt plus 3pt minus 3pt
\noindent This memo describes how to write programs in the
@@ -64,22 +70,27 @@
This memo describes how to write programs in the
@z
-@x l.180
-\yskip\item{1)} A \TeX\ part, containing explanatory material about what
+@x l.126
+well known work of Pierre-Arnoul de Marneffe [``Holon programming: A
+survey,'' Univ.\ de Liege, Service Informatique, Liege, Belgium, 1973; 135
@y
-\yskip\itemitem{1)} A \TeX\ part, containing explanatory material about what
+well known work of Pierre-Arnoul de Marneffe [``\pdfURL{Holon programming:
+A survey}{https://github.com/holon-scribe/holon-programming},'' Univ.\ de
+Li\`ege, Service d'Informatique, Li\`ege, Belgium, 1973; 135
@z
-@x l.183
-\item{2)} A definition part, containing macro definitions that serve as
+@x l.180
+\yskip\item{1)} A \TeX\ part, containing explanatory material about what
@y
-\itemitem{2)} A definition part, containing macro definitions that serve as
+\begingroup\parindent=2.5em
+\yskip\item{1)} A \TeX\ part, containing explanatory material about what
@z
-@x l.187
-\item{3)} A \PASCAL\ part, containing a piece of the program that
+@x l.190
+that its structure is readily perceived.
@y
-\itemitem{3)} A \PASCAL\ part, containing a piece of the program that
+that its structure is readily perceived.\par
+\endgroup
@z
@x l.304
@@ -102,14 +113,29 @@ program for \.{TANGLE}, in \pdfURL{Appendix~E}{tangle.pdf},
gives precise details about this
@z
-@x l.626
+@x l.628
outputs of \.{WEAVE} and \.{TANGLE} (see Appendix~C\null). Meta-comments
@y
outputs of \.{WEAVE} (see \Appendix B\null) and \.{TANGLE}
(see \Appendix C\null). Meta-comments
@z
-@x l.893
+@x l.788
+\yskip\itemitem{a)}Comments in \PASCAL\ text should appear only after
+@y
+\yskip
+\begingroup\parindent=1.5em
+\itemitem{a)}Comments in \PASCAL\ text should appear only after
+@z
+
+@x l.796
+statements.
+@y
+statements.\par
+\endgroup
+@z
+
+@x l.895
examples of ``real'' programs. Appendix~A shows the \.{WEB} input that
generated modules 55--59 of the \.{WEAVE} program; Appendix~B shows the
corresponding \TeX\ code output by \.{WEAVE}; and Appendix~C shows excerpts
@@ -119,7 +145,7 @@ generated modules 55--59 of the \.{WEAVE} program; \Appendix B shows the
corresponding \TeX\ code output by \.{WEAVE}; and \Appendix C shows excerpts
@z
-@x l.900
+@x l.901
report, in Appendices D and~E. The reader should first compare Appendix~A
to the corresponding portion of Appendix~D; then the same material should
be compared to Appendices B and~C. Finally, if time permits, the reader may
@@ -133,7 +159,7 @@ studying the complete programs in Appendices \pdfURL{D}{weave.pdf}
and~\pdfURL{E}{tangle.pdf}, since \.{WEAVE}
@z
-@x l.908
+@x l.909
Finally, Appendix F is the `\.{webmac}' file that sets \TeX\ up to accept
the output of \.{WEAVE}; Appendix~G discusses how to use some of its macros
to vary the output formats; and Appendix~H discusses what needs to be done
@@ -145,7 +171,7 @@ engines; \Appendix G discusses how to use some of these macros
to vary the output formats; and \Appendix H discusses what needs to be done
@z
-@x l.913
+@x l.914
The programs in Appendices D and E will optionally keep statistics on
@y
The programs in Appendices \pdfURL{D}{weave.pdf} and \pdfURL{E}{tangle.pdf}
@@ -153,9 +179,11 @@ will optionally keep statistics on
@z
@x l.989
+ \def\runninghead{APPENDIX A --- {\tentt WEB} FILE FORMAT}
\section Appendix A.
This excerpt from \.{WEAVE.WEB} produced modules 55--59 in Appendix~D.
@y
+ \def\runninghead{APPENDIX A --- {\ninett WEB} FILE FORMAT}
\def\bkminfo{WEB file format}
\section Appendix A.
This excerpt from \.{WEAVE.WEB} produced modules 55--59 in
@@ -169,9 +197,11 @@ ASCII codes is $c_1c_2\ldots c_n$, its hash value will be
@z
@x l.1061
+ \def\runninghead{APPENDIX B --- TRANSLATION BY {\tentt WEAVE}}
\section Appendix B.
This excerpt from \.{WEAVE.TEX} corresponds to Appendix A.
@y
+ \def\runninghead{APPENDIX B --- TRANSLATION BY {\ninett WEAVE}}
\def\bkminfo{Translations by WEAVE}
\section Appendix B.
This excerpt from \.{WEAVE.TEX} corresponds to \Appendix A.
@@ -190,8 +220,10 @@ ASCII codes is $c_1c_2\ldots c_n$, its hash value will be
@z
@x l.1143
+ \def\runninghead{APPENDIX C --- TRANSLATION BY {\tentt TANGLE}}
\section Appendix C.
@y
+ \def\runninghead{APPENDIX C --- TRANSLATION BY {\ninett TANGLE}}
\def\bkminfo{Translation by TANGLE}
\section Appendix C.
@z
@@ -543,35 +575,35 @@ The macros in \.{webmac} and \.{pwebmac} make it possible to produce
a variety of formats
@z
-@x l.1425
+@x l.1463
in small caps. For example, Appendix~D was produced after saying
@y
in small caps. For example, \pdfURL{Appendix~D}{weave.pdf} was produced
after saying
@z
-@x l.1468
+@x l.1469
\.{\\pageno=\\contentspagenumber} \.{\\advance\\pageno by 1}'. (Appendix~D
@y
\.{\\pageno=\\contentspagenumber} \.{\\advance\\pageno by 1}'.
(\pdfURL{Appendix~D}{weave.pdf}
@z
-@x l.1479
+@x l.1480
For example, Appendix~D was produced with the following definitions:
@y
For example, \pdfURL{Appendix~D}{weave.pdf} was produced with the following
definitions:
@z
-@x l.1491
+@x l.1492
for every starred module. For example, when Appendix~D was being generated,
@y
for every starred module. For example, when \pdfURL{Appendix~D}{weave.pdf}
was being generated,
@z
-@x l.569
+@x l.1569
\.{\\ch}, \.{\\fin}, and \.{\\con}. \.{WEAVE} itself need not be changed.
@y
\.{\\ch}, \.{\\fin}, and \.{\\con}. \.{WEAVE} itself need not be changed.
@@ -582,7 +614,7 @@ and run \TeX\ \\{twice} on your woven \.{WEB} document, in order to shift the
table-of-contents to the front of the {\mc PDF} output.
@z
-@x l.1583
+@x l.1584
dependencies'' in the index of Appendix~E above, and figure out what changes
@y
dependencies'' in the index of \pdfURL{Appendix~E}{tangle.pdf} above,
@@ -595,25 +627,25 @@ first change files; then you can sure that your compiler will handle
first change files; then you can be sure that your compiler will handle
@z
-@x l.1609
+@x l.1610
the index to Appendix~D.
@y
the index to \pdfURL{Appendix~D}{weave.pdf}.
@z
-@x l.1616
+@x l.1617
Appendix~E. This listing will incorporate your changes.
@y
\pdfURL{Appendix~E}{tangle.pdf}. This listing will incorporate your changes.
@z
-@x l.1620
+@x l.1621
Appendix~D that incorporates your changes.
@y
\pdfURL{Appendix~D}{weave.pdf} that incorporates your changes.
@z
-@x l.1632
+@x l.1631
\def\substep(10.#1){\par\hangindent 4em\noindent
\hbox to 4em{\hfil(10.#1) }\ignorespaces}
@y
@@ -621,7 +653,7 @@ Appendix~D that incorporates your changes.
\hbox to 3em{\hfil(10.#1) }\ignorespaces}
@z
-@x l.1666
+@x l.1667
computer by following Appendices D and E. Then you have to simulate the
@y
computer by following Appendices \pdfURL{D}{weave.pdf}