diff options
Diffstat (limited to 'web/c_cpp/cweb')
27 files changed, 171 insertions, 132 deletions
diff --git a/web/c_cpp/cweb/Makefile b/web/c_cpp/cweb/Makefile index 86db9f3bfc..92e59b857b 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.6 --- December 2021 +# Version 4.7 --- February 2022 # Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth @@ -64,9 +64,11 @@ CP= /bin/cp # uncomment the second line if you use pdftex to bypass .dvi files # uncomment the third line if you use xetex to bypass .dvi files +# uncomment the forth line if you use hitex for HINT output PDFTEX = dvipdfm #PDFTEX = pdftex #PDFTEX = xetex +#PDFTEX = hitex ########## You shouldn't have to change anything after this point ####### @@ -108,6 +110,7 @@ ALL = common.w ctangle.w cweave.w prod.w \ dvipdfm ) tex "\let\pdf+ \input $*"; dvipdfm $* ;; \ pdftex ) pdftex $* ;; \ xetex ) xetex $* ;; \ + hitex ) hitex $* ;; \ esac all: ctangle cweave @@ -163,7 +166,7 @@ fullmanual: usermanual $(SOURCES) comm-man.ch ctang-man.ch cweav-man.ch # be sure to leave ctangle.c and common.c for bootstrapping clean: $(RM) -f -r *~ *.o common.tex cweave.tex cweave.c ctangle.tex \ - *.log *.dvi *.toc *.idx *.scn *.pdf core cweave ctangle + *.log *.dvi *.toc *.idx *.scn *.pdf *.hnt core cweave ctangle install: all - mkdir $(DESTDIR) diff --git a/web/c_cpp/cweb/comm-mac.ch b/web/c_cpp/cweb/comm-mac.ch index 4d1382accd..6d795ff4e8 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.6)} + \centerline{(Version 4.7)} @y - \centerline{(Version 4.6 for MacOS)} + \centerline{(Version 4.7 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-man.ch b/web/c_cpp/cweb/comm-man.ch index c922c03631..f2cdcf52e4 100644 --- a/web/c_cpp/cweb/comm-man.ch +++ b/web/c_cpp/cweb/comm-man.ch @@ -16,7 +16,7 @@ under the terms of a permission notice identical to this one. } @y \def\botofcontents{\vfill\titlefalse} -\def\contentspagenumber{28} +\def\contentspagenumber{29} \def\title{APPENDIX D: COMMON} \let\K=\leftarrow @z diff --git a/web/c_cpp/cweb/comm-pc.ch b/web/c_cpp/cweb/comm-pc.ch index 5a29188ed7..883da1303c 100644 --- a/web/c_cpp/cweb/comm-pc.ch +++ b/web/c_cpp/cweb/comm-pc.ch @@ -8,7 +8,7 @@ Note: The change to section 16 is not necessary if using a compiler that allows >64K arrays. @x section 16 -@d max_bytes 90000 /* the number of bytes in identifiers, +@d max_bytes 100000 /* the number of bytes in identifiers, @y @d max_bytes (unsigned)60000 /* the number of bytes in identifiers, @z diff --git a/web/c_cpp/cweb/comm-ql.ch b/web/c_cpp/cweb/comm-ql.ch index 191fb51f1d..aa451c7455 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.6)} +\def\title{Common code for CTANGLE and CWEAVE (Version 4.7)} \def\topofcontents{\null\vfill \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and {\ttitlefont CWEAVE}} \vskip 15pt - \centerline{(Version 4.6)} + \centerline{(Version 4.7)} \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.6)} +\def\title{Common code for CTANGLE and CWEAVE (QL Version 4.7)} \def\topofcontents{\null\vfill \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and {\ttitlefont CWEAVE}} \vskip 15pt - \centerline{(Version 4.6)} + \centerline{(Version 4.7)} \vfill} \def\botofcontents{\vfill \noindent diff --git a/web/c_cpp/cweb/common.c b/web/c_cpp/cweb/common.c index 9e77c55f31..00575a0ebf 100644 --- a/web/c_cpp/cweb/common.c +++ b/web/c_cpp/cweb/common.c @@ -82,13 +82,13 @@ #define new_line putchar('\n') #define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) \ -#define buf_size 100 +#define buf_size 200 #define longest_name 10000 \ #define long_buf_size (buf_size+longest_name) -#define max_bytes 90000 \ +#define max_bytes 100000 \ -#define max_names 4000 \ +#define max_names 5000 \ #define max_sections 2000 \ diff --git a/web/c_cpp/cweb/common.h b/web/c_cpp/cweb/common.h index 2a584ff442..4d2caba05d 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.6 --- December 2021 (works also with later versions) +% Version 4.7 --- February 2022 (works also with later versions) % Copyright (C) 1987,1990,1993 Silvio Levy and Donald E. Knuth @@ -226,17 +226,16 @@ extern FILE *active_file; /* currently active file for \.{CWEAVE} output */ extern void common_init(void);@/ extern void print_stats(void); -@ The following parameters were sufficient in the original \.{WEB} to -handle \TEX/, so they should be sufficient for most applications of -\.{CWEB}. +@ The following parameters are sufficient to handle \TEX/ (converted to +\.{CWEB}), so they should be sufficient for most applications of \.{CWEB}. -@d buf_size 100 /* maximum length of input line, plus one */ +@d buf_size 200 /* maximum length of input line, plus one */ @d longest_name 10000 /* file names, section names, and section texts shouldn't be longer than this */ @d long_buf_size (buf_size+longest_name) /* for \.{CWEAVE} */ -@d max_bytes 90000 /* the number of bytes in identifiers, +@d max_bytes 100000 /* the number of bytes in identifiers, index entries, and section names; must be less than $2^{24}$ */ -@d max_names 4000 /* number of identifiers, strings, section names; +@d max_names 5000 /* number of identifiers, strings, section names; must be less than 10240 */ @d max_sections 2000 /* greater than the total number of sections */ diff --git a/web/c_cpp/cweb/common.w b/web/c_cpp/cweb/common.w index 36f35f3cbc..941b7206cc 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.6 --- December 2021 +% Version 4.7 --- February 2022 % 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.6)} +\def\title{Common code for CTANGLE and CWEAVE (Version 4.7)} \def\topofcontents{\null\vfill \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and {\ttitlefont CWEAVE}} \vskip 15pt - \centerline{(Version 4.6)} + \centerline{(Version 4.7)} \vfill} \def\botofcontents{\vfill \noindent diff --git a/web/c_cpp/cweb/ctang-bs.ch b/web/c_cpp/cweb/ctang-bs.ch index ceaefa93e5..ecdb4be591 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.6)" +@d banner "This is CTANGLE (Version 4.7)" @y The ``banner line'' defined here should be changed whenever \.{CTANGLE} is modified. -@d banner "This is CTANGLE (Version 4.6pc/big)" +@d banner "This is CTANGLE (Version 4.7pc/big)" @z @@ -98,7 +98,7 @@ typedef text *text_pointer; @x Section 20. -@ @d max_texts 2500 /* number of replacement texts, must be less than 10240 */ +@ @d max_texts 4000 /* number of replacement texts, must be less than 10240 */ @d max_toks 270000 /* number of bytes in compressed \CEE/ code */ @y @ (This is a modified version of \.{CTANGLE}, and in fact one of the parameters diff --git a/web/c_cpp/cweb/ctang-man.ch b/web/c_cpp/cweb/ctang-man.ch index f90d5361ae..69bc686b72 100644 --- a/web/c_cpp/cweb/ctang-man.ch +++ b/web/c_cpp/cweb/ctang-man.ch @@ -16,7 +16,7 @@ under the terms of a permission notice identical to this one. } @y \def\botofcontents{\vfill\titlefalse} -\def\contentspagenumber{64} +\def\contentspagenumber{65} \def\title{APPENDIX E: CTANGLE} \let\K=\leftarrow @z diff --git a/web/c_cpp/cweb/ctang-pc.ch b/web/c_cpp/cweb/ctang-pc.ch index 2fb9b90440..459356a59e 100644 --- a/web/c_cpp/cweb/ctang-pc.ch +++ b/web/c_cpp/cweb/ctang-pc.ch @@ -9,12 +9,12 @@ 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.6)" +@d banner "This is CTANGLE (Version 4.7)" @y -@d banner "This is CTANGLE (Version 4.6pc)" +@d banner "This is CTANGLE (Version 4.7pc)" @z @x section 17 -@d max_bytes 90000 /* the number of bytes in identifiers, +@d max_bytes 100000 /* the number of bytes in identifiers, index entries, and section names; must be less than $2^{24}$ */ @y (note that CWEAVE itself needs only about 42K toks) @d max_bytes (unsigned)60000 /* 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 2f4ff604b1..727b20ea9c 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.6)} +\def\title{CTANGLE (Version 4.7)} @y -\def\title{CTANGLE (QL Version 4.6)} +\def\title{CTANGLE (QL Version 4.7)} @z @x section 1 -@d banner "This is CTANGLE (Version 4.6)" +@d banner "This is CTANGLE (Version 4.7)" @y -@d banner "This is CTANGLE (QL Version 4.6)" +@d banner "This is CTANGLE (QL Version 4.7)" @z @x diff --git a/web/c_cpp/cweb/ctang-vms.ch b/web/c_cpp/cweb/ctang-vms.ch index 9f5dd2a677..e494b86f4f 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.6)" +@d banner "This is CTANGLE (Version 4.7)" @y -@d banner "This is CTANGLE (VAX/VMS Version 4.6)" +@d banner "This is CTANGLE (VAX/VMS Version 4.7)" @z @x section 4 (01-FEB-1992 ST) diff --git a/web/c_cpp/cweb/ctang-w32.ch b/web/c_cpp/cweb/ctang-w32.ch index d299f00683..d54b84b9f9 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.6)" +@d banner "This is CTANGLE (Version 4.7)" @y -@d banner "This is CTANGLE (Version 4.6win32)" +@d banner "This is CTANGLE (Version 4.7win32)" @z @x @@ -14,13 +14,13 @@ boolean names_match( name_pointer p, /* points to the proposed match */ const char *first, /* position of first character of string */ size_t l, /* length of identifier */ -eight_bits t) /* not used by \.{TANGLE} */ +eight_bits t) /* not used by \.{CTANGLE} */ @y boolean __cdecl names_match( name_pointer p, /* points to the proposed match */ const char *first, /* position of first character of string */ size_t l, /* length of identifier */ -eight_bits t) /* not used by \.{TANGLE} */ +eight_bits t) /* not used by \.{CTANGLE} */ @z @x diff --git a/web/c_cpp/cweb/ctangle.c b/web/c_cpp/cweb/ctangle.c index 0c6f8afe2a..d7bc2ecbf8 100644 --- a/web/c_cpp/cweb/ctangle.c +++ b/web/c_cpp/cweb/ctangle.c @@ -15,7 +15,7 @@ /*:4*/ #line 67 "ctangle.w" -#define banner "This is CTANGLE (Version 4.6)" \ +#define banner "This is CTANGLE (Version 4.7)" \ #define ctangle false #define cweave true \ @@ -84,17 +84,17 @@ #define new_line putchar('\n') #define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) \ -#define buf_size 100 +#define buf_size 200 #define longest_name 10000 \ #define long_buf_size (buf_size+longest_name) -#define max_bytes 90000 \ +#define max_bytes 100000 \ -#define max_names 4000 \ +#define max_names 5000 \ #define max_sections 2000 \ -#define max_texts 2500 +#define max_texts 4000 #define max_toks 270000 #define equiv equiv_or_xref \ diff --git a/web/c_cpp/cweb/ctangle.w b/web/c_cpp/cweb/ctangle.w index 1a9e8065af..1ee2aaf195 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.6 --- December 2021 +% Version 4.7 --- February 2022 % 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.6)} +\def\title{CTANGLE (Version 4.7)} \def\topofcontents{\null\vfill \centerline{\titlefont The {\ttitlefont CTANGLE} processor} \vskip 15pt - \centerline{(Version 4.6)} + \centerline{(Version 4.7)} \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.6)" +@d banner "This is CTANGLE (Version 4.7)" @c @<Include files@>@/ @@ -126,7 +126,7 @@ typedef struct { } text; typedef text *text_pointer; -@ @d max_texts 2500 /* number of replacement texts, must be less than 10240 */ +@ @d max_texts 4000 /* number of replacement texts, must be less than 10240 */ @d max_toks 270000 /* number of bytes in compressed \CEE/ code */ @<Private...@>= static text text_info[max_texts]; @@ -157,7 +157,7 @@ boolean names_match( name_pointer p, /* points to the proposed match */ const char *first, /* position of first character of string */ size_t l, /* length of identifier */ -eight_bits t) /* not used by \.{TANGLE} */ +eight_bits t) /* not used by \.{CTANGLE} */ {@+(void)t;@/ return length(p)==l && strncmp(first,p->byte_start,l)==0; } diff --git a/web/c_cpp/cweb/cweav-bs.ch b/web/c_cpp/cweb/cweav-bs.ch index 5aa05c8b8c..c0fc3981ae 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.6)" +@d banner "This is CWEAVE (Version 4.7)" @y The ``banner line'' defined here should be changed whenever \.{CWEAVE} is modified. -@d banner "This is CWEAVE (Version 4.6pc/big)" +@d banner "This is CWEAVE (Version 4.7pc/big)" @z diff --git a/web/c_cpp/cweb/cweav-man.ch b/web/c_cpp/cweb/cweav-man.ch index 366cda6f11..6cfcc8fe2d 100644 --- a/web/c_cpp/cweb/cweav-man.ch +++ b/web/c_cpp/cweb/cweav-man.ch @@ -16,7 +16,7 @@ under the terms of a permission notice identical to this one. } @y \def\botofcontents{\vfill\titlefalse} -\def\contentspagenumber{108} +\def\contentspagenumber{109} \def\title{APPENDIX F: CWEAVE} \let\K=\leftarrow @z diff --git a/web/c_cpp/cweb/cweav-pc.ch b/web/c_cpp/cweb/cweav-pc.ch index 23b37416a8..101b4d8a7a 100644 --- a/web/c_cpp/cweb/cweav-pc.ch +++ b/web/c_cpp/cweb/cweav-pc.ch @@ -11,18 +11,18 @@ 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.6)" +@d banner "This is CWEAVE (Version 4.7)" @y -@d banner "This is CWEAVE (Version 4.6pc)" +@d banner "This is CWEAVE (Version 4.7pc)" @z @x section 17 -@d max_bytes 90000 /* the number of bytes in identifiers, +@d max_bytes 100000 /* the number of bytes in identifiers, @y @d max_bytes (unsigned)60000 /* the number of bytes in identifiers, @z @x -@d max_refs 20000 /* number of cross-references; must be less than 65536 */ +@d max_refs 30000 /* number of cross-references; must be less than 65536 */ @y @d max_refs 10000 /* number of cross-references; must be less than 65536 */ @z diff --git a/web/c_cpp/cweb/cweav-ql.ch b/web/c_cpp/cweb/cweav-ql.ch index 4525b8006d..041cba0a83 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.6)} +\def\title{CWEAVE (Version 4.7)} @y -\def\title{CWEAVE (QL Version 4.6)} +\def\title{CWEAVE (QL Version 4.7)} @z @x section 1 -@d banner "This is CWEAVE (Version 4.6)" +@d banner "This is CWEAVE (Version 4.7)" @y -@d banner "This is CWEAVE (QL Version 4.6)" +@d banner "This is CWEAVE (QL Version 4.7)" @z @x diff --git a/web/c_cpp/cweb/cweav-vms.ch b/web/c_cpp/cweb/cweav-vms.ch index f6d786da4a..5078c16541 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.6)" +@d banner "This is CWEAVE (Version 4.7)" @y -@d banner "This is CWEAVE (VAX/VMS Version 4.6)" +@d banner "This is CWEAVE (VAX/VMS Version 4.7)" @z @x section 4 (01-FEB-1992 ST) diff --git a/web/c_cpp/cweb/cweav-w32.ch b/web/c_cpp/cweb/cweav-w32.ch index 1fc91f1a88..84e6a321a5 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.6)" +@d banner "This is CWEAVE (Version 4.7)" @y -@d banner "This is CWEAVE (Version 4.6win32)" +@d banner "This is CWEAVE (Version 4.7win32)" @z @x diff --git a/web/c_cpp/cweb/cweave.w b/web/c_cpp/cweb/cweave.w index bcc8efcfb7..5db1c371b5 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.6 --- December 2021 +% Version 4.7 --- February 2022 % Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth @@ -32,11 +32,11 @@ \def\skipxTeX{\\{skip\_\TEX/}} \def\copyxTeX{\\{copy\_\TEX/}} -\def\title{CWEAVE (Version 4.6)} +\def\title{CWEAVE (Version 4.7)} \def\topofcontents{\null\vfill \centerline{\titlefont The {\ttitlefont CWEAVE} processor} \vskip 15pt - \centerline{(Version 4.6)} + \centerline{(Version 4.7)} \vfill} \def\botofcontents{\vfill \noindent @@ -67,7 +67,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.6)" +@d banner "This is CWEAVE (Version 4.7)" @c @<Include files@>@/ @@ -111,13 +111,13 @@ possible changes from this \.{COMMON} interface consistently. @i common.h -@ The following parameters were sufficient in the original \.{WEAVE} to -handle \TEX/, so they should be sufficient for most applications of \.{CWEAVE}. +@ The following parameters are sufficient to handle \TEX/ (converted to +\.{CWEB}), so they should be sufficient for most applications of \.{CWEAVE}. @d line_length 80 /* lines of \TEX/ output have at most this many characters; should be less than 256 */ -@d max_refs 20000 /* number of cross-references; must be less than 65536 */ -@d max_scraps 2000 /* number of tokens in \CEE/ texts being parsed */ +@d max_refs 30000 /* number of cross-references; must be less than 65536 */ +@d max_scraps 5000 /* number of tokens in \CEE/ texts being parsed */ @* Data structures exclusive to {\tt CWEAVE}. As explained in \.{common.w}, the field of a |name_info| structure @@ -335,9 +335,9 @@ that is unoccupied by replacement text is called |tok_ptr|, and the first unused location of |tok_start| is called |text_ptr|. Thus, we usually have |*text_ptr==tok_ptr|. -@d max_toks 20000 /* number of symbols in \CEE/ texts being parsed; +@d max_toks 30000 /* number of symbols in \CEE/ texts being parsed; must be less than 65536 */ -@d max_texts 4000 /* number of phrases in \CEE/ texts being parsed; +@d max_texts 8000 /* number of phrases in \CEE/ texts being parsed; must be less than 10240 */ @<Private...@>= @@ -3765,7 +3765,7 @@ typedef struct { } output_state; typedef output_state *stack_pointer; -@ @d stack_size 400 /* number of simultaneous output levels */ +@ @d stack_size 2000 /* number of simultaneous output levels */ @d cur_end cur_state.end_field /* current ending location in |tok_mem| */ @d cur_tok cur_state.tok_field /* location of next output token in |tok_mem| */ @d cur_mode cur_state.mode_field /* current mode of interpretation */ diff --git a/web/c_cpp/cweb/cwebmac.tex b/web/c_cpp/cweb/cwebmac.tex index 586e7bb30f..9384d06886 100644 --- a/web/c_cpp/cweb/cwebmac.tex +++ b/web/c_cpp/cweb/cwebmac.tex @@ -1,8 +1,8 @@ % standard macros for CWEB listings (in addition to plain.tex) -% Version 4.6 --- December 2021 +% Version 4.7--- January 2022 \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros -\xdef\fmtversion{\fmtversion+CWEB4.6} -\chardef\cwebversion=4 \chardef\cwebrevision=6 +\xdef\fmtversion{\fmtversion+CWEB4.7} +\chardef\cwebversion=4 \chardef\cwebrevision=7 \newif\ifpdf \ifx\pdf+\pdftrue\fi % Uncomment the following line if you want PDF goodies to be the default @@ -16,7 +16,10 @@ \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\fi +\newif\ifHINT +\ifx\HINTversion\undefined \HINTfalse \else \HINTtrue \fi \newif\ifacro \ifpdf\acrotrue\fi \ifpdftex\acrotrue\fi +\newif\ifacroHINT \ifacro\acroHINTtrue\fi \ifHINT\acroHINTtrue\fi \let\:=\. % preserve a way to get the dot accent % (all other accents will still work as usual) @@ -127,7 +130,7 @@ \def\?{\mathrel?} \def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} \def\note#1#2.{\Y\noindent{\hangindent2em% - \baselineskip10pt\eightrm#1~\ifacro{\pdfnote#2.}\else#2\fi.\par}} + \baselineskip10pt\eightrm#1~\ifacroHINT{\pdfnote#2.}\else#2\fi.\par}} \newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD \newtoks\toksE \newtoks\toksF \newtoks\usersanitizer @@ -148,39 +151,6 @@ \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\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} -\def\pdfURL#1#2{\ifpdftex\pdfannotlink height\ht\strutbox depth\dp\strutbox - attr {/Border [0 0 0]} user { /Type /Action /Subtype /Link /A - << /S /URI /URI (#2) >>}\Blue #1\Black \pdfendlink % changed in 3.69 - \else \ifpdf{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}% - \special{pdf: ec}}\special{pdf: ann width \thewidth\space height \theheight - \space depth \thedepth\space << /Border [0 0 0] - /Type /Action /Subtype /Link /A << /S /URI /URI (#2) >> >>}\box0\relax}% - \else #1 ({\tt#2})\fi\fi} -{\catcode`\~=12 \gdef\TILDE/{~}} % ~ in a URL -{\catcode`\_=12 \gdef\UNDER/{_}} % _ in a URL \def\sanitizecommand#1#2{\addtokens\usersanitizer {\noexpand\dosanitizecommand\noexpand#1{#2}}} \def\dosanitizecommand#1#2{\ifx\nxt#1\addF{#2}\fi} @@ -235,7 +205,7 @@ \else\ifx\nxt\_\ifTnum\addF{E}\else\addF_\fi % 0.1E5->\T{0.1\_5} \else\ifx\nxt\^\ifTnum\addF{0x}\else\addF^\fi % 0x77 -> \T{\^77} \else\ifx\nxt\\\\\ifTnum\addF{0b}\else\addF\\\fi % 0b10111 -> \T{\\10111} - \else\ifx\nxt\$\ifTnum\tokprocessedtrue\else\addF$\fi % \T{77\$L} + \else\ifx\nxt\$\ifTnum\tokprocessedtrue\else\addF$\fi %$% \T{77\$L} \else\ifx\nxt\{\addF\lbchar \else\ifx\nxt\}\addF\rbchar \else\ifx\nxt\ \addF\space \else\ifx\nxt\#\addF{\string\#}% \else\ifx\nxt\PP\addF{++}\else\ifx\nxt\MM\addF{--}% @@ -281,9 +251,64 @@ \outlinest\let\outlinedone=\relax} \fi % End of pdf macros +\ifHINT +% The following uses 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\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 + +\def\pdfURL#1#2{\ifpdftex\pdfannotlink height\ht\strutbox depth\dp\strutbox + attr {/Border [0 0 0]} user { /Type /Action /Subtype /Link /A + << /S /URI /URI (#2) >>}\Blue #1\Black \pdfendlink % changed in 3.69 + \else \ifpdf{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}% + \special{pdf: ec}}\special{pdf: ann width \thewidth\space height \theheight + \space depth \thedepth\space << /Border [0 0 0] + /Type /Action /Subtype /Link /A << /S /URI /URI (#2) >> >>}\box0\relax}% + \else #1 ({\tt#2})\fi\fi} +{\catcode`\~=12 \gdef\TILDE/{~}} % ~ in a URL +{\catcode`\_=12 \gdef\UNDER/{_}} % _ in a URL + \def\lapstar{\rlap{*}} \def\stsec{\rightskip=0pt % get out of C mode (cf. \B) \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50 + \ifHINT\HINTlabel\fi% Start page before section \noindent{\let\*=\lapstar\bf\secstar.\quad}% \ifacro \smash{\raise\baselineskip\hbox to0pt{\let\*=\empty \ifpdftex \pdfdest num \secstar fith% @@ -311,7 +336,7 @@ \let\G=\ge % greater than or equal sign % \H is long Hungarian umlaut accent \let\I=\ne % unequal sign -\def\J{\.{@\&}} % TANGLE's join operation +\def\J{\.{@\&}} % CTANGLE's join operation \let\K== % assignment operator %\let\K=\leftarrow % "honest" alternative to standard assignment operator % \L is Polish letter suppressed-L @@ -345,19 +370,19 @@ \let\R=\lnot % logical not % \S is section sign \def\T#1{\leavevmode % octal, hex or decimal constant - \hbox{$\def\?{\kern.2em}% + \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\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick) - \let\~=\oct \let\^=\hex \let\\=\bin {#1}$}} + \let\~=\oct \let\^=\hex \let\\=\bin {#1}$}}%$% \def\U{\note{This code is used in section}} % xref for use of a section \def\Us{\note{This code is used in sections}} % xref for uses of a section \let\V=\lor % logical or \let\W=\land % logical and \def\X#1:#2\X{\ifmmode\gdef\XX{\null$\null}\else\gdef\XX{}\fi %$% section name \XX$\langle\,${\let\I=\ne#2\eightrm\kern.5em - \ifacro{\pdfnote#1.}\else#1\fi}$\,\rangle$\XX} + \ifacroHINT{\pdfnote#1.}\else#1\fi}$\,\rangle$\XX} \def\Y{\par\yskip} \let\Z=\le \let\ZZ=\let % now you can \write the control sequence \ZZ @@ -451,7 +476,9 @@ \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 \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 @@ -460,7 +487,7 @@ \message{Index:} \parskip 0pt plus .5pt \outer\def\I##1, ##2.{\par\hangindent2em\noindent##1:\kern1em - \ifacro\pdfnote##2.\else##2\fi.} % index entry + \ifacroHINT\pdfnote##2.\else##2\fi.} % index entry \def\[##1]{$\underline{##1}$} % underlined index item \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar \hyphenpenalty 10000 \parindent0pt @@ -475,7 +502,7 @@ \message{Section names:} \output={\normaloutput\page\lheader\rheader} \setpage - \def\note##1##2.{\quad{\eightrm##1~\ifacro{\pdfnote##2.}\else{##2}\fi.}} + \def\note##1##2.{\quad{\eightrm##1~\ifacroHINT{\pdfnote##2.}\else{##2}\fi.}} \def\Q{\note{Cited in section}} % crossref for mention of a section \def\Qs{\note{Cited in sections}} % crossref for mentions of a section \def\U{\note{Used in section}} % crossref for use of a section @@ -512,15 +539,20 @@ \pageno=\contentspagenumber \def\grouptitle{TABLE OF CONTENTS} \message{Table of contents:} + \ifHINT\HINThome\fi% Mark the Table of contents as home page \topofcontents \startpdf - \line{\hfil Section\hbox to3em{\hss Page}} + \line{\hfil Section\ifHINT\else\hbox to3em{\hss Page}\fi}% No Page in HINT \let\ZZ=\contentsline \readcontents\relax % read the contents info \botofcontents \end} % print the contents page(s) and terminate \def\contentsline#1#2#3#4#5{\ifnum#2=0 \smallbreak\fi \line{\consetup{#2}#1 \rm\leaders\hbox to .5em{.\hfil}\hfil - \ \ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi\hbox to3em{\hss#4}}} + \ \ifHINT + \HINTlink{#3}{\romannumeral#3}% No page numbers in HINT + \HINTcontents{#1}{#2}{#3}% + \else\ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi + \hbox to3em{\hss#4}\fi}} \def\consetup#1{\ifcase#1 \bf % depth -1 (@**) \or % depth 0 (@*) \or \hskip2em % depth 1 (@*1) diff --git a/web/c_cpp/cweb/cwebman.pdf b/web/c_cpp/cweb/cwebman.pdf Binary files differindex 83f0707c13..134c823818 100644 --- a/web/c_cpp/cweb/cwebman.pdf +++ b/web/c_cpp/cweb/cwebman.pdf diff --git a/web/c_cpp/cweb/cwebman.tex b/web/c_cpp/cweb/cwebman.tex index 476b526a60..c36b26c9ff 100644 --- a/web/c_cpp/cweb/cwebman.tex +++ b/web/c_cpp/cweb/cwebman.tex @@ -2,7 +2,7 @@ \def\tangref{3} % where the main explanation of CTANGLing is given \input cwebmac -\acrofalse\pdffalse\pdftexfalse +\acrofalse\pdffalse\pdftexfalse\HINTfalse\acroHINTfalse \def\page{\box255 } \normalbottom \parskip 0pt plus 1pt \def\RA{\char'31 } % right arrow @@ -35,7 +35,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.6)} +\def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 4.7)} % This verbatim mode assumes that ! marks are !! in the text being copied. \def\verbatim{\begingroup @@ -49,7 +49,7 @@ \null\vfill \centerline{\titlefont The {\ttitlefont CWEB} System of Structured Documentation} -\vskip 18pt\centerline{(Version 4.6 --- December 2021)} +\vskip 18pt\centerline{(Version 4.7 --- February 2022)} \vskip 24pt \centerline{\authorfont Donald E. Knuth and Silvio Levy} \vfill @@ -889,8 +889,8 @@ the change file can have any number of lines that do not begin with matching purposes. \more This dual-input feature is useful when working with a master \.{CWEB} -file that has been received from elsewhere (e.g., \.{tangle.w} or -\.{weave.w} or \.{tex.web}), when changes are desirable to customize the +file that has been received from elsewhere (e.g., \.{ctangle.w} or +\.{cweave.w} or \.{ctex.w}), when changes are desirable to customize the program for your local computer system. You will be able to debug your system-dependent changes without clobbering the master web file; and once your changes are working, you will be able to incorporate them readily @@ -1166,6 +1166,11 @@ saying `\.{pdftex}~\.{cob}'. And a third way to create PDF output from \.{CWEB} input is to say `\.{xetex}~\.{cob}'. +Similar output for ``smart'' devices can be created with Martin Ruckert's +Hi\TeX\ and its dynamic \.{HINT} format; just say `\.{hitex}~\.{cob}'. +\.{HINT} files can be viewed with the \.{hintview} program, which is available +for {\mc GNU}/Linux, {\mc MS}~Windows, and Android. + A more elaborate system called \.{CTWILL}, which extends the usual cross references of \.{CWEAVE} by preparing links from the uses of identifiers to their definitions, is also available---provided that you are willing @@ -1592,7 +1597,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.6)\}{ }\\vfill\}}\cr}$$ + \.{ { }\\vskip 15pt \\centerline\{(Version 4.7)\}{ }\\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. @@ -1600,8 +1605,8 @@ contents page. \point 9. Data for the table of contents is written to a file that is read after the indexes have been \TEX/ed; there's one line of data for every starred section. The file \.{common.toc} might look like this: -$$\lpile{\.{\\ZZ \{Introduction\}\{0\}\{1\}\{28\}\{\}}\cr - \.{\\ZZ \{The character set\}\{2\}\{5\}\{29\}\{\}}\cr}$$ +$$\lpile{\.{\\ZZ \{Introduction\}\{0\}\{1\}\{29\}\{\}}\cr + \.{\\ZZ \{The character set\}\{1\}\{21\}\{35\}\{\}}\cr}$$ and so on. The \.{\\topofcontents} macro could redefine \.{\\ZZ} so that the information appears in any desired format. (See also point~19 below.) diff --git a/web/c_cpp/cweb/prod.w b/web/c_cpp/cweb/prod.w index cba9473fd0..ff33c57a46 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.6 --- December 2021 +% Version 4.7 --- February 2022 % @ Here is a table of all the productions. Each production that combines two or more consecutive scraps implicitly inserts a {\tt \$} |