summaryrefslogtreecommitdiff
path: root/web/c_cpp/cweb
diff options
context:
space:
mode:
Diffstat (limited to 'web/c_cpp/cweb')
-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
24 files changed, 207 insertions, 174 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.