diff options
author | Andreas Scherer <andreas_tex@freenet.de> | 2021-05-02 13:12:20 +0000 |
---|---|---|
committer | Andreas Scherer <andreas_tex@freenet.de> | 2021-05-02 13:12:20 +0000 |
commit | d28619b4358aaa5c7ae210ce855df17e80b042a5 (patch) | |
tree | 96141dd0510f9501c56e1b3b0f5331179bd3fff9 /Build/source/texk/web2c | |
parent | ac2076a1c1574e8973c41270faf9064b46fd5130 (diff) |
Revert "[CWEB] New release 4.3."
This reverts commit 3ccac2a7d0f4a19dde861c6f4c178e853d90f0cc.
CWEB 4.3 is seriously broken.
git-svn-id: svn://tug.org/texlive/trunk@59048 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
72 files changed, 2101 insertions, 3549 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index 70196144ef2..e03ae51d529 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,13 +1,3 @@ -2021-04-16 Andreas Scherer <https://ascherer.github.io> - - * ctangleboot.cin, - * cwebboot.cin, - * help.h: CWEB release 4.3. - -2021-03-24 Andreas Scherer <https://ascherer.github.io> - - * help.h: New options for CTANGLE, CWEAVE and CTWILL. - 2021-03-23 Karl Berry <karl@tug.org> * TL'21. @@ -18,11 +8,6 @@ * doc/webman.tex: add these Knuth files here, since nowhere else seems better. PDF output for them is in the knuth-pdf package. -2021-03-06 Andreas Scherer <https://ascherer.github.io> - - * Makefile.in, - * am/cweb.am: Patch refsort and twinx with changefiles. - 2021-02-25 Andreas Scherer <https://ascherer.github.io> * ctangleboot.cin, diff --git a/Build/source/texk/web2c/Makefile.in b/Build/source/texk/web2c/Makefile.in index 3c6a7ded3a2..e623bd7fdde 100644 --- a/Build/source/texk/web2c/Makefile.in +++ b/Build/source/texk/web2c/Makefile.in @@ -21196,10 +21196,10 @@ cweave.c: ctangle$(EXEEXT) cwebdir/comm-w2c.h cwebdir/cweave.w cwebdir/prod.w cw $(ctangle_silent)CWEBINPUTS=$(srcdir)/cwebdir $(ctangle) cweave cweav-w2c ctwill.c: ctangle$(EXEEXT) cwebdir/comm-w2c.h cwebdir/cweave.w cwebdir/prod-twill.w cwebdir/ctwill-w2c.ch $(ctangle_silent)CWEBINPUTS=$(srcdir)/cwebdir $(ctangle) cweave ctwill-w2c ctwill.c -ctwill-refsort.c: ctangle$(EXEEXT) cwebdir/refsort.w cwebdir/refsort.ch - $(ctangle_silent)CWEBINPUTS=$(srcdir)/cwebdir $(ctangle) refsort refsort ctwill-refsort.c -ctwill-twinx.c: ctangle$(EXEEXT) cwebdir/twinx.w cwebdir/twinx.ch - $(ctangle_silent)CWEBINPUTS=$(srcdir)/cwebdir $(ctangle) twinx twinx ctwill-twinx.c +ctwill-refsort.c: ctangle$(EXEEXT) cwebdir/refsort.w + $(ctangle_silent)CWEBINPUTS=$(srcdir)/cwebdir $(ctangle) refsort - ctwill-refsort.c +ctwill-twinx.c: ctangle$(EXEEXT) cwebdir/twinx.w + $(ctangle_silent)CWEBINPUTS=$(srcdir)/cwebdir $(ctangle) twinx - ctwill-twinx.c tie.c: ctangle$(EXEEXT) tiedir/tie.w tiedir/tie-w2c.ch $(ctangle_silent)CWEBINPUTS=$(srcdir)/tiedir $(ctangle) tie.w tie-w2c.ch ctiedir/ctie.log: ctie$(EXEEXT) diff --git a/Build/source/texk/web2c/am/cweb.am b/Build/source/texk/web2c/am/cweb.am index 00446a7dbd4..90c10db2d67 100644 --- a/Build/source/texk/web2c/am/cweb.am +++ b/Build/source/texk/web2c/am/cweb.am @@ -25,13 +25,13 @@ ctwill.c: ctangle$(EXEEXT) cwebdir/comm-w2c.h cwebdir/cweave.w cwebdir/prod-twil DISTCLEANFILES += ctwill.c nodist_ctwill_refsort_SOURCES = ctwill-refsort.c -ctwill-refsort.c: ctangle$(EXEEXT) cwebdir/refsort.w cwebdir/refsort.ch - $(ctangle_silent)CWEBINPUTS=$(srcdir)/cwebdir $(ctangle) refsort refsort ctwill-refsort.c +ctwill-refsort.c: ctangle$(EXEEXT) cwebdir/refsort.w + $(ctangle_silent)CWEBINPUTS=$(srcdir)/cwebdir $(ctangle) refsort - ctwill-refsort.c DISTCLEANFILES += ctwill-refsort.c nodist_ctwill_twinx_SOURCES = ctwill-twinx.c -ctwill-twinx.c: ctangle$(EXEEXT) cwebdir/twinx.w cwebdir/twinx.ch - $(ctangle_silent)CWEBINPUTS=$(srcdir)/cwebdir $(ctangle) twinx twinx ctwill-twinx.c +ctwill-twinx.c: ctangle$(EXEEXT) cwebdir/twinx.w + $(ctangle_silent)CWEBINPUTS=$(srcdir)/cwebdir $(ctangle) twinx - ctwill-twinx.c DISTCLEANFILES += ctwill-twinx.c nodist_tie_SOURCES = tie.c diff --git a/Build/source/texk/web2c/ctangleboot.cin b/Build/source/texk/web2c/ctangleboot.cin index 04a63ad133a..4f5f78b7ee0 100644 --- a/Build/source/texk/web2c/ctangleboot.cin +++ b/Build/source/texk/web2c/ctangleboot.cin @@ -2,7 +2,7 @@ #line 66 "cwebdir/ctangle.w" /*4:*/ -#line 51 "cwebdir/comm-w2c.h" +#line 53 "cwebdir/comm-w2c.h" #ifndef HAVE_GETTEXT #define HAVE_GETTEXT 0 @@ -25,7 +25,7 @@ /*:4*/ #line 67 "cwebdir/ctangle.w" -#define banner "This is CTANGLE, Version 4.3" \ +#define banner "This is CTANGLE, Version 4.2" \ \ #define _(S) gettext(S) \ @@ -46,18 +46,12 @@ #define period_ast 026 #define minus_gt_ast 027 \ -#define compress(c) if(loc++<=limit) return c \ - -#define xisalpha(c) (isalpha((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisdigit(c) (isdigit((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisspace(c) (isspace((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xislower(c) (islower((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisupper(c) (isupper((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisxdigit(c) (isxdigit((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define isxalpha(c) ((c) =='_'||(c) =='$') \ - -#define ishigh(c) ((eight_bits) (c) > 0177) \ - \ +#define xisalpha(c) (isalpha((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisdigit(c) (isdigit((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisspace(c) (isspace((eight_bits) c) &&((eight_bits) c<0200) ) +#define xislower(c) (islower((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \ #define max_include_depth 10 \ @@ -88,12 +82,15 @@ #define show_progress flags['p'] #define show_stats flags['s'] #define show_happiness flags['h'] -#define make_xrefs flags['x'] -#define check_for_change flags['c'] \ +#define temporary_output flags['t'] +#define make_xrefs flags['x'] \ #define update_terminal fflush(stdout) #define new_line putchar('\n') -#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) \ +#define putxchar putchar +#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) +#define C_printf(c,a) fprintf(C_file,c,a) +#define C_putc(c) putc(c,C_file) \ #define max_bytes 1000000 \ @@ -109,11 +106,9 @@ #define equiv equiv_or_xref \ -#define macro 0 #define section_flag max_texts \ #define string 02 -#define constant 03 #define join 0177 #define output_defs_flag (2*024000-1) \ @@ -133,12 +128,9 @@ #define verbatim 4 \ #define max_files 256 -#define C_printf(c,a) fprintf(C_file,c,a) -#define C_putc(c) putc(c,C_file) \ - #define translit_length 10 \ -#define ignore 00 +#define ignore 0 #define ord 0302 #define control_text 0303 #define translit_code 0304 @@ -149,9 +141,17 @@ #define section_name 0311 #define new_section 0312 \ -#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow(_("token") ) ;*tok_ptr++= c;} \ +#define constant 03 \ -#define keep_digit_separators flags['k'] \ +#define isxalpha(c) ((c) =='_'||(c) =='$') \ + +#define ishigh(c) ((eight_bits) (c) > 0177) \ + \ + +#define compress(c) if(loc++<=limit) return c \ + +#define macro 0 +#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow(_("token") ) ;*tok_ptr++= c;} \ #define max_banner 50 \ @@ -159,7 +159,7 @@ #line 68 "cwebdir/ctangle.w" /*3:*/ -#line 33 "cwebdir/comm-w2c.h" +#line 35 "cwebdir/comm-w2c.h" typedef bool boolean; typedef uint8_t eight_bits; @@ -179,7 +179,7 @@ extern char*id_first; extern char*id_loc; /*:5*//*6:*/ -#line 109 "cwebdir/comm-w2c.h" +#line 105 "cwebdir/comm-w2c.h" extern char buffer[]; extern char*buffer_end; @@ -187,7 +187,7 @@ extern char*loc; extern char*limit; /*:6*//*7:*/ -#line 126 "cwebdir/comm-w2c.h" +#line 122 "cwebdir/comm-w2c.h" extern int include_depth; extern FILE*file[]; @@ -204,7 +204,7 @@ extern boolean changing; extern boolean web_file_open; /*:7*//*9:*/ -#line 147 "cwebdir/comm-w2c.h" +#line 143 "cwebdir/comm-w2c.h" extern sixteen_bits section_count; extern boolean changed_section[]; @@ -212,7 +212,7 @@ extern boolean change_pending; extern boolean print_where; /*:9*//*10:*/ -#line 161 "cwebdir/comm-w2c.h" +#line 157 "cwebdir/comm-w2c.h" typedef struct name_info{ char*byte_start; @@ -237,12 +237,12 @@ extern hash_pointer hash_end; extern hash_pointer h; /*:10*//*12:*/ -#line 205 "cwebdir/comm-w2c.h" +#line 201 "cwebdir/comm-w2c.h" extern int history; /*:12*//*14:*/ -#line 222 "cwebdir/comm-w2c.h" +#line 218 "cwebdir/comm-w2c.h" extern int argc; extern char**argv; @@ -254,7 +254,7 @@ extern boolean flags[]; extern const char*use_language; /*:14*//*15:*/ -#line 237 "cwebdir/comm-w2c.h" +#line 235 "cwebdir/comm-w2c.h" extern FILE*C_file; extern FILE*tex_file; @@ -281,7 +281,7 @@ sixteen_bits text_link; typedef text*text_pointer; /*:19*//*31:*/ -#line 273 "cwebdir/ctangle.w" +#line 269 "cwebdir/ctangle.w" typedef struct{ eight_bits*end_field; @@ -306,12 +306,12 @@ static eight_bits*tok_mem_end= tok_mem+max_toks-1; static eight_bits*tok_ptr; /*:20*//*26:*/ -#line 199 "cwebdir/ctangle.w" +#line 198 "cwebdir/ctangle.w" static text_pointer last_unnamed; /*:26*//*32:*/ -#line 289 "cwebdir/ctangle.w" +#line 285 "cwebdir/ctangle.w" static output_state cur_state; @@ -320,18 +320,18 @@ static stack_pointer stack_end= stack+stack_size; static stack_pointer stack_ptr; /*:32*//*37:*/ -#line 365 "cwebdir/ctangle.w" +#line 361 "cwebdir/ctangle.w" static int cur_val; /*:37*//*42:*/ -#line 456 "cwebdir/ctangle.w" +#line 452 "cwebdir/ctangle.w" static eight_bits out_state; static boolean protect; /*:42*//*45:*/ -#line 487 "cwebdir/ctangle.w" +#line 483 "cwebdir/ctangle.w" static name_pointer output_files[max_files]; static name_pointer*cur_out_file,*end_output_files,*an_output_file; @@ -339,33 +339,33 @@ static char cur_section_name_char; static char output_file_name[longest_name+1]; /*:45*//*52:*/ -#line 584 "cwebdir/ctangle.w" +#line 582 "cwebdir/ctangle.w" static boolean output_defs_seen= false; /*:52*//*57:*/ -#line 696 "cwebdir/ctangle.w" +#line 691 "cwebdir/ctangle.w" static char translit[128][translit_length]; /*:57*//*62:*/ -#line 775 "cwebdir/ctangle.w" +#line 770 "cwebdir/ctangle.w" static eight_bits ccode[256]; /*:62*//*66:*/ -#line 835 "cwebdir/ctangle.w" +#line 830 "cwebdir/ctangle.w" static boolean comment_continues= false; /*:66*//*68:*/ -#line 872 "cwebdir/ctangle.w" +#line 869 "cwebdir/ctangle.w" static name_pointer cur_section_name; static boolean no_where; /*:68*//*82:*/ -#line 1189 "cwebdir/ctangle.w" +#line 1182 "cwebdir/ctangle.w" static text_pointer cur_text; static eight_bits next_control; @@ -374,19 +374,19 @@ static eight_bits next_control; #line 71 "cwebdir/ctangle.w" /*8:*/ -#line 141 "cwebdir/comm-w2c.h" +#line 137 "cwebdir/comm-w2c.h" extern boolean get_line(void); extern void check_complete(void); extern void reset_input(void); /*:8*//*11:*/ -#line 184 "cwebdir/comm-w2c.h" +#line 180 "cwebdir/comm-w2c.h" extern boolean names_match(name_pointer,const char*,size_t,eight_bits); extern name_pointer id_lookup(const char*,const char*,char); -extern name_pointer section_lookup(char*,char*,boolean); +extern name_pointer section_lookup(char*,char*,int); extern void init_node(name_pointer); extern void init_p(name_pointer,eight_bits); extern void print_prefix_name(name_pointer); @@ -394,7 +394,7 @@ extern void print_section_name(name_pointer); extern void sprint_section_name(char*,name_pointer); /*:11*//*13:*/ -#line 208 "cwebdir/comm-w2c.h" +#line 204 "cwebdir/comm-w2c.h" extern int wrap_up(void); extern void err_print(const char*); @@ -402,64 +402,64 @@ extern void fatal(const char*,const char*); extern void overflow(const char*); /*:13*//*16:*/ -#line 246 "cwebdir/comm-w2c.h" +#line 244 "cwebdir/comm-w2c.h" extern void common_init(void); extern void print_stats(void); extern void cb_show_banner(void); /*:16*//*30:*/ -#line 245 "cwebdir/ctangle.w" +#line 241 "cwebdir/ctangle.w" static void store_two_bytes(sixteen_bits); /*:30*//*35:*/ -#line 328 "cwebdir/ctangle.w" +#line 324 "cwebdir/ctangle.w" static void push_level(name_pointer); static void pop_level(boolean); /*:35*//*39:*/ -#line 401 "cwebdir/ctangle.w" +#line 397 "cwebdir/ctangle.w" static void get_output(void); /*:39*//*44:*/ -#line 477 "cwebdir/ctangle.w" +#line 473 "cwebdir/ctangle.w" static void flush_buffer(void); /*:44*//*49:*/ -#line 551 "cwebdir/ctangle.w" +#line 549 "cwebdir/ctangle.w" static void phase_two(void); /*:49*//*53:*/ -#line 587 "cwebdir/ctangle.w" +#line 585 "cwebdir/ctangle.w" static void output_defs(void); static void out_char(eight_bits); /*:53*//*65:*/ -#line 815 "cwebdir/ctangle.w" +#line 810 "cwebdir/ctangle.w" static eight_bits skip_ahead(void); static boolean skip_comment(boolean); /*:65*//*70:*/ -#line 922 "cwebdir/ctangle.w" +#line 924 "cwebdir/ctangle.w" static eight_bits get_next(void); /*:70*//*84:*/ -#line 1215 "cwebdir/ctangle.w" +#line 1208 "cwebdir/ctangle.w" static void scan_repl(eight_bits); /*:84*//*91:*/ -#line 1396 "cwebdir/ctangle.w" +#line 1379 "cwebdir/ctangle.w" static void scan_section(void); /*:91*//*99:*/ -#line 1477 "cwebdir/ctangle.w" +#line 1460 "cwebdir/ctangle.w" static void phase_one(void); /*:99*//*101:*/ -#line 1511 "cwebdir/ctangle.w" +#line 1494 "cwebdir/ctangle.w" static void skip_limbo(void); /*:101*/ @@ -488,16 +488,16 @@ text_ptr= text_info+1;text_ptr->tok_start= tok_mem; init_node(name_dir); /*:23*//*27:*/ -#line 202 "cwebdir/ctangle.w" -last_unnamed= text_info;text_info->text_link= macro; +#line 201 "cwebdir/ctangle.w" +last_unnamed= text_info;text_info->text_link= 0; /*:27*//*46:*/ -#line 497 "cwebdir/ctangle.w" +#line 493 "cwebdir/ctangle.w" cur_out_file= end_output_files= output_files+max_files; /*:46*//*58:*/ -#line 699 "cwebdir/ctangle.w" +#line 694 "cwebdir/ctangle.w" { int i; @@ -505,7 +505,7 @@ for(i= 0;i<128;i++)sprintf(translit[i],"X%02X",(unsigned int)(128+i)); } /*:58*//*63:*/ -#line 778 "cwebdir/ctangle.w" +#line 773 "cwebdir/ctangle.w" { int c; for(c= 0;c<256;c++)ccode[c]= ignore; @@ -525,7 +525,7 @@ ccode['\'']= ord; } /*:63*//*78:*/ -#line 1111 "cwebdir/ctangle.w" +#line 1103 "cwebdir/ctangle.w" section_text[0]= ' '; /*:78*//*116:*/ @@ -571,7 +571,7 @@ void init_p(name_pointer p,eight_bits t){(void)p;(void)t;} /*:25*//*29:*/ -#line 235 "cwebdir/ctangle.w" +#line 231 "cwebdir/ctangle.w" static void store_two_bytes( @@ -579,13 +579,13 @@ sixteen_bits x) { #line 65 "cwebdir/ctang-w2c.ch" if(tok_ptr+2> tok_mem_end)overflow(_("token")); -#line 241 "cwebdir/ctangle.w" +#line 237 "cwebdir/ctangle.w" *tok_ptr++= x>>8; *tok_ptr++= x&0377; } /*:29*//*34:*/ -#line 313 "cwebdir/ctangle.w" +#line 309 "cwebdir/ctangle.w" static void push_level( @@ -593,7 +593,7 @@ name_pointer p) { #line 71 "cwebdir/ctang-w2c.ch" if(stack_ptr==stack_end)overflow(_("stack")); -#line 319 "cwebdir/ctangle.w" +#line 315 "cwebdir/ctangle.w" *stack_ptr= cur_state; stack_ptr++; if(p!=NULL){ @@ -604,7 +604,7 @@ cur_section= 0; } /*:34*//*36:*/ -#line 336 "cwebdir/ctangle.w" +#line 332 "cwebdir/ctangle.w" static void pop_level( @@ -620,7 +620,7 @@ if(stack_ptr> stack)cur_state= *stack_ptr; } /*:36*//*38:*/ -#line 372 "cwebdir/ctangle.w" +#line 368 "cwebdir/ctangle.w" static void get_output(void) @@ -643,7 +643,7 @@ switch(a/024000){ case 0:cur_val= a;out_char(identifier);break; case 1:if(a==output_defs_flag)output_defs(); else/*40:*/ -#line 406 "cwebdir/ctangle.w" +#line 402 "cwebdir/ctangle.w" { a-= 024000; @@ -651,7 +651,7 @@ if((a+name_dir)->equiv!=(void*)text_info)push_level(a+name_dir); else if(a!=0){ #line 77 "cwebdir/ctang-w2c.ch" fputs(_("\n! Not present: <"),stdout); -#line 412 "cwebdir/ctangle.w" +#line 408 "cwebdir/ctangle.w" print_section_name(a+name_dir);err_print(">"); } @@ -659,7 +659,7 @@ goto restart; } /*:40*/ -#line 393 "cwebdir/ctangle.w" +#line 389 "cwebdir/ctangle.w" break; default:cur_val= a-050000;if(cur_val> 0)cur_section= cur_val; @@ -669,14 +669,14 @@ out_char(section_number); } /*:38*//*43:*/ -#line 464 "cwebdir/ctangle.w" +#line 460 "cwebdir/ctangle.w" static void flush_buffer(void) { C_putc('\n'); if(cur_line%100==0&&show_progress){ -putchar('.'); +printf("."); if(cur_line%500==0)printf("%d",cur_line); update_terminal; } @@ -684,34 +684,34 @@ cur_line++; } /*:43*//*48:*/ -#line 516 "cwebdir/ctangle.w" +#line 514 "cwebdir/ctangle.w" static void phase_two(void){ web_file_open= false; cur_line= 1; /*33:*/ -#line 302 "cwebdir/ctangle.w" +#line 298 "cwebdir/ctangle.w" stack_ptr= stack+1;cur_name= name_dir;cur_repl= text_info->text_link+text_info; cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start;cur_section= 0; /*:33*/ -#line 521 "cwebdir/ctangle.w" +#line 519 "cwebdir/ctangle.w" /*51:*/ -#line 580 "cwebdir/ctangle.w" +#line 578 "cwebdir/ctangle.w" if(!output_defs_seen) output_defs(); /*:51*/ -#line 522 "cwebdir/ctangle.w" +#line 520 "cwebdir/ctangle.w" -if(text_info->text_link==macro&&cur_out_file==end_output_files){ +if(text_info->text_link==0&&cur_out_file==end_output_files){ #line 89 "cwebdir/ctang-w2c.ch" fputs(_("\n! No program text was specified."),stdout);mark_harmless; -#line 525 "cwebdir/ctangle.w" +#line 523 "cwebdir/ctangle.w" } else{ @@ -719,18 +719,18 @@ if(cur_out_file==end_output_files){ if(show_progress) #line 95 "cwebdir/ctang-w2c.ch" printf(_("\nWriting the output file (%s):"),C_file_name); -#line 531 "cwebdir/ctangle.w" +#line 529 "cwebdir/ctangle.w" } else{ if(show_progress){ #line 101 "cwebdir/ctang-w2c.ch" fputs(_("\nWriting the output files:"),stdout); -#line 535 "cwebdir/ctangle.w" +#line 533 "cwebdir/ctangle.w" printf(" (%s)",C_file_name); update_terminal; } -if(text_info->text_link==macro)goto writeloop; +if(text_info->text_link==0)goto writeloop; } while(stack_ptr> stack)get_output(); flush_buffer(); @@ -752,7 +752,7 @@ if((check_file= fopen(check_file_name,"r"))==NULL) fatal(_("! Cannot open output file "),check_file_name); -if(check_for_change)/*107:*/ +if(temporary_output)/*107:*/ #line 378 "cwebdir/ctang-w2c.ch" do{ @@ -927,7 +927,7 @@ if((check_file= fopen(check_file_name,"r"))==NULL) fatal(_("! Cannot open output file "),check_file_name); -if(check_for_change)/*107:*/ +if(temporary_output)/*107:*/ #line 378 "cwebdir/ctang-w2c.ch" do{ @@ -969,22 +969,22 @@ rename(check_file_name,output_file_name); } strcpy(check_file_name,""); -#line 575 "cwebdir/ctangle.w" +#line 573 "cwebdir/ctangle.w" /*:50*/ -#line 543 "cwebdir/ctangle.w" +#line 541 "cwebdir/ctangle.w" if(show_happiness){ if(show_progress)new_line; #line 107 "cwebdir/ctang-w2c.ch" fputs(_("Done."),stdout); -#line 547 "cwebdir/ctangle.w" +#line 545 "cwebdir/ctangle.w" } } } /*:48*//*54:*/ -#line 594 "cwebdir/ctangle.w" +#line 589 "cwebdir/ctangle.w" static void output_defs(void) @@ -992,7 +992,7 @@ output_defs(void) sixteen_bits a; push_level(NULL); for(cur_text= text_info+1;cur_text<text_ptr;cur_text++) -if(cur_text->text_link==macro){ +if(cur_text->text_link==0){ cur_byte= cur_text->tok_start; cur_end= (cur_text+1)->tok_start; C_printf("%s","#define "); @@ -1011,8 +1011,8 @@ if(a<024000){ cur_val= a;out_char(identifier); } #line 159 "cwebdir/ctang-w2c.ch" -else if(a<050000)confusion(_("macro defs have strange char")); -#line 620 "cwebdir/ctangle.w" +else if(a<050000){confusion(_("macro defs have strange char"));} +#line 615 "cwebdir/ctangle.w" else{ cur_val= a-050000;cur_section= cur_val;out_char(section_number); } @@ -1026,7 +1026,7 @@ pop_level(false); } /*:54*//*55:*/ -#line 637 "cwebdir/ctangle.w" +#line 632 "cwebdir/ctangle.w" static void out_char( @@ -1039,7 +1039,7 @@ case'\n':if(protect&&out_state!=verbatim)C_putc(' '); if(protect||out_state==verbatim)C_putc('\\'); flush_buffer();if(out_state!=verbatim)out_state= normal;break; /*59:*/ -#line 705 "cwebdir/ctangle.w" +#line 700 "cwebdir/ctangle.w" case identifier: if(out_state==num_or_id)C_putc(' '); @@ -1054,10 +1054,10 @@ j++; out_state= num_or_id;break; /*:59*/ -#line 648 "cwebdir/ctangle.w" +#line 643 "cwebdir/ctangle.w" /*60:*/ -#line 718 "cwebdir/ctangle.w" +#line 713 "cwebdir/ctangle.w" case section_number: if(cur_val> 0)C_printf("/*%d:*/",cur_val); @@ -1079,15 +1079,15 @@ j<k;j++){ if(*j=='\\'||*j=='"')C_putc('\\'); C_putc(*j); } -C_putc('"');C_putc('\n'); +C_printf("%s","\"\n"); } break; /*:60*/ -#line 649 "cwebdir/ctangle.w" +#line 644 "cwebdir/ctangle.w" /*56:*/ -#line 667 "cwebdir/ctangle.w" +#line 662 "cwebdir/ctangle.w" case plus_plus:C_putc('+');C_putc('+');out_state= normal;break; case minus_minus:C_putc('-');C_putc('-');out_state= normal;break; @@ -1108,7 +1108,7 @@ case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal; break; /*:56*/ -#line 650 "cwebdir/ctangle.w" +#line 645 "cwebdir/ctangle.w" case'=':case'>':C_putc(cur_char);C_putc(' '); out_state= normal;break; @@ -1127,7 +1127,7 @@ default:C_putc(cur_char);out_state= normal;break; } /*:55*//*64:*/ -#line 799 "cwebdir/ctangle.w" +#line 794 "cwebdir/ctangle.w" static eight_bits skip_ahead(void) @@ -1145,7 +1145,7 @@ if(c!=ignore||*(loc-1)=='>')return c; } /*:64*//*67:*/ -#line 838 "cwebdir/ctangle.w" +#line 833 "cwebdir/ctangle.w" static boolean skip_comment( boolean is_long_comment) @@ -1158,7 +1158,7 @@ if(get_line())return comment_continues= true; else{ #line 165 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in mid-comment")); -#line 849 "cwebdir/ctangle.w" +#line 844 "cwebdir/ctangle.w" return comment_continues= false; } @@ -1173,7 +1173,7 @@ if(c=='@'){ if(ccode[(eight_bits)*loc]==new_section){ #line 171 "cwebdir/ctang-w2c.ch" err_print(_("! Section name ended in mid-comment"));loc--; -#line 862 "cwebdir/ctangle.w" +#line 857 "cwebdir/ctangle.w" return comment_continues= false; } @@ -1183,23 +1183,22 @@ else loc++; } /*:67*//*69:*/ -#line 879 "cwebdir/ctangle.w" +#line 881 "cwebdir/ctangle.w" static eight_bits get_next(void) { -static boolean preprocessing= false; +static int preprocessing= 0; eight_bits c; while(true){ if(loc> limit){ -if(preprocessing&&*(limit-1)!='\\')preprocessing= false; +if(preprocessing&&*(limit-1)!='\\')preprocessing= 0; if(get_line()==false)return new_section; else if(print_where&&!no_where){ print_where= false; /*85:*/ -#line 1221 "cwebdir/ctangle.w" +#line 1214 "cwebdir/ctangle.w" -{ store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1211,10 +1210,9 @@ store_two_bytes((sixteen_bits)cur_line); id_loc= id_first+strlen(id_first); {int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200); app_repl(a_l%0400);} -} /*:85*/ -#line 891 "cwebdir/ctangle.w" +#line 893 "cwebdir/ctangle.w" } else return'\n'; @@ -1228,32 +1226,23 @@ else continue; } loc++; if(xisdigit(c)||c=='.')/*73:*/ -#line 963 "cwebdir/ctangle.w" +#line 964 "cwebdir/ctangle.w" { -boolean hex_flag= false; id_first= loc-1; if(*id_first=='.'&&!xisdigit(*loc))goto mistake; if(*id_first=='0'){ if(*loc=='x'||*loc=='X'){ -hex_flag= true; -loc++;while(xisxdigit(*loc)||*loc=='\'')loc++; -} -else if(*loc=='b'||*loc=='B'){ -loc++;while(*loc=='0'||*loc=='1'||*loc=='\'')loc++;goto found; +loc++;while(xisxdigit(*loc))loc++;goto found; } } -while(xisdigit(*loc)||*loc=='\'')loc++; +while(xisdigit(*loc))loc++; if(*loc=='.'){ loc++; -while((hex_flag&&xisxdigit(*loc))||xisdigit(*loc)||*loc=='\'')loc++; +while(xisdigit(*loc))loc++; } if(*loc=='e'||*loc=='E'){ if(*++loc=='+'||*loc=='-')loc++; -while(xisdigit(*loc)||*loc=='\'')loc++; -} -else if(hex_flag&&(*loc=='p'||*loc=='P')){ -if(*++loc=='+'||*loc=='-')loc++; -while(xisxdigit(*loc)||*loc=='\'')loc++; +while(xisdigit(*loc))loc++; } found:while(*loc=='u'||*loc=='U'||*loc=='l'||*loc=='L' ||*loc=='f'||*loc=='F')loc++; @@ -1262,19 +1251,19 @@ return constant; } /*:73*/ -#line 903 "cwebdir/ctangle.w" +#line 905 "cwebdir/ctangle.w" else if(c=='\''||c=='"' ||((c=='L'||c=='u'||c=='U')&&(*loc=='\''||*loc=='"')) ||((c=='u'&&*loc=='8')&&(*(loc+1)=='\''||*(loc+1)=='"'))) /*74:*/ -#line 1000 "cwebdir/ctangle.w" +#line 992 "cwebdir/ctangle.w" { char delim= c; id_first= section_text+1; id_loc= section_text;*++id_loc= delim; if(delim=='L'||delim=='u'||delim=='U'){ -if(delim=='u'&&*loc=='8')*++id_loc= *loc++; +if(delim=='u'&&*loc=='8'){*++id_loc= *loc++;} delim= *loc++;*++id_loc= delim; } while(true){ @@ -1282,13 +1271,13 @@ if(loc>=limit){ if(*(limit-1)!='\\'){ #line 177 "cwebdir/ctang-w2c.ch" err_print(_("! String didn't end"));loc= limit;break; -#line 1012 "cwebdir/ctangle.w" +#line 1004 "cwebdir/ctangle.w" } if(get_line()==false){ #line 183 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in middle of string"));loc= buffer;break; -#line 1016 "cwebdir/ctangle.w" +#line 1008 "cwebdir/ctangle.w" } else if(++id_loc<=section_text_end)*id_loc= '\n'; @@ -1308,7 +1297,7 @@ if(++id_loc<=section_text_end)*id_loc= c; if(id_loc>=section_text_end){ #line 189 "cwebdir/ctang-w2c.ch" fputs(_("\n! String too long: "),stdout); -#line 1034 "cwebdir/ctangle.w" +#line 1026 "cwebdir/ctangle.w" term_write(section_text+1,25); err_print("..."); @@ -1318,61 +1307,60 @@ return string; } /*:74*/ -#line 907 "cwebdir/ctangle.w" +#line 909 "cwebdir/ctangle.w" else if(isalpha(c)||isxalpha(c)||ishigh(c)) /*72:*/ -#line 954 "cwebdir/ctangle.w" +#line 957 "cwebdir/ctangle.w" { id_first= --loc; -do{ -++loc; -}while(isalpha((eight_bits)*loc)||isdigit((eight_bits)*loc) +while(isalpha((eight_bits)*++loc)||isdigit((eight_bits)*loc) ||isxalpha((eight_bits)*loc)||ishigh((eight_bits)*loc)); id_loc= loc;return identifier; } /*:72*/ -#line 909 "cwebdir/ctangle.w" +#line 911 "cwebdir/ctangle.w" else if(c=='@')/*75:*/ -#line 1045 "cwebdir/ctangle.w" +#line 1037 "cwebdir/ctangle.w" { -switch(c= ccode[(eight_bits)*loc++]){ +c= ccode[(eight_bits)*loc++]; +switch(c){ case ignore:continue; #line 195 "cwebdir/ctang-w2c.ch" case translit_code:err_print(_("! Use @l in limbo only"));continue; -#line 1049 "cwebdir/ctangle.w" +#line 1042 "cwebdir/ctangle.w" case control_text:while((c= skip_ahead())=='@'); if(*(loc-1)!='>') #line 201 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in control text")); -#line 1054 "cwebdir/ctangle.w" +#line 1047 "cwebdir/ctangle.w" continue; case section_name: cur_section_name_char= *(loc-1); /*77:*/ -#line 1091 "cwebdir/ctangle.w" +#line 1085 "cwebdir/ctangle.w" { char*k; /*79:*/ -#line 1113 "cwebdir/ctangle.w" +#line 1105 "cwebdir/ctangle.w" k= section_text; while(true){ if(loc> limit&&get_line()==false){ #line 219 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in section name")); -#line 1118 "cwebdir/ctangle.w" +#line 1110 "cwebdir/ctangle.w" loc= buffer+1;break; } c= *loc; /*80:*/ -#line 1137 "cwebdir/ctangle.w" +#line 1129 "cwebdir/ctangle.w" if(c=='@'){ c= *(loc+1); @@ -1382,20 +1370,20 @@ loc+= 2;break; if(ccode[(eight_bits)c]==new_section){ #line 231 "cwebdir/ctang-w2c.ch" err_print(_("! Section name didn't end"));break; -#line 1145 "cwebdir/ctangle.w" +#line 1137 "cwebdir/ctangle.w" } if(ccode[(eight_bits)c]==section_name){ #line 237 "cwebdir/ctang-w2c.ch" err_print(_("! Nesting of section names not allowed"));break; -#line 1149 "cwebdir/ctangle.w" +#line 1141 "cwebdir/ctangle.w" } *(++k)= '@';loc++; } /*:80*/ -#line 1122 "cwebdir/ctangle.w" +#line 1114 "cwebdir/ctangle.w" loc++;if(k<section_text_end)k++; if(xisspace(c)){ @@ -1406,7 +1394,7 @@ c= ' ';if(*(k-1)==' ')k--; if(k>=section_text_end){ #line 225 "cwebdir/ctang-w2c.ch" fputs(_("\n! Section name too long: "),stdout); -#line 1131 "cwebdir/ctangle.w" +#line 1123 "cwebdir/ctangle.w" term_write(section_text+1,25); printf("...");mark_harmless; @@ -1414,16 +1402,14 @@ printf("...");mark_harmless; if(*k==' '&&k> section_text)k--; /*:79*/ -#line 1093 "cwebdir/ctangle.w" +#line 1087 "cwebdir/ctangle.w" if(k-section_text> 3&&strncmp(k-2,"...",3)==0) -cur_section_name= section_lookup(section_text+1,k-3,true); - -else cur_section_name= section_lookup(section_text+1,k,false); - +cur_section_name= section_lookup(section_text+1,k-3,1); +else cur_section_name= section_lookup(section_text+1,k,0); if(cur_section_name_char=='(') /*47:*/ -#line 501 "cwebdir/ctangle.w" +#line 497 "cwebdir/ctangle.w" { for(an_output_file= cur_out_file; @@ -1432,49 +1418,52 @@ if(*an_output_file==cur_section_name)break; if(an_output_file==end_output_files){ if(cur_out_file> output_files) *--cur_out_file= cur_section_name; +else{ #line 83 "cwebdir/ctang-w2c.ch" -else overflow(_("output files")); -#line 510 "cwebdir/ctangle.w" +overflow(_("output files")); +#line 507 "cwebdir/ctangle.w" +} } } /*:47*/ -#line 1101 "cwebdir/ctangle.w" +#line 1093 "cwebdir/ctangle.w" return section_name; } /*:77*/ -#line 1058 "cwebdir/ctangle.w" +#line 1051 "cwebdir/ctangle.w" case string:/*81:*/ -#line 1159 "cwebdir/ctangle.w" +#line 1151 "cwebdir/ctangle.w" { id_first= loc++;*(limit+1)= '@';*(limit+2)= '>'; while(*loc!='@'||*(loc+1)!='>')loc++; #line 243 "cwebdir/ctang-w2c.ch" if(loc>=limit)err_print(_("! Verbatim string didn't end")); -#line 1163 "cwebdir/ctangle.w" +#line 1155 "cwebdir/ctangle.w" id_loc= loc;loc+= 2; return string; } /*:81*/ -#line 1059 "cwebdir/ctangle.w" +#line 1052 "cwebdir/ctangle.w" case ord:/*76:*/ -#line 1071 "cwebdir/ctangle.w" +#line 1064 "cwebdir/ctangle.w" id_first= loc; -if(*loc=='\\') +if(*loc=='\\'){ if(*++loc=='\'')loc++; +} while(*loc!='\''){ if(*loc=='@'){ if(*(loc+1)!='@') #line 207 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in ASCII constant")); -#line 1079 "cwebdir/ctangle.w" +#line 1073 "cwebdir/ctangle.w" else loc++; } @@ -1482,7 +1471,7 @@ loc++; if(loc> limit){ #line 213 "cwebdir/ctang-w2c.ch" err_print(_("! String didn't end"));loc= limit-1;break; -#line 1085 "cwebdir/ctangle.w" +#line 1079 "cwebdir/ctangle.w" } } @@ -1490,35 +1479,34 @@ loc++; return ord; /*:76*/ -#line 1060 "cwebdir/ctangle.w" +#line 1053 "cwebdir/ctangle.w" default:return c; } } /*:75*/ -#line 910 "cwebdir/ctangle.w" +#line 912 "cwebdir/ctangle.w" else if(xisspace(c)){ if(!preprocessing||loc> limit)continue; else return' '; } -else if(c=='#'&&loc==buffer+1)preprocessing= true; +else if(c=='#'&&loc==buffer+1)preprocessing= 1; mistake:/*71:*/ -#line 931 "cwebdir/ctangle.w" +#line 935 "cwebdir/ctangle.w" switch(c){ case'+':if(*loc=='+')compress(plus_plus);break; case'-':if(*loc=='-'){compress(minus_minus);} -else if(*loc=='>'){ -if(*(loc+1)=='*'){loc++;compress(minus_gt_ast);} -else compress(minus_gt); -}break; +else{if(*loc=='>'){if(*(loc+1)=='*'){loc++;compress(minus_gt_ast);} +else compress(minus_gt);}}break; case'.':if(*loc=='*'){compress(period_ast);} else if(*loc=='.'&&*(loc+1)=='.'){ loc++;compress(dot_dot_dot); -}break; +} +break; case':':if(*loc==':')compress(colon_colon);break; case'=':if(*loc=='=')compress(eq_eq);break; case'>':if(*loc=='='){compress(gt_eq);} @@ -1531,24 +1519,23 @@ case'!':if(*loc=='=')compress(non_eq);break; } /*:71*/ -#line 917 "cwebdir/ctangle.w" +#line 919 "cwebdir/ctangle.w" return c; } } /*:69*//*83:*/ -#line 1193 "cwebdir/ctangle.w" +#line 1186 "cwebdir/ctangle.w" static void scan_repl( eight_bits t) { sixteen_bits a; -if(t==section_name)/*85:*/ -#line 1221 "cwebdir/ctangle.w" +if(t==section_name){/*85:*/ +#line 1214 "cwebdir/ctangle.w" -{ store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1560,14 +1547,13 @@ store_two_bytes((sixteen_bits)cur_line); id_loc= id_first+strlen(id_first); {int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200); app_repl(a_l%0400);} -} /*:85*/ -#line 1199 "cwebdir/ctangle.w" - +#line 1192 "cwebdir/ctangle.w" +} while(true)switch(a= get_next()){ /*86:*/ -#line 1236 "cwebdir/ctangle.w" +#line 1227 "cwebdir/ctangle.w" case identifier:a= id_lookup(id_first,id_loc,0)-name_dir; app_repl((a/0400)+0200); @@ -1575,7 +1561,7 @@ app_repl(a%0400);break; case section_name:if(t!=section_name)goto done; else{ /*87:*/ -#line 1269 "cwebdir/ctangle.w" +#line 1260 "cwebdir/ctangle.w" { char*try_loc= loc; while(*try_loc==' '&&try_loc<limit)try_loc++; @@ -1583,22 +1569,21 @@ if(*try_loc=='+'&&try_loc<limit)try_loc++; while(*try_loc==' '&&try_loc<limit)try_loc++; #line 273 "cwebdir/ctang-w2c.ch" if(*try_loc=='=')err_print(_("! Missing `@ ' before a named section")); -#line 1275 "cwebdir/ctangle.w" +#line 1266 "cwebdir/ctangle.w" } /*:87*/ -#line 1242 "cwebdir/ctangle.w" +#line 1233 "cwebdir/ctangle.w" a= cur_section_name-name_dir; app_repl((a/0400)+0250); app_repl(a%0400); /*85:*/ -#line 1221 "cwebdir/ctangle.w" +#line 1214 "cwebdir/ctangle.w" -{ store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1610,15 +1595,14 @@ store_two_bytes((sixteen_bits)cur_line); id_loc= id_first+strlen(id_first); {int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200); app_repl(a_l%0400);} -} /*:85*/ -#line 1246 "cwebdir/ctangle.w" +#line 1237 "cwebdir/ctangle.w" break; } #line 261 "cwebdir/ctang-w2c.ch" case output_defs_code:if(t!=section_name)err_print(_("! Misplaced @h")); -#line 1249 "cwebdir/ctangle.w" +#line 1240 "cwebdir/ctangle.w" else{ output_defs_seen= true; @@ -1626,9 +1610,8 @@ a= output_defs_flag; app_repl((a/0400)+0200); app_repl(a%0400); /*85:*/ -#line 1221 "cwebdir/ctangle.w" +#line 1214 "cwebdir/ctangle.w" -{ store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1640,16 +1623,15 @@ store_two_bytes((sixteen_bits)cur_line); id_loc= id_first+strlen(id_first); {int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200); app_repl(a_l%0400);} -} /*:85*/ -#line 1255 "cwebdir/ctangle.w" +#line 1246 "cwebdir/ctangle.w" } break; case constant:case string: /*88:*/ -#line 1286 "cwebdir/ctangle.w" +#line 1271 "cwebdir/ctangle.w" app_repl(a); while(id_first<id_loc){ @@ -1657,21 +1639,19 @@ if(*id_first=='@'){ if(*(id_first+1)=='@')id_first++; #line 279 "cwebdir/ctang-w2c.ch" else err_print(_("! Double @ should be used in string")); -#line 1292 "cwebdir/ctangle.w" +#line 1277 "cwebdir/ctangle.w" } -else if(a==constant&&*id_first=='\''&&!keep_digit_separators) -id_first++; app_repl(*id_first++); } app_repl(a);break; /*:88*/ -#line 1259 "cwebdir/ctangle.w" +#line 1250 "cwebdir/ctangle.w" case ord: /*89:*/ -#line 1304 "cwebdir/ctangle.w" +#line 1287 "cwebdir/ctangle.w" { int c= (eight_bits)*id_first; if(c=='\\'){ @@ -1710,7 +1690,7 @@ case'\'':c= '\'';break; case'\"':c= '\"';break; #line 285 "cwebdir/ctang-w2c.ch" default:err_print(_("! Unrecognized escape sequence")); -#line 1341 "cwebdir/ctangle.w" +#line 1324 "cwebdir/ctangle.w" } } @@ -1724,19 +1704,19 @@ app_repl(constant); break; /*:89*/ -#line 1261 "cwebdir/ctangle.w" +#line 1252 "cwebdir/ctangle.w" case definition:case format_code:case begin_C:if(t!=section_name)goto done; else{ #line 267 "cwebdir/ctang-w2c.ch" err_print(_("! @d, @f and @c are ignored in C text"));continue; -#line 1265 "cwebdir/ctangle.w" +#line 1256 "cwebdir/ctangle.w" } case new_section:goto done; /*:86*/ -#line 1204 "cwebdir/ctangle.w" +#line 1197 "cwebdir/ctangle.w" case')':app_repl(a); if(t==macro)app_repl(' '); @@ -1746,12 +1726,12 @@ default:app_repl(a); done:next_control= (eight_bits)a; #line 255 "cwebdir/ctang-w2c.ch" if(text_ptr> text_info_end)overflow(_("text")); -#line 1212 "cwebdir/ctangle.w" +#line 1205 "cwebdir/ctangle.w" cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; } /*:83*//*90:*/ -#line 1363 "cwebdir/ctangle.w" +#line 1346 "cwebdir/ctangle.w" static void scan_section(void) @@ -1763,10 +1743,10 @@ section_count++;no_where= true; if(*(loc-1)=='*'&&show_progress){ printf("*%d",section_count);update_terminal; } -next_control= ignore; +next_control= 0; while(true){ /*92:*/ -#line 1404 "cwebdir/ctangle.w" +#line 1387 "cwebdir/ctangle.w" while(next_control<definition) @@ -1775,17 +1755,17 @@ loc-= 2;next_control= get_next(); } /*:92*/ -#line 1377 "cwebdir/ctangle.w" +#line 1360 "cwebdir/ctangle.w" if(next_control==definition){ /*93:*/ -#line 1411 "cwebdir/ctangle.w" +#line 1394 "cwebdir/ctangle.w" { while((next_control= get_next())=='\n'); if(next_control!=identifier){ #line 291 "cwebdir/ctang-w2c.ch" err_print(_("! Definition flushed, must start with identifier")); -#line 1415 "cwebdir/ctangle.w" +#line 1398 "cwebdir/ctangle.w" continue; } @@ -1800,7 +1780,7 @@ cur_text->text_link= macro; } /*:93*/ -#line 1379 "cwebdir/ctangle.w" +#line 1362 "cwebdir/ctangle.w" continue; } @@ -1810,14 +1790,14 @@ p= name_dir;break; if(next_control==section_name){ p= cur_section_name; /*94:*/ -#line 1436 "cwebdir/ctangle.w" +#line 1419 "cwebdir/ctangle.w" while((next_control= get_next())=='+'); if(next_control!='='&&next_control!=eq_eq) continue; /*:94*/ -#line 1387 "cwebdir/ctangle.w" +#line 1370 "cwebdir/ctangle.w" break; } @@ -1825,22 +1805,22 @@ return; } no_where= print_where= false; /*95:*/ -#line 1441 "cwebdir/ctangle.w" +#line 1424 "cwebdir/ctangle.w" /*96:*/ -#line 1446 "cwebdir/ctangle.w" +#line 1429 "cwebdir/ctangle.w" store_two_bytes((sixteen_bits)(0150000+section_count)); /*:96*/ -#line 1442 "cwebdir/ctangle.w" +#line 1425 "cwebdir/ctangle.w" scan_repl(section_name); /*97:*/ -#line 1450 "cwebdir/ctangle.w" +#line 1433 "cwebdir/ctangle.w" -if(p==name_dir||p==NULL){ +if(p==name_dir||p==0){ (last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text; } else if(p->equiv==(void*)text_info)p->equiv= (void*)cur_text; @@ -1855,16 +1835,16 @@ cur_text->text_link= section_flag; /*:97*/ -#line 1444 "cwebdir/ctangle.w" +#line 1427 "cwebdir/ctangle.w" /*:95*/ -#line 1393 "cwebdir/ctangle.w" +#line 1376 "cwebdir/ctangle.w" } /*:90*//*98:*/ -#line 1465 "cwebdir/ctangle.w" +#line 1448 "cwebdir/ctangle.w" static void phase_one(void){ @@ -1878,7 +1858,7 @@ phase= 2; } /*:98*//*100:*/ -#line 1482 "cwebdir/ctangle.w" +#line 1465 "cwebdir/ctangle.w" static void skip_limbo(void) @@ -1893,7 +1873,7 @@ c= *loc++; if(ccode[(eight_bits)c]==new_section)break; switch(ccode[(eight_bits)c]){ case translit_code:/*102:*/ -#line 1513 "cwebdir/ctangle.w" +#line 1496 "cwebdir/ctangle.w" while(xisspace(*loc)&&loc<limit)loc++; loc+= 3; @@ -1901,7 +1881,7 @@ if(loc> limit||!xisxdigit(*(loc-3))||!xisxdigit(*(loc-2)) ||(*(loc-3)>='0'&&*(loc-3)<='7')||!xisspace(*(loc-1))) #line 309 "cwebdir/ctang-w2c.ch" err_print(_("! Improper hex number following @l")); -#line 1519 "cwebdir/ctangle.w" +#line 1502 "cwebdir/ctangle.w" else{ unsigned int i; @@ -1913,7 +1893,7 @@ while(loc<limit&&(xisalpha(*loc)||xisdigit(*loc)||*loc=='_'))loc++; if(loc-beg>=translit_length) #line 315 "cwebdir/ctang-w2c.ch" err_print(_("! Replacement string in @l too long")); -#line 1529 "cwebdir/ctangle.w" +#line 1512 "cwebdir/ctangle.w" else{ strncpy(translit[i-0200],beg,(size_t)(loc-beg)); @@ -1922,7 +1902,7 @@ translit[i-0200][loc-beg]= '\0'; } /*:102*/ -#line 1495 "cwebdir/ctangle.w" +#line 1478 "cwebdir/ctangle.w" break; case format_code:case'@':break; case control_text:if(c=='q'||c=='Q'){ @@ -1930,13 +1910,13 @@ while((c= skip_ahead())=='@'); if(*(loc-1)!='>') #line 297 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in control text")); -#line 1501 "cwebdir/ctangle.w" +#line 1484 "cwebdir/ctangle.w" break; } #line 303 "cwebdir/ctang-w2c.ch" default:err_print(_("! Double @ should be used in limbo")); -#line 1505 "cwebdir/ctangle.w" +#line 1488 "cwebdir/ctangle.w" } } @@ -1944,7 +1924,7 @@ default:err_print(_("! Double @ should be used in limbo")); } /*:100*//*103:*/ -#line 1539 "cwebdir/ctangle.w" +#line 1522 "cwebdir/ctangle.w" void print_stats(void){ @@ -1957,7 +1937,7 @@ printf(_("%ld replacement texts (out of %ld)\n"), printf(_("%ld bytes (out of %ld)\n"), (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes); printf(_("%ld tokens (out of %ld)\n"), -#line 1550 "cwebdir/ctangle.w" +#line 1533 "cwebdir/ctangle.w" (ptrdiff_t)(tok_ptr-tok_mem),(long)max_toks); } diff --git a/Build/source/texk/web2c/cwebboot.cin b/Build/source/texk/web2c/cwebboot.cin index 8e957a576a7..150c303a346 100644 --- a/Build/source/texk/web2c/cwebboot.cin +++ b/Build/source/texk/web2c/cwebboot.cin @@ -1,8 +1,8 @@ /*1:*/ -#line 62 "cwebdir/common.w" +#line 66 "cwebdir/common.w" /*3:*/ -#line 51 "cwebdir/comm-w2c.h" +#line 53 "cwebdir/comm-w2c.h" #ifndef HAVE_GETTEXT #define HAVE_GETTEXT 0 @@ -23,7 +23,7 @@ #include <string.h> /*:3*//*89:*/ -#line 712 "cwebdir/comm-w2c.ch" +#line 709 "cwebdir/comm-w2c.ch" #if HAVE_GETTEXT #include <locale.h> @@ -34,7 +34,7 @@ #endif /*:89*//*91:*/ -#line 759 "cwebdir/comm-w2c.ch" +#line 756 "cwebdir/comm-w2c.ch" typedef bool boolean; #define HAVE_BOOLEAN @@ -44,13 +44,13 @@ typedef bool boolean; #include <lib/lib.h> /*:91*//*94:*/ -#line 798 "cwebdir/comm-w2c.ch" +#line 795 "cwebdir/comm-w2c.ch" #define CWEB #include "help.h" /*:94*/ -#line 63 "cwebdir/common.w" +#line 67 "cwebdir/common.w" #define _(S) gettext(S) \ @@ -70,18 +70,12 @@ typedef bool boolean; #define period_ast 026 #define minus_gt_ast 027 \ -#define compress(c) if(loc++<=limit) return c \ - -#define xisalpha(c) (isalpha((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisdigit(c) (isdigit((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisspace(c) (isspace((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xislower(c) (islower((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisupper(c) (isupper((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisxdigit(c) (isxdigit((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define isxalpha(c) ((c) =='_'||(c) =='$') \ - -#define ishigh(c) ((eight_bits) (c) > 0177) \ - \ +#define xisalpha(c) (isalpha((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisdigit(c) (isdigit((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisspace(c) (isspace((eight_bits) c) &&((eight_bits) c<0200) ) +#define xislower(c) (islower((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \ #define max_include_depth 10 \ @@ -112,12 +106,15 @@ typedef bool boolean; #define show_progress flags['p'] #define show_stats flags['s'] #define show_happiness flags['h'] -#define make_xrefs flags['x'] -#define check_for_change flags['c'] \ +#define temporary_output flags['t'] +#define make_xrefs flags['x'] \ #define update_terminal fflush(stdout) #define new_line putchar('\n') -#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) \ +#define putxchar putchar +#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) +#define C_printf(c,a) fprintf(C_file,c,a) +#define C_putc(c) putc(c,C_file) \ #define max_bytes 1000000 \ @@ -134,8 +131,7 @@ typedef bool boolean; #define lines_dont_match (change_limit-change_buffer!=limit-buffer|| \ strncmp(buffer,change_buffer,(size_t) (limit-buffer) ) ) \ -#define if_section_start_make_pending(b) { \ -*limit= '!'; \ +#define if_section_start_make_pending(b) {*limit= '!'; \ for(loc= buffer;xisspace(*loc) ;loc++) ; \ *limit= ' '; \ if(*loc=='@'&&(xisspace(*(loc+1) ) ||*(loc+1) =='*') ) change_pending= b; \ @@ -175,10 +171,10 @@ err_print(_("! Include file name too long") ) ;goto restart;} \ #define kpse_find_cweb(name) kpse_find_file(name,kpse_cweb_format,true) \ -#line 64 "cwebdir/common.w" +#line 68 "cwebdir/common.w" /*2:*/ -#line 33 "cwebdir/comm-w2c.h" +#line 35 "cwebdir/comm-w2c.h" typedef bool boolean; typedef uint8_t eight_bits; @@ -198,7 +194,7 @@ extern char*id_first; extern char*id_loc; /*:4*//*5:*/ -#line 109 "cwebdir/comm-w2c.h" +#line 105 "cwebdir/comm-w2c.h" extern char buffer[]; extern char*buffer_end; @@ -206,7 +202,7 @@ extern char*loc; extern char*limit; /*:5*//*6:*/ -#line 126 "cwebdir/comm-w2c.h" +#line 122 "cwebdir/comm-w2c.h" extern int include_depth; extern FILE*file[]; @@ -223,7 +219,7 @@ extern boolean changing; extern boolean web_file_open; /*:6*//*8:*/ -#line 147 "cwebdir/comm-w2c.h" +#line 143 "cwebdir/comm-w2c.h" extern sixteen_bits section_count; extern boolean changed_section[]; @@ -231,7 +227,7 @@ extern boolean change_pending; extern boolean print_where; /*:8*//*9:*/ -#line 161 "cwebdir/comm-w2c.h" +#line 157 "cwebdir/comm-w2c.h" typedef struct name_info{ char*byte_start; @@ -256,12 +252,12 @@ extern hash_pointer hash_end; extern hash_pointer h; /*:9*//*11:*/ -#line 205 "cwebdir/comm-w2c.h" +#line 201 "cwebdir/comm-w2c.h" extern int history; /*:11*//*13:*/ -#line 222 "cwebdir/comm-w2c.h" +#line 218 "cwebdir/comm-w2c.h" extern int argc; extern char**argv; @@ -273,7 +269,7 @@ extern boolean flags[]; extern const char*use_language; /*:13*//*14:*/ -#line 237 "cwebdir/comm-w2c.h" +#line 235 "cwebdir/comm-w2c.h" extern FILE*C_file; extern FILE*tex_file; @@ -283,22 +279,22 @@ extern FILE*active_file; extern FILE*check_file; /*:14*/ -#line 65 "cwebdir/common.w" +#line 69 "cwebdir/common.w" /*18:*/ -#line 79 "cwebdir/common.w" +#line 83 "cwebdir/common.w" #line 72 "cwebdir/comm-w2c.ch" cweb program; -#line 81 "cwebdir/common.w" +#line 85 "cwebdir/common.w" /*:18*//*19:*/ -#line 88 "cwebdir/common.w" +#line 92 "cwebdir/common.w" int phase; /*:19*//*21:*/ -#line 126 "cwebdir/common.w" +#line 130 "cwebdir/common.w" char section_text[longest_name+1]; char*section_text_end= section_text+longest_name; @@ -306,7 +302,7 @@ char*id_first; char*id_loc; /*:21*//*22:*/ -#line 146 "cwebdir/common.w" +#line 150 "cwebdir/common.w" char buffer[long_buf_size]; char*buffer_end= buffer+buf_size-2; @@ -314,7 +310,7 @@ char*loc= buffer; char*limit= buffer; /*:22*//*25:*/ -#line 190 "cwebdir/common.w" +#line 194 "cwebdir/common.w" int include_depth; FILE*file[max_include_depth]; @@ -322,7 +318,7 @@ FILE*change_file; char file_name[max_include_depth][max_file_name_length]; char change_file_name[max_file_name_length]; -#line 198 "cwebdir/common.w" +#line 202 "cwebdir/common.w" int line[max_include_depth]; int change_line; int change_depth; @@ -331,13 +327,13 @@ boolean changing; boolean web_file_open= false; /*:25*//*26:*/ -#line 216 "cwebdir/common.w" +#line 220 "cwebdir/common.w" static char change_buffer[buf_size]; static char*change_limit; /*:26*//*37:*/ -#line 396 "cwebdir/common.w" +#line 399 "cwebdir/common.w" sixteen_bits section_count; boolean changed_section[max_sections]; @@ -346,7 +342,7 @@ boolean change_pending; boolean print_where= false; /*:37*//*43:*/ -#line 593 "cwebdir/common.w" +#line 596 "cwebdir/common.w" char byte_mem[max_bytes]; char*byte_mem_end= byte_mem+max_bytes-1; @@ -354,60 +350,60 @@ name_info name_dir[max_names]; name_pointer name_dir_end= name_dir+max_names-1; /*:43*//*44:*/ -#line 604 "cwebdir/common.w" +#line 607 "cwebdir/common.w" char*byte_ptr; name_pointer name_ptr; /*:44*//*46:*/ -#line 624 "cwebdir/common.w" +#line 627 "cwebdir/common.w" name_pointer hash[hash_size]; hash_pointer hash_end= hash+hash_size-1; hash_pointer h; /*:46*//*65:*/ -#line 1006 "cwebdir/common.w" +#line 1014 "cwebdir/common.w" int history= spotless; /*:65*//*73:*/ -#line 1129 "cwebdir/common.w" +#line 1135 "cwebdir/common.w" int argc; char**argv; char C_file_name[max_file_name_length]; char tex_file_name[max_file_name_length]; char idx_file_name[max_file_name_length]; -#line 441 "cwebdir/comm-w2c.ch" +#line 431 "cwebdir/comm-w2c.ch" char scn_file_name[max_file_name_length]; char check_file_name[max_file_name_length]; -#line 1136 "cwebdir/common.w" +#line 1142 "cwebdir/common.w" boolean flags[128]; /*:73*//*83:*/ -#line 1273 "cwebdir/common.w" +#line 1282 "cwebdir/common.w" FILE*C_file; FILE*tex_file; FILE*idx_file; -#line 572 "cwebdir/comm-w2c.ch" +#line 569 "cwebdir/comm-w2c.ch" FILE*scn_file; FILE*check_file; -#line 579 "cwebdir/comm-w2c.ch" +#line 576 "cwebdir/comm-w2c.ch" FILE*active_file; char*found_filename; -#line 1279 "cwebdir/common.w" +#line 1288 "cwebdir/common.w" -#line 596 "cwebdir/comm-w2c.ch" +#line 593 "cwebdir/comm-w2c.ch" /*:83*//*86:*/ -#line 641 "cwebdir/comm-w2c.ch" +#line 638 "cwebdir/comm-w2c.ch" const char*use_language= ""; /*:86*//*87:*/ -#line 654 "cwebdir/comm-w2c.ch" +#line 651 "cwebdir/comm-w2c.ch" char cb_banner[max_banner]; string texmf_locale; @@ -417,22 +413,22 @@ string texmf_locale; char separators[]= SEPARATORS; /*:87*/ -#line 66 "cwebdir/common.w" +#line 70 "cwebdir/common.w" /*7:*/ -#line 141 "cwebdir/comm-w2c.h" +#line 137 "cwebdir/comm-w2c.h" extern boolean get_line(void); extern void check_complete(void); extern void reset_input(void); /*:7*//*10:*/ -#line 184 "cwebdir/comm-w2c.h" +#line 180 "cwebdir/comm-w2c.h" extern boolean names_match(name_pointer,const char*,size_t,eight_bits); extern name_pointer id_lookup(const char*,const char*,char); -extern name_pointer section_lookup(char*,char*,boolean); +extern name_pointer section_lookup(char*,char*,int); extern void init_node(name_pointer); extern void init_p(name_pointer,eight_bits); extern void print_prefix_name(name_pointer); @@ -440,7 +436,7 @@ extern void print_section_name(name_pointer); extern void sprint_section_name(char*,name_pointer); /*:10*//*12:*/ -#line 208 "cwebdir/comm-w2c.h" +#line 204 "cwebdir/comm-w2c.h" extern int wrap_up(void); extern void err_print(const char*); @@ -448,59 +444,59 @@ extern void fatal(const char*,const char*); extern void overflow(const char*); /*:12*//*15:*/ -#line 246 "cwebdir/comm-w2c.h" +#line 244 "cwebdir/comm-w2c.h" extern void common_init(void); extern void print_stats(void); extern void cb_show_banner(void); /*:15*//*24:*/ -#line 176 "cwebdir/common.w" +#line 180 "cwebdir/common.w" static boolean input_ln(FILE*); /*:24*//*28:*/ -#line 237 "cwebdir/common.w" +#line 241 "cwebdir/common.w" static void prime_the_change_buffer(void); /*:28*//*33:*/ -#line 337 "cwebdir/common.w" +#line 340 "cwebdir/common.w" static void check_change(void); /*:33*//*55:*/ -#line 767 "cwebdir/common.w" +#line 774 "cwebdir/common.w" static int web_strcmp(char*,int,char*,int); -static name_pointer add_section_name(name_pointer,int,char*,char*,boolean); -static void extend_section_name(name_pointer,char*,char*,boolean); +static name_pointer add_section_name(name_pointer,int,char*,char*,int); +static void extend_section_name(name_pointer,char*,char*,int); /*:55*//*64:*/ -#line 994 "cwebdir/common.w" +#line 1002 "cwebdir/common.w" static int section_name_cmp(char**,int,name_pointer); /*:64*//*76:*/ -#line 1190 "cwebdir/common.w" +#line 1197 "cwebdir/common.w" static void scan_args(void); -#line 502 "cwebdir/comm-w2c.ch" +#line 496 "cwebdir/comm-w2c.ch" /*:76*//*96:*/ -#line 811 "cwebdir/comm-w2c.ch" +#line 808 "cwebdir/comm-w2c.ch" static void cb_usage(const_string str); static void cb_usagehelp(const_string*message,const_string bug_email); /*:96*/ -#line 67 "cwebdir/common.w" +#line 71 "cwebdir/common.w" /*:1*//*20:*/ -#line 95 "cwebdir/common.w" +#line 99 "cwebdir/common.w" void common_init(void) { #line 78 "cwebdir/comm-w2c.ch" /*45:*/ -#line 608 "cwebdir/common.w" +#line 611 "cwebdir/common.w" name_dir->byte_start= byte_ptr= byte_mem; name_ptr= name_dir+1; @@ -508,7 +504,7 @@ name_ptr->byte_start= byte_mem; root= NULL; /*:45*//*47:*/ -#line 631 "cwebdir/common.w" +#line 634 "cwebdir/common.w" for(h= hash;h<=hash_end;*h++= NULL); @@ -516,7 +512,7 @@ for(h= hash;h<=hash_end;*h++= NULL); #line 78 "cwebdir/comm-w2c.ch" /*92:*/ -#line 773 "cwebdir/comm-w2c.ch" +#line 770 "cwebdir/comm-w2c.ch" kpse_set_program_name(argv[0],"cweb"); @@ -525,7 +521,7 @@ kpse_set_program_name(argv[0],"cweb"); #line 85 "cwebdir/comm-w2c.ch" /*90:*/ -#line 721 "cwebdir/comm-w2c.ch" +#line 718 "cwebdir/comm-w2c.ch" setlocale(LC_MESSAGES,setlocale(LC_CTYPE,"")); texmf_locale= kpse_var_expand("${TEXMFLOCALEDIR}"); @@ -544,20 +540,20 @@ textdomain("cweb"); #line 85 "cwebdir/comm-w2c.ch" /*74:*/ -#line 1142 "cwebdir/common.w" +#line 1148 "cwebdir/common.w" -#line 448 "cwebdir/comm-w2c.ch" +#line 438 "cwebdir/comm-w2c.ch" make_xrefs= true; -check_for_change= true; -#line 1144 "cwebdir/common.w" +temporary_output= true; +#line 1150 "cwebdir/common.w" show_stats= false; /*:74*/ #line 86 "cwebdir/comm-w2c.ch" -#line 101 "cwebdir/common.w" +#line 105 "cwebdir/common.w" /*84:*/ -#line 596 "cwebdir/comm-w2c.ch" +#line 593 "cwebdir/comm-w2c.ch" scan_args(); if(program==ctangle){ @@ -588,16 +584,16 @@ else strcpy(dot_pos,".wtp"); if((tex_file= fopen(check_file_name,"wb"))==NULL) fatal(_("! Cannot open output file "),check_file_name); } -#line 1291 "cwebdir/common.w" +#line 1300 "cwebdir/common.w" -#line 631 "cwebdir/comm-w2c.ch" +#line 628 "cwebdir/comm-w2c.ch" /*:84*/ -#line 101 "cwebdir/common.w" +#line 105 "cwebdir/common.w" } /*:20*//*23:*/ -#line 156 "cwebdir/common.w" +#line 160 "cwebdir/common.w" static boolean input_ln( FILE*fp) @@ -609,12 +605,12 @@ limit= k= buffer; while(k<=buffer_end&&(c= getc(fp))!=EOF&&c!='\n') #line 92 "cwebdir/comm-w2c.ch" if((*(k++)= c)!=' '&&c!='\r')limit= k; -#line 166 "cwebdir/common.w" +#line 170 "cwebdir/common.w" if(k> buffer_end) if((c= getc(fp))!=EOF&&c!='\n'){ #line 98 "cwebdir/comm-w2c.ch" ungetc(c,fp);loc= buffer;err_print(_("! Input line too long")); -#line 169 "cwebdir/common.w" +#line 173 "cwebdir/common.w" } if(c==EOF&&limit==buffer)return false; @@ -623,14 +619,14 @@ return true; } /*:23*//*27:*/ -#line 227 "cwebdir/common.w" +#line 231 "cwebdir/common.w" static void prime_the_change_buffer(void) { change_limit= change_buffer; /*29:*/ -#line 243 "cwebdir/common.w" +#line 247 "cwebdir/common.w" while(true){ change_line++; @@ -643,33 +639,33 @@ if(buffer[1]=='y'||buffer[1]=='z'||buffer[1]=='i'){ loc= buffer+2; #line 109 "cwebdir/comm-w2c.ch" err_print(_("! Missing @x in change file")); -#line 254 "cwebdir/common.w" +#line 258 "cwebdir/common.w" } } /*:29*/ -#line 232 "cwebdir/common.w" +#line 236 "cwebdir/common.w" /*30:*/ -#line 260 "cwebdir/common.w" +#line 264 "cwebdir/common.w" do{ change_line++; if(!input_ln(change_file)){ #line 115 "cwebdir/comm-w2c.ch" err_print(_("! Change file ended after @x")); -#line 265 "cwebdir/common.w" +#line 269 "cwebdir/common.w" return; } }while(limit==buffer); /*:30*/ -#line 233 "cwebdir/common.w" +#line 237 "cwebdir/common.w" /*31:*/ -#line 270 "cwebdir/common.w" +#line 274 "cwebdir/common.w" { change_limit= change_buffer+(ptrdiff_t)(limit-buffer); @@ -677,12 +673,12 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); } /*:31*/ -#line 234 "cwebdir/common.w" +#line 238 "cwebdir/common.w" } /*:27*//*32:*/ -#line 299 "cwebdir/common.w" +#line 302 "cwebdir/common.w" static void check_change(void) @@ -695,11 +691,11 @@ if_section_start_make_pending(true); if(!change_pending)changed_section[section_count]= true; } while(true){ -changing= print_where= true;change_line++; +changing= true;print_where= true;change_line++; if(!input_ln(change_file)){ #line 121 "cwebdir/comm-w2c.ch" err_print(_("! Change file ended before @y")); -#line 314 "cwebdir/common.w" +#line 317 "cwebdir/common.w" change_limit= change_buffer;changing= false; return; @@ -707,12 +703,12 @@ return; if(limit> buffer+1&&buffer[0]=='@'){ char xyz_code= xisupper(buffer[1])?tolower((eight_bits)buffer[1]):buffer[1]; /*34:*/ -#line 339 "cwebdir/common.w" +#line 342 "cwebdir/common.w" if(xyz_code=='x'||xyz_code=='z'){ #line 133 "cwebdir/comm-w2c.ch" loc= buffer+2;err_print(_("! Where is the matching @y?")); -#line 342 "cwebdir/common.w" +#line 345 "cwebdir/common.w" } else if(xyz_code=='y'){ @@ -721,7 +717,7 @@ loc= buffer+2; printf("\n! Hmm... %d ",n); #line 139 "cwebdir/comm-w2c.ch" err_print(_("of the preceding lines failed to match")); -#line 349 "cwebdir/common.w" +#line 352 "cwebdir/common.w" } change_depth= include_depth; @@ -729,11 +725,11 @@ return; } /*:34*/ -#line 321 "cwebdir/common.w" +#line 324 "cwebdir/common.w" } /*31:*/ -#line 270 "cwebdir/common.w" +#line 274 "cwebdir/common.w" { change_limit= change_buffer+(ptrdiff_t)(limit-buffer); @@ -741,14 +737,14 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); } /*:31*/ -#line 323 "cwebdir/common.w" +#line 326 "cwebdir/common.w" changing= false;cur_line++; while(!input_ln(cur_file)){ if(include_depth==0){ #line 127 "cwebdir/comm-w2c.ch" err_print(_("! CWEB file ended during a change")); -#line 328 "cwebdir/common.w" +#line 331 "cwebdir/common.w" input_has_ended= true;return; } @@ -759,67 +755,67 @@ if(lines_dont_match)n++; } /*:32*//*35:*/ -#line 359 "cwebdir/common.w" +#line 362 "cwebdir/common.w" void reset_input(void) { limit= buffer;loc= buffer+1;buffer[0]= ' '; /*36:*/ -#line 374 "cwebdir/common.w" +#line 377 "cwebdir/common.w" #line 149 "cwebdir/comm-w2c.ch" -if((found_filename= kpse_find_cweb(web_file_name))==NULL -||(web_file= fopen(found_filename,"r"))==NULL) +if((found_filename= kpse_find_cweb(web_file_name))==NULL|| +(web_file= fopen(found_filename,"r"))==NULL){ fatal(_("! Cannot open input file "),web_file_name); -else if(strlen(found_filename)<max_file_name_length){ +}else if(strlen(found_filename)<max_file_name_length){ if(strcmp(web_file_name,found_filename)) strcpy(web_file_name,found_filename+ ((strncmp(found_filename,"./",2)==0)?2:0)); free(found_filename); }else fatal(_("! Filename too long\n"),found_filename); -#line 380 "cwebdir/common.w" +#line 383 "cwebdir/common.w" web_file_open= true; #line 165 "cwebdir/comm-w2c.ch" -if((found_filename= kpse_find_cweb(change_file_name))==NULL -||(change_file= fopen(found_filename,"r"))==NULL) +if((found_filename= kpse_find_cweb(change_file_name))==NULL|| +(change_file= fopen(found_filename,"r"))==NULL){ fatal(_("! Cannot open change file "),change_file_name); -else if(strlen(found_filename)<max_file_name_length){ +}else if(strlen(found_filename)<max_file_name_length){ if(strcmp(change_file_name,found_filename)) strcpy(change_file_name,found_filename+ ((strncmp(found_filename,"./",2)==0)?2:0)); free(found_filename); }else fatal(_("! Filename too long\n"),found_filename); -#line 385 "cwebdir/common.w" +#line 388 "cwebdir/common.w" /*:36*/ -#line 364 "cwebdir/common.w" +#line 367 "cwebdir/common.w" -include_depth= cur_line= change_line= 0; +include_depth= 0;cur_line= 0;change_line= 0; change_depth= include_depth; -changing= true;prime_the_change_buffer();changing= !changing; +changing= 1;prime_the_change_buffer();changing= !changing; limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= false; } /*:35*//*38:*/ -#line 403 "cwebdir/common.w" +#line 406 "cwebdir/common.w" boolean get_line(void) { restart: if(changing&&include_depth==change_depth) /*41:*/ -#line 511 "cwebdir/common.w" +#line 514 "cwebdir/common.w" { change_line++; if(!input_ln(change_file)){ #line 274 "cwebdir/comm-w2c.ch" err_print(_("! Change file ended without @z")); -#line 515 "cwebdir/common.w" +#line 518 "cwebdir/common.w" buffer[0]= '@';buffer[1]= 'z';limit= buffer+2; } @@ -837,7 +833,7 @@ if(buffer[1]=='x'||buffer[1]=='y'){ loc= buffer+2; #line 280 "cwebdir/comm-w2c.ch" err_print(_("! Where is the matching @z?")); -#line 531 "cwebdir/common.w" +#line 534 "cwebdir/common.w" } else if(buffer[1]=='z'){ @@ -848,11 +844,11 @@ prime_the_change_buffer();changing= !changing;print_where= true; } /*:41*/ -#line 408 "cwebdir/common.w" +#line 411 "cwebdir/common.w" if(!changing||include_depth> change_depth){ /*40:*/ -#line 494 "cwebdir/common.w" +#line 497 "cwebdir/common.w" { cur_line++; while(!input_ln(cur_file)){ @@ -871,7 +867,7 @@ if(change_limit> change_buffer)check_change(); } /*:40*/ -#line 410 "cwebdir/common.w" +#line 413 "cwebdir/common.w" if(changing&&include_depth==change_depth)goto restart; } @@ -883,25 +879,25 @@ while(*loc==' '||*loc=='\t')loc++; if(loc>=limit){ #line 180 "cwebdir/comm-w2c.ch" err_print(_("! Include file name not given")); -#line 420 "cwebdir/common.w" +#line 423 "cwebdir/common.w" goto restart; } if(include_depth>=max_include_depth-1){ #line 186 "cwebdir/comm-w2c.ch" err_print(_("! Too many nested includes")); -#line 425 "cwebdir/common.w" +#line 428 "cwebdir/common.w" goto restart; } include_depth++; /*39:*/ -#line 448 "cwebdir/common.w" +#line 451 "cwebdir/common.w" { #line 223 "cwebdir/comm-w2c.ch" char*cur_file_name_end= cur_file_name+max_file_name_length-1; char*k= cur_file_name; -#line 453 "cwebdir/common.w" +#line 456 "cwebdir/common.w" if(*loc=='"'){ loc++; @@ -913,8 +909,8 @@ if(k> cur_file_name_end)too_long(); *k= '\0'; #line 230 "cwebdir/comm-w2c.ch" -if((found_filename= kpse_find_cweb(cur_file_name))!=NULL -&&(cur_file= fopen(found_filename,"r"))!=NULL){ +if((found_filename= kpse_find_cweb(cur_file_name))!=NULL&& +(cur_file= fopen(found_filename,"r"))!=NULL){ if(strlen(found_filename)<max_file_name_length){ if(strcmp(cur_file_name,found_filename)) @@ -922,17 +918,17 @@ strcpy(cur_file_name,found_filename+ ((strncmp(found_filename,"./",2)==0)?2:0)); free(found_filename); }else fatal(_("! Filename too long\n"),found_filename); -#line 464 "cwebdir/common.w" +#line 467 "cwebdir/common.w" cur_line= 0;print_where= true; goto restart; } #line 268 "cwebdir/comm-w2c.ch" include_depth--;err_print(_("! Cannot open include file"));goto restart; -#line 492 "cwebdir/common.w" +#line 495 "cwebdir/common.w" } /*:39*/ -#line 429 "cwebdir/common.w" +#line 432 "cwebdir/common.w" } return true; @@ -940,7 +936,7 @@ return true; #line 201 "cwebdir/comm-w2c.ch" /*:38*//*42:*/ -#line 543 "cwebdir/common.w" +#line 546 "cwebdir/common.w" void check_complete(void){ @@ -950,13 +946,13 @@ limit= buffer+(ptrdiff_t)(change_limit-change_buffer); changing= true;change_depth= include_depth;loc= buffer; #line 286 "cwebdir/comm-w2c.ch" err_print(_("! Change file entry did not match")); -#line 551 "cwebdir/common.w" +#line 554 "cwebdir/common.w" } } /*:42*//*48:*/ -#line 636 "cwebdir/common.w" +#line 639 "cwebdir/common.w" name_pointer id_lookup( @@ -971,17 +967,17 @@ name_pointer p; if(last==NULL)for(last= first;*last!='\0';last++); l= (int)(last-first); /*49:*/ -#line 659 "cwebdir/common.w" +#line 662 "cwebdir/common.w" h= (eight_bits)*i; while(++i<last)h= (h+h+(int)((eight_bits)*i))%hash_size; /*:49*/ -#line 649 "cwebdir/common.w" +#line 652 "cwebdir/common.w" /*50:*/ -#line 667 "cwebdir/common.w" +#line 670 "cwebdir/common.w" p= hash[h]; while(p&&!names_match(p,first,l,t))p= p->link; @@ -991,28 +987,28 @@ p->link= hash[h];hash[h]= p; } /*:50*/ -#line 650 "cwebdir/common.w" +#line 653 "cwebdir/common.w" if(p==name_ptr)/*51:*/ -#line 679 "cwebdir/common.w" +#line 681 "cwebdir/common.w" { #line 293 "cwebdir/comm-w2c.ch" if(byte_ptr+l> byte_mem_end)overflow(_("byte memory")); if(name_ptr>=name_dir_end)overflow(_("name")); -#line 682 "cwebdir/common.w" +#line 684 "cwebdir/common.w" strncpy(byte_ptr,first,l); (++name_ptr)->byte_start= byte_ptr+= l; init_p(p,t); } /*:51*/ -#line 651 "cwebdir/common.w" +#line 654 "cwebdir/common.w" return p; } /*:48*//*52:*/ -#line 711 "cwebdir/common.w" +#line 713 "cwebdir/common.w" void print_section_name( @@ -1022,16 +1018,18 @@ char*ss,*s= first_chunk(p); name_pointer q= p+1; while(p!=name_dir){ ss= (p+1)->byte_start-1; -if(*ss==' '&&ss>=s)p= q->link,q= p; -else ss++,p= name_dir,q= NULL; -term_write(s,(size_t)(ss-s)); +if(*ss==' '&&ss>=s){ +term_write(s,(size_t)(ss-s));p= q->link;q= p; +}else{ +term_write(s,(size_t)(ss+1-s));p= name_dir;q= NULL; +} s= p->byte_start; } if(q)term_write("...",3); } /*:52*//*53:*/ -#line 728 "cwebdir/common.w" +#line 732 "cwebdir/common.w" void sprint_section_name( @@ -1042,8 +1040,11 @@ char*ss,*s= first_chunk(p); name_pointer q= p+1; while(p!=name_dir){ ss= (p+1)->byte_start-1; -if(*ss==' '&&ss>=s)p= q->link,q= p; -else ss++,p= name_dir; +if(*ss==' '&&ss>=s){ +p= q->link;q= p; +}else{ +ss++;p= name_dir; +} strncpy(dest,s,(size_t)(ss-s)),dest+= ss-s; s= p->byte_start; } @@ -1051,7 +1052,7 @@ s= p->byte_start; } /*:53*//*54:*/ -#line 746 "cwebdir/common.w" +#line 753 "cwebdir/common.w" void print_prefix_name( @@ -1064,7 +1065,7 @@ if(s+l<(p+1)->byte_start)term_write("...",3); } /*:54*//*56:*/ -#line 772 "cwebdir/common.w" +#line 779 "cwebdir/common.w" static int web_strcmp( char*j, @@ -1082,7 +1083,7 @@ else return greater; } /*:56*//*57:*/ -#line 801 "cwebdir/common.w" +#line 808 "cwebdir/common.w" static name_pointer add_section_name( @@ -1090,7 +1091,7 @@ name_pointer par, int c, char*first, char*last, -boolean ispref) +int ispref) { name_pointer p= name_ptr; char*s= first_chunk(p); @@ -1098,7 +1099,7 @@ int name_len= (int)(last-first)+ispref; #line 301 "cwebdir/comm-w2c.ch" if(s+name_len> byte_mem_end)overflow(_("byte memory")); if(name_ptr+1>=name_dir_end)overflow(_("name")); -#line 815 "cwebdir/common.w" +#line 822 "cwebdir/common.w" (++name_ptr)->byte_start= byte_ptr= s+name_len; if(ispref){ *(byte_ptr-1)= ' '; @@ -1108,48 +1109,49 @@ name_ptr->link= name_dir; } set_prefix_length(p,name_len); strncpy(s,first,name_len); -p->llink= p->rlink= NULL; +p->llink= NULL; +p->rlink= NULL; init_node(p); return par==NULL?(root= p):c==less?(par->llink= p):(par->rlink= p); } /*:57*//*58:*/ -#line 829 "cwebdir/common.w" +#line 837 "cwebdir/common.w" static void extend_section_name( name_pointer p, char*first, char*last, -boolean ispref) +int ispref) { char*s; name_pointer q= p+1; int name_len= (int)(last-first)+ispref; #line 308 "cwebdir/comm-w2c.ch" if(name_ptr>=name_dir_end)overflow(_("name")); -#line 841 "cwebdir/common.w" +#line 849 "cwebdir/common.w" while(q->link!=name_dir)q= q->link; q->link= name_ptr; s= name_ptr->byte_start; name_ptr->link= name_dir; #line 314 "cwebdir/comm-w2c.ch" if(s+name_len> byte_mem_end)overflow(_("byte memory")); -#line 846 "cwebdir/common.w" +#line 854 "cwebdir/common.w" (++name_ptr)->byte_start= byte_ptr= s+name_len; strncpy(s,first,name_len); if(ispref)*(byte_ptr-1)= ' '; } /*:58*//*59:*/ -#line 857 "cwebdir/common.w" +#line 865 "cwebdir/common.w" name_pointer section_lookup( char*first,char*last, -boolean ispref) +int ispref) { -int c= less; +int c= 0; name_pointer p= root; name_pointer q= NULL; name_pointer r= NULL; @@ -1157,7 +1159,7 @@ name_pointer par= NULL; int name_len= (int)(last-first)+1; /*60:*/ -#line 881 "cwebdir/common.w" +#line 889 "cwebdir/common.w" while(p){ c= web_strcmp(first,name_len,first_chunk(p),prefix_length(p)); @@ -1169,12 +1171,12 @@ p= (c==less?p->llink:p->rlink); if(r!=NULL){ #line 320 "cwebdir/comm-w2c.ch" fputs(_("\n! Ambiguous prefix: matches <"),stdout); -#line 891 "cwebdir/common.w" +#line 899 "cwebdir/common.w" print_prefix_name(p); #line 326 "cwebdir/comm-w2c.ch" fputs(_(">\n and <"),stdout); -#line 894 "cwebdir/common.w" +#line 902 "cwebdir/common.w" print_prefix_name(r); err_print(">"); return name_dir; @@ -1188,19 +1190,19 @@ p= q,q= NULL; } /*:60*/ -#line 871 "cwebdir/common.w" +#line 879 "cwebdir/common.w" /*61:*/ -#line 906 "cwebdir/common.w" +#line 914 "cwebdir/common.w" if(r==NULL) return add_section_name(par,c,first,last+1,ispref); /*:61*/ -#line 872 "cwebdir/common.w" +#line 880 "cwebdir/common.w" /*62:*/ -#line 914 "cwebdir/common.w" +#line 922 "cwebdir/common.w" switch(section_name_cmp(&first,name_len,r)){ @@ -1208,46 +1210,46 @@ case prefix: if(!ispref){ #line 332 "cwebdir/comm-w2c.ch" fputs(_("\n! New name is a prefix of <"),stdout); -#line 920 "cwebdir/common.w" +#line 928 "cwebdir/common.w" print_section_name(r); err_print(">"); } else if(name_len<prefix_length(r))set_prefix_length(r,name_len); -case equal:break; +case equal:return r; case extension:if(!ispref||first<=last) extend_section_name(r,first,last+1,ispref); -break; +return r; case bad_extension: #line 338 "cwebdir/comm-w2c.ch" fputs(_("\n! New name extends <"),stdout); -#line 932 "cwebdir/common.w" +#line 940 "cwebdir/common.w" print_section_name(r); err_print(">"); -break; +return r; default: #line 344 "cwebdir/comm-w2c.ch" fputs(_("\n! Section name incompatible with <"),stdout); -#line 938 "cwebdir/common.w" +#line 946 "cwebdir/common.w" print_prefix_name(r); #line 350 "cwebdir/comm-w2c.ch" fputs(_(">,\n which abbreviates <"),stdout); -#line 941 "cwebdir/common.w" +#line 949 "cwebdir/common.w" print_section_name(r); err_print(">"); -} return r; +} /*:62*/ -#line 873 "cwebdir/common.w" +#line 881 "cwebdir/common.w" } /*:59*//*63:*/ -#line 962 "cwebdir/common.w" +#line 970 "cwebdir/common.w" static int section_name_cmp( char**pfirst, @@ -1257,12 +1259,12 @@ name_pointer r) char*first= *pfirst; name_pointer q= r+1; char*ss,*s= first_chunk(r); -int c= less; -boolean ispref; +int c; +int ispref; while(true){ ss= (r+1)->byte_start-1; -if(*ss==' '&&ss>=r->byte_start)ispref= true,q= q->link; -else ispref= false,ss++,q= name_dir; +if(*ss==' '&&ss>=r->byte_start)ispref= 1,q= q->link; +else ispref= 0,ss++,q= name_dir; switch(c= web_strcmp(first,len,s,ss-s)){ case equal:if(q==name_dir) if(ispref){ @@ -1281,7 +1283,7 @@ default:return c; } /*:63*//*66:*/ -#line 1016 "cwebdir/common.w" +#line 1024 "cwebdir/common.w" void err_print( @@ -1290,20 +1292,20 @@ const char*s) char*k,*l; printf(*s=='!'?"\n%s":"%s",s); if(web_file_open)/*67:*/ -#line 1036 "cwebdir/common.w" +#line 1044 "cwebdir/common.w" {if(changing&&include_depth==change_depth) #line 358 "cwebdir/comm-w2c.ch" printf(_(". (l. %d of change file)\n"),change_line); else if(include_depth==0)printf(_(". (l. %d)\n"),cur_line); else printf(_(". (l. %d of include file %s)\n"),cur_line,cur_file_name); -#line 1041 "cwebdir/common.w" +#line 1049 "cwebdir/common.w" l= (loc>=limit?limit:loc); if(l> buffer){ for(k= buffer;k<l;k++) if(*k=='\t')putchar(' '); else putchar(*k); -new_line; +putchar('\n'); for(k= buffer;k<l;k++)putchar(' '); } for(k= l;k<limit;k++)putchar(*k); @@ -1312,13 +1314,13 @@ putchar(' '); } /*:67*/ -#line 1023 "cwebdir/common.w" +#line 1031 "cwebdir/common.w" update_terminal;mark_error; } /*:66*//*68:*/ -#line 1068 "cwebdir/common.w" +#line 1076 "cwebdir/common.w" int wrap_up(void){ if(show_progress)new_line; @@ -1326,26 +1328,26 @@ if(show_stats) print_stats(); #line 388 "cwebdir/comm-w2c.ch" /*69:*/ -#line 1078 "cwebdir/common.w" +#line 1086 "cwebdir/common.w" switch(history){ -#line 414 "cwebdir/comm-w2c.ch" +#line 412 "cwebdir/comm-w2c.ch" case spotless: if(show_happiness)puts(_("(No errors were found.)"));break; case harmless_message: puts(_("(Did you see the warning message above?)"));break; case error_message: puts(_("(Pardon me, but I think I spotted something wrong.)"));break; -case fatal_message:default: +case fatal_message: puts(_("(That was a fatal error, my friend.)")); -#line 1088 "cwebdir/common.w" +#line 1094 "cwebdir/common.w" } /*:69*/ #line 388 "cwebdir/comm-w2c.ch" /*88:*/ -#line 665 "cwebdir/comm-w2c.ch" +#line 662 "cwebdir/comm-w2c.ch" if(C_file)fclose(C_file); if(tex_file)fclose(tex_file); @@ -1358,16 +1360,16 @@ remove(check_file_name); #line 396 "cwebdir/comm-w2c.ch" switch(history){ -case spotless:return RETURN_OK; case harmless_message:return RETURN_WARN; case error_message:return RETURN_ERROR; -case fatal_message:default:return RETURN_FAIL; +case fatal_message:return RETURN_FAIL; +default:return RETURN_OK; } -#line 1076 "cwebdir/common.w" +#line 1084 "cwebdir/common.w" } /*:68*//*70:*/ -#line 1096 "cwebdir/common.w" +#line 1102 "cwebdir/common.w" void fatal( const char*s,const char*t) @@ -1378,19 +1380,19 @@ history= fatal_message;exit(wrap_up()); } /*:70*//*71:*/ -#line 1107 "cwebdir/common.w" +#line 1113 "cwebdir/common.w" void overflow( const char*t) { -#line 427 "cwebdir/comm-w2c.ch" +#line 425 "cwebdir/comm-w2c.ch" printf(_("\n! Sorry, %s capacity exceeded"),t);fatal("",""); -#line 1112 "cwebdir/common.w" +#line 1118 "cwebdir/common.w" } /*:71*//*75:*/ -#line 1161 "cwebdir/common.w" +#line 1167 "cwebdir/common.w" static void scan_args(void) @@ -1401,39 +1403,40 @@ register char*s; boolean found_web= false,found_change= false,found_out= false; -#line 472 "cwebdir/comm-w2c.ch" -strcpy(change_file_name,"/dev/null"); +#line 462 "cwebdir/comm-w2c.ch" + #if defined DEV_NULL strncpy(change_file_name,DEV_NULL,max_file_name_length-2); change_file_name[max_file_name_length-2]= '\0'; #elif defined _DEV_NULL strncpy(change_file_name,_DEV_NULL,max_file_name_length-2); change_file_name[max_file_name_length-2]= '\0'; +#else +strcpy(change_file_name,"/dev/null"); #endif -#line 1172 "cwebdir/common.w" +#line 1178 "cwebdir/common.w" while(--argc> 0){ if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*80:*/ -#line 1251 "cwebdir/common.w" +#line 510 "cwebdir/comm-w2c.ch" -#line 515 "cwebdir/comm-w2c.ch" { if(strcmp("-help",*argv)==0||strcmp("--help",*argv)==0) /*95:*/ -#line 802 "cwebdir/comm-w2c.ch" +#line 799 "cwebdir/comm-w2c.ch" cb_usagehelp(program==ctangle?CTANGLEHELP: program==cweave?CWEAVEHELP:CTWILLHELP,NULL); /*:95*/ -#line 518 "cwebdir/comm-w2c.ch" +#line 514 "cwebdir/comm-w2c.ch" if(strcmp("-version",*argv)==0||strcmp("--version",*argv)==0) /*98:*/ -#line 850 "cwebdir/comm-w2c.ch" +#line 846 "cwebdir/comm-w2c.ch" printversionandexit(cb_banner, program==ctwill?"Donald E. Knuth":"Silvio Levy and Donald E. Knuth", @@ -1441,68 +1444,72 @@ NULL,"Contemporary development on https://github.com/ascherer/cweb.\n"); /*:98*/ -#line 521 "cwebdir/comm-w2c.ch" +#line 517 "cwebdir/comm-w2c.ch" if(strcmp("-verbose",*argv)==0||strcmp("--verbose",*argv)==0) -strcpy(*argv,"-v"); +{show_banner= show_progress= show_happiness= 1;continue;} if(strcmp("-quiet",*argv)==0||strcmp("--quiet",*argv)==0) -strcpy(*argv,"-q"); -for(dot_pos= *argv+1;*dot_pos> '\0';dot_pos++){ -switch(*dot_pos){ -case'v':show_banner= show_progress= show_happiness= true;continue; -case'q':show_banner= show_progress= show_happiness= false;continue; -case'd': +{show_banner= show_progress= show_happiness= 0;continue;} +for(dot_pos= *argv+1;*dot_pos> '\0';dot_pos++) +if(*dot_pos=='v'){ +show_banner= show_progress= show_happiness= true; +}else +if(*dot_pos=='q'){ +show_banner= show_progress= show_happiness= false; +}else +if(*dot_pos=='d'){ if(sscanf(++dot_pos,"%u",&kpathsea_debug)!=1)/*81:*/ -#line 558 "cwebdir/comm-w2c.ch" +#line 555 "cwebdir/comm-w2c.ch" cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); -#line 1266 "cwebdir/common.w" +#line 1275 "cwebdir/common.w" -#line 566 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" /*:81*/ -#line 533 "cwebdir/comm-w2c.ch" +#line 532 "cwebdir/comm-w2c.ch" while(isdigit(*dot_pos))dot_pos++; dot_pos--; -continue; -case'l':use_language= ++dot_pos;break; -default:flags[(eight_bits)*dot_pos]= flag_change;continue; -} +}else +if(*dot_pos=='l'){ +use_language= ++dot_pos; break; +}else +#line 1261 "cwebdir/common.w" + flags[(eight_bits)*dot_pos]= flag_change; } -} -#line 1254 "cwebdir/common.w" -#line 558 "cwebdir/comm-w2c.ch" +#line 555 "cwebdir/comm-w2c.ch" /*:80*/ -#line 1173 "cwebdir/common.w" +#line 1179 "cwebdir/common.w" else{ s= name_pos= *argv;dot_pos= NULL; -#line 489 "cwebdir/comm-w2c.ch" -while(*s) +#line 482 "cwebdir/comm-w2c.ch" +while(*s){ if(*s=='.')dot_pos= s++; else if(*s==DIR_SEPARATOR||*s==DEVICE_SEPARATOR||*s=='/') dot_pos= NULL,name_pos= ++s; else s++; +} -#line 1180 "cwebdir/common.w" +#line 1187 "cwebdir/common.w" if(!found_web)/*77:*/ -#line 1199 "cwebdir/common.w" +#line 1206 "cwebdir/common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 566 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); -#line 1268 "cwebdir/common.w" +#line 1277 "cwebdir/common.w" /*:82*/ -#line 1202 "cwebdir/common.w" +#line 1209 "cwebdir/common.w" if(dot_pos==NULL) sprintf(web_file_name,"%s.w",*argv); @@ -1510,7 +1517,7 @@ else{ strcpy(web_file_name,*argv); *dot_pos= 0; } -#line 1210 "cwebdir/common.w" +#line 1217 "cwebdir/common.w" sprintf(tex_file_name,"%s.tex",name_pos); sprintf(idx_file_name,"%s.idx",name_pos); sprintf(scn_file_name,"%s.scn",name_pos); @@ -1519,22 +1526,22 @@ found_web= true; } /*:77*/ -#line 1181 "cwebdir/common.w" +#line 1188 "cwebdir/common.w" else if(!found_change)/*78:*/ -#line 1217 "cwebdir/common.w" +#line 1224 "cwebdir/common.w" { if(strcmp(*argv,"-")!=0){ if(s-*argv> max_file_name_length-4) /*82:*/ -#line 566 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); -#line 1268 "cwebdir/common.w" +#line 1277 "cwebdir/common.w" /*:82*/ -#line 1221 "cwebdir/common.w" +#line 1228 "cwebdir/common.w" if(dot_pos==NULL) sprintf(change_file_name,"%s.ch",*argv); @@ -1544,21 +1551,21 @@ found_change= true; } /*:78*/ -#line 1182 "cwebdir/common.w" +#line 1189 "cwebdir/common.w" else if(!found_out)/*79:*/ -#line 1229 "cwebdir/common.w" +#line 1236 "cwebdir/common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 566 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); -#line 1268 "cwebdir/common.w" +#line 1277 "cwebdir/common.w" /*:82*/ -#line 1232 "cwebdir/common.w" +#line 1239 "cwebdir/common.w" if(dot_pos==NULL){ sprintf(tex_file_name,"%s.tex",*argv); @@ -1578,36 +1585,36 @@ found_out= true; } /*:79*/ -#line 1183 "cwebdir/common.w" +#line 1190 "cwebdir/common.w" else/*81:*/ -#line 558 "cwebdir/comm-w2c.ch" +#line 555 "cwebdir/comm-w2c.ch" cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); -#line 1266 "cwebdir/common.w" +#line 1275 "cwebdir/common.w" -#line 566 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" /*:81*/ -#line 1184 "cwebdir/common.w" +#line 1191 "cwebdir/common.w" } } if(!found_web)/*81:*/ -#line 558 "cwebdir/comm-w2c.ch" +#line 555 "cwebdir/comm-w2c.ch" cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); -#line 1266 "cwebdir/common.w" +#line 1275 "cwebdir/common.w" -#line 566 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" /*:81*/ -#line 1187 "cwebdir/common.w" +#line 1194 "cwebdir/common.w" } /*:75*//*97:*/ -#line 815 "cwebdir/comm-w2c.ch" +#line 812 "cwebdir/comm-w2c.ch" static void cb_usage(const_string str) { @@ -1628,7 +1635,6 @@ bug_email= "tex-k@tug.org"; textdomain("web2c-help"); while(*message){ - printf("%s\n",strcmp("",*message)?_(*message):*message); ++message; } @@ -1641,10 +1647,11 @@ history= spotless;exit(wrap_up()); } /*:97*//*99:*/ -#line 858 "cwebdir/comm-w2c.ch" +#line 854 "cwebdir/comm-w2c.ch" void cb_show_banner(void) { +assert(cb_banner[0]!='\0'); textdomain("cweb-tl"); printf("%s%s\n",_(cb_banner),versionstring); diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index 13b82147ac2..be924eeb0c1 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -1,44 +1,3 @@ -2021-04-16 Andreas Scherer <https://ascherer.github.io> - - * Makefile, - * README, - * comm-{amiga,bs,mac,mini,os2,pc,ql,vms,w2c,w32}.ch, - * comm-w2c.h, - * common.bux, - * common.c, - * common.h, - * common.w, - * ctang-{bs,man,pc,ql,vms,w2c,w32}.ch, - * ctangle.c, - * ctangle.w, - * ctproofmac.tex, - * ctrwinxmac.tex, - * ctwill-{mini,w2c}.ch, - * ctwill.bux, - * ctwimac.tex, - * cweav-{bs,man,pc,ql,vms,w2c,w32}.ch, - * cweave.w, - * cweb.1, - * cwebmac.tex, - * cwebman-w2c.ch, - * cwebman.tex, - * iso_types.w, - * po/cweb[-tl].pot, - * po/de/cweb[-tl].po, - * po/de/web2c-help.po, - * po/it/cweb.po, - * po/web2c-help.pot, - * prod-twill.w, - * prod.w, - * refsort.ch, - * resort.w, - * system.bux, - * texinputs/Xcwebmac.tex, - * texinputs/pdfctwimac.tex, - * twinx-startup.tex, - * twinx.ch, - * twinx.w: CWEB 4.3 and CWEBbin 2021. - 2021-02-25 Andreas Scherer <https://ascherer.github.io> * Makefile, diff --git a/Build/source/texk/web2c/cwebdir/Makefile b/Build/source/texk/web2c/cwebdir/Makefile index 3ad5bc581b7..0c20d83c10c 100644 --- a/Build/source/texk/web2c/cwebdir/Makefile +++ b/Build/source/texk/web2c/cwebdir/Makefile @@ -1,6 +1,6 @@ # This file is part of CWEB. # It is distributed WITHOUT ANY WARRANTY, express or implied. -# Version 4.3 --- April 2021 +# Version 4.2 --- February 2021 # Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth @@ -74,14 +74,14 @@ CWEAVE = ./cweave CTANGLE = ./ctangle SOURCES = cweave.w common.w ctangle.w ALL = common.w ctangle.w cweave.w prod.w \ - Makefile README common.c common.h ctangle.c \ + Makefile common.c common.h ctangle.c \ cwebman.tex cwebmac.tex comm-vms.ch ctang-vms.ch \ cweav-vms.ch comm-man.ch ctang-man.ch cweav-man.ch \ comm-pc.ch ctang-pc.ch cweav-pc.ch comm-amiga.ch \ comm-bs.ch ctang-bs.ch cweav-bs.ch makefile.bs \ comm-ql.ch ctang-ql.ch cweav-ql.ch readme.ql \ comm-w32.ch ctang-w32.ch cweav-w32.ch \ - comm-os2.ch comm-mac.ch cweb.1 cweb.el c++lib.w iso_types.w + comm-os2.ch comm-mac.ch cweb.1 cweb.el c++lib.w README .SUFFIXES: .dvi .tex .w .pdf @@ -183,8 +183,6 @@ install: all - mkdir $(CWEBINPUTS) $(CP) c++lib.w $(CWEBINPUTS) chmod 644 $(CWEBINPUTS)/c++lib.w - $(CP) iso_types.w $(CWEBINPUTS) - chmod 644 $(CWEBINPUTS)/iso_types.w floppy: $(ALL) examples bar cvhf /dev/rfd0 $(ALL) examples diff --git a/Build/source/texk/web2c/cwebdir/README b/Build/source/texk/web2c/cwebdir/README index 7878c2281ab..081dc5aa0b6 100644 --- a/Build/source/texk/web2c/cwebdir/README +++ b/Build/source/texk/web2c/cwebdir/README @@ -1,7 +1,7 @@ % This file is part of CWEB. % The CWEB programs by Silvio Levy are based on programs by D. E. Knuth. % They are distributed WITHOUT ANY WARRANTY, express or implied. -% This README file last updated April 2021 by Andreas Scherer +% This README file last updated February 2021 by Andreas Scherer % Copyright (C) 1987,1990,1993,2000,2016 Silvio Levy and Donald E. Knuth @@ -66,16 +66,14 @@ makefile.bs prod.w readme.ql c++lib.w -iso_types.w The file cwebman.tex is the user manual. The examples directory contains additional examples of the use of CWEB. The files common.c and ctangle.c are used for bootstrapping. The file cweb.1 is a manual page. The file cweb.el is suggested for GNU-Emacs users. -The files c++lib.w and iso_types.w are for C++ users (say `@i c++lib.w' -and/or `@i iso_types.w' at beginning of program). -The files *-man.ch are used if you want to make the full 243-page CWEB manual. +The file c++lib.w is for C++ users (say `@i c++lib.w' at beginning of program). +The files *-man.ch are used if you want to make the full 240-page CWEB manual. The files *-bs.ch are used instead of *-pc.ch if you are doing BIG programs. You can use makefile.bs to make CWEB with *-bs.ch. The files *-ql.ch are for QDOS/SMSQ systems; see readme.ql for further info. diff --git a/Build/source/texk/web2c/cwebdir/comm-amiga.ch b/Build/source/texk/web2c/cwebdir/comm-amiga.ch index fecfc9460ca..f17c2d333b4 100644 --- a/Build/source/texk/web2c/cwebdir/comm-amiga.ch +++ b/Build/source/texk/web2c/cwebdir/comm-amiga.ch @@ -10,7 +10,7 @@ An omitted change file argument means that |"/dev/null"| should be used, An omitted change file argument means that |"nil:"| should be used, @z -@x section 75 +@x section 76 strcpy(change_file_name,"/dev/null"); @y strcpy(change_file_name,"nil:"); diff --git a/Build/source/texk/web2c/cwebdir/comm-bs.ch b/Build/source/texk/web2c/cwebdir/comm-bs.ch index d121e3d602c..b01b86799d7 100644 --- a/Build/source/texk/web2c/cwebdir/comm-bs.ch +++ b/Build/source/texk/web2c/cwebdir/comm-bs.ch @@ -15,7 +15,7 @@ by using "huge" pointers. (Update attempt by Andreas Scherer, 31 Jan 2021. Good luck!) -@x Section 9. +@x Section 6. for section names */ @<Common code...@>= @@ -50,7 +50,7 @@ typedef struct name_info { union { void huge* equiv_member; void huge* xref_member; - } ptr_union; /* info corresponding to names */ + } ptr_union; /* info corresponding to names */ } name_info; /* contains information about an identifier or section name */ typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */ typedef name_pointer *hash_pointer; @@ -136,23 +136,23 @@ name_pointer p) @x Section 57. static name_pointer -add_section_name( /* install a new node in the tree */ +add_section_name(@t\1\1@> /* install a new node in the tree */ name_pointer par, /* parent of new node */ int c, /* right or left? */ char *first, /* first character of section name */ char *last, /* last character of section name, plus one */ -boolean ispref) /* are we adding a prefix or a full name? */ +int ispref@t\2\2@>) /* are we adding a prefix or a full name? */ { name_pointer p=name_ptr; /* new node */ char *s=first_chunk(p); @y static name_pointer -add_section_name( /* install a new node in the tree */ +add_section_name(@t\1\1@> /* install a new node in the tree */ name_pointer par, /* parent of new node */ int c, /* right or left? */ char huge* first, /* first character of section name */ char huge* last, /* last character of section name, plus one */ -boolean ispref) /* are we adding a prefix or a full name? */ +int ispref@t\2\2@>) /* are we adding a prefix or a full name? */ { name_pointer p=name_ptr; /* new node */ char huge* s=first_chunk(p); @@ -161,39 +161,39 @@ boolean ispref) /* are we adding a prefix or a full name? */ @x Section 58. static void -extend_section_name( +extend_section_name(@t\1\1@> name_pointer p, /* name to be extended */ char *first, /* beginning of extension text */ char *last, /* one beyond end of extension text */ -boolean ispref) /* are we adding a prefix or a full name? */ +int ispref@t\2\2@>) /* are we adding a prefix or a full name? */ { char *s; @y static void -extend_section_name( +extend_section_name(@t\1\1@> name_pointer p, /* name to be extended */ char huge* first, /* beginning of extension text */ char huge* last, /* one beyond end of extension text */ -boolean ispref) /* are we adding a prefix or a full name? */ +int ispref@t\2\2@>) /* are we adding a prefix or a full name? */ { char huge* s; @z -@x Section 63. -static int section_name_cmp( +@x Section 64. +static int section_name_cmp(@t\1\1@> char **pfirst, /* pointer to beginning of comparison string */ int len, /* length of string */ -name_pointer r) /* section name being compared */ +name_pointer r@t\2\2@>) /* section name being compared */ { char *first=*pfirst; /* beginning of comparison string */ name_pointer q=r+1; /* access to subsequent chunks */ char *ss, *s=first_chunk(r); @y -static int section_name_cmp( +static int section_name_cmp(@t\1\1@> char huge** pfirst, /* pointer to beginning of comparison string */ int len, /* length of string */ -name_pointer r) /* section name being compared */ +name_pointer r@t\2\2@>) /* section name being compared */ { char huge* first=*pfirst; /* beginning of comparison string */ name_pointer q=r+1; /* access to subsequent chunks */ @@ -208,14 +208,14 @@ An omitted change file argument means that |"NUL"| should be used, @z -@x Section 75. +@x Section 76. strcpy(change_file_name,"/dev/null"); @y strcpy(change_file_name,"NUL"); @z -@x Section 75. +@x Section 76. else if (*s=='/') dot_pos=NULL,name_pos=++s; @y else if (*s == ':' || *s == '\\' || *s == '/') diff --git a/Build/source/texk/web2c/cwebdir/comm-mac.ch b/Build/source/texk/web2c/cwebdir/comm-mac.ch index 895566d43d3..aa3a77fed4e 100644 --- a/Build/source/texk/web2c/cwebdir/comm-mac.ch +++ b/Build/source/texk/web2c/cwebdir/comm-mac.ch @@ -4,24 +4,27 @@ 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.3)} + \centerline{(Version 4.2)} @y - \centerline{(Version 4.3 for MacOS)} + \centerline{(Version 4.2 for MacOS)} @z -@x section 23: Make input_ln accept \n, \r, \n\r, or \r\n as line endings +@x sections 23/24: Make input_ln accept \n, \r, \n\r, or \r\n as line endings @ In the unlikely event that your standard I/O library does not support |feof|, |getc|, and |ungetc| you may have to change things here. @^system dependencies@> -@c -static boolean input_ln( /* copies a line into |buffer| or returns |false| */ -FILE *fp) /* what file to read from */ +@<Predecl...@>= +static boolean input_ln(FILE *);@/ + +@ @c +static boolean input_ln(@t\1\1@> /* copies a line into |buffer| or returns |false| */ +FILE *fp@t\2\2@>) /* what file to read from */ { - register int c=EOF; /* character read; initialized so some compilers won't complain */ - register char *k; /* where next character goes */ - if (feof(fp)) return false; /* we have hit end-of-file */ - limit = k = buffer; /* beginning of buffer */ + register int c=EOF; /* character read; initialized so some compilers won't complain */ + register char *k; /* where next character goes */ + if (feof(fp)) return false; /* we have hit end-of-file */ + limit = k = buffer; /* beginning of buffer */ while (k<=buffer_end && (c=getc(fp)) != EOF && c!='\n') if ((*(k++) = c) != ' ') limit = k; if (k>buffer_end) @@ -29,7 +32,7 @@ FILE *fp) /* what file to read from */ ungetc(c,fp); loc=buffer; err_print("! Input line too long"); @.Input line too long@> } - if (c==EOF && limit==buffer) return false; /* there was nothing after + if (c==EOF && limit==buffer) return false; /* there was nothing after the last newline */ return true; } @@ -42,14 +45,17 @@ line endings, so that \.{CWEB} will works with ASCII files stored in \UNIX/, {\mc DOS} or {\mc MAC} format. @^system dependencies@> -@c -static boolean input_ln( /* copies a line into |buffer| or returns |false| */ -FILE *fp) /* what file to read from */ +@<Predecl...@>= +static boolean input_ln(FILE *);@/ + +@ @c +static boolean input_ln(@t\1\1@> /* copies a line into |buffer| or returns |false| */ +FILE *fp@t\2\2@>) /* what file to read from */ { register int c=EOF; /* character read; initialized so some compilers won't complain */ - register char *k; /* where next character goes */ - if (feof(fp)) return false; /* we have hit end-of-file */ - limit = k = buffer; /* beginning of buffer */ + register char *k; /* where next character goes */ + if (feof(fp)) return false; /* we have hit end-of-file */ + limit = k = buffer; /* beginning of buffer */ while (true) { c = getc(fp); if (c==EOF) return limit!=buffer; /* |false|, if there was nothing after @@ -71,7 +77,7 @@ FILE *fp) /* what file to read from */ } @z -@x section 27, simply return if no change file was specified +@x section 28, simply return if no change file was specified change_limit=change_buffer; /* this value is used if the change file ends */ @<Skip over comment lines in the change file; |return| if end of file@>@; @y @@ -115,19 +121,20 @@ An omitted change file argument means that |"/dev/null"| should be used, @y An omitted change file argument means that no change file should be used, @z -@x section 75, make change file name empty when it is unspecified + +@x section 76, make change file name empty when it is unspecified strcpy(change_file_name,"/dev/null"); @y change_file_name[0]='\0'; /* empty string */ @z -@x section 75, use the Metrowerks |ccommand| to access command lines +@x section 76, use the Metrowerks |ccommand| to access command lines while (--argc > 0) { @y argc = ccommand (&argv); /* use Mac interface to command line */ @^system dependencies@> while (--argc > 0) { @z -@x section 75, use the path separator constant +@x section 76, use the path separator constant else if (*s=='/') dot_pos=NULL,name_pos=++s; @y else if (*s==PATH_SEP) dot_pos=NULL,name_pos=++s; diff --git a/Build/source/texk/web2c/cwebdir/comm-mini.ch b/Build/source/texk/web2c/cwebdir/comm-mini.ch deleted file mode 100644 index 0d467e9d876..00000000000 --- a/Build/source/texk/web2c/cwebdir/comm-mini.ch +++ /dev/null @@ -1,107 +0,0 @@ -Limbo. - -@x -\def\title{Common code for CTANGLE and CWEAVE (Version 4.3 [CWEBbin 2021])} -@y -\def\title{COMMON (Version 4.3 [CWEBbin 2021])} -\def\contentspagenumber{0} -@z - -Section 3. - -@x -internationalization. -@y -internationalization. -@-A@> -@-S@> -@z - -Section 5. - -@x -@ Code related to input routines: -@y -@ Code related to input routines: -@-c@> -@z - -Section 9. - -@x -@ Code related to identifier and section name storage: -@y -@ Code related to identifier and section name storage: -@-c@> -@z - -Section 14. - -@x -@ Code related to output: -@y -@ Code related to output: -@-a@> -@-b@> -@z - -Section 32. - -@x -current line is nonempty. -@y -current line is nonempty. -@-b@> -@z - -Section 52. - -@x -@d first_chunk(p) ((p)->byte_start+2) -@y -@-m@> -@d first_chunk(p) ((p)->byte_start+2) -@z - -Section 87. - -@x -@^system dependencies@> @.CWEBINPUTS@> -@y -@^system dependencies@> @.CWEBINPUTS@> -@-CWEBINPUTS@> -@z - -Section 88. - -@x -@ @c -@y -@ @-CWEBINPUTS@>@c -@z - -Section 89. - -@x -needs a few extra variables. -@y -needs a few extra variables. -@-SEPARATORS@> -@z - -Section 91. - -@x -@.cweb.mo@> -@y -@.cweb.mo@> -@-A@> -@-B@> -@z - -Section 93. - -@x -@** Index. -@y -@z diff --git a/Build/source/texk/web2c/cwebdir/comm-os2.ch b/Build/source/texk/web2c/cwebdir/comm-os2.ch index d8188633512..2b85f8b1f6d 100644 --- a/Build/source/texk/web2c/cwebdir/comm-os2.ch +++ b/Build/source/texk/web2c/cwebdir/comm-os2.ch @@ -10,13 +10,13 @@ An omitted change file argument means that |"/dev/null"| should be used, An omitted change file argument means that |"NUL"| should be used, @z -@x section 75 +@x section 76 strcpy(change_file_name,"/dev/null"); @y strcpy(change_file_name,"NUL"); @z -@x section 75 (this change copied from comm-pc.ch) +@x section 76 (this change copied from comm-pc.ch) else if (*s=='/') dot_pos=NULL,name_pos=++s; @y else if (*s == ':' || *s == '\\' || *s == '/') diff --git a/Build/source/texk/web2c/cwebdir/comm-pc.ch b/Build/source/texk/web2c/cwebdir/comm-pc.ch index 9e156ad99b0..5f7d9c42ffe 100644 --- a/Build/source/texk/web2c/cwebdir/comm-pc.ch +++ b/Build/source/texk/web2c/cwebdir/comm-pc.ch @@ -19,13 +19,13 @@ An omitted change file argument means that |"/dev/null"| should be used, An omitted change file argument means that |"NUL"| should be used, @z -@x section 75 +@x section 76 strcpy(change_file_name,"/dev/null"); @y strcpy(change_file_name,"NUL"); @z -@x section 75 (this change copied from comm-bs.ch, July 94) +@x section 76 (this change copied from comm-bs.ch, July 94) else if (*s=='/') dot_pos=NULL,name_pos=++s; @y else if (*s == ':' || *s == '\\' || *s == '/') diff --git a/Build/source/texk/web2c/cwebdir/comm-ql.ch b/Build/source/texk/web2c/cwebdir/comm-ql.ch index bde4a1af31f..c03b9185cb9 100644 --- a/Build/source/texk/web2c/cwebdir/comm-ql.ch +++ b/Build/source/texk/web2c/cwebdir/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.3)} +\def\title{Common code for CTANGLE and CWEAVE (Version 4.2)} \def\topofcontents{\null\vfill \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and {\ttitlefont CWEAVE}} \vskip 15pt - \centerline{(Version 4.3)} + \centerline{(Version 4.2)} \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.3)} +\def\title{Common code for CTANGLE and CWEAVE (QL Version 4.2)} \def\topofcontents{\null\vfill \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and {\ttitlefont CWEAVE}} \vskip 15pt - \centerline{(Version 4.3)} + \centerline{(Version 4.2)} \vfill} \def\botofcontents{\vfill \noindent diff --git a/Build/source/texk/web2c/cwebdir/comm-vms.ch b/Build/source/texk/web2c/cwebdir/comm-vms.ch index 9be9b2bf6b1..caf8ecef795 100644 --- a/Build/source/texk/web2c/cwebdir/comm-vms.ch +++ b/Build/source/texk/web2c/cwebdir/comm-vms.ch @@ -34,7 +34,7 @@ modified: @x section 68 (01-FEB-1992 ST) programs are started. Here, for instance, we pass the operating system -a status of |EXIT_SUCCESS| if and only if only harmless messages were printed. +a status of 0 if and only if only harmless messages were printed. @y programs are started. Here, for instance, we pass VAX/VMS a status of |SS$_NORMAL| if and only if only harmless @@ -67,7 +67,7 @@ An omitted change file argument means that the null device |"NL:"| should be used, when no changes are desired. @z -@x section 75 (1987 BL) (01-FEB-1992 ST) (05-APR-1992 DEK) +@x section 76 (1987 BL) (01-FEB-1992 ST) (05-APR-1992 DEK) strcpy(change_file_name,"/dev/null"); @y strcpy(change_file_name,"NL:"); diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.ch b/Build/source/texk/web2c/cwebdir/comm-w2c.ch index 6f4cea5df1e..286a39723e1 100644 --- a/Build/source/texk/web2c/cwebdir/comm-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/comm-w2c.ch @@ -17,16 +17,16 @@ @q Please send comments, suggestions, etc. to tex-k@@tug.org. @> @x -\def\title{Common code for CTANGLE and CWEAVE (Version 4.3)} +\def\title{Common code for CTANGLE and CWEAVE (Version 4.2)} @y \def\Kpathsea/{{\mc KPATHSEA\spacefactor1000}} \ifacro\sanitizecommand\Kpathsea{KPATHSEA}\fi -\def\title{Common code for CTANGLE and CWEAVE (4.3 [\TeX~Live])} +\def\title{Common code for CTANGLE and CWEAVE (4.2 [\TeX~Live])} @z @x - \centerline{(Version 4.3)} + \centerline{(Version 4.2)} @y - \centerline{(Version 4.3 [\TeX~Live])} + \centerline{(Version 4.2 [\TeX~Live])} @z @x @@ -146,11 +146,11 @@ if ((web_file=fopen(web_file_name,"r"))==NULL) { fatal("! Cannot open input file ", web_file_name); } @y -if ((found_filename=kpse_find_cweb(web_file_name))==NULL @| - || (web_file=fopen(found_filename,"r"))==NULL) +if ((found_filename=kpse_find_cweb(web_file_name))==NULL || @| + (web_file=fopen(found_filename,"r"))==NULL) { fatal(_("! Cannot open input file "), web_file_name); -else if (strlen(found_filename) < max_file_name_length) { - /* Copy name for \#\&{line} directives. */ +} else if (strlen(found_filename) < max_file_name_length) { + /* Copy name for |#line| directives. */ if (strcmp(web_file_name, found_filename)) strcpy(web_file_name, found_filename + ((strncmp(found_filename,"./",2)==0) ? 2 : 0)); @@ -162,11 +162,11 @@ else if (strlen(found_filename) < max_file_name_length) { if ((change_file=fopen(change_file_name,"r"))==NULL) fatal("! Cannot open change file ", change_file_name); @y -if ((found_filename=kpse_find_cweb(change_file_name))==NULL @| - || (change_file=fopen(found_filename,"r"))==NULL) +if ((found_filename=kpse_find_cweb(change_file_name))==NULL || @| + (change_file=fopen(found_filename,"r"))==NULL) { fatal(_("! Cannot open change file "), change_file_name); -else if (strlen(found_filename) < max_file_name_length) { - /* Copy name for \#\&{line} directives. */ +} else if (strlen(found_filename) < max_file_name_length) { + /* Copy name for |#line| directives. */ if (strcmp(change_file_name, found_filename)) strcpy(change_file_name, found_filename + ((strncmp(found_filename,"./",2)==0) ? 2 : 0)); @@ -217,7 +217,7 @@ The remainder of the \.{@@i} line after the file name is ignored. @x char temp_file_name[max_file_name_length]; char *cur_file_name_end=cur_file_name+max_file_name_length-1; - char *kk, *k=cur_file_name; + char *k=cur_file_name, *kk; int l; /* length of file name */ @y char *cur_file_name_end=cur_file_name+max_file_name_length-1; @@ -227,9 +227,9 @@ The remainder of the \.{@@i} line after the file name is ignored. @x if ((cur_file=fopen(cur_file_name,"r"))!=NULL) { @y - if ((found_filename=kpse_find_cweb(cur_file_name))!=NULL @| - && (cur_file=fopen(found_filename,"r"))!=NULL) { - /* Copy name for \#\&{line} directives. */ + if ((found_filename=kpse_find_cweb(cur_file_name))!=NULL && @| + (cur_file=fopen(found_filename,"r"))!=NULL) { + /* Copy name for |#line| directives. */ if (strlen(found_filename) < max_file_name_length) { if (strcmp(cur_file_name, found_filename)) strcpy(cur_file_name, found_filename + @@ -255,7 +255,7 @@ The remainder of the \.{@@i} line after the file name is ignored. if (l>0) { if (k+l+2>=cur_file_name_end) too_long(); @.Include file name ...@> - for (; k>=cur_file_name; k--) *(k+l+1)=*k; + for (; k>= cur_file_name; k--) *(k+l+1)=*k; strcpy(cur_file_name,temp_file_name); cur_file_name[l]='/'; /* \UNIX/ pathname separator */ if ((cur_file=fopen(cur_file_name,"r"))!=NULL) { @@ -364,7 +364,7 @@ else if (include_depth==0) printf(_(". (l. %d)\n"), cur_line); Some implementations may wish to pass the |history| value to the operating system so that it can be used to govern whether or not other programs are started. Here, for instance, we pass the operating system -a status of |EXIT_SUCCESS| if and only if only harmless messages were printed. +a status of 0 if and only if only harmless messages were printed. @^system dependencies@> @y On multi-tasking systems like the {\mc AMIGA} it is very convenient to @@ -394,22 +394,20 @@ can be made sensitive to these conditions. else return EXIT_SUCCESS; @y switch(history) { - case spotless: return RETURN_OK; case harmless_message: return RETURN_WARN; case error_message: return RETURN_ERROR; - case fatal_message: default: return RETURN_FAIL; + case fatal_message: return RETURN_FAIL; + default: return RETURN_OK; } @z @x -case spotless: - if (show_happiness) puts("(No errors were found.)"); break; +case spotless: if (show_happiness) puts("(No errors were found.)"); break; case harmless_message: puts("(Did you see the warning message above?)"); break; case error_message: puts("(Pardon me, but I think I spotted something wrong.)"); break; -case fatal_message: default: - puts("(That was a fatal error, my friend.)"); +case fatal_message: puts("(That was a fatal error, my friend.)"); @y case spotless: if (show_happiness) puts(_("(No errors were found.)")); break; @@ -417,7 +415,7 @@ case harmless_message: puts(_("(Did you see the warning message above?)")); break; case error_message: puts(_("(Pardon me, but I think I spotted something wrong.)")); break; -case fatal_message: default: +case fatal_message: puts(_("(That was a fatal error, my friend.)")); @z @@ -428,14 +426,6 @@ case fatal_message: default: @z @x -or flags to be turned on (beginning with |"+"|). -@y -or flags to be turned on (beginning with |"+"|). -\TeX~Live's \.{CWEB} executables accept several ``long options'' as well; -see section |@<Handle flag arg...@>| for details. -@z - -@x char scn_file_name[max_file_name_length]; /* name of |scn_file| */ @y char scn_file_name[max_file_name_length]; /* name of |scn_file| */ @@ -446,7 +436,7 @@ char check_file_name[max_file_name_length]; /* name of |check_file| */ show_banner=show_happiness=show_progress=make_xrefs=true;@/ @y make_xrefs=true;@/ -check_for_change=true; /* Check temporary output for changes */ +temporary_output=true; /* Check temporary output for changes */ @z @x @@ -469,28 +459,32 @@ systems the contents of the compile-time variable |DEV_NULL| (\TeX~Live) or @x strcpy(change_file_name,"/dev/null"); @y - strcpy(change_file_name,"/dev/null"); +@# #if defined DEV_NULL strncpy(change_file_name,DEV_NULL,max_file_name_length-2); change_file_name[max_file_name_length-2]='\0'; #elif defined _DEV_NULL strncpy(change_file_name,_DEV_NULL,max_file_name_length-2); change_file_name[max_file_name_length-2]='\0'; +#else + strcpy(change_file_name,"/dev/null"); #endif @^system dependencies@> @z @x - while (*s) + while (*s) { if (*s=='.') dot_pos=s++; else if (*s=='/') dot_pos=NULL,name_pos=++s; else s++; + } @y - while (*s) + while (*s) { if (*s=='.') dot_pos=s++; else if (*s==DIR_SEPARATOR || *s==DEVICE_SEPARATOR || *s=='/') dot_pos=NULL,name_pos=++s; else s++; + } @^system dependencies@> @z @@ -509,9 +503,11 @@ otherwise we add |".w"|. @z @x -for(dot_pos=*argv+1;*dot_pos>'\0';dot_pos++) - flags[(eight_bits)*dot_pos]=flag_change; +@<Handle flag...@>= +{ + for(dot_pos=*argv+1;*dot_pos>'\0';dot_pos++) @y +@<Handle flag...@>= { if (strcmp("-help",*argv)==0 || strcmp("--help",*argv)==0) @.--help@> @@ -521,25 +517,26 @@ for(dot_pos=*argv+1;*dot_pos>'\0';dot_pos++) @<Display version information and |exit|@>@; if (strcmp("-verbose",*argv)==0 || strcmp("--verbose",*argv)==0) @.--verbose@> - strcpy(*argv,"-v"); + { show_banner=show_progress=show_happiness=1; continue; } if (strcmp("-quiet",*argv)==0 || strcmp("--quiet",*argv)==0) @.--quiet@> - strcpy(*argv,"-q"); - for(dot_pos=*argv+1;*dot_pos>'\0';dot_pos++) { - switch (*dot_pos) { - case 'v': show_banner=show_progress=show_happiness=true; continue; - case 'q': show_banner=show_progress=show_happiness=false; continue; - case 'd': + { show_banner=show_progress=show_happiness=0; continue; } + for(dot_pos=*argv+1;*dot_pos>'\0';dot_pos++) + if (*dot_pos=='v') { + show_banner=show_progress=show_happiness=true; + } else + if (*dot_pos=='q') { + show_banner=show_progress=show_happiness=false; + } else + if (*dot_pos=='d') { if (sscanf(++dot_pos,"%u",&kpathsea_debug)!=1) @<Print usage error...@>@; while (isdigit(*dot_pos)) dot_pos++; /* skip numeric part */ dot_pos--; /* reset to final digit */ - continue; - case 'l': use_language=++dot_pos; break; /* from |switch| */ - default: flags[(eight_bits)*dot_pos]=flag_change; continue; - } - break; /* from |for| loop */ - } -} + } else + if(*dot_pos=='l') { + use_language=++dot_pos; + break; + } else @z @x @@ -628,9 +625,9 @@ else { @x @** Index. @y -@** Extensions to {\tentex CWEB}. The following sections introduce new or -improved features that have been created by numerous contributors over the -course of a quarter century. +@** Extensions to \.{CWEB}. The following sections introduce new or improved +features that have been created by numerous contributors over the course of a +quarter century. Care has been taken to keep the original section numbering intact, so this new material should nicely integrate with the original ``\&{85.~Index}.'' @@ -832,7 +829,6 @@ static void cb_usagehelp (const_string *message, const_string bug_email) textdomain("web2c-help"); @.web2c-help.mo@> while (*message) { - /* empty string \.{""} has special meaning for |gettext| */ printf("%s\n", strcmp("", *message) ? _(*message) : *message); ++message; } @@ -858,6 +854,7 @@ printversionandexit(cb_banner, @c void cb_show_banner (void) { + assert(cb_banner[0]!='\0'); textdomain("cweb-tl"); @.cweb-tl.mo@> printf("%s%s\n", _(cb_banner), versionstring); diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.h b/Build/source/texk/web2c/cwebdir/comm-w2c.h index 4a5e64b4fa8..6c9e605b1d0 100644 --- a/Build/source/texk/web2c/cwebdir/comm-w2c.h +++ b/Build/source/texk/web2c/cwebdir/comm-w2c.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.3 --- April 2021 (works also with later versions) +% Version 4.2 --- February 2021 (works also with later versions) % Copyright (C) 1987,1990,1993 Silvio Levy and Donald E. Knuth @@ -27,7 +27,9 @@ First comes general stuff: -@i iso_types.w +@s boolean int +@s uint8_t int +@s uint16_t int @<Common code...@>= @@ -71,22 +73,20 @@ internationalization. @^ASCII code dependencies@> @d and_and 04 /* `\.{\&\&}'\,; corresponds to MIT's {\tentex\char'4} */ -@d lt_lt 020 /* `\.{<<}'\,; corresponds to MIT's {\tentex\char'20} */ -@d gt_gt 021 /* `\.{>>}'\,; corresponds to MIT's {\tentex\char'21} */ -@d plus_plus 013 /* `\.{++}'\,; corresponds to MIT's {\tentex\char'13} */ -@d minus_minus 01 /* `\.{--}'\,; corresponds to MIT's {\tentex\char'1} */ -@d minus_gt 031 /* `\.{->}'\,; corresponds to MIT's {\tentex\char'31} */ -@d non_eq 032 /* `\.{!=}'\,; corresponds to MIT's {\tentex\char'32} */ -@d lt_eq 034 /* `\.{<=}'\,; corresponds to MIT's {\tentex\char'34} */ -@d gt_eq 035 /* `\.{>=}'\,; corresponds to MIT's {\tentex\char'35} */ -@d eq_eq 036 /* `\.{==}'\,; corresponds to MIT's {\tentex\char'36} */ -@d or_or 037 /* `\.{\v\v}'\,; corresponds to MIT's {\tentex\char'37} */ -@d dot_dot_dot 016 /* `\.{...}'\,; corresponds to MIT's {\tentex\char'16} */ -@d colon_colon 06 /* `\.{::}'\,; corresponds to MIT's {\tentex\char'6} */ -@d period_ast 026 /* `\.{.*}'\,; corresponds to MIT's {\tentex\char'26} */ -@d minus_gt_ast 027 /* `\.{->*}'\,; corresponds to MIT's {\tentex\char'27} */ -@# -@d compress(c) if (loc++<=limit) return c +@d lt_lt 020 /* `\.{<<}'\,; corresponds to MIT's {\tentex\char'20} */ +@d gt_gt 021 /* `\.{>>}'\,; corresponds to MIT's {\tentex\char'21} */ +@d plus_plus 013 /* `\.{++}'\,; corresponds to MIT's {\tentex\char'13} */ +@d minus_minus 01 /* `\.{--}'\,; corresponds to MIT's {\tentex\char'1} */ +@d minus_gt 031 /* `\.{->}'\,; corresponds to MIT's {\tentex\char'31} */ +@d non_eq 032 /* `\.{!=}'\,; corresponds to MIT's {\tentex\char'32} */ +@d lt_eq 034 /* `\.{<=}'\,; corresponds to MIT's {\tentex\char'34} */ +@d gt_eq 035 /* `\.{>=}'\,; corresponds to MIT's {\tentex\char'35} */ +@d eq_eq 036 /* `\.{==}'\,; corresponds to MIT's {\tentex\char'36} */ +@d or_or 037 /* `\.{\v\v}'\,; corresponds to MIT's {\tentex\char'37} */ +@d dot_dot_dot 016 /* `\.{...}'\,; corresponds to MIT's {\tentex\char'16} */ +@d colon_colon 06 /* `\.{::}'\,; corresponds to MIT's {\tentex\char'6} */ +@d period_ast 026 /* `\.{.*}'\,; corresponds to MIT's {\tentex\char'26} */ +@d minus_gt_ast 027 /* `\.{->*}'\,; corresponds to MIT's {\tentex\char'27} */ @<Common code...@>= extern char section_text[]; /* text being sought for */ @@ -95,16 +95,12 @@ extern char *id_first; /* where the current identifier begins in the buffer */ extern char *id_loc; /* just after the current identifier in the buffer */ @ Code related to input routines: -@d xisalpha(c) (isalpha((eight_bits)(c))&&((eight_bits)(c)<0200)) -@d xisdigit(c) (isdigit((eight_bits)(c))&&((eight_bits)(c)<0200)) -@d xisspace(c) (isspace((eight_bits)(c))&&((eight_bits)(c)<0200)) -@d xislower(c) (islower((eight_bits)(c))&&((eight_bits)(c)<0200)) -@d xisupper(c) (isupper((eight_bits)(c))&&((eight_bits)(c)<0200)) -@d xisxdigit(c) (isxdigit((eight_bits)(c))&&((eight_bits)(c)<0200)) -@d isxalpha(c) ((c)=='_' || (c)=='$') - /* non-alpha characters allowed in identifier */ -@d ishigh(c) ((eight_bits)(c)>0177) -@^high-bit character handling@> +@d xisalpha(c) (isalpha((eight_bits)c)&&((eight_bits)c<0200)) +@d xisdigit(c) (isdigit((eight_bits)c)&&((eight_bits)c<0200)) +@d xisspace(c) (isspace((eight_bits)c)&&((eight_bits)c<0200)) +@d xislower(c) (islower((eight_bits)c)&&((eight_bits)c<0200)) +@d xisupper(c) (isupper((eight_bits)c)&&((eight_bits)c<0200)) +@d xisxdigit(c) (isxdigit((eight_bits)c)&&((eight_bits)c<0200)) @<Common code...@>= extern char buffer[]; /* where each line of input goes */ @@ -185,7 +181,7 @@ extern hash_pointer h; /* index into hash-head array */ extern boolean names_match(name_pointer,const char *,size_t,eight_bits);@/ extern name_pointer id_lookup(const char *,const char *,char); /* looks up a string in the identifier table */ -extern name_pointer section_lookup(char *,char *,boolean); /* finds section name */ +extern name_pointer section_lookup(char *,char *,int); /* finds section name */ extern void init_node(name_pointer);@/ extern void init_p(name_pointer,eight_bits);@/ extern void print_prefix_name(name_pointer);@/ @@ -216,8 +212,8 @@ extern void overflow(const char *); /* succumb because a table has overflowed */ @d show_progress flags['p'] /* should progress reports be printed? */ @d show_stats flags['s'] /* should statistics be printed at end of run? */ @d show_happiness flags['h'] /* should lack of errors be announced? */ +@d temporary_output flags['t'] /* should temporary output take precedence? */ @d make_xrefs flags['x'] /* should cross references be output? */ -@d check_for_change flags['c'] /* check temporary output for changes */ @<Common code...@>= extern int argc; /* copy of |ac| parameter to |main| */ @@ -231,8 +227,10 @@ extern const char *use_language; /* prefix to \.{cwebmac.tex} in \TEX/ output */ @ Code related to output: @d update_terminal fflush(stdout) /* empty the terminal output buffer */ -@d new_line putchar('\n') +@d new_line putchar('\n') @d putxchar putchar @d term_write(a,b) fflush(stdout),fwrite(a,sizeof(char),b,stdout) +@d C_printf(c,a) fprintf(C_file,c,a) +@d C_putc(c) putc(c,C_file) /* isn't \CEE/ wonderfully consistent? */ @<Common code...@>= extern FILE *C_file; /* where output of \.{CTANGLE} goes */ diff --git a/Build/source/texk/web2c/cwebdir/comm-w32.ch b/Build/source/texk/web2c/cwebdir/comm-w32.ch index 38c209981a4..d256cedf121 100644 --- a/Build/source/texk/web2c/cwebdir/comm-w32.ch +++ b/Build/source/texk/web2c/cwebdir/comm-w32.ch @@ -52,13 +52,13 @@ An omitted change file argument means that |"/dev/null"| should be used, An omitted change file argument means that |"NUL"| should be used, @z -@x section 75 +@x section 76 strcpy(change_file_name,"/dev/null"); @y strcpy(change_file_name,"NUL"); @z -@x section 75 (this change copied from comm-bs.ch, July 94) +@x section 76 (this change copied from comm-bs.ch, July 94) else if (*s=='/') dot_pos=NULL,name_pos=++s; @y else if (*s == ':' || *s == '\\' || *s == '/') diff --git a/Build/source/texk/web2c/cwebdir/common.bux b/Build/source/texk/web2c/cwebdir/common.bux deleted file mode 100644 index d5d2a399f34..00000000000 --- a/Build/source/texk/web2c/cwebdir/common.bux +++ /dev/null @@ -1,28 +0,0 @@ -@$ctangle "common.h" \zip@> -@$ctwill "common.h" \zip@> -@$cweave "common.h" \zip@> - -@$HAVE_GETTEXT "common.h" \zip@> - -@$init_p {CWEAVE.W}32 \&{void} (\,)@> -@$init_node {CWEAVE.W}32 \&{void} (\,)@> -@$names_match {CWEAVE.W}32 \&{boolean} (\,)@> - -@$ac {CWEAVE.W}2 \&{int}@> -@$av {CWEAVE.W}2 \&{char} ${*}{*}$@> -@$main {CWEAVE.W}2 \&{int} (\,)@> - -@$print_stats {CWEAVE.W}262 \&{void} (\,)@> - -@$xmem {CWEAVE.W}23 \&{xref\_info} [\,]@> - -@$xref {CWEAVE.W}24 \\{equiv\_or\_xref}@> - -@$text_info {CTANGLE.W}20 \&{text} [\,]@> - -@$equiv {CTANGLE.W}22 \\{equiv\_or\_xref}@> - -@$ilk {CWEAVE.W}20 \\{dummy.Ilk}@> - -@$DEV_NULL {COMMON.W}75 macro@> -@$_DEV_NULL {COMMON.W}75 macro@> diff --git a/Build/source/texk/web2c/cwebdir/common.c b/Build/source/texk/web2c/cwebdir/common.c index 52c0d37dde7..7dd0f0c0838 100644 --- a/Build/source/texk/web2c/cwebdir/common.c +++ b/Build/source/texk/web2c/cwebdir/common.c @@ -1,8 +1,8 @@ /*1:*/ -#line 62 "common.w" +#line 66 "common.w" /*3:*/ -#line 44 "common.h" +#line 46 "common.h" #include <ctype.h> #include <stdbool.h> @@ -13,7 +13,7 @@ #include <string.h> /*:3*/ -#line 63 "common.w" +#line 67 "common.w" #define ctangle false #define cweave true \ @@ -34,18 +34,12 @@ #define period_ast 026 #define minus_gt_ast 027 \ -#define compress(c) if(loc++<=limit) return c \ - -#define xisalpha(c) (isalpha((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisdigit(c) (isdigit((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisspace(c) (isspace((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xislower(c) (islower((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisupper(c) (isupper((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisxdigit(c) (isxdigit((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define isxalpha(c) ((c) =='_'||(c) =='$') \ - -#define ishigh(c) ((eight_bits) (c) > 0177) \ - \ +#define xisalpha(c) (isalpha((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisdigit(c) (isdigit((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisspace(c) (isspace((eight_bits) c) &&((eight_bits) c<0200) ) +#define xislower(c) (islower((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \ #define max_include_depth 10 \ @@ -80,7 +74,10 @@ #define update_terminal fflush(stdout) #define new_line putchar('\n') -#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) \ +#define putxchar putchar +#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) +#define C_printf(c,a) fprintf(C_file,c,a) +#define C_putc(c) putc(c,C_file) \ #define max_bytes 1000000 \ @@ -97,8 +94,7 @@ #define lines_dont_match (change_limit-change_buffer!=limit-buffer|| \ strncmp(buffer,change_buffer,(size_t) (limit-buffer) ) ) \ -#define if_section_start_make_pending(b) { \ -*limit= '!'; \ +#define if_section_start_make_pending(b) {*limit= '!'; \ for(loc= buffer;xisspace(*loc) ;loc++) ; \ *limit= ' '; \ if(*loc=='@'&&(xisspace(*(loc+1) ) ||*(loc+1) =='*') ) change_pending= b; \ @@ -125,10 +121,10 @@ err_print("! Include file name too long") ;goto restart;} \ #define flag_change (**argv!='-') -#line 64 "common.w" +#line 68 "common.w" /*2:*/ -#line 35 "common.h" +#line 37 "common.h" typedef bool boolean; typedef uint8_t eight_bits; @@ -145,7 +141,7 @@ extern char*id_first; extern char*id_loc; /*:4*//*5:*/ -#line 92 "common.h" +#line 88 "common.h" extern char buffer[]; extern char*buffer_end; @@ -153,7 +149,7 @@ extern char*loc; extern char*limit; /*:5*//*6:*/ -#line 109 "common.h" +#line 105 "common.h" extern int include_depth; extern FILE*file[]; @@ -169,7 +165,7 @@ extern boolean changing; extern boolean web_file_open; /*:6*//*8:*/ -#line 129 "common.h" +#line 125 "common.h" extern sixteen_bits section_count; extern boolean changed_section[]; @@ -177,7 +173,7 @@ extern boolean change_pending; extern boolean print_where; /*:8*//*9:*/ -#line 143 "common.h" +#line 139 "common.h" typedef struct name_info{ char*byte_start; @@ -202,12 +198,12 @@ extern hash_pointer hash_end; extern hash_pointer h; /*:9*//*11:*/ -#line 187 "common.h" +#line 183 "common.h" extern int history; /*:11*//*13:*/ -#line 203 "common.h" +#line 199 "common.h" extern int argc; extern char**argv; @@ -218,7 +214,7 @@ extern char scn_file_name[]; extern boolean flags[]; /*:13*//*14:*/ -#line 217 "common.h" +#line 215 "common.h" extern FILE*C_file; extern FILE*tex_file; @@ -227,20 +223,20 @@ extern FILE*scn_file; extern FILE*active_file; /*:14*/ -#line 65 "common.w" +#line 69 "common.w" /*18:*/ -#line 79 "common.w" +#line 83 "common.w" boolean program; /*:18*//*19:*/ -#line 88 "common.w" +#line 92 "common.w" int phase; /*:19*//*21:*/ -#line 126 "common.w" +#line 130 "common.w" char section_text[longest_name+1]; char*section_text_end= section_text+longest_name; @@ -248,7 +244,7 @@ char*id_first; char*id_loc; /*:21*//*22:*/ -#line 146 "common.w" +#line 150 "common.w" char buffer[long_buf_size]; char*buffer_end= buffer+buf_size-2; @@ -256,7 +252,7 @@ char*loc= buffer; char*limit= buffer; /*:22*//*25:*/ -#line 190 "common.w" +#line 194 "common.w" int include_depth; FILE*file[max_include_depth]; @@ -273,13 +269,13 @@ boolean changing; boolean web_file_open= false; /*:25*//*26:*/ -#line 216 "common.w" +#line 220 "common.w" static char change_buffer[buf_size]; static char*change_limit; /*:26*//*37:*/ -#line 396 "common.w" +#line 399 "common.w" sixteen_bits section_count; boolean changed_section[max_sections]; @@ -288,7 +284,7 @@ boolean change_pending; boolean print_where= false; /*:37*//*43:*/ -#line 593 "common.w" +#line 596 "common.w" char byte_mem[max_bytes]; char*byte_mem_end= byte_mem+max_bytes-1; @@ -296,25 +292,25 @@ name_info name_dir[max_names]; name_pointer name_dir_end= name_dir+max_names-1; /*:43*//*44:*/ -#line 604 "common.w" +#line 607 "common.w" char*byte_ptr; name_pointer name_ptr; /*:44*//*46:*/ -#line 624 "common.w" +#line 627 "common.w" name_pointer hash[hash_size]; hash_pointer hash_end= hash+hash_size-1; hash_pointer h; /*:46*//*65:*/ -#line 1006 "common.w" +#line 1014 "common.w" int history= spotless; /*:65*//*73:*/ -#line 1129 "common.w" +#line 1135 "common.w" int argc; char**argv; @@ -325,7 +321,7 @@ char scn_file_name[max_file_name_length]; boolean flags[128]; /*:73*//*83:*/ -#line 1273 "common.w" +#line 1282 "common.w" FILE*C_file; FILE*tex_file; @@ -334,22 +330,22 @@ FILE*scn_file; FILE*active_file; /*:83*/ -#line 66 "common.w" +#line 70 "common.w" /*7:*/ -#line 123 "common.h" +#line 119 "common.h" extern boolean get_line(void); extern void check_complete(void); extern void reset_input(void); /*:7*//*10:*/ -#line 166 "common.h" +#line 162 "common.h" extern boolean names_match(name_pointer,const char*,size_t,eight_bits); extern name_pointer id_lookup(const char*,const char*,char); -extern name_pointer section_lookup(char*,char*,boolean); +extern name_pointer section_lookup(char*,char*,int); extern void init_node(name_pointer); extern void init_p(name_pointer,eight_bits); extern void print_prefix_name(name_pointer); @@ -357,7 +353,7 @@ extern void print_section_name(name_pointer); extern void sprint_section_name(char*,name_pointer); /*:10*//*12:*/ -#line 190 "common.h" +#line 186 "common.h" extern int wrap_up(void); extern void err_print(const char*); @@ -365,50 +361,50 @@ extern void fatal(const char*,const char*); extern void overflow(const char*); /*:12*//*15:*/ -#line 225 "common.h" +#line 223 "common.h" extern void common_init(void); extern void print_stats(void); /*:15*//*24:*/ -#line 176 "common.w" +#line 180 "common.w" static boolean input_ln(FILE*); /*:24*//*28:*/ -#line 237 "common.w" +#line 241 "common.w" static void prime_the_change_buffer(void); /*:28*//*33:*/ -#line 337 "common.w" +#line 340 "common.w" static void check_change(void); /*:33*//*55:*/ -#line 767 "common.w" +#line 774 "common.w" static int web_strcmp(char*,int,char*,int); -static name_pointer add_section_name(name_pointer,int,char*,char*,boolean); -static void extend_section_name(name_pointer,char*,char*,boolean); +static name_pointer add_section_name(name_pointer,int,char*,char*,int); +static void extend_section_name(name_pointer,char*,char*,int); /*:55*//*64:*/ -#line 994 "common.w" +#line 1002 "common.w" static int section_name_cmp(char**,int,name_pointer); /*:64*//*76:*/ -#line 1190 "common.w" +#line 1197 "common.w" static void scan_args(void); /*:76*/ -#line 67 "common.w" +#line 71 "common.w" /*:1*//*20:*/ -#line 95 "common.w" +#line 99 "common.w" void common_init(void) { /*45:*/ -#line 608 "common.w" +#line 611 "common.w" name_dir->byte_start= byte_ptr= byte_mem; name_ptr= name_dir+1; @@ -416,24 +412,24 @@ name_ptr->byte_start= byte_mem; root= NULL; /*:45*//*47:*/ -#line 631 "common.w" +#line 634 "common.w" for(h= hash;h<=hash_end;*h++= NULL); /*:47*/ -#line 99 "common.w" +#line 103 "common.w" /*74:*/ -#line 1142 "common.w" +#line 1148 "common.w" show_banner= show_happiness= show_progress= make_xrefs= true; show_stats= false; /*:74*/ -#line 100 "common.w" +#line 104 "common.w" /*84:*/ -#line 1280 "common.w" +#line 1289 "common.w" scan_args(); if(program==ctangle){ @@ -447,12 +443,12 @@ fatal("! Cannot open output file ",tex_file_name); } /*:84*/ -#line 101 "common.w" +#line 105 "common.w" } /*:20*//*23:*/ -#line 156 "common.w" +#line 160 "common.w" static boolean input_ln( FILE*fp) @@ -474,14 +470,14 @@ return true; } /*:23*//*27:*/ -#line 227 "common.w" +#line 231 "common.w" static void prime_the_change_buffer(void) { change_limit= change_buffer; /*29:*/ -#line 243 "common.w" +#line 247 "common.w" while(true){ change_line++; @@ -498,10 +494,10 @@ err_print("! Missing @x in change file"); } /*:29*/ -#line 232 "common.w" +#line 236 "common.w" /*30:*/ -#line 260 "common.w" +#line 264 "common.w" do{ change_line++; @@ -513,10 +509,10 @@ return; }while(limit==buffer); /*:30*/ -#line 233 "common.w" +#line 237 "common.w" /*31:*/ -#line 270 "common.w" +#line 274 "common.w" { change_limit= change_buffer+(ptrdiff_t)(limit-buffer); @@ -524,12 +520,12 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); } /*:31*/ -#line 234 "common.w" +#line 238 "common.w" } /*:27*//*32:*/ -#line 299 "common.w" +#line 302 "common.w" static void check_change(void) @@ -542,7 +538,7 @@ if_section_start_make_pending(true); if(!change_pending)changed_section[section_count]= true; } while(true){ -changing= print_where= true;change_line++; +changing= true;print_where= true;change_line++; if(!input_ln(change_file)){ err_print("! Change file ended before @y"); @@ -552,7 +548,7 @@ return; if(limit> buffer+1&&buffer[0]=='@'){ char xyz_code= xisupper(buffer[1])?tolower((eight_bits)buffer[1]):buffer[1]; /*34:*/ -#line 339 "common.w" +#line 342 "common.w" if(xyz_code=='x'||xyz_code=='z'){ loc= buffer+2;err_print("! Where is the matching @y?"); @@ -570,11 +566,11 @@ return; } /*:34*/ -#line 321 "common.w" +#line 324 "common.w" } /*31:*/ -#line 270 "common.w" +#line 274 "common.w" { change_limit= change_buffer+(ptrdiff_t)(limit-buffer); @@ -582,7 +578,7 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); } /*:31*/ -#line 323 "common.w" +#line 326 "common.w" changing= false;cur_line++; while(!input_ln(cur_file)){ @@ -598,14 +594,14 @@ if(lines_dont_match)n++; } /*:32*//*35:*/ -#line 359 "common.w" +#line 362 "common.w" void reset_input(void) { limit= buffer;loc= buffer+1;buffer[0]= ' '; /*36:*/ -#line 374 "common.w" +#line 377 "common.w" if((web_file= fopen(web_file_name,"r"))==NULL){ strcpy(web_file_name,alt_web_file_name); @@ -619,23 +615,23 @@ if((change_file= fopen(change_file_name,"r"))==NULL) fatal("! Cannot open change file ",change_file_name); /*:36*/ -#line 364 "common.w" +#line 367 "common.w" -include_depth= cur_line= change_line= 0; +include_depth= 0;cur_line= 0;change_line= 0; change_depth= include_depth; -changing= true;prime_the_change_buffer();changing= !changing; +changing= 1;prime_the_change_buffer();changing= !changing; limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= false; } /*:35*//*38:*/ -#line 403 "common.w" +#line 406 "common.w" boolean get_line(void) { restart: if(changing&&include_depth==change_depth) /*41:*/ -#line 511 "common.w" +#line 514 "common.w" { change_line++; if(!input_ln(change_file)){ @@ -666,11 +662,11 @@ prime_the_change_buffer();changing= !changing;print_where= true; } /*:41*/ -#line 408 "common.w" +#line 411 "common.w" if(!changing||include_depth> change_depth){ /*40:*/ -#line 494 "common.w" +#line 497 "common.w" { cur_line++; while(!input_ln(cur_file)){ @@ -689,7 +685,7 @@ if(change_limit> change_buffer)check_change(); } /*:40*/ -#line 410 "common.w" +#line 413 "common.w" if(changing&&include_depth==change_depth)goto restart; } @@ -710,11 +706,11 @@ goto restart; } include_depth++; /*39:*/ -#line 448 "common.w" +#line 451 "common.w" { char temp_file_name[max_file_name_length]; char*cur_file_name_end= cur_file_name+max_file_name_length-1; -char*kk,*k= cur_file_name; +char*k= cur_file_name,*kk; int l; if(*loc=='"'){ @@ -758,14 +754,14 @@ include_depth--;err_print("! Cannot open include file");goto restart; } /*:39*/ -#line 429 "common.w" +#line 432 "common.w" } return true; } /*:38*//*42:*/ -#line 543 "common.w" +#line 546 "common.w" void check_complete(void){ @@ -779,7 +775,7 @@ err_print("! Change file entry did not match"); } /*:42*//*48:*/ -#line 636 "common.w" +#line 639 "common.w" name_pointer id_lookup( @@ -794,17 +790,17 @@ name_pointer p; if(last==NULL)for(last= first;*last!='\0';last++); l= (int)(last-first); /*49:*/ -#line 659 "common.w" +#line 662 "common.w" h= (eight_bits)*i; while(++i<last)h= (h+h+(int)((eight_bits)*i))%hash_size; /*:49*/ -#line 649 "common.w" +#line 652 "common.w" /*50:*/ -#line 667 "common.w" +#line 670 "common.w" p= hash[h]; while(p&&!names_match(p,first,l,t))p= p->link; @@ -814,10 +810,10 @@ p->link= hash[h];hash[h]= p; } /*:50*/ -#line 650 "common.w" +#line 653 "common.w" if(p==name_ptr)/*51:*/ -#line 679 "common.w" +#line 681 "common.w" { if(byte_ptr+l> byte_mem_end)overflow("byte memory"); if(name_ptr>=name_dir_end)overflow("name"); @@ -827,13 +823,13 @@ init_p(p,t); } /*:51*/ -#line 651 "common.w" +#line 654 "common.w" return p; } /*:48*//*52:*/ -#line 711 "common.w" +#line 713 "common.w" void print_section_name( @@ -843,16 +839,18 @@ char*ss,*s= first_chunk(p); name_pointer q= p+1; while(p!=name_dir){ ss= (p+1)->byte_start-1; -if(*ss==' '&&ss>=s)p= q->link,q= p; -else ss++,p= name_dir,q= NULL; -term_write(s,(size_t)(ss-s)); +if(*ss==' '&&ss>=s){ +term_write(s,(size_t)(ss-s));p= q->link;q= p; +}else{ +term_write(s,(size_t)(ss+1-s));p= name_dir;q= NULL; +} s= p->byte_start; } if(q)term_write("...",3); } /*:52*//*53:*/ -#line 728 "common.w" +#line 732 "common.w" void sprint_section_name( @@ -863,8 +861,11 @@ char*ss,*s= first_chunk(p); name_pointer q= p+1; while(p!=name_dir){ ss= (p+1)->byte_start-1; -if(*ss==' '&&ss>=s)p= q->link,q= p; -else ss++,p= name_dir; +if(*ss==' '&&ss>=s){ +p= q->link;q= p; +}else{ +ss++;p= name_dir; +} strncpy(dest,s,(size_t)(ss-s)),dest+= ss-s; s= p->byte_start; } @@ -872,7 +873,7 @@ s= p->byte_start; } /*:53*//*54:*/ -#line 746 "common.w" +#line 753 "common.w" void print_prefix_name( @@ -885,7 +886,7 @@ if(s+l<(p+1)->byte_start)term_write("...",3); } /*:54*//*56:*/ -#line 772 "common.w" +#line 779 "common.w" static int web_strcmp( char*j, @@ -903,7 +904,7 @@ else return greater; } /*:56*//*57:*/ -#line 801 "common.w" +#line 808 "common.w" static name_pointer add_section_name( @@ -911,7 +912,7 @@ name_pointer par, int c, char*first, char*last, -boolean ispref) +int ispref) { name_pointer p= name_ptr; char*s= first_chunk(p); @@ -927,20 +928,21 @@ name_ptr->link= name_dir; } set_prefix_length(p,name_len); strncpy(s,first,name_len); -p->llink= p->rlink= NULL; +p->llink= NULL; +p->rlink= NULL; init_node(p); return par==NULL?(root= p):c==less?(par->llink= p):(par->rlink= p); } /*:57*//*58:*/ -#line 829 "common.w" +#line 837 "common.w" static void extend_section_name( name_pointer p, char*first, char*last, -boolean ispref) +int ispref) { char*s; name_pointer q= p+1; @@ -957,14 +959,14 @@ if(ispref)*(byte_ptr-1)= ' '; } /*:58*//*59:*/ -#line 857 "common.w" +#line 865 "common.w" name_pointer section_lookup( char*first,char*last, -boolean ispref) +int ispref) { -int c= less; +int c= 0; name_pointer p= root; name_pointer q= NULL; name_pointer r= NULL; @@ -972,7 +974,7 @@ name_pointer par= NULL; int name_len= (int)(last-first)+1; /*60:*/ -#line 881 "common.w" +#line 889 "common.w" while(p){ c= web_strcmp(first,name_len,first_chunk(p),prefix_length(p)); @@ -999,19 +1001,19 @@ p= q,q= NULL; } /*:60*/ -#line 871 "common.w" +#line 879 "common.w" /*61:*/ -#line 906 "common.w" +#line 914 "common.w" if(r==NULL) return add_section_name(par,c,first,last+1,ispref); /*:61*/ -#line 872 "common.w" +#line 880 "common.w" /*62:*/ -#line 914 "common.w" +#line 922 "common.w" switch(section_name_cmp(&first,name_len,r)){ @@ -1024,16 +1026,16 @@ err_print(">"); } else if(name_len<prefix_length(r))set_prefix_length(r,name_len); -case equal:break; +case equal:return r; case extension:if(!ispref||first<=last) extend_section_name(r,first,last+1,ispref); -break; +return r; case bad_extension: fputs("\n! New name extends <",stdout); print_section_name(r); err_print(">"); -break; +return r; default: fputs("\n! Section name incompatible with <",stdout); @@ -1041,16 +1043,16 @@ print_prefix_name(r); fputs(">,\n which abbreviates <",stdout); print_section_name(r); err_print(">"); -} return r; +} /*:62*/ -#line 873 "common.w" +#line 881 "common.w" } /*:59*//*63:*/ -#line 962 "common.w" +#line 970 "common.w" static int section_name_cmp( char**pfirst, @@ -1060,12 +1062,12 @@ name_pointer r) char*first= *pfirst; name_pointer q= r+1; char*ss,*s= first_chunk(r); -int c= less; -boolean ispref; +int c; +int ispref; while(true){ ss= (r+1)->byte_start-1; -if(*ss==' '&&ss>=r->byte_start)ispref= true,q= q->link; -else ispref= false,ss++,q= name_dir; +if(*ss==' '&&ss>=r->byte_start)ispref= 1,q= q->link; +else ispref= 0,ss++,q= name_dir; switch(c= web_strcmp(first,len,s,ss-s)){ case equal:if(q==name_dir) if(ispref){ @@ -1084,7 +1086,7 @@ default:return c; } /*:63*//*66:*/ -#line 1016 "common.w" +#line 1024 "common.w" void err_print( @@ -1093,7 +1095,7 @@ const char*s) char*k,*l; printf(*s=='!'?"\n%s":"%s",s); if(web_file_open)/*67:*/ -#line 1036 "common.w" +#line 1044 "common.w" {if(changing&&include_depth==change_depth) printf(". (l. %d of change file)\n",change_line); @@ -1104,7 +1106,7 @@ if(l> buffer){ for(k= buffer;k<l;k++) if(*k=='\t')putchar(' '); else putchar(*k); -new_line; +putchar('\n'); for(k= buffer;k<l;k++)putchar(' '); } for(k= l;k<limit;k++)putchar(*k); @@ -1113,41 +1115,39 @@ putchar(' '); } /*:67*/ -#line 1023 "common.w" +#line 1031 "common.w" update_terminal;mark_error; } /*:66*//*68:*/ -#line 1068 "common.w" +#line 1076 "common.w" int wrap_up(void){ if(show_progress)new_line; if(show_stats) print_stats(); /*69:*/ -#line 1078 "common.w" +#line 1086 "common.w" switch(history){ -case spotless: -if(show_happiness)puts("(No errors were found.)");break; +case spotless:if(show_happiness)puts("(No errors were found.)");break; case harmless_message: puts("(Did you see the warning message above?)");break; case error_message: puts("(Pardon me, but I think I spotted something wrong.)");break; -case fatal_message:default: -puts("(That was a fatal error, my friend.)"); +case fatal_message:puts("(That was a fatal error, my friend.)"); } /*:69*/ -#line 1073 "common.w" +#line 1081 "common.w" if(history> harmless_message)return EXIT_FAILURE; else return EXIT_SUCCESS; } /*:68*//*70:*/ -#line 1096 "common.w" +#line 1102 "common.w" void fatal( const char*s,const char*t) @@ -1158,7 +1158,7 @@ history= fatal_message;exit(wrap_up()); } /*:70*//*71:*/ -#line 1107 "common.w" +#line 1113 "common.w" void overflow( const char*t) @@ -1168,7 +1168,7 @@ printf("\n! Sorry, %s capacity exceeded",t);fatal("",""); /*:71*//*75:*/ -#line 1161 "common.w" +#line 1167 "common.w" static void scan_args(void) @@ -1182,32 +1182,35 @@ boolean found_web= false,found_change= false,found_out= false; strcpy(change_file_name,"/dev/null"); while(--argc> 0){ if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*80:*/ -#line 1251 "common.w" +#line 1258 "common.w" +{ for(dot_pos= *argv+1;*dot_pos> '\0';dot_pos++) flags[(eight_bits)*dot_pos]= flag_change; +} /*:80*/ -#line 1173 "common.w" +#line 1179 "common.w" else{ s= name_pos= *argv;dot_pos= NULL; -while(*s) +while(*s){ if(*s=='.')dot_pos= s++; else if(*s=='/')dot_pos= NULL,name_pos= ++s; else s++; +} if(!found_web)/*77:*/ -#line 1199 "common.w" +#line 1206 "common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 1267 "common.w" +#line 1276 "common.w" fatal("! Filename too long\n",*argv); /*:82*/ -#line 1202 "common.w" +#line 1209 "common.w" if(dot_pos==NULL) sprintf(web_file_name,"%s.w",*argv); @@ -1224,21 +1227,21 @@ found_web= true; } /*:77*/ -#line 1181 "common.w" +#line 1188 "common.w" else if(!found_change)/*78:*/ -#line 1217 "common.w" +#line 1224 "common.w" { if(strcmp(*argv,"-")!=0){ if(s-*argv> max_file_name_length-4) /*82:*/ -#line 1267 "common.w" +#line 1276 "common.w" fatal("! Filename too long\n",*argv); /*:82*/ -#line 1221 "common.w" +#line 1228 "common.w" if(dot_pos==NULL) sprintf(change_file_name,"%s.ch",*argv); @@ -1248,20 +1251,20 @@ found_change= true; } /*:78*/ -#line 1182 "common.w" +#line 1189 "common.w" else if(!found_out)/*79:*/ -#line 1229 "common.w" +#line 1236 "common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 1267 "common.w" +#line 1276 "common.w" fatal("! Filename too long\n",*argv); /*:82*/ -#line 1232 "common.w" +#line 1239 "common.w" if(dot_pos==NULL){ sprintf(tex_file_name,"%s.tex",*argv); @@ -1281,10 +1284,10 @@ found_out= true; } /*:79*/ -#line 1183 "common.w" +#line 1190 "common.w" else/*81:*/ -#line 1255 "common.w" +#line 1264 "common.w" { if(program==ctangle) @@ -1298,12 +1301,12 @@ else fatal( } /*:81*/ -#line 1184 "common.w" +#line 1191 "common.w" } } if(!found_web)/*81:*/ -#line 1255 "common.w" +#line 1264 "common.w" { if(program==ctangle) @@ -1317,7 +1320,7 @@ else fatal( } /*:81*/ -#line 1187 "common.w" +#line 1194 "common.w" } diff --git a/Build/source/texk/web2c/cwebdir/common.h b/Build/source/texk/web2c/cwebdir/common.h index fa064b39dba..425239f1c75 100644 --- a/Build/source/texk/web2c/cwebdir/common.h +++ b/Build/source/texk/web2c/cwebdir/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.3 --- April 2021 (works also with later versions) +% Version 4.2 --- February 2021 (works also with later versions) % Copyright (C) 1987,1990,1993 Silvio Levy and Donald E. Knuth @@ -27,7 +27,9 @@ First comes general stuff: -@i iso_types.w +@s boolean int +@s uint8_t int +@s uint16_t int @d ctangle false @d cweave true @@ -54,22 +56,20 @@ extern int phase; /* which phase are we in? */ @^ASCII code dependencies@> @d and_and 04 /* `\.{\&\&}'\,; corresponds to MIT's {\tentex\char'4} */ -@d lt_lt 020 /* `\.{<<}'\,; corresponds to MIT's {\tentex\char'20} */ -@d gt_gt 021 /* `\.{>>}'\,; corresponds to MIT's {\tentex\char'21} */ -@d plus_plus 013 /* `\.{++}'\,; corresponds to MIT's {\tentex\char'13} */ -@d minus_minus 01 /* `\.{--}'\,; corresponds to MIT's {\tentex\char'1} */ -@d minus_gt 031 /* `\.{->}'\,; corresponds to MIT's {\tentex\char'31} */ -@d non_eq 032 /* `\.{!=}'\,; corresponds to MIT's {\tentex\char'32} */ -@d lt_eq 034 /* `\.{<=}'\,; corresponds to MIT's {\tentex\char'34} */ -@d gt_eq 035 /* `\.{>=}'\,; corresponds to MIT's {\tentex\char'35} */ -@d eq_eq 036 /* `\.{==}'\,; corresponds to MIT's {\tentex\char'36} */ -@d or_or 037 /* `\.{\v\v}'\,; corresponds to MIT's {\tentex\char'37} */ -@d dot_dot_dot 016 /* `\.{...}'\,; corresponds to MIT's {\tentex\char'16} */ -@d colon_colon 06 /* `\.{::}'\,; corresponds to MIT's {\tentex\char'6} */ -@d period_ast 026 /* `\.{.*}'\,; corresponds to MIT's {\tentex\char'26} */ -@d minus_gt_ast 027 /* `\.{->*}'\,; corresponds to MIT's {\tentex\char'27} */ -@# -@d compress(c) if (loc++<=limit) return c +@d lt_lt 020 /* `\.{<<}'\,; corresponds to MIT's {\tentex\char'20} */ +@d gt_gt 021 /* `\.{>>}'\,; corresponds to MIT's {\tentex\char'21} */ +@d plus_plus 013 /* `\.{++}'\,; corresponds to MIT's {\tentex\char'13} */ +@d minus_minus 01 /* `\.{--}'\,; corresponds to MIT's {\tentex\char'1} */ +@d minus_gt 031 /* `\.{->}'\,; corresponds to MIT's {\tentex\char'31} */ +@d non_eq 032 /* `\.{!=}'\,; corresponds to MIT's {\tentex\char'32} */ +@d lt_eq 034 /* `\.{<=}'\,; corresponds to MIT's {\tentex\char'34} */ +@d gt_eq 035 /* `\.{>=}'\,; corresponds to MIT's {\tentex\char'35} */ +@d eq_eq 036 /* `\.{==}'\,; corresponds to MIT's {\tentex\char'36} */ +@d or_or 037 /* `\.{\v\v}'\,; corresponds to MIT's {\tentex\char'37} */ +@d dot_dot_dot 016 /* `\.{...}'\,; corresponds to MIT's {\tentex\char'16} */ +@d colon_colon 06 /* `\.{::}'\,; corresponds to MIT's {\tentex\char'6} */ +@d period_ast 026 /* `\.{.*}'\,; corresponds to MIT's {\tentex\char'26} */ +@d minus_gt_ast 027 /* `\.{->*}'\,; corresponds to MIT's {\tentex\char'27} */ @<Common code...@>= extern char section_text[]; /* text being sought for */ @@ -78,16 +78,12 @@ extern char *id_first; /* where the current identifier begins in the buffer */ extern char *id_loc; /* just after the current identifier in the buffer */ @ Code related to input routines: -@d xisalpha(c) (isalpha((eight_bits)(c))&&((eight_bits)(c)<0200)) -@d xisdigit(c) (isdigit((eight_bits)(c))&&((eight_bits)(c)<0200)) -@d xisspace(c) (isspace((eight_bits)(c))&&((eight_bits)(c)<0200)) -@d xislower(c) (islower((eight_bits)(c))&&((eight_bits)(c)<0200)) -@d xisupper(c) (isupper((eight_bits)(c))&&((eight_bits)(c)<0200)) -@d xisxdigit(c) (isxdigit((eight_bits)(c))&&((eight_bits)(c)<0200)) -@d isxalpha(c) ((c)=='_' || (c)=='$') - /* non-alpha characters allowed in identifier */ -@d ishigh(c) ((eight_bits)(c)>0177) -@^high-bit character handling@> +@d xisalpha(c) (isalpha((eight_bits)c)&&((eight_bits)c<0200)) +@d xisdigit(c) (isdigit((eight_bits)c)&&((eight_bits)c<0200)) +@d xisspace(c) (isspace((eight_bits)c)&&((eight_bits)c<0200)) +@d xislower(c) (islower((eight_bits)c)&&((eight_bits)c<0200)) +@d xisupper(c) (isupper((eight_bits)c)&&((eight_bits)c<0200)) +@d xisxdigit(c) (isxdigit((eight_bits)c)&&((eight_bits)c<0200)) @<Common code...@>= extern char buffer[]; /* where each line of input goes */ @@ -167,7 +163,7 @@ extern hash_pointer h; /* index into hash-head array */ extern boolean names_match(name_pointer,const char *,size_t,eight_bits);@/ extern name_pointer id_lookup(const char *,const char *,char); /* looks up a string in the identifier table */ -extern name_pointer section_lookup(char *,char *,boolean); /* finds section name */ +extern name_pointer section_lookup(char *,char *,int); /* finds section name */ extern void init_node(name_pointer);@/ extern void init_p(name_pointer,eight_bits);@/ extern void print_prefix_name(name_pointer);@/ @@ -211,8 +207,10 @@ extern boolean flags[]; /* an option for each 7-bit code */ @ Code related to output: @d update_terminal fflush(stdout) /* empty the terminal output buffer */ -@d new_line putchar('\n') +@d new_line putchar('\n') @d putxchar putchar @d term_write(a,b) fflush(stdout),fwrite(a,sizeof(char),b,stdout) +@d C_printf(c,a) fprintf(C_file,c,a) +@d C_putc(c) putc(c,C_file) /* isn't \CEE/ wonderfully consistent? */ @<Common code...@>= extern FILE *C_file; /* where output of \.{CTANGLE} goes */ diff --git a/Build/source/texk/web2c/cwebdir/common.w b/Build/source/texk/web2c/cwebdir/common.w index 97e2d50118d..15e93c2c5e6 100644 --- a/Build/source/texk/web2c/cwebdir/common.w +++ b/Build/source/texk/web2c/cwebdir/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.3 --- April 2021 +% Version 4.2 --- February 2021 % 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.3)} +\def\title{Common code for CTANGLE and CWEAVE (Version 4.2)} \def\topofcontents{\null\vfill \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and {\ttitlefont CWEAVE}} \vskip 15pt - \centerline{(Version 4.3)} + \centerline{(Version 4.2)} \vfill} \def\botofcontents{\vfill \noindent @@ -47,6 +47,10 @@ under the terms of a permission notice identical to this one. \pageno=\contentspagenumber \advance\pageno by 1 \let\maybe=\iftrue +@s boolean int +@s uint8_t int +@s uint16_t int + @** Introduction. This file contains code common to both \.{CTANGLE} and \.{CWEAVE}, which roughly concerns the following problems: character uniformity, input routines, error handling and @@ -154,13 +158,13 @@ support |feof|, |getc|, and |ungetc| you may have to change things here. @^system dependencies@> @c -static boolean input_ln( /* copies a line into |buffer| or returns |false| */ -FILE *fp) /* what file to read from */ +static boolean input_ln(@t\1\1@> /* copies a line into |buffer| or returns |false| */ +FILE *fp@t\2\2@>) /* what file to read from */ { - register int c=EOF; /* character read; initialized so some compilers won't complain */ - register char *k; /* where next character goes */ - if (feof(fp)) return false; /* we have hit end-of-file */ - limit = k = buffer; /* beginning of buffer */ + register int c=EOF; /* character read; initialized so some compilers won't complain */ + register char *k; /* where next character goes */ + if (feof(fp)) return false; /* we have hit end-of-file */ + limit = k = buffer; /* beginning of buffer */ while (k<=buffer_end && (c=getc(fp)) != EOF && c!='\n') if ((*(k++) = c) != ' ') limit = k; if (k>buffer_end) @@ -168,7 +172,7 @@ FILE *fp) /* what file to read from */ ungetc(c,fp); loc=buffer; err_print("! Input line too long"); @.Input line too long@> } - if (c==EOF && limit==buffer) return false; /* there was nothing after + if (c==EOF && limit==buffer) return false; /* there was nothing after the last newline */ return true; } @@ -210,7 +214,7 @@ so that no further matches will be made. Here's a shorthand expression for inequality between the two lines: -@d lines_dont_match (change_limit-change_buffer != limit-buffer @| || +@d lines_dont_match (change_limit-change_buffer != limit-buffer || @| strncmp(buffer, change_buffer, (size_t)(limit-buffer))) @<Global var...@>= @@ -289,9 +293,8 @@ either `\.{@@*}' or `\.{@@\ }' (possibly preceded by whitespace). This procedure is called only when |buffer<limit|, i.e., when the current line is nonempty. -@d if_section_start_make_pending(b) { - *limit='!';@+ - for (loc=buffer;xisspace(*loc);loc++) ;@+ +@d if_section_start_make_pending(b) {@+*limit='!'; + for (loc=buffer;xisspace(*loc);loc++) ; *limit=' '; if (*loc=='@@' && (xisspace(*(loc+1)) || *(loc+1)=='*')) change_pending=b; } @@ -308,7 +311,7 @@ check_change(void) /* switches to |change_file| if the buffers match */ if (!change_pending) changed_section[section_count]=true; } while (true) { - changing=print_where=true; change_line++; + changing=true; print_where=true; change_line++; if (!input_ln(change_file)) { err_print("! Change file ended before @@y"); @.Change file ended...@> @@ -362,9 +365,9 @@ reset_input(void) { limit=buffer; loc=buffer+1; buffer[0]=' '; @<Open input files@>@; - include_depth=cur_line=change_line=0; + include_depth=0; cur_line=0; change_line=0; change_depth=include_depth; - changing=true; prime_the_change_buffer(); changing=!changing; + changing=1; prime_the_change_buffer(); changing=!changing; limit=buffer; loc=buffer+1; buffer[0]=' '; input_has_ended=false; } @@ -405,7 +408,7 @@ boolean get_line(void) /* inputs the next line */ { restart: if (changing && include_depth==change_depth) - @<Read from |change_file| and maybe turn off |changing|@>@; + @<Read from |change_file| and maybe turn off |changing|@>@; if (! changing || include_depth>change_depth) { @<Read from |cur_file| and maybe turn on |changing|@>@; if (changing && include_depth==change_depth) goto restart; @@ -448,7 +451,7 @@ The remainder of the \.{@@i} line after the file name is ignored. @.CWEBINPUTS@>@<Try to open...@>= { char temp_file_name[max_file_name_length]; char *cur_file_name_end=cur_file_name+max_file_name_length-1; - char *kk, *k=cur_file_name; + char *k=cur_file_name, *kk; int l; /* length of file name */ if (*loc=='"') { @@ -480,7 +483,7 @@ The remainder of the \.{@@i} line after the file name is ignored. if (l>0) { if (k+l+2>=cur_file_name_end) too_long(); @.Include file name ...@> - for (; k>=cur_file_name; k--) *(k+l+1)=*k; + for (; k>= cur_file_name; k--) *(k+l+1)=*k; strcpy(cur_file_name,temp_file_name); cur_file_name[l]='/'; /* \UNIX/ pathname separator */ if ((cur_file=fopen(cur_file_name,"r"))!=NULL) { @@ -635,10 +638,10 @@ for (h=hash; h<=hash_end; *h++=NULL) ; @c name_pointer -id_lookup( /* looks up a string in the identifier table */ +id_lookup(@t\1\1@> /* looks up a string in the identifier table */ const char *first, /* first character of string */ const char *last, /* last character of string plus one */ -char t) /* the |ilk|; used by \.{CWEAVE} only */ +char t@t\2\2@>) /* the |ilk|; used by \.{CWEAVE} only */ { const char *i=first; /* position in |buffer| */ int h; /* hash code */ @@ -675,7 +678,6 @@ if (p==NULL) { @ The information associated with a new identifier must be initialized in a slightly different way in \.{CWEAVE} than in \.{CTANGLE}; hence the |init_p| procedure. - @<Enter a new name...@>= { if (byte_ptr+l>byte_mem_end) overflow("byte memory"); if (name_ptr>=name_dir_end) overflow("name"); @@ -717,9 +719,11 @@ name_pointer p) name_pointer q = p+1; while (p!=name_dir) { ss = (p+1)->byte_start-1; - if (*ss==' ' && ss>=s) p=q->link,q=p; - else ss++,p=name_dir,q=NULL; - term_write(s,(size_t)(ss-s)); + if (*ss==' ' && ss>=s) { + term_write(s,(size_t)(ss-s)); p=q->link; q=p; + } else { + term_write(s,(size_t)(ss+1-s)); p=name_dir; q=NULL; + } s = p->byte_start; } if (q) term_write("...",3); /* complete name not yet known */ @@ -735,8 +739,11 @@ sprint_section_name( name_pointer q = p+1; while (p!=name_dir) { ss = (p+1)->byte_start-1; - if (*ss==' ' && ss>=s) p=q->link,q=p; - else ss++,p=name_dir; + if (*ss==' ' && ss>=s) { + p=q->link; q=p; + } else { + ss++; p=name_dir; + } strncpy(dest,s,(size_t)(ss-s)), dest+=ss-s; s = p->byte_start; } @@ -766,15 +773,15 @@ are null-terminated, and we keep an eye open for prefixes and extensions. @<Predecl...@>= static int web_strcmp(char *,int,char *,int);@/ -static name_pointer add_section_name(name_pointer,int,char *,char *,boolean);@/ -static void extend_section_name(name_pointer,char *,char *,boolean); +static name_pointer add_section_name(name_pointer,int,char *,char *,int);@/ +static void extend_section_name(name_pointer,char *,char *,int); @ @c -static int web_strcmp( /* fuller comparison than |strcmp| */ +static int web_strcmp(@t\1\1@> /* fuller comparison than |strcmp| */ char *j, /* beginning of first string */ int j_len, /* length of first string */ char *k, /* beginning of second string */ - int k_len) /* length of second string */ + int k_len@t\2\2@>) /* length of second string */ { char *j1=j+j_len, *k1=k+k_len; while (k<k1 && j<j1 && *j==*k) k++, j++; @@ -800,12 +807,12 @@ and \.{ctangle.w}. @c static name_pointer -add_section_name( /* install a new node in the tree */ +add_section_name(@t\1\1@> /* install a new node in the tree */ name_pointer par, /* parent of new node */ int c, /* right or left? */ char *first, /* first character of section name */ char *last, /* last character of section name, plus one */ -boolean ispref) /* are we adding a prefix or a full name? */ +int ispref@t\2\2@>) /* are we adding a prefix or a full name? */ { name_pointer p=name_ptr; /* new node */ char *s=first_chunk(p); @@ -821,18 +828,19 @@ boolean ispref) /* are we adding a prefix or a full name? */ } set_prefix_length(p,name_len); strncpy(s,first,name_len); - p->llink=p->rlink=NULL; + p->llink=NULL; + p->rlink=NULL; init_node(p); return par==NULL ? (root=p) : c==less ? (par->llink=p) : (par->rlink=p); } @ @c static void -extend_section_name( +extend_section_name(@t\1\1@> name_pointer p, /* name to be extended */ char *first, /* beginning of extension text */ char *last, /* one beyond end of extension text */ -boolean ispref) /* are we adding a prefix or a full name? */ +int ispref@t\2\2@>) /* are we adding a prefix or a full name? */ { char *s; name_pointer q=p+1; @@ -856,11 +864,11 @@ exactly equals or is a prefix or extension of a name in the tree. @c name_pointer -section_lookup( /* find or install section name in tree */ +section_lookup(@t\1\1@> /* find or install section name in tree */ char *first,char *last, /* first and last characters of new name */ -boolean ispref) /* is the new name a prefix or a full name? */ +int ispref@t\2\2@>) /* is the new name a prefix or a full name? */ { - int c=less; /* comparison between two names; initialized so some compilers won't complain */ + int c=0; /* comparison between two names; initialized so some compilers won't complain */ name_pointer p=root; /* current node of the search tree */ name_pointer q=NULL; /* another place to look in the tree */ name_pointer r=NULL; /* where a match has been found */ @@ -923,16 +931,16 @@ switch(section_name_cmp(&first,name_len,r)) { } else if (name_len<prefix_length(r)) set_prefix_length(r,name_len); /* fall through */ - case equal: break; + case equal: return r; case extension: if (!ispref || first<=last) extend_section_name(r,first,last+1,ispref); - break; + return r; case bad_extension: fputs("\n! New name extends <",stdout); @.New name extends...@> print_section_name(r); err_print(">"); - break; + return r; default: /* no match: illegal */ fputs("\n! Section name incompatible with <",stdout); @.Section name incompatible...@> @@ -940,8 +948,8 @@ switch(section_name_cmp(&first,name_len,r)) { fputs(">,\n which abbreviates <",stdout); print_section_name(r); err_print(">"); + return r; } -return r; @ The return codes of |section_name_cmp|, which compares a string with the full name of a section, are those of |web_strcmp| plus @@ -960,20 +968,20 @@ us to regard \.{@@<foo...@@>} as an ``extension'' of itself. @d bad_extension 5 @c -static int section_name_cmp( +static int section_name_cmp(@t\1\1@> char **pfirst, /* pointer to beginning of comparison string */ int len, /* length of string */ -name_pointer r) /* section name being compared */ +name_pointer r@t\2\2@>) /* section name being compared */ { char *first=*pfirst; /* beginning of comparison string */ name_pointer q=r+1; /* access to subsequent chunks */ char *ss, *s=first_chunk(r); - int c=less; /* comparison */ - boolean ispref; /* is chunk |r| a prefix? */ + int c; /* comparison */ + int ispref; /* is chunk |r| a prefix? */ while (true) { ss=(r+1)->byte_start-1; - if (*ss==' ' && ss>=r->byte_start) ispref=true,q=q->link; - else ispref=false,ss++,q=name_dir; + if (*ss==' ' && ss>=r->byte_start) ispref=1,q=q->link; + else ispref=0,ss++,q=name_dir; switch(c=web_strcmp(first,len,s,ss-s)) { case equal: if (q==name_dir) if (ispref) { @@ -1015,12 +1023,12 @@ if the string begins with |"!"|. @c void -err_print( /* prints `\..' and location of error message */ -const char *s) +err_print(@t\1\1@> /* prints `\..' and location of error message */ +const char *s@t\2\2@>) { char *k,*l; /* pointers into |buffer| */ printf(*s=='!'? "\n%s" : "%s",s); - if (web_file_open) @<Print error location based on input buffer@>@; + if(web_file_open) @<Print error location based on input buffer@>@; update_terminal; mark_error; } @@ -1043,7 +1051,7 @@ if (l>buffer) { for (k=buffer; k<l; k++) if (*k=='\t') putchar(' '); else putchar(*k); /* print the characters already read */ - new_line; + putchar('\n'); for (k=buffer; k<l; k++) putchar(' '); /* space out the next line */ } for (k=l; k<limit; k++) putchar(*k); /* print the part not yet read */ @@ -1062,7 +1070,7 @@ interface above and in the index. Some implementations may wish to pass the |history| value to the operating system so that it can be used to govern whether or not other programs are started. Here, for instance, we pass the operating system -a status of |EXIT_SUCCESS| if and only if only harmless messages were printed. +a status of 0 if and only if only harmless messages were printed. @^system dependencies@> @c @@ -1077,15 +1085,13 @@ int wrap_up(void) { @ @<Print the job |history|@>= switch (history) { -case spotless: - if (show_happiness) puts("(No errors were found.)"); break; +case spotless: if (show_happiness) puts("(No errors were found.)"); break; case harmless_message: puts("(Did you see the warning message above?)"); break; case error_message: puts("(Pardon me, but I think I spotted something wrong.)"); break; -case fatal_message: default: - puts("(That was a fatal error, my friend.)"); -} +case fatal_message: puts("(That was a fatal error, my friend.)"); +} /* there are no other cases */ @ When there is no way to recover from an error, the |fatal| subroutine is invoked. This happens most often when |overflow| occurs. @@ -1173,13 +1179,14 @@ scan_args(void) if ((**(++argv)=='-'||**argv=='+')&&*(*argv+1)) @<Handle flag argument@>@; else { s=name_pos=*argv;@+dot_pos=NULL; - while (*s) + while (*s) { if (*s=='.') dot_pos=s++; else if (*s=='/') dot_pos=NULL,name_pos=++s; else s++; + } if (!found_web) @<Make - |web_file_name|, |tex_file_name|, and |C_file_name|@>@; - else if (!found_change) @<Make |change_file_name|@>@; + |web_file_name|, |tex_file_name|, and |C_file_name|@>@; + else if (!found_change) @<Make |change_file_name| from |fname|@>@; else if (!found_out) @<Override |tex_file_name| and |C_file_name|@>@; else @<Print usage error message and quit@>@; } @@ -1249,8 +1256,10 @@ after the dot. We must check that there is enough room in @ @d flag_change (**argv!='-') @<Handle flag...@>= -for(dot_pos=*argv+1;*dot_pos>'\0';dot_pos++) - flags[(eight_bits)*dot_pos]=flag_change; +{ + for(dot_pos=*argv+1;*dot_pos>'\0';dot_pos++) + flags[(eight_bits)*dot_pos]=flag_change; +} @ @<Print usage error message and quit@>= { diff --git a/Build/source/texk/web2c/cwebdir/ctang-bs.ch b/Build/source/texk/web2c/cwebdir/ctang-bs.ch index fcd2706b36e..55cc27cd00e 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-bs.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-bs.ch @@ -17,16 +17,16 @@ by using "huge" pointers. The ``banner line'' defined here should be changed whenever \.{CTANGLE} is modified. -@d banner "This is CTANGLE (Version 4.3)" +@d banner "This is CTANGLE (Version 4.2)" @y The ``banner line'' defined here should be changed whenever \.{CTANGLE} is modified. -@d banner "This is CTANGLE (Version 4.3pc/big)" +@d banner "This is CTANGLE (Version 4.2pc/big)" @z -@x Section 10. +@x Section 9. for section names */ @<Common code...@>= @@ -127,7 +127,7 @@ to run \.{CTANGLE} from a makefile.) @z -@x Section 19. +@x Section 16. eight_bits *tok_start; /* pointer into |tok_mem| */ sixteen_bits text_link; /* relates replacement texts */ } text; @@ -140,7 +140,7 @@ typedef text *text_pointer; @z -@x Section 20. +@x Section 17. static eight_bits tok_mem[max_toks]; static eight_bits *tok_mem_end=tok_mem+max_toks-1; static eight_bits *tok_ptr; /* first unused position in |tok_mem| */ @@ -151,7 +151,7 @@ static eight_bits huge* tok_ptr; /* first unused position in |tok_mem| */ @z -@x Section 21. +@x Section 18. text_info->tok_start=tok_ptr=tok_mem; text_ptr=text_info+1; text_ptr->tok_start=tok_mem; /* this makes replacement text 0 of length zero */ @@ -163,14 +163,14 @@ text_ptr=text_info+1; text_ptr->tok_start=tok_mem; @z -@x Section 22. +@x Section 19. @d equiv equiv_or_xref /* info corresponding to names */ @y @d equiv ptr_union.equiv_member /* info corresponding to names */ @z -@x Section 31. +@x Section 27. eight_bits *end_field; /* ending location of replacement text */ eight_bits *byte_field; /* present location within replacement text */ @y @@ -179,7 +179,7 @@ text_ptr=text_info+1; text_ptr->tok_start=tok_mem; @z -@x Section 55. +@x Section 49. out_char( eight_bits cur_char) { diff --git a/Build/source/texk/web2c/cwebdir/ctang-man.ch b/Build/source/texk/web2c/cwebdir/ctang-man.ch index f90d5361ae8..5b4d06c88b1 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-man.ch +++ b/Build/source/texk/web2c/cwebdir/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{66} \def\title{APPENDIX E: CTANGLE} \let\K=\leftarrow @z diff --git a/Build/source/texk/web2c/cwebdir/ctang-pc.ch b/Build/source/texk/web2c/cwebdir/ctang-pc.ch index 025790e3fc7..ddf281b3fc6 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-pc.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-pc.ch @@ -9,11 +9,11 @@ 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.3)" +@d banner "This is CTANGLE (Version 4.2)" @y -@d banner "This is CTANGLE (Version 4.3pc)" +@d banner "This is CTANGLE (Version 4.2pc)" @z -@x section 17 +@x section 4 @d max_bytes 1000000 /* the number of bytes in identifiers, index entries, and section names */ @d max_toks 1000000 /* number of bytes in compressed \CEE/ code */ diff --git a/Build/source/texk/web2c/cwebdir/ctang-ql.ch b/Build/source/texk/web2c/cwebdir/ctang-ql.ch index 6d5fe6b3e3a..64f0e81a723 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-ql.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-ql.ch @@ -7,15 +7,15 @@ ex <dev_>cc;"-v -h -c -=500000 ctangle_c" @x -\def\title{CTANGLE (Version 4.3)} +\def\title{CTANGLE (Version 4.2)} @y -\def\title{CTANGLE (QL Version 4.3)} +\def\title{CTANGLE (QL Version 4.2)} @z @x section 1 -@d banner "This is CTANGLE (Version 4.3)" +@d banner "This is CTANGLE (Version 4.2)" @y -@d banner "This is CTANGLE (QL Version 4.3)" +@d banner "This is CTANGLE (QL Version 4.2)" @z @x diff --git a/Build/source/texk/web2c/cwebdir/ctang-vms.ch b/Build/source/texk/web2c/cwebdir/ctang-vms.ch index 753e8d94a18..5686c66b9ad 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-vms.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-vms.ch @@ -10,12 +10,12 @@ created: (these changes not necessary for initial bootstrapping) @x section 1 (01-FEB-1992 ST) -@d banner "This is CTANGLE (Version 4.3)" +@d banner "This is CTANGLE (Version 4.2)" @y -@d banner "This is CTANGLE (VAX/VMS Version 4.3)" +@d banner "This is CTANGLE (VAX/VMS Version 4.2)" @z -@x section 4 (01-FEB-1992 ST) +@x section 3 (01-FEB-1992 ST) #include <ctype.h> /* definition of |@!isalpha|, |@!isdigit| and so on */ #include <stdbool.h> /* definition of |@!bool|, |@!true| and |@!false| */ #include <stddef.h> /* definition of |@!ptrdiff_t| */ diff --git a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch index 1545c5c5eb8..4fcbe7b1607 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch @@ -17,15 +17,15 @@ @q Please send comments, suggestions, etc. to tex-k@@tug.org. @> @x -\def\title{CTANGLE (Version 4.3)} +\def\title{CTANGLE (Version 4.2)} @y -\def\title{CTANGLE (Version 4.3 [\TeX~Live])} +\def\title{CTANGLE (Version 4.2 [\TeX~Live])} @z @x - \centerline{(Version 4.3)} + \centerline{(Version 4.2)} @y - \centerline{(Version 4.3 [\TeX~Live])} + \centerline{(Version 4.2 [\TeX~Live])} @z @x @@ -41,9 +41,9 @@ @z @x -@d banner "This is CTANGLE (Version 4.3)" +@d banner "This is CTANGLE (Version 4.2)" @y -@d banner "This is CTANGLE, Version 4.3" +@d banner "This is CTANGLE, Version 4.2" /* will be extended by the \TeX~Live |versionstring| */ @z @@ -78,9 +78,9 @@ @z @x - else overflow("output files"); + overflow("output files"); @y - else overflow(_("output files")); + overflow(_("output files")); @z @x @@ -113,14 +113,14 @@ for (an_output_file=end_output_files; an_output_file>cur_out_file;) { an_output_file--; sprint_section_name(output_file_name,*an_output_file); fclose(C_file); - if ((C_file=fopen(output_file_name,"wb"))==NULL) - fatal("! Cannot open output file ",output_file_name); + C_file=fopen(output_file_name,"wb"); + if (C_file ==0) fatal("! Cannot open output file ",output_file_name); @.Cannot open output file@> if (show_progress) { printf("\n(%s)",output_file_name); update_terminal; } cur_line=1; stack_ptr=stack+1; - cur_name=(*an_output_file); - cur_repl=(text_pointer)cur_name->equiv; + cur_name= (*an_output_file); + cur_repl= (text_pointer)cur_name->equiv; cur_byte=cur_repl->tok_start; cur_end=(cur_repl+1)->tok_start; while (stack_ptr > stack) get_output(); @@ -142,8 +142,8 @@ for (an_output_file=end_output_files; an_output_file>cur_out_file;) { if (show_progress) { printf("\n(%s)",output_file_name); update_terminal; } cur_line=1; stack_ptr=stack+1; - cur_name=(*an_output_file); - cur_repl=(text_pointer)cur_name->equiv; + cur_name= (*an_output_file); + cur_repl= (text_pointer)cur_name->equiv; cur_byte=cur_repl->tok_start; cur_end=(cur_repl+1)->tok_start; while (stack_ptr > stack) get_output(); @@ -154,9 +154,9 @@ strcpy(check_file_name,""); /* We want to get rid of the temporary file */ @z @x - else if (a<050000) confusion("macro defs have strange char"); + else if (a<050000) { confusion("macro defs have strange char");} @y - else if (a<050000) confusion(_("macro defs have strange char")); + else if (a<050000) { confusion(_("macro defs have strange char"));} @z @x @@ -338,9 +338,9 @@ case output_defs_code: if (t!=section_name) err_print(_("! Misplaced @@h")); @x @** Index. @y -@** Extensions to {\tentex CWEB}. The following sections introduce new or -improved features that have been created by numerous contributors over the -course of a quarter century. +@** Extensions to \.{CWEB}. The following sections introduce new or improved +features that have been created by numerous contributors over the course of a +quarter century. Care has been taken to keep the original section numbering intact, so this new material should nicely integrate with the original ``\&{104.~Index}.'' @@ -368,7 +368,7 @@ if((C_file=fopen(C_file_name,"r"))!=NULL) { fatal(_("! Cannot open output file "),check_file_name); @.Cannot open output file@> - if (check_for_change) @<Compare the temporary output...@>@; + if (temporary_output) @<Compare the temporary output...@>@; fclose(C_file); C_file=NULL; fclose(check_file); check_file=NULL; diff --git a/Build/source/texk/web2c/cwebdir/ctang-w32.ch b/Build/source/texk/web2c/cwebdir/ctang-w32.ch index 9d9be1255c2..1c687e5eb67 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-w32.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-w32.ch @@ -4,23 +4,23 @@ 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.3)" +@d banner "This is CTANGLE (Version 4.2)" @y -@d banner "This is CTANGLE (Version 4.3win32)" +@d banner "This is CTANGLE (Version 4.2win32)" @z @x -boolean names_match( +boolean names_match(@t\1\1@> 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@t\2\2@>) /* not used by \.{TANGLE} */ @y -boolean __cdecl names_match( +boolean __cdecl names_match(@t\1\1@> 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@t\2\2@>) /* not used by \.{TANGLE} */ @z @x diff --git a/Build/source/texk/web2c/cwebdir/ctangle.c b/Build/source/texk/web2c/cwebdir/ctangle.c index 5f3f9e1b76d..d955da9d573 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.c +++ b/Build/source/texk/web2c/cwebdir/ctangle.c @@ -2,7 +2,7 @@ #line 66 "ctangle.w" /*4:*/ -#line 44 "common.h" +#line 46 "common.h" #include <ctype.h> #include <stdbool.h> @@ -15,7 +15,7 @@ /*:4*/ #line 67 "ctangle.w" -#define banner "This is CTANGLE (Version 4.3)" \ +#define banner "This is CTANGLE (Version 4.2)" \ #define ctangle false #define cweave true \ @@ -36,18 +36,12 @@ #define period_ast 026 #define minus_gt_ast 027 \ -#define compress(c) if(loc++<=limit) return c \ - -#define xisalpha(c) (isalpha((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisdigit(c) (isdigit((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisspace(c) (isspace((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xislower(c) (islower((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisupper(c) (isupper((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define xisxdigit(c) (isxdigit((eight_bits) (c) ) &&((eight_bits) (c) <0200) ) -#define isxalpha(c) ((c) =='_'||(c) =='$') \ - -#define ishigh(c) ((eight_bits) (c) > 0177) \ - \ +#define xisalpha(c) (isalpha((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisdigit(c) (isdigit((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisspace(c) (isspace((eight_bits) c) &&((eight_bits) c<0200) ) +#define xislower(c) (islower((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \ #define max_include_depth 10 \ @@ -82,7 +76,10 @@ #define update_terminal fflush(stdout) #define new_line putchar('\n') -#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) \ +#define putxchar putchar +#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) +#define C_printf(c,a) fprintf(C_file,c,a) +#define C_putc(c) putc(c,C_file) \ #define max_bytes 1000000 \ @@ -98,11 +95,9 @@ #define equiv equiv_or_xref \ -#define macro 0 #define section_flag max_texts \ #define string 02 -#define constant 03 #define join 0177 #define output_defs_flag (2*024000-1) \ @@ -122,12 +117,9 @@ #define verbatim 4 \ #define max_files 256 -#define C_printf(c,a) fprintf(C_file,c,a) -#define C_putc(c) putc(c,C_file) \ - #define translit_length 10 \ -#define ignore 00 +#define ignore 0 #define ord 0302 #define control_text 0303 #define translit_code 0304 @@ -138,15 +130,23 @@ #define section_name 0311 #define new_section 0312 \ -#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow("token") ;*tok_ptr++= c;} \ +#define constant 03 \ -#define keep_digit_separators flags['k'] \ +#define isxalpha(c) ((c) =='_'||(c) =='$') \ + +#define ishigh(c) ((eight_bits) (c) > 0177) \ + \ + +#define compress(c) if(loc++<=limit) return c \ + +#define macro 0 +#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow("token") ;*tok_ptr++= c;} \ #line 68 "ctangle.w" /*3:*/ -#line 35 "common.h" +#line 37 "common.h" typedef bool boolean; typedef uint8_t eight_bits; @@ -163,7 +163,7 @@ extern char*id_first; extern char*id_loc; /*:5*//*6:*/ -#line 92 "common.h" +#line 88 "common.h" extern char buffer[]; extern char*buffer_end; @@ -171,7 +171,7 @@ extern char*loc; extern char*limit; /*:6*//*7:*/ -#line 109 "common.h" +#line 105 "common.h" extern int include_depth; extern FILE*file[]; @@ -187,7 +187,7 @@ extern boolean changing; extern boolean web_file_open; /*:7*//*9:*/ -#line 129 "common.h" +#line 125 "common.h" extern sixteen_bits section_count; extern boolean changed_section[]; @@ -195,7 +195,7 @@ extern boolean change_pending; extern boolean print_where; /*:9*//*10:*/ -#line 143 "common.h" +#line 139 "common.h" typedef struct name_info{ char*byte_start; @@ -220,12 +220,12 @@ extern hash_pointer hash_end; extern hash_pointer h; /*:10*//*12:*/ -#line 187 "common.h" +#line 183 "common.h" extern int history; /*:12*//*14:*/ -#line 203 "common.h" +#line 199 "common.h" extern int argc; extern char**argv; @@ -236,7 +236,7 @@ extern char scn_file_name[]; extern boolean flags[]; /*:14*//*15:*/ -#line 217 "common.h" +#line 215 "common.h" extern FILE*C_file; extern FILE*tex_file; @@ -257,7 +257,7 @@ sixteen_bits text_link; typedef text*text_pointer; /*:19*//*31:*/ -#line 273 "ctangle.w" +#line 269 "ctangle.w" typedef struct{ eight_bits*end_field; @@ -282,12 +282,12 @@ static eight_bits*tok_mem_end= tok_mem+max_toks-1; static eight_bits*tok_ptr; /*:20*//*26:*/ -#line 199 "ctangle.w" +#line 198 "ctangle.w" static text_pointer last_unnamed; /*:26*//*32:*/ -#line 289 "ctangle.w" +#line 285 "ctangle.w" static output_state cur_state; @@ -296,18 +296,18 @@ static stack_pointer stack_end= stack+stack_size; static stack_pointer stack_ptr; /*:32*//*37:*/ -#line 365 "ctangle.w" +#line 361 "ctangle.w" static int cur_val; /*:37*//*42:*/ -#line 456 "ctangle.w" +#line 452 "ctangle.w" static eight_bits out_state; static boolean protect; /*:42*//*45:*/ -#line 487 "ctangle.w" +#line 483 "ctangle.w" static name_pointer output_files[max_files]; static name_pointer*cur_out_file,*end_output_files,*an_output_file; @@ -315,33 +315,33 @@ static char cur_section_name_char; static char output_file_name[longest_name+1]; /*:45*//*52:*/ -#line 584 "ctangle.w" +#line 582 "ctangle.w" static boolean output_defs_seen= false; /*:52*//*57:*/ -#line 696 "ctangle.w" +#line 691 "ctangle.w" static char translit[128][translit_length]; /*:57*//*62:*/ -#line 775 "ctangle.w" +#line 770 "ctangle.w" static eight_bits ccode[256]; /*:62*//*66:*/ -#line 835 "ctangle.w" +#line 830 "ctangle.w" static boolean comment_continues= false; /*:66*//*68:*/ -#line 872 "ctangle.w" +#line 869 "ctangle.w" static name_pointer cur_section_name; static boolean no_where; /*:68*//*82:*/ -#line 1189 "ctangle.w" +#line 1182 "ctangle.w" static text_pointer cur_text; static eight_bits next_control; @@ -350,19 +350,19 @@ static eight_bits next_control; #line 71 "ctangle.w" /*8:*/ -#line 123 "common.h" +#line 119 "common.h" extern boolean get_line(void); extern void check_complete(void); extern void reset_input(void); /*:8*//*11:*/ -#line 166 "common.h" +#line 162 "common.h" extern boolean names_match(name_pointer,const char*,size_t,eight_bits); extern name_pointer id_lookup(const char*,const char*,char); -extern name_pointer section_lookup(char*,char*,boolean); +extern name_pointer section_lookup(char*,char*,int); extern void init_node(name_pointer); extern void init_p(name_pointer,eight_bits); extern void print_prefix_name(name_pointer); @@ -370,7 +370,7 @@ extern void print_section_name(name_pointer); extern void sprint_section_name(char*,name_pointer); /*:11*//*13:*/ -#line 190 "common.h" +#line 186 "common.h" extern int wrap_up(void); extern void err_print(const char*); @@ -378,63 +378,63 @@ extern void fatal(const char*,const char*); extern void overflow(const char*); /*:13*//*16:*/ -#line 225 "common.h" +#line 223 "common.h" extern void common_init(void); extern void print_stats(void); /*:16*//*30:*/ -#line 245 "ctangle.w" +#line 241 "ctangle.w" static void store_two_bytes(sixteen_bits); /*:30*//*35:*/ -#line 328 "ctangle.w" +#line 324 "ctangle.w" static void push_level(name_pointer); static void pop_level(boolean); /*:35*//*39:*/ -#line 401 "ctangle.w" +#line 397 "ctangle.w" static void get_output(void); /*:39*//*44:*/ -#line 477 "ctangle.w" +#line 473 "ctangle.w" static void flush_buffer(void); /*:44*//*49:*/ -#line 551 "ctangle.w" +#line 549 "ctangle.w" static void phase_two(void); /*:49*//*53:*/ -#line 587 "ctangle.w" +#line 585 "ctangle.w" static void output_defs(void); static void out_char(eight_bits); /*:53*//*65:*/ -#line 815 "ctangle.w" +#line 810 "ctangle.w" static eight_bits skip_ahead(void); static boolean skip_comment(boolean); /*:65*//*70:*/ -#line 922 "ctangle.w" +#line 924 "ctangle.w" static eight_bits get_next(void); /*:70*//*84:*/ -#line 1215 "ctangle.w" +#line 1208 "ctangle.w" static void scan_repl(eight_bits); /*:84*//*91:*/ -#line 1396 "ctangle.w" +#line 1379 "ctangle.w" static void scan_section(void); /*:91*//*99:*/ -#line 1477 "ctangle.w" +#line 1460 "ctangle.w" static void phase_one(void); /*:99*//*101:*/ -#line 1511 "ctangle.w" +#line 1494 "ctangle.w" static void skip_limbo(void); /*:101*/ @@ -463,16 +463,16 @@ text_ptr= text_info+1;text_ptr->tok_start= tok_mem; init_node(name_dir); /*:23*//*27:*/ -#line 202 "ctangle.w" -last_unnamed= text_info;text_info->text_link= macro; +#line 201 "ctangle.w" +last_unnamed= text_info;text_info->text_link= 0; /*:27*//*46:*/ -#line 497 "ctangle.w" +#line 493 "ctangle.w" cur_out_file= end_output_files= output_files+max_files; /*:46*//*58:*/ -#line 699 "ctangle.w" +#line 694 "ctangle.w" { int i; @@ -480,7 +480,7 @@ for(i= 0;i<128;i++)sprintf(translit[i],"X%02X",(unsigned int)(128+i)); } /*:58*//*63:*/ -#line 778 "ctangle.w" +#line 773 "ctangle.w" { int c; for(c= 0;c<256;c++)ccode[c]= ignore; @@ -500,7 +500,7 @@ ccode['\'']= ord; } /*:63*//*78:*/ -#line 1111 "ctangle.w" +#line 1103 "ctangle.w" section_text[0]= ' '; /*:78*/ @@ -539,7 +539,7 @@ void init_p(name_pointer p,eight_bits t){(void)p;(void)t;} /*:25*//*29:*/ -#line 235 "ctangle.w" +#line 231 "ctangle.w" static void store_two_bytes( @@ -551,7 +551,7 @@ if(tok_ptr+2> tok_mem_end)overflow("token"); } /*:29*//*34:*/ -#line 313 "ctangle.w" +#line 309 "ctangle.w" static void push_level( @@ -568,7 +568,7 @@ cur_section= 0; } /*:34*//*36:*/ -#line 336 "ctangle.w" +#line 332 "ctangle.w" static void pop_level( @@ -584,7 +584,7 @@ if(stack_ptr> stack)cur_state= *stack_ptr; } /*:36*//*38:*/ -#line 372 "ctangle.w" +#line 368 "ctangle.w" static void get_output(void) @@ -607,7 +607,7 @@ switch(a/024000){ case 0:cur_val= a;out_char(identifier);break; case 1:if(a==output_defs_flag)output_defs(); else/*40:*/ -#line 406 "ctangle.w" +#line 402 "ctangle.w" { a-= 024000; @@ -621,7 +621,7 @@ goto restart; } /*:40*/ -#line 393 "ctangle.w" +#line 389 "ctangle.w" break; default:cur_val= a-050000;if(cur_val> 0)cur_section= cur_val; @@ -631,14 +631,14 @@ out_char(section_number); } /*:38*//*43:*/ -#line 464 "ctangle.w" +#line 460 "ctangle.w" static void flush_buffer(void) { C_putc('\n'); if(cur_line%100==0&&show_progress){ -putchar('.'); +printf("."); if(cur_line%500==0)printf("%d",cur_line); update_terminal; } @@ -646,31 +646,31 @@ cur_line++; } /*:43*//*48:*/ -#line 516 "ctangle.w" +#line 514 "ctangle.w" static void phase_two(void){ web_file_open= false; cur_line= 1; /*33:*/ -#line 302 "ctangle.w" +#line 298 "ctangle.w" stack_ptr= stack+1;cur_name= name_dir;cur_repl= text_info->text_link+text_info; cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start;cur_section= 0; /*:33*/ -#line 521 "ctangle.w" +#line 519 "ctangle.w" /*51:*/ -#line 580 "ctangle.w" +#line 578 "ctangle.w" if(!output_defs_seen) output_defs(); /*:51*/ -#line 522 "ctangle.w" +#line 520 "ctangle.w" -if(text_info->text_link==macro&&cur_out_file==end_output_files){ +if(text_info->text_link==0&&cur_out_file==end_output_files){ fputs("\n! No program text was specified.",stdout);mark_harmless; } @@ -686,19 +686,19 @@ fputs("\nWriting the output files:",stdout); printf(" (%s)",C_file_name); update_terminal; } -if(text_info->text_link==macro)goto writeloop; +if(text_info->text_link==0)goto writeloop; } while(stack_ptr> stack)get_output(); flush_buffer(); writeloop:/*50:*/ -#line 557 "ctangle.w" +#line 555 "ctangle.w" for(an_output_file= end_output_files;an_output_file> cur_out_file;){ an_output_file--; sprint_section_name(output_file_name,*an_output_file); fclose(C_file); -if((C_file= fopen(output_file_name,"wb"))==NULL) -fatal("! Cannot open output file ",output_file_name); +C_file= fopen(output_file_name,"wb"); +if(C_file==0)fatal("! Cannot open output file ",output_file_name); if(show_progress){printf("\n(%s)",output_file_name);update_terminal;} cur_line= 1; @@ -712,7 +712,7 @@ flush_buffer(); } /*:50*/ -#line 543 "ctangle.w" +#line 541 "ctangle.w" if(show_happiness){ if(show_progress)new_line; @@ -722,7 +722,7 @@ fputs("Done.",stdout); } /*:48*//*54:*/ -#line 594 "ctangle.w" +#line 589 "ctangle.w" static void output_defs(void) @@ -730,7 +730,7 @@ output_defs(void) sixteen_bits a; push_level(NULL); for(cur_text= text_info+1;cur_text<text_ptr;cur_text++) -if(cur_text->text_link==macro){ +if(cur_text->text_link==0){ cur_byte= cur_text->tok_start; cur_end= (cur_text+1)->tok_start; C_printf("%s","#define "); @@ -748,7 +748,7 @@ a= (a-0200)*0400+*cur_byte++; if(a<024000){ cur_val= a;out_char(identifier); } -else if(a<050000)confusion("macro defs have strange char"); +else if(a<050000){confusion("macro defs have strange char");} else{ cur_val= a-050000;cur_section= cur_val;out_char(section_number); } @@ -762,7 +762,7 @@ pop_level(false); } /*:54*//*55:*/ -#line 637 "ctangle.w" +#line 632 "ctangle.w" static void out_char( @@ -775,7 +775,7 @@ case'\n':if(protect&&out_state!=verbatim)C_putc(' '); if(protect||out_state==verbatim)C_putc('\\'); flush_buffer();if(out_state!=verbatim)out_state= normal;break; /*59:*/ -#line 705 "ctangle.w" +#line 700 "ctangle.w" case identifier: if(out_state==num_or_id)C_putc(' '); @@ -790,10 +790,10 @@ j++; out_state= num_or_id;break; /*:59*/ -#line 648 "ctangle.w" +#line 643 "ctangle.w" /*60:*/ -#line 718 "ctangle.w" +#line 713 "ctangle.w" case section_number: if(cur_val> 0)C_printf("/*%d:*/",cur_val); @@ -815,15 +815,15 @@ j<k;j++){ if(*j=='\\'||*j=='"')C_putc('\\'); C_putc(*j); } -C_putc('"');C_putc('\n'); +C_printf("%s","\"\n"); } break; /*:60*/ -#line 649 "ctangle.w" +#line 644 "ctangle.w" /*56:*/ -#line 667 "ctangle.w" +#line 662 "ctangle.w" case plus_plus:C_putc('+');C_putc('+');out_state= normal;break; case minus_minus:C_putc('-');C_putc('-');out_state= normal;break; @@ -844,7 +844,7 @@ case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal; break; /*:56*/ -#line 650 "ctangle.w" +#line 645 "ctangle.w" case'=':case'>':C_putc(cur_char);C_putc(' '); out_state= normal;break; @@ -863,7 +863,7 @@ default:C_putc(cur_char);out_state= normal;break; } /*:55*//*64:*/ -#line 799 "ctangle.w" +#line 794 "ctangle.w" static eight_bits skip_ahead(void) @@ -881,7 +881,7 @@ if(c!=ignore||*(loc-1)=='>')return c; } /*:64*//*67:*/ -#line 838 "ctangle.w" +#line 833 "ctangle.w" static boolean skip_comment( boolean is_long_comment) @@ -915,23 +915,22 @@ else loc++; } /*:67*//*69:*/ -#line 879 "ctangle.w" +#line 881 "ctangle.w" static eight_bits get_next(void) { -static boolean preprocessing= false; +static int preprocessing= 0; eight_bits c; while(true){ if(loc> limit){ -if(preprocessing&&*(limit-1)!='\\')preprocessing= false; +if(preprocessing&&*(limit-1)!='\\')preprocessing= 0; if(get_line()==false)return new_section; else if(print_where&&!no_where){ print_where= false; /*85:*/ -#line 1221 "ctangle.w" +#line 1214 "ctangle.w" -{ store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -943,10 +942,9 @@ store_two_bytes((sixteen_bits)cur_line); id_loc= id_first+strlen(id_first); {int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200); app_repl(a_l%0400);} -} /*:85*/ -#line 891 "ctangle.w" +#line 893 "ctangle.w" } else return'\n'; @@ -960,32 +958,23 @@ else continue; } loc++; if(xisdigit(c)||c=='.')/*73:*/ -#line 963 "ctangle.w" +#line 964 "ctangle.w" { -boolean hex_flag= false; id_first= loc-1; if(*id_first=='.'&&!xisdigit(*loc))goto mistake; if(*id_first=='0'){ if(*loc=='x'||*loc=='X'){ -hex_flag= true; -loc++;while(xisxdigit(*loc)||*loc=='\'')loc++; +loc++;while(xisxdigit(*loc))loc++;goto found; } -else if(*loc=='b'||*loc=='B'){ -loc++;while(*loc=='0'||*loc=='1'||*loc=='\'')loc++;goto found; } -} -while(xisdigit(*loc)||*loc=='\'')loc++; +while(xisdigit(*loc))loc++; if(*loc=='.'){ loc++; -while((hex_flag&&xisxdigit(*loc))||xisdigit(*loc)||*loc=='\'')loc++; +while(xisdigit(*loc))loc++; } if(*loc=='e'||*loc=='E'){ if(*++loc=='+'||*loc=='-')loc++; -while(xisdigit(*loc)||*loc=='\'')loc++; -} -else if(hex_flag&&(*loc=='p'||*loc=='P')){ -if(*++loc=='+'||*loc=='-')loc++; -while(xisxdigit(*loc)||*loc=='\'')loc++; +while(xisdigit(*loc))loc++; } found:while(*loc=='u'||*loc=='U'||*loc=='l'||*loc=='L' ||*loc=='f'||*loc=='F')loc++; @@ -994,19 +983,19 @@ return constant; } /*:73*/ -#line 903 "ctangle.w" +#line 905 "ctangle.w" else if(c=='\''||c=='"' ||((c=='L'||c=='u'||c=='U')&&(*loc=='\''||*loc=='"')) ||((c=='u'&&*loc=='8')&&(*(loc+1)=='\''||*(loc+1)=='"'))) /*74:*/ -#line 1000 "ctangle.w" +#line 992 "ctangle.w" { char delim= c; id_first= section_text+1; id_loc= section_text;*++id_loc= delim; if(delim=='L'||delim=='u'||delim=='U'){ -if(delim=='u'&&*loc=='8')*++id_loc= *loc++; +if(delim=='u'&&*loc=='8'){*++id_loc= *loc++;} delim= *loc++;*++id_loc= delim; } while(true){ @@ -1044,27 +1033,26 @@ return string; } /*:74*/ -#line 907 "ctangle.w" +#line 909 "ctangle.w" else if(isalpha(c)||isxalpha(c)||ishigh(c)) /*72:*/ -#line 954 "ctangle.w" +#line 957 "ctangle.w" { id_first= --loc; -do{ -++loc; -}while(isalpha((eight_bits)*loc)||isdigit((eight_bits)*loc) +while(isalpha((eight_bits)*++loc)||isdigit((eight_bits)*loc) ||isxalpha((eight_bits)*loc)||ishigh((eight_bits)*loc)); id_loc= loc;return identifier; } /*:72*/ -#line 909 "ctangle.w" +#line 911 "ctangle.w" else if(c=='@')/*75:*/ -#line 1045 "ctangle.w" +#line 1037 "ctangle.w" { -switch(c= ccode[(eight_bits)*loc++]){ +c= ccode[(eight_bits)*loc++]; +switch(c){ case ignore:continue; case translit_code:err_print("! Use @l in limbo only");continue; @@ -1077,11 +1065,11 @@ continue; case section_name: cur_section_name_char= *(loc-1); /*77:*/ -#line 1091 "ctangle.w" +#line 1085 "ctangle.w" { char*k; /*79:*/ -#line 1113 "ctangle.w" +#line 1105 "ctangle.w" k= section_text; while(true){ @@ -1092,7 +1080,7 @@ loc= buffer+1;break; } c= *loc; /*80:*/ -#line 1137 "ctangle.w" +#line 1129 "ctangle.w" if(c=='@'){ c= *(loc+1); @@ -1111,7 +1099,7 @@ err_print("! Nesting of section names not allowed");break; } /*:80*/ -#line 1122 "ctangle.w" +#line 1114 "ctangle.w" loc++;if(k<section_text_end)k++; if(xisspace(c)){ @@ -1128,16 +1116,14 @@ printf("...");mark_harmless; if(*k==' '&&k> section_text)k--; /*:79*/ -#line 1093 "ctangle.w" +#line 1087 "ctangle.w" if(k-section_text> 3&&strncmp(k-2,"...",3)==0) -cur_section_name= section_lookup(section_text+1,k-3,true); - -else cur_section_name= section_lookup(section_text+1,k,false); - +cur_section_name= section_lookup(section_text+1,k-3,1); +else cur_section_name= section_lookup(section_text+1,k,0); if(cur_section_name_char=='(') /*47:*/ -#line 501 "ctangle.w" +#line 497 "ctangle.w" { for(an_output_file= cur_out_file; @@ -1146,21 +1132,23 @@ if(*an_output_file==cur_section_name)break; if(an_output_file==end_output_files){ if(cur_out_file> output_files) *--cur_out_file= cur_section_name; -else overflow("output files"); +else{ +overflow("output files"); +} } } /*:47*/ -#line 1101 "ctangle.w" +#line 1093 "ctangle.w" return section_name; } /*:77*/ -#line 1058 "ctangle.w" +#line 1051 "ctangle.w" case string:/*81:*/ -#line 1159 "ctangle.w" +#line 1151 "ctangle.w" { id_first= loc++;*(limit+1)= '@';*(limit+2)= '>'; while(*loc!='@'||*(loc+1)!='>')loc++; @@ -1171,14 +1159,15 @@ return string; } /*:81*/ -#line 1059 "ctangle.w" +#line 1052 "ctangle.w" case ord:/*76:*/ -#line 1071 "ctangle.w" +#line 1064 "ctangle.w" id_first= loc; -if(*loc=='\\') +if(*loc=='\\'){ if(*++loc=='\'')loc++; +} while(*loc!='\''){ if(*loc=='@'){ if(*(loc+1)!='@') @@ -1196,35 +1185,34 @@ loc++; return ord; /*:76*/ -#line 1060 "ctangle.w" +#line 1053 "ctangle.w" default:return c; } } /*:75*/ -#line 910 "ctangle.w" +#line 912 "ctangle.w" else if(xisspace(c)){ if(!preprocessing||loc> limit)continue; else return' '; } -else if(c=='#'&&loc==buffer+1)preprocessing= true; +else if(c=='#'&&loc==buffer+1)preprocessing= 1; mistake:/*71:*/ -#line 931 "ctangle.w" +#line 935 "ctangle.w" switch(c){ case'+':if(*loc=='+')compress(plus_plus);break; case'-':if(*loc=='-'){compress(minus_minus);} -else if(*loc=='>'){ -if(*(loc+1)=='*'){loc++;compress(minus_gt_ast);} -else compress(minus_gt); -}break; +else{if(*loc=='>'){if(*(loc+1)=='*'){loc++;compress(minus_gt_ast);} +else compress(minus_gt);}}break; case'.':if(*loc=='*'){compress(period_ast);} else if(*loc=='.'&&*(loc+1)=='.'){ loc++;compress(dot_dot_dot); -}break; +} +break; case':':if(*loc==':')compress(colon_colon);break; case'=':if(*loc=='=')compress(eq_eq);break; case'>':if(*loc=='='){compress(gt_eq);} @@ -1237,24 +1225,23 @@ case'!':if(*loc=='=')compress(non_eq);break; } /*:71*/ -#line 917 "ctangle.w" +#line 919 "ctangle.w" return c; } } /*:69*//*83:*/ -#line 1193 "ctangle.w" +#line 1186 "ctangle.w" static void scan_repl( eight_bits t) { sixteen_bits a; -if(t==section_name)/*85:*/ -#line 1221 "ctangle.w" +if(t==section_name){/*85:*/ +#line 1214 "ctangle.w" -{ store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1266,14 +1253,13 @@ store_two_bytes((sixteen_bits)cur_line); id_loc= id_first+strlen(id_first); {int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200); app_repl(a_l%0400);} -} /*:85*/ -#line 1199 "ctangle.w" - +#line 1192 "ctangle.w" +} while(true)switch(a= get_next()){ /*86:*/ -#line 1236 "ctangle.w" +#line 1227 "ctangle.w" case identifier:a= id_lookup(id_first,id_loc,0)-name_dir; app_repl((a/0400)+0200); @@ -1281,7 +1267,7 @@ app_repl(a%0400);break; case section_name:if(t!=section_name)goto done; else{ /*87:*/ -#line 1269 "ctangle.w" +#line 1260 "ctangle.w" { char*try_loc= loc; while(*try_loc==' '&&try_loc<limit)try_loc++; @@ -1294,15 +1280,14 @@ if(*try_loc=='=')err_print("! Missing `@ ' before a named section"); } /*:87*/ -#line 1242 "ctangle.w" +#line 1233 "ctangle.w" a= cur_section_name-name_dir; app_repl((a/0400)+0250); app_repl(a%0400); /*85:*/ -#line 1221 "ctangle.w" +#line 1214 "ctangle.w" -{ store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1314,10 +1299,9 @@ store_two_bytes((sixteen_bits)cur_line); id_loc= id_first+strlen(id_first); {int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200); app_repl(a_l%0400);} -} /*:85*/ -#line 1246 "ctangle.w" +#line 1237 "ctangle.w" break; } case output_defs_code:if(t!=section_name)err_print("! Misplaced @h"); @@ -1328,9 +1312,8 @@ a= output_defs_flag; app_repl((a/0400)+0200); app_repl(a%0400); /*85:*/ -#line 1221 "ctangle.w" +#line 1214 "ctangle.w" -{ store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1342,16 +1325,15 @@ store_two_bytes((sixteen_bits)cur_line); id_loc= id_first+strlen(id_first); {int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200); app_repl(a_l%0400);} -} /*:85*/ -#line 1255 "ctangle.w" +#line 1246 "ctangle.w" } break; case constant:case string: /*88:*/ -#line 1286 "ctangle.w" +#line 1271 "ctangle.w" app_repl(a); while(id_first<id_loc){ @@ -1360,18 +1342,16 @@ if(*(id_first+1)=='@')id_first++; else err_print("! Double @ should be used in string"); } -else if(a==constant&&*id_first=='\''&&!keep_digit_separators) -id_first++; app_repl(*id_first++); } app_repl(a);break; /*:88*/ -#line 1259 "ctangle.w" +#line 1250 "ctangle.w" case ord: /*89:*/ -#line 1304 "ctangle.w" +#line 1287 "ctangle.w" { int c= (eight_bits)*id_first; if(c=='\\'){ @@ -1422,7 +1402,7 @@ app_repl(constant); break; /*:89*/ -#line 1261 "ctangle.w" +#line 1252 "ctangle.w" case definition:case format_code:case begin_C:if(t!=section_name)goto done; else{ @@ -1432,7 +1412,7 @@ err_print("! @d, @f and @c are ignored in C text");continue; case new_section:goto done; /*:86*/ -#line 1204 "ctangle.w" +#line 1197 "ctangle.w" case')':app_repl(a); if(t==macro)app_repl(' '); @@ -1445,7 +1425,7 @@ cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; } /*:83*//*90:*/ -#line 1363 "ctangle.w" +#line 1346 "ctangle.w" static void scan_section(void) @@ -1457,10 +1437,10 @@ section_count++;no_where= true; if(*(loc-1)=='*'&&show_progress){ printf("*%d",section_count);update_terminal; } -next_control= ignore; +next_control= 0; while(true){ /*92:*/ -#line 1404 "ctangle.w" +#line 1387 "ctangle.w" while(next_control<definition) @@ -1469,11 +1449,11 @@ loc-= 2;next_control= get_next(); } /*:92*/ -#line 1377 "ctangle.w" +#line 1360 "ctangle.w" if(next_control==definition){ /*93:*/ -#line 1411 "ctangle.w" +#line 1394 "ctangle.w" { while((next_control= get_next())=='\n'); if(next_control!=identifier){ @@ -1492,7 +1472,7 @@ cur_text->text_link= macro; } /*:93*/ -#line 1379 "ctangle.w" +#line 1362 "ctangle.w" continue; } @@ -1502,14 +1482,14 @@ p= name_dir;break; if(next_control==section_name){ p= cur_section_name; /*94:*/ -#line 1436 "ctangle.w" +#line 1419 "ctangle.w" while((next_control= get_next())=='+'); if(next_control!='='&&next_control!=eq_eq) continue; /*:94*/ -#line 1387 "ctangle.w" +#line 1370 "ctangle.w" break; } @@ -1517,22 +1497,22 @@ return; } no_where= print_where= false; /*95:*/ -#line 1441 "ctangle.w" +#line 1424 "ctangle.w" /*96:*/ -#line 1446 "ctangle.w" +#line 1429 "ctangle.w" store_two_bytes((sixteen_bits)(0150000+section_count)); /*:96*/ -#line 1442 "ctangle.w" +#line 1425 "ctangle.w" scan_repl(section_name); /*97:*/ -#line 1450 "ctangle.w" +#line 1433 "ctangle.w" -if(p==name_dir||p==NULL){ +if(p==name_dir||p==0){ (last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text; } else if(p->equiv==(void*)text_info)p->equiv= (void*)cur_text; @@ -1547,16 +1527,16 @@ cur_text->text_link= section_flag; /*:97*/ -#line 1444 "ctangle.w" +#line 1427 "ctangle.w" /*:95*/ -#line 1393 "ctangle.w" +#line 1376 "ctangle.w" } /*:90*//*98:*/ -#line 1465 "ctangle.w" +#line 1448 "ctangle.w" static void phase_one(void){ @@ -1570,7 +1550,7 @@ phase= 2; } /*:98*//*100:*/ -#line 1482 "ctangle.w" +#line 1465 "ctangle.w" static void skip_limbo(void) @@ -1585,7 +1565,7 @@ c= *loc++; if(ccode[(eight_bits)c]==new_section)break; switch(ccode[(eight_bits)c]){ case translit_code:/*102:*/ -#line 1513 "ctangle.w" +#line 1496 "ctangle.w" while(xisspace(*loc)&&loc<limit)loc++; loc+= 3; @@ -1610,7 +1590,7 @@ translit[i-0200][loc-beg]= '\0'; } /*:102*/ -#line 1495 "ctangle.w" +#line 1478 "ctangle.w" break; case format_code:case'@':break; case control_text:if(c=='q'||c=='Q'){ @@ -1628,7 +1608,7 @@ default:err_print("! Double @ should be used in limbo"); } /*:100*//*103:*/ -#line 1539 "ctangle.w" +#line 1522 "ctangle.w" void print_stats(void){ diff --git a/Build/source/texk/web2c/cwebdir/ctangle.w b/Build/source/texk/web2c/cwebdir/ctangle.w index 03751a473c9..e7e2d311fe5 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.w +++ b/Build/source/texk/web2c/cwebdir/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.3 --- April 2021 +% Version 4.2 --- February 2021 % 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.3)} +\def\title{CTANGLE (Version 4.2)} \def\topofcontents{\null\vfill \centerline{\titlefont The {\ttitlefont CTANGLE} processor} \vskip 15pt - \centerline{(Version 4.3)} + \centerline{(Version 4.2)} \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.3)" +@d banner "This is CTANGLE (Version 4.2)" @c @<Include files@>@/ @@ -151,11 +151,11 @@ init_node(name_dir); /* the undefined section has no replacement text */ starting at position |first| equals the identifier pointed to by |p|: @c -boolean names_match( +boolean names_match(@t\1\1@> 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@t\2\2@>) /* not used by \.{TANGLE} */ {@+(void)t; if (length(p)!=l) return false; return !strncmp(first,p->byte_start,l); @@ -193,13 +193,12 @@ name, and they also tie together all the \CEE/ texts of unnamed sections. The replacement text pointer for the first unnamed section appears in |text_info->text_link|, and the most recent such pointer is |last_unnamed|. -@d macro 0 @d section_flag max_texts /* final |text_link| in section replacement texts */ @<Private...@>= static text_pointer last_unnamed; /* most recent replacement text of unnamed section */ -@ @<Set init...@>= last_unnamed=text_info; text_info->text_link=macro; +@ @<Set init...@>= last_unnamed=text_info; text_info->text_link=0; @ If the first byte of a token is less than |0200|, the token occupies a single byte. Otherwise we make a sixteen-bit token by combining two consecutive @@ -215,18 +214,15 @@ Codes less than |0200| are 7-bit |char| codes that represent themselves. Some of the 7-bit codes will not be present, however, so we can use them for special purposes. The following symbolic names are used: -\yskip \hang |string| denotes the beginning or end of a string -or a verbatim construction. +\yskip \hang |join| denotes the concatenation of adjacent items with no +space or line breaks allowed between them (the \.{@@\&} operation of \.{CWEB}). -\hang |constant| denotes a numerical constant. - -\hang |join| denotes the concatenation of adjacent items with no space -or line breaks allowed between them (the \.{@@\&} operation of \.{CWEB}). +\hang |string| denotes the beginning or end of a string, verbatim +construction or numerical constant. @^ASCII code dependencies@> -@d string 02 /* takes the place of ASCII \.{STX} */ -@d constant 03 /* takes the place of ASCII \.{ETX} */ -@d join 0177 /* takes the place of ASCII \.{DEL} */ +@d string 02 /* takes the place of extended ASCII \.{\char2} */ +@d join 0177 /* takes the place of ASCII delete */ @d output_defs_flag (2*024000-1) @ The following procedure is used to enter a two-byte value into @@ -312,8 +308,8 @@ We assume that the \CEE/ compiler can copy structures. @c static void -push_level( /* suspends the current level */ -name_pointer p) +push_level(@t\1\1@> /* suspends the current level */ +name_pointer p@t\2\2@>) { if (stack_ptr==stack_end) overflow("stack"); *stack_ptr=cur_state; @@ -335,8 +331,8 @@ text or returns the state to the most recently stacked level. @c static void -pop_level( /* do this when |cur_byte| reaches |cur_end| */ -boolean flag) /* |flag==false| means we are in |output_defs| */ +pop_level(@t\1\1@> /* do this when |cur_byte| reaches |cur_end| */ +boolean flag@t\2\2@>) /* |flag==false| means we are in |output_defs| */ { if (flag && cur_repl->text_link<section_flag) { /* link to a continuation */ cur_repl=cur_repl->text_link+text_info; /* stay on the same level */ @@ -354,7 +350,7 @@ necessary stacking and unstacking. It sends the value |section_number| if the next output begins or ends the replacement text of some section, in which case |cur_val| is that section's number (if beginning) or the negative of that value (if ending). (A section number of 0 indicates -not the beginning or ending of a section, but a \#\&{line} command.) +not the beginning or ending of a section, but a \&{\#line} command.) And it sends the value |identifier| if the next output is an identifier, in which case |cur_val| points to that identifier name. @@ -467,7 +463,7 @@ flush_buffer(void) /* writes one line to output file */ { C_putc('\n'); if (cur_line % 100 == 0 && show_progress) { - putchar('.'); + printf("."); if (cur_line % 500 == 0) printf("%d",cur_line); update_terminal; /* progress report */ } @@ -506,7 +502,9 @@ complain we're out of room@>= if (an_output_file==end_output_files) { if (cur_out_file>output_files) *--cur_out_file=cur_section_name; - else overflow("output files"); + else { + overflow("output files"); + } } } @@ -520,7 +518,7 @@ phase_two (void) { cur_line=1; @<Initialize the output stacks@>@; @<Output macro definitions if appropriate@>@; - if (text_info->text_link==macro && cur_out_file==end_output_files) { + if (text_info->text_link==0 && cur_out_file==end_output_files) { fputs("\n! No program text was specified.",stdout); mark_harmless; @.No program text...@> } @@ -536,7 +534,7 @@ phase_two (void) { printf(" (%s)",C_file_name); update_terminal; } - if (text_info->text_link==macro) goto writeloop; + if (text_info->text_link==0) goto writeloop; } while (stack_ptr>stack) get_output(); flush_buffer(); @@ -559,14 +557,14 @@ for (an_output_file=end_output_files; an_output_file>cur_out_file;) { an_output_file--; sprint_section_name(output_file_name,*an_output_file); fclose(C_file); - if ((C_file=fopen(output_file_name,"wb"))==NULL) - fatal("! Cannot open output file ",output_file_name); + C_file=fopen(output_file_name,"wb"); + if (C_file ==0) fatal("! Cannot open output file ",output_file_name); @.Cannot open output file@> if (show_progress) { printf("\n(%s)",output_file_name); update_terminal; } cur_line=1; stack_ptr=stack+1; - cur_name=(*an_output_file); - cur_repl=(text_pointer)cur_name->equiv; + cur_name= (*an_output_file); + cur_repl= (text_pointer)cur_name->equiv; cur_byte=cur_repl->tok_start; cur_end=(cur_repl+1)->tok_start; while (stack_ptr > stack) get_output(); @@ -588,17 +586,14 @@ static boolean output_defs_seen=false; static void output_defs(void);@/ static void out_char(eight_bits); -@ @d C_printf(c,a) fprintf(C_file,c,a) -@d C_putc(c) putc(c,C_file) /* isn't \CEE/ wonderfully consistent? */ - -@c +@ @c static void output_defs(void) { sixteen_bits a; push_level(NULL); for (cur_text=text_info+1; cur_text<text_ptr; cur_text++) - if (cur_text->text_link==macro) { /* |cur_text| is the text for a |macro| */ + if (cur_text->text_link==0) { /* |cur_text| is the text for a macro */ cur_byte=cur_text->tok_start; cur_end=(cur_text+1)->tok_start; C_printf("%s","#define "); @@ -616,7 +611,7 @@ output_defs(void) if (a<024000) { /* |024000==(0250-0200)*0400| */ cur_val=a; out_char(identifier); } - else if (a<050000) confusion("macro defs have strange char"); + else if (a<050000) { confusion("macro defs have strange char");} else { cur_val=a-050000; cur_section=cur_val; out_char(section_number); } @@ -648,7 +643,7 @@ restart: @/@t\4@>@<Case of an identifier@>@; @/@t\4@>@<Case of a section number@>@; @/@t\4@>@<Cases like \.{!=}@>@; - case '=': case '>': C_putc(cur_char);@+C_putc(' '); + case '=': case '>': C_putc(cur_char); C_putc(' '); out_state=normal; break; case join: out_state=unbreakable; break; case constant: if (out_state==verbatim) { @@ -664,7 +659,7 @@ restart: } } -@ @<Cases like \.{!=}@>=@t\1\quad@> +@ @<Cases like \.{!=}@>= case plus_plus: C_putc('+');@+C_putc('+'); out_state=normal; break; case minus_minus: C_putc('-');@+C_putc('-'); out_state=normal; break; case minus_gt: C_putc('-');@+C_putc('>'); out_state=normal; break; @@ -702,7 +697,7 @@ static char translit[128][translit_length]; for (i=0;i<128;i++) sprintf(translit[i],"X%02X",(unsigned int)(128+i)); } -@ @<Case of an identifier@>=@t\1\quad@> +@ @<Case of an identifier@>= case identifier: if (out_state==num_or_id) C_putc(' '); j=(cur_val+name_dir)->byte_start; @@ -715,7 +710,7 @@ case identifier: } out_state=num_or_id; break; -@ @<Case of a sec...@>=@t\1\quad@> +@ @<Case of a sec...@>= case section_number: if (cur_val>0) C_printf("/*%d:*/",cur_val); else if(cur_val<0) C_printf("/*:%d*/",-cur_val); @@ -736,7 +731,7 @@ case section_number: if (*j=='\\' || *j=='"') C_putc('\\'); C_putc(*j); } - C_putc('"');@+C_putc('\n'); + C_printf("%s","\"\n"); } break; @@ -761,7 +756,7 @@ of these internal code numbers has been chosen to simplify the program logic; larger numbers are given to the control codes that denote more significant milestones. -@d ignore 00 /* control code of no interest to \.{CTANGLE} */ +@d ignore 0 /* control code of no interest to \.{CTANGLE} */ @d ord 0302 /* control code for `\.{@@'}' */ @d control_text 0303 /* control code for `\.{@@t}', `\.{@@\^}', etc. */ @d translit_code 0304 /* control code for `\.{@@l}' */ @@ -822,7 +817,7 @@ to the output. If the comment is introduced by \.{/*}, |skip_comment| proceeds until finding the end-comment token \.{*/} or a newline; in the latter case |skip_comment| will be called again by |get_next|, since the comment is not finished. This is done so that each newline in the -\CEE/ part of a section is copied to the output; otherwise the \#\&{line} +\CEE/ part of a section is copied to the output; otherwise the \&{\#line} commands inserted into the \CEE/ file by the output routines become useless. On the other hand, if the comment is introduced by \.{//} (i.e., if it is a \CPLUSPLUS/ ``short comment''), it always is simply delimited by the next @@ -836,15 +831,15 @@ No comment, long or short, is allowed to contain `\.{@@\ }' or `\.{@@*}'. static boolean comment_continues=false; /* are we scanning a comment? */ @ @c -static boolean skip_comment( /* skips over comments */ -boolean is_long_comment) +static boolean skip_comment(@t\1\1@> /* skips over comments */ +boolean is_long_comment@t\2\2@>) { char c; /* current character */ while (true) { if (loc>limit) { if (is_long_comment) { - if (get_line()) return comment_continues=true; - else { + if(get_line()) return comment_continues=true; + else{ err_print("! Input ended in mid-comment"); @.Input ended in mid-comment@> return comment_continues=false; @@ -869,6 +864,8 @@ boolean is_long_comment) @* Inputting the next token. +@d constant 03 + @<Private...@>= static name_pointer cur_section_name; /* name of section just scanned */ static boolean no_where; /* suppress |print_where|? */ @@ -876,15 +873,20 @@ static boolean no_where; /* suppress |print_where|? */ @ As one might expect, |get_next| consists mostly of a big switch that branches to the various special cases that can arise. +@d isxalpha(c) ((c)=='_' || (c)=='$') + /* non-alpha characters allowed in identifier */ +@d ishigh(c) ((eight_bits)(c)>0177) +@^high-bit character handling@> + @c static eight_bits get_next(void) /* produces the next input token */ { - static boolean preprocessing=false; + static int preprocessing=0; eight_bits c; /* the current character */ while (true) { if (loc>limit) { - if (preprocessing && *(limit-1)!='\\') preprocessing=false; + if (preprocessing && *(limit-1)!='\\') preprocessing=0; if (get_line()==false) return new_section; else if (print_where && !no_where) { print_where=false; @@ -911,9 +913,9 @@ get_next(void) /* produces the next input token */ else if (xisspace(c)) { if (!preprocessing || loc>limit) continue; /* we don't want a blank after a final backslash */ - else return ' '; /* ignore spaces and tabs, unless |preprocessing| */ + else return ' '; /* ignore spaces and tabs, unless preprocessing */ } - else if (c=='#' && loc==buffer+1) preprocessing=true; + else if (c=='#' && loc==buffer+1) preprocessing=1; mistake: @<Compress two-symbol operator@>@; return c; } @@ -928,23 +930,24 @@ combinations \.{...}, \.{::}, \.{.*} and \.{->*}. The compound assignment operators (e.g., \.{+=}) are treated as separate tokens. +@d compress(c) if (loc++<=limit) return c + @<Compress tw...@>= switch(c) { case '+': if (*loc=='+') compress(plus_plus); break; - case '-': if (*loc=='-') {@+compress(minus_minus);@+} - else if (*loc=='>') { - if (*(loc+1)=='*') {loc++;@+compress(minus_gt_ast);} - else compress(minus_gt); - } break; - case '.': if (*loc=='*') {@+compress(period_ast);@+} + case '-': if (*loc=='-') {compress(minus_minus);} + else { if (*loc=='>') { if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);} + else compress(minus_gt); } } break; + case '.': if (*loc=='*') {compress(period_ast);} else if (*loc=='.' && *(loc+1)=='.') { - loc++;@+compress(dot_dot_dot); - } break; + loc++; compress(dot_dot_dot); + } + break; case ':': if (*loc==':') compress(colon_colon); break; case '=': if (*loc=='=') compress(eq_eq); break; - case '>': if (*loc=='=') {@+compress(gt_eq);@+} + case '>': if (*loc=='=') {compress(gt_eq);} else if (*loc=='>') compress(gt_gt); break; - case '<': if (*loc=='=') {@+compress(lt_eq);@+} + case '<': if (*loc=='=') {compress(lt_eq);} else if (*loc=='<') compress(lt_lt); break; case '&': if (*loc=='&') compress(and_and); break; case '|': if (*loc=='|') compress(or_or); break; @@ -953,41 +956,30 @@ switch(c) { @ @<Get an identifier@>= { id_first=--loc; - do { - ++loc; - } while (isalpha((eight_bits)*loc) || isdigit((eight_bits)*loc) @| + while (isalpha((eight_bits)*++loc) || isdigit((eight_bits)*loc) @| || isxalpha((eight_bits)*loc) || ishigh((eight_bits)*loc)); id_loc=loc; return identifier; } @ @<Get a constant@>= { - boolean hex_flag = false; /* are we reading a hexadecimal literal? */ id_first=loc-1; if (*id_first=='.' && !xisdigit(*loc)) goto mistake; /* not a constant */ if (*id_first=='0') { if (*loc=='x' || *loc=='X') { /* hex constant */ - hex_flag = true; - loc++; while (xisxdigit(*loc) || *loc=='\'') loc++; - } - else if (*loc=='b' || *loc=='B') { /* binary constant */ - loc++; while (*loc=='0' || *loc=='1' || *loc=='\'') loc++; goto found; + loc++; while (xisxdigit(*loc)) loc++; goto found; } } - while (xisdigit(*loc) || *loc=='\'') loc++; + while (xisdigit(*loc)) loc++; if (*loc=='.') { - loc++; - while ((hex_flag && xisxdigit(*loc)) || xisdigit(*loc) || *loc=='\'') loc++; + loc++; + while (xisdigit(*loc)) loc++; } if (*loc=='e' || *loc=='E') { /* float constant */ if (*++loc=='+' || *loc=='-') loc++; - while (xisdigit(*loc) || *loc=='\'') loc++; - } - else if (hex_flag && (*loc=='p' || *loc=='P')) { /* hex float constant */ - if (*++loc=='+' || *loc=='-') loc++; - while (xisxdigit(*loc) || *loc=='\'') loc++; + while (xisdigit(*loc)) loc++; } -found: while (*loc=='u' || *loc=='U' || *loc=='l' || *loc=='L' - || *loc=='f' || *loc=='F') loc++; + found: while (*loc=='u' || *loc=='U' || *loc=='l' || *loc=='L' + || *loc=='f' || *loc=='F') loc++; id_loc=loc; return constant; } @@ -1002,7 +994,7 @@ convention, but do not allow the string to be longer than |longest_name|. id_first = section_text+1; id_loc = section_text; *++id_loc=delim; if (delim=='L' || delim=='u' || delim=='U') { /* wide character constant */ - if (delim=='u' && *loc=='8') *++id_loc=*loc++; + if (delim=='u' && *loc=='8') { *++id_loc=*loc++; } delim=*loc++; *++id_loc=delim; } while (true) { @@ -1043,7 +1035,8 @@ convention, but do not allow the string to be longer than |longest_name|. whether there is more work to do. @<Get control code and possible section name@>= { - switch(c=ccode[(eight_bits)*loc++]) { + c=ccode[(eight_bits)*loc++]; + switch(c) { case ignore: continue; case translit_code: err_print("! Use @@l in limbo only"); continue; @.Use @@l in limbo...@> @@ -1070,8 +1063,9 @@ thus, \.{@@'\\nopq'} gives the same result as \.{@@'\\n'}. @<Scan an ASCII constant@>= id_first=loc; - if (*loc=='\\') + if (*loc=='\\') { if (*++loc=='\'') loc++; + } while (*loc!='\'') { if (*loc=='@@') { if (*(loc+1)!='@@') @@ -1092,10 +1086,8 @@ thus, \.{@@'\\nopq'} gives the same result as \.{@@'\\n'}. char *k; /* pointer into |section_text| */ @<Put section name into |section_text|@>@; if (k-section_text>3 && strncmp(k-2,"...",3)==0) - cur_section_name=section_lookup(section_text+1,k-3,true); - /* |true| means it's a prefix */ - else cur_section_name=section_lookup(section_text+1,k,false); - /* |false| means it's not */ + cur_section_name=section_lookup(section_text+1,k-3,1); /* 1 means is a prefix */ + else cur_section_name=section_lookup(section_text+1,k,0); if (cur_section_name_char=='(') @<If it's not there, add |cur_section_name| to the output file stack, or complain we're out of room@>@; @@ -1184,6 +1176,7 @@ ANSI \CEE/ preprocessor sometimes requires it. acted, |cur_text| will point to the replacement text just generated, and |next_control| will contain the control code that terminated the activity. +@d macro 0 @d app_repl(c) {if (tok_ptr==tok_mem_end) overflow("token"); *tok_ptr++=c;} @<Private...@>= @@ -1192,11 +1185,11 @@ static eight_bits next_control; @ @c static void -scan_repl( /* creates a replacement text */ -eight_bits t) +scan_repl(@t\1\1@> /* creates a replacement text */ +eight_bits t@t\2\2@>) { sixteen_bits a; /* the current token */ - if (t==section_name) @<Insert the line number into |tok_mem|@>@; + if (t==section_name) {@<Insert the line number into |tok_mem|@>@;} while (true) switch (a=get_next()) { @<In cases that |a| is a non-|char| token (|identifier|, |section_name|, etc.), either process it and change |a| to a byte @@ -1219,21 +1212,19 @@ to |0150000|; then the numeric line number; then a pointer to the file name. @<Insert the line...@>= -{ - store_two_bytes(0150000); - if (changing && include_depth==change_depth) { /* correction made Feb 2017 */ - id_first=change_file_name; - store_two_bytes((sixteen_bits)change_line); - }@+else { - id_first=cur_file_name; - store_two_bytes((sixteen_bits)cur_line); - } - id_loc=id_first+strlen(id_first); - {int a_l=id_lookup(id_first,id_loc,0)-name_dir; app_repl((a_l / 0400)+0200); - app_repl(a_l % 0400);} +store_two_bytes(0150000); +if (changing && include_depth==change_depth) { /* correction made Feb 2017 */ + id_first=change_file_name; + store_two_bytes((sixteen_bits)change_line); +}@+else { + id_first=cur_file_name; + store_two_bytes((sixteen_bits)cur_line); } +id_loc=id_first+strlen(id_first); +{int a_l=id_lookup(id_first,id_loc,0)-name_dir; app_repl((a_l / 0400)+0200); + app_repl(a_l % 0400);} -@ @<In cases that |a| is...@>=@t\1\quad@> +@ @<In cases that |a| is...@>= case identifier: a=id_lookup(id_first,id_loc,0)-name_dir; app_repl((a / 0400)+0200); app_repl(a % 0400); break; @@ -1277,13 +1268,7 @@ case new_section: goto done; as explained in the manual */ } -@ By default, \.{CTANGLE} purges single-quote characters from \CPLUSPLUS/-style -literals, e.g., \.{1'000'000}, so that you can use this notation also in \CEE/ -code. The \.{+k} switch will `keep' the single quotes in the output. - -@d keep_digit_separators flags['k'] - -@<Copy a string...@>= +@ @<Copy a string...@>= app_repl(a); /* |string| or |constant| */ while (id_first < id_loc) { /* simplify \.{@@@@} pairs */ if (*id_first=='@@') { @@ -1291,8 +1276,6 @@ code. The \.{+k} switch will `keep' the single quotes in the output. else err_print("! Double @@ should be used in string"); @.Double @@ should be used...@> } - else if (a==constant && *id_first=='\'' && !keep_digit_separators) - id_first++; app_repl(*id_first++); } app_repl(a); break; @@ -1371,7 +1354,7 @@ scan_section(void) if (*(loc-1)=='*' && show_progress) { /* starred section */ printf("*%d",section_count); update_terminal; } - next_control=ignore; + next_control=0; while (true) { @<Skip ahead until |next_control| corresponds to \.{@@d}, \.{@@<}, \.{@@\ } or the like@>@; @@ -1448,7 +1431,7 @@ store_two_bytes((sixteen_bits)(0150000+section_count)); /* |0150000==0320*0400| */ @ @<Update the data...@>= -if (p==name_dir||p==NULL) { /* unnamed section, or bad section name */ +if (p==name_dir||p==0) { /* unnamed section, or bad section name */ (last_unnamed)->text_link=cur_text-text_info; last_unnamed=cur_text; } else if (p->equiv==(void *)text_info) p->equiv=(void *)cur_text; diff --git a/Build/source/texk/web2c/cwebdir/ctproofmac.tex b/Build/source/texk/web2c/cwebdir/ctproofmac.tex index ccfd36b83b2..29533b84b4d 100644 --- a/Build/source/texk/web2c/cwebdir/ctproofmac.tex +++ b/Build/source/texk/web2c/cwebdir/ctproofmac.tex @@ -1,8 +1,8 @@ % standard macros for CWEB listings (in addition to plain.tex) -% Version 4.3 --- April 2021 +% Version 3.6 --- May 2000 % Modified for proofs in CTWILL \ifx\documentstyle\undefined\else\endinput\fi % LaTeX will use other macros -\xdef\fmtversion{\fmtversion+CWEB4.3+PROOFS} +\xdef\fmtversion{\fmtversion+CWEB3.6+PROOFS} \let\:=\. % preserve a way to get the dot accent % (all other accents will still work as usual) @@ -107,7 +107,6 @@ \newskip\intersecskip \intersecskip=12pt minus 3pt % space between sections \let\yskip=\smallskip \def\?{\mathrel?} -\def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} \def\note#1#2.{\Y\noindent{\hangindent2em\baselineskip10pt\eightrm#1~#2.\par}} \def\lapstar{\rlap{*}} \def\stsec{\rightskip=0pt % get out of C mode (cf. \B) @@ -163,8 +162,7 @@ \hbox{$\def\?{\kern.2em}% \def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick) - \def\%{\cdot 16^{\aftergroup}}% power of sixteen (via dirty trick) - \let\~=\oct \let\^=\hex \let\\=\bin{#1}$}}%$% + \let\~=\oct \let\^=\hex {#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 @@ -178,12 +176,8 @@ %\def\oct{\hbox{\rm\char'23\kern-.2em\it\aftergroup\?\aftergroup}} % WEB style %\def\hex{\hbox{\rm\char"7D\tt\aftergroup}} % WEB style -\def\oct{\hbox{$^\circ$\kern-.1em}\Od}% CWEB style -\def\hex{\hbox{$^{\scriptscriptstyle\#}$}\Hd} % CWEB style -\def\bin{\hbox{$^{\scriptscriptstyle b}$}\Bd} -\def\Od#1/{{\it#1}} % octal digit -\def\Hd#1/{{\tt#1}} % hexadecimal digit -\def\Bd#1/{{\tt#1}} % binary digit +\def\oct{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}}% CWEB style +\def\hex{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}} % CWEB style \def\vb#1{\leavevmode\hbox{\kern2pt\vrule\vtop{\vbox{\hrule \hbox{\strut\kern2pt\.{#1}\kern2pt}} \hrule}\vrule\kern2pt}} % verbatim string @@ -345,6 +339,9 @@ \def\printtwodigits{\advance\twodigits100 \expandafter\gobbleone\number\twodigits \advance\twodigits-100 } +\def\TeX{{\ifmmode\it\fi + \leavevmode\hbox{T\kern-.1667em\lower.424ex\hbox{E}\hskip-.125em X}}} +\def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} \def\datethis{\def\startsection{\leftline{\sc\today\ at \hours}\bigskip \let\startsection=\stsec\stsec}} % say `\datethis' in limbo, to get your listing timestamped before section 1 diff --git a/Build/source/texk/web2c/cwebdir/cttwinxmac.tex b/Build/source/texk/web2c/cwebdir/cttwinxmac.tex index 89e3b6873e4..99ae6047ab4 100644 --- a/Build/source/texk/web2c/cwebdir/cttwinxmac.tex +++ b/Build/source/texk/web2c/cwebdir/cttwinxmac.tex @@ -2,6 +2,8 @@ \let\:=\. % preserve a way to get the dot accent % (all other accents will still work as usual) +\def\TeX{{\ifmmode\it\fi + \hbox{T\kern-.1667em\lower.424ex\hbox{E}\hskip-.125em X}}} \def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} \let\mc=\ninerm % medium caps \def\CEE/{{\mc C\spacefactor1000}} diff --git a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch index 1310d0bc042..a3569f3442d 100644 --- a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch +++ b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch @@ -14,7 +14,7 @@ Section 1. @z @x -@d banner "This is CTWILL, Version 4.3" +@d banner "This is CTWILL, Version 4.2" @y \bigskip {\font\itt=cmitt10 \font\bit=cmbxti10 @@ -35,7 +35,7 @@ be even more ``off'' from {\itt cweave.w}. Care has been taken to give a faithful overall rendering of {\itt CTWILL}'s code, though. \hfill ---Enjoy!\bigskip} -@d banner "This is CTWILL, Version 4.3" +@d banner "This is CTWILL, Version 4.2" @z Section 2. @@ -43,7 +43,7 @@ Section 2. @x @ Here is a sort of user manual for \.{CTWILL}---which is exactly like @y -@* {\tentex CTWILL} user manual. +@* \.{CTWILL} user manual. Here is a sort of user manual for \.{CTWILL}---which is exactly like @z @@ -93,29 +93,14 @@ Section 7. @x internationalization. - -@d _(S) gettext(S) - -@<Include files@>= -#ifndef HAVE_GETTEXT -#define HAVE_GETTEXT 0 -#endif -@# @y internationalization. - -@d _(S) gettext(S) -@-S@> - -@r @ @<Include files@>= @-A@> @-HAVE_GETTEXT@> -#ifndef HAVE_GETTEXT -#define HAVE_GETTEXT 0 -#endif +@-S@> @z -Section 10. +Section 9. @x @ Code related to input routines: @@ -124,7 +109,7 @@ Section 10. @-c@> @z -Section 14. +Section 13. @x @ Code related to identifier and section name storage: @@ -133,7 +118,7 @@ Section 14. @-c@> @z -Section 16. +Section 15. @x @ Code related to error handling: @@ -142,7 +127,7 @@ Section 16. @-s@> @z -Section 18. +Section 17. @x extern const char *use_language; /* prefix to \.{cwebmac.tex} in \TEX/ output */ @@ -150,7 +135,7 @@ extern const char *use_language; /* prefix to \.{cwebmac.tex} in \TEX/ output */ extern const char *use_language; /* prefix to \.{ctwimac.tex} in \TEX/ output */ @z -Section 19. +Section 18. @x @ Code related to output: @@ -161,7 +146,7 @@ Section 19. @-c@> @z -Section 24. +Section 23. @x @* Data structures exclusive to {\tt CWEAVE}. @@ -173,22 +158,30 @@ Section 24. Section 25. @x -@ We keep track of the current section number in |section_count|, which +@ The other large memory area in \.{CWEAVE} keeps the cross-reference data. @y -@r @ We keep track of the current section number in |section_count|, which +@ The other large memory area in \.{CWEAVE} keeps the cross-reference data. +@-p@> +@-x@> @z -Section 26. +Section 27. @x -@ The other large memory area in \.{CWEAVE} keeps the cross-reference data. +@ \.{CTWILL} also has special data structures to keep track of current @y -@ The other large memory area in \.{CWEAVE} keeps the cross-reference data. -@-p@> -@-x@> +@r @ \.{CTWILL} also has special data structures to keep track of current @z -Section 36. +Section 32. + +@x +@ The |new_meaning| routine changes the current ``permanent meaning'' +@y +@r @ The |new_meaning| routine changes the current ``permanent meaning'' +@z + +Section 35. @x @ A new cross-reference for an identifier is formed by calling |new_xref|, @@ -198,6 +191,23 @@ Section 36. @-c@> @z +Section 44. + +@x +@ We have to get \CEE/'s +@y +@r @ We have to get \CEE/'s +@z + +Section 45. + +@x +id_lookup("goto",NULL,case_like); +@y +@ @<Store all...@>= +id_lookup("goto",NULL,case_like); +@z + Section 49. @x @@ -249,133 +259,42 @@ Section 63. @-c@> @z -@x - if (*(loc+1)=='*') {loc++;@+compress(minus_gt_ast);} -@y - if (*(loc+1)=='*') {@+loc++;@+compress(minus_gt_ast);@+} -@z - -@x - else if (*loc=='.' && *(loc+1)=='.') { - loc++;@+compress(dot_dot_dot); - } break; -@y - else if (*loc=='.' && *(loc+1)=='.') {@+ - loc++;@+compress(dot_dot_dot);@+ - } break; -@z - -Section 64. +Section 66. @x - id_first=--loc; - do { - ++loc; - } while (isalpha((eight_bits)*loc) || isdigit((eight_bits)*loc) @| - || isxalpha((eight_bits)*loc) || ishigh((eight_bits)*loc)); - id_loc=loc; return identifier; -} -@y - id_first=--loc;@/ - do { - ++loc; - } while (isalpha((eight_bits)*loc) || isdigit((eight_bits)*loc) @| - || isxalpha((eight_bits)*loc) || ishigh((eight_bits)*loc));@/ - id_loc=loc;@/ - return identifier; -} -@z - -Section 67. - -@x -@ @<Get a bin...@>={ +@<Get a string@>= { @y -@r @ @<Get a bin...@>={ +@<Get a string@>= {@+ @z Section 70. @x -@ @<Get a wide...@>={ -@y -@r @ @<Get a wide...@>={ -@z - -Section 74. - -@x @ @<Put section name...@>= @y -@ @<Put section name...@>= -@z - -Section 75. - -@x -@ @<If end of name...@>= -@y -@r @ @<If end of name...@>= -@z - -Section 87. - -@x -C_xref( /* makes cross-references for \CEE/ identifiers */ - eight_bits spec_ctrl) -@y -C_xref(eight_bits spec_ctrl) - /* makes cross-references for \CEE/ identifiers */ +@r @ @<Put section name...@>= @z -Section 88--89. +Section 84. @x -@ The |outer_xref| subroutine is like |C_xref| except that it begins with |next_control!='|'| and ends with |next_control>=format_code|. Thus, it -handles \CEE/ text with embedded comments. - -@c -static void -outer_xref(void) /* extension of |C_xref| */ -{ - int bal; /* brace level in comment */ @y -@ The |outer_xref| subroutine is like |C_xref| except that it begins with |next_control| |!='|'| and ends with |next_control>=format_code|. Thus, it -handles \CEE/ text with embedded comments. - -@ @c -static void -outer_xref(void) /* extension of |C_xref| */ -{@+ - int bal; /* brace level in comment */ @z Section 91. @x -@ @<Replace |"@@@@"| by |"@@"| @>= -{ - char *src=id_first,*dst=id_first; -@y -@ @<Replace |"@@@@"| by |"@@"| @>= -{@+ - char *src=id_first,*dst=id_first; -@z - -Section 96. - -@x @ Finally, when the \TEX/ and definition parts have been treated, we have |next_control>=begin_C|. @y -@r @ Finally, when the \TEX/ and definition parts have been treated, we have +@ Finally, when the \TEX/ and definition parts have been treated, we have \hfil\break|next_control>=begin_C|. @z -Section 102. +Section 97. @x @ The |flush_buffer| routine empties the buffer up to a given breakpoint, @@ -384,34 +303,32 @@ Section 102. @-c@> @z -Section 106. +Section 99. @x -@ When we wish to append one character |c| to the output buffer, we write +@ When we are copying \TEX/ source material, we retain line breaks @y -@ When we wish to append one character |c| to the output buffer, we write -@-c@> +@r @ When we are copying \TEX/ source material, we retain line breaks @z -Section 107. +Section 101. @x -out_str( /* output characters from |s| to end of string */ -const char*s) +@ When we wish to append one character |c| to the output buffer, we write @y -out_str(const char*s) - /* output characters from |s| to end of string */ +@ When we wish to append one character |c| to the output buffer, we write +@-c@> @z -Section 113. +Section 105. @x -@ The |out_name| procedure is used to output an identifier or index +@ We get to this section only in the unusual case that the entire output line @y -@r @ The |out_name| procedure is used to output an identifier or index +@r @ We get to this section only in the unusual case that the entire output line @z -Section 116. +Section 111. @x @ The |copy_TeX| routine processes the \TEX/ code at the beginning of a @@ -419,32 +336,36 @@ Section 116. @r @ The |copy_TeX| routine processes the \TEX/ code at the beginning of a @z -Section 117. - @x -@ The |copy_comment| function issues a warning if more braces are opened than +static eight_bits +copy_TeX(void) +{ @y -@ The |copy_comment| function issues a warning if more braces are opened than -@-t@> +static eight_bits +copy_TeX(void) +{@+ @z +Section 112. + @x -static int copy_comment( /* copies \TeX\ code in comments */ -boolean is_long_comment, /* is this a traditional \CEE/ comment? */ -int bal) /* brace balance */ +@ The |copy_comment| function issues a warning if more braces are opened than @y -static int copy_comment( -boolean is_long_comment, /* is this a traditional \CEE/ comment? */ -int bal) /* brace balance */ +@ The |copy_comment| function issues a warning if more braces are opened than +@-t@> @z @x - } else { +int bal@t\2\2@>) /* brace balance */ +{ + char c; /* current character being copied */ @y - } @+ else { +int bal@t\2\2@>) /* brace balance */ +{@+ + char c; /* current character being copied */ @z -Section 122. +Section 117. @x @ Here is a list of the category codes that scraps can have. @@ -452,7 +373,7 @@ Section 122. @r @ Here is a list of the category codes that scraps can have. @z -Section 126. +Section 121. @x @ The token lists for translated \TEX/ output contain some special control @@ -461,7 +382,7 @@ Section 126. @-n@> @z -Section 127. +Section 122. @x \yskip\noindent All of these tokens are removed from the \TEX/ output that @@ -470,7 +391,7 @@ Section 127. @-n@> @z -Section 128. +Section 123. @x @ The raw input is converted into scraps according to the following table, @@ -488,67 +409,55 @@ The raw input is converted into scraps according to the following table, \yskip\halign{\quad#\hfil&\quad\hbox to11cm{#\hfil}&\quad\hfil#\hfil\cr @z -Section 129. +Section 124. @x -\./&|binop|: \./&yes\cr +\.>&|prerangle|: \.{\\rangle}&yes\cr @y -\./&|binop|: \./&yes\cr} +\.>&|prerangle|: \.{\\rangle}&yes\cr} @ Cont. \yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr @z -Section 130. +Section 125. @x -\.{complex}&|int_like|: \stars&yes\cr +\.{continue}&|case_like|: \stars&maybe\cr @y -\.{complex}&|int_like|: \stars&yes\cr} - -@ Cont. +\.{continue}&|case_like|: \stars&maybe\cr} -\yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr -@z - -Section 131. - -@x -\.{friend}&|int_like|: \stars&maybe\cr -@y -\.{friend}&|int_like|: \stars&maybe\cr} - -@ Cont. +@r @ Cont. \yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr @z -Section 132. +Section 126. @x -\.{static\_cast}&|raw_int|: \stars&maybe\cr +\.{long}&|raw_int|: \stars&maybe\cr @y -\.{static\_cast}&|raw_int|: \stars&maybe\cr} +\.{long}&|raw_int|: \stars&maybe\cr} @ Cont. \yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr @z -Section 133. +Section 127. @x -\.{xor\_eq}&|alfop|: \stars&yes\cr +\.{try}&|else_like|: \stars&maybe\cr @y -\.{xor\_eq}&|alfop|: \stars&yes\cr} +\.{try}&|else_like|: \stars&maybe\cr} -@ Cont. +@r @ Cont. \yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr @z -Sections 134--142. +Sections 128--135. @x l.7 line numbers refer to 'prod.w' @ Here is a table of all the productions. Each production that @@ -580,9 +489,9 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. {$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr \strut\hbox{#3}\cr}\!\Biggr\}$ } \def\malt #1 #2 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} \def\maltt #1 #2 #3 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr \strut\hbox{#3}\hfill\cr}$} \yskip@-in@>@-x@>@-y@> \prodno=13 \midcol=2.5in @@ -610,9 +519,9 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. {$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr \strut\hbox{#3}\cr}\!\Biggr\}$ } \def\malt #1 #2 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} \def\maltt #1 #2 #3 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr \strut\hbox{#3}\hfill\cr}$} \yskip@-in@> \prodno=27 \midcol=2.5in @@ -640,9 +549,9 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. {$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr \strut\hbox{#3}\cr}\!\Biggr\}$ } \def\malt #1 #2 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} \def\maltt #1 #2 #3 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr \strut\hbox{#3}\hfill\cr}$} \yskip@-in@> \prodno=47 \midcol=2.5in @@ -656,9 +565,9 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. @z @x l.164 - $|force|\,E\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|$ & $\!\!$|else x=0;|\cr + $|force|\,E\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|$ & |else x=0;|\cr @y - $|force|\,E\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|$ & $\!\!$|else x=0;|\cr + $|force|\,E\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|$ & |else x=0;|\cr \endgroup @ Cont. @@ -670,9 +579,9 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. {$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr \strut\hbox{#3}\cr}\!\Biggr\}$ } \def\malt #1 #2 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} \def\maltt #1 #2 #3 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr \strut\hbox{#3}\hfill\cr}$} \yskip@-any@>@-z@>@-g@>@-a@>@-x@>@-y@>@-f@> \prodno=61 \midcol=2.5in @@ -701,9 +610,9 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. {$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr \strut\hbox{#3}\cr}\!\Biggr\}$ } \def\malt #1 #2 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} \def\maltt #1 #2 #3 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr \strut\hbox{#3}\hfill\cr}$} \yskip@-any@>@-z@>@-g@>@-a@> \prodno=86 \midcol=2.5in @@ -723,11 +632,6 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. \endgroup @ Cont. -@-deprecated@> -@-fallthrough@> -@-likely@> -@-nodiscard@> -@-unlikely@> \begingroup \lineskip=4pt \def\alt #1 #2 {$\displaystyle\Bigl\{\!\matrix{\strut\hbox{#1}\cr @@ -736,9 +640,9 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. {$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr \strut\hbox{#3}\cr}\!\Biggr\}$ } \def\malt #1 #2 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} \def\maltt #1 #2 #3 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr \strut\hbox{#3}\hfill\cr}$} \yskip@-any_other@>@-z@>@-f@>@-x@>@-p@> \prodno=100 \midcol=2.5in @@ -765,56 +669,15 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. @y @z -@x l.291 -\+& |exp| |attr| & |attr| \hfill $E\.\ A$ & \&{enum} $\{x\ [[\ldots]]\}$ \cr -@y -\+& |exp| |attr| & |attr| \hfill $E\.\ A$ & \&{enum} $\{x\ [[\ldots]]\}$ \cr -\endgroup - -@ Cont. -@-deprecated@> -@-fallthrough@> -@-likely@> -@-nodiscard@> -@-unlikely@> -\begingroup \lineskip=4pt -\def\alt #1 #2 -{$\displaystyle\Bigl\{\!\matrix{\strut\hbox{#1}\cr - \strut\hbox{#2}\cr}\!\Bigr\}$ } -\def\altt #1 #2 #3 -{$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr - \strut\hbox{#3}\cr}\!\Biggr\}$ } -\def\malt #1 #2 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} -\def\maltt #1 #2 #3 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr - \strut\hbox{#3}\hfill\cr}$} -\yskip@-any_other@>@-z@>@-f@>@-x@>@-p@> -\prodno=143 \midcol=2.5in -\def\theprodno{\number\prodno \global\advance\prodno by1\enspace} -\def\dagit{\dag\theprodno} -\def\+#1\cr{\def\next{#1}% - \line{\hbox to 2em{\hss - \ifx\next\empty\theprodno\else\next\fi}\strut - \ignorespaces#2\hfil\hbox to\midcol{$\RA$ - \ignorespaces#3\hfil}\quad \hbox to1.45in{\ignorespaces#4\hfil}}} -\advance\midcol20pt -@z - -@x l.326 -\+& |alignas_like| |cast| & |attr| & |alignas(int)| \cr -\yskip -\yskip -\yskip -\yskip -\yskip +@x l.272 +\+& |any_other| |end_arg| & |end_arg| & \&{char}$*$\.{@@]}\cr \yskip \yskip \yskip \parindent=0pt \dag{\bf Notes} @y -\+& |alignas_like| |cast| & |attr| & |alignas(int)| \cr +\+& |any_other| |end_arg| & |end_arg| & \&{char}$*$\.{@@]}\cr \advance\midcol-3pt \+\dag200\enspace& |typedef_like| |decl_head| \alt|exp| |int_like| & |typedef_like| |decl_head| \hfill $D=D$\alt $E^{**}$ $I^{**}$ \unskip & @@ -826,18 +689,15 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. \&{typedef} \&{int} \&{foo}\cr \endgroup -@-any_other@>@-z@>@ \begingroup\dag{\bf Notes} -\advance \hsize by -4cm -\parindent=0pt -\everypar={\hangindent=2em} +@r @-any_other@>@-z@>@ \begingroup\dag{\bf Notes} @z -Section 143. +Section 136. @x @* Implementing the productions. @y -@* Implementing the productions.\advance \hsize by -4cm +@* Implementing the productions. \advance \hsize by -4cm \ifx\undefined\pdfpagewidth \else \advance \pdfpagewidth by -4cm \fi @z @@ -847,7 +707,7 @@ the category codes |pp->cat,@,@,(pp+1)->cat|$,\,\,\ldots\,$ the category codes |pp->cat|, |(pp+1)->cat|, $\,\ldots\,$ @z -Section 146. +Section 139. @x @ Token lists in |@!tok_mem| are composed of the following kinds of @@ -856,7 +716,15 @@ Section 146. @-p@> @z -Section 149. +Section 141. + +@x +@ @<Print token |r|...@>= +@y +@r @ @<Print token |r|...@>= +@z + +Section 142. @x @ The production rules listed above are embedded directly into \.{CWEAVE}, @@ -871,7 +739,7 @@ Section 149. @-pp@> @z -Section 150. +Section 143. @x The code below is an exact translation of the production rules into @@ -880,7 +748,7 @@ The code below is an exact translation of the production rules into @-a@> @z -Section 153. +Section 146. @x @ Let us consider the big switch for productions now, before looking @@ -888,21 +756,7 @@ Section 153. @r @ Let us consider the big switch for productions now, before looking @z -@x - && pp->cat!=new_exp - && pp->cat!=ftemplate @| -@y - && pp->cat!=new_exp @| - && pp->cat!=ftemplate -@z - -@x - && pp->cat!=const_like -@y - && pp->cat!=const_like @| -@z - -Section 154. +Section 147. @x switch (pp->cat) { @@ -953,11 +807,6 @@ Section 154. case typedef_like: @<Cases for |typedef_like|@>@; @+break; case delete_like: @<Cases for |delete_like|@>@; @+break; case question: @<Cases for |question|@>@; @+break; - case alignas_like: @<Cases for |alignas_like|@>@; @+break; - case lbrack: @<Cases for |lbrack|@>@; @+break; - case attr_head: @<Cases for |attr_head|@>@; @+break; - case attr: @<Cases for |attr|@>@; @+break; - case default_like: @<Cases for |default_like|@>@; @+break; } pp++; /* if no match was found, we move to the right */ } @@ -968,7 +817,7 @@ Section 154. pp++; /* if no match was found, we move to the right */ } -@ @<Cases for |pp->cat|@>=@t\1\5\5@> +@ @<Cases for |pp->cat|@>= case exp: @<Cases for |exp|@>@; @+break; case lpar: @<Cases for |lpar|@>@; @+break; case unop: @<Cases for |unop|@>@; @+break; @@ -1016,14 +865,9 @@ Section 154. case typedef_like: @<Cases for |typedef_like|@>@; @+break; case delete_like: @<Cases for |delete_like|@>@; @+break; case question: @<Cases for |question|@>@; @+break; - case alignas_like: @<Cases for |alignas_like|@>@; @+break; - case lbrack: @<Cases for |lbrack|@>@; @+break; - case attr_head: @<Cases for |attr_head|@>@; @+break; - case attr: @<Cases for |attr|@>@; @+break; - case default_like: @<Cases for |default_like|@>@; @+break; @z -Section 155. +Section 148. @x of identifiers in case labels. @@ -1034,7 +878,7 @@ of identifiers in case labels. If the first identifier is the keyword `\&{operator}', we give up; @z -Section 157. +Section 150. @x @ The scraps currently being parsed must be inspected for any @@ -1048,26 +892,7 @@ Section 157. \hfil\break|make_reserved|, hence |tok_loc| has been set. @z -@x -make_reserved( /* make the first identifier in |p->trans| like |int| */ -scrap_pointer p) -@y -make_reserved(scrap_pointer p) - /* make the first identifier in |p->trans| like |int| */ -@z - -Section 158. - -@x -make_underlined( -/* underline the entry for the first identifier in |p->trans| */ -scrap_pointer p) -@y -make_underlined(scrap_pointer p) - /* underline the entry for the first identifier in |p->trans| */ -@z - -Section 161. +Section 154. @x @ \.{CTWILL} needs the following procedure, which appends tokens of a @@ -1075,7 +900,7 @@ Section 161. @r @ \.{CTWILL} needs the following procedure, which appends tokens of a @z -Section 162. +Section 155. @x @ The trickiest part of \.{CTWILL} is the procedure |make_ministring(l)|, @@ -1092,23 +917,7 @@ Section 162. {@+ @z -Section 163. - -@x -if (l==0) { app(int_loc+res_flag); app(' '); cur_mathness=no_math; } -@y -if (l==0) { app(int_loc+res_flag); app(' '); cur_mathness=no_math; }@+ -@z - -Section 164. - -@x - && *(*r+1)=='{') app(**q); /* |struct_like| identifier */ -@y - @|&& *(*r+1)=='{') app(**q); /* |struct_like| identifier */ -@z - -Section 166. +Section 159. @x @ @<Cases for |lpar|@>= @@ -1116,51 +925,39 @@ Section 166. @r @ @<Cases for |lpar|@>= @z -Section 180. - -@x - if (indent_param_decl) { - app(outdent); app(outdent); - } -@y - if (indent_param_decl) {@+app(outdent); app(outdent);@+} -@z - -Section 189. +Section 168. @x -@ @<Cases for |case_like|@>= +@ @<Cases for |decl_head|@>= @y -@r @ @<Cases for |case_like|@>= +@r @ @<Cases for |decl_head|@>= @z -Section 206. +Section 173. @x -@ @<Cases for |raw_ubin|@>= +@ @<Cases for |fn_decl|@>= @y -@r @ @<Cases for |raw_ubin|@>= +@r @ @<Cases for |fn_decl|@>= @z -Section 221. +Section 208. @x -@ And here now is the code that applies productions as long as possible. +@ Here's the |squash| procedure, which @y -@r @ And here now is the code that applies productions as long as possible. +@r @ Here's the |squash| procedure, which @z -Section 230. +Section 212. @x - if (next_control=='|' || next_control==begin_comment || - next_control==begin_short_comment) return; +@ @<Print a snapsh...@>= @y - if (next_control=='|' || next_control==begin_comment @| || - next_control==begin_short_comment) return; +@r @ @<Print a snapsh...@>= @z -Section 232. +Section 220. @x @ The following macro is used to append a scrap whose tokens have just @@ -1170,280 +967,71 @@ Section 232. @-c@> @z -Section 233. +Section 229. @x -@ @<Append the scr...@>= -@<Make sure that there is room for the new scraps, tokens, and texts@>@; +@ The |outer_parse| routine is to |C_parse| as |outer_xref| @y -@r @ @<Append the scr...@>= -@# -@<Make sure that there is room for the new scraps, tokens, and texts@>@; -@# +@r @ The |outer_parse| routine is to |C_parse| as |outer_xref| @z -@x - case '/': case '.': - app(next_control);@+app_scrap(binop,yes_math);@+break; - case '<': app_str("\\langle");@+app_scrap(prelangle,yes_math);@+break; -@.\\langle@> - case '>': app_str("\\rangle");@+app_scrap(prerangle,yes_math);@+break; -@.\\rangle@> - case '=': app_str("\\K");@+app_scrap(binop,yes_math);@+break; -@.\\K@> - case '|': app_str("\\OR");@+app_scrap(binop,yes_math);@+break; -@.\\OR@> - case '^': app_str("\\XOR");@+app_scrap(binop,yes_math);@+break; -@.\\XOR@> - case '%': app_str("\\MOD");@+app_scrap(binop,yes_math);@+break; -@.\\MOD@> - case '!': app_str("\\R");@+app_scrap(unop,yes_math);@+break; -@.\\R@> - case '~': app_str("\\CM");@+app_scrap(unop,yes_math);@+break; -@.\\CM@> - case '+': case '-': app(next_control);@+app_scrap(ubinop,yes_math);@+break; - case '*': app(next_control);@+app_scrap(raw_ubin,yes_math);@+break; - case '&': app_str("\\AND");@+app_scrap(raw_ubin,yes_math);@+break; -@.\\AND@> - case '?': app_str("\\?");@+app_scrap(question,yes_math);@+break; -@.\\?@> - case '#': app_str("\\#");@+app_scrap(ubinop,yes_math);@+break; -@.\\\#@> -@y -@# - @t\4@> @<Cases for operators@>@; -@# -@z - -@x - case ignore: case xref_roman: case xref_wildcard: - case meaning: case suppress: -@y - case ignore: case xref_roman: case xref_wildcard:@/ - case meaning: case suppress:@/ -@z +Section 235. @x - case '(': app(next_control);@+app_scrap(lpar,maybe_math);@+break; - case ')': app(next_control);@+app_scrap(rpar,maybe_math);@+break; - case '[': app(next_control);@+app_scrap(lbrack,maybe_math);@+break; - case ']': app(next_control);@+app_scrap(rbrack,maybe_math);@+break; - case '{': app_str("\\{"@q}@>);@+app_scrap(lbrace,yes_math);@+break; -@.\\\{@>@q}@> - case '}': app_str(@q{@>"\\}");@+app_scrap(rbrace,yes_math);@+break; -@q{@>@.\\\}@> - case ',': app(',');@+app_scrap(comma,yes_math);@+break; - case ';': app(';');@+app_scrap(semi,maybe_math);@+break; - case ':': app(':');@+app_scrap(colon,no_math);@+break;@/ +@ To insert token-list |p| into the output, the |push_level| subroutine @y -@# - @t\4@> @<Cases for syntax markers@>@; -@z - -@x - @t\4@> @<Cases involving nonstandard characters@>@; -@y - @t\4@> @<Cases involving nonstandard characters@>@; -@# -@z - -@x - overflow(_("scrap/token/text")); -} -@y - overflow(_("scrap/token/text")); -} - -@ @<Cases for operators@>=@t\1\5\5@> - case '/': case '.': - app(next_control);@+app_scrap(binop,yes_math);@+break; - case '<': app_str("\\langle");@+app_scrap(prelangle,yes_math);@+break; -@.\\langle@> - case '>': app_str("\\rangle");@+app_scrap(prerangle,yes_math);@+break; -@.\\rangle@> - case '=': app_str("\\K");@+app_scrap(binop,yes_math);@+break; -@.\\K@> - case '|': app_str("\\OR");@+app_scrap(binop,yes_math);@+break; -@.\\OR@> - case '^': app_str("\\XOR");@+app_scrap(binop,yes_math);@+break; -@.\\XOR@> - case '%': app_str("\\MOD");@+app_scrap(binop,yes_math);@+break; -@.\\MOD@> - case '!': app_str("\\R");@+app_scrap(unop,yes_math);@+break; -@.\\R@> - case '~': app_str("\\CM");@+app_scrap(unop,yes_math);@+break; -@.\\CM@> - case '+': case '-': app(next_control);@+app_scrap(ubinop,yes_math);@+break; - case '*': app(next_control);@+app_scrap(raw_ubin,yes_math);@+break; - case '&': app_str("\\AND");@+app_scrap(raw_ubin,yes_math);@+break; -@.\\AND@> - case '?': app_str("\\?");@+app_scrap(question,yes_math);@+break; -@.\\?@> - case '#': app_str("\\#");@+app_scrap(ubinop,yes_math);@+break; -@.\\\#@> - -@ @<Cases for syntax markers@>=@t\1\5\5@> - case '(': app(next_control);@+app_scrap(lpar,maybe_math);@+break; - case ')': app(next_control);@+app_scrap(rpar,maybe_math);@+break; - case '[': app(next_control);@+app_scrap(lbrack,maybe_math);@+break; - case ']': app(next_control);@+app_scrap(rbrack,maybe_math);@+break; - case '{': app_str("\\{"@q}@>);@+app_scrap(lbrace,yes_math);@+break; -@.\\\{@>@q}@> - case '}': app_str(@q{@>"\\}");@+app_scrap(rbrace,yes_math);@+break; -@q{@>@.\\\}@> - case ',': app(',');@+app_scrap(comma,yes_math);@+break; - case ';': app(';');@+app_scrap(semi,maybe_math);@+break; - case ':': app(':');@+app_scrap(colon,no_math);@+break;@/ +@r @ To insert token-list |p| into the output, the |push_level| subroutine @z Section 237. @x -@ Some nonstandard characters may have entered \.{CWEAVE} by means of +called when |stack_ptr==1|. @y -@r @ Some nonstandard characters may have entered \.{CWEAVE} by means of +called when |stack_ptr| |==1|. @z -Section 239. +Section 241. @x -@<Append a \TEX/ string, without forming a scrap@>= + text_pointer save_text_ptr; + sixteen_bits save_next_control; /* values to be restored */ + text_pointer p; /* translation of the \CEE/ text */ @y -@r @ @<Append a \TEX/ string, without forming a scrap@>= + text_pointer save_text_ptr, p; /* translation of the \CEE/ text */ + sixteen_bits save_next_control; /* values to be restored */ @z -Section 245. +Section 244. @x -make_pb=true; - -@ @c +else @<Look ahead for strongest line break, |goto reswitch|@> @y -make_pb=true; - -@r @ @c +else {@<Look ahead for strongest line break, |goto reswitch|@>} @z -Section 249. +Section 245. @x -@<Private...@>= +@<Look ahead for st...@>= { @y -@r @ @<Private...@>= +@<Look ahead for st...@>= @z -Section 252. - @x -@ @c -static void -push_level( /* suspends the current level */ -text_pointer p) +} @y -@ Suspend the current level. -@c -static void -push_level(text_pointer p)@/ @z -Section 253. +Section 246. @x -called when |stack_ptr==1|. +@ @<Output saved...@>= @y -called when |stack_ptr| |==1|. +@r @ @<Output saved...@>= @z -Section 257. - -@x -@ The real work associated with token output is done by |make_output|. -@y -@r @ The real work associated with token output is done by |make_output|. -@z - -Section 258. - -@x - reswitch: switch(a) { - 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}@>); -@.\\MRL@> - case noop: case inserted: break; - case cancel: case big_cancel: c=0; b=a; - while (true) { - a=get_output(); - if (a==inserted) continue; - if ((a<indent && !(b==big_cancel&&a==' ')) || a>big_force) break; - if (a==indent) c++; - else if (a==outdent) c--; - else if (a==opt) a=get_output(); - } - @<Output saved |indent| or |outdent| tokens@>@; - goto reswitch; - case dindent: a=get_output(); - if (a!=big_force) { - out_str("\\1\\1"); goto reswitch; - } - 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++)); - case qualifier: break; - default: out(a); /* otherwise |a| is an ordinary character */ - } - } -} -@y - reswitch: @/@<The output |switch|@>@; - } -} - -@r @ @<The output |switch|@>= - switch(a) { - 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}@>); -@.\\MRL@> - case noop: case inserted: break; - case cancel: case big_cancel: c=0; b=a; - while (true) { - a=get_output(); - if (a==inserted) continue; - if ((a<indent && !(b==big_cancel&&a==' ')) || a>big_force) break; - if (a==indent) c++; - else if (a==outdent) c--; - else if (a==opt) a=get_output(); - } - @<Output saved |indent| or |outdent| tokens@>@; - goto reswitch; - case dindent: a=get_output(); - if (a!=big_force) { - out_str("\\1\\1"); goto reswitch; - } - 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++)); - case qualifier: break; - default: out(a); /* otherwise |a| is an ordinary character */ - } -@z - -Section 264. - -@x -@ The remaining part of |make_output| is somewhat more complicated. When we -@y -@r @ The remaining part of |make_output| is somewhat more complicated. When we -@z - -Section 267. +Section 250. @x @ The \CEE/ text enclosed in \pb\ should not contain `\.{\v}' characters, @@ -1451,7 +1039,7 @@ Section 267. @r @ The \CEE/ text enclosed in \pb\ should not contain `\.{\v}' characters, @z -Section 273. +Section 256. @x @ The output file will contain the control sequence \.{\\Y} between non-null @@ -1459,7 +1047,7 @@ Section 273. @r @ The output file will contain the control sequence \.{\\Y} between non-null @z -Section 276. +Section 259. @x @<Translate the \T...@>= do { @@ -1467,21 +1055,7 @@ Section 276. @<Translate the \T...@>= do {@+ @z -Section 282. - -@x -@<Start a macro...@>= { -@y -@r @ @<Start a macro...@>= { -@z - -@x - if(!space_checked){emit_space_if_needed;save_position;} -@y - if(!space_checked){@+emit_space_if_needed;save_position;@+} -@z - -Section 285. +Section 267. @x |next_control>=begin_C|. We will make the global variable |this_section| @@ -1489,7 +1063,7 @@ Section 285. \hfil\break|next_control>=begin_C|. We will make the global variable |this_section| @z -Section 286. +Section 268. @x @ @<Translate the \CEE/...@>= @@ -1497,7 +1071,7 @@ Section 286. @r @ @<Translate the \CEE/...@>= @z -Section 290. +Section 272. @x @ The |footnote| procedure gives cross-reference information about @@ -1505,26 +1079,26 @@ Section 290. @r @ The |footnote| procedure gives cross-reference information about @z -Section 302. +Section 284. @x @ A left-to-right radix sorting method is used, since this makes it easy to @y -@r @ A left-to-right radix sorting method is used, since this makes it easy to +@ A left-to-right radix sorting method is used, since this makes it easy to @-c@> @z -Section 304. +Section 286. @x -@<Rest of |trans_plus| union@>= +@ During the sorting phase we shall use the |cat| and |trans| arrays from @y -@ @<Rest of |trans_plus| union@>= +@ During the sorting phase we shall use the |cat| and |trans| arrays from @-j@> @-k@> @z -Section 308. +Section 289. @x $|collate|[0]<|collate|[1]<\cdots<|collate|[100]$. @@ -1532,17 +1106,15 @@ $|collate|[0]<|collate|[1]<\cdots<|collate|[100]$. |collate[0]| $<$|collate[1]|$<\cdots<$|collate[100]|. @z -Section 310. +Section 296. @x -unbucket( /* empties buckets having depth |d| */ -eight_bits d) + else {char *j; @y -unbucket(eight_bits d) - /* empties buckets having depth |d| */ + else {@+char *j; @z -Section 322. +Section 303. @x @ Because on some systems the difference between two pointers is a |ptrdiff_t| @@ -1552,80 +1124,18 @@ rather than an |int|, we use \.{\%ld} to print these quantities. |ptrdiff_t| rather than an |int|, we use \.{\%ld} to print these quantities. @z -@x - puts(_("\nMemory usage statistics:")); -@.Memory usage statistics:@> - printf(_("%ld names (out of %ld)\n"), - (ptrdiff_t)(name_ptr-name_dir),(long)max_names); - printf(_("%ld cross-references (out of %ld)\n"), - (ptrdiff_t)(xref_ptr-xmem),(long)max_refs); - printf(_("%ld bytes (out of %ld)\n"), - (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes); - printf(_("%ld temp meanings (out of %ld)\n"), - (ptrdiff_t)(max_temp_meaning_ptr-temp_meaning_stack), - (long)max_meanings); - printf(_("%ld titles (out of %ld)\n"), - (ptrdiff_t)(title_code_ptr-title_code),(long)max_titles); - puts(_("Parsing:")); - printf(_("%ld scraps (out of %ld)\n"), - (ptrdiff_t)(max_scr_ptr-scrap_info),(long)max_scraps); - printf(_("%ld texts (out of %ld)\n"), - (ptrdiff_t)(max_text_ptr-tok_start),(long)max_texts); - printf(_("%ld tokens (out of %ld)\n"), - (ptrdiff_t)(max_tok_ptr-tok_mem),(long)max_toks); - printf(_("%ld levels (out of %ld)\n"), - (ptrdiff_t)(max_stack_ptr-stack),(long)stack_size); - puts(_("Sorting:")); - printf(_("%ld levels (out of %ld)\n"), - (ptrdiff_t)(max_sort_ptr-scrap_info),(long)max_scraps); -@y - puts(_("\nMemory usage statistics:"));@/ -@.Memory usage statistics:@> - printf(_("%ld names (out of %ld)\n"), - (ptrdiff_t)(name_ptr-name_dir),@/ - @t\5\5\5\5@>(long)max_names);@/ - printf(_("%ld cross-references (out of %ld)\n"), - (ptrdiff_t)(xref_ptr-xmem),(long)max_refs);@/ - printf(_("%ld bytes (out of %ld)\n"), - (ptrdiff_t)(byte_ptr-byte_mem),@/ - @t\5\5\5\5@>(long)max_bytes);@/ - printf(_("%ld temp meanings (out of %ld)\n"), - (ptrdiff_t)(max_temp_meaning_ptr-temp_meaning_stack),@/ - @t\5\5\5\5@>(long)max_meanings);@/ - printf(_("%ld titles (out of %ld)\n"), - (ptrdiff_t)(title_code_ptr-title_code),@/ - @t\5\5\5\5@>(long)max_titles);@/ - puts(_("Parsing:"));@/ - printf(_("%ld scraps (out of %ld)\n"), - (ptrdiff_t)(max_scr_ptr-scrap_info),@/ - @t\5\5\5\5@>(long)max_scraps);@/ - printf(_("%ld texts (out of %ld)\n"), - (ptrdiff_t)(max_text_ptr-tok_start),@/ - @t\5\5\5\5@>(long)max_texts);@/ - printf(_("%ld tokens (out of %ld)\n"), - (ptrdiff_t)(max_tok_ptr-tok_mem),@/ - @t\5\5\5\5@>(long)max_toks);@/ - printf(_("%ld levels (out of %ld)\n"), - (ptrdiff_t)(max_stack_ptr-stack),@/ - @t\5\5\5\5@>(long)stack_size);@/ - puts(_("Sorting:"));@/ - printf(_("%ld levels (out of %ld)\n"), - (ptrdiff_t)(max_sort_ptr-scrap_info),@/ - @t\5\5\5\5@>(long)max_scraps); -@z - -Section 323. +Section 304. @x \bigskip \font\itt=cmitt10 -{\noindent \it Although {\itt CTWILL} is based on {\itt cweave.w}, new and +{\noindent \it Although \.{\itt CTWILL} is based on \.{\itt cweave.w}, new and modified material is incorporated all over the place, without taking special care for keeping the original section numbering intact.} @y @z -Section 331. +Section 312. @x @** Index. diff --git a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch index 509fda144d0..777c3c28484 100644 --- a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch @@ -34,9 +34,9 @@ @z @x -\def\title{CWEAVE (Version 4.3)} +\def\title{CWEAVE (Version 4.2)} @y -\def\title{CTWILL (Version 4.3 [\TeX~Live])} +\def\title{CTWILL (Version 4.2 [\TeX~Live])} @z @x @@ -46,9 +46,9 @@ @z @x - \centerline{(Version 4.3)} + \centerline{(Version 4.2)} @y - \centerline{(Version 4.3 [\TeX~Live])} + \centerline{(Version 4.2 [\TeX~Live])} @z @x @@ -75,7 +75,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.3)" +@d banner "This is CWEAVE (Version 4.2)" @y This is the \.{CTWILL} program by D. E. Knuth, based on \.{CWEAVE} by Silvio Levy and D.~E. Knuth. It is also based on @@ -94,7 +94,7 @@ reprinted in {\sl Digital Typography\/} (1999), 225--245. The ``banner line'' defined here should be changed whenever \.{CTWILL} is modified. The version number parallels the corresponding version of \.{CWEAVE}. -@d banner "This is CTWILL, Version 4.3" +@d banner "This is CTWILL, Version 4.2" /* will be extended by the \TeX~Live |versionstring| */ @z @@ -628,10 +628,6 @@ skip_restricted(void) @x @.Control codes are forbidden...@> - } -} - -@ @<Predecl...@>=@+static void skip_restricted(void); @y @.Control codes are forbidden...@> if (c==meaning && phase==2) @<Process a user-generated meaning@>@; @@ -639,7 +635,15 @@ skip_restricted(void) } } -@ @<Predecl...@>=@+static void skip_restricted(void); +@ @<Suppress mini-index entry@>= +{ char *first=id_first,*last=id_loc; + while (xisspace(*first)) first++; + while (xisspace(*(last-1))) last--; + if (first<last) { + struct perm_meaning *q=id_lookup(first,last,normal)-name_dir+cur_meaning; + q->stamp=section_count; /* this is what actually suppresses output */ + } +} @ @<Process a user-generated meaning@>= { char *first=id_first; @@ -660,16 +664,6 @@ skip_restricted(void) loc=id_loc+2; } -@ @<Suppress mini-index entry@>= -{ char *first=id_first,*last=id_loc; - while (xisspace(*first)) first++; - while (xisspace(*(last-1))) last--; - if (first<last) { - struct perm_meaning *q=id_lookup(first,last,normal)-name_dir+cur_meaning; - q->stamp=section_count; /* this is what actually suppresses output */ - } -} - @ @<Digest...@>= { meaning_struct *m; struct perm_meaning *q=p-name_dir+cur_meaning; @@ -689,8 +683,6 @@ skip_restricted(void) else { char *q=m->tex_part; while (loc<id_loc) *q++=*loc++; *q='\0'; - } -} @z @x @@ -880,10 +872,10 @@ the section is changed, we output `\.{\\*}' just after the number. @z @x -@d attr_head 69 /* denotes beginning of attribute */ +@d end_arg 62 /* \.{@@]} */ @y -@d attr_head 69 /* denotes beginning of attribute */ -@d title 70 /* program name or header name in a ``meaning'' */ +@d end_arg 62 /* \.{@@]} */ +@d title 63 /* program name or header name in a ``meaning'' */ @z @x @@ -911,14 +903,14 @@ null_scrap.trans=&tok_start[0]; @c static void -print_text( /* prints a token list for debugging; not used in |main| */ +print_text(@t\1\1@> /* prints a token list for debugging; not used in |main| */ @y @d inner_tok_flag 5*id_flag /* signifies a token list in `\pb' */ @c #if 0 -@t\4\4@>static void -print_text( /* prints a token list for debugging; not used in |main| */ +static void +print_text(@t\1\1@> /* prints a token list for debugging; not used in |main| */ @z @x @@ -972,16 +964,16 @@ static token_pointer tok_loc; /* where the first identifier appears */ @z @x -r->num=m; /* everything from |q| on is left undisturbed */ + r->num=m; /* everything from |q| on is left undisturbed */ @y -r->num=m; /* everything from |q| on is left undisturbed */ + r->num=m; /* everything from |q| on is left undisturbed */ @ \.{CTWILL} needs the following procedure, which appends tokens of a translated text until coming to |tok_loc|, then suppresses text that may appear between parentheses or brackets. The calling routine should set |ident_seen=false| first. (This is admittedly tricky.) -@c static boolean ident_seen; +@c boolean ident_seen; static boolean app_supp( text_pointer p) { token_pointer j; @@ -1097,7 +1089,7 @@ while (ast_count) { @x @<Cases for |exp|@>= if (cat1==lbrace || cat1==int_like || cat1==decl) { - make_underlined(pp); big_app(dindent); big_app1(pp); + make_underlined(pp); big_app1(pp); big_app(indent); app(indent); reduce(pp,1,fn_decl,0,1); } @y @@ -1105,13 +1097,16 @@ if (cat1==lbrace || cat1==int_like || cat1==decl) { if(cat1==lbrace || cat1==int_like || cat1==decl) { make_underlined(pp); make_ministring(0); - if (indent_param_decl) big_app(dindent); big_app1(pp); + big_app1(pp); + if (indent_param_decl) { + big_app(indent); app(indent); + } reduce(pp,1,fn_decl,0,1); } @z @x - make_underlined (pp); squash(pp,2,tag,-1,7); + make_underlined (pp); squash(pp,2,tag,-1,7); @y make_underlined (pp); if (tok_loc>operator_found) { @@ -1128,7 +1123,8 @@ if (cat1==comma) { big_app2(pp); big_app(' '); reduce(pp,2,decl_head,-1,33); } else if (cat1==ubinop) { - big_app1_insert(pp,'{'); big_app('}'); reduce(pp,2,decl_head,-1,34); + big_app1(pp); big_app('{'); big_app1(pp+1); big_app('}'); + reduce(pp,2,decl_head,-1,34); } else if (cat1==exp && cat2!=lpar && cat2!=exp && cat2!=cast) { make_underlined(pp+1); squash(pp,2,decl_head,-1,35); @@ -1138,7 +1134,7 @@ else if ((cat1==binop||cat1==colon) && cat2==exp && (cat3==comma || 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) { - big_app(dindent); big_app1(pp); reduce(pp,1,fn_decl,0,38); + big_app1(pp); big_app(indent); app(indent); reduce(pp,1,fn_decl,0,38); } else if (cat1==semi) squash(pp,2,decl,-1,39); @y @@ -1147,7 +1143,7 @@ if (cat1==comma) { big_app2(pp); big_app(' '); reduce(pp,2,decl_head,-1,33); } else if (cat1==ubinop) { - big_app1_insert(pp,'{'); big_app('}'); + big_app1(pp); big_app('{'); big_app1(pp+1); big_app('}'); reduce(pp,2,decl_head,-1,34); } else if (cat1==exp && cat2!=lpar && cat2!=exp && cat2!=cast) { @@ -1160,7 +1156,10 @@ else if ((cat1==binop||cat1==colon) && cat2==exp && (cat3==comma || 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) { - if (indent_param_decl) big_app(dindent); big_app1(pp); + big_app1(pp); + if (indent_param_decl) { + big_app(indent); app(indent); + } reduce(pp,1,fn_decl,0,38); } else if (cat1==semi) squash(pp,2,decl,-1,39); @@ -1169,19 +1168,24 @@ else if (cat1==semi) squash(pp,2,decl,-1,39); @x @ @<Cases for |decl|@>= if (cat1==decl) { - big_app1_insert(pp,force); reduce(pp,2,decl,-1,40); + big_app1(pp); big_app(force); big_app1(pp+1); + reduce(pp,2,decl,-1,40); } else if (cat1==stmt || cat1==function) { - big_app1_insert(pp,big_force); reduce(pp,2,cat1,-1,41); + big_app1(pp); big_app(big_force); + big_app1(pp+1); reduce(pp,2,cat1,-1,41); } @y @ @<Cases for |decl|@>= if (cat1==decl) { - big_app1_insert(pp,force); reduce(pp,2,decl,-1,40); + big_app1(pp); big_app(force); big_app1(pp+1); + reduce(pp,2,decl,-1,40); } else if (cat1==stmt || cat1==function) { - big_app1_insert(pp,order_decl_stmt ? big_force : force); - reduce(pp,2,cat1,-1,41); + big_app1(pp); + if(order_decl_stmt) big_app(big_force); + else big_app(force); + big_app1(pp+1); reduce(pp,2,cat1,-1,41); } @z @@ -1195,7 +1199,7 @@ else if (cat1==stmt || cat1==function) { @x @ @<Cases for |fn_decl|@>= if (cat1==decl) { - big_app1_insert(pp,force); reduce(pp,2,fn_decl,0,51); + big_app1(pp); big_app(force); big_app1(pp+1); reduce(pp,2,fn_decl,0,51); } else if (cat1==stmt) { big_app1(pp); app(outdent); app(outdent); big_app(force); @@ -1204,25 +1208,19 @@ else if (cat1==stmt) { @y @ @<Cases for |fn_decl|@>= if (cat1==decl) { - big_app1_insert(pp,force); reduce(pp,2,fn_decl,0,51); + big_app1(pp); big_app(force); big_app1(pp+1); reduce(pp,2,fn_decl,0,51); } else if (cat1==stmt) { big_app1(pp); if (indent_param_decl) { app(outdent); app(outdent); } - big_app(force); big_app1(pp+1); reduce(pp,2,function,-1,52); + big_app(force); + big_app1(pp+1); reduce(pp,2,function,-1,52); } @z @x - big_app1_insert(pp,dindent); reduce(pp,2,fn_decl,0,73); -@y - big_app1(pp); if (indent_param_decl) big_app(dindent); - big_app1(pp+1); reduce(pp,2,fn_decl,0,73); -@z - -@x if (cat1==define_like) make_underlined(pp+2); @y if (cat1==define_like) { /* \.{\#define} is analogous to \&{extern} */ @@ -1243,9 +1241,9 @@ else squash(pp,1,exp,-2,122); @z @x - big_app1_insert(pp,' '); reduce(pp,2,else_like,-2,102); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,else_like,-2,102); @y - big_app1_insert(pp,' '); reduce(pp,2,else_like,-2,123); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,else_like,-2,123); @z @x @@ -1253,18 +1251,19 @@ else squash(pp,1,exp,-2,122); if ((cat1==int_like || cat1==cast) && (cat2==comma || cat2==semi)) squash(pp+1,1,exp,-1,115); else if (cat1==int_like) { - big_app1_insert(pp,' '); reduce(pp,2,typedef_like,0,116); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,typedef_like,0,116); } else if (cat1==exp && cat2!=lpar && cat2!=exp && cat2!=cast) { make_underlined(pp+1); make_reserved(pp+1); - big_app1_insert(pp,' '); reduce(pp,2,typedef_like,0,117); + big_app1(pp); big_app(' '); big_app1(pp+1); 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==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); + big_app('{'); big_app1(pp+1); big_app('}'); big_app1(pp+2); + reduce(pp+1,2,cat2,0,120); } @y @ Here \.{CTWILL} deviates from the normal productions introduced in @@ -1354,9 +1353,11 @@ if (cat1==decl_head) { @z @x -to \.{\\PB}. Although \.{cwebmac} ignores \.{\\PB}, other macro packages +to \.{\\PB}, if the user has invoked \.{CWEAVE} with the \.{+e} flag. +Although \.{cwebmac} ignores \.{\\PB}, other macro packages @y -to \.{\\PB}. Although \.{ctwimac} ignores \.{\\PB}, other macro packages +to \.{\\PB}, if the user has invoked \.{CTWILL} with the \.{+e} flag. +Although \.{ctwimac} ignores \.{\\PB}, other macro packages @z @x @@ -1411,10 +1412,12 @@ section_count=0; format_visible=true; right_start_switch=false; copy_limbo(); @z @x -@ @<Predecl...@>=@+static void phase_two(void); +while (!input_has_ended) @<Translate the current section@>@; +} @y -@ @<Predecl...@>=@+static void phase_two(void); +while (!input_has_ended) @<Translate the current section@>@; +} @ @<Private...@>= static FILE *aux_file; @@ -1476,15 +1479,15 @@ if (*(loc-1)!='*') { @y @.\\N@> if (right_start_switch) { - out('N'); right_start_switch=false; + out_str("N"); right_start_switch=false; @.\\NN@> } @z @x -out('{'); out_section(section_count); out('}'); +out_str("{");out_section(section_count); out_str("}"); @y -out('{'); out_section(section_count); out('}'); +out_str("{");out_section(section_count); out_str("}"); flush_buffer(out_ptr,false,false); @z @@ -1548,12 +1551,12 @@ static name_pointer id_being_defined; /* the definee */ @x @.Improper macro definition@> else { - app_cur_id(false); + app('$'); app_cur_id(false); @y @.Improper macro definition@> else { id_being_defined=id_lookup(id_first,id_loc,normal); - app_cur_id(false); + app('$'); app_cur_id(false); def_diff=*loc-'('; @z @@ -1806,9 +1809,9 @@ rest of the job. @z @x - case normal: case func_template: + case normal: case func_template: if (is_tiny(cur_name)) out_str("\\|"); @y - case normal: + case normal: if (is_tiny(cur_name)) out_str("\\|"); @z @x @@ -1897,20 +1900,20 @@ else { @x @** Index. @y -@** Extensions to {\tentex CWEB}. The following sections introduce new or -improved features that have been created by numerous contributors over the -course of a quarter century. +@** Extensions to \.{CWEB}. The following sections introduce new or improved +features that have been created by numerous contributors over the course of a +quarter century. \bigskip \font\itt=cmitt10 -{\noindent \it Although {\itt CTWILL} is based on {\itt cweave.w}, new and +{\noindent \it Although \.{\itt CTWILL} is based on \.{\itt cweave.w}, new and modified material is incorporated all over the place, without taking special care for keeping the original section numbering intact.} @* Formatting alternatives. -\.{CWEAVE} indents declarations after old-style function definitions and -long parameter lists of modern function definitions. -With the \.{-i} option they will come out flush left. +\.{CWEAVE} indents declarations after old-style function definitions. +With the \.{-i} option they will come out flush left. You won't see +any difference if you use ANSI-style function definitions. @d indent_param_decl flags['i'] /* should formal parameter declarations be indented? */ @@ -1944,7 +1947,7 @@ if((tex_file=fopen(tex_file_name,"r"))!=NULL) { fatal(_("! Cannot open output file "),check_file_name); @.Cannot open output file@> - if (check_for_change) @<Compare the temporary output...@>@; + if (temporary_output) @<Compare the temporary output...@>@; fclose(tex_file); tex_file=NULL; fclose(check_file); check_file=NULL; @@ -1976,7 +1979,7 @@ else { rename(check_file_name,tex_file_name); } -@* Put ``version'' information in a single spot. +@* Put ``version'' information in \.{COMMON}. Don't do this at home, kids! Push our local macro to the variable in \.{COMMON} for printing the |banner| and the |versionstring| from there. diff --git a/Build/source/texk/web2c/cwebdir/ctwill.bux b/Build/source/texk/web2c/cwebdir/ctwill.bux index 4a6c5f901e8..d5a678dba53 100644 --- a/Build/source/texk/web2c/cwebdir/ctwill.bux +++ b/Build/source/texk/web2c/cwebdir/ctwill.bux @@ -1,23 +1,24 @@ @$program {COMMON.W}18 \&{int}@> -@$ctangle {COMMON.W}2 \&{int}@> -@$ctwill {COMMON.W}2 \&{int}@> -@$cweave {COMMON.W}2 \&{int}@> +@$ctangle {COMMON.W}18 \&{int}@> +@$ctwill {COMMON.W}18 \&{int}@> +@$cweave {COMMON.W}18 \&{int}@> @$phase {COMMON.W}19 \&{int}@> @$common_init {COMMON.W}20 \&{void} (\,)@> -@$section_text {COMMON.W}21 \&{char} [\,][\,]@> -@$section_text_end {COMMON.W}21 \&{char} ${*}$@> @$id_first {COMMON.W}21 \&{char} ${*}$@> @$id_loc {COMMON.W}21 \&{char} ${*}$@> +@$section_text {COMMON.W}21 \&{char} [\,][\,]@> +@$section_text_end {COMMON.W}21 \&{char} ${*}$@> @$buffer {COMMON.W}22 \&{char} [\,]@> @$buffer_end {COMMON.W}22 \&{char} ${*}$@> -@$loc {COMMON.W}22 \&{char} ${*}$@> @$limit {COMMON.W}22 \&{char} ${*}$@> +@$loc {COMMON.W}22 \&{char} ${*}$@> @$include_depth {COMMON.W}25 \&{int}@> @$file {COMMON.W}25 \&{FILE} ${*}$ [\,]@> @$change_file {COMMON.W}25 \&{FILE} ${*}$@> @$file_name {COMMON.W}25 \&{char} [\,][\,]@> @$change_file_name {COMMON.W}25 \&{char} [\,]@> +@$alt_web_file_name {COMMON.W}25 \&{char} [\,]@> @$line {COMMON.W}25 \&{int} [\,]@> @$change_line {COMMON.W}25 \&{int}@> @$change_depth {COMMON.W}25 \&{int}@> @@ -42,9 +43,9 @@ @$byte_ptr {COMMON.W}44 \&{char} ${*}$@> @$name_ptr {COMMON.W}44 \&{name\_pointer}@> +@$h {COMMON.W}46 \&{hash\_pointer}@> @$hash {COMMON.W}46 \&{name\_pointer} [\,]@> @$hash_end {COMMON.W}46 \&{hash\_pointer}@> -@$h {COMMON.W}46 \&{hash\_pointer}@> @$id_lookup {COMMON.W}48 \&{name\_pointer} (\,)@> @@ -71,6 +72,7 @@ @$scn_file_name {COMMON.W}73 \&{char} [\,]@> @$check_file_name {COMMON.W}73 \&{char} [\,]@> @$flags {COMMON.W}73 \&{boolean} [\,]@> +@$use_language {COMMON.W}86 \&{const char} ${*}$@> @$C_file {COMMON.W}83 \&{FILE} ${*}$@> @$tex_file {COMMON.W}83 \&{FILE} ${*}$@> @@ -79,8 +81,6 @@ @$check_file {COMMON.W}83 \&{FILE} ${*}$@> @$active_file {COMMON.W}83 \&{FILE} ${*}$@> -@$use_language {COMMON.W}86 \&{const char} ${*}$@> - @$cb_banner {COMMON.W}87 \&{char} [\,]@> @$cb_show_banner {COMMON.W}99 \&{void} (\,)@> diff --git a/Build/source/texk/web2c/cwebdir/ctwimac.tex b/Build/source/texk/web2c/cwebdir/ctwimac.tex index 8596b2747de..eddd6af3528 100644 --- a/Build/source/texk/web2c/cwebdir/ctwimac.tex +++ b/Build/source/texk/web2c/cwebdir/ctwimac.tex @@ -1,9 +1,9 @@ % standard macros for CWEB listings (in addition to plain.tex) -% Version 4.3 --- April 2021 +% Version 3.6 --- May 2000 % modified for pages produced by CTWILL % further modified for page size of the MMIXware book \ifx\documentstyle\undefined\else\endinput\fi % LaTeX will use other macros -\xdef\fmtversion{\fmtversion+CTWILL4.3+LNCS} +\xdef\fmtversion{\fmtversion+CTWILL3.6+LNCS} \let\:=\. % preserve a way to get the dot accent % (all other accents will still work as usual) @@ -218,7 +218,6 @@ \newskip\intersecskip \intersecskip=12pt minus 3pt % space between sections \let\yskip=\smallskip \def\?{\mathrel?} -\def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} \def\note#1#2.{\par\penalty5000 \Y\noindent{\hangindent2\em\baselineskip10pt\eightrm#1~#2.\par}} \def\lapstar{\rlap{*}} @@ -279,8 +278,7 @@ \hbox{$\def\?{\kern.2em}% \def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick) - \def\%{\cdot 16^{\aftergroup}}% power of sixteen (via dirty trick) - \let\~=\oct \let\^=\hex \let\\=\bin{#1}$}}%$% + \let\~=\oct \let\^=\hex {#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 @@ -294,16 +292,16 @@ %\def\oct{\hbox{\rm\char'23\kern-.2em\it\aftergroup\?\aftergroup}} % WEB style %\def\hex{\hbox{\rm\char"7D\tt\aftergroup}} % WEB style -\def\oct{\hbox{$^\circ$\kern-.1em}\Od}% CWEB style -\def\hex{\hbox{$^{\scriptscriptstyle\#}$}\Hd} % CWEB style -\def\bin{\hbox{$^{\scriptscriptstyle b}$}\Bd} -\def\Od#1/{{\it#1}} % octal digit -\def\Hd#1/{{\tt#1}} % hexadecimal digit -\def\Bd#1/{{\tt#1}} % binary digit +\def\oct{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}}% CWEB style +\def\hex{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}} % CWEB style \def\vb#1{\leavevmode\hbox{\kern2pt\vrule\vtop{\vbox{\hrule \hbox{\strut\kern2pt\.{#1}\kern2pt}} \hrule}\vrule\kern2pt}} % verbatim string +\def\TeX{{\ifmmode\it\fi + \leavevmode\hbox{T\kern-.1667em\lower.424ex\hbox{E}\hskip-.125em X}}} +\def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} + % now here's the mini-index formatting control \newcount\nrefs % total number of references in partial page \newcount\baseno % smallest section number in partial page diff --git a/Build/source/texk/web2c/cwebdir/cweav-bs.ch b/Build/source/texk/web2c/cwebdir/cweav-bs.ch index 36ce6a4ef8e..bf2752881e4 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-bs.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-bs.ch @@ -20,16 +20,16 @@ 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.3)" +@d banner "This is CWEAVE (Version 4.2)" @y The ``banner line'' defined here should be changed whenever \.{CWEAVE} is modified. -@d banner "This is CWEAVE (Version 4.3pc/big)" +@d banner "This is CWEAVE (Version 4.2pc/big)" @z -@x Section 10. +@x Section 7. for section names */ @<Common code...@>= @@ -119,11 +119,11 @@ static xref_pointer xmem_end; @x Section 24. -xref_ptr=xmem; init_node(name_dir); xref_switch=section_xref_switch=0; +xref_ptr=xmem; init_node(name_dir); xref_switch=0; section_xref_switch=0; xmem->num=0; /* sentinel value */ @y xmem_end = xmem + max_refs - 1; -xref_ptr=xmem; init_node(name_dir); xref_switch=section_xref_switch=0; +xref_ptr=xmem; init_node(name_dir); xref_switch=0; section_xref_switch=0; xmem->num=0; /* sentinel value */ @z @@ -165,7 +165,7 @@ max_tok_ptr=tok_mem+1; max_text_ptr=tok_start+1; @z -@x Section 78. +@x Section 74. if (unindexed(lhs)) { /* retain only underlined entries */ xref_pointer q,r=NULL; for (q=(xref_pointer)lhs->xref;q>xmem;q=q->xlink) @@ -186,7 +186,7 @@ max_tok_ptr=tok_mem+1; max_text_ptr=tok_start+1; @z -@x Section 97. +@x Section 93. char *k, *k_end=(p+1)->byte_start; /* pointers into |byte_mem| */ out('{'); for (k=p->byte_start; k<k_end; k++) { @@ -197,41 +197,39 @@ max_tok_ptr=tok_mem+1; max_text_ptr=tok_start+1; @z -@x Section 218. +@x Section 209. char *p; /* index into |byte_mem| */ @y char huge *p; /* index into |byte_mem| */ @z -@x Section 253. +@x Section 244. if (cur_name->xref!=(void *)xmem) { @y if (cur_name->xref!=(void huge*)xmem) { @z -@x Section 255. +@x Section 246. static char *cur_byte; /* index into |byte_mem| */ @y static char huge* cur_byte; /* index into |byte_mem| */ @z -@x Section 264. +@x Section 255. switch (cur_name->ilk) { - case normal: case func_template: - if (is_tiny(cur_name)) out_str("\\|"); - else {@+char *j; + case normal: case func_template: if (is_tiny(cur_name)) out_str("\\|"); + else {char *j; @y switch (cur_name->ilk) { - case normal: case func_template: - if (is_tiny(cur_name)) out_str("\\|"); - else {@+char huge* j; + case normal: case func_template: if (is_tiny(cur_name)) out_str("\\|"); + else {char huge* j; @z -@x Section 264. +@x Section 255. case custom: {char *j; out_str("$\\"); @y case custom: {char huge* j; out_str("$\\"); diff --git a/Build/source/texk/web2c/cwebdir/cweav-man.ch b/Build/source/texk/web2c/cwebdir/cweav-man.ch index 6cfcc8fe2d2..b72360944a2 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-man.ch +++ b/Build/source/texk/web2c/cwebdir/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{109} +\def\contentspagenumber{111} \def\title{APPENDIX F: CWEAVE} \let\K=\leftarrow @z diff --git a/Build/source/texk/web2c/cwebdir/cweav-pc.ch b/Build/source/texk/web2c/cwebdir/cweav-pc.ch index f0f7770d5ed..b37f9f2ec35 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-pc.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-pc.ch @@ -11,12 +11,12 @@ 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.3)" +@d banner "This is CWEAVE (Version 4.2)" @y -@d banner "This is CWEAVE (Version 4.3pc)" +@d banner "This is CWEAVE (Version 4.2pc)" @z -@x section 17 +@x section 4 @d max_bytes 1000000 /* the number of bytes in identifiers, @y @d max_bytes (unsigned)60000 /* the number of bytes in identifiers, diff --git a/Build/source/texk/web2c/cwebdir/cweav-ql.ch b/Build/source/texk/web2c/cwebdir/cweav-ql.ch index fa809a5bce5..28053eb1588 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-ql.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-ql.ch @@ -7,15 +7,15 @@ ex <dev_>cc;"-v -h -c =500000 cweave_c" @x -\def\title{CWEAVE (Version 4.3)} +\def\title{CWEAVE (Version 4.2)} @y -\def\title{CWEAVE (QL Version 4.3)} +\def\title{CWEAVE (QL Version 4.2)} @z @x section 1 -@d banner "This is CWEAVE (Version 4.3)" +@d banner "This is CWEAVE (Version 4.2)" @y -@d banner "This is CWEAVE (QL Version 4.3)" +@d banner "This is CWEAVE (QL Version 4.2)" @z @x diff --git a/Build/source/texk/web2c/cwebdir/cweav-vms.ch b/Build/source/texk/web2c/cwebdir/cweav-vms.ch index a4416a7eb15..7d80d57c1e8 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-vms.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-vms.ch @@ -13,12 +13,12 @@ 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.3)" +@d banner "This is CWEAVE (Version 4.2)" @y -@d banner "This is CWEAVE (VAX/VMS Version 4.3)" +@d banner "This is CWEAVE (VAX/VMS Version 4.2)" @z -@x section 4 (01-FEB-1992 ST) +@x section 3 (01-FEB-1992 ST) #include <ctype.h> /* definition of |@!isalpha|, |@!isdigit| and so on */ #include <stdbool.h> /* definition of |@!bool|, |@!true| and |@!false| */ #include <stddef.h> /* definition of |@!ptrdiff_t| */ diff --git a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch index 26c6c6699f8..3f63105075a 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch @@ -17,15 +17,15 @@ @q Please send comments, suggestions, etc. to tex-k@@tug.org. @> @x -\def\title{CWEAVE (Version 4.3)} +\def\title{CWEAVE (Version 4.2)} @y -\def\title{CWEAVE (Version 4.3 [\TeX~Live])} +\def\title{CWEAVE (Version 4.2 [\TeX~Live])} @z @x - \centerline{(Version 4.3)} + \centerline{(Version 4.2)} @y - \centerline{(Version 4.3 [\TeX~Live])} + \centerline{(Version 4.2 [\TeX~Live])} @z @x @@ -41,9 +41,9 @@ @z @x -@d banner "This is CWEAVE (Version 4.3)" +@d banner "This is CWEAVE (Version 4.2)" @y -@d banner "This is CWEAVE, Version 4.3" +@d banner "This is CWEAVE, Version 4.2" /* will be extended by the \TeX~Live |versionstring| */ @z @@ -252,14 +252,14 @@ tex_puts("cwebma"); @c static void -print_text( /* prints a token list for debugging; not used in |main| */ +print_text(@t\1\1@> /* prints a token list for debugging; not used in |main| */ @y @d inner_tok_flag 5*id_flag /* signifies a token list in `\pb' */ @c #if 0 -@t\4\4@>static void -print_text( /* prints a token list for debugging; not used in |main| */ +static void +print_text(@t\1\1@> /* prints a token list for debugging; not used in |main| */ @z @x @@ -281,13 +281,16 @@ static void print_text(text_pointer p); @x @<Cases for |exp|@>= if (cat1==lbrace || cat1==int_like || cat1==decl) { - make_underlined(pp); big_app(dindent); big_app1(pp); + make_underlined(pp); big_app1(pp); big_app(indent); app(indent); reduce(pp,1,fn_decl,0,1); } @y @<Cases for |exp|@>= if(cat1==lbrace || cat1==int_like || cat1==decl) { - make_underlined(pp); if (indent_param_decl) big_app(dindent); big_app1(pp); + make_underlined(pp); big_app1(pp); + if (indent_param_decl) { + big_app(indent); app(indent); + } reduce(pp,1,fn_decl,0,1); } @z @@ -298,7 +301,8 @@ if (cat1==comma) { big_app2(pp); big_app(' '); reduce(pp,2,decl_head,-1,33); } else if (cat1==ubinop) { - big_app1_insert(pp,'{'); big_app('}'); reduce(pp,2,decl_head,-1,34); + big_app1(pp); big_app('{'); big_app1(pp+1); big_app('}'); + reduce(pp,2,decl_head,-1,34); } else if (cat1==exp && cat2!=lpar && cat2!=exp && cat2!=cast) { make_underlined(pp+1); squash(pp,2,decl_head,-1,35); @@ -308,7 +312,7 @@ else if ((cat1==binop||cat1==colon) && cat2==exp && (cat3==comma || 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) { - big_app(dindent); big_app1(pp); reduce(pp,1,fn_decl,0,38); + big_app1(pp); big_app(indent); app(indent); reduce(pp,1,fn_decl,0,38); } else if (cat1==semi) squash(pp,2,decl,-1,39); @y @@ -317,7 +321,7 @@ if (cat1==comma) { big_app2(pp); big_app(' '); reduce(pp,2,decl_head,-1,33); } else if (cat1==ubinop) { - big_app1_insert(pp,'{'); big_app('}'); + big_app1(pp); big_app('{'); big_app1(pp+1); big_app('}'); reduce(pp,2,decl_head,-1,34); } else if (cat1==exp && cat2!=lpar && cat2!=exp && cat2!=cast) { @@ -328,7 +332,10 @@ else if ((cat1==binop||cat1==colon) && cat2==exp && (cat3==comma || 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) { - if (indent_param_decl) big_app(dindent); big_app1(pp); + big_app1(pp); + if (indent_param_decl) { + big_app(indent); app(indent); + } reduce(pp,1,fn_decl,0,38); } else if (cat1==semi) squash(pp,2,decl,-1,39); @@ -337,26 +344,31 @@ else if (cat1==semi) squash(pp,2,decl,-1,39); @x @ @<Cases for |decl|@>= if (cat1==decl) { - big_app1_insert(pp,force); reduce(pp,2,decl,-1,40); + big_app1(pp); big_app(force); big_app1(pp+1); + reduce(pp,2,decl,-1,40); } else if (cat1==stmt || cat1==function) { - big_app1_insert(pp,big_force); reduce(pp,2,cat1,-1,41); + big_app1(pp); big_app(big_force); + big_app1(pp+1); reduce(pp,2,cat1,-1,41); } @y @ @<Cases for |decl|@>= if (cat1==decl) { - big_app1_insert(pp,force); reduce(pp,2,decl,-1,40); + big_app1(pp); big_app(force); big_app1(pp+1); + reduce(pp,2,decl,-1,40); } else if (cat1==stmt || cat1==function) { - big_app1_insert(pp,order_decl_stmt ? big_force : force); - reduce(pp,2,cat1,-1,41); + big_app1(pp); + if(order_decl_stmt) big_app(big_force); + else big_app(force); + big_app1(pp+1); reduce(pp,2,cat1,-1,41); } @z @x @ @<Cases for |fn_decl|@>= if (cat1==decl) { - big_app1_insert(pp,force); reduce(pp,2,fn_decl,0,51); + big_app1(pp); big_app(force); big_app1(pp+1); reduce(pp,2,fn_decl,0,51); } else if (cat1==stmt) { big_app1(pp); app(outdent); app(outdent); big_app(force); @@ -365,25 +377,19 @@ else if (cat1==stmt) { @y @ @<Cases for |fn_decl|@>= if (cat1==decl) { - big_app1_insert(pp,force); reduce(pp,2,fn_decl,0,51); + big_app1(pp); big_app(force); big_app1(pp+1); reduce(pp,2,fn_decl,0,51); } else if (cat1==stmt) { big_app1(pp); if (indent_param_decl) { app(outdent); app(outdent); } - big_app(force); big_app1(pp+1); reduce(pp,2,function,-1,52); + big_app(force); + big_app1(pp+1); reduce(pp,2,function,-1,52); } @z @x - big_app1_insert(pp,dindent); reduce(pp,2,fn_decl,0,73); -@y - big_app1(pp); if (indent_param_decl) big_app(dindent); - big_app1(pp+1); reduce(pp,2,fn_decl,0,73); -@z - -@x overflow("token"); @y overflow(_("token")); @@ -614,17 +620,17 @@ finish_line(); fclose(active_file); active_file=NULL; @x @** Index. @y -@** Extensions to {\tentex CWEB}. The following sections introduce new or -improved features that have been created by numerous contributors over the -course of a quarter century. +@** Extensions to \.{CWEB}. The following sections introduce new or improved +features that have been created by numerous contributors over the course of a +quarter century. Care has been taken to keep the original section numbering intact, so this new -material should nicely integrate with the original ``\&{272.~Index}.'' +material should nicely integrate with the original ``\&{263.~Index}.'' @* Formatting alternatives. -\.{CWEAVE} indents declarations after old-style function definitions and -long parameter lists of modern function definitions. -With the \.{-i} option they will come out flush left. +\.{CWEAVE} indents declarations after old-style function definitions. +With the \.{-i} option they will come out flush left. You won't see +any difference if you use ANSI-style function definitions. @d indent_param_decl flags['i'] /* should formal parameter declarations be indented? */ @@ -658,7 +664,7 @@ if((tex_file=fopen(tex_file_name,"r"))!=NULL) { fatal(_("! Cannot open output file "),check_file_name); @.Cannot open output file@> - if (check_for_change) @<Compare the temporary output...@>@; + if (temporary_output) @<Compare the temporary output...@>@; fclose(tex_file); tex_file=NULL; fclose(check_file); check_file=NULL; diff --git a/Build/source/texk/web2c/cwebdir/cweav-w32.ch b/Build/source/texk/web2c/cwebdir/cweav-w32.ch index 2fec0672e47..346d00771aa 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-w32.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-w32.ch @@ -2,23 +2,23 @@ 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.3)" +@d banner "This is CWEAVE (Version 4.2)" @y -@d banner "This is CWEAVE (Version 4.3win32)" +@d banner "This is CWEAVE (Version 4.2win32)" @z @x -boolean names_match( +boolean names_match(@t\1\1@> 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) /* desired |ilk| */ +eight_bits t@t\2\2@>) /* desired |ilk| */ @y -boolean __cdecl names_match( +boolean __cdecl names_match(@t\1\1@> 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) /* desired |ilk| */ +eight_bits t@t\2\2@>) /* desired |ilk| */ @z @x diff --git a/Build/source/texk/web2c/cwebdir/cweave.w b/Build/source/texk/web2c/cwebdir/cweave.w index 58b2934fc01..a8e31055b23 100644 --- a/Build/source/texk/web2c/cwebdir/cweave.w +++ b/Build/source/texk/web2c/cwebdir/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.3 --- April 2021 +% Version 4.2 --- February 2021 % 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.3)} +\def\title{CWEAVE (Version 4.2)} \def\topofcontents{\null\vfill \centerline{\titlefont The {\ttitlefont CWEAVE} processor} \vskip 15pt - \centerline{(Version 4.3)} + \centerline{(Version 4.2)} \vfill} \def\botofcontents{\vfill \noindent @@ -67,10 +67,9 @@ 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.3)" +@d banner "This is CWEAVE (Version 4.2)" -@c -@<Include files@>@/ +@c @<Include files@>@/ @h @<Common code for \.{CWEAVE} and \.{CTANGLE}@>@/ @<Typedef declarations@>@/ @@ -86,9 +85,9 @@ Please read the documentation for \.{common}, the set of routines common to \.{CTANGLE} and \.{CWEAVE}, before proceeding further. @c -int main ( +int main (@t\1\1@> int ac, /* argument count */ -char **av) /* argument values */ +char **av@t\2\2@>) /* argument values */ { argc=ac; argv=av; program=cweave; @@ -100,7 +99,7 @@ char **av) /* argument values */ phase_one(); /* read all the user's text and store the cross-references */ phase_two(); /* read all the text again and translate it to \TEX/ form */ phase_three(); /* output the cross-reference index */ - if (tracing==fully && !show_progress) new_line; + if (tracing==2 && !show_progress) new_line; return wrap_up(); /* and exit gracefully */ } @@ -144,7 +143,7 @@ will be typeset in special ways. \yskip\hang |typewriter| identifiers are index entries that appear after \.{@@.} in the \.{CWEB} file. -\yskip\hang |alfop|, \dots, |attr| +\yskip\hang |alfop|, \dots, |template_like| identifiers are \CEE/ or \CPLUSPLUS/ reserved words whose |ilk| explains how they are to be treated when \CEE/ code is being formatted. @@ -177,10 +176,6 @@ formatted. @d typedef_like 56 /* \&{typedef} */ @d define_like 57 /* \&{define} */ @d template_like 58 /* \&{template} */ -@d alignas_like 59 /* \&{alignas} */ -@d using_like 60 /* \&{using} */ -@d default_like 61 /* \&{default} */ -@d attr 62 /* \&{noexcept} and attributes */ @ We keep track of the current section number in |section_count|, which is the total number of sections that have started. Sections which have @@ -234,7 +229,7 @@ has a special first cross-reference whose |num| field is |file_flag|. @d xref equiv_or_xref @<Set init...@>= -xref_ptr=xmem; init_node(name_dir); xref_switch=section_xref_switch=0; +xref_ptr=xmem; init_node(name_dir); xref_switch=0; section_xref_switch=0; xmem->num=0; /* sentinel value */ @ A new cross-reference for an identifier is formed by calling |new_xref|, @@ -244,7 +239,7 @@ to one-letter identifiers or \CEE/'s reserved words. If the user has sent the |no_xref| flag (the \.{-x} option of the command line), it is unnecessary to keep track of cross-references for identifiers. If one were careful, one could probably make more changes around section -115 to avoid a lot of identifier looking up. +100 to avoid a lot of identifier looking up. @d append_xref(c) if (xref_ptr==xmem_end) overflow("cross-reference"); else (++xref_ptr)->num=c; @@ -294,9 +289,9 @@ static void new_section_xref( name_pointer p) { - xref_pointer q=(xref_pointer)p->xref; - xref_pointer r=xmem; /* pointers to previous cross-references */ - if (q>r) + xref_pointer q,r; /* pointers to previous cross-references */ + q=(xref_pointer)p->xref; r=xmem; + if (q>xmem) while (q->num>section_xref_switch) {r=q; q=q->xlink;} if (r->num==section_count+section_xref_switch) return; /* don't duplicate entries */ @@ -314,7 +309,8 @@ static void set_file_flag( name_pointer p) { - xref_pointer q=(xref_pointer)p->xref; + xref_pointer q; + q=(xref_pointer)p->xref; if (q->num==file_flag) return; append_xref(file_flag); xref_ptr->xlink = q; @@ -354,11 +350,11 @@ text_ptr=max_text_ptr=tok_start+1; @ Here are the three procedures needed to complete |id_lookup|: @c -boolean names_match( +boolean names_match(@t\1\1@> 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) /* desired |ilk| */ +eight_bits t@t\2\2@>) /* desired |ilk| */ { if (length(p)!=l) return false; if (p->ilk!=t && !(t==normal && abnormal(p))) return false; @@ -389,18 +385,14 @@ name_pointer p) @ @<Predecl...@>=@+static void update_node(name_pointer p); -@ We have to get \CEE/'s and \CPLUSPLUS/'s +@ We have to get \CEE/'s reserved words into the hash table, and the simplest way to do this is to insert them every time \.{CWEAVE} is run. Fortunately there are relatively few reserved words. (Some of these are not strictly ``reserved,'' but -are defined in header files of the ISO Standard \CEE/ Library. -An ever growing list of \CPLUSPLUS/ keywords can be found here: -\.{https://en.cppreference.com/w/cpp/keyword}.) +are defined in header files of the ISO Standard \CEE/ Library.) @^reserved words@> @<Store all the reserved words@>= -id_lookup("alignas",NULL,alignas_like); -id_lookup("alignof",NULL,sizeof_like); id_lookup("and",NULL,alfop); id_lookup("and_eq",NULL,alfop); id_lookup("asm",NULL,sizeof_like); @@ -412,24 +404,13 @@ id_lookup("break",NULL,case_like); id_lookup("case",NULL,case_like); id_lookup("catch",NULL,catch_like); id_lookup("char",NULL,raw_int); -id_lookup("char8_t",NULL,raw_int); -id_lookup("char16_t",NULL,raw_int); -id_lookup("char32_t",NULL,raw_int); id_lookup("class",NULL,struct_like); id_lookup("clock_t",NULL,raw_int); id_lookup("compl",NULL,alfop); -id_lookup("concept",NULL,int_like); id_lookup("const",NULL,const_like); -id_lookup("consteval",NULL,const_like); -id_lookup("constexpr",NULL,const_like); -id_lookup("constinit",NULL,const_like); id_lookup("const_cast",NULL,raw_int); id_lookup("continue",NULL,case_like); -id_lookup("co_await",NULL,case_like); -id_lookup("co_return",NULL,case_like); -id_lookup("co_yield",NULL,case_like); -id_lookup("decltype",NULL,sizeof_like); -id_lookup("default",NULL,default_like); +id_lookup("default",NULL,case_like); id_lookup("define",NULL,define_like); id_lookup("defined",NULL,sizeof_like); id_lookup("delete",NULL,delete_like); @@ -446,7 +427,6 @@ id_lookup("explicit",NULL,int_like); id_lookup("export",NULL,int_like); id_lookup("extern",NULL,int_like); id_lookup("FILE",NULL,raw_int); -id_lookup("false",NULL,normal); id_lookup("float",NULL,raw_int); id_lookup("for",NULL,for_like); id_lookup("fpos_t",NULL,raw_int); @@ -465,11 +445,9 @@ id_lookup("long",NULL,raw_int); id_lookup("mutable",NULL,int_like); id_lookup("namespace",NULL,struct_like); id_lookup("new",NULL,new_like); -id_lookup("noexcept",NULL,attr); id_lookup("not",NULL,alfop); id_lookup("not_eq",NULL,alfop); id_lookup("NULL",NULL,custom); -id_lookup("nullptr",NULL,custom); id_lookup("offsetof",NULL,raw_int); id_lookup("operator",NULL,operator_like); id_lookup("or",NULL,alfop); @@ -481,8 +459,6 @@ id_lookup("ptrdiff_t",NULL,raw_int); id_lookup("public",NULL,public_like); id_lookup("register",NULL,int_like); id_lookup("reinterpret_cast",NULL,raw_int); -id_lookup("requires",NULL,int_like); -id_lookup("restrict",NULL,int_like); id_lookup("return",NULL,case_like); id_lookup("short",NULL,raw_int); id_lookup("sig_atomic_t",NULL,raw_int); @@ -490,24 +466,21 @@ id_lookup("signed",NULL,raw_int); id_lookup("size_t",NULL,raw_int); id_lookup("sizeof",NULL,sizeof_like); id_lookup("static",NULL,int_like); -id_lookup("static_assert",NULL,sizeof_like); id_lookup("static_cast",NULL,raw_int); id_lookup("struct",NULL,struct_like); id_lookup("switch",NULL,for_like); id_lookup("template",NULL,template_like); id_lookup("this",NULL,custom); -id_lookup("thread_local",NULL,raw_int); id_lookup("throw",NULL,case_like); id_lookup("time_t",NULL,raw_int); -id_lookup("true",NULL,normal); id_lookup("try",NULL,else_like); id_lookup("typedef",NULL,typedef_like); -id_lookup("typeid",NULL,sizeof_like); +id_lookup("typeid",NULL,raw_int); id_lookup("typename",NULL,struct_like); id_lookup("undef",NULL,if_like); id_lookup("union",NULL,struct_like); id_lookup("unsigned",NULL,raw_int); -id_lookup("using",NULL,using_like); +id_lookup("using",NULL,int_like); id_lookup("va_dcl",NULL,decl); /* Berkeley's variable-arg-list convention */ id_lookup("va_list",NULL,raw_int); /* ditto */ id_lookup("virtual",NULL,int_like); @@ -518,8 +491,6 @@ id_lookup("while",NULL,for_like); id_lookup("xor",NULL,alfop); id_lookup("xor_eq",NULL,alfop);@+ res_wd_end=name_ptr; id_lookup("TeX",NULL,custom); -id_lookup("complex",NULL,int_like); -id_lookup("imaginary",NULL,int_like); id_lookup("make_pair",NULL,func_template); @* Lexical scanning. @@ -542,11 +513,11 @@ scanning routines. @^ASCII code dependencies@> @d ignore 00 /* control code of no interest to \.{CWEAVE} */ -@d verbatim 02 /* takes the place of ASCII \.{STX} */ +@d verbatim 02 /* takes the place of extended ASCII \.{\char2} */ @d begin_short_comment 03 /* \CPLUSPLUS/ short comment */ @d begin_comment '\t' /* tab marks will not appear */ @d underline '\n' /* this code will be intercepted without confusion */ -@d noop 0177 /* takes the place of ASCII \.{DEL} */ +@d noop 0177 /* takes the place of ASCII delete */ @d xref_roman 0203 /* control code for `\.{@@\^}' */ @d xref_wildcard 0204 /* control code for `\.{@@:}' */ @d xref_typewriter 0205 /* control code for `\.{@@.}' */ @@ -578,7 +549,7 @@ representation by means of the table |ccode|. static eight_bits ccode[256]; /* meaning of a char following \.{@@} */ @ @<Set ini...@>= -{int c; for (c=0; c<256; c++) ccode[c]=ignore;} +{int c; for (c=0; c<256; c++) ccode[c]=0;} ccode[' ']=ccode['\t']=ccode['\n']=ccode['\v']=ccode['\r']=ccode['\f'] =ccode['*']=new_section; ccode['@@']='@@'; /* `quoted' at sign */ @@ -700,6 +671,13 @@ static char cur_section_char; /* the character just before that name */ @ As one might expect, |get_next| consists mostly of a big switch that branches to the various special cases that can arise. +\CEE/ allows underscores to appear in identifiers, and some \CEE/ +compilers even allow the dollar sign. + +@d isxalpha(c) ((c)=='_' || (c)=='$') + /* non-alpha characters allowed in identifier */ +@d ishigh(c) ((eight_bits)(c)>0177) +@^high-bit character handling@> @c static eight_bits @@ -716,7 +694,7 @@ get_next(void) /* produces the next input token */ || ((c=='u' && *loc=='8')&&(*(loc+1)=='\'' || *(loc+1)=='"'))@| || (c=='<' && sharp_include_line==true)) @<Get a string@>@; - else if (isalpha(c) || isxalpha(c) || ishigh(c)) + else if (xisalpha(c) || isxalpha(c) || ishigh(c)) @<Get an identifier@>@; else if (c=='@@') @<Get control code and possible section name@>@; else if (xisspace(c)) continue; /* ignore spaces and tabs */ @@ -755,8 +733,7 @@ a file name in lines that start with \.{\#include}. We must treat this file name as a string. @<Private...@>= -static boolean sharp_include_line=false; - /* are we scanning a \#\&{include} line? */ +static boolean sharp_include_line=false; /* are we scanning a \&{\#include} line? */ @ @<Check if next token is |include|@>= while (loc<=buffer_end-7 && xisspace(*loc)) loc++; @@ -781,25 +758,26 @@ combinations \.{...}, \.{::}, \.{.*} and \.{->*}. The compound assignment operators (e.g., \.{+=}) are treated as separate tokens. +@d compress(c) if (loc++<=limit) return c + @<Compress tw...@>= switch(c) { - case '/': if (*loc=='*') {@+compress(begin_comment);@+} + case '/': if (*loc=='*') {compress(begin_comment);} else if (*loc=='/') compress(begin_short_comment); break; case '+': if (*loc=='+') compress(plus_plus); break; - case '-': if (*loc=='-') {@+compress(minus_minus);@+} - else if (*loc=='>') { - if (*(loc+1)=='*') {loc++;@+compress(minus_gt_ast);} - else compress(minus_gt); - } break; - case '.': if (*loc=='*') {@+compress(period_ast);@+} + case '-': if (*loc=='-') {compress(minus_minus);} + else { if (*loc=='>') { if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);} + else compress(minus_gt); } } break; + case '.': if (*loc=='*') {compress(period_ast);} else if (*loc=='.' && *(loc+1)=='.') { - loc++;@+compress(dot_dot_dot); - } break; + loc++; compress(dot_dot_dot); + } + break; case ':': if (*loc==':') compress(colon_colon); break; case '=': if (*loc=='=') compress(eq_eq); break; - case '>': if (*loc=='=') {@+compress(gt_eq);@+} + case '>': if (*loc=='=') {compress(gt_eq);} else if (*loc=='>') compress(gt_gt); break; - case '<': if (*loc=='=') {@+compress(lt_eq);@+} + case '<': if (*loc=='=') {compress(lt_eq);} else if (*loc=='<') compress(lt_lt); break; case '&': if (*loc=='&') compress(and_and); break; case '|': if (*loc=='|') compress(or_or); break; @@ -808,9 +786,7 @@ switch(c) { @ @<Get an identifier@>= { id_first=--loc; - do { - ++loc; - } while (isalpha((eight_bits)*loc) || isdigit((eight_bits)*loc) @| + while (isalpha((eight_bits)*++loc) || isdigit((eight_bits)*loc) @| || isxalpha((eight_bits)*loc) || ishigh((eight_bits)*loc)); id_loc=loc; return identifier; } @@ -822,38 +798,28 @@ introduced by \.0 and hexadecimals by \.{0x}, but \.{CWEAVE} will print with \TEX/ macros that the user can redefine to fit the context. In order to simplify such macros, we replace some of the characters. -On output, the \.{\ } that replaces \.{'} in \CPLUSPLUS/ literals will become -``\.{\\\ }''. - Notice that in this section and the next, |id_first| and |id_loc| are pointers into the array |section_text|, not into |buffer|. -@d gather_digits_while(t) while (t || *loc=='\'') - if (*loc=='\'') { /* \CPLUSPLUS/-style digit separator */ - *id_loc++=' '; loc++; /* insert a little bit of space */ - }@+else *id_loc++=*loc++; - @<Get a constant@>= { id_first=id_loc=section_text+1; - if (*(loc-1)=='.' && !xisdigit(*loc)) goto mistake; /* not a constant */ if (*(loc-1)=='0') { - if (*loc=='x' || *loc=='X') @<Get a hexadecimal constant@>@; - else if (*loc=='b' || *loc=='B') @<Get a binary constant@>@; - else if (xisdigit(*loc)) @<Get an octal constant@>@; + if (*loc=='x' || *loc=='X') {*id_loc++='^'; loc++; + while (xisxdigit(*loc)) *id_loc++=*loc++;} /* hex constant */ + else if (xisdigit(*loc)) {*id_loc++='~'; + while (xisdigit(*loc)) *id_loc++=*loc++;} /* octal constant */ + else goto dec; /* decimal constant */ + } + else { /* decimal constant */ + if (*(loc-1)=='.' && !xisdigit(*loc)) goto mistake; /* not a constant */ + dec: *id_loc++=*(loc-1); + while (xisdigit(*loc) || *loc=='.') *id_loc++=*loc++; + if (*loc=='e' || *loc=='E') { /* float constant */ + *id_loc++='_'; loc++; + if (*loc=='+' || *loc=='-') *id_loc++=*loc++; + while (xisdigit(*loc)) *id_loc++=*loc++; + } } - *id_loc++=*(loc-1); /* decimal constant */ - gather_digits_while(xisdigit(*loc) || *loc=='.'); -get_exponent: - if (*loc=='e' || *loc=='E') - *id_loc++='_'; - else if (*loc=='p' || *loc=='P') - *id_loc++='%'; - else - goto digit_suffix; - loc++; - if (*loc=='+' || *loc=='-') *id_loc++=*loc++; - gather_digits_while(xisdigit(*loc)); -digit_suffix: while (*loc=='u' || *loc=='U' || *loc=='l' || *loc=='L' || *loc=='f' || *loc=='F') { *id_loc++='$'; *id_loc++=toupper((eight_bits)*loc); loc++; @@ -861,37 +827,22 @@ digit_suffix: return constant; } -@ @<Get a hex...@>={ - *id_loc++='^'; loc++; - gather_digits_while(xisxdigit(*loc) || *loc=='.'); - *id_loc++='/'; goto get_exponent; -} - -@ @<Get a bin...@>={ - *id_loc++='\\'; loc++; - gather_digits_while(*loc=='0' || *loc=='1'); - *id_loc++='/'; goto digit_suffix; -} - -@ @<Get an oct...@>={ - *id_loc++='~'; gather_digits_while(xisdigit(*loc)); - *id_loc++='/'; goto digit_suffix; -} - @ \CEE/ strings and character constants, delimited by double and single quotes, respectively, can contain newlines or instances of their own delimiters if they are protected by a backslash. We follow this convention, but do not allow the string to be longer than |longest_name|. -@<Get a string@>= {@+ +@<Get a string@>= { char delim = c; /* what started the string */ id_first = section_text+1; id_loc = section_text; if (delim=='\'' && *(loc-2)=='@@') {*++id_loc='@@'; *++id_loc='@@';} *++id_loc=delim; - if (delim=='L' || delim=='u' || delim=='U') - @<Get a wide character constant@>@; - if (delim=='<') delim='>'; /* for file names in \#\&{include} lines */ + if (delim=='L' || delim=='u' || delim=='U') { /* wide character constant */ + if (delim=='u' && *loc=='8') { *++id_loc=*loc++; } + delim=*loc++; *++id_loc=delim; + } + if (delim=='<') delim='>'; /* for file names in \&{\#include} lines */ while (true) { if (loc>=limit) { if(*(limit-1)!='\\') { @@ -907,14 +858,10 @@ convention, but do not allow the string to be longer than |longest_name|. if (++id_loc<=section_text_end) *id_loc=c; break; } - if (c=='\\') { - if (loc>=limit) continue; - else { - if (++id_loc<=section_text_end) { - *id_loc = '\\'; c=*loc++; - } - } - } + if (c=='\\') { if (loc>=limit) continue; + else { if (++id_loc<=section_text_end) { + *id_loc = '\\'; c=*loc++; + } } } if (++id_loc<=section_text_end) *id_loc=c; } if (id_loc>=section_text_end) { @@ -927,11 +874,6 @@ convention, but do not allow the string to be longer than |longest_name|. return string; } -@ @<Get a wide...@>={ - if (delim=='u' && *loc=='8') *++id_loc=*loc++; - delim=*loc++; *++id_loc=delim; -} - @ After an \.{@@} sign has been scanned, the next character tells us whether there is more work to do. @@ -943,7 +885,7 @@ whether there is more work to do. case underline: xref_switch=def_flag; continue; case trace: tracing=c-'0'; continue; case xref_roman: case xref_wildcard: case xref_typewriter: case noop: - case TeX_string: skip_restricted(); return ccode[(eight_bits)c]; + case TeX_string: c=ccode[(eight_bits)c]; skip_restricted(); return c; case section_name: @<Scan the section name and make |cur_section| point to it@>@; case verbatim: @<Scan a verbatim string@>@; @@ -960,9 +902,8 @@ because the section name might (for example) follow \&{int}. cur_section_char=*(loc-1); @<Put section name into |section_text|@>@; if (k-section_text>3 && strncmp(k-2,"...",3)==0) - cur_section=section_lookup(section_text+1,k-3,true); - /* |true| indicates a prefix */ - else cur_section=section_lookup(section_text+1,k,false); + cur_section=section_lookup(section_text+1,k-3,1); /* 1 indicates a prefix */ + else cur_section=section_lookup(section_text+1,k,0); xref_switch=0; return section_name; } @@ -1028,7 +969,8 @@ false_alarm: if (loc++>limit) { err_print("! Control text didn't end"); loc=limit; @.Control text didn't end@> - } else { + } + else { if (*loc=='@@'&&loc<=limit) {loc++; goto false_alarm;} if (*loc++!='>') err_print("! Control codes are forbidden in control text"); @@ -1125,8 +1067,8 @@ static void outer_xref(void); @ @c static void -C_xref( /* makes cross-references for \CEE/ identifiers */ - eight_bits spec_ctrl) +C_xref(@t\1\1@> /* makes cross-references for \CEE/ identifiers */ + eight_bits spec_ctrl@t\2\2@>) { name_pointer p; /* a referenced name */ while (next_control<format_code || next_control==spec_ctrl) { @@ -1355,7 +1297,7 @@ that is being output; in this case the breakpoint |b| should be strictly less than |out_buf_end|. If the |per_cent| parameter is |false|, trailing blanks are suppressed. The characters emptied from the buffer form a new line of output; -if the |carryover| parameter is |true|, a |"%"| in that line will be +if the |carryover| parameter is true, a |"%"| in that line will be carried over to the next line (so that \TEX/ will ignore the completion of commented-out text). @@ -1371,11 +1313,11 @@ static void finish_line(void); @ @c static void -flush_buffer( +flush_buffer(@t\1\1@> char *b, /* outputs from |out_buf+1| to |b|, where |b<=out_ptr| */ -boolean per_cent,boolean carryover) +boolean per_cent,boolean carryover@t\2\2@>) { - char *j=b; /* pointer into |out_buf| */ + char *j; j=b; /* pointer into |out_buf| */ if (! per_cent) /* remove trailing blanks */ while (j>out_buf && *j==' ') j--; c_line_write(j-out_buf); @@ -1436,8 +1378,8 @@ static void break_out(void); @ @c static void -out_str( /* output characters from |s| to end of string */ -const char*s) +out_str(@t\1\1@> /* output characters from |s| to end of string */ +const char*s@t\2\2@>) { while (*s) out(*s++); } @@ -1604,9 +1546,9 @@ one further token without overflow. @d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow("token"); *(tok_ptr++)=c;} @c -static int copy_comment( /* copies \TeX\ code in comments */ +static int copy_comment(@t\1\1@> /* copies \TeX\ code in comments */ boolean is_long_comment, /* is this a traditional \CEE/ comment? */ -int bal) /* brace balance */ +int bal@t\2\2@>) /* brace balance */ { char c; /* current character being copied */ while (true) { @@ -1617,7 +1559,8 @@ int bal) /* brace balance */ @.Input ended in mid-comment@> loc=buffer+1; goto done; } - } else { + } + else { if (bal>1) err_print("! Missing } in comment"); @.Missing \} in comment@> goto done; @@ -1640,7 +1583,7 @@ int bal) /* brace balance */ } } } -done: @<Clear |bal| and |return|@>@; +done:@<Clear |bal| and |return|@>@; } @ @<Check for end of comment@>= @@ -1658,11 +1601,9 @@ if (c=='@@') { @.Illegal use of @@...@> loc-=2; if (phase==2) *(tok_ptr-1)=' '; goto done; } -} else { - if (c=='\\' && *loc!='@@') { - if (phase==2) app_tok(*(loc++))@; else loc++; - } } +else { if (c=='\\' && *loc!='@@') { + if (phase==2) app_tok(*(loc++))@; else loc++; } } @ We output enough right braces to keep \TEX/ happy. @@ -1742,8 +1683,8 @@ same initial letter; these subscripts are assigned from left to right. @d rbrace 8 /* denotes a right brace */ @d decl_head 9 /* denotes an incomplete declaration */ @d comma 10 /* denotes a comma */ -@d lpar 11 /* denotes a left parenthesis */ -@d rpar 12 /* denotes a right parenthesis */ +@d lpar 11 /* denotes a left parenthesis or left bracket */ +@d rpar 12 /* denotes a right parenthesis or right bracket */ @d prelangle 13 /* denotes `$<$' before we know what it is */ @d prerangle 14 /* denotes `$>$' before we know what it is */ @d langle 15 /* denotes `$<$' when it's used as angle bracket in a template */ @@ -1765,13 +1706,10 @@ same initial letter; these subscripts are assigned from left to right. @d insert 37 /* a scrap that gets combined with its neighbor */ @d section_scrap 38 /* section name */ @d dead 39 /* scrap that won't combine */ -@d ftemplate 63 /* \\{make\_pair} */ -@d new_exp 64 /* \&{new} and a following type identifier */ -@d begin_arg 65 /* \.{@@[} */ -@d end_arg 66 /* \.{@@]} */ -@d lbrack 67 /* denotes a left bracket */ -@d rbrack 68 /* denotes a right bracket */ -@d attr_head 69 /* denotes beginning of attribute */ +@d ftemplate 59 /* \\{make\_pair} */ +@d new_exp 60 /* \&{new} and a following type identifier */ +@d begin_arg 61 /* \.{@@[} */ +@d end_arg 62 /* \.{@@]} */ @<Private...@>= static char cat_name[256][12]; @@ -1836,21 +1774,14 @@ static char cat_name[256][12]; strcpy(cat_name[new_exp],"new_exp"); strcpy(cat_name[begin_arg],"@@["@q]@>); strcpy(cat_name[end_arg],@q[@>"@@]"); - 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. @c static void -print_cat( /* symbolic printout of a category */ -eight_bits c) +print_cat(@t\1\1@> /* symbolic printout of a category */ +eight_bits c@t\2\2@>) { fputs(cat_name[c],stdout); } @@ -1882,9 +1813,7 @@ $10n$; \yskip\hang |indent| causes future lines to be indented one more em; -\yskip\hang |outdent| causes future lines to be indented one less em; - -\yskip\hang |dindent| causes future lines to be indented two more ems. +\yskip\hang |outdent| causes future lines to be indented one less em. \yskip\noindent All of these tokens are removed from the \TEX/ output that comes from \CEE/ text between \pb\ signs; |break_space| and |force| and @@ -1898,10 +1827,6 @@ However, a sequence of consecutive `\.\ ', |break_space|, |force|, and/or |big_force| tokens is first replaced by a single token (the maximum of the given ones). -A |dindent| token becomes \.{\\1\\1}. It is equivalent to a pair of |indent| -tokens. However, if |dindent| immediately precedes |big_force|, the two tokens -are swapped, so that the indentation happens after the line break. - The token |math_rel| will be translated into \.{\\MRL\{}, and it will get a matching \.\} later. Other control sequences in the \TEX/ output will be @@ -1929,7 +1854,6 @@ reserved words, `\.{\\.\{}$\,\ldots\,$\.\}' surrounding strings, @d end_translation 0223 /* special sentinel token at end of list */ @d inserted 0224 /* sentinel to mark translations of inserts */ @d qualifier 0225 /* introduces an explicit namespace qualifier */ -@d dindent 0226 /* two more tabs (\.{\\1\\1}) */ @ The raw input is converted into scraps according to the following table, which gives category codes followed by the translations. @@ -1968,14 +1892,11 @@ with discretionary breaks in between. \.{@@=}string\.{@@>}&|exp|: \.{\\vb\{}string with special characters quoted\.\}&maybe\cr \.{@@'7'}&|exp|: \.{\\.\{@@'7'\}}&maybe\cr -\.{077} or \.{\\77}&|exp|: \.{\\T\{\\\~77/\}}&maybe\cr -\.{0x7f}&|exp|: \.{\\T\{\\\^7f/\}}&maybe\cr -\.{0b10111}&|exp|: \.{\\T\{\\\\10111/\}}&maybe\cr +\.{077} or \.{\\77}&|exp|: \.{\\T\{\\\~77\}}&maybe\cr +\.{0x7f}&|exp|: \.{\\T\{\\\^7f\}}&maybe\cr \.{77}&|exp|: \.{\\T\{77\}}&maybe\cr \.{77L}&|exp|: \.{\\T\{77\\\$L\}}&maybe\cr \.{0.1E5}&|exp|: \.{\\T\{0.1\\\_5\}}&maybe\cr -\.{0x10p3}&|exp|: \.{\\T\{\\\^10/\\\%3\}}&maybe\cr -\.{1'000'000}&|exp|: \.{\\T\{1\\\ 000\\\ 000\}}&maybe\cr \.+&|ubinop|: \.+&yes\cr \.-&|ubinop|: \.-&yes\cr \.*&|raw_ubin|: \.*&yes\cr @@ -1992,9 +1913,9 @@ with discretionary breaks in between. \.\~&|unop|: \.{\\CM}&yes\cr \.\&&|raw_ubin|: \.{\\AND}&yes\cr \.(&|lpar|: \.(&maybe\cr +\.[&|lpar|: \.[&maybe\cr \.)&|rpar|: \.)&maybe\cr -\.[&|lbrack|: \.[&maybe\cr -\.]&|rbrack|: \.]&maybe\cr +\.]&|rpar|: \.]&maybe\cr \.\{&|lbrace|: \.\{&yes\cr \.\}&|lbrace|: \.\}&yes\cr \.,&|comma|: \.,&yes\cr @@ -2005,8 +1926,6 @@ with discretionary breaks in between. end of \.\# line&|rproc|: |force|&no\cr identifier&|exp|: \.{\\\\\{}identifier with underlines and dollar signs quoted\.\}&maybe\cr -\.{alignas}&|alignas_like|: \stars&maybe\cr -\.{alignof}&|sizeof_like|: \stars&maybe\cr \.{and}&|alfop|: \stars&yes\cr \.{and\_eq}&|alfop|: \stars&yes\cr \.{asm}&|sizeof_like|: \stars&maybe\cr @@ -2018,25 +1937,13 @@ identifier&|exp|: \.{\\\\\{}identifier with underlines and \.{case}&|case_like|: \stars&maybe\cr \.{catch}&|catch_like|: \stars&maybe\cr \.{char}&|raw_int|: \stars&maybe\cr -\.{char8\_t}&|raw_int|: \stars&maybe\cr -\.{char16\_t}&|raw_int|: \stars&maybe\cr -\.{char32\_t}&|raw_int|: \stars&maybe\cr \.{class}&|struct_like|: \stars&maybe\cr \.{clock\_t}&|raw_int|: \stars&maybe\cr \.{compl}&|alfop|: \stars&yes\cr -\.{complex}&|int_like|: \stars&yes\cr -\.{concept}&|int_like|: \stars&maybe\cr \.{const}&|const_like|: \stars&maybe\cr -\.{consteval}&|const_like|: \stars&maybe\cr -\.{constexpr}&|const_like|: \stars&maybe\cr -\.{constinit}&|const_like|: \stars&maybe\cr \.{const\_cast}&|raw_int|: \stars&maybe\cr \.{continue}&|case_like|: \stars&maybe\cr -\.{co\_await}&|case_like|: \stars&maybe\cr -\.{co\_return}&|case_like|: \stars&maybe\cr -\.{co\_yield}&|case_like|: \stars&maybe\cr -\.{decltype}&|sizeof_like|: \stars&maybe\cr -\.{default}&|default_like|: \stars&maybe\cr +\.{default}&|case_like|: \stars&maybe\cr \.{define}&|define_like|: \stars&maybe\cr \.{defined}&|sizeof_like|: \stars&maybe\cr \.{delete}&|delete_like|: \stars&maybe\cr @@ -2053,7 +1960,6 @@ identifier&|exp|: \.{\\\\\{}identifier with underlines and \.{export}&|int_like|: \stars&maybe\cr \.{extern}&|int_like|: \stars&maybe\cr \.{FILE}&|raw_int|: \stars&maybe\cr -\.{false}&|normal|: \stars&maybe\cr \.{float}&|raw_int|: \stars&maybe\cr \.{for}&|for_like|: \stars&maybe\cr \.{fpos\_t}&|raw_int|: \stars&maybe\cr @@ -2062,7 +1968,6 @@ identifier&|exp|: \.{\\\\\{}identifier with underlines and \.{if}&|if_like|: \stars&maybe\cr \.{ifdef}&|if_like|: \stars&maybe\cr \.{ifndef}&|if_like|: \stars&maybe\cr -\.{imaginary}&|int_like|: \stars&maybe\cr \.{include}&|if_like|: \stars&maybe\cr \.{inline}&|int_like|: \stars&maybe\cr \.{int}&|raw_int|: \stars&maybe\cr @@ -2074,11 +1979,9 @@ identifier&|exp|: \.{\\\\\{}identifier with underlines and \.{mutable}&|int_like|: \stars&maybe\cr \.{namespace}&|struct_like|: \stars&maybe\cr \.{new}&|new_like|: \stars&maybe\cr -\.{noexcept}&|attr|: \stars&maybe\cr \.{not}&|alfop|: \stars&yes\cr \.{not\_eq}&|alfop|: \stars&yes\cr \.{NULL}&|exp|: \.{\\NULL}&yes\cr -\.{nullptr}&|exp|: \.{\\NULL}&yes\cr \.{offsetof}&|raw_int|: \stars&maybe\cr \.{operator}&|operator_like|: \stars&maybe\cr \.{or}&|alfop|: \stars&yes\cr @@ -2090,8 +1993,6 @@ identifier&|exp|: \.{\\\\\{}identifier with underlines and \.{public}&|public_like|: \stars&maybe\cr \.{register}&|int_like|: \stars&maybe\cr \.{reinterpret\_cast}&|raw_int|: \stars&maybe\cr -\.{requires}&|int_like|: \stars&maybe\cr -\.{restrict}&|int_like|: \stars&maybe\cr \.{return}&|case_like|: \stars&maybe\cr \.{short}&|raw_int|: \stars&maybe\cr \.{sig\_atomic\_t}&|raw_int|: \stars&maybe\cr @@ -2099,24 +2000,22 @@ identifier&|exp|: \.{\\\\\{}identifier with underlines and \.{size\_t}&|raw_int|: \stars&maybe\cr \.{sizeof}&|sizeof_like|: \stars&maybe\cr \.{static}&|int_like|: \stars&maybe\cr -\.{static\_assert}&|sizeof_like|: \stars&maybe\cr \.{static\_cast}&|raw_int|: \stars&maybe\cr \.{struct}&|struct_like|: \stars&maybe\cr \.{switch}&|for_like|: \stars&maybe\cr \.{template}&|template_like|: \stars&maybe\cr \.{TeX}&|exp|: \.{\\TeX}&yes\cr \.{this}&|exp|: \.{\\this}&yes\cr -\.{thread\_local}&|raw_int|: \stars&maybe\cr \.{throw}&|case_like|: \stars&maybe\cr \.{time\_t}&|raw_int|: \stars&maybe\cr \.{try}&|else_like|: \stars&maybe\cr \.{typedef}&|typedef_like|: \stars&maybe\cr -\.{typeid}&|sizeof_like|: \stars&maybe\cr +\.{typeid}&|raw_int|: \stars&maybe\cr \.{typename}&|struct_like|: \stars&maybe\cr \.{undef}&|if_like|: \stars&maybe\cr \.{union}&|struct_like|: \stars&maybe\cr \.{unsigned}&|raw_int|: \stars&maybe\cr -\.{using}&|using_like|: \stars&maybe\cr +\.{using}&|int_like|: \stars&maybe\cr \.{va\_dcl}&|decl|: \stars&maybe\cr \.{va\_list}&|raw_int|: \stars&maybe\cr \.{virtual}&|int_like|: \stars&maybe\cr @@ -2238,8 +2137,8 @@ translated without line-break controls. @c static void -print_text( /* prints a token list for debugging; not used in |main| */ -text_pointer p) +print_text(@t\1\1@> /* prints a token list for debugging; not used in |main| */ +text_pointer p@t\2\2@>) { token_pointer j; /* index into |tok_mem| */ sixteen_bits r; /* remainder of token after the flag has been stripped off */ @@ -2251,7 +2150,7 @@ text_pointer p) break; /* |id_flag| */ case 2: printf("\\&{"@q}@>); print_id((name_dir+r)); printf(@q{@>"}"); break; /* |res_flag| */ - case 3: putchar('<'); print_section_name((name_dir+r)); putchar('>'); + case 3: printf("<"); print_section_name((name_dir+r)); printf(">"); break; /* |section_flag| */ case 4: printf("[[%d]]",r); break; /* |tok_flag| */ case 5: printf("|[[%d]]|",r); break; /* |inner_tok_flag| */ @@ -2270,7 +2169,6 @@ switch (r) { case cancel: printf("[cancel]"); break; case indent: printf("[indent]"); break; case outdent: printf("[outdent]"); break; - case dindent: printf("[dindent]"); break; case backup: printf("[backup]"); break; case opt: printf("[opt]"); break; case break_space: printf("[break]"); break; @@ -2280,7 +2178,7 @@ switch (r) { case quoted_char: j++; printf("[%o]",(unsigned int)*j); break; case end_translation: printf("[quit]"); break; case inserted: printf("[inserted]"); break; - default: putchar(r); + default: putxchar(r); } @ The production rules listed above are embedded directly into \.{CWEAVE}, @@ -2355,9 +2253,8 @@ productions as they were listed earlier. @d no_math 2 /* should be in horizontal mode */ @d yes_math 1 /* should be in math mode */ @d maybe_math 0 /* works in either horizontal or math mode */ -@d big_app2(a) big_app1(a);@+big_app1(a+1) -@d big_app3(a) big_app2(a);@+big_app1(a+2) -@d big_app1_insert(p,c) big_app1(p);@+big_app(c);@+big_app1(p+1) +@d big_app2(a) big_app1(a);big_app1(a+1) +@d big_app3(a) big_app2(a);big_app1(a+2) @d app(a) *(tok_ptr++)=(token)(a) @d app1(a) *(tok_ptr++)=(token)(tok_flag+(int)((a)->trans-tok_start)) @@ -2381,12 +2278,12 @@ static void big_app( token a) { - if (a==' ' || (a>=big_cancel && a<=big_force) || a==dindent) - /* non-math token */ { + if (a==' ' || (a>=big_cancel && a<=big_force)) /* non-math token */ { if (cur_mathness==maybe_math) init_mathness=no_math; else if (cur_mathness==yes_math) app_str("{}$"); cur_mathness=no_math; - } else { + } + else { if (cur_mathness==maybe_math) init_mathness=yes_math; else if (cur_mathness==no_math) app_str("${}"); cur_mathness=yes_math; @@ -2423,7 +2320,7 @@ code needs to be provided with a proper environment. @d cat2 (pp+2)->cat @d cat3 (pp+3)->cat @d lhs_not_simple (pp->cat!=public_like - && pp->cat!=semi + && pp->cat!=semi && pp->cat!=prelangle && pp->cat!=prerangle @| && pp->cat!=template_like @@ -2440,8 +2337,6 @@ code needs to be provided with a proper environment. if (cat1==end_arg && lhs_not_simple) if (pp->cat==begin_arg) squash(pp,2,exp,-2,124); else squash(pp,2,end_arg,-1,125); - else if (pp->cat==rbrack) squash(pp,1,rpar,-3,130); - else if (pp->cat==using_like) squash(pp,1,int_like,-3,140); else if (cat1==insert) squash(pp,2,pp->cat,-2,0); else if (cat2==insert) squash(pp+1,2,(pp+1)->cat,-1,0); else if (cat3==insert) squash(pp+2,2,(pp+2)->cat,0,0); @@ -2494,11 +2389,6 @@ code needs to be provided with a proper environment. case typedef_like: @<Cases for |typedef_like|@>@; @+break; case delete_like: @<Cases for |delete_like|@>@; @+break; case question: @<Cases for |question|@>@; @+break; - case alignas_like: @<Cases for |alignas_like|@>@; @+break; - case lbrack: @<Cases for |lbrack|@>@; @+break; - case attr_head: @<Cases for |attr_head|@>@; @+break; - case attr: @<Cases for |attr|@>@; @+break; - case default_like: @<Cases for |default_like|@>@; @+break; } pp++; /* if no match was found, we move to the right */ } @@ -2567,8 +2457,8 @@ the |for| loop below. @c static void -make_reserved( /* make the first identifier in |p->trans| like |int| */ -scrap_pointer p) +make_reserved(@t\1\1@> /* make the first identifier in |p->trans| like |int| */ +scrap_pointer p@t\2\2@>) { sixteen_bits tok_value; /* the name of this identifier, plus its flag */ token_pointer tok_loc; /* pointer to |tok_value| */ @@ -2598,9 +2488,9 @@ it has been swallowed up by an |exp|. @c static void -make_underlined( +make_underlined(@t\1\1@> /* underline the entry for the first identifier in |p->trans| */ -scrap_pointer p) +scrap_pointer p@t\2\2@>) { token_pointer tok_loc; /* where the first identifier appears */ if ((tok_loc=find_first_ident(p->trans))<=operator_found) @@ -2645,11 +2535,11 @@ to insert the new cross-reference not at the beginning of the list (namely, at |p->xref|), but rather right before |q|. @<Insert new cross-reference at |q|...@>= -append_xref(0); /* this number doesn't matter */ -xref_ptr->xlink=(xref_pointer)p->xref; r=xref_ptr; -update_node(p); -while (r->xlink!=q) {r->num=r->xlink->num; r=r->xlink;} -r->num=m; /* everything from |q| on is left undisturbed */ + append_xref(0); /* this number doesn't matter */ + xref_ptr->xlink=(xref_pointer)p->xref; r=xref_ptr; + update_node(p); + while (r->xlink!=q) {r->num=r->xlink->num; r=r->xlink;} + r->num=m; /* everything from |q| on is left undisturbed */ @ Now comes the code that tries to match each production starting with a particular type of scrap. Whenever a match is discovered, @@ -2658,7 +2548,7 @@ to be performed, followed by |goto found|. @<Cases for |exp|@>= if (cat1==lbrace || cat1==int_like || cat1==decl) { - make_underlined(pp); big_app(dindent); big_app1(pp); + make_underlined(pp); big_app1(pp); big_app(indent); app(indent); reduce(pp,1,fn_decl,0,1); } else if (cat1==unop) squash(pp,2,exp,-2,2); @@ -2672,20 +2562,16 @@ else if (cat1==lpar && cat2==rpar && cat3==colon) squash(pp+3,1,base,0,5); else if (cat1==cast && cat2==colon) squash(pp+2,1,base,0,5); else if (cat1==semi) squash(pp,2,stmt,-1,6); else if (cat1==colon) { - make_underlined (pp); squash(pp,2,tag,-1,7); + make_underlined (pp); squash(pp,2,tag,-1,7); } else if (cat1==rbrace) squash(pp,1,stmt,-1,8); else if (cat1==lpar && cat2==rpar && (cat3==const_like || cat3==case_like)) { - big_app1_insert(pp+2,' '); reduce(pp+2,2,rpar,0,9); + big_app1(pp+2); big_app(' '); big_app1(pp+3); reduce(pp+2,2,rpar,0,9); } else if (cat1==cast && (cat2==const_like || cat2==case_like)) { - big_app1_insert(pp+1,' '); reduce(pp+1,2,cast,0,9); + big_app1(pp+1); big_app(' '); big_app1(pp+2); reduce(pp+1,2,cast,0,9); } else if (cat1==exp || cat1==cast) squash(pp,2,exp,-2,10); -else if (cat1==attr) { - big_app1_insert(pp,' '); reduce(pp,2,exp,-2,142); -} -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); @@ -2708,13 +2594,15 @@ if (cat1==exp || cat1==int_like) squash(pp,2,exp,-2,16); @ @<Cases for |ubinop|@>= if (cat1==cast && cat2==rpar) { - big_app('{'); big_app1_insert(pp,'}'); reduce(pp,2,cast,-2,17); + big_app('{'); big_app1(pp); big_app('}'); big_app1(pp+1); + reduce(pp,2,cast,-2,17); } else if (cat1==exp || cat1==int_like) { - big_app('{'); big_app1_insert(pp,'}'); reduce(pp,2,cat1,-2,18); + big_app('{'); big_app1(pp); big_app('}'); big_app1(pp+1); + reduce(pp,2,cat1,-2,18); } else if (cat1==binop) { - big_app(math_rel); big_app1_insert(pp,'{'); big_app('}'); + big_app(math_rel); big_app1(pp); big_app('{'); big_app1(pp+1); big_app('}'); big_app('}'); reduce(pp,2,binop,-1,19); } @@ -2728,19 +2616,19 @@ 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(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,exp,-2,21); } else if (cat1==semi) squash(pp,1,exp,-2,22); @ @<Cases for |sizeof_like|@>= if (cat1==cast) squash(pp,2,exp,-2,23); else if (cat1==exp) { - big_app1_insert(pp,' '); reduce(pp,2,exp,-2,24); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,exp,-2,24); } @ @<Cases for |int_like|@>= if (cat1==int_like|| cat1==struct_like) { - big_app1_insert(pp,' '); reduce(pp,2,cat1,-2,25); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,cat1,-2,25); } else if (cat1==exp && (cat2==raw_int||cat2==struct_like)) squash(pp,2,int_like,-2,26); @@ -2756,15 +2644,15 @@ else squash(pp,1,int_like,-2,30); @ @<Cases for |colcol|@>= if (cat1==exp||cat1==int_like) { app(qualifier); squash(pp,2,cat1,-2,31); -} -else if (cat1==colcol) squash(pp,2,colcol,-1,32); +}@+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); } else if (cat1==ubinop) { - big_app1_insert(pp,'{'); big_app('}'); reduce(pp,2,decl_head,-1,34); + big_app1(pp); big_app('{'); big_app1(pp+1); big_app('}'); + reduce(pp,2,decl_head,-1,34); } else if (cat1==exp && cat2!=lpar && cat2!=exp && cat2!=cast) { make_underlined(pp+1); squash(pp,2,decl_head,-1,35); @@ -2774,19 +2662,18 @@ else if ((cat1==binop||cat1==colon) && cat2==exp && (cat3==comma || 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) { - big_app(dindent); big_app1(pp); reduce(pp,1,fn_decl,0,38); + big_app1(pp); big_app(indent); app(indent); reduce(pp,1,fn_decl,0,38); } else if (cat1==semi) squash(pp,2,decl,-1,39); -else if (cat1==attr) { - big_app1_insert(pp,' '); reduce(pp,2,decl_head,-1,139); -} @ @<Cases for |decl|@>= if (cat1==decl) { - big_app1_insert(pp,force); reduce(pp,2,decl,-1,40); + big_app1(pp); big_app(force); big_app1(pp+1); + reduce(pp,2,decl,-1,40); } else if (cat1==stmt || cat1==function) { - big_app1_insert(pp,big_force); reduce(pp,2,cat1,-1,41); + big_app1(pp); big_app(big_force); + big_app1(pp+1); reduce(pp,2,cat1,-1,41); } @ @<Cases for |base|@>= @@ -2796,19 +2683,19 @@ if (cat1==int_like || cat1==exp) { app(opt); app('9'); reduce(pp,3,base,0,42); } else if (cat2==lbrace) { - big_app1_insert(pp,' '); big_app(' '); big_app1(pp+2); + big_app1(pp); big_app(' '); big_app1(pp+1); big_app(' '); big_app1(pp+2); reduce(pp,3,lbrace,-2,43); } } @ @<Cases for |struct_like|@>= if (cat1==lbrace) { - big_app1_insert(pp,' '); reduce(pp,2,struct_head,0,44); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,struct_head,0,44); } else if (cat1==exp||cat1==int_like) { if (cat2==lbrace || cat2==semi) { make_underlined(pp+1); make_reserved(pp+1); - big_app1_insert(pp,' '); + big_app1(pp); big_app(' '); big_app1(pp+1); if (cat2==semi) reduce(pp,2,decl_head,0,45); else { big_app(' '); big_app1(pp+2);reduce(pp,3,struct_head,0,46); @@ -2816,20 +2703,14 @@ else if (cat1==exp||cat1==int_like) { } else if (cat2==colon) squash(pp+2,1,base,2,47); else if (cat2!=base) { - big_app1_insert(pp,' '); reduce(pp,2,int_like,-2,48); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,int_like,-2,48); } } -else if (cat1==attr) { - big_app1_insert(pp,' '); reduce(pp,2,struct_like,-3,141); -} -else if (cat1==struct_like) { - big_app1_insert(pp,' '); reduce(pp,2,struct_like,-3,151); -} @ @<Cases for |struct_head|@>= if ((cat1==decl || cat1==stmt || cat1==function) && cat2==rbrace) { big_app1(pp); big_app(indent); big_app(force); big_app1(pp+1); - big_app(outdent); big_app(force); big_app1(pp+2); + big_app(outdent); big_app(force); big_app1(pp+2); reduce(pp,3,int_like,-2,49); } else if (cat1==rbrace) { @@ -2840,19 +2721,16 @@ else if (cat1==rbrace) { @ @<Cases for |fn_decl|@>= if (cat1==decl) { - big_app1_insert(pp,force); reduce(pp,2,fn_decl,0,51); + big_app1(pp); big_app(force); big_app1(pp+1); reduce(pp,2,fn_decl,0,51); } else if (cat1==stmt) { big_app1(pp); app(outdent); app(outdent); big_app(force); big_app1(pp+1); reduce(pp,2,function,-1,52); } -else if (cat1==attr) { - big_app1_insert(pp,' '); reduce(pp,2,fn_decl,0,157); -} @ @<Cases for |function|@>= if (cat1==function || cat1==decl || cat1==stmt) { - big_app1_insert(pp,big_force); reduce(pp,2,cat1,-1,53); + big_app1(pp); big_app(big_force); big_app1(pp+1); reduce(pp,2,cat1,-1,53); } @ @<Cases for |lbrace|@>= @@ -2862,8 +2740,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_app1(pp+1); big_app(force); big_app(backup); big_app1(pp+2); + big_app(force); big_app1(pp); big_app(indent); big_app(force); + 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); } else if (cat1==exp) { @@ -2873,7 +2751,7 @@ else if (cat1==exp) { @ @<Cases for |if_like|@>= if (cat1==exp) { - big_app1_insert(pp,' '); reduce(pp,2,if_clause,0,57); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,if_clause,0,57); } @ @<Cases for |else_like|@>= @@ -2900,24 +2778,19 @@ else if (cat1==stmt) { big_app1(pp+1); big_app(outdent); big_app(force); big_app1(pp+2); if (cat3==if_like) { big_app(' '); big_app1(pp+3); reduce(pp,4,if_like,0,63); - } - else reduce(pp,3,else_like,0,64); + }@+else reduce(pp,3,else_like,0,64); } else squash(pp,1,else_like,0,65); } -else if (cat1==attr) { - big_app1_insert(pp,' '); reduce(pp,2,if_head,0,146); -} @ @<Cases for |if_head|@>= if (cat1==stmt || cat1==exp) { if (cat2==else_like) { big_app(force); big_app1(pp); big_app(break_space); app(noop); - big_app(cancel); big_app1_insert(pp+1,force); + big_app(cancel); big_app1(pp+1); big_app(force); big_app1(pp+2); if (cat3==if_like) { big_app(' '); big_app1(pp+3); reduce(pp,4,if_like,0,66); - } - else reduce(pp,3,else_like,0,67); + }@+else reduce(pp,3,else_like,0,67); } else squash(pp,1,else_head,0,68); } @@ -2933,23 +2806,22 @@ if (cat1==stmt && cat2==else_like && cat3==semi) { if (cat1==semi) squash(pp,2,stmt,-1,70); else if (cat1==colon) squash(pp,2,tag,-1,71); else if (cat1==exp) { - big_app1_insert(pp,' '); reduce(pp,2,exp,-2,72); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,exp,-2,72); } @ @<Cases for |catch_like|@>= if (cat1==cast || cat1==exp) { - big_app1_insert(pp,dindent); reduce(pp,2,fn_decl,0,73); + big_app2(pp); big_app(indent); big_app(indent); reduce(pp,2,fn_decl,0,73); } @ @<Cases for |tag|@>= if (cat1==tag) { - big_app1_insert(pp,break_space); reduce(pp,2,tag,-1,74); + big_app1(pp); big_app(break_space); big_app1(pp+1); reduce(pp,2,tag,-1,74); } else if (cat1==stmt||cat1==decl||cat1==function) { - big_app(force); big_app(backup); big_app1_insert(pp,break_space); - reduce(pp,2,cat1,-1,75); + big_app(force); big_app(backup); big_app1(pp); big_app(break_space); + big_app1(pp+1); reduce(pp,2,cat1,-1,75); } -else if (cat1==rbrace) squash(pp,1,decl,-1,156); @ The user can decide at run-time whether short statements should be grouped together on the same line. @@ -2961,8 +2833,12 @@ force_lines=true; @ @<Cases for |stmt|@>= if (cat1==stmt||cat1==decl||cat1==function) { - big_app1_insert(pp, (cat1==function || cat1==decl) ? big_force : - force_lines ? force : break_space); reduce(pp,2,cat1,-1,76); + big_app1(pp); + if (cat1==function) big_app(big_force); + else if (cat1==decl) big_app(big_force); + else if (force_lines) big_app(force); + else big_app(break_space); + big_app1(pp+1); reduce(pp,2,cat1,-1,76); } @ @<Cases for |semi|@>= @@ -2970,7 +2846,7 @@ big_app(' '); big_app1(pp); reduce(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==else_like || cat1==if_like ||cat1==define_like) squash(pp,2,lproc,0,78); else if (cat1==rproc) { app(inserted); big_app2(pp); reduce(pp,2,insert,-1,79); @@ -2980,7 +2856,7 @@ else if (cat1==rproc) { reduce(pp,3,insert,-1,80); } else if (cat2==exp && cat3==rproc && cat1==exp) { - app(inserted); big_app1_insert(pp,' '); app_str("\\5"); + app(inserted); big_app1(pp); big_app(' '); big_app1(pp+1); app_str(" \\5"); @.\\5@> big_app2(pp+2); reduce(pp,4,insert,-1,80); } @@ -3004,10 +2880,7 @@ app('<'); reduce(pp,1,binop,-2,84); init_mathness=cur_mathness=yes_math; app('>'); reduce(pp,1,binop,-2,85); -@ @d reserve_typenames flags['t'] - /* should we treat \&{typename} in a template like \&{typedef}? */ - -@<Cases for |langle|@>= +@ @<Cases for |langle|@>= if (cat1==prerangle) { big_app1(pp); app('\\'); app(','); big_app1(pp+1); @.\\,@> @@ -3019,42 +2892,31 @@ else if (cat1==decl_head || cat1==int_like || cat1==exp) { big_app3(pp); app(opt); app('9'); reduce(pp,3,langle,0,88); } } -else if (cat1==struct_like) { - if ((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); - else reduce(pp,4,cast,-1,154); - } -} @ @<Cases for |template_like|@>= if (cat1==exp && cat2==prelangle) squash(pp+2,1,langle,2,89); else if (cat1==exp || cat1==raw_int) { - big_app1_insert(pp,' '); reduce(pp,2,cat1,-2,90); -} -else if (cat1==cast && cat2==struct_like) { - big_app1_insert(pp,' '); reduce(pp,2,struct_like,0,155); -} -else squash(pp,1,raw_int,0,91); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,cat1,-2,90); +}@+ else squash(pp,1,raw_int,0,91); @ @<Cases for |new_like|@>= if (cat1==lpar && cat2==exp && cat3==rpar) squash(pp,4,new_like,0,92); else if (cat1==cast) { - big_app1_insert(pp,' '); reduce(pp,2,exp,-2,93); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,exp,-2,93); } else if (cat1!=lpar) squash(pp,1,new_exp,0,94); @ @<Cases for |new_exp|@>= if (cat1==int_like || cat1==const_like) { - big_app1_insert(pp,' '); reduce(pp,2,new_exp,0,95); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,new_exp,0,95); } else if (cat1==struct_like && (cat2==exp || cat2==int_like)) { - big_app1_insert(pp,' '); big_app(' '); + big_app1(pp); big_app(' '); big_app1(pp+1); big_app(' '); big_app1(pp+2); reduce(pp,3,new_exp,0,96); } else if (cat1==raw_ubin) { - big_app1_insert(pp,'{'); big_app('}'); reduce(pp,2,new_exp,0,97); + big_app1(pp); big_app('{'); big_app1(pp+1); big_app('}'); + reduce(pp,2,new_exp,0,97); } else if (cat1==lpar) squash(pp,1,exp,-2,98); else if (cat1==exp) { @@ -3069,15 +2931,14 @@ else squash(pp,1,exp,-2,101); @ @<Cases for |for_like|@>= if (cat1==exp) { - big_app1_insert(pp,' '); reduce(pp,2,else_like,-2,102); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,else_like,-2,102); } @ @<Cases for |raw_ubin|@>= if (cat1==const_like) { big_app2(pp); app_str("\\ "); reduce(pp,2,raw_ubin,0,103); @.\\\ @> -} -else squash(pp,1,ubinop,-2,104); +} else squash(pp,1,ubinop,-2,104); @ @<Cases for |const_like|@>= squash(pp,1,int_like,-2,105); @@ -3087,16 +2948,16 @@ if (cat1==prelangle) squash(pp+1,1,langle,1,106); else if (cat1==colcol) squash(pp,2,colcol,-1,107); else if (cat1==cast) squash(pp,2,raw_int,0,108); else if (cat1==lpar) squash(pp,1,exp,-2,109); -else if (cat1==lbrack) squash(pp,1,exp,-2,144); else if (cat1!=langle) squash(pp,1,int_like,-3,110); @ @<Cases for |operator_like|@>= if (cat1==binop || cat1==unop || cat1==ubinop) { if (cat2==binop) break; - big_app1_insert(pp,'{'); big_app('}'); reduce(pp,2,exp,-2,111); + big_app1(pp); big_app('{'); big_app1(pp+1); big_app('}'); + reduce(pp,2,exp,-2,111); } else if (cat1==new_like || cat1==delete_like) { - big_app1_insert(pp,' '); reduce(pp,2,exp,-2,112); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,exp,-2,112); } else if (cat1==comma) squash(pp,2,exp,-2,113); else if (cat1!=raw_ubin) squash(pp,1,new_exp,0,114); @@ -3105,18 +2966,19 @@ else if (cat1!=raw_ubin) squash(pp,1,new_exp,0,114); if ((cat1==int_like || cat1==cast) && (cat2==comma || cat2==semi)) squash(pp+1,1,exp,-1,115); else if (cat1==int_like) { - big_app1_insert(pp,' '); reduce(pp,2,typedef_like,0,116); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,typedef_like,0,116); } else if (cat1==exp && cat2!=lpar && cat2!=exp && cat2!=cast) { make_underlined(pp+1); make_reserved(pp+1); - big_app1_insert(pp,' '); reduce(pp,2,typedef_like,0,117); + big_app1(pp); big_app(' '); big_app1(pp+1); 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==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); + big_app('{'); big_app1(pp+1); big_app('}'); big_app1(pp+2); + reduce(pp+1,2,cat2,0,120); } @ @<Cases for |delete_like|@>= @@ -3126,7 +2988,7 @@ if (cat1==lpar && cat2==rpar) { reduce(pp,3,delete_like,0,121); } else if (cat1==exp) { - big_app1_insert(pp,' '); reduce(pp,2,exp,-2,122); + big_app1(pp); big_app(' '); big_app1(pp+1); reduce(pp,2,exp,-2,122); } @ @<Cases for |question|@>= @@ -3135,51 +2997,6 @@ if (cat1==exp && (cat2==colon || cat2==base)) { squash(pp,3,binop,-2,123); } -@ @<Cases for |alignas_like|@>= -if (cat1==decl_head) squash(pp,2,attr,-1,126); -else if (cat1==exp) squash(pp,2,attr,-1,127); -else if (cat1==cast) squash(pp,2,attr,-1,158); - -@ @<Cases for |lbrack|@>= -if (cat1==lbrack) - if (cat2==rbrack && cat3==rbrack) squash(pp,4,exp,-2,147); - else squash(pp,2,attr_head,-1,128); -else squash(pp,1,lpar,-1,129); - -@ @<Cases for |attr_head|@>= -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(' '); - reduce(pp,4,attr_head,0,133); -} -else if (cat1==comma) squash(pp,2,attr_head,0,145); - -@ @<Cases for |attr|@>= -if (cat1==lbrace || cat1==stmt) { - big_app1_insert(pp,' '); reduce(pp,2,cat1,-2,134); -} -else if (cat1==tag) { - big_app1_insert(pp,' '); reduce(pp,2,tag,-1,135); -} -else if (cat1==semi) squash(pp,2,stmt,-2,136); -else if (cat1==attr) { - big_app1_insert(pp,' '); reduce(pp,2,attr,-1,137); -} -else if (cat1==decl_head) { - big_app1_insert(pp,' '); reduce(pp,2,decl_head,-1,138); -} -else if (cat1==typedef_like) { - big_app1_insert(pp,' '); reduce(pp,2,typedef_like,0,143); -} -else if (cat1==function) { - big_app1_insert(pp,' '); reduce(pp,2,function,-1,148); -} - -@ @<Cases for |default_like|@>= -if (cat1==colon) squash(pp,1,case_like,-3,149); -else squash(pp,1,exp,-2,150); - @ Now here's the |reduce| procedure used in our code for productions. The `|freeze_text|' macro is used to give official status to a token list. @@ -3286,30 +3103,26 @@ if (lo_ptr<pp+3) { } @ If \.{CWEAVE} is being run in debugging mode, the production numbers and -current stack categories will be printed out when |tracing| is set to |fully|; +current stack categories will be printed out when |tracing| is set to 2; a sequence of two or more irreducible scraps will be printed out when -|tracing| is set to |partly|. - -@d off 0 -@d partly 1 -@d fully 2 +|tracing| is set to 1. @<Private...@>= -static int tracing=off; /* can be used to show parsing details */ +static int tracing; /* can be used to show parsing details */ @ @<Print a snapsh...@>= { scrap_pointer k_l; /* pointer into |scrap_info| */ - if (tracing==fully) { + if (tracing==2) { printf("\n%d:",n); for (k_l=scrap_base; k_l<=lo_ptr; k_l++) { - if (k_l==pp) putchar('*'); else putchar(' '); + if (k_l==pp) putxchar('*'); else putxchar(' '); if (k_l->mathness %4 == yes_math) putchar('+'); else if (k_l->mathness %4 == no_math) putchar('-'); print_cat(k_l->cat); if (k_l->mathness /4 == yes_math) putchar('+'); else if (k_l->mathness /4 == no_math) putchar('-'); } - if (hi_ptr<=scrap_ptr) printf("..."); /* indicate that more is coming */ + if (hi_ptr<=scrap_ptr) fputs("...",stdout); /* indicate that more is coming */ } } @@ -3330,8 +3143,8 @@ for overflow. static text_pointer translate(void) /* converts a sequence of scraps */ { - scrap_pointer i; /* index into |cat| */ - scrap_pointer j; /* runs through final scraps */ + scrap_pointer i, /* index into |cat| */ + j; /* runs through final scraps */ pp=scrap_base; lo_ptr=pp-1; hi_ptr=pp; @<If tracing, print an indication of where we are@>@; @<Reduce the scraps...@>@; @@ -3358,17 +3171,17 @@ where appropriate. } @ @<If semi-tracing, show the irreducible scraps@>= -if (lo_ptr>scrap_base && tracing==partly) { +if (lo_ptr>scrap_base && tracing==1) { printf("\nIrreducible scrap sequence in section %d:",section_count); @.Irreducible scrap sequence...@> mark_harmless; for (j=scrap_base; j<=lo_ptr; j++) { - putchar(' '); print_cat(j->cat); + printf(" "); print_cat(j->cat); } } @ @<If tracing,...@>= -if (tracing==fully) { +if (tracing==2) { printf("\nTracing after l. %d:\n",cur_line); mark_harmless; @.Tracing after...@> if (loc>buffer+50) { @@ -3395,8 +3208,8 @@ is advanced. @c static void -C_parse( /* creates scraps from \CEE/ tokens */ - eight_bits spec_ctrl) +C_parse(@t\1\1@> /* creates scraps from \CEE/ tokens */ + eight_bits spec_ctrl@t\2\2@>) { int count; /* characters remaining before string break */ while (next_control<format_code || next_control==spec_ctrl) { @@ -3423,7 +3236,7 @@ been appended: switch (next_control) { case section_name: app(section_flag+(int)(cur_section-name_dir)); - app_scrap(section_scrap,maybe_math);@+ + app_scrap(section_scrap,maybe_math); app_scrap(exp,yes_math);@+break; case string: case constant: case verbatim: @<Append a string or constant@>@;@+break; @@ -3458,10 +3271,8 @@ switch (next_control) { @.\\\#@> case ignore: case xref_roman: case xref_wildcard: case xref_typewriter: case noop:@+break; - case '(': app(next_control);@+app_scrap(lpar,maybe_math);@+break; - case ')': app(next_control);@+app_scrap(rpar,maybe_math);@+break; - case '[': app(next_control);@+app_scrap(lbrack,maybe_math);@+break; - case ']': app(next_control);@+app_scrap(rbrack,maybe_math);@+break; + case '(': case '[': app(next_control);@+app_scrap(lpar,maybe_math);@+break; + case ')': case ']': app(next_control);@+app_scrap(rpar,maybe_math);@+break; case '{': app_str("\\{"@q}@>);@+app_scrap(lbrace,yes_math);@+break; @.\\\{@>@q}@> case '}': app_str(@q{@>"\\}");@+app_scrap(rbrace,yes_math);@+break; @@ -3509,7 +3320,7 @@ if (scrap_ptr+safe_scrap_incr>scrap_info_end || standard ones. They are converted to \TEX/ control sequences so that it is possible to keep \.{CWEAVE} from outputting unusual |char| codes. -@<Cases involving nonstandard...@>=@t\1\quad@> +@<Cases involving nonstandard...@>= case non_eq: app_str("\\I");@+app_scrap(binop,yes_math);@+break; @.\\I@> case lt_eq: app_str("\\Z");@+app_scrap(binop,yes_math);@+break; @@ -3636,8 +3447,8 @@ static void outer_parse(void); @ @c static void -app_cur_id( -boolean scrapping) /* are we making this into a scrap? */ +app_cur_id(@t\1\1@> +boolean scrapping@t\2\2@>) /* are we making this into a scrap? */ { name_pointer p=id_lookup(id_first,id_loc,normal); if (p->ilk<=custom) { /* not a reserved word */ @@ -3664,8 +3475,8 @@ static text_pointer C_translate(void) { text_pointer p; /* points to the translation */ - scrap_pointer save_base=scrap_base; /* holds original value of |scrap_base| */ - scrap_base=scrap_ptr+1; + scrap_pointer save_base; /* holds original value of |scrap_base| */ + save_base=scrap_base; scrap_base=scrap_ptr+1; C_parse(section_name); /* get the scraps together */ if (next_control!='|') err_print("! Missing '|' after C text"); @.Missing '|'...@> @@ -3682,7 +3493,8 @@ is to |C_xref|: It constructs a sequence of scraps for \CEE/ text until |next_control>=format_code|. Thus, it takes care of embedded comments. The token list created from within `\pb' brackets is output as an argument -to \.{\\PB}. Although \.{cwebmac} ignores \.{\\PB}, other macro packages +to \.{\\PB}, if the user has invoked \.{CWEAVE} with the \.{+e} flag. +Although \.{cwebmac} ignores \.{\\PB}, other macro packages might use it to localize the special meaning of the macros that mark up program text. @@ -3803,8 +3615,8 @@ static void pop_level(void); @ @c static void -push_level( /* suspends the current level */ -text_pointer p) +push_level(@t\1\1@> /* suspends the current level */ +text_pointer p@t\2\2@>) { if (stack_ptr==stack_end) overflow("stack"); if (stack_ptr>stack) { /* save current state */ @@ -3889,11 +3701,12 @@ while outputting the name of a section. static void output_C(void) /* outputs the current token list */ { - token_pointer save_tok_ptr=tok_ptr; - text_pointer save_text_ptr=text_ptr; - sixteen_bits save_next_control=next_control; /* values to be restored */ + token_pointer save_tok_ptr; + text_pointer save_text_ptr; + sixteen_bits save_next_control; /* values to be restored */ text_pointer p; /* translation of the \CEE/ text */ - next_control=ignore; p=C_translate(); + save_tok_ptr=tok_ptr; save_text_ptr=text_ptr; + save_next_control=next_control; next_control=ignore; p=C_translate(); app(inner_tok_flag+(int)(p-tok_start)); if (make_pb) { out_str("\\PB{"); make_output(); out('}'); @@ -3911,8 +3724,8 @@ output_C(void) /* outputs the current token list */ static void make_output(void) /* outputs the equivalents of tokens */ { - eight_bits a=0; /* current output byte */ - eight_bits b; /* next output byte */ + eight_bits a=0, /* current output byte */ + b; /* next output byte */ int c; /* count of |indent| and |outdent| tokens */ char scratch[longest_name+1]; /* scratch area for section names */ char *k, *k_limit; /* indices into |scratch| */ @@ -3922,7 +3735,6 @@ make_output(void) /* outputs the equivalents of tokens */ char *save_loc, *save_limit; /* |loc| and |limit| to be restored */ name_pointer cur_section_name; /* name of section being output */ boolean save_mode; /* value of |cur_mode| before a sequence of breaks */ - boolean dindent_pending=false; /* should a |dindent| be output? */ app(end_translation); /* append a sentinel */ freeze_text; push_level(text_ptr-1); while (true) { @@ -3939,17 +3751,11 @@ make_output(void) /* outputs the equivalents of tokens */ a=get_output(); if (a==inserted) continue; if ((a<indent && !(b==big_cancel&&a==' ')) || a>big_force) break; - if (a==indent) c++; - else if (a==outdent) c--; - else if (a==opt) a=get_output(); + if (a==indent) c++; else if (a==outdent) c--; + else if (a==opt) a=get_output(); } @<Output saved |indent| or |outdent| tokens@>@; goto reswitch; - case dindent: a=get_output(); - if (a!=big_force) { - out_str("\\1\\1"); goto reswitch; - } - 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; @@ -3973,8 +3779,7 @@ if (a==identifier) { for (p=cur_name->byte_start;p<(cur_name+1)->byte_start;p++) out(*p=='_'? 'x': *p=='$'? 'X': *p); break; - } - else if (is_tiny(cur_name)) out('|')@; + } else if (is_tiny(cur_name)) out('|')@; @.\\|@> else { delim='.'; for (p=cur_name->byte_start;p<(cur_name+1)->byte_start;p++) @@ -3985,12 +3790,10 @@ if (a==identifier) { } @.\\\\@> @.\\.@> -} -else if (cur_name->ilk==alfop) { +}@+else if (cur_name->ilk==alfop) { out('X'); goto custom_out; -} -else out('&'); /* |a==res_word| */ +}@+else out('&'); /* |a==res_word| */ @.\\\&@> if (is_tiny(cur_name)) { if (isxalpha((cur_name->byte_start)[0])) @@ -4017,7 +3820,7 @@ if (a<break_space || a==preproc_line) { else out_str("{-1}"); /* |force_lines| encourages more \.{@@\v} breaks */ } } else if (a==opt) b=get_output(); /* ignore digit following |opt| */ -} + } else @<Look ahead for strongest line break, |goto reswitch|@> @ If several of the tokens |break_space|, |force|, |big_force| occur in a @@ -4027,10 +3830,7 @@ except at the very end of the translation. The very first line break is suppressed (i.e., a line break that follows `\.{\\Y\\B}'). @<Look ahead for st...@>= { - b=a; save_mode=cur_mode; - if (dindent_pending) { - c=2; dindent_pending=false; - } else c=0; + b=a; save_mode=cur_mode; c=0; while (true) { a=get_output(); if (a==inserted) continue; @@ -4108,9 +3908,9 @@ while (k<k_limit) { if (b=='@@') @<Skip next character, give error if not `\.{@@}'@>@; if (an_output) switch (b) { - case ' ': case '\\': case '#': case '%': case '$': case '^': - case '{': case '}': case '~': case '&': case '_': - out('\\'); /* falls through */ + case ' ':case '\\':case '#':case '%':case '$':case '^': + case '{': case '}': case '~': case '&': case '_': + out('\\'); /* falls through */ @.\\\ @> @.\\\\@> @.\\\#@> @@ -4122,16 +3922,15 @@ while (k<k_limit) { @.\\\~@> @.\\\&@> @.\\\_@> - default: out(b); - } - else - if (b!='|') out(b)@; - else { - @<Copy the \CEE/ text into the |buffer| array@>@; - save_loc=loc; save_limit=limit; loc=limit+2; limit=j+1; - *limit='|'; output_C(); - loc=save_loc; limit=save_limit; + default: out(b); } + else { if (b!='|') out(b)@; + else { + @<Copy the \CEE/ text into the |buffer| array@>@; + save_loc=loc; save_limit=limit; loc=limit+2; limit=j+1; + *limit='|'; output_C(); + loc=save_loc; limit=save_limit; + } } } @ @<Skip next char...@>= @@ -4256,13 +4055,14 @@ else { if (show_progress) printf("*%d",section_count); update_terminal; /* print a progress report */ } -out('{'); out_section(section_count); out('}'); +out_str("{");out_section(section_count); out_str("}"); @ In the \TEX/ part of a section, we simply copy the source text, except that index entries are not copied and \CEE/ text within \pb\ is translated. @<Translate the \T...@>= do { - switch (next_control=copy_TeX()) { + next_control=copy_TeX(); + switch (next_control) { case '|': init_stack; output_C(); break; case '@@': out('@@'); break; case TeX_string: case noop: @@ -4305,8 +4105,8 @@ takes place, so that the translation will normally end with \.{\\6} or @c static void -finish_C( /* finishes a definition or a \CEE/ part */ - boolean visible) /* |true| if we should produce \TeX\ output */ +finish_C(@t\1\1@> /* finishes a definition or a \CEE/ part */ + boolean visible@t\2\2@>) /* nonzero if we should produce \TeX\ output */ { text_pointer p; /* translation of the scraps */ if (visible) { @@ -4314,7 +4114,7 @@ finish_C( /* finishes a definition or a \CEE/ part */ p=translate(); @.\\B@> app(tok_flag+(int)(p-tok_start)); make_output(); /* output the list */ - if (out_ptr>out_buf+1) + if (out_ptr>out_buf+1) { if (*(out_ptr-1)=='\\') { @.\\6@> @.\\7@> @@ -4322,6 +4122,7 @@ finish_C( /* finishes a definition or a \CEE/ part */ if (*out_ptr=='6') out_ptr-=2; else if (*out_ptr=='7') *out_ptr='Y'; } + } out_str("\\par"); finish_line(); } if (text_ptr>max_text_ptr) max_text_ptr=text_ptr; @@ -4344,30 +4145,22 @@ it starts after we scan the matching `\.)'. @<Start a macro...@>= { if (save_line!=out_line || save_place!=out_ptr || space_checked) app(backup); if(!space_checked){emit_space_if_needed;save_position;} - app_str("\\D"); /* this will produce `\#\&{define }' */ + app_str("\\D"); /* this will produce `\&{define }' */ @.\\D@> if ((next_control=get_next())!=identifier) err_print("! Improper macro definition"); @.Improper macro definition@> else { - app_cur_id(false); - if (*loc=='(') { - app('$'); + app('$'); app_cur_id(false); + if (*loc=='(') reswitch: switch (next_control=get_next()) { case '(': case ',': app(next_control); goto reswitch; case identifier: app_cur_id(false); goto reswitch; case ')': app(next_control); next_control=get_next(); break; - case dot_dot_dot: app_str("\\,\\ldots\\,"); @.\\,@> @.\\ldots@> - app_scrap(raw_int,no_math); - if ((next_control=get_next())==')') { - app(next_control); next_control=get_next(); break; - } /* otherwise fall through */ default: err_print("! Improper macro definition"); break; - } - app('$'); } else next_control=get_next(); - app(break_space); + app_str("$ "); app(break_space); app_scrap(dead,no_math); /* scrap won't take part in the parsing */ } } @@ -4381,6 +4174,7 @@ it starts after we scan the matching `\.)'. next_control=get_next(); if (next_control==identifier) { app(id_flag+(int)(id_lookup(id_first, id_loc,normal)-name_dir)); + app(' '); app(break_space); /* this is syntactically separate from what follows */ next_control=get_next(); if (next_control==identifier) { @@ -4426,7 +4220,7 @@ do next_control=get_next(); if (next_control!='=' && next_control!=eq_eq) err_print("! You need an = sign after the section name"); @.You need an = sign...@> -else next_control=get_next(); + else next_control=get_next(); if (out_ptr>out_buf+1 && *out_ptr=='Y' && *(out_ptr-1)=='\\') app(backup); /* the section name will be flush left */ @.\\Y@> @@ -4483,8 +4277,8 @@ supply new definitions for the macros \.{\\A}, \.{\\As}, etc. @c static void -footnote( /* outputs section cross-references */ -sixteen_bits flag) +footnote(@t\1\1@> /* outputs section cross-references */ +sixteen_bits flag@t\2\2@>) { xref_pointer q; /* cross-reference pointer variable */ if (cur_xref->num<=flag) return; @@ -4725,8 +4519,8 @@ regarded as identical. @c static void -unbucket( /* empties buckets having depth |d| */ -eight_bits d) +unbucket(@t\1\1@> /* empties buckets having depth |d| */ +eight_bits d@t\2\2@>) { int c; /* index into |bucket|; cannot be a simple |char| because of sign comparison below */ @@ -4782,15 +4576,14 @@ while (sort_ptr>scrap_info) { @ @<Output the name...@>= switch (cur_name->ilk) { - case normal: case func_template: - if (is_tiny(cur_name)) out_str("\\|"); - else {@+char *j; + case normal: case func_template: if (is_tiny(cur_name)) out_str("\\|"); + else {char *j; for (j=cur_name->byte_start;j<(cur_name+1)->byte_start;j++) if (xislower(*j)) goto lowcase; out_str("\\."); break; lowcase: out_str("\\\\"); } - break; + break; @.\\|@> @.\\.@> @.\\\\@> @@ -4828,7 +4621,6 @@ out('.'); finish_line(); @ List inversion is best thought of as popping elements off one stack and pushing them onto another. In this case |cur_xref| will be the head of the stack that we push things onto. - @<Private...@>= static xref_pointer next_xref, this_xref; /* pointer variables for rearranging a list */ @@ -4846,8 +4638,8 @@ prints them. @c static void -section_print( /* print all section names in subtree |p| */ -name_pointer p) +section_print(@t\1\1@> /* print all section names in subtree |p| */ +name_pointer p@t\2\2@>) { if (p) { section_print(p->llink); out_str("\\I"); diff --git a/Build/source/texk/web2c/cwebdir/cweb.1 b/Build/source/texk/web2c/cwebdir/cweb.1 index 93c5f1d9c4a..a9aa69bf433 100644 --- a/Build/source/texk/web2c/cwebdir/cweb.1 +++ b/Build/source/texk/web2c/cwebdir/cweb.1 @@ -1,4 +1,4 @@ -.TH CWEB 1 2021-Mar-24 +.TH CWEB 1 2018-Dec-16 . .SH NAME ctangle, cweave \- translate CWEB to C and/or TeX @@ -9,14 +9,14 @@ ctangle, cweave \- translate CWEB to C and/or TeX [ .B \-bhp ] [ -.B +ks +.B +s ] webfile[.w] [{changefile[.ch]|-} [outputfile[.c]]] .br .B cweave [ .B \-befhpx ] [ -.B +st +.B +s ] webfile[.w] [{changefile[.ch]|-} [outputfile[.tex]]] .ad . @@ -80,13 +80,7 @@ The .B +s option prints statistics about memory usage at the end of a run. .PP -There is one other option applicable to -.I ctangle -only: -.B +k -means keep '-separators in numeric literals in the C/C++\ output. -.PP -There are four other options applicable to +There are three other options applicable to .I cweave only: .B \-f @@ -95,15 +89,13 @@ means do not force a newline after every statement in the formatted output. inhibits the enclosure of C\ material formatted by .I cweave in brackets -\ePB{...}; -such brackets are normally inserted so that special hooks +\ePB{...}. +Such brackets are normally inserted so that special hooks can be used by .I cweb-latex and similar programs. .B \-x -means omit the index, the names of the sections, and the table of contents. -.B +t -means treat 'typename' in templates like 'typedef'. +means omit the index and table of contents. . .SH FILES The location of the files mentioned below varies from system to system. diff --git a/Build/source/texk/web2c/cwebdir/cwebmac.tex b/Build/source/texk/web2c/cwebdir/cwebmac.tex index a7a02519649..385dc474e71 100644 --- a/Build/source/texk/web2c/cwebdir/cwebmac.tex +++ b/Build/source/texk/web2c/cwebdir/cwebmac.tex @@ -1,7 +1,7 @@ % standard macros for CWEB listings (in addition to plain.tex) -% Version 4.3 --- April 2021 +% Version 4.2 --- February 2021 \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros -\xdef\fmtversion{\fmtversion+CWEB4.3} +\xdef\fmtversion{\fmtversion+CWEB4.2} \chardef\cwebversion=4 \chardef\cwebrevision=1 \newif\ifpdf \ifx\pdf+\pdftrue\fi @@ -31,7 +31,6 @@ \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 @@ -125,7 +124,6 @@ \newskip\intersecskip \intersecskip=12pt minus 3pt % space between sections \let\yskip=\smallskip \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}} @@ -289,7 +287,7 @@ \else \special{pdf: dest (\romannumeral\secstar) [ @thispage /FitH @ypos ]}\fi}}\fi} \let\startsection=\stsec -\def\defin#1{\global\advance\ind by 2 \1\&{#1 }} % begin `define' or `format' +\def\defin#1{\global\advance\ind by 2 \1\&{#1 } } % begin `define' or `format' \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 @@ -302,7 +300,7 @@ \let\SHC\C % "// short comments" treated like "/* ordinary comments */" %\def\C#1{\5\5\quad$\triangleright\,${\cmntfont#1}$\,\triangleleft$} %\def\SHC#1{\5\5\quad$\diamond\,${\cmntfont#1}} -\def\D{\defin{{\rm\#}define}} % macro definition +\def\D{\defin{\#define}} % macro definition \let\E=\equiv % equivalence sign \def\ET{ and~} % conjunction between two section numbers \def\ETs{, and~} % conjunction between the last two of several section numbers @@ -343,15 +341,12 @@ \def\Qs{\note{This code is cited in sections}} % xref for mentions of a section \let\R=\lnot % logical not % \S is section sign -\def\digitseparator{\,} % a bit of extra space \def\T#1{\leavevmode % octal, hex or decimal constant \hbox{$\def\?{\kern.2em}% - \let\ \digitseparator% % \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) - \def\%{\cdot 16^{\aftergroup}}% power of sixteen (via dirty trick) - \let\~=\oct \let\^=\hex \let\\=\bin {#1}$}} + \let\~=\oct \let\^=\hex {#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 @@ -370,12 +365,8 @@ %\def\oct{\hbox{\rm\char'23\kern-.2em\it\aftergroup\?\aftergroup}} % WEB style %\def\hex{\hbox{\rm\char"7D\tt\aftergroup}} % WEB style -\def\oct{\hbox{$^\circ$\kern-.1em}\Od}% CWEB style -\def\hex{\hbox{$^{\scriptscriptstyle\#}$}\Hd} % CWEB style -\def\bin{\hbox{$^{\scriptscriptstyle b}$}\Bd} -\def\Od#1/{{\it#1}} % octal digit -\def\Hd#1/{{\tt#1}} % hexadecimal digit -\def\Bd#1/{{\tt#1}} % binary digit +\def\oct{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}}% CWEB style +\def\hex{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}} % CWEB style \def\vb#1{\leavevmode\hbox{\kern2pt\vrule\vtop{\vbox{\hrule \hbox{\strut\kern2pt\.{#1}\kern2pt}} \hrule}\vrule\kern2pt}} % verbatim string @@ -491,13 +482,14 @@ \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}% \pdfoutline goto num \the\toksA \expandafter{\the\toksE}} - \else \special{pdf: outline -1 << /Title (\outsecname) + \else\ifpdf + \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 + \fi\fi\fi \readsections} \def\makebookmarks{\let\ZZ=\writebookmarkline \readcontents\relax} \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% @@ -544,6 +536,9 @@ \def\printtwodigits{\advance\twodigits100 \expandafter\gobbleone\number\twodigits \advance\twodigits-100 } +\def\TeX{{\ifmmode\it\fi + \leavevmode\hbox{T\kern-.1667em\lower.424ex\hbox{E}\hskip-.125em X}}} +\def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} \def\datethis{\def\startsection{\leftline{\sc\today\ at \hours}\bigskip \let\startsection=\stsec\stsec}} % say `\datethis' in limbo, to get your listing timestamped before section 1 diff --git a/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch b/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch index a14e5caa490..929896ee31c 100644 --- a/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch @@ -93,17 +93,17 @@ @z @x -\def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 4.3)} +\def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 4.2)} @y \def\Kpathsea/{{\mc KPATHSEA\spacefactor1000}} -\def\runninghead{{\tentt CWEB} USER MANUAL (Version 4.3 [\TeX~Live])} +\def\runninghead{{\tentt CWEB} USER MANUAL (Version 4.2 [\TeX~Live])} @z @x -\vskip 18pt\centerline{(Version 4.3 --- April 2021)} +\vskip 18pt\centerline{(Version 4.2 --- February 2021)} @y -\vskip 18pt\centerline{(Version 4.3 --- April 2021)% -\footnote*{This document describes the extended \.{CWEB} (Version 4.3 [\TeX~Live]).}} +\vskip 18pt\centerline{(Version 4.2 --- February 2021)% +\footnote*{This document describes the extended \.{CWEB} (Version 4.2 [\TeX~Live]).}} @z @x @@ -159,38 +159,35 @@ options `\.{b}', `\.{h}', and `\.{p}' are `off' by default.} @z @x -options are currently implemented: - -\yskip -\def\option#1 {\textindent{\.#1}\hangindent2\parindent} +output by \.{CWEAVE}. (On by default.) (Has no effect on \.{CTANGLE}.) @y -\def\option#1 {\textindent{\.#1}\hangindent2\parindent}% -options are currently implemented:% +output by \.{CWEAVE}. (On by default.) (Has no effect on \.{CTANGLE}.)% \cwebfootnote{This extended version of \.{CWEB} adds the following options to the list: \hfil\smallskip -\option c Overwrite output files with temporary output only if changes occur. -(On by default.) -\hfil\vskip\normallineskip \option d Set the debugging variable \\{kpathsea\_debug} to the numeric value $N\in[0,127]$ of this option. See section~93 % FIXME of \pdfURL{appendix~D}{common-changes.pdf} for details. \hfil\vskip\normallineskip -\option i Indent parameters in function declarations. (On by default; -\.{-i} typesets declarations flush left; some people think this to be -more logical than indenting them.) (Has no effect on \.{CTANGLE}.) +\option i Indent parameters in function declarations. This causes the +formal parameter declarations in function heads to be indented. (On by +default; \.{-i} typesets declarations flush left; some people think this +to be more logical than indenting them) (Has no effect on \.{CTANGLE}.) \hfil\vskip\normallineskip \option l This option takes the string of characters to its right as its argument to switch between different user languages and macro packages. For example, if you call \.{CWEAVE} with the `\.{+ld}' (or `\.{-ld}') option, the German \.{CWEB} macros \.{dcwebmac.tex} will be loaded in the first line -of output instead of the English ones. (Off by default.) (Has no effect on -\.{CTANGLE}.) +of output instead of the English ones. To avoid conflicts, the Danish +macros could be called \.{dkcwebmac.tex} and would be included by `\.{+ldk}'. +(Off by default) (Has no effect on \.{CTANGLE}.) \hfil\vskip\normallineskip \option o Separate declarations and the first statement in a function block. -(On by default.) (Has no effect on\break\hbox{}\qquad\.{CTANGLE}.)} - -\yskip +\.{CWEAVE} automatically inserts a bit of extra space. (On by default.) +(Has no effect on \.{CTANGLE}.) +\hfil\vskip\normallineskip +\option t Overwrite output files with temporary output only if changes occur. +(On by default.)} @z @x @@ -314,9 +311,9 @@ And here's what the same excerpt looks like when typeset. @z @x - \.{ { }\\vskip 15pt \\centerline\{(Version 4.3)\}{ }\\vfill\}}\cr}$$ + \.{ { }\\vskip 15pt \\centerline\{(Version 4.2)\}{ }\\vfill\}}\cr}$$ @y - \.{ { }\\vskip 15pt \\centerline\{(Version 4.3)\}{ }\\vfill\}}\cr}$$ + \.{ { }\\vskip 15pt \\centerline\{(Version 4.2)\}{ }\\vfill\}}\cr}$$ @z @x diff --git a/Build/source/texk/web2c/cwebdir/cwebman.tex b/Build/source/texk/web2c/cwebdir/cwebman.tex index 26cdb93f1ca..df652232b72 100644 --- a/Build/source/texk/web2c/cwebdir/cwebman.tex +++ b/Build/source/texk/web2c/cwebdir/cwebman.tex @@ -1,4 +1,5 @@ % This file generates the user manual; TeX it, don't read it! +% update 14 Nov 2016 by DEK: corrected obsolete remarks re debugging info \def\tangref{3} % where the main explanation of CTANGLing is given \input cwebmac @@ -35,7 +36,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.3)} +\def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 4.2)} % This verbatim mode assumes that ! marks are !! in the text being copied. \def\verbatim{\begingroup @@ -49,7 +50,7 @@ \null\vfill \centerline{\titlefont The {\ttitlefont CWEB} System of Structured Documentation} -\vskip 18pt\centerline{(Version 4.3 --- April 2021)} +\vskip 18pt\centerline{(Version 4.2 --- February 2021)} \vskip 24pt \centerline{\authorfont Donald E. Knuth and Silvio Levy} \vfill @@ -393,9 +394,9 @@ program. Therefore the \.{CWEB} language allows you to get the effect of \CEE/ editing within \TEX/ text, if you place `\.|' marks before and after the \CEE/ material. For example, suppose you want to say something like this: -$$\hbox{If \PB{\\{pa}} is declared as `\PB{\&{int} ${}{*}\\{pa}$}', -the assignment \PB{$\\{pa}\K{\AND}\|a[\T{0}]$} makes \PB{\\{pa}} -point to the zeroth element of \PB{\|a}.}$$ +$$\hbox{ If \\{pa} is declared as `\&{int} ${}{*}\\{pa}$', +the assignment $\\{pa}\K{\AND}\|a[\T{0}]$ makes \\{pa} +point to the zeroth element of \|a.}$$ The \TEX/ text would look like this in your \.{CWEB} file: $$\lpile{\.{If |pa| is declared as `|int *pa|', the assignment}\cr \.{|pa=\&a[0]| makes |pa| point to the zeroth element of |a|.}\cr}$$ @@ -476,16 +477,13 @@ respectively, to it; in \CEE/ the constant should be preceded by \.0 or \.{0x}. In \.{CWEB} it seems reasonable to let each convention hold in its respective realm; so in \CEE/ text you get $40_8$ by typing `\.{040}', which \.{CTANGLE} faithfully copies into the \CEE/ file (for -the compiler's benefit) and which \.{CWEAVE} prints as $\T{\~40/}$. +the compiler's benefit) and which \.{CWEAVE} prints as $\T{\~40}$. Similarly, \.{CWEAVE} prints the hexadecimal \CEE/ constant `\.{0x20}' -as \T{\^20/}. The use of italic font for octal digits and typewriter font +as \T{\^20}. The use of italic font for octal digits and typewriter font for hexadecimal digits makes the meaning of such constants clearer in -a document. For consistency, then, you should type `\.{|040|}' or -`\.{|0x20|}' in the \TEX/ part of the section. - -And if you type a binary constant like `\.{0b00101010}', \.{CWEAVE} prints -it as $\T{\\00101010/}$. In all numeric literals you may add \.' separators -for improved readability. +a document. For consistency, then, you +should type `\.{|040|}' or `\.{|0x20|}' +in the \TEX/ part of the section. \section Control codes. A \.{CWEB} {\sl control code\/} @@ -763,11 +761,11 @@ and so on. When such characters occur in identifiers, \.{CTANGLE} must replace them by standard ASCII alphanumeric characters or \.{\_}, in order to generate legal \CEE/ code. It does this by means of a transliteration table, which by default associates the string -\.{Xab} to the character with ASCII code \T{\^/}$ab$ (where $a$ and $b$ are +\.{Xab} to the character with ASCII code \T{\^}$ab$ (where $a$ and $b$ are hexadecimal digits, and $a\ge8$). By placing the construction \.{@l\ ab\ newstring} in limbo, you are telling \.{CTANGLE} to replace this character by \.{newstring} instead. -For example, the ISO Latin-1 code for the letter `\"u' is \T{\^FC/} +For example, the ISO Latin-1 code for the letter `\"u' is \T{\^FC} (or \.{'\char`\\374'}), and \.{CTANGLE} will normally change this code to the three-character sequence \.{XFC} if it @@ -1044,7 +1042,7 @@ by default.) \option e Enclose \CEE/ material formatted by \.{CWEAVE} in brackets \.{\\PB\{...\}}, so that special hooks can be used. -(On by default.) (Has no effect on \.{CTANGLE}.) +(On by default; has no effect on \.{CTANGLE}.) \option f Force line breaks after each \CEE/ statement formatted by \.{CWEAVE}. (On by default; \.{-f} saves paper but looks less \CEE/-like @@ -1053,18 +1051,13 @@ to some people.) (Has no effect on \.{CTANGLE}.) \option h Print a happy message at the conclusion of a successful run. (On by default.) -\option k Keep single quotes (\.') in numeric literals in the -\CEE//\CPLUSPLUS/ output. (Off by default.) (\.{CTANGLE} only.) - \option p Give progress reports as the program runs. (On by default.) \option s Show statistics about memory usage after the program runs to completion. (Off by default.) -If you have large \.{CWEB} files or sections, you may need to see how close -you come to exceeding the capacity of \.{CTANGLE} and/or \.{CWEAVE}. - -\option t Treat \&{typename} in a template like \&{typedef}. -(Off by default.) (Has no effect on \.{CTANGLE}.) +If you +have large \.{CWEB} files or sections, you may need to see +how close you come to exceeding the capacity of \.{CTANGLE} and/or \.{CWEAVE}. \option x Include indexes and a table of contents in the \TEX/ file output by \.{CWEAVE}. (On by default.) (Has no effect on \.{CTANGLE}.) @@ -1162,7 +1155,7 @@ for the macros that make this work.) Alternatively, thanks to H\`an Th\^e\kern-.3em\raise.3ex\hbox{\'{}} Th\`anh and Andreas Scherer, you can generate \.{cob.pdf} in one step by simply saying `\.{pdftex}~\.{cob}'. -And a third way to create PDF output from \.{CWEB} input is to say +A third way to create PDF output from \.{CWEB} input is to say `\.{xetex}~\.{cob}'. A more elaborate system called \.{CTWILL}, which extends the usual cross @@ -1218,7 +1211,10 @@ Since blank lines in the change file are not used for matching, we have the change file is exhausted. This procedure is called only when |changing| is |true|; hence error messages will be reported correctly. -@c +@<Predecl...@>= +static void prime_the_change_buffer(void);@/ + +@ @c static void prime_the_change_buffer(void) { @@ -1228,8 +1224,6 @@ prime_the_change_buffer(void) @<Move |buffer| and |limit| to |change_buffer| and |change_limit|@>@; } -@ @<Predecl...@>=@+static void prime_the_change_buffer(void); - @ While looking for a line that begins with \.{@@x} in the change file, we allow lines that begin with \.{@@}, as long as they don't begin with \.{@@y}, \.{@@z}, or \.{@@i} (which would probably mean that the change file is fouled up). @@ -1274,20 +1268,20 @@ do { 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 -have been tangled into section~27. +have been tangled into section~28. \vskip6pt \begingroup \def\tt{\eighttt} \baselineskip9pt \verbatim -/*:23*//*27:*/ -#line 227 "common.w" +/*:24*//*28:*/ +#line 234 "common.w" static void prime_the_change_buffer(void) { change_limit= change_buffer; /*29:*/ -#line 243 "common.w" +#line 248 "common.w" while(true){ change_line++; @@ -1304,10 +1298,10 @@ err_print("!! Missing @x in change file"); } /*:29*/ -#line 232 "common.w" +#line 239 "common.w" /*30:*/ -#line 260 "common.w" +#line 265 "common.w" do{ change_line++; @@ -1319,10 +1313,10 @@ return; }while(limit==buffer); /*:30*/ -#line 233 "common.w" +#line 240 "common.w" /*31:*/ -#line 270 "common.w" +#line 275 "common.w" { change_limit= change_buffer+(ptrdiff_t)(limit-buffer); @@ -1330,11 +1324,11 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); } /*:31*/ -#line 234 "common.w" +#line 241 "common.w" } -/*:27*//*32:*/ +/*:28*//*33:*/ !endgroup \endgroup \vfill\eject @@ -1355,7 +1349,11 @@ the change file is exhausted. This procedure is called only when \PB{\\{changing}} is \PB{\\{true}}; hence error messages will be reported correctly. -\Y\B\1\1\&{static} \&{void} \\{prime\_the\_change\_buffer}(\&{void})\2\2\6 +\Y\B\4\X7:Predeclaration of procedures\X${}\mathrel+\E{}$\6 +\&{static} \&{void} \\{prime\_the\_change\_buffer}(\&{void});\par +\fi + +\M{28}\B\&{static} \&{void} \\{prime\_the\_change\_buffer}(\&{void})\1\1\2\2\6 ${}\{{}$\1\6 ${}\\{change\_limit}\K\\{change\_buffer}{}$;\C{ this value is used if the change file ends }\6 @@ -1367,10 +1365,6 @@ change file ends }\6 \4${}\}{}$\2\par \fi -\M{28}\B\X7:Predeclaration of procedures\X${}\mathrel+\E{}$\5 -\&{static} \&{void} \\{prime\_the\_change\_buffer}(\&{void});\par -\fi - \M{29}While looking for a line that begins with \.{@x} in the change file, we allow lines that begin with \.{@}, as long as they don't begin with \.{@y}, \.{@z}, or \.{@i} (which would probably mean that the change file is fouled @@ -1398,7 +1392,7 @@ ${}\\{loc}\K\\{buffer}+\T{2};{}$\6 \\{err\_print}(\.{"!!\ Missing\ @x\ in\ cha}\)\.{nge\ file"});\6 \4${}\}{}$\2\6 \4${}\}{}$\2\par -\U27.\fi +\U28.\fi \M{30}Here we are looking at lines following the \.{@x}. @@ -1414,7 +1408,7 @@ ${}\{{}$\1\6 \4${}\}{}$\2\6 \4${}\}{}$\2\5 \&{while} ${}(\\{limit}\E\\{buffer}){}$;\par -\U27.\fi +\U28.\fi !endgroup \endgroup \vfil\eject @@ -1433,7 +1427,11 @@ the change file is exhausted. This procedure is called only when \PB{\\{changing}} is \PB{\\{true}}; hence error messages will be reported correctly. -\Y\B\1\1\&{static} \&{void} \\{prime\_the\_change\_buffer}(\&{void})\2\2\6 +\Y\B\4\X7:Predeclaration of procedures\X${}\mathrel+\E{}$\6 +\&{static} \&{void} \\{prime\_the\_change\_buffer}(\&{void});\par +\fi + +\M{28}\B\&{static} \&{void} \\{prime\_the\_change\_buffer}(\&{void})\1\1\2\2\6 ${}\{{}$\1\6 ${}\\{change\_limit}\K\\{change\_buffer}{}$;\C{ this value is used if the change file ends }\6 @@ -1445,10 +1443,6 @@ change file ends }\6 \4${}\}{}$\2\par \fi -\M{28}\B\X7:Predeclaration of procedures\X${}\mathrel+\E{}$\5 -\&{static} \&{void} \\{prime\_the\_change\_buffer}(\&{void});\par -\fi - \M{29}While looking for a line that begins with \.{@x} in the change file, we allow lines that begin with \.{@}, as long as they don't begin with \.{@y}, \.{@z}, or \.{@i} (which would probably mean that the change file is fouled @@ -1476,7 +1470,7 @@ ${}\\{loc}\K\\{buffer}+\T{2};{}$\6 \\{err\_print}(\.{"!\ Missing\ @x\ in\ cha}\)\.{nge\ file"});\6 \4${}\}{}$\2\6 \4${}\}{}$\2\par -\U27.\fi +\U28.\fi \M{30}Here we are looking at lines following the \.{@x}. @@ -1492,7 +1486,7 @@ ${}\{{}$\1\6 \4${}\}{}$\2\6 \4${}\}{}$\2\5 \&{while} ${}(\\{limit}\E\\{buffer}){}$;\par -\U27.\fi +\U28.\fi \M{31}\B\X31:Move \PB{\\{buffer}} and \PB{\\{limit}} to \PB{\\{change\_buffer}} and \PB{\\{change\_limit}}\X${}\E{}$\6 @@ -1502,7 +1496,7 @@ ${}\\{change\_limit}\K\\{change\_buffer}+(\&{ptrdiff\_t})(\\{limit}-% ${}\\{strncpy}(\\{change\_buffer},\39\\{buffer},\39(\&{size\_t})(\\{limit}-% \\{buffer}+\T{1}));{}$\6 \4${}\}{}$\2\par -\Us27\ET32.\fi +\Us28\ET33.\fi \vfil\eject\titletrue \rightskip=0pt % get out of C mode (cf. \B) \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50 @@ -1597,7 +1591,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.3)\}{ }\\vfill\}}\cr}$$ + \.{ { }\\vskip 15pt \\centerline\{(Version 4.2)\}{ }\\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/Build/source/texk/web2c/cwebdir/iso_types.w b/Build/source/texk/web2c/cwebdir/iso_types.w deleted file mode 100644 index c88e76b7f9e..00000000000 --- a/Build/source/texk/web2c/cwebdir/iso_types.w +++ /dev/null @@ -1,95 +0,0 @@ -@q This file defines type names introduced in modern dialects @> -@q of C and C++ as special entities for TeX formatting @> - -@q C99 and C11 underscore keywords @> -@q http://en.cppreference.com/w/c/keyword @> - -@s _Alignas alignas -@s _Alignof alignof -@s _Atomic int -@s _Bool bool -@s _Complex complex -@s _Generic class -@s _Imaginary imaginary -@s _Noreturn noreturn -@s _Static_assert static_assert -@s _Thread_local thread_local - -@q C99 and C11 core language atomic types @> -@q http://en.cppreference.com/w/c/atomic @> - -@s atomic_bool bool -@s atomic_char char -@s atomic_schar char -@s atomic_uchar char -@s atomic_short short -@s atomic_ushort short -@s atomic_int int -@s atomic_uint int -@s atomic_long long -@s atomic_ulong long -@s atomic_llong long -@s atomic_ullong long -@s atomic_char8_t char8_t -@s atomic_char16_t char16_t -@s atomic_char32_t char32_t -@s atomic_wchar_t wchar_t -@s atomic_int_least8_t int -@s atomic_uint_least8_t int -@s atomic_int_least16_t int -@s atomic_uint_least16_t int -@s atomic_int_least32_t int -@s atomic_uint_least32_t int -@s atomic_int_least64_t int -@s atomic_uint_least64_t int -@s atomic_int_fast8_t int -@s atomic_uint_fast8_t int -@s atomic_int_fast16_t int -@s atomic_uint_fast16_t int -@s atomic_int_fast32_t int -@s atomic_uint_fast32_t int -@s atomic_int_fast64_t int -@s atomic_uint_fast64_t int -@s atomic_intptr_t int -@s atomic_uintptr_t int -@s atomic_ptrdiff_t ptrdiff_t -@s atomic_size_t size_t -@s atomic_intmax_t int -@s atomic_uintmax_t int - -@q C99 preprocessor @> - -@s _Pragma pragma - -@q Integral types of C99 and C++, see @> -@q http://en.cppreference.com/w/c/types/integer and @> -@q http://en.cppreference.com/w/cpp/types/integer @> - -@s int8_t int -@s int16_t int -@s int32_t int -@s int64_t int -@s int_fast8_t int -@s int_fast16_t int -@s int_fast32_t int -@s int_fast64_t int -@s int_least8_t int -@s int_least16_t int -@s int_least32_t int -@s int_least64_t int -@s intmax_t int -@s intptr_t int -@s uint8_t int -@s uint16_t int -@s uint32_t int -@s uint64_t int -@s uint_fast8_t int -@s uint_fast16_t int -@s uint_fast32_t int -@s uint_fast64_t int -@s uint_least8_t int -@s uint_least16_t int -@s uint_least32_t int -@s uint_least64_t int -@s uintmax_t int -@s uintptr_t int diff --git a/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot b/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot index 1ded3a5b408..67afbc4f32b 100644 --- a/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot +++ b/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: CWEBbin 2021\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-04-13 16:44+0200\n" +"POT-Creation-Date: 2021-02-06 15:43+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -30,15 +30,15 @@ msgid "%s: Need one to three file arguments.\n" msgstr "" #: ctang-texlive.ch:39 -msgid "This is CTANGLE, Version 4.3" +msgid "This is CTANGLE, Version 4.2" msgstr "" #: ctwill-texlive.ch:39 -msgid "This is CTWILL, Version 4.3" +msgid "This is CTWILL, Version 4.2" msgstr "" #: cweav-texlive.ch:39 -msgid "This is CWEAVE, Version 4.3" +msgid "This is CWEAVE, Version 4.2" msgstr "" #: comm-texlive.ch:512 diff --git a/Build/source/texk/web2c/cwebdir/po/cweb.pot b/Build/source/texk/web2c/cwebdir/po/cweb.pot index 037586010e7..f6f992a0c07 100644 --- a/Build/source/texk/web2c/cwebdir/po/cweb.pot +++ b/Build/source/texk/web2c/cwebdir/po/cweb.pot @@ -523,15 +523,15 @@ msgid "Sorting:" msgstr "" #: ctang-i18n.ch:17 -msgid "This is CTANGLE (Version 4.3 [CWEBbin 2021])" +msgid "This is CTANGLE (Version 4.2 [CWEBbin 2021])" msgstr "" #: cweav-twill.ch:61 -msgid "This is CTWILL (Version 4.3 [CWEBbin 2021])" +msgid "This is CTWILL (Version 4.2 [CWEBbin 2021])" msgstr "" #: cweav-i18n.ch:17 cweav-twill.ch:42 -msgid "This is CWEAVE (Version 4.3 [CWEBbin 2021])" +msgid "This is CWEAVE (Version 4.2 [CWEBbin 2021])" msgstr "" #: cweav-i18n.ch:301 cweav-i18n.ch:309 diff --git a/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po b/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po index 947c799ea2a..bd086345a9e 100644 --- a/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po +++ b/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: CWEBbin 2021\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-04-13 16:44+0200\n" -"PO-Revision-Date: 2021-04-13 16:46+0200\n" +"POT-Creation-Date: 2021-02-06 15:43+0100\n" +"PO-Revision-Date: 2021-02-06 15:58+0100\n" "Last-Translator: Andreas Scherer <andreas_github@freenet.de>\n" "Language-Team: German\n" "Language: de\n" @@ -32,16 +32,16 @@ msgid "%s: Need one to three file arguments.\n" msgstr "%s: Benötige ein bis drei Dateiargumente.\n" #: ctang-texlive.ch:39 -msgid "This is CTANGLE, Version 4.3" -msgstr "Dies ist CTANGLE, Version 4.3" +msgid "This is CTANGLE, Version 4.2" +msgstr "Dies ist CTANGLE, Version 4.2" #: ctwill-texlive.ch:39 -msgid "This is CTWILL, Version 4.3" -msgstr "Dies ist CTWILL, Version 4.3" +msgid "This is CTWILL, Version 4.2" +msgstr "Dies ist CTWILL, Version 4.2" #: cweav-texlive.ch:39 -msgid "This is CWEAVE, Version 4.3" -msgstr "Dies ist CWEAVE, Version 4.3" +msgid "This is CWEAVE, Version 4.2" +msgstr "Dies ist CWEAVE, Version 4.2" #: comm-texlive.ch:512 #, c-format diff --git a/Build/source/texk/web2c/cwebdir/po/de/cweb.po b/Build/source/texk/web2c/cwebdir/po/de/cweb.po index 24fcba90b3e..3bc760ff2af 100644 --- a/Build/source/texk/web2c/cwebdir/po/de/cweb.po +++ b/Build/source/texk/web2c/cwebdir/po/de/cweb.po @@ -603,16 +603,16 @@ msgid "Sorting:" msgstr "Sortieren:" #: ctang-i18n.ch:17 -msgid "This is CTANGLE (Version 4.3 [CWEBbin 2021])" -msgstr "Dies ist CTANGLE (Version 4.3 [CWEBbin 2021])" +msgid "This is CTANGLE (Version 4.2 [CWEBbin 2021])" +msgstr "Dies ist CTANGLE (Version 4.2 [CWEBbin 2021])" #: cweav-twill.ch:61 -msgid "This is CTWILL (Version 4.3 [CWEBbin 2021])" -msgstr "Dies ist CTWILL (Version 4.3 [CWEBbin 2021])" +msgid "This is CTWILL (Version 4.2 [CWEBbin 2021])" +msgstr "Dies ist CTWILL (Version 4.2 [CWEBbin 2021])" #: cweav-i18n.ch:17 cweav-twill.ch:42 -msgid "This is CWEAVE (Version 4.3 [CWEBbin 2021])" -msgstr "Dies ist CWEAVE (Version 4.3 [CWEBbin 2021])" +msgid "This is CWEAVE (Version 4.2 [CWEBbin 2021])" +msgstr "Dies ist CWEAVE (Version 4.2 [CWEBbin 2021])" #: cweav-i18n.ch:301 cweav-i18n.ch:309 msgid "buffer" diff --git a/Build/source/texk/web2c/cwebdir/po/de/web2c-help.po b/Build/source/texk/web2c/cwebdir/po/de/web2c-help.po index 485a88d715e..45bc6a54f99 100644 --- a/Build/source/texk/web2c/cwebdir/po/de/web2c-help.po +++ b/Build/source/texk/web2c/cwebdir/po/de/web2c-help.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: CWEBbin 2021\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-03-24 12:04+0100\n" -"PO-Revision-Date: 2021-03-24 12:04+0100\n" +"POT-Creation-Date: 2021-02-06 15:10+0200\n" +"PO-Revision-Date: 2021-02-06 15:58+0100\n" "Last-Translator: Andreas Scherer <andreas_github@freenet.de>\n" "Language-Team: German\n" "Language: de\n" @@ -55,10 +55,6 @@ msgstr "-dN setze 'kpathsea_debug' auf N (0..127)" msgid "+h print success message on completion" msgstr "+h schreibe die Erfolgsmeldung am Ende" -#: help.h:66 -msgid "+k keep separators in numeric literals in the output" -msgstr "+k konserviere '-Trenner in Zahlen in der Ausgabe" - #: help.h:61 help.h:81 help.h:107 msgid "+p print progress report messages" msgstr "+p schreibe die Fortschrittsmeldungen" @@ -71,17 +67,13 @@ msgstr "+/-q Kurzform für '-bhp'; auch '--quiet' (Vorgabe)" msgid "+/-v shortcut for '+bhp'; also '--verbose'" msgstr "+/-v Kurzform für '+bhp'; auch '--verbose'" -#: help.h:64 help.h:85 help.h:112 -msgid "-c ignore temporary output irrespective of changes" -msgstr "-c ignoriere temporäre Ausgabe unabhängig von Änderungen" - -#: help.h:66 help.h:93 help.h:121 +#: help.h:64 help.h:90 help.h:117 msgid "+s print usage statistics" msgstr "+s melde die Verbrauchsstatistik" -#: help.h:95 help.h:124 -msgid "+t treat 'typename' in a template like 'typedef'" -msgstr "+t behandle 'typename' in Templates wie 'typedef'" +#: help.h:65 help.h:91 help.h:118 +msgid "-t ignore temporary output irrespective of changes" +msgstr "-t ignoriere temporäre Ausgabe unabhängig von Änderungen" #: help.h:66 help.h:92 help.h:119 msgid "--help display this help and exit" diff --git a/Build/source/texk/web2c/cwebdir/po/it/cweb.po b/Build/source/texk/web2c/cwebdir/po/it/cweb.po index 24e6f01a217..7001ea086b1 100644 --- a/Build/source/texk/web2c/cwebdir/po/it/cweb.po +++ b/Build/source/texk/web2c/cwebdir/po/it/cweb.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: CWEBbin 2021\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-04-13 16:44+0200\n" -"PO-Revision-Date: 2021-04-13 16:47+0200\n" +"POT-Creation-Date: 2021-02-06 15:25+0100\n" +"PO-Revision-Date: 2021-02-06 15:57+0100\n" "Last-Translator: Andreas Scherer <andreas_github@freenet.de>\n" "Language-Team: Italian\n" "Language: it\n" @@ -598,16 +598,16 @@ msgid "Sorting:" msgstr "Ordinamento:" #: ctang-i18n.ch:17 -msgid "This is CTANGLE (Version 4.3 [CWEBbin 2021])" -msgstr "Questo è CTANGLE (Versione 4.3 [CWEBbin 2021])" +msgid "This is CTANGLE (Version 4.2 [CWEBbin 2021])" +msgstr "Questo è CTANGLE (Versione 4.2 [CWEBbin 2021])" #: cweav-i18n.ch:17 -msgid "This is CWEAVE (Version 4.3 [CWEBbin 2021])" -msgstr "Questo è CWEAVE (Versione 4.3 [CWEBbin 2021])" +msgid "This is CWEAVE (Version 4.2 [CWEBbin 2021])" +msgstr "Questo è CWEAVE (Versione 4.2 [CWEBbin 2021])" #: cweav-twill.ch:68 -msgid "This is CTWILL (Version 4.3 [CWEBbin 2021])" -msgstr "Questo è CTWILL (Versione 4.3 [CWEBbin 2021])" +msgid "This is CTWILL (Version 4.2 [CWEBbin 2021])" +msgstr "Questo è CTWILL (Versione 4.2 [CWEBbin 2021])" #: cweav-i18n.ch:301 cweav-i18n.ch:309 msgid "buffer" diff --git a/Build/source/texk/web2c/cwebdir/po/web2c-help.pot b/Build/source/texk/web2c/cwebdir/po/web2c-help.pot index ae370062ba1..87444595f4a 100644 --- a/Build/source/texk/web2c/cwebdir/po/web2c-help.pot +++ b/Build/source/texk/web2c/cwebdir/po/web2c-help.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: CWEBbin 2021\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-03-24 12:04+0100\n" +"POT-Creation-Date: 2021-02-06 15:10+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -54,10 +54,6 @@ msgstr "" msgid "+h print success message on completion" msgstr "" -#: help.h:66 -msgid "+k keep separators in numeric literals in the output" -msgstr "" - #: help.h:61 help.h:81 help.h:107 msgid "+p print progress report messages" msgstr "" @@ -70,16 +66,12 @@ msgstr "" msgid "+/-v shortcut for '+bhp'; also '--verbose'" msgstr "" -#: help.h:64 help.h:85 help.h:112 -msgid "-c ignore temporary output irrespective of changes" -msgstr "" - -#: help.h:66 help.h:93 help.h:121 +#: help.h:64 help.h:90 help.h:117 msgid "+s print usage statistics" msgstr "" -#: help.h:95 help.h:124 -msgid "+t treat 'typename' in a template like 'typedef'" +#: help.h:65 help.h:91 help.h:118 +msgid "-t ignore temporary output irrespective of changes" msgstr "" #: help.h:66 help.h:92 help.h:119 diff --git a/Build/source/texk/web2c/cwebdir/prod-twill.w b/Build/source/texk/web2c/cwebdir/prod-twill.w index cf09e5a9ac9..ae2ab30b383 100644 --- a/Build/source/texk/web2c/cwebdir/prod-twill.w +++ b/Build/source/texk/web2c/cwebdir/prod-twill.w @@ -26,8 +26,9 @@ identifier's ilk becomes |raw_int|. A dagger \dag\ before the production number refers to the notes at the end of this section, which deal with various exceptional cases. -We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for -|indent|, |outdent|, |backup|, |break_space|, and |dindent|, respectively. +We use \\{in}, \\{out}, \\{back} and +\\{bsp} as shorthands for |indent|, |outdent|, |backup| and +|break_space|, respectively. \begingroup \lineskip=4pt \def\alt #1 #2 @@ -37,9 +38,9 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for {$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr \strut\hbox{#3}\cr}\!\Biggr\}$ } \def\malt #1 #2 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} \def\maltt #1 #2 #3 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr \strut\hbox{#3}\hfill\cr}$} \yskip \prodno=0 \midcol=2.5in @@ -57,14 +58,14 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for & stmt; \ /$\ast\,$comment$\,*$/\cr \+& |exp| \altt|lbrace| |int_like| |decl| & |fn_decl| \altt|lbrace| |int_like| |decl| - \hfill $F=E^*\,\\{din}$ & \malt {\\{main}()$\{$} + \hfill $F=E^*\,|in|\,|in|$ & \malt {\\{main}()$\{$} {\\{main}$(\\{ac},\\{av})$ \&{int} \\{ac};} \cr \+& |exp| |unop| & |exp| & |x++|\cr \+& |exp| \alt |binop| |ubinop| |exp| & |exp| & \malt {|x/y|} {|x+y|} \cr \+& |exp| |comma| |exp| & |exp| \hfill $EC\,|opt|9\,E$& |f(x,y)|\cr \+& |exp| \alt {|lpar| |rpar|} |cast| |colon| & |exp| \alt {|lpar| |rpar|} |cast| |base| & - \malt \&C|()|: {\&C|(int i)|:} \cr + \malt \&C|()|: {\&C|int i)|:} \cr \+& |exp| |semi| & |stmt| & |x=0;|\cr \+& |exp| |colon| & |tag| \hfill $E^*C$ & |found:|\cr \+& |exp| |rbrace| & |stmt| |rbrace| & end of \&{enum} list\cr @@ -117,7 +118,7 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for $D=D$\alt $B$ $C$ \unskip$E$ & \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=D\,|in|\,|in|$ & |long time () {|\cr \+& |decl_head| |semi| & |decl| & |int n;|\cr \+& |decl| |decl| & |decl| \hfill $D_1\,|force|\,D_2$ & |int n;double x;|\cr @@ -160,24 +161,24 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \+& |else_like| |colon| & |else_like| |base| & \&{try} :\cr \+& |else_like| |lbrace| & |else_head| |lbrace| & \&{else} $\{$\cr \+& |else_like| |stmt| & |stmt| \hfill - $|force|\,E\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|$ & $\!\!$|else x=0;|\cr + $|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}$ & $\!\!$|else{x=0;}|\cr + $|force|\,E\,\\{bsp}\,|noop|\,|cancel|\,S\,\\{bsp}$ & |else{x=0;}|\cr \+& |if_clause| |lbrace| & |if_head| |lbrace| & |if (x) {|\cr \+& |if_clause| |stmt| |else_like| |if_like| & |if_like| \hfill $|force|\,I\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|\,E\,\.\ I$ & - $\!\!$|if (x) y; else if|\cr + |if (x) y; else if|\cr \+& |if_clause| |stmt| |else_like| & |else_like| \hfill $|force|\,I\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|\,E$ & - $\!\!$|if (x) y; else|\cr + |if (x) y; else|\cr \+& |if_clause| |stmt| & |else_like| |stmt| & |if (x)|\cr \+& |if_head| \alt|stmt| |exp| |else_like| |if_like| & |if_like| \hfill $|force|\,I\,\\{bsp}\,|noop|\,|cancel|\,S\,|force|\,E\,\.\ I$ & - $\!\!$|if (x){y;}else if|\cr + |if (x){y;}else if|\cr \+& |if_head| \alt|stmt| |exp| |else_like| & |else_like| \hfill $|force|\,I\,\\{bsp}\,|noop|\,|cancel|\,S\,|force|\,E$ & - $\!\!$|if (x){y;}else|\cr -\+& |if_head| \alt|stmt| |exp| & |else_head| \alt|stmt| |exp| & $\!\!$|if (x){y;}|\cr + |if (x){y;}else|\cr +\+& |if_head| \alt|stmt| |exp| & |else_head| \alt|stmt| |exp| & |if (x){y;}|\cr \advance\midcol20pt \+& |do_like| |stmt| |else_like| |semi| & |stmt| \hfill $D\,\\{bsp}\,|noop|\,|cancel|\,S\,|cancel|\,|noop|\,\\{bsp}\,ES$% @@ -190,18 +191,18 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for $C$\alt $C$ $E$ \\{in}\,\\{in} & |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$ & $\!\!$|case 0: z=0;|\cr + \hfill $|force|\,\\{back}\,T\,\\{bsp}\,S$ & |case 0: z=0;|\cr \+\dagit& |stmt| \altt|stmt| |decl| |function| & \altt|stmt| |decl| |function| \hfill $S\,$\altt$|force|\,S$ $|big_force|\,D$ $|big_force|\,F$ & |x=1;y=2;|\cr \+& |semi| & |stmt| \hfill \.\ $S$& empty statement\cr \+\dagit& |lproc| \altt |if_like| |else_like| |define_like| & |lproc| & - \maltt {\#\&{include}} \#\&{else} \#\&{define} \cr -\+& |lproc| |rproc| & |insert| & \#\&{endif} \cr + \maltt {{\bf \#include}} {\bf\#else} {\bf\#define} \cr +\+& |lproc| |rproc| & |insert| & {\bf\#endif} \cr \+& |lproc| \alt {|exp| [|exp|]} |function| |rproc| & |insert| \hfill $I$\.\ \alt {$E{[\.{\ \\5}E]}$} {$F$} & - \malt{\#\&{define} $a$\enspace 1} {\#\&{define} $a$\enspace$\{\,b;\,\}$} \cr + \malt{{\bf\#define} $a$\enspace 1} {{\bf\#define} $a$\enspace$\{\,b;\,\}$} \cr \+& |section_scrap| |semi| & |stmt|\hfill $MS$ |force| &$\langle\,$section name$\,\rangle$;\cr \+& |section_scrap| & |exp| &$\langle\,$section name$\,\rangle$\cr @@ -264,55 +265,6 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \malt |?x:| |?f():| \cr \+& |begin_arg| |end_arg| & |exp| & \.{@@[}\&{char}$*$\.{@@]}\cr \+& |any_other| |end_arg| & |end_arg| & \&{char}$*$\.{@@]}\cr -\+& |alignas_like| |decl_head| & |attr| & |alignas(struct s *)| \cr -\+& |alignas_like| |exp| & |attr| & |alignas(8)| \cr -\+& |lbrack| |lbrack| & |attr_head| & attribute begins \cr -\+& |lbrack| & |lpar| & |[| elsewhere \cr -\+& |rbrack| & |rpar| & |]| elsewhere \cr -\+& |attr_head| |rbrack| |rbrack| & |attr| & $[[\ldots]]$ \cr -\+& |attr_head| |exp| & |attr_head| & $[[$|deprecated| \cr -\+& |attr_head| |using_like| |exp| |colon| & |attr_head| & $[[$|using NS:| \cr -\+& |attr| \alt|lbrace| |stmt| & \alt|lbrace| |stmt| \hfill $A\.\ $ \alt $S$ $L$ & - |[[likely]] {|\cr -\+& |attr| |tag| & |tag| \hfill $A\.\ T$ & |[[likely]] case 0:| \cr -\+& |attr| |semi| & |stmt| & |[[fallthrough]];| \cr -\+& |attr| |attr| & |attr| \hfill $A\.\ A$ & |alignas(x)| $[[\ldots]]$ \cr -\+& |attr| |decl_head| & |decl_head| & |[[nodiscard]] f()| \cr -\+& |decl_head| |attr| & |decl_head| & |(int x [[deprecated]])|\cr -\+& |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 -\+& |attr| |typedef_like| & |typedef_like| \hfill $A\.\ T$ & - |[[deprecated]] typedef| \cr -\+& |raw_int| |lbrack| & |exp| & |int[3]| \cr -\+& |attr_head| |comma| & |attr_head| & $[[$|x, y| \cr -\+& |if_head| |attr| & |if_head| \hfill $I\.\ A$ & |if (x) [[unlikely]] {| \cr -\+& |lbrack| |lbrack| |rbrack| |rbrack| & |exp| & |[[]]| \cr -\+& |attr| |function| & |function| \hfill $A\.\ F$ & - attribute and function \cr -\+& |default_like| |colon| & |case_like| |colon| & |default:| \cr -\+& |default_like| & |exp| & |f()=default;| \cr -\+& |struct_like| |struct_like| & |struct_like| \hfill $S\.\ S$ & - |enum class| \cr -\+& |exp| |colcol| |int_like| & |int_like| & $\\{std}\DC\&{atomic}$ \cr -\advance\midcol-60pt -\+\dagit& |langle| |struct_like| \alt |exp| |int_like| |comma| & - |langle| \hfill $LS$\alt $E^{**}$ $I^{**}$ $C$ & $\langle$\&{typename} $t,$\cr -\+\dagit& |langle| |struct_like| \alt |exp| |int_like| |prerangle| & - |cast| \hfill $LS$\alt $E^{**}$ $I^{**}$ $P$ & - \hbox{$\langle$\&{typename} $t\rangle$} \hss \cr -\advance\midcol60pt -\+& |template_like| |cast| |struct_like| & |struct_like| \hfill $T\.\ CS$ & - |template<@t\dots@>> class| \cr -\+& |tag| |rbrace| & |decl| |rbrace| & @q{@>|public: }| \cr -\+& |fn_decl| |attr| & |fn_decl| \hfill $F\.\ A$ & |void f() noexcept| \cr -\+& |alignas_like| |cast| & |attr| & |alignas(int)| \cr -\yskip -\yskip -\yskip -\yskip -\yskip \yskip \yskip \yskip @@ -344,9 +296,6 @@ Rule 114: The |operator_like| must not be immediately followed by Rule 123: The mathness of the |colon| or |base| changes to `yes'. -Rules 153, 154: |make_reserved| is called only if the \.{+t} option is given -to \.{CWEAVE}. - Rule 200: The |exp| must not be immediately followed by |lpar| or~|exp|. Rule 202: The |raw_int| must be immediately followed by |semi| or |comma|. diff --git a/Build/source/texk/web2c/cwebdir/prod.w b/Build/source/texk/web2c/cwebdir/prod.w index 5bee0fc8aae..5f76a193794 100644 --- a/Build/source/texk/web2c/cwebdir/prod.w +++ b/Build/source/texk/web2c/cwebdir/prod.w @@ -26,8 +26,9 @@ identifier's ilk becomes |raw_int|. A dagger \dag\ before the production number refers to the notes at the end of this section, which deal with various exceptional cases. -We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for -|indent|, |outdent|, |backup|, |break_space|, and |dindent|, respectively. +We use \\{in}, \\{out}, \\{back} and +\\{bsp} as shorthands for |indent|, |outdent|, |backup| and +|break_space|, respectively. \begingroup \lineskip=4pt \def\alt #1 #2 @@ -37,9 +38,9 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for {$\displaystyle\Biggl\{\!\matrix{\strut\hbox{#1}\cr\hbox{#2}\cr \strut\hbox{#3}\cr}\!\Biggr\}$ } \def\malt #1 #2 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\strut\hbox{#2}\hfill\cr}$} \def\maltt #1 #2 #3 -{$\displaystyle\!\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr +{$\displaystyle\matrix{\strut\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr \strut\hbox{#3}\hfill\cr}$} \yskip \prodno=0 \midcol=2.5in @@ -57,14 +58,14 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for & stmt; \ /$\ast\,$comment$\,*$/\cr \+& |exp| \altt|lbrace| |int_like| |decl| & |fn_decl| \altt|lbrace| |int_like| |decl| - \hfill $F=E^*\,\\{din}$ & \malt {\\{main}()$\{$} + \hfill $F=E^*\,|in|\,|in|$ & \malt {\\{main}()$\{$} {\\{main}$(\\{ac},\\{av})$ \&{int} \\{ac};} \cr \+& |exp| |unop| & |exp| & |x++|\cr \+& |exp| \alt |binop| |ubinop| |exp| & |exp| & \malt {|x/y|} {|x+y|} \cr \+& |exp| |comma| |exp| & |exp| \hfill $EC\,|opt|9\,E$& |f(x,y)|\cr \+& |exp| \alt {|lpar| |rpar|} |cast| |colon| & |exp| \alt {|lpar| |rpar|} |cast| |base| & - \malt \&C|()|: {\&C|(int i)|:} \cr + \malt \&C|()|: {\&C|int i)|:} \cr \+& |exp| |semi| & |stmt| & |x=0;|\cr \+& |exp| |colon| & |tag| \hfill $E^*C$ & |found:|\cr \+& |exp| |rbrace| & |stmt| |rbrace| & end of \&{enum} list\cr @@ -117,7 +118,7 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for $D=D$\alt $B$ $C$ \unskip$E$ & \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=D\,|in|\,|in|$ & |long time () {|\cr \+& |decl_head| |semi| & |decl| & |int n;|\cr \+& |decl| |decl| & |decl| \hfill $D_1\,|force|\,D_2$ & |int n;double x;|\cr @@ -160,24 +161,24 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \+& |else_like| |colon| & |else_like| |base| & \&{try} :\cr \+& |else_like| |lbrace| & |else_head| |lbrace| & \&{else} $\{$\cr \+& |else_like| |stmt| & |stmt| \hfill - $|force|\,E\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|$ & $\!\!$|else x=0;|\cr + $|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}$ & $\!\!$|else{x=0;}|\cr + $|force|\,E\,\\{bsp}\,|noop|\,|cancel|\,S\,\\{bsp}$ & |else{x=0;}|\cr \+& |if_clause| |lbrace| & |if_head| |lbrace| & |if (x) {|\cr \+& |if_clause| |stmt| |else_like| |if_like| & |if_like| \hfill $|force|\,I\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|\,E\,\.\ I$ & - $\!\!$|if (x) y; else if|\cr + |if (x) y; else if|\cr \+& |if_clause| |stmt| |else_like| & |else_like| \hfill $|force|\,I\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|\,E$ & - $\!\!$|if (x) y; else|\cr + |if (x) y; else|\cr \+& |if_clause| |stmt| & |else_like| |stmt| & |if (x)|\cr \+& |if_head| \alt|stmt| |exp| |else_like| |if_like| & |if_like| \hfill $|force|\,I\,\\{bsp}\,|noop|\,|cancel|\,S\,|force|\,E\,\.\ I$ & - $\!\!$|if (x){y;}else if|\cr + |if (x){y;}else if|\cr \+& |if_head| \alt|stmt| |exp| |else_like| & |else_like| \hfill $|force|\,I\,\\{bsp}\,|noop|\,|cancel|\,S\,|force|\,E$ & - $\!\!$|if (x){y;}else|\cr -\+& |if_head| \alt|stmt| |exp| & |else_head| \alt|stmt| |exp| & $\!\!$|if (x){y;}|\cr + |if (x){y;}else|\cr +\+& |if_head| \alt|stmt| |exp| & |else_head| \alt|stmt| |exp| & |if (x){y;}|\cr \advance\midcol20pt \+& |do_like| |stmt| |else_like| |semi| & |stmt| \hfill $D\,\\{bsp}\,|noop|\,|cancel|\,S\,|cancel|\,|noop|\,\\{bsp}\,ES$% @@ -190,18 +191,18 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for $C$\alt $C$ $E$ \\{in}\,\\{in} & |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$ & $\!\!$|case 0: z=0;|\cr + \hfill $|force|\,\\{back}\,T\,\\{bsp}\,S$ & |case 0: z=0;|\cr \+\dagit& |stmt| \altt|stmt| |decl| |function| & \altt|stmt| |decl| |function| \hfill $S\,$\altt$|force|\,S$ $|big_force|\,D$ $|big_force|\,F$ & |x=1;y=2;|\cr \+& |semi| & |stmt| \hfill \.\ $S$& empty statement\cr \+\dagit& |lproc| \altt |if_like| |else_like| |define_like| & |lproc| & - \maltt {\#\&{include}} \#\&{else} \#\&{define} \cr -\+& |lproc| |rproc| & |insert| & \#\&{endif} \cr + \maltt {{\bf \#include}} {\bf\#else} {\bf\#define} \cr +\+& |lproc| |rproc| & |insert| & {\bf\#endif} \cr \+& |lproc| \alt {|exp| [|exp|]} |function| |rproc| & |insert| \hfill $I$\.\ \alt {$E{[\.{\ \\5}E]}$} {$F$} & - \malt{\#\&{define} $a$\enspace 1} {\#\&{define} $a$\enspace$\{\,b;\,\}$} \cr + \malt{{\bf\#define} $a$\enspace 1} {{\bf\#define} $a$\enspace$\{\,b;\,\}$} \cr \+& |section_scrap| |semi| & |stmt|\hfill $MS$ |force| &$\langle\,$section name$\,\rangle$;\cr \+& |section_scrap| & |exp| &$\langle\,$section name$\,\rangle$\cr @@ -269,55 +270,6 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \malt |?x:| |?f():| \cr \+& |begin_arg| |end_arg| & |exp| & \.{@@[}\&{char}$*$\.{@@]}\cr \+& |any_other| |end_arg| & |end_arg| & \&{char}$*$\.{@@]}\cr -\+& |alignas_like| |decl_head| & |attr| & |alignas(struct s *)| \cr -\+& |alignas_like| |exp| & |attr| & |alignas(8)| \cr -\+& |lbrack| |lbrack| & |attr_head| & attribute begins \cr -\+& |lbrack| & |lpar| & |[| elsewhere \cr -\+& |rbrack| & |rpar| & |]| elsewhere \cr -\+& |attr_head| |rbrack| |rbrack| & |attr| & $[[\ldots]]$ \cr -\+& |attr_head| |exp| & |attr_head| & $[[$|deprecated| \cr -\+& |attr_head| |using_like| |exp| |colon| & |attr_head| & $[[$|using NS:| \cr -\+& |attr| \alt|lbrace| |stmt| & \alt|lbrace| |stmt| \hfill $A\.\ $ \alt $S$ $L$ & - |[[likely]] {|\cr -\+& |attr| |tag| & |tag| \hfill $A\.\ T$ & |[[likely]] case 0:| \cr -\+& |attr| |semi| & |stmt| & |[[fallthrough]];| \cr -\+& |attr| |attr| & |attr| \hfill $A\.\ A$ & |alignas(x)| $[[\ldots]]$ \cr -\+& |attr| |decl_head| & |decl_head| & |[[nodiscard]] f()| \cr -\+& |decl_head| |attr| & |decl_head| & |(int x [[deprecated]])|\cr -\+& |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 -\+& |attr| |typedef_like| & |typedef_like| \hfill $A\.\ T$ & - |[[deprecated]] typedef| \cr -\+& |raw_int| |lbrack| & |exp| & |int[3]| \cr -\+& |attr_head| |comma| & |attr_head| & $[[$|x, y| \cr -\+& |if_head| |attr| & |if_head| \hfill $I\.\ A$ & |if (x) [[unlikely]] {| \cr -\+& |lbrack| |lbrack| |rbrack| |rbrack| & |exp| & |[[]]| \cr -\+& |attr| |function| & |function| \hfill $A\.\ F$ & - attribute and function \cr -\+& |default_like| |colon| & |case_like| |colon| & |default:| \cr -\+& |default_like| & |exp| & |f()=default;| \cr -\+& |struct_like| |struct_like| & |struct_like| \hfill $S\.\ S$ & - |enum class| \cr -\+& |exp| |colcol| |int_like| & |int_like| & $\\{std}\DC\&{atomic}$ \cr -\advance\midcol-60pt -\+\dagit& |langle| |struct_like| \alt |exp| |int_like| |comma| & - |langle| \hfill $LS$\alt $E^{**}$ $I^{**}$ $C$ & $\langle$\&{typename} $t,$\cr -\+\dagit& |langle| |struct_like| \alt |exp| |int_like| |prerangle| & - |cast| \hfill $LS$\alt $E^{**}$ $I^{**}$ $P$ & - \hbox{$\langle$\&{typename} $t\rangle$} \hss \cr -\advance\midcol60pt -\+& |template_like| |cast| |struct_like| & |struct_like| \hfill $T\.\ CS$ & - |template<@t\dots@>> class| \cr -\+& |tag| |rbrace| & |decl| |rbrace| & @q{@>|public: }| \cr -\+& |fn_decl| |attr| & |fn_decl| \hfill $F\.\ A$ & |void f() noexcept| \cr -\+& |alignas_like| |cast| & |attr| & |alignas(int)| \cr -\yskip -\yskip -\yskip -\yskip -\yskip \yskip \yskip \yskip @@ -352,7 +304,4 @@ or |cast|. Rule 123: The mathness of the |colon| or |base| changes to `yes'. -Rules 153, 154: |make_reserved| is called only if the \.{+t} option is given -to \.{CWEAVE}. - \endgroup diff --git a/Build/source/texk/web2c/cwebdir/refsort.ch b/Build/source/texk/web2c/cwebdir/refsort.ch deleted file mode 100644 index 79a8867b84c..00000000000 --- a/Build/source/texk/web2c/cwebdir/refsort.ch +++ /dev/null @@ -1,44 +0,0 @@ -Changes for the REFSORT utility from the CTWILL tarball. - -This minimal set of changes tries to satisfy the GCC compiler. - -This file is not copyrighted and can be used freely. - -@x -\datethis -@y -\datethis -\let\maybe=\iffalse % print only sections that change -@z - -@x standard C library interface -#include "stdio.h" -#include "strings.h" -#include "ctype.h" -@y -#include <stdio.h> -#include <string.h> -#include <ctype.h> -@z - -@x declare return type -main() -@y -int main() -@z - -@x variable not used -{ register int k; -@y -{ -@z - -@x add 'Index.' section - for (;*p;p++) *q++=*p; -} -@y - for (;*p;p++) *q++=*p; -} - -@* Index. -@z diff --git a/Build/source/texk/web2c/cwebdir/refsort.w b/Build/source/texk/web2c/cwebdir/refsort.w index e18d1349bf6..162f696f568 100644 --- a/Build/source/texk/web2c/cwebdir/refsort.w +++ b/Build/source/texk/web2c/cwebdir/refsort.w @@ -40,9 +40,9 @@ be plenty big enough. @d abort(c,m) { fprintf(stderr,"%s!\n%s",m,buf); return c; } @c -#include "stdio.h" -#include "strings.h" -#include "ctype.h" +#include <stdio.h> +#include <string.h> +#include <ctype.h> @# typedef struct { char key[max_key]; @@ -54,7 +54,7 @@ char cur_page[10]; /* page number, as a string */ char buf[max_size]; /* current line of input */ char *input_status; /* |NULL| if end of input reached, else |buf| */ @# -main() +int main() { register char *p,*q; register int n; /* current number of items */ @@ -86,7 +86,7 @@ while (1) { } @ @<Output the current group@>= -{ register int k; +{ for (y=sorted;y<sorted+n;y++) printf("%s\n",(*y)->entry); printf("\\donewithpage%s\n",cur_page); } @@ -162,3 +162,4 @@ characters. Ergo, the following routine replaced a simpler original loop. for (;*p;p++) *q++=*p; } +@* Index. diff --git a/Build/source/texk/web2c/cwebdir/system.bux b/Build/source/texk/web2c/cwebdir/system.bux index 83196611a5b..8a895b161b5 100644 --- a/Build/source/texk/web2c/cwebdir/system.bux +++ b/Build/source/texk/web2c/cwebdir/system.bux @@ -1,16 +1,13 @@ @$memcmp "<string.h>" \zip@> @$memcpy "<string.h>" \zip@> @$strcat "<string.h>" \zip@> -@$strchr "<string.h>" \zip@> @$strcmp "<string.h>" \zip@> @$strcpy "<string.h>" \zip@> @$strlen "<string.h>" \zip@> @$strncmp "<string.h>" \zip@> @$strncpy "<string.h>" \zip@> -@$strrchr "<string.h>" \zip@> @$BUFSIZ "<stdio.h>" \zip@> -@$EOF "<stdio.h>" \zip@> @$fclose "<stdio.h>" \zip@> @$feof "<stdio.h>" \zip@> @$fflush "<stdio.h>" \zip@> @@ -19,7 +16,6 @@ @$fputs "<stdio.h>" \zip@> @$fread "<stdio.h>" \zip@> @$fwrite "<stdio.h>" \zip@> -@$getc "<stdio.h>" \zip@> @$printf "<stdio.h>" \zip@> @$putc "<stdio.h>" \zip@> @$putchar "<stdio.h>" \zip@> @@ -28,7 +24,6 @@ @$remove "<stdio.h>" \zip@> @$sprintf "<stdio.h>" \zip@> @$stdout "<stdio.h>" \zip@> -@$ungetc "<stdio.h>" \zip@> @$getenv "<stdlib.h>" \zip@> @$exit "<stdlib.h>" \zip@> @@ -48,14 +43,7 @@ @$bool "<stdbool.h>" \zip@> @$false "<stdbool.h>" \zip@> @$true "<stdbool.h>" \zip@> - @$ptrdiff_t "<stddef.h>" \zip@> @$size_t "<stddef.h>" \zip@> - @$uint8_t "<stdint.h>" \zip@> @$uint16_t "<stdint.h>" \zip@> - -@$bindtextdomain "<locale.h>" \zip@> -@$setlocale "<locale.h>" \zip@> -@$LC_CTYPE "<locale.h>" \zip@> -@$LC_MESSAGES "<locale.h>" \zip@> diff --git a/Build/source/texk/web2c/cwebdir/texinputs/Xcwebmac.tex b/Build/source/texk/web2c/cwebdir/texinputs/Xcwebmac.tex index b6467052400..c2a8b4115ad 100644 --- a/Build/source/texk/web2c/cwebdir/texinputs/Xcwebmac.tex +++ b/Build/source/texk/web2c/cwebdir/texinputs/Xcwebmac.tex @@ -26,11 +26,12 @@ % Version 3.64 [p21] --- Andreas Scherer, Octobre 2005 % Version 3.64 [2018] --- Andreas Scherer, Octobre 2018 % Version 3.64 [2020] --- Andreas Scherer, May 2020 -% Version 4.3 [2021] --- Andreas Scherer, April 2021 \ifx\undefined\botofcontents\input cwebmac.tex\fi -\xdef\fmtversion{\fmtversion[2021]} +\xdef\fmtversion{\fmtversion[2020]} + +\def\Cpp{\CPLUSPLUS/} % for backward compatibility \font\tenss=cmss10 \let\cmntfont\tenss % comment font diff --git a/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex b/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex index bcc7f58f6d5..346b24095d9 100644 --- a/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex +++ b/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex @@ -234,7 +234,6 @@ \newskip\intersecskip \intersecskip=12pt minus 3pt % space between sections \let\yskip=\smallskip \def\?{\mathrel?} -\def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} \def\note#1#2.{\par\penalty5000 \Y\noindent{\hangindent2\em\baselineskip10pt% \eightrm#1~\ifacro{\pdfnote#2.}\else#2\fi.\par}} @@ -401,7 +400,7 @@ \def\startsection{\titletrue \line{\smash{\titlefont\title}\quad\hrulefill}\bigskip \let\startsection=\stsec\stsec} -\def\defin#1{\global\advance\ind by 2 \1\&{#1 }} % begin `define' or `format' +\def\defin#1{\global\advance\ind by 2 \1\&{#1 } } % begin `define' or `format' \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{\iftenpoint\ninepoint\fi @@ -416,7 +415,7 @@ %\let\SHC\C % "// short comments" treated like "/* ordinary comments */" \def\C#1{\5\5\quad$\triangleright\,${\cmntfont#1}$\,\triangleleft$} \def\SHC#1{\5\5\quad$\diamond\,${\cmntfont#1}} -\def\D{\defin{{\rm\#}define}} % macro definition +\def\D{\defin{\#define}} % macro definition \let\E=\equiv % equivalence sign \def\ET{ and~} % conjunction between two section numbers \def\ETs{, and~} % conjunction between the last two of several section numbers @@ -470,8 +469,7 @@ \hbox{$\def\?{\kern.2em}%$% \def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick) - \def\%{\cdot 16^{\aftergroup}}% power of sixteen (via dirty trick) - \let\~=\oct \let\^=\hex \let\\=\bin{#1}$}}%$% + \let\~=\oct \let\^=\hex {#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 @@ -486,16 +484,16 @@ %\def\oct{\hbox{\rm\char'23\kern-.2em\it\aftergroup\?\aftergroup}} % WEB style %\def\hex{\hbox{\rm\char"7D\tt\aftergroup}} % WEB style -\def\oct{\hbox{$^\circ$\kern-.1em}\Od}% CWEB style -\def\hex{\hbox{$^{\scriptscriptstyle\#}$}\Hd} % CWEB style -\def\bin{\hbox{$^{\scriptscriptstyle b}$}\Bd} -\def\Od#1/{{\it#1}} % octal digit -\def\Hd#1/{{\tt#1}} % hexadecimal digit -\def\Bd#1/{{\tt#1}} % binary digit +\def\oct{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}}% CWEB style +\def\hex{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}} % CWEB style \def\vb#1{\leavevmode\hbox{\kern2pt\vrule\vtop{\vbox{\hrule \hbox{\strut\kern2pt\.{#1}\kern2pt}} \hrule}\vrule\kern2pt}} % verbatim string +\def\TeX{{\ifmmode\it\fi + \leavevmode\hbox{T\kern-.1667em\lower.424ex\hbox{E}\hskip-.125em X}}} +\def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} + % now here's the mini-index formatting control \newcount\nrefs % total number of references in partial page \newcount\baseno % smallest section number in partial page @@ -641,26 +639,7 @@ \hsize=\pagewd \vsize=\maxdimen \output={\twillout} -%\let\page=\pagebody \raggedbottom -% \def\page{\box255 }\normalbottom % faster, but loses plain TeX footnotes -%\def\normaloutput#1#2#3{\ifodd\pageno\hoffset=\pageshift\fi - %\shipout\vbox{ - %\vbox to\fullpageht{ - %\iftitle\global\titlefalse - %\else\hbox to\pagewd{\vbox to10pt{}\ifodd\pageno #3\else#2\fi}\fi - %\vfill#1}} % parameter #1 is the page itself - %\global\advance\pageno by1} -%\def\topofcontents{\centerline{\titlefont\title}\vskip.7in - %\vfill} % this material will start the table of contents page -%\def\startpdf{\ifpdftex\pdfcatalog{/PageMode /UseOutlines}\else - %\ifpdf{\special{pdf: docview << /PageMode /UseOutlines >>}}\fi\fi} -%\def\botofcontents{\vfill - %\centerline{\covernote}} % this material will end the table of contents page -%\def\covernote{} \def\contentspagenumber{0} % default page number for table of contents -%\newdimen\pageshift \pageshift=\hoffset - %% shift righthand pages wrt lefthand ones (changed in version 3.70) -%\def\setpage{\hsize\pagewd\vsize\pageht} % use after changing page size \def\contentsfile{\jobname.toc} % file that gets table of contents info \def\readcontents{\input \contentsfile} \def\readsections{\input \jobname.scn} @@ -696,28 +675,6 @@ \let\(=\let \let\)=\let \let\[=\let \let\]=\let \let\/=\let \pdfoutline goto num #3 count -\expnumber{chunk#2.#3} {#5}}} \let\con=\end % no table of contents -%\def\con{\par\vfill\eject % finish the section names -% \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 - %\pageno=\contentspagenumber - %\def\grouptitle{TABLE OF CONTENTS} - %\message{Table of contents:} - %\topofcontents \startpdf - %\line{\hfil Section\hbox to3em{\hss Page}} - %\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}}} -%\def\consetup#1{\ifcase#1 \bf % depth -1 (@**) - %\or % depth 0 (@*) - %\or \hskip2em % depth 1 (@*1) - %\or \hskip4em \or \hskip6em \or \hskip8em \or \hskip10em % depth 2,3,4,5 - %\else \hskip12em \fi} % depth 6 or more \def\datethis{} \def\datecontentspage{} % To produce only a subset of pages, put the page numbers on separate diff --git a/Build/source/texk/web2c/cwebdir/twinx-startup.tex b/Build/source/texk/web2c/cwebdir/twinx-startup.tex deleted file mode 100644 index faf3257021e..00000000000 --- a/Build/source/texk/web2c/cwebdir/twinx-startup.tex +++ /dev/null @@ -1,9 +0,0 @@ -% special TeX strings from 'ctwill.w': -\def\copyxTeX{\\{copy\_\TEX/}} -\def\skipxTeX{\\{skip\_\TEX/}} -\def\TeXxstring{\\{\TEX/\_string}} - -\pageno=101 % dummy page number -\preinx % pre-index text on full pagewidth -\noindent Some introductory words about this full index. -\inx % two-column index diff --git a/Build/source/texk/web2c/cwebdir/twinx.ch b/Build/source/texk/web2c/cwebdir/twinx.ch deleted file mode 100644 index 00513c0c2c6..00000000000 --- a/Build/source/texk/web2c/cwebdir/twinx.ch +++ /dev/null @@ -1,156 +0,0 @@ -Changes for the TWINX utility from the CTWILL tarball. - -This minimal set of changes tries to satisfy the GCC compiler -and it fixes a few minor issues. See the comments after '@x'. - -This file is not copyrighted and can be used freely. - -Limbo. - -@x l.1 -\datethis -@y -\datethis -\let\maybe=\iffalse % print only sections that change -@z - -Section 1. - -@x l.10 Standard C interface. -#include <stdio.h> -@y -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> -@z - -@x l.15 -main(argc,argv) - int argc; - char *argv[]; -@y -int main( - int argc, - char *argv[]) -@z - -@x l.21 - f=fopen(*++argv,"r"); - if (!f) -@y - if((f=fopen(*++argv,"r"))==NULL) -@z - -@x l.28 - f=fopen(*argv,"r"); - if (!f) -@y - if((f=fopen(*argv,"r"))==NULL) -@z - -Section 3. - -@x l.49 Document minor change in behavior. -@ @<Scan file |f|...@>= -@y -@ For your convenience, \.{TWINX} grabs the first ``word'' in \.{\\title} and -turns it into uppercase form. - -@<Scan file |f|...@>= -@z - -@x l.57 FIX: Fetch only the first word from the '\title'. - for (p=buf+11,q=title;*p && *p!='}';p++) *q++=*p; -@y - for (p=buf+11,q=title;*p&&*p!=' '&&*p!='}';p++) *q++=toupper(*p); -@z - -Section 4. - -@x l.96 -@<Type...@>= -@y -@s node_struct int - -@<Type...@>= -@z - -@x l.102 Compiler warning. - char *id; -@y - const char *id; -@z - -Section 5. - -@x l.115 -char *save_string(s) - char *s; -@y -char *save_string( - char *s) -@z - -Section 6. - -@x l.145 -node *new_node() -@y -node *new_node(void) -@z - -Section 11. - -@x l.216 FIX: Don't count masked braces. - if (*p=='{') bal++; - else if (*p=='}') bal--; -@y - switch (*p) { - case '\\': *q++=*p++; break; - case '{': bal++; break; - case '}': bal--; break; - } -@z - -Section 17. - -@x l.347 -int compare(p,q) - node *p,*q; -@y -int compare( - node *p, node *q) -@z - -Section 19. - -@x l.379 Compiler warning. - for (j=1;collate[j];j++) ord[collate[j]]=j; -@y - for (j=1;collate[j];j++) ord[(int)collate[j]]=j; -@z - -Section 20. - -@x l.390 -collapse(p,q) - node *p,*q; -@y -void collapse( - node *p, node *q) -@z - -Section 22. - -@x l.414 Compiler warning. -{@+register char *p=x->id; -@y -{@+register const char *p=x->id; -@z - -@x l.434 FIX: Don't mask already masked underscore. - if (*p=='_') putchar('\\'); -@y - if (*p=='_'&&*(p-1)!='\\') putchar('\\'); -@z diff --git a/Build/source/texk/web2c/cwebdir/twinx.w b/Build/source/texk/web2c/cwebdir/twinx.w index 735a5d7d07e..ecfce0c8da8 100644 --- a/Build/source/texk/web2c/cwebdir/twinx.w +++ b/Build/source/texk/web2c/cwebdir/twinx.w @@ -8,13 +8,16 @@ the form `\.{\\def\\title\{NAME\}}'. @c #include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> @<Type definitions@>@; @<Global variables@>@; @<Procedures@>@; @# -main(argc,argv) - int argc; - char *argv[]; +int main( + int argc, + char *argv[]) { @<Local variables@>; @<Initialize the data structures@>; while (--argc) { @@ -99,7 +102,7 @@ typedef union { struct node_struct *n; } mixed; typedef struct node_struct { - char *id; + const char *id; mixed data; struct node_struct *next; } node; @@ -112,8 +115,8 @@ if the input is all screwed up. @d string_block_size 8192 /* number of bytes per string block */ @<Proc...@>= -char *save_string(s) - char *s; +char *save_string( + char *s) { register char *p,*q; register int l; for (p=s;*p;p++) ; @@ -142,7 +145,7 @@ char *save_string(s) @d nodes_per_block 340 @<Proc...@>= -node *new_node() +node *new_node(void) { if (next_node==bad_node) { next_node=(node*)calloc(nodes_per_block,sizeof(node)); @@ -344,8 +347,8 @@ If they are still equal, we look at the format characters (the first two characters of the |id| field). @<Proc...@>= -int compare(p,q) - node *p,*q; +int compare( + node *p, node *q) {@+register unsigned char *pp,*qq; for (pp=(unsigned char*)p->id+3,qq=(unsigned char*)q->id+3; *pp&&ord[*pp]==ord[*qq];pp++,qq++) ; @@ -376,7 +379,7 @@ collate[0]=0; strcpy(collate+1,"} \1\2\3\4\5\6\7\10\11\12\13\14\15\16\17\ !\42#$%&'()*+,-./:;<=>?@@[\\]^`{|~_\ abcdefghijklmnopqrstuvwxyz0123456789"); {@+register int j; - for (j=1;collate[j];j++) ord[collate[j]]=j; + for (j=1;collate[j];j++) ord[(int)collate[j]]=j; ord[128]=j; /* this affects the ordering of |sentinel.id| */ for (j='A';j<='Z';j++) ord[j]=ord[tolower(j)]; } @@ -387,8 +390,8 @@ the order when printing. After this procedure has acted, the field |q->data.n| should not be considered an active pointer. @<Proc...@>= -collapse(p,q) - node *p,*q; +void collapse( + node *p, node *q) {@+register node *x; for (x=q->data.n;x->next;x=x->next) ; x->next=p->data.n; @@ -411,7 +414,7 @@ properly, especially in the ``custom'' format when they must become } @ @<Output |x->id|...@>= -{@+register char *p=x->id; +{@+register const char *p=x->id; if (*p==' ') { if (*(p+1)!=' ') goto unknown; goto known; diff --git a/Build/source/texk/web2c/help.h b/Build/source/texk/web2c/help.h index d6078658d29..033ba329eb6 100644 --- a/Build/source/texk/web2c/help.h +++ b/Build/source/texk/web2c/help.h @@ -61,10 +61,9 @@ const_string CTANGLEHELP[] = { "+p print progress report messages", "+/-q shortcut for '-bhp'; also '--quiet' (default)", "+/-v shortcut for '+bhp'; also '--verbose'", - "-c ignore temporary output irrespective of changes", "-dN set 'kpathsea_debug' to N (0..127)", - "+k keep separators in numeric literals in the output", "+s print usage statistics", + "-t ignore temporary output irrespective of changes", "--help display this help and exit", "--version output version information and exit", NULL @@ -83,7 +82,6 @@ const_string CWEAVEHELP[] = { "+p print progress report messages", "+/-q shortcut for '-bhp'; also '--quiet' (default)", "+/-v shortcut for '+bhp'; also '--verbose'", - "-c ignore temporary output irrespective of changes", "-dN set 'kpathsea_debug' to N (0..127)", "-e do not enclose C material in \\PB{...}", "-f do not force a newline after every C statement in output", @@ -92,7 +90,7 @@ const_string CWEAVEHELP[] = { "-x omit indices, section names, table of contents", "+lX use macros for language X as of Xcwebmac.tex", "+s print usage statistics", - "+t treat 'typename' in a template like 'typedef'", + "-t ignore temporary output irrespective of changes", "--help display this help and exit", "--version output version information and exit", NULL @@ -111,7 +109,6 @@ const_string CTWILLHELP[] = { "+p print progress report messages", "+/-q shortcut for '-bhp'; also '--quiet' (default)", "+/-v shortcut for '+bhp'; also '--verbose'", - "-c ignore temporary output irrespective of changes", "-dN set 'kpathsea_debug' to N (0..127)", "-e do not enclose C material in \\PB{...}", "-f do not force a newline after every C statement in output", @@ -121,7 +118,7 @@ const_string CTWILLHELP[] = { "+P \\input ctproofmac.tex instead of ctwimac.tex", "+/-lX use macros for language X as of Xct{wi|proof}mac.tex", "+s print usage statistics", - "+t treat 'typename' in a template like 'typedef'", + "-t ignore temporary output irrespective of changes", "--help display this help and exit", "--version output version information and exit", NULL diff --git a/Build/source/texk/web2c/man/ChangeLog b/Build/source/texk/web2c/man/ChangeLog index 22c256bdfd3..0808c91d136 100644 --- a/Build/source/texk/web2c/man/ChangeLog +++ b/Build/source/texk/web2c/man/ChangeLog @@ -1,12 +1,3 @@ -2021-04-16 Andreas Scherer <https://ascherer.github.io> - - * ctwill.man, - * cweb.man: CWEB 4.3 release. - -2021-03-07 Andreas Scherer <https://ascherer.github.io> - - * ctwill.man: Document 'ctwill-twinx' a bit more. - 2021-03-04 Karl Berry <karl@freefriends.org> * gftodvi.man: font and spacing fixes from Debian. diff --git a/Build/source/texk/web2c/man/ctwill.man b/Build/source/texk/web2c/man/ctwill.man index b537722d334..c000d7dc088 100644 --- a/Build/source/texk/web2c/man/ctwill.man +++ b/Build/source/texk/web2c/man/ctwill.man @@ -1,6 +1,6 @@ -.\" Automatically generated by Pandoc 2.12 +.\" Automatically generated by Pandoc 2.11.4 .\" -.TH "CTWILL" "1" "April 13, 2021" "Web2c @VERSION@" "General Commands Manual" +.TH "CTWILL" "1" "February 6, 2021" "Web2c @VERSION@" "General Commands Manual" .hy .SH NAME .PP @@ -48,7 +48,7 @@ If you just want to change the output file name, but don\[cq]t have a change file to apply, you can use `\f[B]-\f[R]' as the second argument. .PP \f[B]ctwill\f[R] is exactly like \f[B]cweave\f[R] except that it -produces much better documentation, for which you must work much harder. +produces much better documentation, for which you must work harder. You should run \f[B]ctwill\f[R] twice, once to prime the pump and once to get decent answers. Moreover, you must run the output twice through TeX. @@ -60,14 +60,9 @@ Say \f[B]ctwill-refsort < foo.ref > foo.sref\f[R] and then another \f[B]tex foo\f[R] will produce alphabetized output. .PP The \f[B]ctwill-twinx\f[R] program compiles a master index for a set of related -programs that have been processed by \f[B]ctwill\f[R] (\f[I]not\f[R] by -\f[B]cweave\f[R], mind you!). +programs that have been processed by \f[B]ctwill\f[R]. The individual programs should define their names with a line of the form \f[B]\[rs]def\[rs]title{NAME}\f[R]. -For your convenience, \f[B]ctwill-twinx\f[R] grabs the first \[lq]word\[rq] in -\f[B]\[rs]title\f[R] and turns it into uppercase form. -You should adapt file \f[B]twinx-startup.tex\f[R] for the first page of -the master index. .PP The mini-indexes list identifiers that are used but not defined on each two-page spread. @@ -111,13 +106,13 @@ The present incarnation of \f[B]ctwill\f[R] and its utilities tries hard to be a drop-in replacement for the original package. There are, however, a few differences worth noting: .IP \[bu] 2 -This version is based on the most recent version of CWEB (4.3). +This version is based on the most recent version of CWEB (4.2). .IP \[bu] 2 In TeX\ Live the utility programs are prefixed with \f[B]ctwill-\f[R] and the macro files with \f[B]ct\f[R] for technical reasons. .IP \[bu] 2 Options \f[B]--help\f[R], \f[B]--quiet\f[R], \f[B]--verbose\f[R], -\f[B]--version\f[R], and flags \f[B]-c\f[R], \f[B]-i\f[R], \f[B]-o\f[R], +\f[B]--version\f[R], and flags \f[B]-i\f[R], \f[B]-o\f[R], \f[B]-t\f[R], and \f[B]+lX\f[R] are new in CWEBbin and TeX\ Live. .IP \[bu] 2 Option \f[B]+lX\f[R] is accompanied by example wrapper files for @@ -158,8 +153,6 @@ leave out the \f[B]happy message\f[R] (\f[B]-h\f[R]). \f[B]+v\f[R]/\f[B]-v\f[R]: shortcut for \f[B]+bhp\f[R]; also \f[B]--verbose\f[R] .IP \[bu] 2 -\f[B]-c\f[R]: ignore temporary output irrespective of changes -.IP \[bu] 2 \f[B]-e\f[R]: do not enclose C/C++\ material in \f[B]\[rs]PB{\&...}\f[R] .IP \[bu] 2 \f[B]-f\f[R]: do not force a newline after every C/C++\ statement in @@ -169,6 +162,8 @@ output .IP \[bu] 2 \f[B]-o\f[R]: suppress separation of declarations and statements .IP \[bu] 2 +\f[B]-t\f[R]: ignore temporary output irrespective of changes +.IP \[bu] 2 \f[B]-x\f[R]: omit indices, section names, table of contents .IP \[bu] 2 \f[B]+P\f[R]: \f[B]\[rs]input ctproofmac.tex\f[R] instead of @@ -179,9 +174,6 @@ output .IP \[bu] 2 \f[B]+s\f[R]: print usage statistics .IP \[bu] 2 -\f[B]+t\f[R]: treat \f[B]typename\f[R] in a template like -\f[B]typedef\f[R] -.IP \[bu] 2 \f[B]--help\f[R]: display help message and exit .IP \[bu] 2 \f[B]--version\f[R]: output version information and exit diff --git a/Build/source/texk/web2c/man/cweb.man b/Build/source/texk/web2c/man/cweb.man index fe507bf89a1..1786b698e8a 100644 --- a/Build/source/texk/web2c/man/cweb.man +++ b/Build/source/texk/web2c/man/cweb.man @@ -1,6 +1,6 @@ -.\" Automatically generated by Pandoc 2.12 +.\" Automatically generated by Pandoc 2.11.4 .\" -.TH "CWEB" "1" "April 13, 2021" "Web2c @VERSION@" "General Commands Manual" +.TH "CWEB" "1" "September 23, 2020" "Web2c @VERSION@" "General Commands Manual" .hy .SH NAME .PP @@ -55,7 +55,7 @@ the resulting output. There are, however, a few differences worth noting: .IP \[bu] 2 Options \f[B]--help\f[R], \f[B]--quiet\f[R], \f[B]--verbose\f[R], -\f[B]--version\f[R], and flags \f[B]-c\f[R], \f[B]-i\f[R], \f[B]-o\f[R], +\f[B]--version\f[R], and flags \f[B]-i\f[R], \f[B]-o\f[R], \f[B]-t\f[R], and \f[B]+lX\f[R] are new in CWEBbin and TeX\ Live. .IP \[bu] 2 Option \f[B]+lX\f[R] is accompanied by several wrapper files for @@ -95,19 +95,15 @@ The first batch of options are common to both \f[B]ctangle\f[R] and \f[B]+v\f[R]/\f[B]-v\f[R]: shortcut for \f[B]+bhp\f[R]; also \f[B]--verbose\f[R] .IP \[bu] 2 -\f[B]-c\f[R]: ignore temporary output irrespective of changes -.IP \[bu] 2 \f[B]+s\f[R]: print usage statistics .IP \[bu] 2 +\f[B]-t\f[R]: ignore temporary output irrespective of changes +.IP \[bu] 2 \f[B]--help\f[R]: display help message and exit .IP \[bu] 2 \f[B]--version\f[R]: output version information and exit .PP -There is one other option applicable to \f[B]ctangle\f[R] only: -.IP \[bu] 2 -\f[B]+k\f[R]: keep separators in numeric literals in the output -.PP -There are seven other options applicable to \f[B]cweave\f[R] only: +There are six other options applicable to \f[B]cweave\f[R] only: .IP \[bu] 2 \f[B]-e\f[R]: do not enclose C/C++\ material in \f[B]\[rs]PB{\&...}\f[R] .IP \[bu] 2 @@ -122,9 +118,6 @@ output .IP \[bu] 2 \f[B]+lX\f[R]/\f[B]-lX\f[R]: use macros for language \f[I]X\f[R] as of \f[I]X\f[R]\f[B]cwebmac.tex\f[R] -.IP \[bu] 2 -\f[B]+t\f[R]: treat \f[B]typename\f[R] in a template like -\f[B]typedef\f[R] .SH ENVIRONMENT .PP The environment variable CWEBINPUTS is used to search for the input |