diff options
author | Norbert Preining <norbert@preining.info> | 2022-06-07 03:01:10 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-06-07 03:01:10 +0000 |
commit | 76cfdb3c84a9a4d5d06a9f785b2bed2b44098806 (patch) | |
tree | b552a509a35d1f669c9d390a0d70809bb1030571 /web/c_cpp | |
parent | 89e8f58007e3fa8841a95b1e3d7efeacced6aed5 (diff) |
CTAN sync 202206070301
Diffstat (limited to 'web/c_cpp')
-rw-r--r-- | web/c_cpp/cweb/Makefile | 8 | ||||
-rw-r--r-- | web/c_cpp/cweb/comm-mac.ch | 4 | ||||
-rw-r--r-- | web/c_cpp/cweb/comm-ql.ch | 8 | ||||
-rw-r--r-- | web/c_cpp/cweb/common.c | 6 | ||||
-rw-r--r-- | web/c_cpp/cweb/common.h | 2 | ||||
-rw-r--r-- | web/c_cpp/cweb/common.w | 12 | ||||
-rw-r--r-- | web/c_cpp/cweb/ctang-bs.ch | 4 | ||||
-rw-r--r-- | web/c_cpp/cweb/ctang-pc.ch | 4 | ||||
-rw-r--r-- | web/c_cpp/cweb/ctang-ql.ch | 8 | ||||
-rw-r--r-- | web/c_cpp/cweb/ctang-vms.ch | 4 | ||||
-rw-r--r-- | web/c_cpp/cweb/ctang-w32.ch | 4 | ||||
-rw-r--r-- | web/c_cpp/cweb/ctangle.c | 73 | ||||
-rw-r--r-- | web/c_cpp/cweb/ctangle.w | 21 | ||||
-rw-r--r-- | web/c_cpp/cweb/cweav-bs.ch | 4 | ||||
-rw-r--r-- | web/c_cpp/cweb/cweav-pc.ch | 4 | ||||
-rw-r--r-- | web/c_cpp/cweb/cweav-ql.ch | 8 | ||||
-rw-r--r-- | web/c_cpp/cweb/cweav-vms.ch | 4 | ||||
-rw-r--r-- | web/c_cpp/cweb/cweav-w32.ch | 4 | ||||
-rw-r--r-- | web/c_cpp/cweb/cweave.w | 105 | ||||
-rw-r--r-- | web/c_cpp/cweb/cwebmac.tex | 36 | ||||
-rw-r--r-- | web/c_cpp/cweb/cwebman.pdf | bin | 346104 -> 346011 bytes | |||
-rw-r--r-- | web/c_cpp/cweb/cwebman.tex | 15 | ||||
-rw-r--r-- | web/c_cpp/cweb/prod.w | 35 |
23 files changed, 198 insertions, 175 deletions
diff --git a/web/c_cpp/cweb/Makefile b/web/c_cpp/cweb/Makefile index 92e59b857b..e3db8819c6 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.7 --- February 2022 +# Version 4.8 --- June 2022 # Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth @@ -13,7 +13,7 @@ # entire resulting derived work is given a different name and distributed # under the terms of a permission notice identical to this one. -# +# # Read the README file, then edit this file to reflect local conditions # @@ -50,7 +50,7 @@ TCHANGES= WCHANGES= # We keep debugging info around, for fun, but most users don't need it -CFLAGS = -g +CFLAGS = -g # -Wall -Wextra -Wimplicit-fallthrough=2 # check compiler warnings #CFLAGS = -O LINKFLAGS = -g #LINKFLAGS = -s # for smaller (stripped) executables on many UNIX systems @@ -138,7 +138,7 @@ common.o: common.c $(CC) $(CFLAGS) -DCWEBINPUTS=\"$(CWEBINPUTS)\" -c common.c ctangle: ctangle.o common.o - $(CC) $(LINKFLAGS) -o ctangle ctangle.o common.o + $(CC) $(LINKFLAGS) -o ctangle ctangle.o common.o ctangle.c: ctangle.w $(TCHANGES) common.h $(CTANGLE) ctangle $(TCHANGES) diff --git a/web/c_cpp/cweb/comm-mac.ch b/web/c_cpp/cweb/comm-mac.ch index 6d795ff4e8..6bad610d1b 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.7)} + \centerline{(Version 4.8)} @y - \centerline{(Version 4.7 for MacOS)} + \centerline{(Version 4.8 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 aa451c7455..52c4834bed 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.7)} +\def\title{Common code for CTANGLE and CWEAVE (Version 4.8)} \def\topofcontents{\null\vfill \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and {\ttitlefont CWEAVE}} \vskip 15pt - \centerline{(Version 4.7)} + \centerline{(Version 4.8)} \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.7)} +\def\title{Common code for CTANGLE and CWEAVE (QL Version 4.8)} \def\topofcontents{\null\vfill \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and {\ttitlefont CWEAVE}} \vskip 15pt - \centerline{(Version 4.7)} + \centerline{(Version 4.8)} \vfill} \def\botofcontents{\vfill \noindent diff --git a/web/c_cpp/cweb/common.c b/web/c_cpp/cweb/common.c index 00575a0ebf..2b5c7c9ccc 100644 --- a/web/c_cpp/cweb/common.c +++ b/web/c_cpp/cweb/common.c @@ -732,8 +732,10 @@ else{ if((l= strlen(CWEBINPUTS))> max_file_name_length-2)too_long(); strcpy(temp_file_name,CWEBINPUTS); #else -l= 0; +#line 474 "common.w" + l= 0; #endif +#line 476 "common.w" } if(l> 0){ if(k+l+2>=cur_file_name_end)too_long(); @@ -1015,7 +1017,7 @@ print_section_name(r); err_print(">"); } else if(name_len<prefix_length(r))set_prefix_length(r,name_len); - +/* fall through */ case equal:break; case extension:if(!ispref||first<=last) extend_section_name(r,first,last+1,ispref); diff --git a/web/c_cpp/cweb/common.h b/web/c_cpp/cweb/common.h index 4d2caba05d..186e87fd63 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.7 --- February 2022 (works also with later versions) +% Version 4.8 --- June 2022 (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 941b7206cc..4ec17241c3 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.7 --- February 2022 +% Version 4.8 --- June 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.7)} +\def\title{Common code for CTANGLE and CWEAVE (Version 4.8)} \def\topofcontents{\null\vfill \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and {\ttitlefont CWEAVE}} \vskip 15pt - \centerline{(Version 4.7)} + \centerline{(Version 4.8)} \vfill} \def\botofcontents{\vfill \noindent @@ -66,8 +66,8 @@ The file begins with a few basic definitions. @<Global variables@>@/ @<Predeclaration of procedures@> -@ The details will be filled in due course. The interface of this module -is included first. It is also used by the main programs. +@ The details will be filled in due course. The interface |"common.h"| of this +\.{COMMON} module is included first. It is also used by the main programs. @i common.h @@ -919,7 +919,7 @@ switch(section_name_cmp(&first,name_len,r)) { err_print(">"); } else if (name_len<prefix_length(r)) set_prefix_length(r,name_len); - /* fall through */ + @=/* fall through */@>@; case equal: break; case extension: if (!ispref || first<=last) extend_section_name(r,first,last+1,ispref); diff --git a/web/c_cpp/cweb/ctang-bs.ch b/web/c_cpp/cweb/ctang-bs.ch index ecdb4be591..911d7d5dcf 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.7)" +@d banner "This is CTANGLE (Version 4.8)" @y The ``banner line'' defined here should be changed whenever \.{CTANGLE} is modified. -@d banner "This is CTANGLE (Version 4.7pc/big)" +@d banner "This is CTANGLE (Version 4.8pc/big)" @z diff --git a/web/c_cpp/cweb/ctang-pc.ch b/web/c_cpp/cweb/ctang-pc.ch index 459356a59e..00c1937307 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.7)" +@d banner "This is CTANGLE (Version 4.8)" @y -@d banner "This is CTANGLE (Version 4.7pc)" +@d banner "This is CTANGLE (Version 4.8pc)" @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 727b20ea9c..809dff497d 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.7)} +\def\title{CTANGLE (Version 4.8)} @y -\def\title{CTANGLE (QL Version 4.7)} +\def\title{CTANGLE (QL Version 4.8)} @z @x section 1 -@d banner "This is CTANGLE (Version 4.7)" +@d banner "This is CTANGLE (Version 4.8)" @y -@d banner "This is CTANGLE (QL Version 4.7)" +@d banner "This is CTANGLE (QL Version 4.8)" @z @x diff --git a/web/c_cpp/cweb/ctang-vms.ch b/web/c_cpp/cweb/ctang-vms.ch index e494b86f4f..a928d912cf 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.7)" +@d banner "This is CTANGLE (Version 4.8)" @y -@d banner "This is CTANGLE (VAX/VMS Version 4.7)" +@d banner "This is CTANGLE (VAX/VMS Version 4.8)" @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 d54b84b9f9..ab76415410 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.7)" +@d banner "This is CTANGLE (Version 4.8)" @y -@d banner "This is CTANGLE (Version 4.7win32)" +@d banner "This is CTANGLE (Version 4.8win32)" @z @x diff --git a/web/c_cpp/cweb/ctangle.c b/web/c_cpp/cweb/ctangle.c index d7bc2ecbf8..262469d611 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.7)" \ +#define banner "This is CTANGLE (Version 4.8)" \ #define ctangle false #define cweave true \ @@ -434,15 +434,15 @@ static eight_bits get_next(void); static void scan_repl(eight_bits); /*:84*//*91:*/ -#line 1404 "ctangle.w" +#line 1411 "ctangle.w" static void scan_section(void); /*:91*//*99:*/ -#line 1481 "ctangle.w" +#line 1488 "ctangle.w" static void phase_one(void); /*:99*//*101:*/ -#line 1514 "ctangle.w" +#line 1521 "ctangle.w" static void skip_limbo(void); /*:101*/ @@ -866,7 +866,7 @@ case string:if(out_state==verbatim)out_state= normal; else out_state= verbatim;break; case'/':C_putc('/');out_state= post_slash;break; case'*':if(out_state==post_slash)C_putc(' '); - +/* fall through */ default:C_putc(cur_char);out_state= normal;break; } } @@ -1281,11 +1281,18 @@ while(true)switch(a= get_next()){ /*86:*/ #line 1244 "ctangle.w" -case identifier:store_id(a);break; +case identifier:store_id(a); +if(*buffer=='#'&&( +(id_loc-id_first==5&&strncmp("endif",id_first,5)==0)|| +(id_loc-id_first==4&&strncmp("else",id_first,4)==0)|| +(id_loc-id_first==4&&strncmp("elif",id_first,4)==0))) + +print_where= true; +break; case section_name:if(t!=section_name)goto done; else{ /*87:*/ -#line 1278 "ctangle.w" +#line 1285 "ctangle.w" { char*try_loc= loc; while(*try_loc==' '&&try_loc<limit)try_loc++; @@ -1298,7 +1305,7 @@ if(*try_loc=='=')err_print("! Missing `@ ' before a named section"); } /*:87*/ -#line 1248 "ctangle.w" +#line 1255 "ctangle.w" a= cur_section_name-name_dir; app_repl((a/0400)+0250); @@ -1321,7 +1328,7 @@ store_id(a); } /*:85*/ -#line 1252 "ctangle.w" +#line 1259 "ctangle.w" } break; @@ -1350,13 +1357,13 @@ store_id(a); } /*:85*/ -#line 1262 "ctangle.w" +#line 1269 "ctangle.w" } break; case constant:case string: /*88:*/ -#line 1295 "ctangle.w" +#line 1302 "ctangle.w" app_repl(a); while(id_first<id_loc){ @@ -1372,12 +1379,12 @@ app_repl(*id_first++); app_repl(a); /*:88*/ -#line 1266 "ctangle.w" +#line 1273 "ctangle.w" break; case ord: /*89:*/ -#line 1313 "ctangle.w" +#line 1320 "ctangle.w" { int c= (int)((eight_bits)*id_first); if(c=='\\'){ @@ -1427,7 +1434,7 @@ app_repl(constant); } /*:89*/ -#line 1269 "ctangle.w" +#line 1276 "ctangle.w" break; case definition:case format_code:case begin_C:if(t!=section_name)goto done; @@ -1451,7 +1458,7 @@ cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; } /*:83*//*90:*/ -#line 1371 "ctangle.w" +#line 1378 "ctangle.w" static void scan_section(void) @@ -1466,7 +1473,7 @@ printf("*%d",(int)section_count);update_terminal; next_control= ignore; while(true){ /*92:*/ -#line 1412 "ctangle.w" +#line 1419 "ctangle.w" while(next_control<definition) @@ -1475,11 +1482,11 @@ loc-= 2;next_control= get_next(); } /*:92*/ -#line 1385 "ctangle.w" +#line 1392 "ctangle.w" if(next_control==definition){ /*93:*/ -#line 1419 "ctangle.w" +#line 1426 "ctangle.w" while((next_control= get_next())=='\n'); if(next_control!=identifier){ @@ -1495,7 +1502,7 @@ scan_repl(macro); cur_text->text_link= macro; /*:93*/ -#line 1387 "ctangle.w" +#line 1394 "ctangle.w" continue; } @@ -1505,14 +1512,14 @@ p= name_dir;break; if(next_control==section_name){ p= cur_section_name; /*94:*/ -#line 1441 "ctangle.w" +#line 1448 "ctangle.w" while((next_control= get_next())=='+'); if(next_control!='='&&next_control!=eq_eq) continue; /*:94*/ -#line 1395 "ctangle.w" +#line 1402 "ctangle.w" break; } @@ -1520,20 +1527,20 @@ return; } no_where= print_where= false; /*95:*/ -#line 1446 "ctangle.w" +#line 1453 "ctangle.w" /*96:*/ -#line 1451 "ctangle.w" +#line 1458 "ctangle.w" store_two_bytes((sixteen_bits)(0150000+section_count)); /*:96*/ -#line 1447 "ctangle.w" +#line 1454 "ctangle.w" scan_repl(section_name); /*97:*/ -#line 1455 "ctangle.w" +#line 1462 "ctangle.w" if(p==name_dir||p==NULL){ last_unnamed->text_link= cur_text-text_info;last_unnamed= cur_text; @@ -1550,16 +1557,16 @@ cur_text->text_link= section_flag; /*:97*/ -#line 1449 "ctangle.w" +#line 1456 "ctangle.w" /*:95*/ -#line 1401 "ctangle.w" +#line 1408 "ctangle.w" } /*:90*//*98:*/ -#line 1470 "ctangle.w" +#line 1477 "ctangle.w" static void phase_one(void){ @@ -1572,7 +1579,7 @@ check_complete(); } /*:98*//*100:*/ -#line 1486 "ctangle.w" +#line 1493 "ctangle.w" static void skip_limbo(void) @@ -1586,7 +1593,7 @@ char c= *loc++; switch(ccode[(eight_bits)c]){ case new_section:return; case translit_code:/*102:*/ -#line 1516 "ctangle.w" +#line 1523 "ctangle.w" while(xisspace(*loc)&&loc<limit)loc++; loc+= 3; @@ -1611,7 +1618,7 @@ translit[i-0200][loc-beg]= '\0'; } /*:102*/ -#line 1498 "ctangle.w" +#line 1505 "ctangle.w" break; case format_code:case'@':break; case control_text:if(c=='q'||c=='Q'){ @@ -1620,7 +1627,7 @@ if(*(loc-1)!='>') err_print("! Double @ should be used in control text"); break; -} +}/* otherwise fall through */ default:err_print("! Double @ should be used in limbo"); } @@ -1629,7 +1636,7 @@ default:err_print("! Double @ should be used in limbo"); } /*:100*//*103:*/ -#line 1542 "ctangle.w" +#line 1549 "ctangle.w" void print_stats(void){ diff --git a/web/c_cpp/cweb/ctangle.w b/web/c_cpp/cweb/ctangle.w index 1ee2aaf195..0c372e59ed 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.7 --- February 2022 +% Version 4.8 --- June 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.7)} +\def\title{CTANGLE (Version 4.8)} \def\topofcontents{\null\vfill \centerline{\titlefont The {\ttitlefont CTANGLE} processor} \vskip 15pt - \centerline{(Version 4.7)} + \centerline{(Version 4.8)} \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.7)" +@d banner "This is CTANGLE (Version 4.8)" @c @<Include files@>@/ @@ -666,7 +666,7 @@ restart: else out_state=verbatim; break; case '/': C_putc('/'); out_state=post_slash; break; case '*': if (out_state==post_slash) C_putc(' '); - /* fall through */ + @=/* fall through */@>@; default: C_putc(cur_char); out_state=normal; break; } } @@ -1242,7 +1242,14 @@ file name. } @ @<In cases that |a| is...@>=@t\1\quad@> -case identifier: store_id(a); break; +case identifier: store_id(a); + if (*buffer=='#' && @| ( + ( id_loc-id_first==5 && strncmp("endif",id_first,5)==0 ) || @| + ( id_loc-id_first==4 && strncmp("else",id_first,4)==0 ) || @| + ( id_loc-id_first==4 && strncmp("elif",id_first,4)==0 ) ) ) + /* Avoid preprocessor calamities */ + print_where=true; + break; case section_name: if (t!=section_name) goto done; else { @<Was an `\.{@@}' missed here?@>@; @@ -1503,7 +1510,7 @@ skip_limbo(void) err_print("! Double @@ should be used in control text"); @.Double @@ should be used...@> break; - } /* otherwise fall through */ + } @=/* otherwise fall through */@>@; default: err_print("! Double @@ should be used in limbo"); @.Double @@ should be used...@> } diff --git a/web/c_cpp/cweb/cweav-bs.ch b/web/c_cpp/cweb/cweav-bs.ch index c0fc3981ae..5a53a8ad0a 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.7)" +@d banner "This is CWEAVE (Version 4.8)" @y The ``banner line'' defined here should be changed whenever \.{CWEAVE} is modified. -@d banner "This is CWEAVE (Version 4.7pc/big)" +@d banner "This is CWEAVE (Version 4.8pc/big)" @z diff --git a/web/c_cpp/cweb/cweav-pc.ch b/web/c_cpp/cweb/cweav-pc.ch index 101b4d8a7a..eb2e394265 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.7)" +@d banner "This is CWEAVE (Version 4.8)" @y -@d banner "This is CWEAVE (Version 4.7pc)" +@d banner "This is CWEAVE (Version 4.8pc)" @z @x section 17 diff --git a/web/c_cpp/cweb/cweav-ql.ch b/web/c_cpp/cweb/cweav-ql.ch index 041cba0a83..94e1f54304 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.7)} +\def\title{CWEAVE (Version 4.8)} @y -\def\title{CWEAVE (QL Version 4.7)} +\def\title{CWEAVE (QL Version 4.8)} @z @x section 1 -@d banner "This is CWEAVE (Version 4.7)" +@d banner "This is CWEAVE (Version 4.8)" @y -@d banner "This is CWEAVE (QL Version 4.7)" +@d banner "This is CWEAVE (QL Version 4.8)" @z @x diff --git a/web/c_cpp/cweb/cweav-vms.ch b/web/c_cpp/cweb/cweav-vms.ch index 5078c16541..5debd4bd92 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.7)" +@d banner "This is CWEAVE (Version 4.8)" @y -@d banner "This is CWEAVE (VAX/VMS Version 4.7)" +@d banner "This is CWEAVE (VAX/VMS Version 4.8)" @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 84e6a321a5..f40d6e3195 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.7)" +@d banner "This is CWEAVE (Version 4.8)" @y -@d banner "This is CWEAVE (Version 4.7win32)" +@d banner "This is CWEAVE (Version 4.8win32)" @z @x diff --git a/web/c_cpp/cweb/cweave.w b/web/c_cpp/cweb/cweave.w index 5db1c371b5..7de3b4d1d9 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.7 --- February 2022 +% Version 4.8 --- June 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.7)} +\def\title{CWEAVE (Version 4.8)} \def\topofcontents{\null\vfill \centerline{\titlefont The {\ttitlefont CWEAVE} processor} \vskip 15pt - \centerline{(Version 4.7)} + \centerline{(Version 4.8)} \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.7)" +@d banner "This is CWEAVE (Version 4.8)" @c @<Include files@>@/ @@ -948,7 +948,7 @@ switch(ccode[c=*loc++]) { case verbatim: @<Scan a verbatim string@>@; case ord: @<Get a string@>@; case xref_roman: case xref_wildcard: case xref_typewriter: case noop: - case TeX_string: skip_restricted(); /* fall through */ + case TeX_string: skip_restricted(); @=/* fall through */@>@; default: return ccode[c]; } @@ -2317,10 +2317,14 @@ tokens, and intercalates a `\.{\$}' token if necessary. When in doubt what to use, use |big_app|. @d app(a) *(tok_ptr++)=(token)(a) +@# @d big_app2(a) big_app1(a);@+big_app1(a+1) @d big_app3(a) big_app2(a);@+big_app1(a+2) @d big_app4(a) big_app3(a);@+big_app1(a+3) +@# @d big_app1_insert(p,c) big_app1(p);@+big_app(c);@+big_app1(p+1) +@d big_app1_insert_str(p,s) big_app1(p);@+app_str(s);@+big_app1(p+1) +@d big_app2_insert(p,c) big_app2(p);@+big_app(c);@+big_app2(p+2) @<Predecl...@>= static void app_str(const char *);@/ @@ -2356,6 +2360,11 @@ static int cur_mathness, init_mathness; understanding the format by comparing the code with the symbolic productions as they were listed earlier. +@d begin_math if (cur_mathness==maybe_math) init_mathness=yes_math; + else if (cur_mathness==no_math) app_str("${}") +@d end_math if (cur_mathness==maybe_math) init_mathness=no_math; + else if (cur_mathness==yes_math) app_str("{}$") + @c static void app_str( @@ -2370,12 +2379,10 @@ token a) { if (a==' ' || (a>=big_cancel && a<=big_force) || a==dindent) /* non-math token */ { - if (cur_mathness==maybe_math) init_mathness=no_math; - else if (cur_mathness==yes_math) app_str("{}$"); + end_math; cur_mathness=no_math; } else { - if (cur_mathness==maybe_math) init_mathness=yes_math; - else if (cur_mathness==no_math) app_str("${}"); + begin_math; cur_mathness=yes_math; } app(a); @@ -2387,13 +2394,11 @@ scrap_pointer a) { switch (a->mathness % 4) { /* left boundary */ case (no_math): - if (cur_mathness==maybe_math) init_mathness=no_math; - else if (cur_mathness==yes_math) app_str("{}$"); + end_math; cur_mathness=a->mathness / 4; /* right boundary */ break; case (yes_math): - if (cur_mathness==maybe_math) init_mathness=yes_math; - else if (cur_mathness==no_math) app_str("${}"); + begin_math; cur_mathness=a->mathness / 4; /* right boundary */ break; case (maybe_math): /* no changes */ break; @@ -2535,10 +2540,12 @@ text_pointer p) if (name_dir[r].ilk==case_like) return case_found; if (name_dir[r].ilk==operator_like) return operator_found; if (name_dir[r].ilk!=raw_int) break; + @=/* else fall through */@>@; case 1: return j; case 4: case 5: /* |tok_flag| or |inner_tok_flag| */ if ((q=find_first_ident(tok_start+r))!=no_ident_found) return q; + @=/* else fall through */@>@; default: ; /* char, |section_flag|, fall thru: move on to next token */ if (*j==inserted) return no_ident_found; /* ignore inserts */ else if (*j==qualifier) j++; /* bypass namespace qualifier */ @@ -2642,15 +2649,14 @@ to be performed. @<Cases for |exp|@>= if (cat1==lbrace || cat1==int_like || cat1==decl) { - make_underlined(pp); big_app1(pp); big_app(dindent); + make_underlined(pp); big_app(dindent); big_app1(pp); reduce(pp,1,fn_decl,0,1); } else if (cat1==unop) squash(pp,2,exp,-2,2); else if ((cat1==binop || cat1==ubinop) && cat2==exp) squash(pp,3,exp,-2,3); else if (cat1==comma && cat2==exp) { - big_app2(pp); - app(opt); app('9'); big_app1(pp+2); reduce(pp,3,exp,-2,4); + big_app2(pp); app(opt); app('9'); big_app1(pp+2); reduce(pp,3,exp,-2,4); } else if (cat1==lpar && cat2==rpar && cat3==colon) reduce(pp+3,0,base,0,5); else if (cat1==cast && cat2==colon) reduce(pp+2,0,base,0,5); @@ -2674,7 +2680,7 @@ else if (cat1==colcol && cat2==int_like) squash(pp,3,int_like,-2,152); @ @<Cases for |lpar|@>= if ((cat1==exp||cat1==ubinop) && cat2==rpar) squash(pp,3,exp,-2,11); else if (cat1==rpar) { - big_app1(pp); app_str("\\,"); big_app1(pp+1); + big_app1_insert_str(pp,"\\,"); @.\\,@> reduce(pp,2,exp,-2,12); } @@ -2712,7 +2718,9 @@ if (cat1==binop) { @ @<Cases for |cast|@>= if (cat1==lpar) squash(pp,2,lpar,-1,21); else if (cat1==exp) { - big_app1_insert(pp,' '); reduce(pp,2,exp,-2,21); + big_app1_insert_str(pp,"\\,"); +@.\\,@> + reduce(pp,2,exp,-2,21); } else if (cat1==semi) reduce(pp,0,exp,-2,22); @@ -2745,7 +2753,7 @@ else if (cat1==colcol) squash(pp,2,colcol,-1,32); @ @<Cases for |decl_head|@>= if (cat1==comma) { - big_app2(pp); big_app(' '); reduce(pp,2,decl_head,-1,33); + big_app2(pp); app(opt); app('9'); reduce(pp,2,decl_head,-1,33); } else if (cat1==ubinop) { big_app1_insert(pp,'{'); big_app('}'); reduce(pp,2,decl_head,-1,34); @@ -2757,7 +2765,7 @@ else if ((cat1==binop||cat1==colon) && cat2==exp && (cat3==comma || cat3==semi || cat3==rpar)) squash(pp,3,decl_head,-1,36); else if (cat1==cast) squash(pp,2,decl_head,-1,37); -else if (cat1==lbrace || cat1==int_like || cat1==decl) { +else if (cat1==int_like || cat1==lbrace || cat1==decl) { big_app(dindent); squash(pp,1,fn_decl,0,38); } else if (cat1==semi) squash(pp,2,decl,-1,39); @@ -2776,7 +2784,7 @@ else if (cat1==stmt || cat1==function) { @ @<Cases for |base|@>= if (cat1==int_like || cat1==exp) { if (cat2==comma) { - big_app1(pp); big_app(' '); big_app2(pp+1); + big_app1_insert(pp,' '); big_app1(pp+2); app(opt); app('9'); reduce(pp,3,base,0,42); } else if (cat2==lbrace) { @@ -2795,7 +2803,7 @@ else if (cat1==exp||cat1==int_like) { big_app1_insert(pp,' '); if (cat2==semi) reduce(pp,2,decl_head,0,45); else { - big_app(' '); big_app1(pp+2);reduce(pp,3,struct_head,0,46); + big_app(' '); big_app1(pp+2); reduce(pp,3,struct_head,0,46); } } else if (cat2==colon) reduce(pp+2,0,base,2,47); @@ -2817,7 +2825,7 @@ if ((cat1==decl || cat1==stmt || cat1==function) && cat2==rbrace) { reduce(pp,3,int_like,-2,49); } else if (cat1==rbrace) { - big_app1(pp); app_str("\\,"); big_app1(pp+1); + big_app1_insert_str(pp,"\\,"); @.\\,@> reduce(pp,2,int_like,-2,50); } @@ -2835,13 +2843,13 @@ else if (cat1==attr) { } @ @<Cases for |function|@>= -if (cat1==function || cat1==decl || cat1==stmt) { +if (cat1==stmt || cat1==decl || cat1==function) { big_app1_insert(pp,big_force); reduce(pp,2,cat1,-1,53); } @ @<Cases for |lbrace|@>= if (cat1==rbrace) { - big_app1(pp); app_str("\\,"); big_app1(pp+1); + big_app1_insert_str(pp,"\\,"); @.\\,@> reduce(pp,2,stmt,-1,54); } @@ -2944,8 +2952,8 @@ grouped together on the same line. force_lines=true; @ @<Cases for |stmt|@>= -if (cat1==stmt||cat1==decl||cat1==function) { - big_app1_insert(pp, (cat1==function || cat1==decl) ? big_force : +if (cat1==stmt || cat1==decl || cat1==function) { + big_app1_insert(pp, (cat1==decl || cat1==function) ? big_force : force_lines ? force : break_space); reduce(pp,2,cat1,-1,76); } @@ -2954,13 +2962,13 @@ big_app(' '); squash(pp,1,stmt,-1,77); @ @<Cases for |lproc|@>= if (cat1==define_like) make_underlined(pp+2); -if (cat1==else_like || cat1==if_like || cat1==define_like) +if (cat1==if_like || cat1==else_like || cat1==define_like) squash(pp,2,lproc,0,78); else if (cat1==rproc) { app(inserted); squash(pp,2,insert,-1,79); } else if (cat1==exp || cat1==function) { if (cat2==rproc) { - app(inserted); big_app1(pp); big_app(' '); big_app2(pp+1); + app(inserted); big_app1_insert(pp,' '); big_app1(pp+2); reduce(pp,3,insert,-1,80); } else if (cat1==exp && cat2==exp && cat3==rproc) { @@ -2977,8 +2985,8 @@ if (cat1==semi) { else reduce(pp,0,exp,-2,82); @ @<Cases for |insert|@>= -if (cat1) - squash(pp,2,cat1,0,83); +if (cat1==function) + squash(pp,2,function,0,83); @ @<Cases for |prelangle|@>= init_mathness=cur_mathness=yes_math; @@ -2993,7 +3001,7 @@ app('>'); reduce(pp,1,binop,-2,85); @<Cases for |langle|@>= if (cat1==prerangle) { - big_app1(pp); app_str("\\,"); big_app1(pp+1); + big_app1_insert_str(pp,"\\,"); @.\\,@> reduce(pp,2,cast,-1,86); } @@ -3007,8 +3015,10 @@ else if ((cat1==struct_like) @| && (cat2==exp || cat2==int_like) @| && (cat3==comma || cat3==prerangle)) { make_underlined(pp+2); if (reserve_typenames) make_reserved(pp+2); - big_app2(pp); big_app(' '); big_app2(pp+2); - if (cat3==comma) reduce(pp,4,langle,0,153); + big_app2_insert(pp,' '); + if (cat3==comma) { + app(opt); app('9'); reduce(pp,4,langle,0,153); + } else reduce(pp,4,cast,-1,154); } @@ -3091,21 +3101,19 @@ if ((cat1==int_like || cat1==cast) && (cat2==comma || cat2==semi)) else if (cat1==int_like) { big_app1_insert(pp,' '); reduce(pp,2,typedef_like,0,116); } -else if (cat1==exp && cat2!=lpar && cat2!=exp && cat2!=cast) { +else if (cat1==exp && cat2!=lpar && cat2!=lbrack && cat2!=exp && cat2!=cast) { make_underlined(pp+1); make_reserved(pp+1); big_app1_insert(pp,' '); reduce(pp,2,typedef_like,0,117); } -else if (cat1==comma) { - big_app2(pp); big_app(' '); reduce(pp,2,typedef_like,0,118); -} +else if (cat1==comma) squash(pp,2,typedef_like,0,118); else if (cat1==semi) squash(pp,2,decl,-1,119); else if (cat1==ubinop && (cat2==ubinop || cat2==cast)) { big_app('{'); big_app1_insert(pp+1,'}'); reduce(pp+1,2,cat2,0,120); } @ @<Cases for |delete_like|@>= -if (cat1==lpar && cat2==rpar) { - big_app2(pp); app_str("\\,"); big_app1(pp+2); +if (cat1==lbrack && cat2==rbrack) { + big_app1(pp); big_app1_insert_str(pp+1,"\\,"); @.\\,@> reduce(pp,3,delete_like,0,121); } @@ -3134,7 +3142,7 @@ else reduce(pp,0,lpar,-1,129); if (cat1==rbrack && cat2==rbrack) squash(pp,3,attr,-1,131); else if (cat1==exp) squash(pp,2,attr_head,0,132); else if (cat1==using_like && cat2==exp && cat3==colon) { - big_app2(pp); big_app(' '); big_app2(pp+2); big_app(' '); + big_app2_insert(pp,' '); big_app(' '); reduce(pp,4,attr_head,0,133); } else if (cat1==comma) squash(pp,2,attr_head,0,145); @@ -3594,7 +3602,7 @@ section, it will be made into a scrap when |finish_C| is called. There's a known bug here, in cases where an adjacent scrap is |prelangle| or |prerangle|. Then the \TEX/ string can disappear when the \.{\\langle} or \.{\\rangle} becomes \.{<} or \.{>}. -For example, if the user writes \.{\v x<@@ty@@>\v}, the \TEX/ string +For example, if the user writes \.{\v x<@@ty@@><42\v}, the \TEX/ string \.{\\hbox\{y\}} eventually becomes part of an |insert| scrap, which is combined with a |prelangle| scrap and eventually lost. The best way to work around this bug is probably to enclose the \.{@@t...@@>} in \.{@@[...@@]} so that @@ -3919,7 +3927,7 @@ make_output(void) /* outputs the equivalents of tokens */ case end_translation: return; case identifier: case res_word: @<Output an identifier@>@; break; case section_code: @<Output a section name@>@; break; - case math_rel: out_str("\\MRL{"@q}@>); /* fall through */ + case math_rel: out_str("\\MRL{"@q}@>); @=/* fall through */@>@; @.\\MRL@> case noop: case inserted: break; case cancel: case big_cancel: c=0; b=a; @@ -3929,9 +3937,9 @@ make_output(void) /* outputs the equivalents of tokens */ if ((a<indent && !(b==big_cancel&&a==' ')) @| || (a>big_force && a!=dindent)) break; switch (a) { + case dindent: c++; @=/* fall through */@>@; case indent: c++; break; case outdent: c--; break; - case dindent: c+=2; break; case opt: a=get_output(); } } @@ -3941,11 +3949,11 @@ make_output(void) /* outputs the equivalents of tokens */ if (a!=big_force) { out_str("\\1\\1"); goto reswitch; } - else dindent_pending=true; /* fall through */ + else dindent_pending=true; @=/* fall through */@>@; case indent: case outdent: case opt: case backup: case break_space: case force: case big_force: case preproc_line: @<Output a control, look ahead in case of line breaks, possibly |goto reswitch|@>@; break; - case quoted_char: out(*(cur_tok++)); /* fall through */ + case quoted_char: out(*(cur_tok++)); @=/* fall through */@>@; case qualifier: break; default: out(a); /* otherwise |a| is an ordinary character */ } @@ -4100,7 +4108,7 @@ while (k<k_limit) { switch (b) { case ' ': case '\\': case '#': case '%': case '$': case '^': case '{': case '}': case '~': case '&': case '_': - out('\\'); /* falls through */ + out('\\'); @=/* falls through */@>@; @.\\\ @> @.\\\\@> @.\\\#@> @@ -4353,7 +4361,7 @@ it starts after we scan the matching `\.)'. app_scrap(raw_int,no_math); if ((next_control=get_next())==')') { app(next_control); next_control=get_next(); break; - } /* otherwise fall through */ + } @=/* otherwise fall through */@>@; default: err_print("! Improper macro definition"); break; } app('$'); @@ -4786,6 +4794,7 @@ lowcase: out_str("\\\\"); case wildcard: out_str("\\9");@+ goto not_an_identifier; @.\\9@> case typewriter: out_str("\\."); + @=/* fall through */@>@; @.\\.@> case roman: not_an_identifier: out_name(cur_name,false); goto name_done; case custom: diff --git a/web/c_cpp/cweb/cwebmac.tex b/web/c_cpp/cweb/cwebmac.tex index 9384d06886..e2d2ecb3a2 100644 --- a/web/c_cpp/cweb/cwebmac.tex +++ b/web/c_cpp/cweb/cwebmac.tex @@ -1,7 +1,7 @@ % standard macros for CWEB listings (in addition to plain.tex) -% Version 4.7--- January 2022 +% Version 4.8--- June 2022 \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros -\xdef\fmtversion{\fmtversion+CWEB4.7} +\xdef\fmtversion{\fmtversion+CWEB4.8} \chardef\cwebversion=4 \chardef\cwebrevision=7 \newif\ifpdf \ifx\pdf+\pdftrue\fi @@ -16,10 +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\ifhint +\ifx\HINTversion\undefined \hintfalse \else \hinttrue \fi \newif\ifacro \ifpdf\acrotrue\fi \ifpdftex\acrotrue\fi -\newif\ifacroHINT \ifacro\acroHINTtrue\fi \ifHINT\acroHINTtrue\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) @@ -70,7 +70,7 @@ tangles as \tentex "#2"\egroup\par} \def\noATL#1 #2 {} \def\noatl{\let\ATL=\noATL} % suppress output from @l -\def\ATH{{\acrofalse\X\kern-.5em:Preprocessor definitions\X}} +\def\ATH{{\acrohintfalse\X\kern-.5em:Preprocessor definitions\X}} \let\PB=\relax % hook for program brackets |...| in TeX part or section name \chardef\AM=`\& % ampersand character in a string @@ -130,7 +130,7 @@ \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}} + \baselineskip10pt\eightrm#1~\ifacrohint{\pdfnote#2.}\else#2\fi.\par}} \newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD \newtoks\toksE \newtoks\toksF \newtoks\usersanitizer @@ -251,7 +251,7 @@ \outlinest\let\outlinedone=\relax} \fi % End of pdf macros -\ifHINT +\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 @@ -267,8 +267,8 @@ \let\pdflink=\HINTlink \fi % End of HINT macros -% Common macros for \ifacro and \ifHINT -\ifacroHINT +% 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={} @@ -308,7 +308,7 @@ \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 + \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% @@ -382,7 +382,7 @@ \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 - \ifacroHINT{\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 @@ -476,7 +476,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 + \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 @@ -487,7 +487,7 @@ \message{Index:} \parskip 0pt plus .5pt \outer\def\I##1, ##2.{\par\hangindent2em\noindent##1:\kern1em - \ifacroHINT\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 @@ -502,7 +502,7 @@ \message{Section names:} \output={\normaloutput\page\lheader\rheader} \setpage - \def\note##1##2.{\quad{\eightrm##1~\ifacroHINT{\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 @@ -539,16 +539,16 @@ \pageno=\contentspagenumber \def\grouptitle{TABLE OF CONTENTS} \message{Table of contents:} - \ifHINT\HINThome\fi% Mark the Table of contents as home page + \ifhint\HINThome\fi% Mark the Table of contents as home page \topofcontents \startpdf - \line{\hfil Section\ifHINT\else\hbox to3em{\hss Page}\fi}% No Page in HINT + \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 - \ \ifHINT + \ \ifhint \HINTlink{#3}{\romannumeral#3}% No page numbers in HINT \HINTcontents{#1}{#2}{#3}% \else\ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi diff --git a/web/c_cpp/cweb/cwebman.pdf b/web/c_cpp/cweb/cwebman.pdf Binary files differindex 134c823818..bed70a685f 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 c36b26c9ff..87523dbced 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\HINTfalse\acroHINTfalse +\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.7)} +\def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 4.8)} % 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.7 --- February 2022)} +\vskip 18pt\centerline{(Version 4.8 --- June 2022)} \vskip 24pt \centerline{\authorfont Donald E. Knuth and Silvio Levy} \vfill @@ -1133,7 +1133,7 @@ are just \\{exp}s. Thus it would tell \TEX/ to format `\X2:Argument declarations\X' on the same line as `$\\{main}(\\{argc},\39\\{argv}{}$)'. In this case you should help \.{CWEAVE} by putting `\.{@/}' after -`\.{main(argc,argv)}'. +`\.{main(argc,argv)}' (plus `\.{@t\\qquad@>}' for consistent indentation). \.{CWEAVE} automatically inserts a bit of extra space between declarations and the first apparent statement of a block. One way to defeat this @@ -1337,6 +1337,7 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); } /*:27*//*32:*/ +#line 296 "common.w" !endgroup \endgroup \vfill\eject @@ -1390,7 +1391,7 @@ ${}\\{change\_line}\PP;{}$\6 \&{if} ${}(\\{buffer}[\T{0}]\I\.{'@'}){}$\1\5 \&{continue};\2\6 \&{if} (\\{xisupper}(\\{buffer}[\T{1}]))\1\5 -${}\\{buffer}[\T{1}]\K\\{tolower}{}$((\&{int}) \\{buffer}[\T{1}]);\2\6 +${}\\{buffer}[\T{1}]\K\\{tolower}((\&{int})\,\\{buffer}[\T{1}]);{}$\2\6 \&{if} ${}(\\{buffer}[\T{1}]\E\.{'x'}){}$\1\5 \&{break};\2\6 \&{if} ${}(\\{buffer}[\T{1}]\E\.{'y'}\V\\{buffer}[\T{1}]\E\.{'z'}\V\\{buffer}[% @@ -1468,7 +1469,7 @@ ${}\\{change\_line}\PP;{}$\6 \&{if} ${}(\\{buffer}[\T{0}]\I\.{'@'}){}$\1\5 \&{continue};\2\6 \&{if} (\\{xisupper}(\\{buffer}[\T{1}]))\1\5 -${}\\{buffer}[\T{1}]\K\\{tolower}{}$((\&{eight\_bits}) \\{buffer}[\T{1}]);\2\6 +${}\\{buffer}[\T{1}]\K\\{tolower}((\&{int})\,\\{buffer}[\T{1}]);{}$\2\6 \&{if} ${}(\\{buffer}[\T{1}]\E\.{'x'}){}$\1\5 \&{break};\2\6 \&{if} ${}(\\{buffer}[\T{1}]\E\.{'y'}\V\\{buffer}[\T{1}]\E\.{'z'}\V\\{buffer}[% @@ -1597,7 +1598,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.7)\}{ }\\vfill\}}\cr}$$ + \.{ { }\\vskip 15pt \\centerline\{(Version 4.8)\}{ }\\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. diff --git a/web/c_cpp/cweb/prod.w b/web/c_cpp/cweb/prod.w index ff33c57a46..1e6cb6194c 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.7 --- February 2022 +% Version 4.8 --- June 2022 % @ Here is a table of all the productions. Each production that combines two or more consecutive scraps implicitly inserts a {\tt \$} @@ -56,7 +56,7 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for |insert| & \altt\\{any} {\\{any} \\{any}} {\\{any} \\{any} \\{any}} & stmt; \4\4 \C{comment}\cr \+& |exp| \altt|lbrace| |int_like| |decl| - & |fn_decl| \altt|lbrace| |int_like| |decl| \hfill $F=E^*\,\\{din}$ + & |fn_decl| \altt|lbrace| |int_like| |decl| \hfill $F=\\{din}\,E^*$ & \malt {\\{main}(\,) $\{$} {$\\{main}(\\{ac},\\{av}){}$ \&{int} \\{ac};} \cr \+& |exp| |unop| & |exp| & $x\PP$ \cr @@ -90,7 +90,7 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \+& |binop| |binop| & |binop| \hfill $|math_rel|\,\.\{B_1\.\}\.\{B_2\.\}\.\}$ & |>>=|\cr \+& |cast| \alt |lpar| |exp| & \alt |lpar| |exp| \hfill - \alt $CL$ $C\.\ E$ & \malt {$(\&{double})(x+2)$} {(\&{double}) $x$} \cr + \alt $CL$ $C\.{\\,}E$ & \malt {$(\&{double})(x+2)$} {(\&{double})\,$x$} \cr \+& |cast| |semi| & |exp| |semi| & |(int);|\cr \+& |sizeof_like| |cast| & |exp| & |sizeof (double)|\cr \+& |sizeof_like| |exp| & |exp| \hfill $S\.\ E$ & \&{sizeof} $x$\cr @@ -109,7 +109,7 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \+& |colcol| \alt|exp| |int_like| & \alt|exp| |int_like| \hfill |qualifier| $C$\alt$E$ $I$ & \&C\DC$x$\cr \+& |colcol| |colcol| & |colcol| & \&C\DC\&B\DC\cr -\+& |decl_head| |comma| & |decl_head| \hfill $DC\.\ $ & \&{int} $x,{}$ \cr +\+& |decl_head| |comma| & |decl_head| \hfill $DC$\,|opt|9 & \&{int} $x,{}$ \cr \+& |decl_head| |ubinop| & |decl_head| \hfill $D\.\{U\.\}$ & |int *|\cr \+\dagit& |decl_head| |exp| & |decl_head| \hfill $DE^*$ & \&{int} $x$ \cr \+& |decl_head| \alt|binop| |colon| |exp| \altt|comma| |semi| |rpar| & @@ -118,7 +118,7 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for & \malt {\&{int} $f(\&{int}\ x=2)$} {\&{int} $b$ : 1} \cr \+& |decl_head| |cast| & |decl_head| & \&{int} $f$(\&{int})\cr \+& |decl_head| \altt|int_like| |lbrace| |decl| & |fn_decl| - \altt|int_like| |lbrace| |decl| \hfill $F=D\,\\{din}$ + \altt|int_like| |lbrace| |decl| \hfill $F=\\{din}\,D$ & \&{long} \\{time}(\,) $\{$\cr \+& |decl_head| |semi| & |decl| & \&{int} $n$;\cr \+& |decl| |decl| & |decl| \hfill $D_1\,|force|\,D_2$ @@ -166,7 +166,7 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for $|force|\,E\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|$ & \&{else} $x=0;$\cr \+& |else_head| \alt|stmt| |exp| & |stmt| \hfill - $|force|\,E\,\\{bsp}\,|noop|\,|cancel|\,S\,\\{bsp}$ + $|force|\,E\,\\{bsp}\,|noop|\,|cancel|\,S\,\\{force}$ & $\!\!$ \&{else} $\{x=0;\}$\cr \+& |if_clause| |lbrace| & |if_head| |lbrace| & \&{if} ($x$) $\{$\cr \+& |if_clause| |stmt| |else_like| |if_like| & |if_like| \hfill @@ -193,7 +193,7 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \+& |case_like| |colon| & |tag| & |default:|\cr \+& |case_like| |exp| & |exp| \hfill $C\.\ E$ & |return 0|\cr \+& |catch_like| \alt|cast| |exp| & |fn_decl| \hfill - $C$\alt $C$ $E$ \unskip \\{din} & |catch (...)|\cr + $C$\,\\{din}\,\alt $C$ $E$ & |catch (...)|\cr \+& |tag| |tag| & |tag| \hfill $T_1\,\\{bsp}\,T_2$ & |case 0: case 1:|\cr \+& |tag| \altt|stmt| |decl| |function| & \altt|stmt| |decl| |function| \hfill $|force|\,\\{back}\,T\,\\{bsp}\,S$ @@ -212,7 +212,7 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \+& |section_scrap| |semi| & |stmt|\hfill $MS$ |force| &$\langle\,$section name$\,\rangle$;\cr \+& |section_scrap| & |exp| &$\langle\,$section name$\,\rangle$\cr -\+& |insert| \\{any} & \\{any} & \.{\v\#include\v}\cr +\+& |insert| |function| & |function| & \#\&{include} before \\{main}\cr \+& |prelangle| & |binop| \hfill \.< & $<$ not in template\cr \+& |prerangle| & |binop| \hfill \.> & $>$ not in template\cr \+& |langle| |prerangle| & |cast| \hfill $L\.{\\,}P$ & $\langle\,\rangle$\cr @@ -262,14 +262,14 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \&{typedef} \&{char}\cr \+\dagit& |typedef_like| |exp| & |typedef_like| \hfill $T\.\ E^{**}$ & \&{typedef} \&I \.{@@[@@]} (|*|\&P)\cr -\+& |typedef_like| |comma| & |typedef_like| \hfill $TC\.\ $ & +\+& |typedef_like| |comma| & |typedef_like| \hfill $TC$ & \&{typedef} \&{int} \&x,\cr -\+& |typedef_like| |semi| & |decl| & \&{typedef} \&{int} $\&x,\&y$;\cr -\+& |typedef_like| |ubinop| \alt |cast| |ubinop| & +\+& |typedef_like| |semi| & |decl| & \&{typedef} \&{int} $\&x,{}$ $\&y$;\cr +\+& |typedef_like| |ubinop| \alt |cast| |ubinop| & |typedef_like| \alt |cast| |ubinop| \hfill \alt $C=\.\{U\.\}C$ $U_2=\.\{U_1\.\}U_2$ \unskip & \&{typedef} |*|{}|*|(\&{CPtr})\cr -\+& |delete_like| |lpar| |rpar| & |delete_like|\hfill $DL\.{\\,}R$ +\+& |delete_like| |lbrack| |rbrack| & |delete_like|\hfill $DL\.{\\,}R$ & \&{delete}[\,] \cr \+& |delete_like| |exp| & |exp| \hfill $D\.\ E$ & \&{delete} $p$ \cr \+\dagit& |question| |exp| \alt |colon| |base| & |binop| @@ -296,7 +296,7 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \+& |using_like| & |int_like| & \&{using} not in attributes \cr \+& |struct_like| |attr| & |struct_like| \hfill $S\.\ A$ & \&{struct} [[\\{deprecated}]]\cr -\+& |exp| |attr| & |attr| \hfill $E\.\ A$ & \&{enum} $\{x\ [[\ldots]]\}$ \cr +\+& |exp| |attr| & |exp| \hfill $E\.\ A$ & \&{enum} $\{x\ [[\ldots]]\}$ \cr \+& |attr| |typedef_like| & |typedef_like| \hfill $A\.\ T$ & |[[deprecated]] typedef| \cr \+& |raw_int| |lbrack| & |exp| & |int[3]| \cr @@ -313,10 +313,10 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \+& |exp| |colcol| |int_like| & |int_like| & $\\{std}\DC\&{atomic}$ \cr \advance\midcol-30pt \+\dagit& |langle| |struct_like| \alt |exp| |int_like| |comma| & - |langle| \hfill $LS$\alt $E^{**}$ $I^{**}$ \unskip $C$ + |langle| \hfill $LS$\.\ \alt $E^{**}$ $I^{**}$ \unskip $C$\,\\{opt}9 & $\langle$\&{typename} $t,$\cr \+\dagit& |langle| |struct_like| \alt |exp| |int_like| |prerangle| & - |cast| \hfill $LS$\alt $E^{**}$ $I^{**}$ \unskip $P$ + |cast| \hfill $LS$\.\ \alt $E^{**}$ $I^{**}$ \unskip $P$ & $\langle$\&{typename} $t\rangle$ \cr \advance\midcol30pt \+& |template_like| |cast| |struct_like| & |struct_like| \hfill $T\.\ CS$ & @@ -329,7 +329,7 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \parindent=0pt \dag{\bf Notes} \yskip -Rule 35: The |exp| must not be immediately followed by |lpar|, |lbrack|, +Rules 35, 117: The |exp| must not be immediately followed by |lpar|, |lbrack|, |exp|, or~|cast|. Rule 48: The |exp| or |int_like| must not be immediately followed by |base|. @@ -352,9 +352,6 @@ must not be immediately followed by a |binop|. Rule 114: The |operator_like| must not be immediately followed by |raw_ubin|. -Rule 117: The |exp| must not be immediately followed by |lpar|, |exp|, -or |cast|. - Rule 123: The mathness of the |colon| or |base| changes to `yes'. Rules 153, 154: |make_reserved| is called only if \.{CWEAVE} has been invoked |