diff options
Diffstat (limited to 'Build')
47 files changed, 1818 insertions, 1614 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index 7a0364dfe58..366aa0d8edb 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,3 +1,8 @@ +2021-06-06 Andreas Scherer <https://ascherer.github.io> + + * ctangleboot.cin, + * cwebboot.cin: CWEB release 4.4. + 2021-05-18 Karl Berry <karl@freefriends.org> * README, diff --git a/Build/source/texk/web2c/ctangleboot.cin b/Build/source/texk/web2c/ctangleboot.cin index a0db9c59c00..02eef23e706 100644 --- a/Build/source/texk/web2c/ctangleboot.cin +++ b/Build/source/texk/web2c/ctangleboot.cin @@ -11,7 +11,7 @@ #if HAVE_GETTEXT #include <libintl.h> #else -#define gettext(A) A +#define gettext(a) a #endif #include <ctype.h> @@ -25,10 +25,10 @@ /*:4*/ #line 67 "cwebdir/ctangle.w" -#define banner "This is CTANGLE, Version 4.3" \ +#define banner "This is CTANGLE, Version 4.4" \ \ -#define _(S) gettext(S) \ +#define _(s) gettext(s) \ #define and_and 04 #define lt_lt 020 @@ -69,7 +69,7 @@ #define web_file_name file_name[0] \ #define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start) -#define print_id(c) term_write((c) ->byte_start,length((c) ) ) +#define print_id(c) term_write((c) ->byte_start,length(c) ) #define llink link #define rlink dummy.Rlink #define root name_dir->rlink \ @@ -95,18 +95,18 @@ #define new_line putchar('\n') #define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) \ +#define buf_size 1000 +#define longest_name 10000 \ + +#define long_buf_size (buf_size+longest_name) #define max_bytes 1000000 \ -#define max_toks 1000000 #define max_names 10239 \ -#define max_sections 4000 -#define max_texts 10239 -#define longest_name 10000 -#define stack_size 500 -#define buf_size 1000 -#define long_buf_size (buf_size+longest_name) \ +#define max_sections 4000 \ +#define max_texts 10239 +#define max_toks 1000000 #define equiv equiv_or_xref \ #define macro 0 @@ -117,6 +117,7 @@ #define join 0177 #define output_defs_flag (2*024000-1) \ +#define stack_size 50 #define cur_end cur_state.end_field #define cur_byte cur_state.byte_field #define cur_name cur_state.name_field @@ -149,7 +150,11 @@ #define section_name 0311 #define new_section 0312 \ -#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow(_("token") ) ;*tok_ptr++= c;} \ +#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow(_("token") ) ;*(tok_ptr++) = c;} \ + +#define store_id(a) a= id_lookup(id_first,id_loc,0) -name_dir; \ +app_repl((a/0400) +0200) ; \ +app_repl(a%0400) ; \ #define keep_digit_separators flags['k'] \ @@ -264,7 +269,7 @@ extern FILE*active_file; extern FILE*check_file; /*:15*//*115:*/ -#line 473 "cwebdir/ctang-w2c.ch" +#line 481 "cwebdir/ctang-w2c.ch" extern char cb_banner[]; @@ -280,8 +285,9 @@ sixteen_bits text_link; }text; typedef text*text_pointer; +#line 66 "cwebdir/ctang-w2c.ch" /*:19*//*31:*/ -#line 273 "cwebdir/ctangle.w" +#line 274 "cwebdir/ctangle.w" typedef struct{ eight_bits*end_field; @@ -296,7 +302,7 @@ typedef output_state*stack_pointer; #line 70 "cwebdir/ctangle.w" /*20:*/ -#line 129 "cwebdir/ctangle.w" +#line 131 "cwebdir/ctangle.w" static text text_info[max_texts]; static text_pointer text_info_end= text_info+max_texts-1; @@ -306,12 +312,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 200 "cwebdir/ctangle.w" static text_pointer last_unnamed; /*:26*//*32:*/ -#line 289 "cwebdir/ctangle.w" +#line 291 "cwebdir/ctangle.w" static output_state cur_state; @@ -320,18 +326,18 @@ static stack_pointer stack_end= stack+stack_size; static stack_pointer stack_ptr; /*:32*//*37:*/ -#line 365 "cwebdir/ctangle.w" +#line 367 "cwebdir/ctangle.w" static int cur_val; /*:37*//*42:*/ -#line 456 "cwebdir/ctangle.w" +#line 458 "cwebdir/ctangle.w" static eight_bits out_state; static boolean protect; /*:42*//*45:*/ -#line 487 "cwebdir/ctangle.w" +#line 489 "cwebdir/ctangle.w" static name_pointer output_files[max_files]; static name_pointer*cur_out_file,*end_output_files,*an_output_file; @@ -339,33 +345,33 @@ static char cur_section_name_char; static char output_file_name[longest_name+1]; /*:45*//*52:*/ -#line 584 "cwebdir/ctangle.w" +#line 589 "cwebdir/ctangle.w" static boolean output_defs_seen= false; /*:52*//*57:*/ -#line 696 "cwebdir/ctangle.w" +#line 701 "cwebdir/ctangle.w" static char translit[128][translit_length]; /*:57*//*62:*/ -#line 775 "cwebdir/ctangle.w" +#line 777 "cwebdir/ctangle.w" static eight_bits ccode[256]; /*:62*//*66:*/ -#line 835 "cwebdir/ctangle.w" +#line 837 "cwebdir/ctangle.w" static boolean comment_continues= false; /*:66*//*68:*/ -#line 872 "cwebdir/ctangle.w" +#line 874 "cwebdir/ctangle.w" static name_pointer cur_section_name; static boolean no_where; /*:68*//*82:*/ -#line 1189 "cwebdir/ctangle.w" +#line 1188 "cwebdir/ctangle.w" static text_pointer cur_text; static eight_bits next_control; @@ -409,57 +415,57 @@ extern void print_stats(void); extern void cb_show_banner(void); /*:16*//*30:*/ -#line 245 "cwebdir/ctangle.w" +#line 246 "cwebdir/ctangle.w" static void store_two_bytes(sixteen_bits); /*:30*//*35:*/ -#line 328 "cwebdir/ctangle.w" +#line 330 "cwebdir/ctangle.w" static void push_level(name_pointer); static void pop_level(boolean); /*:35*//*39:*/ -#line 401 "cwebdir/ctangle.w" +#line 403 "cwebdir/ctangle.w" static void get_output(void); /*:39*//*44:*/ -#line 477 "cwebdir/ctangle.w" +#line 479 "cwebdir/ctangle.w" static void flush_buffer(void); /*:44*//*49:*/ -#line 551 "cwebdir/ctangle.w" +#line 556 "cwebdir/ctangle.w" static void phase_two(void); /*:49*//*53:*/ -#line 587 "cwebdir/ctangle.w" +#line 592 "cwebdir/ctangle.w" static void output_defs(void); static void out_char(eight_bits); /*:53*//*65:*/ -#line 815 "cwebdir/ctangle.w" +#line 817 "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 1214 "cwebdir/ctangle.w" static void scan_repl(eight_bits); /*:84*//*91:*/ -#line 1396 "cwebdir/ctangle.w" +#line 1397 "cwebdir/ctangle.w" static void scan_section(void); /*:91*//*99:*/ -#line 1477 "cwebdir/ctangle.w" +#line 1474 "cwebdir/ctangle.w" static void phase_one(void); /*:99*//*101:*/ -#line 1511 "cwebdir/ctangle.w" +#line 1507 "cwebdir/ctangle.w" static void skip_limbo(void); /*:101*/ @@ -476,28 +482,28 @@ char**av) argc= ac;argv= av; program= ctangle; /*21:*/ -#line 137 "cwebdir/ctangle.w" +#line 139 "cwebdir/ctangle.w" text_info->tok_start= tok_ptr= tok_mem; text_ptr= text_info+1;text_ptr->tok_start= tok_mem; /*:21*//*23:*/ -#line 147 "cwebdir/ctangle.w" +#line 149 "cwebdir/ctangle.w" init_node(name_dir); /*:23*//*27:*/ -#line 202 "cwebdir/ctangle.w" +#line 203 "cwebdir/ctangle.w" last_unnamed= text_info;text_info->text_link= macro; /*:27*//*46:*/ -#line 497 "cwebdir/ctangle.w" +#line 499 "cwebdir/ctangle.w" cur_out_file= end_output_files= output_files+max_files; /*:46*//*58:*/ -#line 699 "cwebdir/ctangle.w" +#line 704 "cwebdir/ctangle.w" { int i; @@ -505,7 +511,7 @@ for(i= 0;i<128;i++)sprintf(translit[i],"X%02X",(unsigned int)(128+i)); } /*:58*//*63:*/ -#line 778 "cwebdir/ctangle.w" +#line 780 "cwebdir/ctangle.w" { int c; for(c= 0;c<256;c++)ccode[c]= ignore; @@ -525,11 +531,11 @@ ccode['<']= ccode['(']= section_name; ccode['\'']= ord; /*:63*//*78:*/ -#line 1111 "cwebdir/ctangle.w" +#line 1112 "cwebdir/ctangle.w" section_text[0]= ' '; /*:78*//*116:*/ -#line 476 "cwebdir/ctang-w2c.ch" +#line 484 "cwebdir/ctang-w2c.ch" strncpy(cb_banner,banner,max_banner-1); @@ -546,7 +552,7 @@ return wrap_up(); } /*:2*//*24:*/ -#line 153 "cwebdir/ctangle.w" +#line 155 "cwebdir/ctangle.w" boolean names_match( name_pointer p, @@ -554,12 +560,11 @@ const char*first, size_t l, eight_bits t) {(void)t; -if(length(p)!=l)return false; -return!strncmp(first,p->byte_start,l); +return length(p)==l&&strncmp(first,p->byte_start,l)==0; } /*:24*//*25:*/ -#line 169 "cwebdir/ctangle.w" +#line 170 "cwebdir/ctangle.w" void init_node( @@ -571,29 +576,29 @@ void init_p(name_pointer p,eight_bits t){(void)p;(void)t;} /*:25*//*29:*/ -#line 235 "cwebdir/ctangle.w" +#line 236 "cwebdir/ctangle.w" static void store_two_bytes( sixteen_bits x) { -#line 65 "cwebdir/ctang-w2c.ch" +#line 73 "cwebdir/ctang-w2c.ch" if(tok_ptr+2> tok_mem_end)overflow(_("token")); -#line 241 "cwebdir/ctangle.w" +#line 242 "cwebdir/ctangle.w" *tok_ptr++= x>>8; *tok_ptr++= x&0377; } /*:29*//*34:*/ -#line 313 "cwebdir/ctangle.w" +#line 315 "cwebdir/ctangle.w" static void push_level( name_pointer p) { -#line 71 "cwebdir/ctang-w2c.ch" +#line 79 "cwebdir/ctang-w2c.ch" if(stack_ptr==stack_end)overflow(_("stack")); -#line 319 "cwebdir/ctangle.w" +#line 321 "cwebdir/ctangle.w" *stack_ptr= cur_state; stack_ptr++; if(p!=NULL){ @@ -604,7 +609,7 @@ cur_section= 0; } /*:34*//*36:*/ -#line 336 "cwebdir/ctangle.w" +#line 338 "cwebdir/ctangle.w" static void pop_level( @@ -620,7 +625,7 @@ if(stack_ptr> stack)cur_state= *stack_ptr; } /*:36*//*38:*/ -#line 372 "cwebdir/ctangle.w" +#line 374 "cwebdir/ctangle.w" static void get_output(void) @@ -643,15 +648,15 @@ 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 408 "cwebdir/ctangle.w" { a-= 024000; if((a+name_dir)->equiv!=(void*)text_info)push_level(a+name_dir); else if(a!=0){ -#line 77 "cwebdir/ctang-w2c.ch" +#line 85 "cwebdir/ctang-w2c.ch" fputs(_("\n! Not present: <"),stdout); -#line 412 "cwebdir/ctangle.w" +#line 414 "cwebdir/ctangle.w" print_section_name(a+name_dir);err_print(">"); } @@ -659,7 +664,7 @@ goto restart; } /*:40*/ -#line 393 "cwebdir/ctangle.w" +#line 395 "cwebdir/ctangle.w" break; default:cur_val= a-050000;if(cur_val> 0)cur_section= cur_val; @@ -669,7 +674,7 @@ out_char(section_number); } /*:38*//*43:*/ -#line 464 "cwebdir/ctangle.w" +#line 466 "cwebdir/ctangle.w" static void flush_buffer(void) @@ -684,48 +689,51 @@ cur_line++; } /*:43*//*48:*/ -#line 516 "cwebdir/ctangle.w" +#line 518 "cwebdir/ctangle.w" static void phase_two(void){ +phase= 2; web_file_open= false; cur_line= 1; /*33:*/ -#line 302 "cwebdir/ctangle.w" +#line 304 "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 524 "cwebdir/ctangle.w" /*51:*/ -#line 580 "cwebdir/ctangle.w" +#line 585 "cwebdir/ctangle.w" if(!output_defs_seen) output_defs(); /*:51*/ -#line 522 "cwebdir/ctangle.w" +#line 525 "cwebdir/ctangle.w" if(text_info->text_link==macro&&cur_out_file==end_output_files){ -#line 89 "cwebdir/ctang-w2c.ch" +#line 97 "cwebdir/ctang-w2c.ch" fputs(_("\n! No program text was specified."),stdout);mark_harmless; -#line 525 "cwebdir/ctangle.w" +#line 528 "cwebdir/ctangle.w" } else{ if(cur_out_file==end_output_files){ -if(show_progress) -#line 95 "cwebdir/ctang-w2c.ch" +if(show_progress){ +#line 103 "cwebdir/ctang-w2c.ch" printf(_("\nWriting the output file (%s):"),C_file_name); -#line 531 "cwebdir/ctangle.w" +#line 534 "cwebdir/ctangle.w" +update_terminal; +} } else{ if(show_progress){ -#line 101 "cwebdir/ctang-w2c.ch" +#line 109 "cwebdir/ctang-w2c.ch" fputs(_("\nWriting the output files:"),stdout); -#line 535 "cwebdir/ctangle.w" +#line 540 "cwebdir/ctangle.w" printf(" (%s)",C_file_name); update_terminal; @@ -735,45 +743,44 @@ if(text_info->text_link==macro)goto writeloop; while(stack_ptr> stack)get_output(); flush_buffer(); writeloop:/*50:*/ -#line 130 "cwebdir/ctang-w2c.ch" +#line 138 "cwebdir/ctang-w2c.ch" fclose(C_file);C_file= NULL; /*105:*/ -#line 356 "cwebdir/ctang-w2c.ch" +#line 364 "cwebdir/ctang-w2c.ch" if((C_file= fopen(C_file_name,"r"))!=NULL){ /*106:*/ -#line 363 "cwebdir/ctang-w2c.ch" +#line 371 "cwebdir/ctang-w2c.ch" -char x[BUFSIZ],y[BUFSIZ]; -int x_size,y_size,comparison= false; +boolean comparison= false; if((check_file= fopen(check_file_name,"r"))==NULL) fatal(_("! Cannot open output file "),check_file_name); if(check_for_change)/*107:*/ -#line 378 "cwebdir/ctang-w2c.ch" +#line 385 "cwebdir/ctang-w2c.ch" do{ -x_size= fread(x,1,BUFSIZ,C_file); -y_size= fread(y,1,BUFSIZ,check_file); -comparison= (x_size==y_size); -if(comparison)comparison= !memcmp(x,y,x_size); +char x[BUFSIZ],y[BUFSIZ]; +int x_size= fread(x,sizeof(char),BUFSIZ,C_file); +int y_size= fread(y,sizeof(char),BUFSIZ,check_file); +comparison= (x_size==y_size)&&!memcmp(x,y,x_size); }while(comparison&&!feof(C_file)&&!feof(check_file)); /*:107*/ -#line 371 "cwebdir/ctang-w2c.ch" +#line 378 "cwebdir/ctang-w2c.ch" fclose(C_file);C_file= NULL; fclose(check_file);check_file= NULL; /*:106*/ -#line 358 "cwebdir/ctang-w2c.ch" +#line 366 "cwebdir/ctang-w2c.ch" /*108:*/ -#line 389 "cwebdir/ctang-w2c.ch" +#line 396 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -783,13 +790,13 @@ rename(check_file_name,C_file_name); } /*:108*/ -#line 359 "cwebdir/ctang-w2c.ch" +#line 367 "cwebdir/ctang-w2c.ch" }else rename(check_file_name,C_file_name); /*:105*/ -#line 132 "cwebdir/ctang-w2c.ch" +#line 140 "cwebdir/ctang-w2c.ch" for(an_output_file= end_output_files;an_output_file> cur_out_file;){ an_output_file--; @@ -803,39 +810,40 @@ fatal(_("! Cannot open output file "),check_file_name); if(show_progress){printf("\n(%s)",output_file_name);update_terminal;} cur_line= 1; stack_ptr= stack+1; -cur_name= (*an_output_file); +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(); flush_buffer();fclose(C_file);C_file= NULL; /*109:*/ -#line 402 "cwebdir/ctang-w2c.ch" +#line 409 "cwebdir/ctang-w2c.ch" if(0==strcmp("/dev/stdout",output_file_name)) /*111:*/ -#line 429 "cwebdir/ctang-w2c.ch" +#line 436 "cwebdir/ctang-w2c.ch" { /*114:*/ -#line 460 "cwebdir/ctang-w2c.ch" +#line 467 "cwebdir/ctang-w2c.ch" char in_buf[BUFSIZ+1]; -int in_size,comparison= true; +int in_size; +boolean comparison= true; if((check_file= fopen(check_file_name,"r"))==NULL) fatal(_("! Cannot open output file "),check_file_name); /*:114*/ -#line 430 "cwebdir/ctang-w2c.ch" +#line 437 "cwebdir/ctang-w2c.ch" do{ -in_size= fread(in_buf,1,BUFSIZ,check_file); +in_size= fread(in_buf,sizeof(char),BUFSIZ,check_file); in_buf[in_size]= '\0'; fprintf(stdout,"%s",in_buf); }while(!feof(check_file)); fclose(check_file);check_file= NULL; /*110:*/ -#line 419 "cwebdir/ctang-w2c.ch" +#line 426 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -845,37 +853,38 @@ rename(check_file_name,output_file_name); } /*:110*/ -#line 437 "cwebdir/ctang-w2c.ch" +#line 444 "cwebdir/ctang-w2c.ch" } /*:111*/ -#line 404 "cwebdir/ctang-w2c.ch" +#line 411 "cwebdir/ctang-w2c.ch" else if(0==strcmp("/dev/stderr",output_file_name)) /*112:*/ -#line 442 "cwebdir/ctang-w2c.ch" +#line 449 "cwebdir/ctang-w2c.ch" { /*114:*/ -#line 460 "cwebdir/ctang-w2c.ch" +#line 467 "cwebdir/ctang-w2c.ch" char in_buf[BUFSIZ+1]; -int in_size,comparison= true; +int in_size; +boolean comparison= true; if((check_file= fopen(check_file_name,"r"))==NULL) fatal(_("! Cannot open output file "),check_file_name); /*:114*/ -#line 443 "cwebdir/ctang-w2c.ch" +#line 450 "cwebdir/ctang-w2c.ch" do{ -in_size= fread(in_buf,1,BUFSIZ,check_file); +in_size= fread(in_buf,sizeof(char),BUFSIZ,check_file); in_buf[in_size]= '\0'; fprintf(stderr,"%s",in_buf); }while(!feof(check_file)); fclose(check_file);check_file= NULL; /*110:*/ -#line 419 "cwebdir/ctang-w2c.ch" +#line 426 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -885,20 +894,20 @@ rename(check_file_name,output_file_name); } /*:110*/ -#line 450 "cwebdir/ctang-w2c.ch" +#line 457 "cwebdir/ctang-w2c.ch" } /*:112*/ -#line 406 "cwebdir/ctang-w2c.ch" +#line 413 "cwebdir/ctang-w2c.ch" else if(0==strcmp("/dev/null",output_file_name)) /*113:*/ -#line 455 "cwebdir/ctang-w2c.ch" +#line 462 "cwebdir/ctang-w2c.ch" { -int comparison= true; +boolean comparison= true; /*110:*/ -#line 419 "cwebdir/ctang-w2c.ch" +#line 426 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -908,47 +917,46 @@ rename(check_file_name,output_file_name); } /*:110*/ -#line 457 "cwebdir/ctang-w2c.ch" +#line 464 "cwebdir/ctang-w2c.ch" } /*:113*/ -#line 408 "cwebdir/ctang-w2c.ch" +#line 415 "cwebdir/ctang-w2c.ch" else{ if((C_file= fopen(output_file_name,"r"))!=NULL){ /*106:*/ -#line 363 "cwebdir/ctang-w2c.ch" +#line 371 "cwebdir/ctang-w2c.ch" -char x[BUFSIZ],y[BUFSIZ]; -int x_size,y_size,comparison= false; +boolean comparison= false; if((check_file= fopen(check_file_name,"r"))==NULL) fatal(_("! Cannot open output file "),check_file_name); if(check_for_change)/*107:*/ -#line 378 "cwebdir/ctang-w2c.ch" +#line 385 "cwebdir/ctang-w2c.ch" do{ -x_size= fread(x,1,BUFSIZ,C_file); -y_size= fread(y,1,BUFSIZ,check_file); -comparison= (x_size==y_size); -if(comparison)comparison= !memcmp(x,y,x_size); +char x[BUFSIZ],y[BUFSIZ]; +int x_size= fread(x,sizeof(char),BUFSIZ,C_file); +int y_size= fread(y,sizeof(char),BUFSIZ,check_file); +comparison= (x_size==y_size)&&!memcmp(x,y,x_size); }while(comparison&&!feof(C_file)&&!feof(check_file)); /*:107*/ -#line 371 "cwebdir/ctang-w2c.ch" +#line 378 "cwebdir/ctang-w2c.ch" fclose(C_file);C_file= NULL; fclose(check_file);check_file= NULL; /*:106*/ -#line 411 "cwebdir/ctang-w2c.ch" +#line 418 "cwebdir/ctang-w2c.ch" /*110:*/ -#line 419 "cwebdir/ctang-w2c.ch" +#line 426 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -958,33 +966,33 @@ rename(check_file_name,output_file_name); } /*:110*/ -#line 412 "cwebdir/ctang-w2c.ch" +#line 419 "cwebdir/ctang-w2c.ch" }else rename(check_file_name,output_file_name); } /*:109*/ -#line 151 "cwebdir/ctang-w2c.ch" +#line 159 "cwebdir/ctang-w2c.ch" } strcpy(check_file_name,""); -#line 575 "cwebdir/ctangle.w" +#line 580 "cwebdir/ctangle.w" /*:50*/ -#line 543 "cwebdir/ctangle.w" +#line 548 "cwebdir/ctangle.w" if(show_happiness){ if(show_progress)new_line; -#line 107 "cwebdir/ctang-w2c.ch" +#line 115 "cwebdir/ctang-w2c.ch" fputs(_("Done."),stdout); -#line 547 "cwebdir/ctangle.w" +#line 552 "cwebdir/ctangle.w" } } } /*:48*//*54:*/ -#line 594 "cwebdir/ctangle.w" +#line 599 "cwebdir/ctangle.w" static void output_defs(void) @@ -1010,9 +1018,9 @@ a= (a-0200)*0400+*cur_byte++; if(a<024000){ cur_val= a;out_char(identifier); } -#line 159 "cwebdir/ctang-w2c.ch" +#line 167 "cwebdir/ctang-w2c.ch" else if(a<050000)confusion(_("macro defs have strange char")); -#line 620 "cwebdir/ctangle.w" +#line 625 "cwebdir/ctangle.w" else{ cur_val= a-050000;cur_section= cur_val;out_char(section_number); } @@ -1026,7 +1034,7 @@ pop_level(false); } /*:54*//*55:*/ -#line 637 "cwebdir/ctangle.w" +#line 642 "cwebdir/ctangle.w" static void out_char( @@ -1039,25 +1047,22 @@ 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 710 "cwebdir/ctangle.w" case identifier: if(out_state==num_or_id)C_putc(' '); -j= (cur_val+name_dir)->byte_start; -k= (cur_val+name_dir+1)->byte_start; -while(j<k){ +for(j= (cur_val+name_dir)->byte_start,k= (cur_val+name_dir+1)->byte_start; +j<k;j++) if((eight_bits)(*j)<0200)C_putc(*j); else C_printf("%s",translit[(eight_bits)(*j)-0200]); -j++; -} out_state= num_or_id;break; /*:59*/ -#line 648 "cwebdir/ctangle.w" +#line 653 "cwebdir/ctangle.w" /*60:*/ -#line 718 "cwebdir/ctangle.w" +#line 720 "cwebdir/ctangle.w" case section_number: if(cur_val> 0)C_printf("/*%d:*/",cur_val); @@ -1068,12 +1073,12 @@ cur_char= '\n'; goto restart; }else{ sixteen_bits a; -a= 0400**cur_byte++; +a= *cur_byte++*0400; a+= *cur_byte++; C_printf("\n#line %d \"",a); -cur_val= *cur_byte++; -cur_val= 0400*(cur_val-0200)+*cur_byte++; +cur_val= (*cur_byte++-0200)*0400; +cur_val+= *cur_byte++; for(j= (cur_val+name_dir)->byte_start,k= (cur_val+name_dir+1)->byte_start; j<k;j++){ if(*j=='\\'||*j=='"')C_putc('\\'); @@ -1084,10 +1089,10 @@ C_putc('"');C_putc('\n'); break; /*:60*/ -#line 649 "cwebdir/ctangle.w" +#line 654 "cwebdir/ctangle.w" /*56:*/ -#line 667 "cwebdir/ctangle.w" +#line 672 "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 +1113,7 @@ case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal; break; /*:56*/ -#line 650 "cwebdir/ctangle.w" +#line 655 "cwebdir/ctangle.w" case'=':case'>':C_putc(cur_char);C_putc(' '); out_state= normal;break; @@ -1127,7 +1132,7 @@ default:C_putc(cur_char);out_state= normal;break; } /*:55*//*64:*/ -#line 799 "cwebdir/ctangle.w" +#line 801 "cwebdir/ctangle.w" static eight_bits skip_ahead(void) @@ -1145,7 +1150,7 @@ if(c!=ignore||*(loc-1)=='>')return c; } /*:64*//*67:*/ -#line 838 "cwebdir/ctangle.w" +#line 840 "cwebdir/ctangle.w" static boolean skip_comment( boolean is_long_comment) @@ -1156,9 +1161,9 @@ if(loc> limit){ if(is_long_comment){ if(get_line())return comment_continues= true; else{ -#line 165 "cwebdir/ctang-w2c.ch" +#line 173 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in mid-comment")); -#line 849 "cwebdir/ctangle.w" +#line 851 "cwebdir/ctangle.w" return comment_continues= false; } @@ -1171,9 +1176,9 @@ loc++;return comment_continues= false; } if(c=='@'){ if(ccode[(eight_bits)*loc]==new_section){ -#line 171 "cwebdir/ctang-w2c.ch" +#line 179 "cwebdir/ctang-w2c.ch" err_print(_("! Section name ended in mid-comment"));loc--; -#line 862 "cwebdir/ctangle.w" +#line 864 "cwebdir/ctangle.w" return comment_continues= false; } @@ -1183,7 +1188,7 @@ else loc++; } /*:67*//*69:*/ -#line 879 "cwebdir/ctangle.w" +#line 881 "cwebdir/ctangle.w" static eight_bits get_next(void) @@ -1197,9 +1202,10 @@ if(get_line()==false)return new_section; else if(print_where&&!no_where){ print_where= false; /*85:*/ -#line 1221 "cwebdir/ctangle.w" +#line 1224 "cwebdir/ctangle.w" { +eight_bits a; store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1209,12 +1215,11 @@ 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_id(a); } /*:85*/ -#line 891 "cwebdir/ctangle.w" +#line 893 "cwebdir/ctangle.w" } else return'\n'; @@ -1228,7 +1233,7 @@ else continue; } loc++; if(xisdigit(c)||c=='.')/*73:*/ -#line 963 "cwebdir/ctangle.w" +#line 965 "cwebdir/ctangle.w" { boolean hex_flag= false; id_first= loc-1; @@ -1262,13 +1267,13 @@ 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 1002 "cwebdir/ctangle.w" { char delim= c; id_first= section_text+1; @@ -1280,15 +1285,15 @@ delim= *loc++;*++id_loc= delim; while(true){ if(loc>=limit){ if(*(limit-1)!='\\'){ -#line 177 "cwebdir/ctang-w2c.ch" +#line 185 "cwebdir/ctang-w2c.ch" err_print(_("! String didn't end"));loc= limit;break; -#line 1012 "cwebdir/ctangle.w" +#line 1014 "cwebdir/ctangle.w" } if(get_line()==false){ -#line 183 "cwebdir/ctang-w2c.ch" +#line 191 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in middle of string"));loc= buffer;break; -#line 1016 "cwebdir/ctangle.w" +#line 1018 "cwebdir/ctangle.w" } else if(++id_loc<=section_text_end)*id_loc= '\n'; @@ -1306,9 +1311,9 @@ c= *loc++; if(++id_loc<=section_text_end)*id_loc= c; } if(id_loc>=section_text_end){ -#line 189 "cwebdir/ctang-w2c.ch" +#line 197 "cwebdir/ctang-w2c.ch" fputs(_("\n! String too long: "),stdout); -#line 1034 "cwebdir/ctangle.w" +#line 1036 "cwebdir/ctangle.w" term_write(section_text+1,25); err_print("..."); @@ -1318,11 +1323,11 @@ 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 956 "cwebdir/ctangle.w" { id_first= --loc; do @@ -1333,38 +1338,37 @@ 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 1047 "cwebdir/ctangle.w" + switch(c= ccode[(eight_bits)*loc++]){ case ignore:continue; -#line 195 "cwebdir/ctang-w2c.ch" +#line 203 "cwebdir/ctang-w2c.ch" case translit_code:err_print(_("! Use @l in limbo only"));continue; -#line 1049 "cwebdir/ctangle.w" +#line 1051 "cwebdir/ctangle.w" case control_text:while((c= skip_ahead())=='@'); if(*(loc-1)!='>') -#line 201 "cwebdir/ctang-w2c.ch" +#line 209 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in control text")); -#line 1054 "cwebdir/ctangle.w" +#line 1056 "cwebdir/ctangle.w" continue; case section_name: cur_section_name_char= *(loc-1); /*77:*/ -#line 1091 "cwebdir/ctangle.w" +#line 1092 "cwebdir/ctangle.w" { -char*k; +char*k= section_text; /*79:*/ -#line 1113 "cwebdir/ctangle.w" +#line 1114 "cwebdir/ctangle.w" -k= section_text; while(true){ if(loc> limit&&get_line()==false){ -#line 219 "cwebdir/ctang-w2c.ch" +#line 227 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in section name")); #line 1118 "cwebdir/ctangle.w" @@ -1380,13 +1384,13 @@ if(c=='>'){ loc+= 2;break; } if(ccode[(eight_bits)c]==new_section){ -#line 231 "cwebdir/ctang-w2c.ch" +#line 239 "cwebdir/ctang-w2c.ch" err_print(_("! Section name didn't end"));break; #line 1145 "cwebdir/ctangle.w" } if(ccode[(eight_bits)c]==section_name){ -#line 237 "cwebdir/ctang-w2c.ch" +#line 245 "cwebdir/ctang-w2c.ch" err_print(_("! Nesting of section names not allowed"));break; #line 1149 "cwebdir/ctangle.w" @@ -1404,7 +1408,7 @@ c= ' ';if(*(k-1)==' ')k--; *k= c; } if(k>=section_text_end){ -#line 225 "cwebdir/ctang-w2c.ch" +#line 233 "cwebdir/ctang-w2c.ch" fputs(_("\n! Section name too long: "),stdout); #line 1131 "cwebdir/ctangle.w" @@ -1414,7 +1418,7 @@ printf("...");mark_harmless; if(*k==' '&&k> section_text)k--; /*:79*/ -#line 1093 "cwebdir/ctangle.w" +#line 1094 "cwebdir/ctangle.w" if(k-section_text> 3&&strncmp(k-2,"...",3)==0) cur_section_name= section_lookup(section_text+1,k-3,true); @@ -1423,7 +1427,7 @@ else cur_section_name= section_lookup(section_text+1,k,false); if(cur_section_name_char=='(') /*47:*/ -#line 501 "cwebdir/ctangle.w" +#line 503 "cwebdir/ctangle.w" { for(an_output_file= cur_out_file; @@ -1432,39 +1436,38 @@ 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; -#line 83 "cwebdir/ctang-w2c.ch" +#line 91 "cwebdir/ctang-w2c.ch" else overflow(_("output files")); -#line 510 "cwebdir/ctangle.w" +#line 512 "cwebdir/ctangle.w" } } /*:47*/ -#line 1101 "cwebdir/ctangle.w" +#line 1102 "cwebdir/ctangle.w" return section_name; } /*:77*/ -#line 1058 "cwebdir/ctangle.w" +#line 1060 "cwebdir/ctangle.w" case string:/*81:*/ #line 1159 "cwebdir/ctangle.w" -{ + id_first= loc++;*(limit+1)= '@';*(limit+2)= '>'; while(*loc!='@'||*(loc+1)!='>')loc++; -#line 243 "cwebdir/ctang-w2c.ch" +#line 251 "cwebdir/ctang-w2c.ch" if(loc>=limit)err_print(_("! Verbatim string didn't end")); #line 1163 "cwebdir/ctangle.w" id_loc= loc;loc+= 2; return string; -} /*:81*/ -#line 1059 "cwebdir/ctangle.w" +#line 1061 "cwebdir/ctangle.w" case ord:/*76:*/ -#line 1071 "cwebdir/ctangle.w" +#line 1072 "cwebdir/ctangle.w" id_first= loc; if(*loc=='\\') @@ -1472,17 +1475,17 @@ if(*++loc=='\'')loc++; while(*loc!='\''){ if(*loc=='@'){ if(*(loc+1)!='@') -#line 207 "cwebdir/ctang-w2c.ch" +#line 215 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in ASCII constant")); -#line 1079 "cwebdir/ctangle.w" +#line 1080 "cwebdir/ctangle.w" else loc++; } loc++; if(loc> limit){ -#line 213 "cwebdir/ctang-w2c.ch" +#line 221 "cwebdir/ctang-w2c.ch" err_print(_("! String didn't end"));loc= limit-1;break; -#line 1085 "cwebdir/ctangle.w" +#line 1086 "cwebdir/ctangle.w" } } @@ -1490,14 +1493,13 @@ loc++; return ord; /*:76*/ -#line 1060 "cwebdir/ctangle.w" +#line 1062 "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; @@ -1506,7 +1508,7 @@ else return' '; } else if(c=='#'&&loc==buffer+1)preprocessing= true; mistake:/*71:*/ -#line 931 "cwebdir/ctangle.w" +#line 933 "cwebdir/ctangle.w" switch(c){ case'+':if(*loc=='+')compress(plus_plus);break; @@ -1531,14 +1533,14 @@ 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 1192 "cwebdir/ctangle.w" static void scan_repl( @@ -1546,9 +1548,10 @@ eight_bits t) { sixteen_bits a; if(t==section_name)/*85:*/ -#line 1221 "cwebdir/ctangle.w" +#line 1224 "cwebdir/ctangle.w" { +eight_bits a; store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1558,47 +1561,45 @@ 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_id(a); } /*:85*/ -#line 1199 "cwebdir/ctangle.w" +#line 1198 "cwebdir/ctangle.w" while(true)switch(a= get_next()){ /*86:*/ -#line 1236 "cwebdir/ctangle.w" +#line 1239 "cwebdir/ctangle.w" -case identifier:a= id_lookup(id_first,id_loc,0)-name_dir; -app_repl((a/0400)+0200); -app_repl(a%0400);break; +case identifier:store_id(a);break; case section_name:if(t!=section_name)goto done; else{ /*87:*/ -#line 1269 "cwebdir/ctangle.w" +#line 1270 "cwebdir/ctangle.w" { char*try_loc= loc; while(*try_loc==' '&&try_loc<limit)try_loc++; if(*try_loc=='+'&&try_loc<limit)try_loc++; while(*try_loc==' '&&try_loc<limit)try_loc++; -#line 273 "cwebdir/ctang-w2c.ch" +#line 281 "cwebdir/ctang-w2c.ch" if(*try_loc=='=')err_print(_("! Missing `@ ' before a named section")); -#line 1275 "cwebdir/ctangle.w" +#line 1276 "cwebdir/ctangle.w" } /*:87*/ -#line 1242 "cwebdir/ctangle.w" +#line 1243 "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 1224 "cwebdir/ctangle.w" { +eight_bits a; store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1608,17 +1609,16 @@ 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_id(a); } /*:85*/ -#line 1246 "cwebdir/ctangle.w" +#line 1247 "cwebdir/ctangle.w" break; } -#line 261 "cwebdir/ctang-w2c.ch" +#line 269 "cwebdir/ctang-w2c.ch" case output_defs_code:if(t!=section_name)err_print(_("! Misplaced @h")); -#line 1249 "cwebdir/ctangle.w" +#line 1250 "cwebdir/ctangle.w" else{ output_defs_seen= true; @@ -1626,9 +1626,10 @@ a= output_defs_flag; app_repl((a/0400)+0200); app_repl(a%0400); /*85:*/ -#line 1221 "cwebdir/ctangle.w" +#line 1224 "cwebdir/ctangle.w" { +eight_bits a; store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1638,26 +1639,25 @@ 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_id(a); } /*:85*/ -#line 1255 "cwebdir/ctangle.w" +#line 1256 "cwebdir/ctangle.w" } break; case constant:case string: /*88:*/ -#line 1286 "cwebdir/ctangle.w" +#line 1287 "cwebdir/ctangle.w" app_repl(a); while(id_first<id_loc){ if(*id_first=='@'){ if(*(id_first+1)=='@')id_first++; -#line 279 "cwebdir/ctang-w2c.ch" +#line 287 "cwebdir/ctang-w2c.ch" else err_print(_("! Double @ should be used in string")); -#line 1292 "cwebdir/ctangle.w" +#line 1293 "cwebdir/ctangle.w" } else if(a==constant&&*id_first=='\''&&!keep_digit_separators) @@ -1667,11 +1667,11 @@ app_repl(*id_first++); app_repl(a);break; /*:88*/ -#line 1259 "cwebdir/ctangle.w" +#line 1260 "cwebdir/ctangle.w" case ord: /*89:*/ -#line 1304 "cwebdir/ctangle.w" +#line 1305 "cwebdir/ctangle.w" { int c= (eight_bits)*id_first; if(c=='\\'){ @@ -1708,9 +1708,9 @@ break; case'\\':c= '\\';break; case'\'':c= '\'';break; case'\"':c= '\"';break; -#line 285 "cwebdir/ctang-w2c.ch" +#line 293 "cwebdir/ctang-w2c.ch" default:err_print(_("! Unrecognized escape sequence")); -#line 1341 "cwebdir/ctangle.w" +#line 1342 "cwebdir/ctangle.w" } } @@ -1724,19 +1724,19 @@ app_repl(constant); break; /*:89*/ -#line 1261 "cwebdir/ctangle.w" +#line 1262 "cwebdir/ctangle.w" case definition:case format_code:case begin_C:if(t!=section_name)goto done; else{ -#line 267 "cwebdir/ctang-w2c.ch" +#line 275 "cwebdir/ctang-w2c.ch" err_print(_("! @d, @f and @c are ignored in C text"));continue; -#line 1265 "cwebdir/ctangle.w" +#line 1266 "cwebdir/ctangle.w" } case new_section:goto done; /*:86*/ -#line 1204 "cwebdir/ctangle.w" +#line 1203 "cwebdir/ctangle.w" case')':app_repl(a); if(t==macro)app_repl(' '); @@ -1744,14 +1744,14 @@ break; default:app_repl(a); } done:next_control= (eight_bits)a; -#line 255 "cwebdir/ctang-w2c.ch" +#line 263 "cwebdir/ctang-w2c.ch" if(text_ptr> text_info_end)overflow(_("text")); -#line 1212 "cwebdir/ctangle.w" +#line 1211 "cwebdir/ctangle.w" cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; } /*:83*//*90:*/ -#line 1363 "cwebdir/ctangle.w" +#line 1364 "cwebdir/ctangle.w" static void scan_section(void) @@ -1766,7 +1766,7 @@ printf("*%d",section_count);update_terminal; next_control= ignore; while(true){ /*92:*/ -#line 1404 "cwebdir/ctangle.w" +#line 1405 "cwebdir/ctangle.w" while(next_control<definition) @@ -1775,32 +1775,29 @@ loc-= 2;next_control= get_next(); } /*:92*/ -#line 1377 "cwebdir/ctangle.w" +#line 1378 "cwebdir/ctangle.w" if(next_control==definition){ /*93:*/ -#line 1411 "cwebdir/ctangle.w" -{ +#line 1412 "cwebdir/ctangle.w" + while((next_control= get_next())=='\n'); if(next_control!=identifier){ -#line 291 "cwebdir/ctang-w2c.ch" +#line 299 "cwebdir/ctang-w2c.ch" err_print(_("! Definition flushed, must start with identifier")); -#line 1415 "cwebdir/ctangle.w" +#line 1416 "cwebdir/ctangle.w" continue; } -app_repl(((a= id_lookup(id_first,id_loc,0)-name_dir)/0400)+0200); - -app_repl(a%0400); +store_id(a); if(*loc!='('){ app_repl(string);app_repl(' ');app_repl(string); } scan_repl(macro); cur_text->text_link= macro; -} /*:93*/ -#line 1379 "cwebdir/ctangle.w" +#line 1380 "cwebdir/ctangle.w" continue; } @@ -1810,14 +1807,14 @@ p= name_dir;break; if(next_control==section_name){ p= cur_section_name; /*94:*/ -#line 1436 "cwebdir/ctangle.w" +#line 1434 "cwebdir/ctangle.w" while((next_control= get_next())=='+'); if(next_control!='='&&next_control!=eq_eq) continue; /*:94*/ -#line 1387 "cwebdir/ctangle.w" +#line 1388 "cwebdir/ctangle.w" break; } @@ -1825,23 +1822,23 @@ return; } no_where= print_where= false; /*95:*/ -#line 1441 "cwebdir/ctangle.w" +#line 1439 "cwebdir/ctangle.w" /*96:*/ -#line 1446 "cwebdir/ctangle.w" +#line 1444 "cwebdir/ctangle.w" store_two_bytes((sixteen_bits)(0150000+section_count)); /*:96*/ -#line 1442 "cwebdir/ctangle.w" +#line 1440 "cwebdir/ctangle.w" scan_repl(section_name); /*97:*/ -#line 1450 "cwebdir/ctangle.w" +#line 1448 "cwebdir/ctangle.w" if(p==name_dir||p==NULL){ -(last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text; +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 +1852,16 @@ cur_text->text_link= section_flag; /*:97*/ -#line 1444 "cwebdir/ctangle.w" +#line 1442 "cwebdir/ctangle.w" /*:95*/ -#line 1393 "cwebdir/ctangle.w" +#line 1394 "cwebdir/ctangle.w" } /*:90*//*98:*/ -#line 1465 "cwebdir/ctangle.w" +#line 1463 "cwebdir/ctangle.w" static void phase_one(void){ @@ -1874,34 +1871,32 @@ reset_input(); skip_limbo(); while(!input_has_ended)scan_section(); check_complete(); -phase= 2; } /*:98*//*100:*/ -#line 1482 "cwebdir/ctangle.w" +#line 1479 "cwebdir/ctangle.w" static void skip_limbo(void) { -char c; while(true){ if(loc> limit&&get_line()==false)return; *(limit+1)= '@'; while(*loc!='@')loc++; if(loc++<=limit){ -c= *loc++; +char 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 1509 "cwebdir/ctangle.w" while(xisspace(*loc)&&loc<limit)loc++; loc+= 3; if(loc> limit||!xisxdigit(*(loc-3))||!xisxdigit(*(loc-2)) ||(*(loc-3)>='0'&&*(loc-3)<='7')||!xisspace(*(loc-1))) -#line 309 "cwebdir/ctang-w2c.ch" +#line 317 "cwebdir/ctang-w2c.ch" err_print(_("! Improper hex number following @l")); -#line 1519 "cwebdir/ctangle.w" +#line 1515 "cwebdir/ctangle.w" else{ unsigned int i; @@ -1911,9 +1906,9 @@ while(xisspace(*loc)&&loc<limit)loc++; beg= loc; while(loc<limit&&(xisalpha(*loc)||xisdigit(*loc)||*loc=='_'))loc++; if(loc-beg>=translit_length) -#line 315 "cwebdir/ctang-w2c.ch" +#line 323 "cwebdir/ctang-w2c.ch" err_print(_("! Replacement string in @l too long")); -#line 1529 "cwebdir/ctangle.w" +#line 1525 "cwebdir/ctangle.w" else{ strncpy(translit[i-0200],beg,(size_t)(loc-beg)); @@ -1922,21 +1917,21 @@ translit[i-0200][loc-beg]= '\0'; } /*:102*/ -#line 1495 "cwebdir/ctangle.w" +#line 1491 "cwebdir/ctangle.w" break; case format_code:case'@':break; case control_text:if(c=='q'||c=='Q'){ while((c= skip_ahead())=='@'); if(*(loc-1)!='>') -#line 297 "cwebdir/ctang-w2c.ch" +#line 305 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in control text")); -#line 1501 "cwebdir/ctangle.w" +#line 1497 "cwebdir/ctangle.w" break; } -#line 303 "cwebdir/ctang-w2c.ch" +#line 311 "cwebdir/ctang-w2c.ch" default:err_print(_("! Double @ should be used in limbo")); -#line 1505 "cwebdir/ctangle.w" +#line 1501 "cwebdir/ctangle.w" } } @@ -1944,11 +1939,11 @@ default:err_print(_("! Double @ should be used in limbo")); } /*:100*//*103:*/ -#line 1539 "cwebdir/ctangle.w" +#line 1535 "cwebdir/ctangle.w" void print_stats(void){ -#line 328 "cwebdir/ctang-w2c.ch" +#line 336 "cwebdir/ctang-w2c.ch" puts(_("\nMemory usage statistics:")); printf(_("%ld names (out of %ld)\n"), (ptrdiff_t)(name_ptr-name_dir),(long)max_names); @@ -1957,9 +1952,9 @@ 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 1546 "cwebdir/ctangle.w" (ptrdiff_t)(tok_ptr-tok_mem),(long)max_toks); } -#line 341 "cwebdir/ctang-w2c.ch" +#line 349 "cwebdir/ctang-w2c.ch" /*:103*/ diff --git a/Build/source/texk/web2c/cwebboot.cin b/Build/source/texk/web2c/cwebboot.cin index 21ccb238c4a..d9f7c934973 100644 --- a/Build/source/texk/web2c/cwebboot.cin +++ b/Build/source/texk/web2c/cwebboot.cin @@ -11,7 +11,7 @@ #if HAVE_GETTEXT #include <libintl.h> #else -#define gettext(A) A +#define gettext(a) a #endif #include <ctype.h> @@ -23,18 +23,18 @@ #include <string.h> /*:3*//*89:*/ -#line 711 "cwebdir/comm-w2c.ch" +#line 717 "cwebdir/comm-w2c.ch" #if HAVE_GETTEXT #include <locale.h> #else -#define setlocale(A,B) "" -#define bindtextdomain(A,B) "" -#define textdomain(A) "" +#define setlocale(a,b) "" +#define bindtextdomain(a,b) "" +#define textdomain(a) "" #endif /*:89*//*91:*/ -#line 758 "cwebdir/comm-w2c.ch" +#line 764 "cwebdir/comm-w2c.ch" typedef bool boolean; #define HAVE_BOOLEAN @@ -44,7 +44,7 @@ typedef bool boolean; #include <lib/lib.h> /*:91*//*94:*/ -#line 797 "cwebdir/comm-w2c.ch" +#line 803 "cwebdir/comm-w2c.ch" #define CWEB #include "help.h" @@ -52,7 +52,7 @@ typedef bool boolean; /*:94*/ #line 63 "cwebdir/common.w" -#define _(S) gettext(S) \ +#define _(s) gettext(s) \ #define and_and 04 #define lt_lt 020 @@ -93,7 +93,7 @@ typedef bool boolean; #define web_file_name file_name[0] \ #define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start) -#define print_id(c) term_write((c) ->byte_start,length((c) ) ) +#define print_id(c) term_write((c) ->byte_start,length(c) ) #define llink link #define rlink dummy.Rlink #define root name_dir->rlink \ @@ -119,27 +119,24 @@ typedef bool boolean; #define new_line putchar('\n') #define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) \ +#define buf_size 1000 +#define longest_name 10000 \ + +#define long_buf_size (buf_size+longest_name) #define max_bytes 1000000 \ -#define max_toks 1000000 #define max_names 10239 \ -#define max_sections 4000 -#define max_texts 10239 -#define longest_name 10000 -#define stack_size 500 -#define buf_size 1000 -#define long_buf_size (buf_size+longest_name) \ +#define max_sections 4000 \ #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) { \ +#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; \ -} \ #define too_long() {include_depth--; \ err_print(_("! Include file name too long") ) ;goto restart;} \ @@ -337,7 +334,7 @@ static char change_buffer[buf_size]; static char*change_limit; /*:26*//*37:*/ -#line 396 "cwebdir/common.w" +#line 393 "cwebdir/common.w" sixteen_bits section_count; boolean changed_section[max_sections]; @@ -346,7 +343,7 @@ boolean change_pending; boolean print_where= false; /*:37*//*43:*/ -#line 593 "cwebdir/common.w" +#line 590 "cwebdir/common.w" char byte_mem[max_bytes]; char*byte_mem_end= byte_mem+max_bytes-1; @@ -354,60 +351,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 601 "cwebdir/common.w" char*byte_ptr; name_pointer name_ptr; /*:44*//*46:*/ -#line 624 "cwebdir/common.w" +#line 621 "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 1003 "cwebdir/common.w" int history= spotless; /*:65*//*73:*/ -#line 1129 "cwebdir/common.w" +#line 1126 "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 447 "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 1133 "cwebdir/common.w" boolean flags[128]; /*:73*//*83:*/ -#line 1272 "cwebdir/common.w" +#line 1269 "cwebdir/common.w" FILE*C_file; FILE*tex_file; FILE*idx_file; -#line 571 "cwebdir/comm-w2c.ch" +#line 577 "cwebdir/comm-w2c.ch" FILE*scn_file; FILE*check_file; -#line 578 "cwebdir/comm-w2c.ch" +#line 584 "cwebdir/comm-w2c.ch" FILE*active_file; char*found_filename; -#line 1278 "cwebdir/common.w" +#line 1275 "cwebdir/common.w" -#line 595 "cwebdir/comm-w2c.ch" +#line 601 "cwebdir/comm-w2c.ch" /*:83*//*86:*/ -#line 640 "cwebdir/comm-w2c.ch" +#line 646 "cwebdir/comm-w2c.ch" const char*use_language= ""; /*:86*//*87:*/ -#line 653 "cwebdir/comm-w2c.ch" +#line 659 "cwebdir/comm-w2c.ch" char cb_banner[max_banner]; string texmf_locale; @@ -463,27 +460,27 @@ static boolean input_ln(FILE*); static void prime_the_change_buffer(void); /*:28*//*33:*/ -#line 337 "cwebdir/common.w" +#line 334 "cwebdir/common.w" static void check_change(void); /*:33*//*55:*/ -#line 767 "cwebdir/common.w" +#line 764 "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); /*:55*//*64:*/ -#line 994 "cwebdir/common.w" +#line 991 "cwebdir/common.w" static int section_name_cmp(char**,int,name_pointer); /*:64*//*76:*/ -#line 1189 "cwebdir/common.w" +#line 1186 "cwebdir/common.w" static void scan_args(void); -#line 501 "cwebdir/comm-w2c.ch" +#line 507 "cwebdir/comm-w2c.ch" /*:76*//*96:*/ -#line 810 "cwebdir/comm-w2c.ch" +#line 816 "cwebdir/comm-w2c.ch" static void cb_usage(const_string str); static void cb_usagehelp(const_string*message,const_string bug_email); @@ -500,7 +497,7 @@ common_init(void) { #line 78 "cwebdir/comm-w2c.ch" /*45:*/ -#line 608 "cwebdir/common.w" +#line 605 "cwebdir/common.w" name_dir->byte_start= byte_ptr= byte_mem; name_ptr= name_dir+1; @@ -508,7 +505,7 @@ name_ptr->byte_start= byte_mem; root= NULL; /*:45*//*47:*/ -#line 631 "cwebdir/common.w" +#line 628 "cwebdir/common.w" for(h= hash;h<=hash_end;*h++= NULL); @@ -516,7 +513,7 @@ for(h= hash;h<=hash_end;*h++= NULL); #line 78 "cwebdir/comm-w2c.ch" /*92:*/ -#line 772 "cwebdir/comm-w2c.ch" +#line 778 "cwebdir/comm-w2c.ch" kpse_set_program_name(argv[0],"cweb"); @@ -525,7 +522,7 @@ kpse_set_program_name(argv[0],"cweb"); #line 85 "cwebdir/comm-w2c.ch" /*90:*/ -#line 720 "cwebdir/comm-w2c.ch" +#line 726 "cwebdir/comm-w2c.ch" setlocale(LC_MESSAGES,setlocale(LC_CTYPE,"")); texmf_locale= kpse_var_expand("${TEXMFLOCALEDIR}"); @@ -544,18 +541,18 @@ textdomain("cweb"); #line 85 "cwebdir/comm-w2c.ch" /*74:*/ -#line 1142 "cwebdir/common.w" +#line 1139 "cwebdir/common.w" -#line 448 "cwebdir/comm-w2c.ch" +#line 454 "cwebdir/comm-w2c.ch" make_xrefs= check_for_change= true; -#line 1144 "cwebdir/common.w" +#line 1141 "cwebdir/common.w" /*:74*/ #line 86 "cwebdir/comm-w2c.ch" #line 101 "cwebdir/common.w" /*84:*/ -#line 595 "cwebdir/comm-w2c.ch" +#line 601 "cwebdir/comm-w2c.ch" scan_args(); if(program==ctangle){ @@ -586,9 +583,9 @@ else strcpy(dot_pos,".wtp"); if((tex_file= fopen(check_file_name,"wb"))==NULL) fatal(_("! Cannot open output file "),check_file_name); } -#line 1290 "cwebdir/common.w" +#line 1287 "cwebdir/common.w" -#line 630 "cwebdir/comm-w2c.ch" +#line 636 "cwebdir/comm-w2c.ch" /*:84*/ #line 101 "cwebdir/common.w" @@ -669,10 +666,8 @@ return; /*31:*/ #line 270 "cwebdir/common.w" -{ change_limit= change_buffer+(ptrdiff_t)(limit-buffer); strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); -} /*:31*/ #line 234 "cwebdir/common.w" @@ -680,7 +675,7 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); } /*:27*//*32:*/ -#line 299 "cwebdir/common.w" +#line 296 "cwebdir/common.w" static void check_change(void) @@ -697,7 +692,7 @@ changing= 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 311 "cwebdir/common.w" change_limit= change_buffer;changing= false; return; @@ -705,12 +700,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 336 "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 339 "cwebdir/common.w" } else if(xyz_code=='y'){ @@ -719,7 +714,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 346 "cwebdir/common.w" } change_depth= include_depth; @@ -727,26 +722,24 @@ return; } /*:34*/ -#line 321 "cwebdir/common.w" +#line 318 "cwebdir/common.w" } /*31:*/ #line 270 "cwebdir/common.w" -{ change_limit= change_buffer+(ptrdiff_t)(limit-buffer); strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); -} /*:31*/ -#line 323 "cwebdir/common.w" +#line 320 "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 325 "cwebdir/common.w" input_has_ended= true;return; } @@ -757,14 +750,14 @@ if(lines_dont_match)n++; } /*:32*//*35:*/ -#line 359 "cwebdir/common.w" +#line 356 "cwebdir/common.w" void reset_input(void) { limit= buffer;loc= buffer+1;buffer[0]= ' '; /*36:*/ -#line 374 "cwebdir/common.w" +#line 371 "cwebdir/common.w" #line 149 "cwebdir/comm-w2c.ch" if((found_filename= kpse_find_cweb(web_file_name))==NULL @@ -777,7 +770,7 @@ 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 377 "cwebdir/common.w" web_file_open= true; @@ -792,10 +785,10 @@ 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 382 "cwebdir/common.w" /*:36*/ -#line 364 "cwebdir/common.w" +#line 361 "cwebdir/common.w" include_depth= cur_line= change_line= 0; change_depth= include_depth; @@ -804,20 +797,20 @@ limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= false; } /*:35*//*38:*/ -#line 403 "cwebdir/common.w" +#line 400 "cwebdir/common.w" boolean get_line(void) { restart: if(changing&&include_depth==change_depth) /*41:*/ -#line 511 "cwebdir/common.w" +#line 508 "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 512 "cwebdir/common.w" buffer[0]= '@';buffer[1]= 'z';limit= buffer+2; } @@ -835,7 +828,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 528 "cwebdir/common.w" } else if(buffer[1]=='z'){ @@ -846,11 +839,11 @@ prime_the_change_buffer();changing= !changing;print_where= true; } /*:41*/ -#line 408 "cwebdir/common.w" +#line 405 "cwebdir/common.w" if(!changing||include_depth> change_depth){ /*40:*/ -#line 494 "cwebdir/common.w" +#line 491 "cwebdir/common.w" { cur_line++; while(!input_ln(cur_file)){ @@ -869,7 +862,7 @@ if(change_limit> change_buffer)check_change(); } /*:40*/ -#line 410 "cwebdir/common.w" +#line 407 "cwebdir/common.w" if(changing&&include_depth==change_depth)goto restart; } @@ -881,25 +874,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 417 "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 422 "cwebdir/common.w" goto restart; } include_depth++; /*39:*/ -#line 448 "cwebdir/common.w" +#line 445 "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 450 "cwebdir/common.w" if(*loc=='"'){ loc++; @@ -920,17 +913,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 461 "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 489 "cwebdir/common.w" } /*:39*/ -#line 429 "cwebdir/common.w" +#line 426 "cwebdir/common.w" } return true; @@ -938,7 +931,7 @@ return true; #line 201 "cwebdir/comm-w2c.ch" /*:38*//*42:*/ -#line 543 "cwebdir/common.w" +#line 540 "cwebdir/common.w" void check_complete(void){ @@ -948,13 +941,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 548 "cwebdir/common.w" } } /*:42*//*48:*/ -#line 636 "cwebdir/common.w" +#line 633 "cwebdir/common.w" name_pointer id_lookup( @@ -969,17 +962,17 @@ name_pointer p; if(last==NULL)for(last= first;*last!='\0';last++); l= (int)(last-first); /*49:*/ -#line 659 "cwebdir/common.w" +#line 656 "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 646 "cwebdir/common.w" /*50:*/ -#line 667 "cwebdir/common.w" +#line 664 "cwebdir/common.w" p= hash[h]; while(p&&!names_match(p,first,l,t))p= p->link; @@ -989,28 +982,28 @@ p->link= hash[h];hash[h]= p; } /*:50*/ -#line 650 "cwebdir/common.w" +#line 647 "cwebdir/common.w" if(p==name_ptr)/*51:*/ -#line 679 "cwebdir/common.w" +#line 676 "cwebdir/common.w" { -#line 293 "cwebdir/comm-w2c.ch" +#line 299 "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 679 "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 648 "cwebdir/common.w" return p; } /*:48*//*52:*/ -#line 711 "cwebdir/common.w" +#line 708 "cwebdir/common.w" void print_section_name( @@ -1029,7 +1022,7 @@ if(q)term_write("...",3); } /*:52*//*53:*/ -#line 728 "cwebdir/common.w" +#line 725 "cwebdir/common.w" void sprint_section_name( @@ -1049,7 +1042,7 @@ s= p->byte_start; } /*:53*//*54:*/ -#line 746 "cwebdir/common.w" +#line 743 "cwebdir/common.w" void print_prefix_name( @@ -1062,7 +1055,7 @@ if(s+l<(p+1)->byte_start)term_write("...",3); } /*:54*//*56:*/ -#line 772 "cwebdir/common.w" +#line 769 "cwebdir/common.w" static int web_strcmp( char*j, @@ -1080,7 +1073,7 @@ else return greater; } /*:56*//*57:*/ -#line 801 "cwebdir/common.w" +#line 798 "cwebdir/common.w" static name_pointer add_section_name( @@ -1093,10 +1086,10 @@ boolean ispref) name_pointer p= name_ptr; char*s= first_chunk(p); int name_len= (int)(last-first)+ispref; -#line 301 "cwebdir/comm-w2c.ch" +#line 307 "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 812 "cwebdir/common.w" (++name_ptr)->byte_start= byte_ptr= s+name_len; if(ispref){ *(byte_ptr-1)= ' '; @@ -1112,7 +1105,7 @@ return par==NULL?(root= p):c==less?(par->llink= p):(par->rlink= p); } /*:57*//*58:*/ -#line 829 "cwebdir/common.w" +#line 826 "cwebdir/common.w" static void extend_section_name( @@ -1124,23 +1117,23 @@ boolean ispref) char*s; name_pointer q= p+1; int name_len= (int)(last-first)+ispref; -#line 308 "cwebdir/comm-w2c.ch" +#line 314 "cwebdir/comm-w2c.ch" if(name_ptr>=name_dir_end)overflow(_("name")); -#line 841 "cwebdir/common.w" +#line 838 "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" +#line 320 "cwebdir/comm-w2c.ch" if(s+name_len> byte_mem_end)overflow(_("byte memory")); -#line 846 "cwebdir/common.w" +#line 843 "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 854 "cwebdir/common.w" name_pointer section_lookup( @@ -1155,7 +1148,7 @@ name_pointer par= NULL; int name_len= (int)(last-first)+1; /*60:*/ -#line 881 "cwebdir/common.w" +#line 878 "cwebdir/common.w" while(p){ c= web_strcmp(first,name_len,first_chunk(p),prefix_length(p)); @@ -1165,14 +1158,14 @@ par= p; p= (c==less?p->llink:p->rlink); }else{ if(r!=NULL){ -#line 320 "cwebdir/comm-w2c.ch" +#line 326 "cwebdir/comm-w2c.ch" fputs(_("\n! Ambiguous prefix: matches <"),stdout); -#line 891 "cwebdir/common.w" +#line 888 "cwebdir/common.w" print_prefix_name(p); -#line 326 "cwebdir/comm-w2c.ch" +#line 332 "cwebdir/comm-w2c.ch" fputs(_(">\n and <"),stdout); -#line 894 "cwebdir/common.w" +#line 891 "cwebdir/common.w" print_prefix_name(r); err_print(">"); return name_dir; @@ -1186,27 +1179,27 @@ p= q,q= NULL; } /*:60*/ -#line 871 "cwebdir/common.w" +#line 868 "cwebdir/common.w" /*61:*/ -#line 906 "cwebdir/common.w" +#line 903 "cwebdir/common.w" if(r==NULL) return add_section_name(par,c,first,last+1,ispref); /*:61*/ -#line 872 "cwebdir/common.w" +#line 869 "cwebdir/common.w" /*62:*/ -#line 914 "cwebdir/common.w" +#line 911 "cwebdir/common.w" switch(section_name_cmp(&first,name_len,r)){ case prefix: if(!ispref){ -#line 332 "cwebdir/comm-w2c.ch" +#line 338 "cwebdir/comm-w2c.ch" fputs(_("\n! New name is a prefix of <"),stdout); -#line 920 "cwebdir/common.w" +#line 917 "cwebdir/common.w" print_section_name(r); err_print(">"); @@ -1218,34 +1211,34 @@ case extension:if(!ispref||first<=last) extend_section_name(r,first,last+1,ispref); break; case bad_extension: -#line 338 "cwebdir/comm-w2c.ch" +#line 344 "cwebdir/comm-w2c.ch" fputs(_("\n! New name extends <"),stdout); -#line 932 "cwebdir/common.w" +#line 929 "cwebdir/common.w" print_section_name(r); err_print(">"); break; default: -#line 344 "cwebdir/comm-w2c.ch" +#line 350 "cwebdir/comm-w2c.ch" fputs(_("\n! Section name incompatible with <"),stdout); -#line 938 "cwebdir/common.w" +#line 935 "cwebdir/common.w" print_prefix_name(r); -#line 350 "cwebdir/comm-w2c.ch" +#line 356 "cwebdir/comm-w2c.ch" fputs(_(">,\n which abbreviates <"),stdout); -#line 941 "cwebdir/common.w" +#line 938 "cwebdir/common.w" print_section_name(r); err_print(">"); } return r; /*:62*/ -#line 873 "cwebdir/common.w" +#line 870 "cwebdir/common.w" } /*:59*//*63:*/ -#line 962 "cwebdir/common.w" +#line 959 "cwebdir/common.w" static int section_name_cmp( char**pfirst, @@ -1279,23 +1272,23 @@ default:return c; } /*:63*//*66:*/ -#line 1016 "cwebdir/common.w" +#line 1013 "cwebdir/common.w" void err_print( const char*s) { -char*k,*l; printf(*s=='!'?"\n%s":"%s",s); if(web_file_open)/*67:*/ -#line 1036 "cwebdir/common.w" +#line 1032 "cwebdir/common.w" -{if(changing&&include_depth==change_depth) -#line 358 "cwebdir/comm-w2c.ch" +{char*k,*l; +if(changing&&include_depth==change_depth) +#line 364 "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 1038 "cwebdir/common.w" l= (loc>=limit?limit:loc); if(l> buffer){ for(k= buffer;k<l;k++) @@ -1310,24 +1303,24 @@ putchar(' '); } /*:67*/ -#line 1023 "cwebdir/common.w" +#line 1019 "cwebdir/common.w" update_terminal;mark_error; } /*:66*//*68:*/ -#line 1068 "cwebdir/common.w" +#line 1065 "cwebdir/common.w" int wrap_up(void){ if(show_progress)new_line; if(show_stats) print_stats(); -#line 388 "cwebdir/comm-w2c.ch" +#line 394 "cwebdir/comm-w2c.ch" /*69:*/ -#line 1078 "cwebdir/common.w" +#line 1075 "cwebdir/common.w" switch(history){ -#line 414 "cwebdir/comm-w2c.ch" +#line 420 "cwebdir/comm-w2c.ch" case spotless: if(show_happiness)puts(_("(No errors were found.)"));break; case harmless_message: @@ -1336,14 +1329,14 @@ 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.)")); -#line 1088 "cwebdir/common.w" +#line 1085 "cwebdir/common.w" } /*:69*/ -#line 388 "cwebdir/comm-w2c.ch" +#line 394 "cwebdir/comm-w2c.ch" /*88:*/ -#line 664 "cwebdir/comm-w2c.ch" +#line 670 "cwebdir/comm-w2c.ch" if(C_file)fclose(C_file); if(tex_file)fclose(tex_file); @@ -1352,20 +1345,20 @@ if(strlen(check_file_name)) remove(check_file_name); /*:88*/ -#line 389 "cwebdir/comm-w2c.ch" +#line 395 "cwebdir/comm-w2c.ch" -#line 396 "cwebdir/comm-w2c.ch" +#line 402 "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; } -#line 1076 "cwebdir/common.w" +#line 1073 "cwebdir/common.w" } /*:68*//*70:*/ -#line 1096 "cwebdir/common.w" +#line 1093 "cwebdir/common.w" void fatal( const char*s,const char*t) @@ -1376,19 +1369,19 @@ history= fatal_message;exit(wrap_up()); } /*:70*//*71:*/ -#line 1107 "cwebdir/common.w" +#line 1104 "cwebdir/common.w" void overflow( const char*t) { -#line 427 "cwebdir/comm-w2c.ch" +#line 433 "cwebdir/comm-w2c.ch" printf(_("\n! Sorry, %s capacity exceeded"),t);fatal("",""); -#line 1112 "cwebdir/common.w" +#line 1109 "cwebdir/common.w" } /*:71*//*75:*/ -#line 1160 "cwebdir/common.w" +#line 1157 "cwebdir/common.w" static void scan_args(void) @@ -1399,7 +1392,7 @@ register char*s; boolean found_web= false,found_change= false,found_out= false; -#line 471 "cwebdir/comm-w2c.ch" +#line 477 "cwebdir/comm-w2c.ch" strcpy(change_file_name,"/dev/null"); #if defined DEV_NULL strncpy(change_file_name,DEV_NULL,max_file_name_length-2); @@ -1409,29 +1402,29 @@ strncpy(change_file_name,_DEV_NULL,max_file_name_length-2); change_file_name[max_file_name_length-2]= '\0'; #endif -#line 1171 "cwebdir/common.w" +#line 1168 "cwebdir/common.w" while(--argc> 0){ if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*80:*/ -#line 1250 "cwebdir/common.w" +#line 1247 "cwebdir/common.w" -#line 514 "cwebdir/comm-w2c.ch" +#line 520 "cwebdir/comm-w2c.ch" { if(strcmp("-help",*argv)==0||strcmp("--help",*argv)==0) /*95:*/ -#line 801 "cwebdir/comm-w2c.ch" +#line 807 "cwebdir/comm-w2c.ch" cb_usagehelp(program==ctangle?CTANGLEHELP: program==cweave?CWEAVEHELP:CTWILLHELP,NULL); /*:95*/ -#line 517 "cwebdir/comm-w2c.ch" +#line 523 "cwebdir/comm-w2c.ch" if(strcmp("-version",*argv)==0||strcmp("--version",*argv)==0) /*98:*/ -#line 849 "cwebdir/comm-w2c.ch" +#line 855 "cwebdir/comm-w2c.ch" printversionandexit(cb_banner, program==ctwill?"Donald E. Knuth":"Silvio Levy and Donald E. Knuth", @@ -1439,7 +1432,7 @@ NULL,"Contemporary development on https://github.com/ascherer/cweb.\n"); /*:98*/ -#line 520 "cwebdir/comm-w2c.ch" +#line 526 "cwebdir/comm-w2c.ch" if(strcmp("-verbose",*argv)==0||strcmp("--verbose",*argv)==0) @@ -1453,15 +1446,15 @@ case'v':show_banner= show_progress= show_happiness= true;continue; case'q':show_banner= show_progress= show_happiness= false;continue; case'd': if(sscanf(++dot_pos,"%u",&kpathsea_debug)!=1)/*81:*/ -#line 557 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); -#line 1265 "cwebdir/common.w" +#line 1262 "cwebdir/common.w" -#line 565 "cwebdir/comm-w2c.ch" +#line 571 "cwebdir/comm-w2c.ch" /*:81*/ -#line 532 "cwebdir/comm-w2c.ch" +#line 538 "cwebdir/comm-w2c.ch" while(isdigit(*dot_pos))dot_pos++; dot_pos--; @@ -1472,43 +1465,43 @@ default:flags[(eight_bits)*dot_pos]= flag_change;continue; break; } } -#line 1253 "cwebdir/common.w" +#line 1250 "cwebdir/common.w" -#line 557 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" /*:80*/ -#line 1172 "cwebdir/common.w" +#line 1169 "cwebdir/common.w" else{ s= name_pos= *argv;dot_pos= NULL; -#line 488 "cwebdir/comm-w2c.ch" +#line 494 "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 1179 "cwebdir/common.w" +#line 1176 "cwebdir/common.w" if(!found_web)/*77:*/ -#line 1198 "cwebdir/common.w" +#line 1195 "cwebdir/common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 565 "cwebdir/comm-w2c.ch" +#line 571 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); -#line 1267 "cwebdir/common.w" +#line 1264 "cwebdir/common.w" /*:82*/ -#line 1201 "cwebdir/common.w" +#line 1198 "cwebdir/common.w" if(dot_pos==NULL) sprintf(web_file_name,"%s.w",*argv); else{ strcpy(web_file_name,*argv); -*dot_pos= 0; +*dot_pos= '\0'; } -#line 1209 "cwebdir/common.w" +#line 1206 "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); @@ -1517,22 +1510,22 @@ found_web= true; } /*:77*/ -#line 1180 "cwebdir/common.w" +#line 1177 "cwebdir/common.w" else if(!found_change)/*78:*/ -#line 1216 "cwebdir/common.w" +#line 1213 "cwebdir/common.w" { if(strcmp(*argv,"-")!=0){ if(s-*argv> max_file_name_length-4) /*82:*/ -#line 565 "cwebdir/comm-w2c.ch" +#line 571 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); -#line 1267 "cwebdir/common.w" +#line 1264 "cwebdir/common.w" /*:82*/ -#line 1220 "cwebdir/common.w" +#line 1217 "cwebdir/common.w" if(dot_pos==NULL) sprintf(change_file_name,"%s.ch",*argv); @@ -1542,21 +1535,21 @@ found_change= true; } /*:78*/ -#line 1181 "cwebdir/common.w" +#line 1178 "cwebdir/common.w" else if(!found_out)/*79:*/ -#line 1228 "cwebdir/common.w" +#line 1225 "cwebdir/common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 565 "cwebdir/comm-w2c.ch" +#line 571 "cwebdir/comm-w2c.ch" fatal(_("! Filename too long\n"),*argv); -#line 1267 "cwebdir/common.w" +#line 1264 "cwebdir/common.w" /*:82*/ -#line 1231 "cwebdir/common.w" +#line 1228 "cwebdir/common.w" if(dot_pos==NULL){ sprintf(tex_file_name,"%s.tex",*argv); @@ -1567,7 +1560,7 @@ sprintf(C_file_name,"%s.c",*argv); strcpy(tex_file_name,*argv); strcpy(C_file_name,*argv); if(make_xrefs){ -*dot_pos= 0; +*dot_pos= '\0'; sprintf(idx_file_name,"%s.idx",*argv); sprintf(scn_file_name,"%s.scn",*argv); } @@ -1576,36 +1569,36 @@ found_out= true; } /*:79*/ -#line 1182 "cwebdir/common.w" +#line 1179 "cwebdir/common.w" else/*81:*/ -#line 557 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); -#line 1265 "cwebdir/common.w" +#line 1262 "cwebdir/common.w" -#line 565 "cwebdir/comm-w2c.ch" +#line 571 "cwebdir/comm-w2c.ch" /*:81*/ -#line 1183 "cwebdir/common.w" +#line 1180 "cwebdir/common.w" } } if(!found_web)/*81:*/ -#line 557 "cwebdir/comm-w2c.ch" +#line 563 "cwebdir/comm-w2c.ch" cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); -#line 1265 "cwebdir/common.w" +#line 1262 "cwebdir/common.w" -#line 565 "cwebdir/comm-w2c.ch" +#line 571 "cwebdir/comm-w2c.ch" /*:81*/ -#line 1186 "cwebdir/common.w" +#line 1183 "cwebdir/common.w" } /*:75*//*97:*/ -#line 814 "cwebdir/comm-w2c.ch" +#line 820 "cwebdir/comm-w2c.ch" static void cb_usage(const_string str) { @@ -1639,7 +1632,7 @@ history= spotless;exit(wrap_up()); } /*:97*//*99:*/ -#line 857 "cwebdir/comm-w2c.ch" +#line 863 "cwebdir/comm-w2c.ch" void cb_show_banner(void) { diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index e5b219ab850..35e9962bf64 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -1,18 +1,16 @@ -2021-04-13 Andreas Scherer <https://ascherer.github.io> +2021-06-06 Andreas Scherer <https://ascherer.github.io> * Makefile, - * README, * comm-{mac,mini,ql,w2c}.ch, * comm-w2c.h, - * common.bux, * common.c, * common.h, * common.w, * ctang-{bs,pc,ql,vms,w2c,w32}.ch, * ctangle.c, * ctangle.w, - * ctwill.bux, * ctwill-{mini,w2c}.ch, + * ctwimac.tex, * cweav-{bs,pc,ql,vms,w2c,w32}.ch, * cweave.w, * cwebmac.tex, @@ -21,7 +19,8 @@ * po/cweb[-tl].pot, * po/de/cweb[-tl].po, * po/it/cweb.po, - * system.bux: CWEB 4.3 and CWEBbin 2021. + * prod-twill.w, + * prod.w: CWEB 4.3 and CWEBbin 2021. 2021-03-26 Andreas Scherer <https://ascherer.github.io> diff --git a/Build/source/texk/web2c/cwebdir/Makefile b/Build/source/texk/web2c/cwebdir/Makefile index 58594210ffc..85986b6fbf6 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 --- May 2021 +# Version 4.4 --- June 2021 # Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth @@ -149,16 +149,16 @@ cweave.c: cweave.w $(WCHANGES) common.h prod.w doc: $(SOURCES:.w=.dvi) usermanual: cwebman.tex cwebmac.tex - tex cwebman + $(PDF)tex cwebman fullmanual: usermanual $(SOURCES) comm-man.ch ctang-man.ch cweav-man.ch make cweave ./cweave common.w comm-man.ch - tex common.tex + $(PDF)tex common.tex ./cweave ctangle.w ctang-man.ch - tex ctangle.tex + $(PDF)tex ctangle.tex ./cweave cweave.w cweav-man.ch - tex cweave.tex + $(PDF)tex cweave.tex # be sure to leave ctangle.c and common.c for bootstrapping clean: diff --git a/Build/source/texk/web2c/cwebdir/comm-mac.ch b/Build/source/texk/web2c/cwebdir/comm-mac.ch index 895566d43d3..aa67bf6402b 100644 --- a/Build/source/texk/web2c/cwebdir/comm-mac.ch +++ b/Build/source/texk/web2c/cwebdir/comm-mac.ch @@ -4,9 +4,9 @@ No changes to CTANGLE or CWEAVE are needed. (Contributed 13 Oct 2000 by AndPio@aol.com; slightly edited by Don Knuth) @x in limbo, change the title page document to specify Mac version - \centerline{(Version 4.3)} + \centerline{(Version 4.4)} @y - \centerline{(Version 4.3 for MacOS)} + \centerline{(Version 4.4 for MacOS)} @z @x section 23: Make input_ln accept \n, \r, \n\r, or \r\n as line endings diff --git a/Build/source/texk/web2c/cwebdir/comm-mini.ch b/Build/source/texk/web2c/cwebdir/comm-mini.ch index 0d467e9d876..eed8fa55401 100644 --- a/Build/source/texk/web2c/cwebdir/comm-mini.ch +++ b/Build/source/texk/web2c/cwebdir/comm-mini.ch @@ -1,9 +1,9 @@ Limbo. @x -\def\title{Common code for CTANGLE and CWEAVE (Version 4.3 [CWEBbin 2021])} +\def\title{Common code for CTANGLE and CWEAVE (Version 4.4 [CWEBbin 2021])} @y -\def\title{COMMON (Version 4.3 [CWEBbin 2021])} +\def\title{COMMON (Version 4.4 [CWEBbin 2021])} \def\contentspagenumber{0} @z @@ -57,10 +57,10 @@ current line is nonempty. Section 52. @x -@d first_chunk(p) ((p)->byte_start+2) +@d first_chunk(p) ((p)->byte_start+2) @y @-m@> -@d first_chunk(p) ((p)->byte_start+2) +@d first_chunk(p) ((p)->byte_start+2) @z Section 87. diff --git a/Build/source/texk/web2c/cwebdir/comm-pc.ch b/Build/source/texk/web2c/cwebdir/comm-pc.ch index 9e156ad99b0..5a29188ed73 100644 --- a/Build/source/texk/web2c/cwebdir/comm-pc.ch +++ b/Build/source/texk/web2c/cwebdir/comm-pc.ch @@ -8,7 +8,7 @@ Note: The change to section 16 is not necessary if using a compiler that allows >64K arrays. @x section 16 -@d max_bytes 1000000 /* the number of bytes in identifiers, +@d max_bytes 90000 /* the number of bytes in identifiers, @y @d max_bytes (unsigned)60000 /* the number of bytes in identifiers, @z diff --git a/Build/source/texk/web2c/cwebdir/comm-ql.ch b/Build/source/texk/web2c/cwebdir/comm-ql.ch index bde4a1af31f..a50abbf583d 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.4)} \def\topofcontents{\null\vfill \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and {\ttitlefont CWEAVE}} \vskip 15pt - \centerline{(Version 4.3)} + \centerline{(Version 4.4)} \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.4)} \def\topofcontents{\null\vfill \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and {\ttitlefont CWEAVE}} \vskip 15pt - \centerline{(Version 4.3)} + \centerline{(Version 4.4)} \vfill} \def\botofcontents{\vfill \noindent @@ -40,7 +40,7 @@ for the file name plus one character as string terminator. (Note that (current) QDOS/SMSQ file systems have a limitation of 36 characters as maximum length for a file name. @x -@d max_file_name_length 1024 +@d max_file_name_length 60 @y @d max_file_name_length 42 @z @@ -148,7 +148,7 @@ the routine as if it would work. sprintf(web_file_name,"%s.w",*argv); else { strcpy(web_file_name,*argv); - *dot_pos=0; /* string now ends where the dot was */ + *dot_pos='\0'; /* string now ends where the dot was */ } sprintf(alt_web_file_name,"%s.web",*argv); sprintf(tex_file_name,"%s.tex",name_pos); /* strip off directory name */ @@ -166,7 +166,7 @@ the routine as if it would work. sprintf(web_file_name,"%s_w",*argv); else { strcpy(web_file_name,*argv); - *dot_pos=0; /* string now ends where the dot was */ + *dot_pos='\0'; /* string now ends where the dot was */ } sprintf(alt_web_file_name,"%s_web",*argv); sprintf(tex_file_name,"%s_tex",name_pos); /* strip off directory name */ @@ -219,7 +219,7 @@ the routine as if it would work. strcpy(tex_file_name,*argv); strcpy(C_file_name,*argv); if (make_xrefs) { /* indexes will be generated */ - *dot_pos=0; + *dot_pos='\0'; sprintf(idx_file_name,"%s.idx",*argv); sprintf(scn_file_name,"%s.scn",*argv); } @@ -240,7 +240,7 @@ the routine as if it would work. strcpy(tex_file_name,*argv); strcpy(C_file_name,*argv); if (make_xrefs) { /* indexes will be generated */ - *dot_pos=0; + *dot_pos='\0'; sprintf(idx_file_name,"%s_idx",*argv); sprintf(scn_file_name,"%s_scn",*argv); } diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.ch b/Build/source/texk/web2c/cwebdir/comm-w2c.ch index 737fbfb4485..ecaf3d437b7 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.4)} @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.4 [\TeX~Live])} @z @x - \centerline{(Version 4.3)} + \centerline{(Version 4.4)} @y - \centerline{(Version 4.3 [\TeX~Live])} + \centerline{(Version 4.4 [\TeX~Live])} @z @x @@ -253,7 +253,7 @@ The remainder of the \.{@@i} line after the file name is ignored. #endif /* |CWEBINPUTS| */ } if (l>0) { - if (k+l+2>=cur_file_name_end) too_long(); + if (k+l+2>=cur_file_name_end) too_long(); @.Include file name ...@> for (; k>=cur_file_name; k--) *(k+l+1)=*k; strcpy(cur_file_name,temp_file_name); @@ -287,6 +287,12 @@ The remainder of the \.{@@i} line after the file name is ignored. @z @x +@d hash_size 353 /* should be prime */ +@y +@d hash_size 8501 /* should be prime */ +@z + +@x if (byte_ptr+l>byte_mem_end) overflow("byte memory"); if (name_ptr>=name_dir_end) overflow("name"); @y @@ -712,9 +718,9 @@ There are several ways to set |TEXMFLOCALEDIR|: #if HAVE_GETTEXT #include <locale.h> /* |@!LC_MESSAGES|, |@!LC_CTYPE| */ #else -#define setlocale(A,B) "" -#define bindtextdomain(A,B) "" -#define textdomain(A) "" +#define setlocale(a,b) "" +#define bindtextdomain(a,b) "" +#define textdomain(a) "" #endif @ @<Set locale...@>= diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.h b/Build/source/texk/web2c/cwebdir/comm-w2c.h index 1a803357ddb..73598ddddd9 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 --- May 2021 (works also with later versions) +% Version 4.4 --- June 2021 (works also with later versions) % Copyright (C) 1987,1990,1993 Silvio Levy and Donald E. Knuth @@ -46,7 +46,7 @@ are placed in the context of the `|_|'~macro. This is just a shortcut for the not have this library installed, we wrap things for neutral behavior without internationalization. -@d _(S) gettext(S) +@d _(s) gettext(s) @<Include files@>= #ifndef HAVE_GETTEXT @@ -56,7 +56,7 @@ internationalization. #if HAVE_GETTEXT #include <libintl.h> #else -#define gettext(A) A +#define gettext(a) a #endif @# #include <ctype.h> /* definition of |@!isalpha|, |@!isdigit| and so on */ @@ -152,7 +152,7 @@ extern boolean print_where; /* tells \.{CTANGLE} to print line and file info */ @ Code related to identifier and section name storage: @d length(c) (size_t)((c+1)->byte_start-(c)->byte_start) /* the length of a name */ -@d print_id(c) term_write((c)->byte_start,length((c))) /* print identifier */ +@d print_id(c) term_write((c)->byte_start,length(c)) /* print identifier */ @d llink link /* left link in binary search tree for section names */ @d rlink dummy.Rlink /* right link in binary search tree for section names */ @d root name_dir->rlink /* the root of the binary search tree @@ -252,16 +252,14 @@ extern void cb_show_banner(void); handle \TEX/, so they should be sufficient for most applications of \.{CWEB}. +@d buf_size 1000 /* maximum length of input line, plus one */ +@d longest_name 10000 /* file names, section names, and section texts + shouldn't be longer than this */ +@d long_buf_size (buf_size+longest_name) /* for \.{CWEAVE} */ @d max_bytes 1000000 /* the number of bytes in identifiers, - index entries, and section names */ -@d max_toks 1000000 /* number of bytes in compressed \CEE/ code */ + index entries, and section names; must be less than $2^{24}$ */ @d max_names 10239 /* number of identifiers, strings, section names; must be less than 10240 */ @d max_sections 4000 /* greater than the total number of sections */ -@d max_texts 10239 /* number of replacement texts, must be less than 10240 */ -@d longest_name 10000 /* file and section names and section texts shouldn't be longer than this */ -@d stack_size 500 /* number of simultaneous levels of macro expansion */ -@d buf_size 1000 /* maximum length of input line, plus one */ -@d long_buf_size (buf_size+longest_name) /* for \.{CWEAVE} */ @ End of \.{COMMON} interface. diff --git a/Build/source/texk/web2c/cwebdir/common.c b/Build/source/texk/web2c/cwebdir/common.c index 3480c862a93..16733c11856 100644 --- a/Build/source/texk/web2c/cwebdir/common.c +++ b/Build/source/texk/web2c/cwebdir/common.c @@ -49,7 +49,7 @@ #define max_include_depth 10 \ -#define max_file_name_length 1024 +#define max_file_name_length 60 #define cur_file file[include_depth] #define cur_file_name file_name[include_depth] #define cur_line line[include_depth] @@ -57,7 +57,7 @@ #define web_file_name file_name[0] \ #define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start) -#define print_id(c) term_write((c) ->byte_start,length((c) ) ) +#define print_id(c) term_write((c) ->byte_start,length(c) ) #define llink link #define rlink dummy.Rlink #define root name_dir->rlink \ @@ -82,32 +82,29 @@ #define new_line putchar('\n') #define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) \ -#define max_bytes 1000000 \ +#define buf_size 100 +#define longest_name 10000 \ -#define max_toks 1000000 -#define max_names 10239 \ +#define long_buf_size (buf_size+longest_name) +#define max_bytes 90000 \ -#define max_sections 4000 -#define max_texts 10239 -#define longest_name 10000 -#define stack_size 500 -#define buf_size 1000 -#define long_buf_size (buf_size+longest_name) \ +#define max_names 4000 \ + +#define max_sections 2000 \ #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) { \ +#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; \ -} \ #define too_long() {include_depth--; \ err_print("! Include file name too long") ;goto restart;} \ -#define hash_size 8501 \ +#define hash_size 353 \ #define first_chunk(p) ((p) ->byte_start+2) #define prefix_length(p) (int) ((eight_bits) *((p) ->byte_start) *256+ \ @@ -279,7 +276,7 @@ static char change_buffer[buf_size]; static char*change_limit; /*:26*//*37:*/ -#line 396 "common.w" +#line 393 "common.w" sixteen_bits section_count; boolean changed_section[max_sections]; @@ -288,7 +285,7 @@ boolean change_pending; boolean print_where= false; /*:37*//*43:*/ -#line 593 "common.w" +#line 590 "common.w" char byte_mem[max_bytes]; char*byte_mem_end= byte_mem+max_bytes-1; @@ -296,25 +293,25 @@ name_info name_dir[max_names]; name_pointer name_dir_end= name_dir+max_names-1; /*:43*//*44:*/ -#line 604 "common.w" +#line 601 "common.w" char*byte_ptr; name_pointer name_ptr; /*:44*//*46:*/ -#line 624 "common.w" +#line 621 "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 1003 "common.w" int history= spotless; /*:65*//*73:*/ -#line 1129 "common.w" +#line 1126 "common.w" int argc; char**argv; @@ -325,7 +322,7 @@ char scn_file_name[max_file_name_length]; boolean flags[128]; /*:73*//*83:*/ -#line 1272 "common.w" +#line 1269 "common.w" FILE*C_file; FILE*tex_file; @@ -379,22 +376,22 @@ static boolean input_ln(FILE*); static void prime_the_change_buffer(void); /*:28*//*33:*/ -#line 337 "common.w" +#line 334 "common.w" static void check_change(void); /*:33*//*55:*/ -#line 767 "common.w" +#line 764 "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); /*:55*//*64:*/ -#line 994 "common.w" +#line 991 "common.w" static int section_name_cmp(char**,int,name_pointer); /*:64*//*76:*/ -#line 1189 "common.w" +#line 1186 "common.w" static void scan_args(void); /*:76*/ @@ -408,7 +405,7 @@ void common_init(void) { /*45:*/ -#line 608 "common.w" +#line 605 "common.w" name_dir->byte_start= byte_ptr= byte_mem; name_ptr= name_dir+1; @@ -416,7 +413,7 @@ name_ptr->byte_start= byte_mem; root= NULL; /*:45*//*47:*/ -#line 631 "common.w" +#line 628 "common.w" for(h= hash;h<=hash_end;*h++= NULL); @@ -424,7 +421,7 @@ for(h= hash;h<=hash_end;*h++= NULL); #line 99 "common.w" /*74:*/ -#line 1142 "common.w" +#line 1139 "common.w" show_banner= show_happiness= show_progress= make_xrefs= true; @@ -432,7 +429,7 @@ show_banner= show_happiness= show_progress= make_xrefs= true; #line 100 "common.w" /*84:*/ -#line 1279 "common.w" +#line 1276 "common.w" scan_args(); if(program==ctangle){ @@ -517,10 +514,8 @@ return; /*31:*/ #line 270 "common.w" -{ change_limit= change_buffer+(ptrdiff_t)(limit-buffer); strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); -} /*:31*/ #line 234 "common.w" @@ -528,7 +523,7 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); } /*:27*//*32:*/ -#line 299 "common.w" +#line 296 "common.w" static void check_change(void) @@ -551,7 +546,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 336 "common.w" if(xyz_code=='x'||xyz_code=='z'){ loc= buffer+2;err_print("! Where is the matching @y?"); @@ -569,19 +564,17 @@ return; } /*:34*/ -#line 321 "common.w" +#line 318 "common.w" } /*31:*/ #line 270 "common.w" -{ change_limit= change_buffer+(ptrdiff_t)(limit-buffer); strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); -} /*:31*/ -#line 323 "common.w" +#line 320 "common.w" changing= false;cur_line++; while(!input_ln(cur_file)){ @@ -597,14 +590,14 @@ if(lines_dont_match)n++; } /*:32*//*35:*/ -#line 359 "common.w" +#line 356 "common.w" void reset_input(void) { limit= buffer;loc= buffer+1;buffer[0]= ' '; /*36:*/ -#line 374 "common.w" +#line 371 "common.w" if((web_file= fopen(web_file_name,"r"))==NULL){ strcpy(web_file_name,alt_web_file_name); @@ -618,7 +611,7 @@ if((change_file= fopen(change_file_name,"r"))==NULL) fatal("! Cannot open change file ",change_file_name); /*:36*/ -#line 364 "common.w" +#line 361 "common.w" include_depth= cur_line= change_line= 0; change_depth= include_depth; @@ -627,14 +620,14 @@ limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= false; } /*:35*//*38:*/ -#line 403 "common.w" +#line 400 "common.w" boolean get_line(void) { restart: if(changing&&include_depth==change_depth) /*41:*/ -#line 511 "common.w" +#line 508 "common.w" { change_line++; if(!input_ln(change_file)){ @@ -665,11 +658,11 @@ prime_the_change_buffer();changing= !changing;print_where= true; } /*:41*/ -#line 408 "common.w" +#line 405 "common.w" if(!changing||include_depth> change_depth){ /*40:*/ -#line 494 "common.w" +#line 491 "common.w" { cur_line++; while(!input_ln(cur_file)){ @@ -688,7 +681,7 @@ if(change_limit> change_buffer)check_change(); } /*:40*/ -#line 410 "common.w" +#line 407 "common.w" if(changing&&include_depth==change_depth)goto restart; } @@ -709,7 +702,7 @@ goto restart; } include_depth++; /*39:*/ -#line 448 "common.w" +#line 445 "common.w" { char temp_file_name[max_file_name_length]; char*cur_file_name_end= cur_file_name+max_file_name_length-1; @@ -757,14 +750,14 @@ include_depth--;err_print("! Cannot open include file");goto restart; } /*:39*/ -#line 429 "common.w" +#line 426 "common.w" } return true; } /*:38*//*42:*/ -#line 543 "common.w" +#line 540 "common.w" void check_complete(void){ @@ -778,7 +771,7 @@ err_print("! Change file entry did not match"); } /*:42*//*48:*/ -#line 636 "common.w" +#line 633 "common.w" name_pointer id_lookup( @@ -793,17 +786,17 @@ name_pointer p; if(last==NULL)for(last= first;*last!='\0';last++); l= (int)(last-first); /*49:*/ -#line 659 "common.w" +#line 656 "common.w" h= (eight_bits)*i; while(++i<last)h= (h+h+(int)((eight_bits)*i))%hash_size; /*:49*/ -#line 649 "common.w" +#line 646 "common.w" /*50:*/ -#line 667 "common.w" +#line 664 "common.w" p= hash[h]; while(p&&!names_match(p,first,l,t))p= p->link; @@ -813,10 +806,10 @@ p->link= hash[h];hash[h]= p; } /*:50*/ -#line 650 "common.w" +#line 647 "common.w" if(p==name_ptr)/*51:*/ -#line 679 "common.w" +#line 676 "common.w" { if(byte_ptr+l> byte_mem_end)overflow("byte memory"); if(name_ptr>=name_dir_end)overflow("name"); @@ -826,13 +819,13 @@ init_p(p,t); } /*:51*/ -#line 651 "common.w" +#line 648 "common.w" return p; } /*:48*//*52:*/ -#line 711 "common.w" +#line 708 "common.w" void print_section_name( @@ -851,7 +844,7 @@ if(q)term_write("...",3); } /*:52*//*53:*/ -#line 728 "common.w" +#line 725 "common.w" void sprint_section_name( @@ -871,7 +864,7 @@ s= p->byte_start; } /*:53*//*54:*/ -#line 746 "common.w" +#line 743 "common.w" void print_prefix_name( @@ -884,7 +877,7 @@ if(s+l<(p+1)->byte_start)term_write("...",3); } /*:54*//*56:*/ -#line 772 "common.w" +#line 769 "common.w" static int web_strcmp( char*j, @@ -902,7 +895,7 @@ else return greater; } /*:56*//*57:*/ -#line 801 "common.w" +#line 798 "common.w" static name_pointer add_section_name( @@ -932,7 +925,7 @@ return par==NULL?(root= p):c==less?(par->llink= p):(par->rlink= p); } /*:57*//*58:*/ -#line 829 "common.w" +#line 826 "common.w" static void extend_section_name( @@ -956,7 +949,7 @@ if(ispref)*(byte_ptr-1)= ' '; } /*:58*//*59:*/ -#line 857 "common.w" +#line 854 "common.w" name_pointer section_lookup( @@ -971,7 +964,7 @@ name_pointer par= NULL; int name_len= (int)(last-first)+1; /*60:*/ -#line 881 "common.w" +#line 878 "common.w" while(p){ c= web_strcmp(first,name_len,first_chunk(p),prefix_length(p)); @@ -998,19 +991,19 @@ p= q,q= NULL; } /*:60*/ -#line 871 "common.w" +#line 868 "common.w" /*61:*/ -#line 906 "common.w" +#line 903 "common.w" if(r==NULL) return add_section_name(par,c,first,last+1,ispref); /*:61*/ -#line 872 "common.w" +#line 869 "common.w" /*62:*/ -#line 914 "common.w" +#line 911 "common.w" switch(section_name_cmp(&first,name_len,r)){ @@ -1044,12 +1037,12 @@ err_print(">"); return r; /*:62*/ -#line 873 "common.w" +#line 870 "common.w" } /*:59*//*63:*/ -#line 962 "common.w" +#line 959 "common.w" static int section_name_cmp( char**pfirst, @@ -1083,18 +1076,18 @@ default:return c; } /*:63*//*66:*/ -#line 1016 "common.w" +#line 1013 "common.w" void err_print( const char*s) { -char*k,*l; printf(*s=='!'?"\n%s":"%s",s); if(web_file_open)/*67:*/ -#line 1036 "common.w" +#line 1032 "common.w" -{if(changing&&include_depth==change_depth) +{char*k,*l; +if(changing&&include_depth==change_depth) 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); @@ -1112,20 +1105,20 @@ putchar(' '); } /*:67*/ -#line 1023 "common.w" +#line 1019 "common.w" update_terminal;mark_error; } /*:66*//*68:*/ -#line 1068 "common.w" +#line 1065 "common.w" int wrap_up(void){ if(show_progress)new_line; if(show_stats) print_stats(); /*69:*/ -#line 1078 "common.w" +#line 1075 "common.w" switch(history){ case spotless: @@ -1139,14 +1132,14 @@ puts("(That was a fatal error, my friend.)"); } /*:69*/ -#line 1073 "common.w" +#line 1070 "common.w" if(history> harmless_message)return EXIT_FAILURE; else return EXIT_SUCCESS; } /*:68*//*70:*/ -#line 1096 "common.w" +#line 1093 "common.w" void fatal( const char*s,const char*t) @@ -1157,7 +1150,7 @@ history= fatal_message;exit(wrap_up()); } /*:70*//*71:*/ -#line 1107 "common.w" +#line 1104 "common.w" void overflow( const char*t) @@ -1167,7 +1160,7 @@ printf("\n! Sorry, %s capacity exceeded",t);fatal("",""); /*:71*//*75:*/ -#line 1160 "common.w" +#line 1157 "common.w" static void scan_args(void) @@ -1181,13 +1174,13 @@ 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 1250 "common.w" +#line 1247 "common.w" for(dot_pos= *argv+1;*dot_pos> '\0';dot_pos++) flags[(eight_bits)*dot_pos]= flag_change; /*:80*/ -#line 1172 "common.w" +#line 1169 "common.w" else{ s= name_pos= *argv;dot_pos= NULL; @@ -1196,23 +1189,23 @@ if(*s=='.')dot_pos= s++; else if(*s=='/')dot_pos= NULL,name_pos= ++s; else s++; if(!found_web)/*77:*/ -#line 1198 "common.w" +#line 1195 "common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 1266 "common.w" +#line 1263 "common.w" fatal("! Filename too long\n",*argv); /*:82*/ -#line 1201 "common.w" +#line 1198 "common.w" if(dot_pos==NULL) sprintf(web_file_name,"%s.w",*argv); else{ strcpy(web_file_name,*argv); -*dot_pos= 0; +*dot_pos= '\0'; } sprintf(alt_web_file_name,"%s.web",*argv); sprintf(tex_file_name,"%s.tex",name_pos); @@ -1223,21 +1216,21 @@ found_web= true; } /*:77*/ -#line 1180 "common.w" +#line 1177 "common.w" else if(!found_change)/*78:*/ -#line 1216 "common.w" +#line 1213 "common.w" { if(strcmp(*argv,"-")!=0){ if(s-*argv> max_file_name_length-4) /*82:*/ -#line 1266 "common.w" +#line 1263 "common.w" fatal("! Filename too long\n",*argv); /*:82*/ -#line 1220 "common.w" +#line 1217 "common.w" if(dot_pos==NULL) sprintf(change_file_name,"%s.ch",*argv); @@ -1247,20 +1240,20 @@ found_change= true; } /*:78*/ -#line 1181 "common.w" +#line 1178 "common.w" else if(!found_out)/*79:*/ -#line 1228 "common.w" +#line 1225 "common.w" { if(s-*argv> max_file_name_length-5) /*82:*/ -#line 1266 "common.w" +#line 1263 "common.w" fatal("! Filename too long\n",*argv); /*:82*/ -#line 1231 "common.w" +#line 1228 "common.w" if(dot_pos==NULL){ sprintf(tex_file_name,"%s.tex",*argv); @@ -1271,7 +1264,7 @@ sprintf(C_file_name,"%s.c",*argv); strcpy(tex_file_name,*argv); strcpy(C_file_name,*argv); if(make_xrefs){ -*dot_pos= 0; +*dot_pos= '\0'; sprintf(idx_file_name,"%s.idx",*argv); sprintf(scn_file_name,"%s.scn",*argv); } @@ -1280,10 +1273,10 @@ found_out= true; } /*:79*/ -#line 1182 "common.w" +#line 1179 "common.w" else/*81:*/ -#line 1254 "common.w" +#line 1251 "common.w" { if(program==ctangle) @@ -1297,12 +1290,12 @@ else fatal( } /*:81*/ -#line 1183 "common.w" +#line 1180 "common.w" } } if(!found_web)/*81:*/ -#line 1254 "common.w" +#line 1251 "common.w" { if(program==ctangle) @@ -1316,7 +1309,7 @@ else fatal( } /*:81*/ -#line 1186 "common.w" +#line 1183 "common.w" } diff --git a/Build/source/texk/web2c/cwebdir/common.h b/Build/source/texk/web2c/cwebdir/common.h index 0f8ec182173..17717a52ddb 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 --- May 2021 (works also with later versions) +% Version 4.4 --- June 2021 (works also with later versions) % Copyright (C) 1987,1990,1993 Silvio Levy and Donald E. Knuth @@ -99,7 +99,7 @@ extern char *limit; /* points to the last character in the buffer */ @f line x /* make |line| an unreserved word */ @d max_include_depth 10 /* maximum number of source files open simultaneously, not counting the change file */ -@d max_file_name_length 1024 +@d max_file_name_length 60 @d cur_file file[include_depth] /* current file */ @d cur_file_name file_name[include_depth] /* current file name */ @d cur_line line[include_depth] /* number of current line in current file */ @@ -134,7 +134,7 @@ extern boolean print_where; /* tells \.{CTANGLE} to print line and file info */ @ Code related to identifier and section name storage: @d length(c) (size_t)((c+1)->byte_start-(c)->byte_start) /* the length of a name */ -@d print_id(c) term_write((c)->byte_start,length((c))) /* print identifier */ +@d print_id(c) term_write((c)->byte_start,length(c)) /* print identifier */ @d llink link /* left link in binary search tree for section names */ @d rlink dummy.Rlink /* right link in binary search tree for section names */ @d root name_dir->rlink /* the root of the binary search tree @@ -230,16 +230,14 @@ extern void print_stats(void); handle \TEX/, so they should be sufficient for most applications of \.{CWEB}. -@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 */ -@d max_names 10239 /* number of identifiers, strings, section names; - must be less than 10240 */ -@d max_sections 4000 /* greater than the total number of sections */ -@d max_texts 10239 /* number of replacement texts, must be less than 10240 */ -@d longest_name 10000 /* file and section names and section texts shouldn't be longer than this */ -@d stack_size 500 /* number of simultaneous levels of macro expansion */ -@d buf_size 1000 /* maximum length of input line, plus one */ +@d buf_size 100 /* maximum length of input line, plus one */ +@d longest_name 10000 /* file names, section names, and section texts + shouldn't be longer than this */ @d long_buf_size (buf_size+longest_name) /* for \.{CWEAVE} */ +@d max_bytes 90000 /* the number of bytes in identifiers, + index entries, and section names; must be less than $2^{24}$ */ +@d max_names 4000 /* number of identifiers, strings, section names; + must be less than 10240 */ +@d max_sections 2000 /* greater than the total number of sections */ @ End of \.{COMMON} interface. diff --git a/Build/source/texk/web2c/cwebdir/common.w b/Build/source/texk/web2c/cwebdir/common.w index d6e07025a66..dba196747a2 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 --- May 2021 +% Version 4.4 --- June 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.4)} \def\topofcontents{\null\vfill \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and {\ttitlefont CWEAVE}} \vskip 15pt - \centerline{(Version 4.3)} + \centerline{(Version 4.4)} \vfill} \def\botofcontents{\vfill \noindent @@ -178,7 +178,7 @@ FILE *fp) /* what file to read from */ @ Now comes the problem of deciding which file to read from next. Recall that the actual text that \.{CWEB} should process comes from two streams: a |web_file|, which can contain possibly nested include -commands \.{@@i}, and a |change_file|, which might also contain +commands~\.{@@i}, and a |change_file|, which might also contain includes. The |web_file| together with the currently open include files form a stack |file|, whose names are stored in a parallel stack |file_name|. The boolean |changing| tells whether or not we're reading @@ -268,10 +268,8 @@ do { } while (limit==buffer); @ @<Move |buffer| and |limit| to |change_buffer| and |change_limit|@>= -{ - change_limit=change_buffer+(ptrdiff_t)(limit-buffer); - strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); -} +change_limit=change_buffer+(ptrdiff_t)(limit-buffer); +strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); @ The following procedure is used to see if the next change entry should go into effect; it is called only when |changing| is |false|. @@ -289,12 +287,11 @@ 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) { +@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; -} @c static void @@ -478,7 +475,7 @@ The remainder of the \.{@@i} line after the file name is ignored. #endif /* |CWEBINPUTS| */ } if (l>0) { - if (k+l+2>=cur_file_name_end) too_long(); + if (k+l+2>=cur_file_name_end) too_long(); @.Include file name ...@> for (; k>=cur_file_name; k--) *(k+l+1)=*k; strcpy(cur_file_name,temp_file_name); @@ -619,7 +616,7 @@ function |names_match|, which is slightly different in \.{CWEAVE} and \.{CTANGLE}. If there is no match for the identifier, it is inserted into the table. -@d hash_size 8501 /* should be prime */ +@d hash_size 353 /* should be prime */ @<Global var...@>= name_pointer hash[hash_size]; /* heads of hash lists */ @@ -886,7 +883,7 @@ while (p) { /* compare shortest prefix of |p| with new name */ par=p; p=(c==less?p->llink:p->rlink); } else { /* new name matches |p| */ - if (r!=NULL) { /* and also |r|: illegal */ + if (r!=NULL) { /* and also |r|: illegal */ fputs("\n! Ambiguous prefix: matches <",stdout); @.Ambiguous prefix ... @> print_prefix_name(p); @@ -1018,7 +1015,6 @@ void err_print( /* prints `\..' and location of error message */ const char *s) { - char *k,*l; /* pointers into |buffer| */ printf(*s=='!'? "\n%s" : "%s",s); if (web_file_open) @<Print error location based on input buffer@>@; update_terminal; mark_error; @@ -1034,7 +1030,8 @@ has special line-numbering conventions. @^system dependencies@> @<Print error location based on input buffer@>= -{if (changing && include_depth==change_depth) +{char *k,*l; /* pointers into |buffer| */ +if (changing && include_depth==change_depth) 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); @@ -1203,7 +1200,7 @@ after the dot. We must check that there is enough room in sprintf(web_file_name,"%s.w",*argv); else { strcpy(web_file_name,*argv); - *dot_pos=0; /* string now ends where the dot was */ + *dot_pos='\0'; /* string now ends where the dot was */ } sprintf(alt_web_file_name,"%s.web",*argv); sprintf(tex_file_name,"%s.tex",name_pos); /* strip off directory name */ @@ -1238,7 +1235,7 @@ after the dot. We must check that there is enough room in strcpy(tex_file_name,*argv); strcpy(C_file_name,*argv); if (make_xrefs) { /* indexes will be generated */ - *dot_pos=0; + *dot_pos='\0'; sprintf(idx_file_name,"%s.idx",*argv); sprintf(scn_file_name,"%s.scn",*argv); } diff --git a/Build/source/texk/web2c/cwebdir/ctang-bs.ch b/Build/source/texk/web2c/cwebdir/ctang-bs.ch index fcd2706b36e..fa4b90c0a26 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-bs.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-bs.ch @@ -17,12 +17,12 @@ by using "huge" pointers. The ``banner line'' defined here should be changed whenever \.{CTANGLE} is modified. -@d banner "This is CTANGLE (Version 4.3)" +@d banner "This is CTANGLE (Version 4.4)" @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.4pc/big)" @z @@ -84,49 +84,6 @@ extern hash_pointer h; /* index into hash-head array */ @z -@x Section 17. -@ The following parameters were sufficient in the original \.{WEB} to -handle \TEX/, so they should be sufficient for most applications of -\.{CWEB}. - -@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 */ -@d max_names 10239 /* number of identifiers, strings, section names; - must be less than 10240 */ -@d max_sections 4000 /* greater than the total number of sections */ -@d max_texts 10239 /* number of replacement texts, must be less than 10240 */ -@d longest_name 10000 /* file and section names and section texts shouldn't be longer than this */ -@d stack_size 500 /* number of simultaneous levels of macro expansion */ -@d buf_size 1000 /* maximum length of input line, plus one */ -@y -@ The following parameters were sufficient in the original \.{WEB} to -handle \TEX/, so they should be sufficient for most applications of -\.{CWEB}. - -(This is a modified version of \.{CTANGLE}, and in fact one of the parameters -has been reduced in value. The parameter |max_toks| -has been reduced from 270000 [which -was sufficient to handle \TEX/] to -170000, so that \.{CTANGLE} -may be run on {\mc MSDOS} -systems that are tight on memory. Consider, for -instance, an 80286-based machine with several TSRs and drivers, trying -to run \.{CTANGLE} from a makefile.) - -@d max_bytes 90000 /* the number of bytes in identifiers, - index entries, and section names */ -@d max_toks 170000 /* number of bytes in compressed \CEE/ code */ -@d max_names 4000 /* number of identifiers, strings, section names; - must be less than 10240 */ -@d max_sections 4000 /* greater than the total number of sections */ -@d max_texts 2500 /* number of replacement texts, must be less than 10240 */ -@d longest_name 10000 /* file and section names and section texts shouldn't be longer than this */ -@d stack_size 50 /* number of simultaneous levels of macro expansion */ -@d buf_size 100 /* for \.{CWEAVE} */ -@z - - @x Section 19. eight_bits *tok_start; /* pointer into |tok_mem| */ sixteen_bits text_link; /* relates replacement texts */ @@ -141,6 +98,22 @@ typedef text *text_pointer; @x Section 20. +@ @d max_texts 2500 /* number of replacement texts, must be less than 10240 */ +@d max_toks 270000 /* number of bytes in compressed \CEE/ code */ +@y +@ (This is a modified version of \.{CTANGLE}, and in fact one of the parameters +has been reduced in value. The parameter |max_toks| +has been reduced from 270000 [which +was sufficient to handle \TEX/] to +170000, so that \.{CTANGLE} +may be run on {\mc MSDOS} +systems that are tight on memory. Consider, for +instance, an 80286-based machine with several TSRs and drivers, trying +to run \.{CTANGLE} from a makefile.) +@d max_texts 2500 /* number of replacement texts, must be less than 10240 */ +@d max_toks 170000 /* number of bytes in compressed \CEE/ code */ +@z +@x 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| */ diff --git a/Build/source/texk/web2c/cwebdir/ctang-pc.ch b/Build/source/texk/web2c/cwebdir/ctang-pc.ch index 025790e3fc7..f84c798da4b 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-pc.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-pc.ch @@ -9,16 +9,19 @@ 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.4)" @y -@d banner "This is CTANGLE (Version 4.3pc)" +@d banner "This is CTANGLE (Version 4.4pc)" @z @x section 17 -@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 */ +@d max_bytes 90000 /* the number of bytes in identifiers, + index entries, and section names; must be less than $2^{24}$ */ @y (note that CWEAVE itself needs only about 42K toks) @d max_bytes (unsigned)60000 /* the number of bytes in identifiers, - index entries, and section names */ + index entries, and section names; must be less than $2^{24}$ */ +@z +@x section 20 +@d max_toks 270000 /* number of bytes in compressed \CEE/ code */ +@y @d max_toks (unsigned)60000 /* number of bytes in compressed \CEE/ code */ @z diff --git a/Build/source/texk/web2c/cwebdir/ctang-ql.ch b/Build/source/texk/web2c/cwebdir/ctang-ql.ch index 6d5fe6b3e3a..27a7d013cf6 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.4)} @y -\def\title{CTANGLE (QL Version 4.3)} +\def\title{CTANGLE (QL Version 4.4)} @z @x section 1 -@d banner "This is CTANGLE (Version 4.3)" +@d banner "This is CTANGLE (Version 4.4)" @y -@d banner "This is CTANGLE (QL Version 4.3)" +@d banner "This is CTANGLE (QL Version 4.4)" @z @x diff --git a/Build/source/texk/web2c/cwebdir/ctang-vms.ch b/Build/source/texk/web2c/cwebdir/ctang-vms.ch index 753e8d94a18..a72de2997be 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-vms.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-vms.ch @@ -10,9 +10,9 @@ created: (these changes not necessary for initial bootstrapping) @x section 1 (01-FEB-1992 ST) -@d banner "This is CTANGLE (Version 4.3)" +@d banner "This is CTANGLE (Version 4.4)" @y -@d banner "This is CTANGLE (VAX/VMS Version 4.3)" +@d banner "This is CTANGLE (VAX/VMS Version 4.4)" @z @x section 4 (01-FEB-1992 ST) diff --git a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch index f9ae82e028c..b594fc93a03 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.4)} @y -\def\title{CTANGLE (Version 4.3 [\TeX~Live])} +\def\title{CTANGLE (Version 4.4 [\TeX~Live])} @z @x - \centerline{(Version 4.3)} + \centerline{(Version 4.4)} @y - \centerline{(Version 4.3 [\TeX~Live])} + \centerline{(Version 4.4 [\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.4)" @y -@d banner "This is CTANGLE, Version 4.3" +@d banner "This is CTANGLE, Version 4.4" /* will be extended by the \TeX~Live |versionstring| */ @z @@ -60,6 +60,14 @@ @z @x +@ @d max_texts 2500 /* number of replacement texts, must be less than 10240 */ +@d max_toks 270000 /* number of bytes in compressed \CEE/ code */ +@y +@ @d max_texts 10239 /* number of replacement texts, must be less than 10240 */ +@d max_toks 1000000 /* number of bytes in compressed \CEE/ code */ +@z + +@x if (tok_ptr+2>tok_mem_end) overflow("token"); @y if (tok_ptr+2>tok_mem_end) overflow(_("token")); @@ -119,7 +127,7 @@ 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_name=*an_output_file; cur_repl=(text_pointer)cur_name->equiv; cur_byte=cur_repl->tok_start; cur_end=(cur_repl+1)->tok_start; @@ -142,7 +150,7 @@ 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_name=*an_output_file; cur_repl=(text_pointer)cur_name->equiv; cur_byte=cur_repl->tok_start; cur_end=(cur_repl+1)->tok_start; @@ -190,15 +198,15 @@ strcpy(check_file_name,""); /* We want to get rid of the temporary file */ @z @x - case translit_code: err_print("! Use @@l in limbo only"); continue; + case translit_code: err_print("! Use @@l in limbo only"); continue; @y - case translit_code: err_print(_("! Use @@l in limbo only")); continue; + case translit_code: err_print(_("! Use @@l in limbo only")); continue; @z @x - err_print("! Double @@ should be used in control text"); + err_print("! Double @@ should be used in control text"); @y - err_print(_("! Double @@ should be used in control text")); + err_print(_("! Double @@ should be used in control text")); @z @x @@ -238,15 +246,15 @@ strcpy(check_file_name,""); /* We want to get rid of the temporary file */ @z @x - if (loc>=limit) err_print("! Verbatim string didn't end"); +if (loc>=limit) err_print("! Verbatim string didn't end"); @y - if (loc>=limit) err_print(_("! Verbatim string didn't end")); +if (loc>=limit) err_print(_("! Verbatim string didn't end")); @z @x -@d app_repl(c) {if (tok_ptr==tok_mem_end) overflow("token"); *tok_ptr++=c;} +@d app_repl(c) {if (tok_ptr==tok_mem_end) overflow("token"); *(tok_ptr++)=c;} @y -@d app_repl(c) {if (tok_ptr==tok_mem_end) overflow(_("token")); *tok_ptr++=c;} +@d app_repl(c) {if (tok_ptr==tok_mem_end) overflow(_("token")); *(tok_ptr++)=c;} @z @x @@ -286,9 +294,9 @@ case output_defs_code: if (t!=section_name) err_print(_("! Misplaced @@h")); @z @x - err_print("! Definition flushed, must start with identifier"); + err_print("! Definition flushed, must start with identifier"); @y - err_print(_("! Definition flushed, must start with identifier")); + err_print(_("! Definition flushed, must start with identifier")); @z @x @@ -361,8 +369,7 @@ if((C_file=fopen(C_file_name,"r"))!=NULL) { rename(check_file_name,C_file_name); /* This was the first run */ @ @<Set up the comparison of temporary output@>= - char x[BUFSIZ],y[BUFSIZ]; - int x_size,y_size,comparison=false; + boolean comparison=false; if((check_file=fopen(check_file_name,"r"))==NULL) fatal(_("! Cannot open output file "),check_file_name); @@ -377,10 +384,10 @@ if((C_file=fopen(C_file_name,"r"))!=NULL) { @<Compare the temporary output to the previous output@>= do { - x_size = fread(x,1,BUFSIZ,C_file); - y_size = fread(y,1,BUFSIZ,check_file); - comparison = (x_size == y_size); /* Do not merge these statements! */ - if(comparison) comparison = !memcmp(x,y,x_size); + char x[BUFSIZ],y[BUFSIZ]; + int x_size = fread(x,sizeof(char),BUFSIZ,C_file); + int y_size = fread(y,sizeof(char),BUFSIZ,check_file); + comparison = (x_size == y_size) && !memcmp(x,y,x_size); } while(comparison && !feof(C_file) && !feof(check_file)); @ Note the superfluous call to |remove| before |rename|. We're using it to @@ -400,13 +407,13 @@ instead of to a file (in \.{@@(...@@>}) to \.{/dev/null} or \.{/dev/stdout} or to a file and finally get rid of that file. @<Update the secondary results...@>= -if(0==strcmp("/dev/stdout",output_file_name)) +if(0==strcmp("/dev/stdout",output_file_name))@/ @<Redirect temporary output to \.{/dev/stdout}@>@; -else if(0==strcmp("/dev/stderr",output_file_name)) +else if(0==strcmp("/dev/stderr",output_file_name))@/ @<Redirect temporary output to \.{/dev/stderr}@>@; -else if(0==strcmp("/dev/null",output_file_name)) +else if(0==strcmp("/dev/null",output_file_name))@/ @<Redirect temporary output to \.{/dev/null}@>@; -else { /* Hopefully a \\{regular} output file */ +else { /* Hopefully a regular output file */ if((C_file=fopen(output_file_name,"r"))!=NULL) { @<Set up the comparison of temporary output@>@; @<Create the secondary output depending on the comparison@>@; @@ -429,7 +436,7 @@ else { @<Redirect temporary output to \.{/dev/stdout}@>={ @<Setup system redirection@>@; do { - in_size = fread(in_buf,1,BUFSIZ,check_file); + in_size = fread(in_buf,sizeof(char),BUFSIZ,check_file); in_buf[in_size]='\0'; fprintf(stdout,"%s",in_buf); } while(!feof(check_file));@/ @@ -442,7 +449,7 @@ else { @<Redirect temporary output to \.{/dev/stderr}@>={ @<Setup system redirection@>@; do { - in_size = fread(in_buf,1,BUFSIZ,check_file); + in_size = fread(in_buf,sizeof(char),BUFSIZ,check_file); in_buf[in_size]='\0'; fprintf(stderr,"%s",in_buf); } while(!feof(check_file));@/ @@ -453,13 +460,14 @@ else { @ No copying necessary, just remove the temporary output file. @<Redirect temporary output to \.{/dev/null}@>={ - int comparison=true; + boolean comparison=true; @<Create the secondary output...@>@; } @ @<Setup system redirection@>= char in_buf[BUFSIZ+1]; -int in_size,comparison=true; +int in_size; +boolean comparison=true; if((check_file=fopen(check_file_name,"r"))==NULL) fatal(_("! Cannot open output file "),check_file_name); @.Cannot open output file@> diff --git a/Build/source/texk/web2c/cwebdir/ctang-w32.ch b/Build/source/texk/web2c/cwebdir/ctang-w32.ch index 9d9be1255c2..ceba0fee761 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-w32.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-w32.ch @@ -4,9 +4,9 @@ This is the change file for CWEB's CTANGLE under Win32 Changes necessary for compiling with Borland C/C++ @x section 1 -@d banner "This is CTANGLE (Version 4.3)" +@d banner "This is CTANGLE (Version 4.4)" @y -@d banner "This is CTANGLE (Version 4.3win32)" +@d banner "This is CTANGLE (Version 4.4win32)" @z @x diff --git a/Build/source/texk/web2c/cwebdir/ctangle.c b/Build/source/texk/web2c/cwebdir/ctangle.c index 26407b42ae4..14a0732742d 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.c +++ b/Build/source/texk/web2c/cwebdir/ctangle.c @@ -15,7 +15,7 @@ /*:4*/ #line 67 "ctangle.w" -#define banner "This is CTANGLE (Version 4.3)" \ +#define banner "This is CTANGLE (Version 4.4)" \ #define ctangle false #define cweave true \ @@ -51,7 +51,7 @@ #define max_include_depth 10 \ -#define max_file_name_length 1024 +#define max_file_name_length 60 #define cur_file file[include_depth] #define cur_file_name file_name[include_depth] #define cur_line line[include_depth] @@ -59,7 +59,7 @@ #define web_file_name file_name[0] \ #define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start) -#define print_id(c) term_write((c) ->byte_start,length((c) ) ) +#define print_id(c) term_write((c) ->byte_start,length(c) ) #define llink link #define rlink dummy.Rlink #define root name_dir->rlink \ @@ -84,18 +84,18 @@ #define new_line putchar('\n') #define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) \ -#define max_bytes 1000000 \ +#define buf_size 100 +#define longest_name 10000 \ -#define max_toks 1000000 -#define max_names 10239 \ +#define long_buf_size (buf_size+longest_name) +#define max_bytes 90000 \ -#define max_sections 4000 -#define max_texts 10239 -#define longest_name 10000 -#define stack_size 500 -#define buf_size 1000 -#define long_buf_size (buf_size+longest_name) \ +#define max_names 4000 \ +#define max_sections 2000 \ + +#define max_texts 2500 +#define max_toks 270000 #define equiv equiv_or_xref \ #define macro 0 @@ -106,6 +106,7 @@ #define join 0177 #define output_defs_flag (2*024000-1) \ +#define stack_size 50 #define cur_end cur_state.end_field #define cur_byte cur_state.byte_field #define cur_name cur_state.name_field @@ -138,7 +139,11 @@ #define section_name 0311 #define new_section 0312 \ -#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow("token") ;*tok_ptr++= c;} \ +#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow("token") ;*(tok_ptr++) = c;} \ + +#define store_id(a) a= id_lookup(id_first,id_loc,0) -name_dir; \ +app_repl((a/0400) +0200) ; \ +app_repl(a%0400) ; \ #define keep_digit_separators flags['k'] \ @@ -257,7 +262,7 @@ sixteen_bits text_link; typedef text*text_pointer; /*:19*//*31:*/ -#line 273 "ctangle.w" +#line 274 "ctangle.w" typedef struct{ eight_bits*end_field; @@ -272,7 +277,7 @@ typedef output_state*stack_pointer; #line 70 "ctangle.w" /*20:*/ -#line 129 "ctangle.w" +#line 131 "ctangle.w" static text text_info[max_texts]; static text_pointer text_info_end= text_info+max_texts-1; @@ -282,12 +287,12 @@ static eight_bits*tok_mem_end= tok_mem+max_toks-1; static eight_bits*tok_ptr; /*:20*//*26:*/ -#line 199 "ctangle.w" +#line 200 "ctangle.w" static text_pointer last_unnamed; /*:26*//*32:*/ -#line 289 "ctangle.w" +#line 291 "ctangle.w" static output_state cur_state; @@ -296,18 +301,18 @@ static stack_pointer stack_end= stack+stack_size; static stack_pointer stack_ptr; /*:32*//*37:*/ -#line 365 "ctangle.w" +#line 367 "ctangle.w" static int cur_val; /*:37*//*42:*/ -#line 456 "ctangle.w" +#line 458 "ctangle.w" static eight_bits out_state; static boolean protect; /*:42*//*45:*/ -#line 487 "ctangle.w" +#line 489 "ctangle.w" static name_pointer output_files[max_files]; static name_pointer*cur_out_file,*end_output_files,*an_output_file; @@ -315,33 +320,33 @@ static char cur_section_name_char; static char output_file_name[longest_name+1]; /*:45*//*52:*/ -#line 584 "ctangle.w" +#line 589 "ctangle.w" static boolean output_defs_seen= false; /*:52*//*57:*/ -#line 696 "ctangle.w" +#line 701 "ctangle.w" static char translit[128][translit_length]; /*:57*//*62:*/ -#line 775 "ctangle.w" +#line 777 "ctangle.w" static eight_bits ccode[256]; /*:62*//*66:*/ -#line 835 "ctangle.w" +#line 837 "ctangle.w" static boolean comment_continues= false; /*:66*//*68:*/ -#line 872 "ctangle.w" +#line 874 "ctangle.w" static name_pointer cur_section_name; static boolean no_where; /*:68*//*82:*/ -#line 1189 "ctangle.w" +#line 1188 "ctangle.w" static text_pointer cur_text; static eight_bits next_control; @@ -384,57 +389,57 @@ extern void common_init(void); extern void print_stats(void); /*:16*//*30:*/ -#line 245 "ctangle.w" +#line 246 "ctangle.w" static void store_two_bytes(sixteen_bits); /*:30*//*35:*/ -#line 328 "ctangle.w" +#line 330 "ctangle.w" static void push_level(name_pointer); static void pop_level(boolean); /*:35*//*39:*/ -#line 401 "ctangle.w" +#line 403 "ctangle.w" static void get_output(void); /*:39*//*44:*/ -#line 477 "ctangle.w" +#line 479 "ctangle.w" static void flush_buffer(void); /*:44*//*49:*/ -#line 551 "ctangle.w" +#line 556 "ctangle.w" static void phase_two(void); /*:49*//*53:*/ -#line 587 "ctangle.w" +#line 592 "ctangle.w" static void output_defs(void); static void out_char(eight_bits); /*:53*//*65:*/ -#line 815 "ctangle.w" +#line 817 "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 1214 "ctangle.w" static void scan_repl(eight_bits); /*:84*//*91:*/ -#line 1396 "ctangle.w" +#line 1397 "ctangle.w" static void scan_section(void); /*:91*//*99:*/ -#line 1477 "ctangle.w" +#line 1474 "ctangle.w" static void phase_one(void); /*:99*//*101:*/ -#line 1511 "ctangle.w" +#line 1507 "ctangle.w" static void skip_limbo(void); /*:101*/ @@ -451,28 +456,28 @@ char**av) argc= ac;argv= av; program= ctangle; /*21:*/ -#line 137 "ctangle.w" +#line 139 "ctangle.w" text_info->tok_start= tok_ptr= tok_mem; text_ptr= text_info+1;text_ptr->tok_start= tok_mem; /*:21*//*23:*/ -#line 147 "ctangle.w" +#line 149 "ctangle.w" init_node(name_dir); /*:23*//*27:*/ -#line 202 "ctangle.w" +#line 203 "ctangle.w" last_unnamed= text_info;text_info->text_link= macro; /*:27*//*46:*/ -#line 497 "ctangle.w" +#line 499 "ctangle.w" cur_out_file= end_output_files= output_files+max_files; /*:46*//*58:*/ -#line 699 "ctangle.w" +#line 704 "ctangle.w" { int i; @@ -480,7 +485,7 @@ for(i= 0;i<128;i++)sprintf(translit[i],"X%02X",(unsigned int)(128+i)); } /*:58*//*63:*/ -#line 778 "ctangle.w" +#line 780 "ctangle.w" { int c; for(c= 0;c<256;c++)ccode[c]= ignore; @@ -500,7 +505,7 @@ ccode['<']= ccode['(']= section_name; ccode['\'']= ord; /*:63*//*78:*/ -#line 1111 "ctangle.w" +#line 1112 "ctangle.w" section_text[0]= ' '; /*:78*/ @@ -514,7 +519,7 @@ return wrap_up(); } /*:2*//*24:*/ -#line 153 "ctangle.w" +#line 155 "ctangle.w" boolean names_match( name_pointer p, @@ -522,12 +527,11 @@ const char*first, size_t l, eight_bits t) {(void)t; -if(length(p)!=l)return false; -return!strncmp(first,p->byte_start,l); +return length(p)==l&&strncmp(first,p->byte_start,l)==0; } /*:24*//*25:*/ -#line 169 "ctangle.w" +#line 170 "ctangle.w" void init_node( @@ -539,7 +543,7 @@ void init_p(name_pointer p,eight_bits t){(void)p;(void)t;} /*:25*//*29:*/ -#line 235 "ctangle.w" +#line 236 "ctangle.w" static void store_two_bytes( @@ -551,7 +555,7 @@ if(tok_ptr+2> tok_mem_end)overflow("token"); } /*:29*//*34:*/ -#line 313 "ctangle.w" +#line 315 "ctangle.w" static void push_level( @@ -568,7 +572,7 @@ cur_section= 0; } /*:34*//*36:*/ -#line 336 "ctangle.w" +#line 338 "ctangle.w" static void pop_level( @@ -584,7 +588,7 @@ if(stack_ptr> stack)cur_state= *stack_ptr; } /*:36*//*38:*/ -#line 372 "ctangle.w" +#line 374 "ctangle.w" static void get_output(void) @@ -607,7 +611,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 408 "ctangle.w" { a-= 024000; @@ -621,7 +625,7 @@ goto restart; } /*:40*/ -#line 393 "ctangle.w" +#line 395 "ctangle.w" break; default:cur_val= a-050000;if(cur_val> 0)cur_section= cur_val; @@ -631,7 +635,7 @@ out_char(section_number); } /*:38*//*43:*/ -#line 464 "ctangle.w" +#line 466 "ctangle.w" static void flush_buffer(void) @@ -646,29 +650,30 @@ cur_line++; } /*:43*//*48:*/ -#line 516 "ctangle.w" +#line 518 "ctangle.w" static void phase_two(void){ +phase= 2; web_file_open= false; cur_line= 1; /*33:*/ -#line 302 "ctangle.w" +#line 304 "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 524 "ctangle.w" /*51:*/ -#line 580 "ctangle.w" +#line 585 "ctangle.w" if(!output_defs_seen) output_defs(); /*:51*/ -#line 522 "ctangle.w" +#line 525 "ctangle.w" if(text_info->text_link==macro&&cur_out_file==end_output_files){ fputs("\n! No program text was specified.",stdout);mark_harmless; @@ -676,8 +681,10 @@ fputs("\n! No program text was specified.",stdout);mark_harmless; } else{ if(cur_out_file==end_output_files){ -if(show_progress) +if(show_progress){ printf("\nWriting the output file (%s):",C_file_name); +update_terminal; +} } else{ if(show_progress){ @@ -691,7 +698,7 @@ if(text_info->text_link==macro)goto writeloop; while(stack_ptr> stack)get_output(); flush_buffer(); writeloop:/*50:*/ -#line 557 "ctangle.w" +#line 562 "ctangle.w" for(an_output_file= end_output_files;an_output_file> cur_out_file;){ an_output_file--; @@ -703,7 +710,7 @@ fatal("! Cannot open output file ",output_file_name); if(show_progress){printf("\n(%s)",output_file_name);update_terminal;} cur_line= 1; stack_ptr= stack+1; -cur_name= (*an_output_file); +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; @@ -712,7 +719,7 @@ flush_buffer(); } /*:50*/ -#line 543 "ctangle.w" +#line 548 "ctangle.w" if(show_happiness){ if(show_progress)new_line; @@ -722,7 +729,7 @@ fputs("Done.",stdout); } /*:48*//*54:*/ -#line 594 "ctangle.w" +#line 599 "ctangle.w" static void output_defs(void) @@ -762,7 +769,7 @@ pop_level(false); } /*:54*//*55:*/ -#line 637 "ctangle.w" +#line 642 "ctangle.w" static void out_char( @@ -775,25 +782,22 @@ 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 710 "ctangle.w" case identifier: if(out_state==num_or_id)C_putc(' '); -j= (cur_val+name_dir)->byte_start; -k= (cur_val+name_dir+1)->byte_start; -while(j<k){ +for(j= (cur_val+name_dir)->byte_start,k= (cur_val+name_dir+1)->byte_start; +j<k;j++) if((eight_bits)(*j)<0200)C_putc(*j); else C_printf("%s",translit[(eight_bits)(*j)-0200]); -j++; -} out_state= num_or_id;break; /*:59*/ -#line 648 "ctangle.w" +#line 653 "ctangle.w" /*60:*/ -#line 718 "ctangle.w" +#line 720 "ctangle.w" case section_number: if(cur_val> 0)C_printf("/*%d:*/",cur_val); @@ -804,12 +808,12 @@ cur_char= '\n'; goto restart; }else{ sixteen_bits a; -a= 0400**cur_byte++; +a= *cur_byte++*0400; a+= *cur_byte++; C_printf("\n#line %d \"",a); -cur_val= *cur_byte++; -cur_val= 0400*(cur_val-0200)+*cur_byte++; +cur_val= (*cur_byte++-0200)*0400; +cur_val+= *cur_byte++; for(j= (cur_val+name_dir)->byte_start,k= (cur_val+name_dir+1)->byte_start; j<k;j++){ if(*j=='\\'||*j=='"')C_putc('\\'); @@ -820,10 +824,10 @@ C_putc('"');C_putc('\n'); break; /*:60*/ -#line 649 "ctangle.w" +#line 654 "ctangle.w" /*56:*/ -#line 667 "ctangle.w" +#line 672 "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 +848,7 @@ case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal; break; /*:56*/ -#line 650 "ctangle.w" +#line 655 "ctangle.w" case'=':case'>':C_putc(cur_char);C_putc(' '); out_state= normal;break; @@ -863,7 +867,7 @@ default:C_putc(cur_char);out_state= normal;break; } /*:55*//*64:*/ -#line 799 "ctangle.w" +#line 801 "ctangle.w" static eight_bits skip_ahead(void) @@ -881,7 +885,7 @@ if(c!=ignore||*(loc-1)=='>')return c; } /*:64*//*67:*/ -#line 838 "ctangle.w" +#line 840 "ctangle.w" static boolean skip_comment( boolean is_long_comment) @@ -915,7 +919,7 @@ else loc++; } /*:67*//*69:*/ -#line 879 "ctangle.w" +#line 881 "ctangle.w" static eight_bits get_next(void) @@ -929,9 +933,10 @@ if(get_line()==false)return new_section; else if(print_where&&!no_where){ print_where= false; /*85:*/ -#line 1221 "ctangle.w" +#line 1224 "ctangle.w" { +eight_bits a; store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -941,12 +946,11 @@ 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_id(a); } /*:85*/ -#line 891 "ctangle.w" +#line 893 "ctangle.w" } else return'\n'; @@ -960,7 +964,7 @@ else continue; } loc++; if(xisdigit(c)||c=='.')/*73:*/ -#line 963 "ctangle.w" +#line 965 "ctangle.w" { boolean hex_flag= false; id_first= loc-1; @@ -994,13 +998,13 @@ 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 1002 "ctangle.w" { char delim= c; id_first= section_text+1; @@ -1044,11 +1048,11 @@ 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 956 "ctangle.w" { id_first= --loc; do @@ -1059,11 +1063,11 @@ id_loc= loc;return identifier; } /*:72*/ -#line 909 "ctangle.w" +#line 911 "ctangle.w" else if(c=='@')/*75:*/ -#line 1045 "ctangle.w" -{ +#line 1047 "ctangle.w" + switch(c= ccode[(eight_bits)*loc++]){ case ignore:continue; case translit_code:err_print("! Use @l in limbo only");continue; @@ -1077,13 +1081,12 @@ continue; case section_name: cur_section_name_char= *(loc-1); /*77:*/ -#line 1091 "ctangle.w" +#line 1092 "ctangle.w" { -char*k; +char*k= section_text; /*79:*/ -#line 1113 "ctangle.w" +#line 1114 "ctangle.w" -k= section_text; while(true){ if(loc> limit&&get_line()==false){ err_print("! Input ended in section name"); @@ -1128,7 +1131,7 @@ printf("...");mark_harmless; if(*k==' '&&k> section_text)k--; /*:79*/ -#line 1093 "ctangle.w" +#line 1094 "ctangle.w" if(k-section_text> 3&&strncmp(k-2,"...",3)==0) cur_section_name= section_lookup(section_text+1,k-3,true); @@ -1137,7 +1140,7 @@ else cur_section_name= section_lookup(section_text+1,k,false); if(cur_section_name_char=='(') /*47:*/ -#line 501 "ctangle.w" +#line 503 "ctangle.w" { for(an_output_file= cur_out_file; @@ -1151,30 +1154,29 @@ else overflow("output files"); } /*:47*/ -#line 1101 "ctangle.w" +#line 1102 "ctangle.w" return section_name; } /*:77*/ -#line 1058 "ctangle.w" +#line 1060 "ctangle.w" case string:/*81:*/ #line 1159 "ctangle.w" -{ + id_first= loc++;*(limit+1)= '@';*(limit+2)= '>'; while(*loc!='@'||*(loc+1)!='>')loc++; if(loc>=limit)err_print("! Verbatim string didn't end"); id_loc= loc;loc+= 2; return string; -} /*:81*/ -#line 1059 "ctangle.w" +#line 1061 "ctangle.w" case ord:/*76:*/ -#line 1071 "ctangle.w" +#line 1072 "ctangle.w" id_first= loc; if(*loc=='\\') @@ -1196,14 +1198,13 @@ loc++; return ord; /*:76*/ -#line 1060 "ctangle.w" +#line 1062 "ctangle.w" default:return c; } -} /*:75*/ -#line 910 "ctangle.w" +#line 912 "ctangle.w" else if(xisspace(c)){ if(!preprocessing||loc> limit)continue; @@ -1212,7 +1213,7 @@ else return' '; } else if(c=='#'&&loc==buffer+1)preprocessing= true; mistake:/*71:*/ -#line 931 "ctangle.w" +#line 933 "ctangle.w" switch(c){ case'+':if(*loc=='+')compress(plus_plus);break; @@ -1237,14 +1238,14 @@ 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 1192 "ctangle.w" static void scan_repl( @@ -1252,9 +1253,10 @@ eight_bits t) { sixteen_bits a; if(t==section_name)/*85:*/ -#line 1221 "ctangle.w" +#line 1224 "ctangle.w" { +eight_bits a; store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1264,24 +1266,21 @@ 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_id(a); } /*:85*/ -#line 1199 "ctangle.w" +#line 1198 "ctangle.w" while(true)switch(a= get_next()){ /*86:*/ -#line 1236 "ctangle.w" +#line 1239 "ctangle.w" -case identifier:a= id_lookup(id_first,id_loc,0)-name_dir; -app_repl((a/0400)+0200); -app_repl(a%0400);break; +case identifier:store_id(a);break; case section_name:if(t!=section_name)goto done; else{ /*87:*/ -#line 1269 "ctangle.w" +#line 1270 "ctangle.w" { char*try_loc= loc; while(*try_loc==' '&&try_loc<limit)try_loc++; @@ -1294,15 +1293,16 @@ if(*try_loc=='=')err_print("! Missing `@ ' before a named section"); } /*:87*/ -#line 1242 "ctangle.w" +#line 1243 "ctangle.w" a= cur_section_name-name_dir; app_repl((a/0400)+0250); app_repl(a%0400); /*85:*/ -#line 1221 "ctangle.w" +#line 1224 "ctangle.w" { +eight_bits a; store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1312,12 +1312,11 @@ 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_id(a); } /*:85*/ -#line 1246 "ctangle.w" +#line 1247 "ctangle.w" break; } case output_defs_code:if(t!=section_name)err_print("! Misplaced @h"); @@ -1328,9 +1327,10 @@ a= output_defs_flag; app_repl((a/0400)+0200); app_repl(a%0400); /*85:*/ -#line 1221 "ctangle.w" +#line 1224 "ctangle.w" { +eight_bits a; store_two_bytes(0150000); if(changing&&include_depth==change_depth){ id_first= change_file_name; @@ -1340,18 +1340,17 @@ 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_id(a); } /*:85*/ -#line 1255 "ctangle.w" +#line 1256 "ctangle.w" } break; case constant:case string: /*88:*/ -#line 1286 "ctangle.w" +#line 1287 "ctangle.w" app_repl(a); while(id_first<id_loc){ @@ -1367,11 +1366,11 @@ app_repl(*id_first++); app_repl(a);break; /*:88*/ -#line 1259 "ctangle.w" +#line 1260 "ctangle.w" case ord: /*89:*/ -#line 1304 "ctangle.w" +#line 1305 "ctangle.w" { int c= (eight_bits)*id_first; if(c=='\\'){ @@ -1422,7 +1421,7 @@ app_repl(constant); break; /*:89*/ -#line 1261 "ctangle.w" +#line 1262 "ctangle.w" case definition:case format_code:case begin_C:if(t!=section_name)goto done; else{ @@ -1432,7 +1431,7 @@ err_print("! @d, @f and @c are ignored in C text");continue; case new_section:goto done; /*:86*/ -#line 1204 "ctangle.w" +#line 1203 "ctangle.w" case')':app_repl(a); if(t==macro)app_repl(' '); @@ -1445,7 +1444,7 @@ cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; } /*:83*//*90:*/ -#line 1363 "ctangle.w" +#line 1364 "ctangle.w" static void scan_section(void) @@ -1460,7 +1459,7 @@ printf("*%d",section_count);update_terminal; next_control= ignore; while(true){ /*92:*/ -#line 1404 "ctangle.w" +#line 1405 "ctangle.w" while(next_control<definition) @@ -1469,30 +1468,27 @@ loc-= 2;next_control= get_next(); } /*:92*/ -#line 1377 "ctangle.w" +#line 1378 "ctangle.w" if(next_control==definition){ /*93:*/ -#line 1411 "ctangle.w" -{ +#line 1412 "ctangle.w" + while((next_control= get_next())=='\n'); if(next_control!=identifier){ err_print("! Definition flushed, must start with identifier"); continue; } -app_repl(((a= id_lookup(id_first,id_loc,0)-name_dir)/0400)+0200); - -app_repl(a%0400); +store_id(a); if(*loc!='('){ app_repl(string);app_repl(' ');app_repl(string); } scan_repl(macro); cur_text->text_link= macro; -} /*:93*/ -#line 1379 "ctangle.w" +#line 1380 "ctangle.w" continue; } @@ -1502,14 +1498,14 @@ p= name_dir;break; if(next_control==section_name){ p= cur_section_name; /*94:*/ -#line 1436 "ctangle.w" +#line 1434 "ctangle.w" while((next_control= get_next())=='+'); if(next_control!='='&&next_control!=eq_eq) continue; /*:94*/ -#line 1387 "ctangle.w" +#line 1388 "ctangle.w" break; } @@ -1517,23 +1513,23 @@ return; } no_where= print_where= false; /*95:*/ -#line 1441 "ctangle.w" +#line 1439 "ctangle.w" /*96:*/ -#line 1446 "ctangle.w" +#line 1444 "ctangle.w" store_two_bytes((sixteen_bits)(0150000+section_count)); /*:96*/ -#line 1442 "ctangle.w" +#line 1440 "ctangle.w" scan_repl(section_name); /*97:*/ -#line 1450 "ctangle.w" +#line 1448 "ctangle.w" if(p==name_dir||p==NULL){ -(last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text; +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 +1543,16 @@ cur_text->text_link= section_flag; /*:97*/ -#line 1444 "ctangle.w" +#line 1442 "ctangle.w" /*:95*/ -#line 1393 "ctangle.w" +#line 1394 "ctangle.w" } /*:90*//*98:*/ -#line 1465 "ctangle.w" +#line 1463 "ctangle.w" static void phase_one(void){ @@ -1566,26 +1562,24 @@ reset_input(); skip_limbo(); while(!input_has_ended)scan_section(); check_complete(); -phase= 2; } /*:98*//*100:*/ -#line 1482 "ctangle.w" +#line 1479 "ctangle.w" static void skip_limbo(void) { -char c; while(true){ if(loc> limit&&get_line()==false)return; *(limit+1)= '@'; while(*loc!='@')loc++; if(loc++<=limit){ -c= *loc++; +char c= *loc++; if(ccode[(eight_bits)c]==new_section)break; switch(ccode[(eight_bits)c]){ case translit_code:/*102:*/ -#line 1513 "ctangle.w" +#line 1509 "ctangle.w" while(xisspace(*loc)&&loc<limit)loc++; loc+= 3; @@ -1610,7 +1604,7 @@ translit[i-0200][loc-beg]= '\0'; } /*:102*/ -#line 1495 "ctangle.w" +#line 1491 "ctangle.w" break; case format_code:case'@':break; case control_text:if(c=='q'||c=='Q'){ @@ -1628,7 +1622,7 @@ default:err_print("! Double @ should be used in limbo"); } /*:100*//*103:*/ -#line 1539 "ctangle.w" +#line 1535 "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 27decb95eb5..810ebadc254 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 --- May 2021 +% Version 4.4 --- June 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.4)} \def\topofcontents{\null\vfill \centerline{\titlefont The {\ttitlefont CTANGLE} processor} \vskip 15pt - \centerline{(Version 4.3)} + \centerline{(Version 4.4)} \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.4)" @c @<Include files@>@/ @@ -126,7 +126,9 @@ typedef struct { } text; typedef text *text_pointer; -@ @<Private...@>= +@ @d max_texts 2500 /* number of replacement texts, must be less than 10240 */ +@d max_toks 270000 /* number of bytes in compressed \CEE/ code */ +@<Private...@>= static text text_info[max_texts]; static text_pointer text_info_end=text_info+max_texts-1; static text_pointer text_ptr; /* first unused position in |text_info| */ @@ -156,9 +158,8 @@ 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} */ -{@+(void)t; - if (length(p)!=l) return false; - return !strncmp(first,p->byte_start,l); +{@+(void)t;@/ + return length(p)==l && strncmp(first,p->byte_start,l)==0; } @ The common lookup routine refers to separate routines |init_node| and @@ -227,7 +228,7 @@ or line breaks allowed between them (the \.{@@\&} operation of \.{CWEB}). @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 output_defs_flag (2*024000-1) +@d output_defs_flag (2*024000-1) /* |024000==(0250-0200)*0400| */ @ The following procedure is used to enter a two-byte value into |tok_mem| when a replacement text is being generated. @@ -280,7 +281,8 @@ typedef struct { } output_state; typedef output_state *stack_pointer; -@ @d cur_end cur_state.end_field /* current ending location in |tok_mem| */ +@ @d stack_size 50 /* number of simultaneous levels of macro expansion */ +@d cur_end cur_state.end_field /* current ending location in |tok_mem| */ @d cur_byte cur_state.byte_field /* location of next output byte in |tok_mem|*/ @d cur_name cur_state.name_field /* pointer to current name being expanded */ @d cur_repl cur_state.repl_field /* pointer to current replacement text */ @@ -516,6 +518,7 @@ output. @c static void phase_two (void) { + phase=2; web_file_open=false; cur_line=1; @<Initialize the output stacks@>@; @@ -525,9 +528,11 @@ phase_two (void) { @.No program text...@> } else { - if(cur_out_file==end_output_files) { - if(show_progress) + if (cur_out_file==end_output_files) { + if (show_progress) { printf("\nWriting the output file (%s):",C_file_name); + update_terminal; + } } else { if (show_progress) { @@ -565,7 +570,7 @@ 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_name=*an_output_file; cur_repl=(text_pointer)cur_name->equiv; cur_byte=cur_repl->tok_start; cur_end=(cur_repl+1)->tok_start; @@ -705,14 +710,11 @@ static char translit[128][translit_length]; @ @<Case of an identifier@>=@t\1\quad@> case identifier: if (out_state==num_or_id) C_putc(' '); - j=(cur_val+name_dir)->byte_start; - k=(cur_val+name_dir+1)->byte_start; - while (j<k) { + for (j=(cur_val+name_dir)->byte_start, k=(cur_val+name_dir+1)->byte_start; + j<k; j++) if ((eight_bits)(*j)<0200) C_putc(*j); @^high-bit character handling@> else C_printf("%s",translit[(eight_bits)(*j)-0200]); - j++; - } out_state=num_or_id; break; @ @<Case of a sec...@>=@t\1\quad@> @@ -725,12 +727,12 @@ case section_number: goto restart; } else { sixteen_bits a; - a=0400* *cur_byte++; + a=*cur_byte++ *0400; a+=*cur_byte++; /* gets the line number */ C_printf("\n#line %d \"",a); @:line}{\.{\#line}@> - cur_val=*cur_byte++; - cur_val=0400*(cur_val-0200)+ *cur_byte++; /* points to the file name */ + cur_val=(*cur_byte++-0200)*0400; + cur_val+=*cur_byte++; /* points to the file name */ for (j=(cur_val+name_dir)->byte_start, k=(cur_val+name_dir+1)->byte_start; j<k; j++) { if (*j=='\\' || *j=='"') C_putc('\\'); @@ -922,8 +924,8 @@ get_next(void) /* produces the next input token */ @ @<Predecl...@>=@+static eight_bits get_next(void); @ The following code assigns values to the combinations \.{++}, -\.{--}, \.{->}, \.{>=}, \.{<=}, \.{==}, \.{<<}, \.{>>}, \.{!=}, \.{||} and -\.{\&\&}, and to the \CPLUSPLUS/ +\.{--}, \.{->}, \.{>=}, \.{<=}, \.{==}, \.{<<}, \.{>>}, \.{!=}, %\.{||} +\.{\v\v} and~\.{\&\&}, and to the \CPLUSPLUS/ combinations \.{...}, \.{::}, \.{.*} and \.{->*}. The compound assignment operators (e.g., \.{+=}) are treated as separate tokens. @@ -1042,24 +1044,23 @@ convention, but do not allow the string to be longer than |longest_name|. @ After an \.{@@} sign has been scanned, the next character tells us whether there is more work to do. -@<Get control code and possible section name@>= { - switch(c=ccode[(eight_bits)*loc++]) { - case ignore: continue; - case translit_code: err_print("! Use @@l in limbo only"); continue; +@<Get control code and possible section name@>= +switch(c=ccode[(eight_bits)*loc++]) { + case ignore: continue; + case translit_code: err_print("! Use @@l in limbo only"); continue; @.Use @@l in limbo...@> - case control_text: while ((c=skip_ahead())=='@@'); - /* only \.{@@@@} and \.{@@>} are expected */ - if (*(loc-1)!='>') - err_print("! Double @@ should be used in control text"); + case control_text: while ((c=skip_ahead())=='@@'); + /* only \.{@@@@} and \.{@@>} are expected */ + if (*(loc-1)!='>') + err_print("! Double @@ should be used in control text"); @.Double @@ should be used...@> - continue; - case section_name: - cur_section_name_char=*(loc-1); - @<Scan the section name and make |cur_section_name| point to it@>@; - case string: @<Scan a verbatim string@>@; - case ord: @<Scan an ASCII constant@>@; - default: return c; - } + continue; + case section_name: + cur_section_name_char=*(loc-1); + @<Scan the section name and make |cur_section_name| point to it@>@; + case string: @<Scan a verbatim string@>@; + case ord: @<Scan an ASCII constant@>@; + default: return c; } @ After scanning a valid ASCII constant that follows @@ -1089,7 +1090,7 @@ thus, \.{@@'\\nopq'} gives the same result as \.{@@'\\n'}. return ord; @ @<Scan the section name...@>= { - char *k; /* pointer into |section_text| */ + char *k=section_text; /* 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); @@ -1111,7 +1112,6 @@ character of the name.) @<Set init...@>=section_text[0]=' '; @ @<Put section name...@>= -k=section_text; while (true) { if (loc>limit && get_line()==false) { err_print("! Input ended in section name"); @@ -1156,14 +1156,13 @@ have |*(loc-1)==string|; we set |id_first| to the beginning of the string itself, and |id_loc| to its ending-plus-one location in the buffer. We also set |loc| to the position just after the ending delimiter. -@<Scan a verbatim string@>= { - id_first=loc++; *(limit+1)='@@'; *(limit+2)='>'; - while (*loc!='@@' || *(loc+1)!='>') loc++; - if (loc>=limit) err_print("! Verbatim string didn't end"); +@<Scan a verbatim string@>= +id_first=loc++; *(limit+1)='@@'; *(limit+2)='>'; +while (*loc!='@@' || *(loc+1)!='>') loc++; +if (loc>=limit) err_print("! Verbatim string didn't end"); @.Verbatim string didn't end@> - id_loc=loc; loc+=2; - return string; -} +id_loc=loc; loc+=2; +return string; @* Scanning a macro definition. The rules for generating the replacement texts corresponding to macros and @@ -1184,7 +1183,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 app_repl(c) {if (tok_ptr==tok_mem_end) overflow("token"); *tok_ptr++=c;} +@d app_repl(c) {if (tok_ptr==tok_mem_end) overflow("token"); *(tok_ptr++)=c;} @<Private...@>= static text_pointer cur_text; /* replacement text formed by |scan_repl| */ @@ -1198,7 +1197,7 @@ eight_bits t) sixteen_bits a; /* the current token */ 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|, + @/@t\4@>@<In cases that |a| is a non-|char| token (|identifier|, |section_name|, etc.), either process it and change |a| to a byte that should be stored, or |continue| if |a| should be ignored, or |goto done| if |a| signals the end of this replacement text@>@; @@ -1218,8 +1217,13 @@ eight_bits t) to |0150000|; then the numeric line number; then a pointer to the file name. +@d store_id(a) a=id_lookup(id_first,id_loc,0)-name_dir;@/ + app_repl((a / 0400)+0200); + app_repl(a % 0400); + @<Insert the line...@>= { + eight_bits a; /* shadow variable |a| */ store_two_bytes(0150000); if (changing && include_depth==change_depth) { /* correction made Feb 2017 */ id_first=change_file_name; @@ -1229,14 +1233,11 @@ 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_id(a); } @ @<In cases that |a| is...@>=@t\1\quad@> -case identifier: a=id_lookup(id_first,id_loc,0)-name_dir; - app_repl((a / 0400)+0200); - app_repl(a % 0400); break; +case identifier: store_id(a); break; case section_name: if (t!=section_name) goto done; else { @<Was an `\.{@@}' missed here?@>@; @@ -1375,11 +1376,11 @@ scan_section(void) while (true) { @<Skip ahead until |next_control| corresponds to \.{@@d}, \.{@@<}, \.{@@\ } or the like@>@; - if (next_control == definition) { /* \.{@@d} */ + if (next_control == definition) { /* \.{@@d} */ @<Scan a definition@>@; continue; } - if (next_control == begin_C) { /* \.{@@c} or \.{@@p} */ + if (next_control == begin_C) { /* \.{@@c} or \.{@@p} */ p=name_dir; break; } if (next_control == section_name) { /* \.{@@<} or \.{@@(} */ @@ -1408,22 +1409,19 @@ while (next_control<definition) loc-=2; next_control=get_next(); } -@ @<Scan a definition@>= { - while ((next_control=get_next())=='\n'); /* allow newline before definition */ - if (next_control!=identifier) { - err_print("! Definition flushed, must start with identifier"); +@ @<Scan a definition@>= +while ((next_control=get_next())=='\n'); /* allow newline before definition */ +if (next_control!=identifier) { + err_print("! Definition flushed, must start with identifier"); @.Definition flushed...@> - continue; - } - app_repl(((a=id_lookup(id_first,id_loc,0)-name_dir) / 0400)+0200); - /* append the lhs */ - app_repl(a % 0400); - if (*loc!='(') { /* identifier must be separated from replacement text */ - app_repl(string); app_repl(' '); app_repl(string); - } - scan_repl(macro); - cur_text->text_link=macro; + continue; +} +store_id(a); /* append the lhs */ +if (*loc!='(') { /* identifier must be separated from replacement text */ + app_repl(string); app_repl(' '); app_repl(string); } +scan_repl(macro); +cur_text->text_link=macro; @ If the section name is not followed by \.{=} or \.{+=}, no \CEE/ code is forthcoming: the section is being cited, not being @@ -1449,7 +1447,7 @@ store_two_bytes((sixteen_bits)(0150000+section_count)); @ @<Update the data...@>= if (p==name_dir||p==NULL) { /* unnamed section, or bad section name */ - (last_unnamed)->text_link=cur_text-text_info; last_unnamed=cur_text; + last_unnamed->text_link=cur_text-text_info; last_unnamed=cur_text; } else if (p->equiv==(void *)text_info) p->equiv=(void *)cur_text; /* first section of this name */ @@ -1471,7 +1469,6 @@ phase_one(void) { skip_limbo(); while (!input_has_ended) scan_section(); check_complete(); - phase=2; } @ @<Predec...@>=@+static void phase_one(void); @@ -1483,13 +1480,12 @@ processing is straightforward. static void skip_limbo(void) { - char c; while (true) { if (loc>limit && get_line()==false) return; *(limit+1)='@@'; while (*loc!='@@') loc++; if (loc++<=limit) { - c=*loc++; + char c=*loc++; if (ccode[(eight_bits)c]==new_section) break; switch (ccode[(eight_bits)c]) { case translit_code: @<Read in transliteration of a character@>@; break; diff --git a/Build/source/texk/web2c/cwebdir/ctproofmac.tex b/Build/source/texk/web2c/cwebdir/ctproofmac.tex index ccfd36b83b2..a3016ba7322 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 4.4 --- June 2021 % 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+CWEB4.4+PROOFS} \let\:=\. % preserve a way to get the dot accent % (all other accents will still work as usual) diff --git a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch index fba2f191f46..ec0aec95ed8 100644 --- a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch +++ b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch @@ -4,7 +4,7 @@ Section 1. @** Introduction. @y \ifacro \ifx\undefined\pdfpagewidth\else - \pdfpagewidth=\pagewd \advance\pdfpagewidth by 2cm + \pdfpagewidth=\pagewd \advance\pdfpagewidth by 2cm \pdfpageheight=\pageht \advance\pdfpageheight by 5cm \ifpdftex \pdfhorigin=1cm \pdfvorigin=1cm \else \global\hoffset=-1.54cm \global\voffset=-1.54cm \fi @@ -15,13 +15,13 @@ Section 1. @x A kind of ``user manual'' for \.{CTWILL} can be found in the appendix -{\bf 272.~Mogrify \.{CWEAVE} into \.{CTWILL}} and beyond, together +{\bf 271.~Mogrify \.{CWEAVE} into \.{CTWILL}} and beyond, together with additional material specific to \.{CTWILL}. % FIXME Until then, \.{CWEAVE}'s sequence of sections will be preserved. The ``banner line'' defined here should be changed whenever \.{CTWILL} is @y -A kind of ``user manual'' for \.{CTWILL} can be found in section~\&{293} +A kind of ``user manual'' for \.{CTWILL} can be found in section~\&{289} and beyond, together with additional material specific to \.{CTWILL}. % FIXME \bigskip {\font\itt=cmitt10 \font\bit=cmbxti10 @@ -58,15 +58,11 @@ Section 2. Section 4. @x -@d _(S) gettext(S) - -@<Include files@>= +@d _(s) gettext(s) @y -@d _(S) gettext(S) -@-S@> - -@<Include files@>= -@-A@> +@d _(s) gettext(s) +@-s@> +@-a@> @-HAVE_GETTEXT@> @z @@ -255,16 +251,32 @@ Section 37. @r @ Control codes are converted to \.{CWEAVE}'s internal @z -Section 41. +Section 43. @x - if (loc++ <=limit) { int c=ccode[(eight_bits)*loc++]; +\yskip\hang |identifier|: In this case the global variables |id_first| and +|id_loc| will have been set to the beginning and ending-plus-one locations +in the buffer, as required by the |id_lookup| routine. + +\yskip\hang |string|: The string will have been copied into the array +|section_text|; |id_first| and |id_loc| are set as above (now they are +pointers into |section_text|). + +\yskip\hang |constant|: The constant is copied into |section_text|, with +slight modifications; |id_first| and |id_loc| are set. @y - if (loc++ <=limit) { int c=ccode[(eight_bits)*loc++]; -@-c@> -@z +{\raggedright +\yskip\hang |identifier|: In this case the global variables |id_first| and +|id_loc| will have been set to the beginning and ending-plus-one locations +in the buffer, as required by the |id_lookup| routine. -Section 43. +\yskip\hang |string|: The string will have been copied into the array +|section_text|; |id_first| and |id_loc| are set as above (now they are +pointers into |section_text|). + +\yskip\hang |constant|: The constant is copied into |section_text|, with +slight modifications; |id_first| and |id_loc| are set.\par} +@z @x \yskip\hang |xref_roman|, |xref_wildcard|, |xref_typewriter|, |TeX_string|, @@ -299,6 +311,15 @@ Section 44. @$c {CTWILL}44 \&{eight\_bits}@> @z +Section 45. + +@x +@ @<Predecl...@>=@+static eight_bits get_next(void); +@y +@ @<Predecl...@>=@+static eight_bits get_next(void); +@-get_next@> +@z + Section 46. @x @@ -351,9 +372,9 @@ Section 52. Section 53. @x -@d gather_digits_while(t) while (t || *loc=='\'') +@d gather_digits_while(t) while ((t) || *loc=='\'') @y -@d gather_digits_while(t) while (t || *loc=='\'') +@d gather_digits_while(t) while ((t) || *loc=='\'') @-t@> @z @@ -381,14 +402,34 @@ Section 63. @r @ @<If end of name...@>= @z +Section 65. + +@x +@ @<Predecl...@>=@+static void skip_restricted(void); +@y +@ @<Predecl...@>=@+static void skip_restricted(void); +@-skip_restricted@> +@z + +Section 69. + +@x +@ @<Predecl...@>=@+static void phase_one(void); +@y +@ @<Predecl...@>=@+static void phase_one(void); +@-phase_one@> +@z + Section 72. @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 */ +C_xref( /* makes cross-references for \CEE/ identifiers */ + eight_bits spec_ctrl) +@-C_xref@> +@$C_xref {CTWILL}72 \&{static} \&{void} (\,)@> @z @x @@ -433,14 +474,6 @@ Section 86. @$tex_new_line {CTWILL}86 =$\\{putc}(\.{'\\n'},\39\\{active\_file})$@> @z -Section 88. - -@x -@ When we are copying \TEX/ source material, we retain line breaks -@y -@r @ When we are copying \TEX/ source material, we retain line breaks -@z - Section 89. @x @@ -461,6 +494,26 @@ Section 90. @-s@> @z +Section 91. + +@x +out_str( /* output characters from |s| to end of string */ +const char*s) +@y +out_str( /* output characters from |s| to end of string */ +const char*s) +@-out_str@> +@$out_str {CTWILL}91 \&{static} \&{void} (\,)@> +@z + +Section 97. + +@x +@ The |out_name| procedure is used to output an identifier or index +@y +@r @ The |out_name| procedure is used to output an identifier or index +@z + Section 100. @x @@ -475,7 +528,10 @@ Section 101. @ The |copy_comment| function issues a warning if more braces are opened than @y @ The |copy_comment| function issues a warning if more braces are opened than +@-c@> @-t@> +@-copy_comment@> +@$copy_comment {CTWILL}101 \&{static} \&{int} (\,)@> @z @x @@ -492,7 +548,7 @@ Section 106. @r @ Here is a list of the category codes that scraps can have. @z -Section 110--111. +Section 109--110. @x @ The token lists for translated \TEX/ output contain some special control @@ -508,7 +564,7 @@ Section 110--111. @-n@> @z -Section 112--117. +Section 111--116. @x @ The raw input is converted into scraps according to the following table, @@ -576,7 +632,7 @@ The raw input is converted into scraps according to the following table, \yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr @z -Sections 118--126. +Sections 117--125. @x l.7 line numbers refer to 'prod.w' @ Here is a table of all the productions. Each production that @@ -593,7 +649,7 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'. \newcount\prodno \newdimen\midcol \let\+\relax @z -Section 119. +Section 118. @x l.78 \+& |lpar| |rpar| & |exp| \hfill $L\.{\\,}R$ & functions, declarations\cr @@ -626,7 +682,7 @@ Section 119. \ignorespaces#3\hfil}\quad \hbox to1.45in{\ignorespaces#4\hfil}}} @z -Section 120. +Section 119. @x l.45 |int_like| \alt|raw_int| |struct_like| & |extern "Ada" int|\cr @@ -658,7 +714,7 @@ Section 120. \ignorespaces#3\hfil}\quad \hbox to1.45in{\ignorespaces#4\hfil}}} @z -Section 121. +Section 120. @x l.75 \&{struct} \&{name\_info} $\{$\cr @@ -690,7 +746,7 @@ Section 121. \ignorespaces#3\hfil}\quad \hbox to1.45in{\ignorespaces#4\hfil}}} @z -Section 122. +Section 121. @x l.164 $|force|\,E\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|$ & $\!\!$|else x=0;|\cr @@ -723,7 +779,7 @@ Section 122. \advance\midcol20pt @z -Section 123. +Section 122. @x l.211 \+& |prerangle| & |binop| \hfill \.> & $>$ not in template\cr @@ -755,7 +811,7 @@ Section 123. \ignorespaces#3\hfil}\quad \hbox to1.45in{\ignorespaces#4\hfil}}} @z -Section 124. +Section 123. @x l.232 \+\dagit& |new_exp| & |exp| & |new int;|\cr @@ -807,7 +863,7 @@ Section 124. @y @z -Section 125. +Section 124. @x l.291 \+& |exp| |attr| & |attr| \hfill $E\.\ A$ & \&{enum} $\{x\ [[\ldots]]\}$ \cr @@ -846,7 +902,7 @@ Section 125. \advance\midcol20pt @z -Section 126. +Section 125. @x l.326 \+& |alignas_like| |cast| & |attr| & |alignas(int)| \cr @@ -879,7 +935,7 @@ Section 126. \everypar={\hangindent=2em} @z -Section 127. +Section 126. @x @* Implementing the productions. @@ -894,17 +950,17 @@ the category codes |pp->cat,@,@,(pp+1)->cat|$,\,\,\ldots\,$ the category codes |pp->cat|, |(pp+1)->cat|, $\,\ldots\,$ @z -Section 128. +Section 127. @x @ @d trans trans_plus.Trans /* translation texts of scraps */ @y @ @d trans trans_plus.Trans /* translation texts of scraps */ @-trans@> -@$trans {CTWILL}128 =\\{trans\_plus}.\\{Trans}@> +@$trans {CTWILL}127 =\\{trans\_plus}.\\{Trans}@> @z -Section 129. +Section 128. @x null_scrap.trans=&tok_start[0]; @@ -914,7 +970,7 @@ null_scrap.trans=&tok_start[0];@/ scrap_base=scrap_info+1;@/ @z -Section 130. +Section 129. @x @ Token lists in |@!tok_mem| are composed of the following kinds of @@ -925,13 +981,13 @@ Section 130. @-section_flag@> @-tok_flag@> @-inner_tok_flag@> -@$res_flag {CTWILL}130 =$\T{2}*\\{id\_flag}$@> -@$section_flag {CTWILL}130 =$\T{3}*\\{id\_flag}$@> -@$tok_flag {CTWILL}130 =$\T{3}*\\{id\_flag}$@> -@$inner_tok_flag {CTWILL}130 =$\T{4}*\\{id\_flag}$@> +@$res_flag {CTWILL}129 =$\T{2}*\\{id\_flag}$@> +@$section_flag {CTWILL}129 =$\T{3}*\\{id\_flag}$@> +@$tok_flag {CTWILL}129 =$\T{3}*\\{id\_flag}$@> +@$inner_tok_flag {CTWILL}129 =$\T{4}*\\{id\_flag}$@> @z -Section 133. +Section 132. @x @ The production rules listed above are embedded directly into \.{CWEAVE}, @@ -946,7 +1002,7 @@ Section 133. @-pp@> @z -Section 134. +Section 133. @x The code below is an exact translation of the production rules into @@ -957,7 +1013,7 @@ The code below is an exact translation of the production rules into @-p@> @z -Section 137--138. +Section 136--137. @x @ Let us consider the big switch for productions now, before looking @@ -966,9 +1022,9 @@ Section 137--138. @-cat1@> @-cat2@> @-cat3@> -@$cat1 {CTWILL}137 =$(\\{pp}+\T{1})\MG\\{cat}$@> -@$cat2 {CTWILL}137 =$(\\{pp}+\T{2})\MG\\{cat}$@> -@$cat3 {CTWILL}137 =$(\\{pp}+\T{3})\MG\\{cat}$@> +@$cat1 {CTWILL}136 =$(\\{pp}+\T{1})\MG\\{cat}$@> +@$cat2 {CTWILL}136 =$(\\{pp}+\T{2})\MG\\{cat}$@> +@$cat3 {CTWILL}136 =$(\\{pp}+\T{3})\MG\\{cat}$@> @z @x @@ -1040,14 +1096,12 @@ Section 137--138. 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 */ -} +pp++; /* if no match was found, we move to the right */ @y switch (pp->cat) { @<Cases for |pp->cat|@>@; } - pp++; /* if no match was found, we move to the right */ -} +pp++; /* if no match was found, we move to the right */ @ @<Cases for |pp->cat|@>=@t\1\5\5@> case exp: @<Cases for |exp|@>@; @+break; @@ -1104,7 +1158,7 @@ Section 137--138. case default_like: @<Cases for |default_like|@>@; @+break; @z -Section 139. +Section 138. @x should say, for example, `\.{@@!@@\^\\\&\{operator\} \$+\{=\}\$@@>}' (or, @@ -1114,15 +1168,19 @@ more properly alpha\-betized, should say, for example, `\.{@@!@@\^\\\&\{operator\}} \.{\$+\{=\}\$@@>}' (or, properly alpha\-betized, `\.{@@!@@:operator+=\}\{\\\&\{operator\}} \.{\$+\{=\}\$@@>}'). +@-find_first_ident@> +@-make_reserved@> +@-make_underlined@> +@-underline_xref@> @-no_ident_found@> @-case_found@> @-operator_found@> -@$no_ident_found {CTWILL}139 =\hfil\break(\&{token\_pointer}) 0@> -@$case_found {CTWILL}139 =\hfil\break(\&{token\_pointer}) 1@> -@$operator_found {CTWILL}139 =\hfil\break(\&{token\_pointer}) 2@> +@$no_ident_found {CTWILL}138 =\hfil\break(\&{token\_pointer}) 0@> +@$case_found {CTWILL}138 =\hfil\break(\&{token\_pointer}) 1@> +@$operator_found {CTWILL}138 =\hfil\break(\&{token\_pointer}) 2@> @z -Section 141. +Section 140. @x the |for| loop below. @@ -1139,11 +1197,13 @@ We use the fact that |make_underlined| has been called immediately preceding 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| */ +make_reserved( /* make the first identifier in |p->trans| like |int| */ +scrap_pointer p) +@-make_reserved@> +@$make_reserved {CTWILL}140 \&{static} \&{void} (\,)@> @z -Section 142. +Section 141. @x @ In the following situations we want to mark the occurrence of @@ -1157,57 +1217,89 @@ make_underlined( scrap_pointer p) @y make_underlined( -scrap_pointer p) /* underline the entry for the first identifier in |p->trans| */ +scrap_pointer p) +@-make_underlined@> +@$make_underlined {CTWILL}141 \&{static} \&{void} (\,)@> @z -Section 151. +Section 144. @x -@ @<Cases for |sizeof_like|@>= +else if (cat1==attr) { @y -@r @ @<Cases for |sizeof_like|@>= +else @/ if (cat1==attr) { @z Section 158. @x -@ @<Cases for |struct_like|@>= +@ @<Cases for |struct_head|@>= @y -@r @ @<Cases for |struct_like|@>= +@r @ @<Cases for |struct_head|@>= @z -Section 172. +Section 165. + +@x + else squash(pp,1,else_like,0,65); +} +else if (cat1==attr) { +@y + else squash(pp,1,else_like,0,65); +} +@+ else @/ if (cat1==attr) { +@z + +Section 171. @x @d force_lines flags['f'] /* should each statement be on its own line? */ @y @d force_lines flags['f'] /* should each statement be on its own line? */ @-force_lines@> -@$force_lines {CTWILL}172 =\\{flags}[\.{'f'}]@> +@$force_lines {CTWILL}171 =\\{flags}[\.{'f'}]@> @z -Section 180. +Section 174. @x -@ @d reserve_typenames flags['t'] +if (cat1==else_like || cat1==if_like || cat1==define_like) @y -@r @ @d reserve_typenames flags['t'] +if (cat1==else_like || cat1==if_like || cat1==define_like) @/ @z -Section 195. +@x +} else if (cat1==exp || cat1==function) { +@y +} else @/ if (cat1==exp || cat1==function) { +@z + +Section 182. @x - reduce(pp,4,attr_head,0,133); + big_app1(pp+2); reduce(pp,3,new_exp,0,96); +} +else if (cat1==raw_ubin) { +@y + big_app1(pp+2); reduce(pp,3,new_exp,0,96); } -else if (cat1==comma) squash(pp,2,attr_head,0,145); +@+ else @/ if (cat1==raw_ubin) { +@z + +Section 198. + +@x +static void squash(scrap_pointer,short,eight_bits,short,short); + +@ @c @y - reduce(pp,4,attr_head,0,133); -}@+ -else if (cat1==comma) squash(pp,2,attr_head,0,145); +static void squash(scrap_pointer,short,eight_bits,short,short); + +@r @ @c @z -Section 204. +Section 203. @x @ @<Print a snapsh...@>= @@ -1215,29 +1307,41 @@ Section 204. @ @<Print a snapsh...@>= @-n@> @% +@$n {CTWILL}198 \&{short}@> @$n {CTWILL}199 \&{short}@> -@$n {CTWILL}200 \&{short}@> @z -Section 207. +Section 205. @x -@ If the initial sequence of scraps does not reduce to a single scrap, +@ @<Predecl...@>=@+static text_pointer translate(void); @y -@r @ If the initial sequence of scraps does not reduce to a single scrap, +@ @<Predecl...@>=@+static text_pointer translate(void); +@-translate@> @z -Section 210. +Section 209. @x if (next_control=='|' || next_control==begin_comment || next_control==begin_short_comment) return; @y +@-C_parse@> +@$C_parse {CTWILL}209 \&{static} \&{void} (\,)@> if (next_control=='|' || next_control==begin_comment @| || next_control==begin_short_comment) return; @z -Section 212. +Section 210. + +@x +@ @<Predecl...@>=@+static void C_parse(eight_bits); +@y +@ @<Predecl...@>=@+static void C_parse(eight_bits); +@-C_parse@> +@z + +Section 211. @x @ The following macro is used to append a scrap whose tokens have just @@ -1247,13 +1351,13 @@ Section 212. @-c@> @z -Section 213. +Section 212. @x @ @<Append the scr...@>= @<Make sure that there is room for the new scraps, tokens, and texts@>@; @y -@r @ @<Append the scr...@>= +@ @<Append the scr...@>= @# @<Make sure that there is room for the new scraps, tokens, and texts@>@; @# @@ -1286,21 +1390,9 @@ Section 213. @.\\?@> 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 - -@x + 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; @@ -1312,18 +1404,18 @@ Section 213. case ',': app(',');@+app_scrap(comma,yes_math);@+break; case ';': app(';');@+app_scrap(semi,maybe_math);@+break; case ':': app(':');@+app_scrap(colon,no_math);@+break;@/ + @t\4@> @<Cases involving nonstandard characters@>@; @y + case ignore: case xref_roman: case xref_wildcard: case meaning: @/ + case suppress: case xref_typewriter: case noop:@+break; @# - @t\4@> @<Cases for syntax markers@>@; -@z - -@x - @t\4@> @<Cases involving nonstandard characters@>@; -@y - @t\4@> @<Cases involving nonstandard characters@>@; + @t\4@> @<Cases for operators and syntax markers@>@; + @t\4@> @<Cases involving nonstandard characters@>@; @# @z +Section 213--214. + @x overflow(_("scrap/token/text")); } @@ -1331,7 +1423,7 @@ Section 213. overflow(_("scrap/token/text")); } -@ @<Cases for operators@>=@t\1\5\5@> +@ @<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; @@ -1358,8 +1450,6 @@ Section 213. @.\\?@> 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; @@ -1373,84 +1463,67 @@ Section 213. case ':': app(':');@+app_scrap(colon,no_math);@+break;@/ @z -Section 217. +Section 221. @x -@ Some nonstandard characters may have entered \.{CWEAVE} by means of +@ The |outer_parse| routine is to |C_parse| as |outer_xref| @y -@r @ Some nonstandard characters may have entered \.{CWEAVE} by means of +@r @ The |outer_parse| routine is to |C_parse| as |outer_xref| @z -Section 220. - -@x -@<Append a \TEX/ string, without forming a scrap@>= -@y -@r @ @<Append a \TEX/ string, without forming a scrap@>= -@z - -Section 224. - @x @d make_pb flags['e'] @y @d make_pb flags['e'] @-make_pb@> -@$make_pb {CTWILL}224 =\\{flags}[\.{'e'}]@> +@$make_pb {CTWILL}221 =\\{flags}[\.{'e'}]@> @z Section 225. @x -make_pb=true; - -@ @c -@y -make_pb=true; - -@r @ @c -@z - -Section 228. - -@x -@ @d cur_end cur_state.end_field /* current ending location in |tok_mem| */ +@d cur_mode cur_state.mode_field /* current mode of interpretation */ @y -@ @d cur_end cur_state.end_field /* current ending location in |tok_mem| */ +@d cur_mode cur_state.mode_field /* current mode of interpretation */ @-cur_end@> @-cur_tok@> @-cur_mode@> -@$cur_end {CTWILL}228 =\\{cur\_state}.\\{end\_field}]@> -@$cur_tok {CTWILL}228 =\\{cur\_state}.\\{tok\_field}]@> -@$cur_mode {CTWILL}228 =\\{cur\_state}.\\{mode\_field}]@> +@$cur_end {CTWILL}225 =\\{cur\_state}.\\{end\_field}]@> +@$cur_tok {CTWILL}225 =\\{cur\_state}.\\{tok\_field}]@> +@$cur_mode {CTWILL}225 =\\{cur\_state}.\\{mode\_field}]@> @z -Section 229. +Section 228. @x -@<Private...@>= +push_level( /* suspends the current level */ +text_pointer p) @y -@r @ @<Private...@>= +push_level( /* suspends the current level */ +text_pointer p) +@-push_level@> +@$push_level {CTWILL}228 \&{static} \&{void} (\,)@> @z -Section 233. +Section 229. @x +force when the current level was begun. This subroutine will never be called when |stack_ptr==1|. @y -called when |stack_ptr| |==1|. +force when the current level was begun. + +This subroutine will never be called when |stack_ptr==1|. @z -Section 237. +Section 234--235. @x -@ The real work associated with token output is done by |make_output|. +@ Here is \.{CWEAVE}'s major output handler. @y -@r @ The real work associated with token output is done by |make_output|. +@r @ Here is \.{CWEAVE}'s major output handler. @z -Section 238--239. - @x reswitch: switch(a) { case end_translation: return; @@ -1485,12 +1558,12 @@ Section 238--239. } } @y - reswitch: @/@<The output |switch|@>@; + @/@<The output |switch|@>@; } } -@r @ @<The output |switch|@>= - switch(a) { +@ @<The output |switch|@>= + reswitch: switch(a) { case end_translation: return; case identifier: case res_word: @<Output an identifier@>@; break; case section_code: @<Output a section name@>@; break; @@ -1522,77 +1595,116 @@ Section 238--239. } @z -Section 244. +Section 236. @x -@ The remaining part of |make_output| is somewhat more complicated. When we +@ An identifier of length one does not have to be enclosed in braces, and it @y -@r @ The remaining part of |make_output| is somewhat more complicated. When we +@r @ An identifier of length one does not have to be enclosed in braces, and it @z -Section 247. +Section 237. @x -@ The \CEE/ text enclosed in \pb\ should not contain `\.{\v}' characters, + } else if (a==opt) b=get_output(); /* ignore digit following |opt| */ @y -@r @ The \CEE/ text enclosed in \pb\ should not contain `\.{\v}' characters, + }@+ else if (a==opt) b=get_output(); /* ignore digit following |opt| */ @z -Section 251. +Section 238. @x - space_checked=true; -@.\\Y@> +@<Look ahead for st...@>= { + b=a; save_mode=cur_mode; + if (dindent_pending) { + c=2; dindent_pending=false; + } else c=0; @y - space_checked=true; -@.\\Y@> -@d usage_sentinel (struct perm_meaning *)1 -@-usage_sentinel@> -@$usage_sentinel {CTWILL}251 =(\&{struct} \\{perm\_meaning} ${}{*}{}$) \T{1}@> +@<Look ahead for st...@>= {@+ + b=a; save_mode=cur_mode; + if (dindent_pending) {@+ + c=2; dindent_pending=false;@+ + } else c=0; @z -Section 252. +@x + while (true) { +@y + while (true) {@+ +@z + +Section 241. @x -@ @d usage_sentinel (struct perm_meaning *)1 + case ' ': case '\\': case '#': case '%': case '$': case '^': + case '{': case '}': case '~': case '&': case '_': + out('\\'); /* falls through */ @y -@r @ + case ' ': case '\\': case '#': case '%': @/ + case '$': case '^': case '{': case '}': @/ + case '~': case '&': case '_': @/ + out('\\'); /* falls through */ @z -Section 253. +Section 243. @x - if (right_start_switch) { - out_str("\\shortpage\n"); right_start_switch=false; -@.\\shortpage@> - } + if (b=='@@' || (b=='\\' && delim!=0)) @y - if (right_start_switch) {@+ - out_str("\\shortpage\n"); right_start_switch=false;@+ -@.\\shortpage@> - } + if (b=='@@' || (b=='\\' && delim!=0)) @/ @z +Section 245. + @x - else { - for (sec_depth=0; xisdigit(*loc);loc++) - sec_depth = sec_depth*10 + (*loc) -'0'; - } +phase_two(void) { @y - else @+ - for (sec_depth=0; xisdigit(*loc);loc++) - sec_depth = sec_depth*10 + (*loc) -'0'; +phase_two(void) {@+ @z -Section 256. +Section 246. + +@x +@ @<Predecl...@>=@+static void phase_two(void); +@y +@ @<Predecl...@>=@+static void phase_two(void); +@-phase_two@> +@z + +Section 248. + +@x +@ @d usage_sentinel (struct perm_meaning *)1 +@<Translate the current section@>= { +@y +@ @d usage_sentinel (struct perm_meaning *)1 +@-usage_sentinel@> +@$usage_sentinel {CTWILL}248 =(\&{struct} \&{perm\_meaning} ${}{*}{}$) \T{1}@> +@<Translate the current section@>=@+ { +@z + +Section 252. + +@x +finish_C( /* finishes a definition or a \CEE/ part */ + boolean visible) /* |true| if we should produce \TeX\ output */ +@y +finish_C( /* finishes a definition or a \CEE/ part */ + boolean visible) /* |true| if we should produce \TeX\ output */ +@-finish_C@> +@$finish_C {CTWILL}252 \&{static} \&{void} (\,)@> +@z + +Section 253. @x -@ The |finish_C| procedure outputs the translation of the current +@ @<Predecl...@>=@+static void finish_C(boolean); @y -@r @ The |finish_C| procedure outputs the translation of the current +@ @<Predecl...@>=@+static void finish_C(boolean); +@-finish_C@> @z -Section 259. +Section 255. @x @ @<Start a format...@>= { @@ -1600,7 +1712,7 @@ Section 259. @r @ @<Start a format...@>= { @z -Section 260. +Section 256. @x |next_control>=begin_C|. We will make the global variable |this_section| @@ -1611,7 +1723,37 @@ We will make the global variable |this_section| point to \hfil\break the current section name, if it has a name. @z -Section 273. +Section 261. + +@x +footnote( /* outputs section cross-references */ +sixteen_bits flag) +@y +footnote( /* outputs section cross-references */ +sixteen_bits flag) +@-footnote@> +@$footnote {CTWILL}261 \&{static} \&{void} (\,)@> +@z + +Section 262. + +@x +@ @<Predecl...@>=@+static void footnote(sixteen_bits); +@y +@ @<Predecl...@>=@+static void footnote(sixteen_bits); +@-footnote@> +@z + +Section 266. + +@x +@ @<Predecl...@>=@+static void phase_three(void); +@y +@ @<Predecl...@>=@+static void phase_three(void); +@-phase_three@> +@z + +Section 269. @x @ A left-to-right radix sorting method is used, since this makes it easy to @@ -1620,7 +1762,7 @@ Section 273. @-c@> @z -Section 275. +Section 271. @x @<Rest of |trans_plus| union@>= @@ -1630,7 +1772,7 @@ Section 275. @-k@> @z -Section 276. +Section 272. @x @ @d depth cat /* reclaims memory that is no longer needed for parsing */ @@ -1640,13 +1782,13 @@ Section 276. @-head@> @-sort_ptr@> @-max_sorts@> -@$depth {CTWILL}276 =\\{cat}@> -@$head {CTWILL}276 =\\{trans\_plus}.\\{Head}@> -@$sort_ptr {CTWILL}276 =\\{scrap\_ptr}@> -@$max_sorts {CTWILL}276 =\\{max_scraps}@> +@$depth {CTWILL}272 =\\{cat}@> +@$head {CTWILL}272 =\\{trans\_plus}.\\{Head}@> +@$sort_ptr {CTWILL}272 =\\{scrap\_ptr}@> +@$max_sorts {CTWILL}272 =\\{max_scraps}@> @z -Section 278. +Section 274. @x $|collate|[0]<|collate|[1]<\cdots<|collate|[100]$. @@ -1654,39 +1796,55 @@ $|collate|[0]<|collate|[1]<\cdots<|collate|[100]$. |collate[0]| ${}<{}$|collate[1]|${}<\cdots<{}$|collate[100]|. @z -Section 280. +Section 276. @x @ Procedure |unbucket| goes through the buckets and adds nonempty lists @y @r @ Procedure |unbucket| goes through the buckets and adds nonempty lists +@-unbucket@> +@$unbucket {CTWILL}276 \&{static} \&{void} (\,)@> @z -Section 283. +Section 277. @x +@ @<Predecl...@>=@+static void unbucket(eight_bits); +@y +@ @<Predecl...@>=@+static void unbucket(eight_bits); +@-unbucket@> +@z + +Section 279. + +@x +@ @<Split the list...@>= { + eight_bits c; next_name=sort_ptr->head; @y +@ @<Split the list...@>= {@+ + eight_bits c; next_name=sort_ptr->head;@/ @z -Section 284. +Section 280. @x cur_name=sort_ptr->head; @y - cur_name=sort_ptr->head;@/ + @+cur_name=sort_ptr->head;@/ @z -Section 285. +Section 286. @x -switch (cur_name->ilk) {@+char *j; +@ @<Predecl...@>=@+static void section_print(name_pointer); @y -switch (cur_name->ilk) { char *j; +@ @<Predecl...@>=@+static void section_print(name_pointer); +@-section_print@> @z -Section 292. +Section 288. @x puts(_("\nMemory usage statistics:")); @@ -1750,7 +1908,7 @@ Section 292. @t\5\5\5\5@>(long)max_scraps); @z -Section 293. +Section 289. @x @** Mogrify {\tentex CWEAVE} into {\tentex CTWILL}. The following sections @@ -1758,12 +1916,13 @@ introduce material that is specific to \.{CTWILL}. Care has been taken to keep the original section numbering of \.{CWEAVE} up to this point intact, so this new material should nicely integrate -with the original ``\&{272.~Index}.'' +with the original ``\&{271.~Index}.'' -@q Section 2->273. @> +@q Section 2->272. @> @* {\tentex CTWILL} user manual. @y @** Mogrify {\tentex CWEAVE} into {\tentex CTWILL}. +@-s@> @z @x @@ -1774,7 +1933,7 @@ give it the necessary hints in other places via your change file. @-x@> @z -Section 294--295. +Section 290--291. @x The current meaning of every identifier is initially `\.{\\uninitialized}'. @@ -1799,7 +1958,26 @@ must have fewer than 50 characters. @y @z -Section 307. +Section 293. + +@x +static struct perm_meaning { +@y +static struct perm_meaning { +@-perm_meaning@> +@$perm_meaning {CTWILL}293 \&{static} \&{struct}@> +@z + +Section 302. + +@x +@ @<Predec...@>=@+static boolean app_supp(text_pointer); +@y +@ @<Predec...@>=@+static boolean app_supp(text_pointer); +@-app_supp@> +@z + +Section 303. @x @ The trickiest part of \.{CTWILL} is the procedure |make_ministring(l)|, @@ -1808,9 +1986,20 @@ Section 307. @-a@> @-b@> @-c@> +@-make_ministring@> +@$make_ministring {CTWILL}303 \&{static} \&{void} (\,)@> +@z + +Section 304. + +@x +@ @<Predec...@>=@+static void make_ministring(int); +@y +@ @<Predec...@>=@+static void make_ministring(int); +@-make_ministring@> @z -Section 311. +Section 307. @x @ @<Append tokens for type |q|@>= @@ -1824,28 +2013,37 @@ Section 311. @|&& *(*r+1)=='{') app(**q); /* |struct_like| identifier */ @z -Section 316. +Section 312. @x @ @<Write the new meaning to the \.{.aux} file@>= @y @ @<Write the new meaning to the \.{.aux} file@>= @% -@$p {CTWILL}300 \&{name\_pointer}@> -@$q {CTWILL}300 \&{struct perm\_meaning} ${}{*}{}$@> +@$p {CTWILL}296 \&{name\_pointer}@> +@$q {CTWILL}296 \&{struct perm\_meaning} ${}{*}{}$@> @z -Section 317. +Section 313. @x @<Flag the usage of this identifier, for the mini-index@>= @y @<Flag the usage of this identifier, for the mini-index@>= @% -@$p {CTWILL}222 \&{name\_pointer}@> +@$p {CTWILL}219 \&{name\_pointer}@> @z -Section 321. +Section 316. + +@x +@ @<Predec...@>=@+static void out_mini(meaning_struct *); +@y +@ @<Predec...@>=@+static void out_mini(meaning_struct *); +@-out_mini@> +@z + +Section 317. @x @ Compare this code with section |@<Output the name...@>|. @@ -1855,27 +2053,36 @@ Section 321. @ @<Mini-output...@>= @z -Section 326. +Section 319. + +@x +@ @<Predec...@>=@+static sixteen_bits title_lookup(void); +@y +@ @<Predec...@>=@+static sixteen_bits title_lookup(void); +@-title_lookup@> +@z + +Section 322. @x @d indent_param_decl flags['i'] /* should formal parameter declarations be indented? */ @y @d indent_param_decl flags['i'] /* should formal parameter declarations be indented? */ @-indent_param_decl@> -@$indent_param_decl {CTWILL}326 =\\{flags}[\.{'i'}]@> +@$indent_param_decl {CTWILL}322 =\\{flags}[\.{'i'}]@> @z -Section 327. +Section 323. @x @d order_decl_stmt flags['o'] /* should declarations and statements be separated? */ @y @d order_decl_stmt flags['o'] /* should declarations and statements be separated? */ @-order_decl_stmt@> -@$order_decl_stmt {CTWILL}327 =\\{flags}[\.{'o'}]@> +@$order_decl_stmt {CTWILL}323 =\\{flags}[\.{'o'}]@> @z -Section 333. +Section 329. @x @** Index. diff --git a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch index f194af2c139..7fe1b3585a4 100644 --- a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch @@ -35,9 +35,9 @@ @z @x -\def\title{CWEAVE (Version 4.3)} +\def\title{CWEAVE (Version 4.4)} @y -\def\title{CTWILL (Version 4.3 [\TeX~Live])} +\def\title{CTWILL (Version 4.4 [\TeX~Live])} @z @x @@ -47,9 +47,9 @@ @z @x - \centerline{(Version 4.3)} + \centerline{(Version 4.4)} @y - \centerline{(Version 4.3 [\TeX~Live])} + \centerline{(Version 4.4 [\TeX~Live])} @z @x @@ -76,7 +76,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.4)" @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 @@ -93,14 +93,14 @@ can be found in Knuth's article ``Mini-indexes for literate programs,'' reprinted in {\sl Digital Typography\/} (1999), 225--245. A kind of ``user manual'' for \.{CTWILL} can be found in the appendix -{\bf 272.~Mogrify \.{CWEAVE} into \.{CTWILL}} and beyond, together +{\bf 271.~Mogrify \.{CWEAVE} into \.{CTWILL}} and beyond, together with additional material specific to \.{CTWILL}. % FIXME Until then, \.{CWEAVE}'s sequence of sections will be preserved. 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.4" /* will be extended by the \TeX~Live |versionstring| */ @z @@ -123,6 +123,14 @@ modified. The version number parallels the corresponding version of \.{CWEAVE}. @z @x +@d max_refs 20000 /* number of cross-references; must be less than 65536 */ +@d max_scraps 2000 /* number of tokens in \CEE/ texts being parsed */ +@y +@d max_refs 65535 /* number of cross-references; must be less than 65536 */ +@d max_scraps 5000 /* number of tokens in \CEE/ texts being parsed */ +@z + +@x turned on during the first phase. @<Private...@>= @@ -138,6 +146,18 @@ turned on during the first phase---NOT! @z @x +@d max_toks 20000 /* number of symbols in \CEE/ texts being parsed; + must be less than 65536 */ +@d max_texts 4000 /* number of phrases in \CEE/ texts being parsed; + must be less than 10240 */ +@y +@d max_toks 65535 /* number of symbols in \CEE/ texts being parsed; + must be less than 65536 */ +@d max_texts 10239 /* number of phrases in \CEE/ texts being parsed; + must be less than 10240 */ +@z + +@x @ Here are the three procedures needed to complete |id_lookup|: @y @ Here are the three procedures needed to complete |id_lookup|: @@ -147,7 +167,7 @@ turned on during the first phase---NOT! @x p->ilk=t; init_node(p); @y - struct perm_meaning *q=p-name_dir+cur_meaning; + struct perm_meaning *q=get_meaning(p); p->ilk=t; init_node(p); q->stamp=0; q->link=NULL; @@ -157,15 +177,30 @@ turned on during the first phase---NOT! @z @x +@ And here's a small helper function to simplify the code. + +@d update_node(p) (p)->xref=(void *)xref_ptr +@y +@ And here are two small helper functions to simplify the code. + +@d update_node(p) (p)->xref=(void *)xref_ptr +@d get_meaning(p) (p)-name_dir+cur_meaning +@z + +@x id_lookup("extern",NULL,int_like); @y +@# ext_loc=id_lookup("extern",NULL,int_like)-name_dir; +@# @z @x id_lookup("int",NULL,raw_int); @y +@# int_loc=id_lookup("int",NULL,raw_int)-name_dir; +@# @z @x @@ -281,24 +316,24 @@ skip_TeX(void) @z @x - case translit_code: err_print("! Use @@l in limbo only"); continue; + case translit_code: err_print("! Use @@l in limbo only"); continue; @y - case translit_code: err_print(_("! Use @@l in limbo only")); continue; + case translit_code: err_print(_("! Use @@l in limbo only")); continue; @z @x - case underline: xref_switch=def_flag; continue; + case underline: xref_switch=def_flag; continue; @y - case underline: xref_switch=def_flag; continue; - case temp_meaning: temp_switch=true-temp_switch; continue; - case right_start: right_start_switch=true; continue; + case underline: xref_switch=def_flag; continue; + case temp_meaning: temp_switch=!temp_switch; continue; + case right_start: right_start_switch=true; continue; @z @x - case xref_roman: case xref_wildcard: case xref_typewriter: case noop: + case xref_roman: case xref_wildcard: case xref_typewriter: case noop: @y - case xref_roman: case xref_wildcard: case xref_typewriter: case noop: - case meaning: case suppress: + case xref_roman: case xref_wildcard: case xref_typewriter: case noop: + case meaning: case suppress: @z @x @@ -326,11 +361,9 @@ skip_TeX(void) @z @x -static void skip_restricted(void) { @y -static void skip_restricted(void) { int c=ccode[(eight_bits)*(loc-1)]; @z @@ -356,9 +389,9 @@ skip_restricted(void) @z @x - if (loc>=limit) err_print("! Verbatim string didn't end"); +if (loc>=limit) err_print("! Verbatim string didn't end"); @y - if (loc>=limit) err_print(_("! Verbatim string didn't end")); +if (loc>=limit) err_print(_("! Verbatim string didn't end")); @z @x @@ -405,15 +438,15 @@ skip_restricted(void) @z @x - err_print("! Missing left identifier of @@s"); + err_print("! Missing left identifier of @@s"); @y - err_print(_("! Missing left identifier of @@s")); + err_print(_("! Missing left identifier of @@s")); @z @x - err_print("! Missing right identifier of @@s"); + err_print("! Missing right identifier of @@s"); @y - err_print(_("! Missing right identifier of @@s")); + err_print(_("! Missing right identifier of @@s")); @z @x @@ -470,7 +503,7 @@ tex_puts(proofing?"ctproofma":"ctwima"); @y @d out(c) {if (ms_mode) { /* outputting to |ministring_buf| */ - if (ministring_ptr<&ministring_buf[max_tex_chars]) + if (ministring_ptr<ministring_buf_end) *ministring_ptr++=c; } else { if (out_ptr>=out_buf_end) break_out(); @@ -493,7 +526,7 @@ the section is changed, we output `\.{\\*}' just after the number. @z @x - if(changed_section[n]) out_str ("\\*"); + if (changed_section[n]) out_str("\\*"); @.\\*@> @y @z @@ -569,13 +602,13 @@ null_scrap.trans=&tok_start[0]; @z @x -@d inner_tok_flag 5*id_flag /* signifies a token list in `\pb' */ +@d inner_tok_flag (5*id_flag) /* signifies a token list in `\pb' */ @c static void print_text( /* prints a token list for debugging; not used in |main| */ @y -@d inner_tok_flag 5*id_flag /* signifies a token list in `\pb' */ +@d inner_tok_flag (5*id_flag) /* signifies a token list in `\pb' */ @<Predecl...@>= #if 0 @@ -840,9 +873,9 @@ if (cat1==decl_head) { @z @x - if (tok_ptr+6>tok_mem_end) overflow("token"); + if (tok_ptr+6>tok_mem_end) overflow("token"); @y - if (tok_ptr+6>tok_mem_end) overflow(_("token")); + if (tok_ptr+6>tok_mem_end) overflow(_("token")); @z @x @@ -937,9 +970,9 @@ to \.{\\PB}. Although \.{ctwimac} ignores \.{\\PB}, other macro packages @z @x -reset_input(); if (show_progress) fputs("\nWriting the output file...",stdout); +if (show_progress) fputs("\nWriting the output file...",stdout); @y -reset_input(); if (show_progress) fputs(_("\nWriting the output file..."),stdout); +if (show_progress) fputs(_("\nWriting the output file..."),stdout); @z @x @@ -1000,7 +1033,7 @@ flush_buffer(out_ptr,false,false); case '@@': out('@@'); break; @y case '@@': out('@@'); break; - case temp_meaning: temp_switch=true-temp_switch; break; + case temp_meaning: temp_switch=!temp_switch; break; case right_start: right_start_switch=true; break; @z @@ -1176,19 +1209,18 @@ the index section itself---NOT! @z @x -@ @<Tell about changed sections@>= { - /* remember that the index is already marked as changed */ - k_section=0; - while (!changed_section[++k_section]); - out_str("\\ch "); +@ @<Tell about changed sections@>= +/* remember that the index is already marked as changed */ +k_section=0; +while (!changed_section[++k_section]); +out_str("\\ch "); @.\\ch@> - out_section(k_section); - while (k_section<section_count) { - while (!changed_section[++k_section]); - out_str(", "); out_section(k_section); - } - out('.'); +out_section(k_section); +while (k_section<section_count) { + while (!changed_section[++k_section]); + out_str(", "); out_section(k_section); } +out('.'); @y @ No need to tell about changed sections. @z @@ -1201,11 +1233,13 @@ the index section itself---NOT! @x @ @<Output the name...@>= +switch (cur_name->ilk) {@+char *j;@+@t}\6{\4@> @y @ We don't format the index completely; the \.{twinx} program does the rest of the job. @<Output the name...@>= +switch (cur_name->ilk) { @z @x @@ -1215,6 +1249,12 @@ rest of the job. @z @x + else { +@y + else {@+char *j;@+@t}\6{@> +@z + +@x case wildcard: out_str("\\9");@+ goto not_an_identifier; @y case roman: out_str(" ");@+ goto not_an_identifier; @@ -1238,12 +1278,7 @@ not_an_identifier: out_name(cur_name,false); goto name_done; @x out_name(cur_name,true); @y -if (proofing) out_name(cur_name,true); -else {@+char *j; - out('{'); - for (j=cur_name->byte_start;j<(cur_name+1)->byte_start;j++) out(*j); - out('}'); -} +out_name(cur_name,proofing); @z @x @@ -1298,15 +1333,15 @@ else {@+char *j; @x @** Index. @y -@q Section 272. @> +@q Section 271. @> @** Mogrify {\tentex CWEAVE} into {\tentex CTWILL}. The following sections introduce material that is specific to \.{CTWILL}. Care has been taken to keep the original section numbering of \.{CWEAVE} up to this point intact, so this new material should nicely integrate -with the original ``\&{272.~Index}.'' +with the original ``\&{271.~Index}.'' -@q Section 2->273. @> +@q Section 2->272. @> @* {\tentex CTWILL} user manual. Here is a sort of user manual for \.{CTWILL}---which is exactly like \.{CWEAVE} except that it produces much better documentation, for which you @@ -1356,12 +1391,12 @@ please do so. understanding this method, you will understand how to fix it when things go wrong. Every identifier has a current ``meaning,'' consisting of its abstract type and the number of the section in which it was most recently -defined. For example, if your \Cee\ program says `|char *s|' in section~3, -the meaning of~|s| gets changed to `\&{char} $*$, \S3' while \.{CTWILL} +defined. For example, if your \Cee\ program says `\&{char}~$*$|s|' in section~3, +the meaning of~|s| gets changed to `\&{char}~$*$,~\S3' while \.{CTWILL} is processing that section. If you refer to~|s| in section~10, and if |s|~hasn't been redefined in the meantime, and if section~10 doesn't wind up on the same two-page spread as section~3, the mini-index generated -by section~10 will say ``|s|: \&{char}~$*$, \S3.'' +by section~10 will say ``|s|:~\&{char}~$*$,~\S3.'' The current meaning of every identifier is initially `\.{\\uninitialized}'. Then \.{CTWILL} reads the \.{.aux} file for your job, if any; this @@ -1428,7 +1463,7 @@ with `\.=', the mini-index entry will contain an equals sign instead of a colon; for example, $$\.{@@\$buf\_size \{PROG\}10 =\\T\{200\}@@>}$$ generates either `$\\{buf\_size}=200$, \S10' or -`$\\{buf\_size}=200$, {\sc PROG}\S10', depending on whether +`$\\{buf\_size}=200$, {\sc PROG}~\S10', depending on whether `{\sc PROG}' is or isn't the title of the current program. If the \TeX\ part is `\.{\\zip}', the mini-index entry will contain neither colon nor equals, just a comma. The program name and section number @@ -1467,7 +1502,7 @@ which are quite different from the change files you set up for tangling. @d max_tex_chars 50 /* limit on the \TeX\ part of a meaning */ -@q Section 25->274. @> +@q Section 25->273. @> @* Temporary and permanent meanings. \.{CTWILL} has special data structures to keep track of current and temporary meanings. These structures were not designed for maximum @@ -1485,33 +1520,39 @@ typedef struct { char tex_part[max_tex_chars]; /* \TeX\ part of meaning */ } meaning_struct; -@q Section 26->275. @> +@q Section 26->274. @> @ @<Private...@>= -struct perm_meaning { +static struct perm_meaning { meaning_struct perm; /* current meaning of an identifier */ int stamp; /* last section number in which further output suppressed */ struct perm_meaning *link; /* another meaning to output in this section */ } cur_meaning[max_names]; /* the current ``permanent'' meanings */ static struct perm_meaning *top_usage; /* first meaning to output in this section */ static meaning_struct temp_meaning_stack[max_meanings]; /* the current ``temporary'' meanings */ +static meaning_struct *temp_meaning_stack_end=temp_meaning_stack+max_meanings-1; + /* end of |temp_meaning_stack| */ static meaning_struct *temp_meaning_ptr; /* first available slot in |temp_meaning_stack| */ static meaning_struct *max_temp_meaning_ptr; /* its maximum value so far */ static name_pointer title_code[max_titles]; /* program names seen so far */ +static name_pointer *title_code_end=title_code+max_titles-1; + /* end of |title_code| */ static name_pointer *title_code_ptr; /* first available slot in |title_code| */ static char ministring_buf[max_tex_chars]; /* \TeX\ code being generated */ +static char *ministring_buf_end=ministring_buf+max_tex_chars-1; + /* end of |ministring_buf| */ static char *ministring_ptr; /* first available slot in |ministring_buf| */ static boolean ms_mode; /* are we outputting to |ministring_buf|? */ -@q Section 27->276. @> +@q Section 27->275. @> @ @<Set init...@>= max_temp_meaning_ptr=temp_meaning_stack; title_code_ptr=title_code; ms_mode=false; -@q Section 277. @> +@q Section 276. @> @ @<Predec...@>=@+static void new_meaning(name_pointer); -@q Section 30->278. @> +@q Section 30->277. @> @ The |new_meaning| routine changes the current ``permanent meaning'' when an identifier is redeclared. It gets the |tex_part| from |ministring_buf|. @@ -1521,11 +1562,11 @@ static void new_meaning( name_pointer p) { - struct perm_meaning *q=p-name_dir+cur_meaning; + struct perm_meaning *q=get_meaning(p); ms_mode=false; if (q->stamp!=section_count) { if (*(ministring_ptr-1)==' ') ministring_ptr--; - if (ministring_ptr>=&ministring_buf[max_tex_chars]) + if (ministring_ptr>=ministring_buf_end) strcpy(ministring_buf,"\\zip"); /* ignore |tex_part| if too long */ @.\\zip@> else *ministring_ptr='\0'; @@ -1536,7 +1577,7 @@ new_meaning( @<Write the new meaning to the \.{.aux} file@>@; } -@q Section 75->279. @> +@q Section 75->278. @> @ @<Process a user-generated meaning@>= { char *first=id_first; while (xisspace(*first)) first++; @@ -1556,25 +1597,25 @@ new_meaning( loc=id_loc+2; } -@q Section 76->280. @> +@q Section 76->279. @> @ @<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; + struct perm_meaning *q=get_meaning(id_lookup(first,last,normal)); q->stamp=section_count; /* this is what actually suppresses output */ } } -@q Section 77->281. @> +@q Section 77->280. @> @ @<Digest...@>= { meaning_struct *m; - struct perm_meaning *q=p-name_dir+cur_meaning; + struct perm_meaning *q=get_meaning(p); if (temp_switch) { m=temp_meaning_ptr++; if (temp_meaning_ptr>max_temp_meaning_ptr) { - if (temp_meaning_ptr>&temp_meaning_stack[max_meanings]) + if (temp_meaning_ptr>=temp_meaning_stack_end) overflow(_("temp meanings")); max_temp_meaning_ptr=temp_meaning_ptr; } @@ -1590,7 +1631,7 @@ new_meaning( } } -@q Section 141->282/3. @> +@q Section 141->281/2. @> @* Make ministrings. \.{CTWILL} needs the following procedure, which appends tokens of a translated text until coming to |tok_loc|, then suppresses text that may @@ -1606,25 +1647,24 @@ static boolean app_supp( { token_pointer j; if (ident_seen && **p>=tok_flag) switch (**(**p-tok_flag+tok_start)) { - case '(': app('(');@+app('\\');@+app(',');@+app(')'); goto catch14; - case '[': app('[');@+app('\\');@+app(',');@+app(']'); goto catch14; + case '(': app_str("(\\,)"); goto catch14; + case '[': app_str("[\\,]"); goto catch14; } - for (j=*p;j<*(p+1);j++) { + for (j=*p;j<*(p+1);j++) if (*j<tok_flag) { if (*j==inserted) break; if (j==tok_loc) ident_seen=true; else app(*j); } else if (*j>=inner_tok_flag) confusion(_("inner")); else if (app_supp(*j-tok_flag+tok_start)) goto catch14; - } return false; catch14: return *(*(p+1)-1)=='9'; /* was production 14 used? */ } -@q Section 284. @> +@q Section 283. @> @ @<Predec...@>=@+static boolean app_supp(text_pointer); -@q Section 142->285. @> +@q Section 142->284. @> @ The trickiest part of \.{CTWILL} is the procedure |make_ministring(l)|, which tries to figure out a symbolic form of definition after |make_underlined(pp+l)| has been called. We rely heavily on the @@ -1655,14 +1695,14 @@ make_ministring( cur_mathness=maybe_math; /* restore it */ } -@q Section 286. @> +@q Section 285. @> @ @<Predec...@>=@+static void make_ministring(int); -@q Section 43->287. @> +@q Section 43->286. @> @ @<Private...@>= static sixteen_bits int_loc, ext_loc; /* locations of special reserved words */ -@q Section 143->288. @> +@q Section 143->287. @> @ Here we use the fact that a |decl_head| comes from |int_like| only in production~27, whose translation is fairly easy to recognize. (Well, production 28 has been added for \CPLUSPLUS/, but we hope that doesn't @@ -1703,7 +1743,7 @@ else { @<Append tokens for type |q|@>@; } -@q Section 144->289. @> +@q Section 144->288. @> @ @<Append tokens for type |q|@>= cur_mathness=no_math; /* it was |maybe_math| */ if (*(q+1)==*q+8 && *(*q+1)==' ' && *(*q+3)==' ') { @@ -1715,13 +1755,13 @@ while (ast_count) { big_app('{');@+app('*');@+app('}');@+ast_count--; } -@q Section 253->290. @> +@q Section 253->289. @> @ @<Private...@>= static boolean is_macro; /* it's a macro def, not a format def */ static boolean def_diff; /* |false| iff the current macro has parameters */ static name_pointer id_being_defined; /* the definee */ -@q Section 257->291. @> +@q Section 257->290. @> @ @<Make ministring for a new macro@>= { ms_mode=true; ministring_ptr=ministring_buf; @@ -1739,14 +1779,14 @@ static name_pointer id_being_defined; /* the definee */ new_meaning(id_being_defined); } -@q Section 246->292. @> +@q Section 246->291. @> @* Process {\tentex .aux} files. @<Private...@>= static FILE *aux_file; static char aux_file_name[max_file_name_length]; /* name of \.{.aux} file */ -@q Section 247->293. @> +@q Section 247->292. @> @ @<Read the \.{.aux} file, if present; then open it for output@>= memcpy(aux_file_name,tex_file_name,strlen(tex_file_name)-4); strcat(aux_file_name,".bux"); @@ -1767,7 +1807,7 @@ if (include_depth) { /* at least one new file was opened */ if ((aux_file=fopen(aux_file_name,"wb"))==NULL) fatal(_("! Cannot open aux output file "),aux_file_name); -@q Section 31->294. @> +@q Section 31->293. @> @ @<Write the new meaning to the \.{.aux} file@>= {@+int n=q->perm.prog_no; fprintf(aux_file,"@@$%.*s %.*s",@| @@ -1777,7 +1817,7 @@ if ((aux_file=fopen(aux_file_name,"wb"))==NULL) fprintf(aux_file," %s@@>\n",q->perm.tex_part); } -@q Section 268->295. @> +@q Section 268->294. @> @* Usage of identifiers. The following code is performed for each identifier parsed during a section. Variable |top_usage| is always nonzero; it has the sentinel @@ -1788,20 +1828,20 @@ placed on the list, unless they are reserved and their current \TeX\ meaning is uninitialized. @<Flag the usage of this identifier, for the mini-index@>= -{ struct perm_meaning *q=p-name_dir+cur_meaning; - if (!(abnormal(p)) || strcmp(q->perm.tex_part,"\\uninitialized")!=0) +{ struct perm_meaning *q=get_meaning(p); + if (!abnormal(p) || strcmp(q->perm.tex_part,"\\uninitialized")!=0) if (q->link==NULL) { q->link=top_usage; top_usage=q; } } -@q Section 269->296. @> +@q Section 269->295. @> @ @<Output information about usage of id's defined in other sections@>= { struct perm_meaning *q; while (temp_meaning_ptr>temp_meaning_stack) { out_mini(--temp_meaning_ptr); - q=temp_meaning_ptr->id-name_dir+cur_meaning; + q=get_meaning(temp_meaning_ptr->id); q->stamp=section_count; /* suppress output from ``permanent'' data */ } while (top_usage!=usage_sentinel) { @@ -1812,7 +1852,7 @@ placed on the list, unless they are reserved and their current } } -@q Section 270->297. @> +@q Section 270->296. @> @ @c static void out_mini( meaning_struct *m) @@ -1831,20 +1871,20 @@ out_mini( out(' '); out_str(m->tex_part); finish_line(); } -@q Section 271->298. @> +@q Section 271->297. @> @ @<Predec...@>=@+static void out_mini(meaning_struct *); -@q Section 272->299. @> +@q Section 272->298. @> @ Compare this code with section |@<Output the name...@>|. @<Mini-output...@>= -switch (cur_name->ilk) {@+char *j; +switch (cur_name->ilk) {@+char *j;@+@t}\6{\4@> case normal: case func_template: if (is_tiny(cur_name)) out_str("\\|"); else { for (j=cur_name->byte_start;j<(cur_name+1)->byte_start;j++) if (xislower(*j)) goto lowcase; - out_str("\\."); break; + goto allcaps; lowcase: out_str("\\\\"); } break; @@ -1853,7 +1893,7 @@ lowcase: out_str("\\\\"); @.\\\\@> case wildcard: out_str("\\9"); break; @.\\9@> - case typewriter: out_str("\\."); + case typewriter: allcaps: out_str("\\."); @.\\.@> case roman: break; case custom: @@ -1868,7 +1908,7 @@ lowcase: out_str("\\\\"); out_name(cur_name,true); name_done:@; -@q Section 28->300. @> +@q Section 28->299. @> @* Handle program title. Here's a routine that converts a program title from the buffer into an internal number for the |prog_no| field of a meaning. @@ -1891,17 +1931,17 @@ It advances |loc| past the title found. } else err_print(_("! Title should be enclosed in braces or doublequotes")); last=++loc; if (last>limit) err_print(_("! Title name didn't end")); - if (title_code_ptr==&title_code[max_titles]) overflow(_("titles")); + if (title_code_ptr==title_code_end) overflow(_("titles")); *title_code_ptr=id_lookup(first,last,title); for (p=title_code;true;p++) if (*p==*title_code_ptr) break; if (p==title_code_ptr) title_code_ptr++; return p-title_code; } -@q Section 301. @> +@q Section 300. @> @ @<Predec...@>=@+static sixteen_bits title_lookup(void); -@q Section 29->302. @> +@q Section 29->301. @> @ @<Give a default title to the program, if necessary@>= if (title_code_ptr==title_code) { /* no \.{\\def\\title} found in limbo */ char *saveloc=loc,*savelimit=limit; /* save */ @@ -1914,7 +1954,7 @@ if (title_code_ptr==title_code) { /* no \.{\\def\\title} found in limbo */ loc=saveloc; limit=savelimit; /* restore */ } -@q Section 303. @> +@q Section 302. @> @** 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. diff --git a/Build/source/texk/web2c/cwebdir/ctwimac.tex b/Build/source/texk/web2c/cwebdir/ctwimac.tex index 8596b2747de..1eca52852b0 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 4.4 --- June 2021 % 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+CTWILL4.4+LNCS} \let\:=\. % preserve a way to get the dot accent % (all other accents will still work as usual) diff --git a/Build/source/texk/web2c/cwebdir/cweav-bs.ch b/Build/source/texk/web2c/cwebdir/cweav-bs.ch index ee919d7fd2c..c05ce06a331 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-bs.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-bs.ch @@ -20,12 +20,12 @@ This file contributed by Barry Schwartz, trashman@crud.mn.org, 28 Jun 94. The ``banner line'' defined here should be changed whenever \.{CWEAVE} is modified. -@d banner "This is CWEAVE (Version 4.3)" +@d banner "This is CWEAVE (Version 4.4)" @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.4pc/big)" @z @@ -219,7 +219,7 @@ static char huge* cur_byte; /* index into |byte_mem| */ @x Section 264. -switch (cur_name->ilk) {@+char *j; +switch (cur_name->ilk) {@+char *j;@+@t}\6{\4@> @y -switch (cur_name->ilk) {@+char huge* j; +switch (cur_name->ilk) {@+char huge* j;@+@t}\6{\4@> @z diff --git a/Build/source/texk/web2c/cwebdir/cweav-man.ch b/Build/source/texk/web2c/cwebdir/cweav-man.ch index 6cfcc8fe2d2..366cda6f114 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{108} \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..0c95dcf2281 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-pc.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-pc.ch @@ -11,18 +11,18 @@ that allows >64K arrays. (If you need lots more bytes, try the alternate change files that have -bs in their name instead of -pc.) @x section 1 -@d banner "This is CWEAVE (Version 4.3)" +@d banner "This is CWEAVE (Version 4.4)" @y -@d banner "This is CWEAVE (Version 4.3pc)" +@d banner "This is CWEAVE (Version 4.4pc)" @z @x section 17 -@d max_bytes 1000000 /* the number of bytes in identifiers, +@d max_bytes 90000 /* the number of bytes in identifiers, @y @d max_bytes (unsigned)60000 /* the number of bytes in identifiers, @z @x -@d max_refs 65535 /* number of cross-references; must be less than 65536 */ +@d max_refs 20000 /* number of cross-references; must be less than 65536 */ @y @d max_refs 10000 /* number of cross-references; must be less than 65536 */ @z diff --git a/Build/source/texk/web2c/cwebdir/cweav-ql.ch b/Build/source/texk/web2c/cwebdir/cweav-ql.ch index fa809a5bce5..d10fc1d7456 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.4)} @y -\def\title{CWEAVE (QL Version 4.3)} +\def\title{CWEAVE (QL Version 4.4)} @z @x section 1 -@d banner "This is CWEAVE (Version 4.3)" +@d banner "This is CWEAVE (Version 4.4)" @y -@d banner "This is CWEAVE (QL Version 4.3)" +@d banner "This is CWEAVE (QL Version 4.4)" @z @x diff --git a/Build/source/texk/web2c/cwebdir/cweav-vms.ch b/Build/source/texk/web2c/cwebdir/cweav-vms.ch index a4416a7eb15..f443d7e3a71 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-vms.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-vms.ch @@ -13,9 +13,9 @@ modified: (also modified by Don Knuth to keep version numbers uptodate) @x section 1 (01-FEB-1992 ST) -@d banner "This is CWEAVE (Version 4.3)" +@d banner "This is CWEAVE (Version 4.4)" @y -@d banner "This is CWEAVE (VAX/VMS Version 4.3)" +@d banner "This is CWEAVE (VAX/VMS Version 4.4)" @z @x section 4 (01-FEB-1992 ST) diff --git a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch index e71d66e67f3..f870b9cd818 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.4)} @y -\def\title{CWEAVE (Version 4.3 [\TeX~Live])} +\def\title{CWEAVE (Version 4.4 [\TeX~Live])} @z @x - \centerline{(Version 4.3)} + \centerline{(Version 4.4)} @y - \centerline{(Version 4.3 [\TeX~Live])} + \centerline{(Version 4.4 [\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.4)" @y -@d banner "This is CWEAVE, Version 4.3" +@d banner "This is CWEAVE, Version 4.4" /* will be extended by the \TeX~Live |versionstring| */ @z @@ -60,12 +60,32 @@ @z @x +@d max_refs 20000 /* number of cross-references; must be less than 65536 */ +@d max_scraps 2000 /* number of tokens in \CEE/ texts being parsed */ +@y +@d max_refs 65535 /* number of cross-references; must be less than 65536 */ +@d max_scraps 5000 /* number of tokens in \CEE/ texts being parsed */ +@z + +@x @d append_xref(c) if (xref_ptr==xmem_end) overflow("cross-reference"); @y @d append_xref(c) if (xref_ptr==xmem_end) overflow(_("cross-reference")); @z @x +@d max_toks 20000 /* number of symbols in \CEE/ texts being parsed; + must be less than 65536 */ +@d max_texts 4000 /* number of phrases in \CEE/ texts being parsed; + must be less than 10240 */ +@y +@d max_toks 65535 /* number of symbols in \CEE/ texts being parsed; + must be less than 65536 */ +@d max_texts 10239 /* number of phrases in \CEE/ texts being parsed; + must be less than 10240 */ +@z + +@x err_print("! String didn't end"); loc=limit; break; @y err_print(_("! String didn't end")); loc=limit; break; @@ -84,9 +104,9 @@ @z @x - case translit_code: err_print("! Use @@l in limbo only"); continue; + case translit_code: err_print("! Use @@l in limbo only"); continue; @y - case translit_code: err_print(_("! Use @@l in limbo only")); continue; + case translit_code: err_print(_("! Use @@l in limbo only")); continue; @z @x @@ -126,9 +146,9 @@ @z @x - if (loc>=limit) err_print("! Verbatim string didn't end"); +if (loc>=limit) err_print("! Verbatim string didn't end"); @y - if (loc>=limit) err_print(_("! Verbatim string didn't end")); +if (loc>=limit) err_print(_("! Verbatim string didn't end")); @z @x @@ -144,15 +164,15 @@ @z @x - err_print("! Missing left identifier of @@s"); + err_print("! Missing left identifier of @@s"); @y - err_print(_("! Missing left identifier of @@s")); + err_print(_("! Missing left identifier of @@s")); @z @x - err_print("! Missing right identifier of @@s"); + err_print("! Missing right identifier of @@s"); @y - err_print(_("! Missing right identifier of @@s")); + err_print(_("! Missing right identifier of @@s")); @z @x @@ -248,13 +268,13 @@ tex_puts("cwebma"); @z @x -@d inner_tok_flag 5*id_flag /* signifies a token list in `\pb' */ +@d inner_tok_flag (5*id_flag) /* signifies a token list in `\pb' */ @c static void print_text( /* prints a token list for debugging; not used in |main| */ @y -@d inner_tok_flag 5*id_flag /* signifies a token list in `\pb' */ +@d inner_tok_flag (5*id_flag) /* signifies a token list in `\pb' */ @<Predecl...@>= #if 0 @@ -397,9 +417,9 @@ else if (cat1==stmt) { @z @x - if (tok_ptr+6>tok_mem_end) overflow("token"); + if (tok_ptr+6>tok_mem_end) overflow("token"); @y - if (tok_ptr+6>tok_mem_end) overflow(_("token")); + if (tok_ptr+6>tok_mem_end) overflow(_("token")); @z @x @@ -463,9 +483,9 @@ else if (cat1==stmt) { @z @x -reset_input(); if (show_progress) fputs("\nWriting the output file...",stdout); +if (show_progress) fputs("\nWriting the output file...",stdout); @y -reset_input(); if (show_progress) fputs(_("\nWriting the output file..."),stdout); +if (show_progress) fputs(_("\nWriting the output file..."),stdout); @z @x @@ -620,7 +640,7 @@ 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 ``\&{271.~Index}.'' @* Formatting alternatives. \.{CWEAVE} indents declarations after old-style function definitions and diff --git a/Build/source/texk/web2c/cwebdir/cweav-w32.ch b/Build/source/texk/web2c/cwebdir/cweav-w32.ch index 2fec0672e47..013ca70dae3 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-w32.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-w32.ch @@ -2,9 +2,9 @@ This is the change file for CWEB's CWEAVE under Win32 (Contributed by Fabrice Popineau, February 2002) @x section 1 -@d banner "This is CWEAVE (Version 4.3)" +@d banner "This is CWEAVE (Version 4.4)" @y -@d banner "This is CWEAVE (Version 4.3win32)" +@d banner "This is CWEAVE (Version 4.4win32)" @z @x diff --git a/Build/source/texk/web2c/cwebdir/cweave.w b/Build/source/texk/web2c/cwebdir/cweave.w index 30bcedb7037..ffd835e76dc 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 --- May 2021 +% Version 4.4 --- June 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.4)} \def\topofcontents{\null\vfill \centerline{\titlefont The {\ttitlefont CWEAVE} processor} \vskip 15pt - \centerline{(Version 4.3)} + \centerline{(Version 4.4)} \vfill} \def\botofcontents{\vfill \noindent @@ -67,7 +67,7 @@ Crusius, and others who have contributed improvements. The ``banner line'' defined here should be changed whenever \.{CWEAVE} is modified. -@d banner "This is CWEAVE (Version 4.3)" +@d banner "This is CWEAVE (Version 4.4)" @c @<Include files@>@/ @@ -116,8 +116,8 @@ handle \TEX/, so they should be sufficient for most applications of \.{CWEAVE}. @d line_length 80 /* lines of \TEX/ output have at most this many characters; should be less than 256 */ -@d max_refs 65535 /* number of cross-references; must be less than 65536 */ -@d max_scraps 10000 /* number of tokens in \CEE/ texts being parsed */ +@d max_refs 20000 /* number of cross-references; must be less than 65536 */ +@d max_scraps 2000 /* number of tokens in \CEE/ texts being parsed */ @* Data structures exclusive to {\tt CWEAVE}. As explained in \.{common.w}, the field of a |name_info| structure @@ -152,7 +152,7 @@ formatted. @d roman 1 /* normal index entries have |roman| ilk */ @d wildcard 2 /* user-formatted index entries have |wildcard| ilk */ @d typewriter 3 /* `typewriter type' entries have |typewriter| ilk */ -@d abnormal(a) (a->ilk>typewriter) /* tells if a name is special */ +@d abnormal(a) ((a)->ilk>typewriter) /* tells if a name is special */ @d func_template 4 /* identifiers that can be followed by optional template */ @d custom 5 /* identifiers with user-given control sequence */ @d alfop 22 /* alphabetic operators like \&{and} or \&{not\_eq} */ @@ -167,7 +167,7 @@ formatted. @d delete_like 48 /* \&{delete} */ @d raw_ubin 49 /* `\.\&' or `\.*' when looking for \&{const} following */ @d const_like 50 /* \&{const}, \&{volatile} */ -@d raw_int 51 /* \&{int}, \&{char}, \dots; also structure and class names */ +@d raw_int 51 /* \&{int}, \&{char}, \dots; also structure and class names */ @d int_like 52 /* same, when not followed by left parenthesis or \DC\ */ @d case_like 53 /* \&{case}, \&{return}, \&{goto}, \&{break}, \&{continue} */ @d sizeof_like 54 /* \&{sizeof} */ @@ -246,9 +246,9 @@ If one were careful, one could probably make more changes around section @d append_xref(c) if (xref_ptr==xmem_end) overflow("cross-reference"); else (++xref_ptr)->num=c; -@d no_xref (!make_xrefs) -@d is_tiny(p) (length(p)==1) -@d unindexed(a) (a<res_wd_end && a->ilk>=custom) +@d no_xref !make_xrefs +@d is_tiny(p) length(p)==1 +@d unindexed(a) ((a)<res_wd_end && (a)->ilk>=custom) /* tells if uses of a name are to be indexed */ @<Predecl...@>= @@ -335,6 +335,11 @@ that is unoccupied by replacement text is called |tok_ptr|, and the first unused location of |tok_start| is called |text_ptr|. Thus, we usually have |*text_ptr==tok_ptr|. +@d max_toks 20000 /* number of symbols in \CEE/ texts being parsed; + must be less than 65536 */ +@d max_texts 4000 /* number of phrases in \CEE/ texts being parsed; + must be less than 10240 */ + @<Private...@>= static token tok_mem[max_toks]; /* tokens */ static token_pointer tok_mem_end = tok_mem+max_toks-1; /* end of |tok_mem| */ @@ -378,14 +383,9 @@ name_pointer p) p->xref=(void *)xmem; } -static void -update_node( -name_pointer p) -{ - p->xref=(void *)xref_ptr; -} +@ And here's a small helper function to simplify the code. -@ @<Predecl...@>=@+static void update_node(name_pointer p); +@d update_node(p) (p)->xref=(void *)xref_ptr @ We have to get \CEE/'s and \CPLUSPLUS/'s reserved words into the hash table, and the simplest way to do this is @@ -505,7 +505,7 @@ 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,using_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); @@ -626,11 +626,12 @@ skip_limbo(void) { if (loc>limit && get_line()==false) return; *(limit+1)='@@'; while (*loc!='@@') loc++; /* look for `\.{@@}', then skip two chars */ - if (loc++ <=limit) { int c=ccode[(eight_bits)*loc++]; - if (c==new_section) return; - if (c==noop) skip_restricted(); - else if (c==format_code) @<Process simple format in limbo@>@; - } + if (loc++ <=limit) + switch (ccode[(eight_bits)*loc++]) { + case new_section: return; + case noop: skip_restricted(); break; + case format_code: @<Process simple format in limbo@>@; + } } } @@ -775,8 +776,8 @@ the last character was a \.\\. } @ The following code assigns values to the combinations \.{++}, -\.{--}, \.{->}, \.{>=}, \.{<=}, \.{==}, \.{<<}, \.{>>}, \.{!=}, \.{\v\v}, and -\.{\&\&}, and to the \CPLUSPLUS/ +\.{--}, \.{->}, \.{>=}, \.{<=}, \.{==}, \.{<<}, \.{>>}, \.{!=}, %\.{||} +\.{\v\v} and~\.{\&\&}, and to the \CPLUSPLUS/ combinations \.{...}, \.{::}, \.{.*} and \.{->*}. The compound assignment operators (e.g., \.{+=}) are treated as separate tokens. @@ -828,7 +829,7 @@ 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=='\'') +@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++; @@ -935,28 +936,26 @@ convention, but do not allow the string to be longer than |longest_name|. @ After an \.{@@} sign has been scanned, the next character tells us whether there is more work to do. -@<Get control code and possible section name@>= { - c=*loc++; - switch(ccode[(eight_bits)c]) { - case translit_code: err_print("! Use @@l in limbo only"); continue; +@<Get control code and possible section name@>= +switch(ccode[(eight_bits)(c=*loc++)]) { + case translit_code: err_print("! Use @@l in limbo only"); continue; @.Use @@l in limbo...@> - 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 section_name: - @<Scan the section name and make |cur_section| point to it@>@; - case verbatim: @<Scan a verbatim string@>@; - case ord: @<Get a string@>@; - default: return ccode[(eight_bits)c]; - } + case underline: xref_switch=def_flag; continue; + case trace: tracing=c-'0'; continue; + case section_name: + @<Scan the section name and make |cur_section| point to it@>@; + case verbatim: @<Scan a verbatim string@>@; + case ord: @<Get a string@>@; + case xref_roman: case xref_wildcard: case xref_typewriter: case noop: + case TeX_string: skip_restricted(); + default: return ccode[(eight_bits)c]; } @ The occurrence of a section name sets |xref_switch| to zero, because the section name might (for example) follow \&{int}. @<Scan the section name...@>= { - char *k; /* pointer into |section_text| */ + char *k=section_text; /* pointer into |section_text| */ cur_section_char=*(loc-1); @<Put section name into |section_text|@>@; if (k-section_text>3 && strncmp(k-2,"...",3)==0) @@ -975,7 +974,6 @@ character of the name.) @<Set init...@>=section_text[0]=' '; @ @<Put section name...@>= -k=section_text; while (true) { if (loc>limit && get_line()==false) { err_print("! Input ended in section name"); @@ -1043,14 +1041,13 @@ have |*(loc-1)==verbatim|; we set |id_first| to the beginning of the string itself, and |id_loc| to its ending-plus-one location in the buffer. We also set |loc| to the position just after the ending delimiter. -@<Scan a verbatim string@>= { - id_first=loc++; *(limit+1)='@@'; *(limit+2)='>'; - while (*loc!='@@' || *(loc+1)!='>') loc++; - if (loc>=limit) err_print("! Verbatim string didn't end"); +@<Scan a verbatim string@>= +id_first=loc++; *(limit+1)='@@'; *(limit+2)='>'; +while (*loc!='@@' || *(loc+1)!='>') loc++; +if (loc>=limit) err_print("! Verbatim string didn't end"); @.Verbatim string didn't end@> - id_loc=loc; loc+=2; - return verbatim; -} +id_loc=loc; loc+=2; +return verbatim; @** Phase one processing. We now have accumulated enough subroutines to make it possible to carry out @@ -1077,7 +1074,6 @@ phase_one(void) { @<Store cross-reference data for the current section@>@; changed_section[section_count]=change_exists; /* the index changes if anything does */ - phase=2; /* prepare for second phase */ @<Print error messages about unused or undefined section names@>@; } @@ -1128,11 +1124,10 @@ static void C_xref( /* makes cross-references for \CEE/ identifiers */ eight_bits spec_ctrl) { - name_pointer p; /* a referenced name */ while (next_control<format_code || next_control==spec_ctrl) { if (next_control>=identifier && next_control<=xref_typewriter) { - if (next_control>identifier) @<Replace |"@@@@"| by |"@@"| @>@; - p=id_lookup(id_first, id_loc,next_control-identifier); new_xref(p); + if (next_control>identifier) @<Replace |"@@@@"| by |"@@"|@>@; + new_xref(id_lookup(id_first,id_loc,next_control-identifier)); } if (next_control==section_name) { section_xref_switch=cite_flag; @@ -1184,8 +1179,8 @@ while (true) { case noop: case section_name: loc-=2; next_control=get_next(); /* scan to \.{@@>} */ if (next_control>=xref_roman && next_control<=xref_typewriter) { - @<Replace |"@@@@"| by |"@@"| @>@; - new_xref(id_lookup(id_first, id_loc,next_control-identifier)); + @<Replace |"@@@@"| by |"@@"|@>@; + new_xref(id_lookup(id_first,id_loc,next_control-identifier)); } break; } @@ -1261,19 +1256,17 @@ discover should be unindexed. definition is found in limbo. @<Process simple format in limbo@>= -{ - if (get_next()!=identifier) - err_print("! Missing left identifier of @@s"); +if (get_next()!=identifier) + err_print("! Missing left identifier of @@s"); @.Missing left identifier...@> - else { - lhs=id_lookup(id_first,id_loc,normal); - if (get_next()!=identifier) - err_print("! Missing right identifier of @@s"); +else { + lhs=id_lookup(id_first,id_loc,normal); + if (get_next()!=identifier) + err_print("! Missing right identifier of @@s"); @.Missing right identifier...@> - else { - rhs=id_lookup(id_first,id_loc,normal); - lhs->ilk=rhs->ilk; - } + else { + rhs=id_lookup(id_first,id_loc,normal); + lhs->ilk=rhs->ilk; } } @@ -1281,7 +1274,7 @@ definition is found in limbo. |next_control>=begin_C|. @<Store cross-references in the \CEE/...@>= -if (next_control<=section_name) { /* |begin_C| or |section_name| */ +if (next_control<=section_name) { /* |begin_C| or |section_name| */ if (next_control==begin_C) section_xref_switch=0; else { section_xref_switch=def_flag; @@ -1315,8 +1308,7 @@ name_pointer p) /* print anomalies in subtree |p| */ if (p) { section_check(p->llink); cur_xref=(xref_pointer)p->xref; - if (cur_xref->num==file_flag) {an_output=true; cur_xref=cur_xref->xlink;} - else an_output=false; + if ((an_output=(cur_xref->num==file_flag))==true) cur_xref=cur_xref->xlink; if (cur_xref->num <def_flag) { fputs("\n! Never defined: <",stdout); print_section_name(p); putchar('>'); mark_harmless; @@ -1499,7 +1491,7 @@ sixteen_bits n) { char s[6]; sprintf(s,"%d",n); out_str(s); - if(changed_section[n]) out_str ("\\*"); + if (changed_section[n]) out_str("\\*"); @.\\*@> } @@ -1660,7 +1652,7 @@ if (c=='@@') { } } else { if (c=='\\' && *loc!='@@') { - if (phase==2) app_tok(*(loc++))@; else loc++; + if (phase==2) app_tok(*(loc++))@t;@>@; else loc++; } } @@ -1847,15 +1839,7 @@ static char cat_name[256][12]; @ This code allows \.{CWEAVE} to display its parsing steps. -@c -static void -print_cat( /* symbolic printout of a category */ -eight_bits c) -{ - fputs(cat_name[c],stdout); -} - -@ @<Predecl...@>=@+static void print_cat(eight_bits); +@d print_cat(c) fputs(cat_name[(eight_bits)(c)],stdout) @ The token lists for translated \TEX/ output contain some special control symbols as well as ordinary characters. These control symbols are @@ -2001,8 +1985,8 @@ with discretionary breaks in between. \.;&|semi|: \.;&maybe\cr \.:&|colon|: \.:&no\cr \.\# (within line)&|ubinop|: \.{\\\#}&yes\cr -\.\# (at beginning)&|lproc|: |force| |preproc_line| \.{\\\#}&no\cr -end of \.\# line&|rproc|: |force|&no\cr +\.\# (at beginning)&|lproc|: |force| |preproc_line| \.{\\\#}&no\cr +end of \.\# line&|rproc|: |force|&no\cr identifier&|exp|: \.{\\\\\{}identifier with underlines and dollar signs quoted\.\}&maybe\cr \.{alignas}&|alignas_like|: \stars&maybe\cr @@ -2127,10 +2111,10 @@ identifier&|exp|: \.{\\\\\{}identifier with underlines and \.{xor}&|alfop|: \stars&yes\cr \.{xor\_eq}&|alfop|: \stars&yes\cr \.{@@,}&|insert|: \.{\\,}&maybe\cr -\.{@@\v}&|insert|: |opt| \.0&maybe\cr -\.{@@/}&|insert|: |force|&no\cr -\.{@@\#}&|insert|: |big_force|&no\cr -\.{@@+}&|insert|: |big_cancel| \.{\{\}} |break_space| +\.{@@\v}&|insert|: |opt| \.0&maybe\cr +\.{@@/}&|insert|: |force|&no\cr +\.{@@\#}&|insert|: |big_force|&no\cr +\.{@@+}&|insert|: |big_cancel| \.{\{\}} |break_space| \.{\{\}} |big_cancel|&no\cr \.{@@;}&|semi|: &maybe\cr \.{@@[@q]@>}&|begin_arg|: &maybe\cr @@ -2150,7 +2134,7 @@ identifier&|exp|: \.{\\\\\{}identifier with underlines and \smallskip The construction \.{@@t}\thinspace stuff\/\thinspace\.{@@>} contributes -\.{\\hbox\{}\thinspace stuff\/\thinspace\.\} to the following scrap. +\.{\\hbox\{}\thinspace stuff\/\thinspace\.\} to the following scrap. @i prod.w @@ -2191,7 +2175,7 @@ typedef struct { eight_bits cat; eight_bits mathness; union { - text_pointer Trans; + text_pointer Trans;@+@t}\6{@> @<Rest of |trans_plus| union@>@; } trans_plus; } scrap; @@ -2231,10 +2215,10 @@ items for \TEX/ output. translated without line-break controls. @d id_flag 10240 /* signifies an identifier */ -@d res_flag 2*id_flag /* signifies a reserved word */ -@d section_flag 3*id_flag /* signifies a section name */ -@d tok_flag 4*id_flag /* signifies a token list */ -@d inner_tok_flag 5*id_flag /* signifies a token list in `\pb' */ +@d res_flag (2*id_flag) /* signifies a reserved word */ +@d section_flag (3*id_flag) /* signifies a section name */ +@d tok_flag (4*id_flag) /* signifies a token list */ +@d inner_tok_flag (5*id_flag) /* signifies a token list in `\pb' */ @c static void @@ -2347,7 +2331,7 @@ If we combine two scraps and the right boundary of the first has a different mathness from the left boundary of the second, we insert a \.{\$} in between. Similarly, if at printing time some irreducible scrap has a |yes_math| boundary the scrap gets preceded -or followed by a \.{\$}. The left boundary is |maybe_math| if and +or followed by a~\.{\$}. The left boundary is |maybe_math| if and only if the right boundary is. The code below is an exact translation of the production rules into @@ -2377,7 +2361,7 @@ static void app_str( const char *s) { - while (*s) app_tok(*(s++)); + while (*s) app_tok(*s++); } static void @@ -2439,16 +2423,16 @@ code needs to be provided with a proper environment. && pp->cat!=operator_like) /* not a production with left side length 1 */ -@<Match a production at |pp|, or increase |pp| if there is no match@>= { - 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); - else +@<Match a production at |pp|, or increase |pp| if there is no match@>= +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); +else switch (pp->cat) { case exp: @<Cases for |exp|@>@; @+break; case lpar: @<Cases for |lpar|@>@; @+break; @@ -2503,8 +2487,7 @@ code needs to be provided with a proper environment. 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 */ -} +pp++; /* if no match was found, we move to the right */ @ In \CEE/, new specifier names can be defined via |typedef|, and we want to make the parser recognize future occurrences of the identifier thus @@ -2578,14 +2561,12 @@ scrap_pointer p) if ((tok_loc=find_first_ident(p->trans))<=operator_found) return; /* this should not happen */ tok_value=*tok_loc; - for (;p<=scrap_ptr; p==lo_ptr? p=hi_ptr: p++) { - if (p->cat==exp) { + for (;p<=scrap_ptr; p==lo_ptr? p=hi_ptr: p++) + if (p->cat==exp) if (**(p->trans)==tok_value) { p->cat=raw_int; **(p->trans)=tok_value%id_flag+res_flag; } - } - } (name_dir+(sixteen_bits)(tok_value%id_flag))->ilk=raw_int; *tok_loc=tok_value%id_flag+res_flag; } @@ -2693,7 +2674,7 @@ else if (cat1==colcol && cat2==int_like) squash(pp,3,int_like,-2,152); @ @<Cases for |lpar|@>= if ((cat1==exp||cat1==ubinop) && cat2==rpar) squash(pp,3,exp,-2,11); else if (cat1==rpar) { - big_app1(pp); app('\\'); app(','); big_app1(pp+1); + big_app1(pp); app_str("\\,"); big_app1(pp+1); @.\\,@> reduce(pp,2,exp,-2,12); } @@ -2860,7 +2841,7 @@ if (cat1==function || cat1==decl || cat1==stmt) { @ @<Cases for |lbrace|@>= if (cat1==rbrace) { - big_app1(pp); app('\\'); app(','); big_app1(pp+1); + big_app1(pp); app_str("\\,"); big_app1(pp+1); @.\\,@> reduce(pp,2,stmt,-1,54); } @@ -3012,7 +2993,7 @@ app('>'); reduce(pp,1,binop,-2,85); @<Cases for |langle|@>= if (cat1==prerangle) { - big_app1(pp); app('\\'); app(','); big_app1(pp+1); + big_app1(pp); app_str("\\,"); big_app1(pp+1); @.\\,@> reduce(pp,2,cast,-1,86); } @@ -3022,14 +3003,14 @@ 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)) { +else if ((cat1==struct_like) @| + && (cat2==exp || cat2==int_like) @| + && (cat3==comma || cat3==prerangle)) { make_underlined(pp+2); if (reserve_typenames) make_reserved(pp+2); big_app2(pp); big_app(' '); big_app2(pp+2); if (cat3==comma) reduce(pp,4,langle,0,153); else reduce(pp,4,cast,-1,154); } -} @ @<Cases for |template_like|@>= if (cat1==exp && cat2==prelangle) squash(pp+2,1,langle,2,89); @@ -3124,7 +3105,7 @@ else if (cat1==ubinop && (cat2==ubinop || cat2==cast)) { @ @<Cases for |delete_like|@>= if (cat1==lpar && cat2==rpar) { - big_app2(pp); app('\\'); app(','); big_app1(pp+2); + big_app2(pp); app_str("\\,"); big_app1(pp+2); @.\\,@> reduce(pp,3,delete_like,0,121); } @@ -3193,7 +3174,7 @@ because no ending point for the current list has been stored in the |tok_start| array. After saying |freeze_text|, the old current token list becomes legitimate, and its number is the current value of |text_ptr-1| since |text_ptr| has been increased. The new -current token list is empty and ready to be appended to. +current token list is empty and ready to be appended~to. Note that |freeze_text| does not check to see that |text_ptr| hasn't gotten too large, since it is assumed that this test was done beforehand. @@ -3282,7 +3263,7 @@ stored, since zero does not match anything in a production. @<Make sure the entries...@>= if (lo_ptr<pp+3) { while (hi_ptr<=scrap_ptr && lo_ptr!=pp+3) { - (++lo_ptr)->cat=hi_ptr->cat; lo_ptr->mathness=(hi_ptr)->mathness; + (++lo_ptr)->cat=hi_ptr->cat; lo_ptr->mathness=hi_ptr->mathness; lo_ptr->trans=(hi_ptr++)->trans; } for (i=lo_ptr+1;i<=pp+3;i++) i->cat=0; @@ -3302,15 +3283,15 @@ static int tracing=off; /* can be used to show parsing details */ @ @<Print a snapsh...@>= if (tracing==fully) { - scrap_pointer k_l; /* pointer into |scrap_info| */ + scrap_pointer k; /* pointer into |scrap_info|; shadows |short k| */ 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->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('-'); + for (k=scrap_base; k<=lo_ptr; k++) { + if (k==pp) putchar('*'); else putchar(' '); + if (k->mathness %4 == yes_math) putchar('+'); + else if (k->mathness %4 == no_math) putchar('-'); + print_cat(k->cat); + if (k->mathness /4 == yes_math) putchar('+'); + else if (k->mathness /4 == no_math) putchar('-'); } if (hi_ptr<=scrap_ptr) printf("..."); /* indicate that more is coming */ } @@ -3347,17 +3328,16 @@ we concatenate the translations of all remaining scraps, separated by blank spaces, with dollar signs surrounding the translations of scraps where appropriate. -@<Combine the irreducible...@>= { - @<If semi-tracing, show the irreducible scraps@>@; - for (j=scrap_base; j<=lo_ptr; j++) { - if (j!=scrap_base) app(' '); - if (j->mathness % 4 == yes_math) app('$'); - app1(j); - if (j->mathness / 4 == yes_math) app('$'); - if (tok_ptr+6>tok_mem_end) overflow("token"); - } - freeze_text; return text_ptr-1; +@<Combine the irreducible...@>= +@<If semi-tracing, show the irreducible scraps@>@; +for (j=scrap_base; j<=lo_ptr; j++) { + if (j!=scrap_base) app(' '); + if (j->mathness % 4 == yes_math) app('$'); + app1(j); + if (j->mathness / 4 == yes_math) app('$'); + if (tok_ptr+6>tok_mem_end) overflow("token"); } +freeze_text; return text_ptr-1; @ @<If semi-tracing, show the irreducible scraps@>= if (lo_ptr>scrap_base && tracing==partly) { @@ -3470,10 +3450,10 @@ switch (next_control) { case ',': app(',');@+app_scrap(comma,yes_math);@+break; case ';': app(';');@+app_scrap(semi,maybe_math);@+break; case ':': app(':');@+app_scrap(colon,no_math);@+break;@/ - @t\4@> @<Cases involving nonstandard characters@>@; + @t\4@> @<Cases involving nonstandard characters@>@; case thin_space: app_str("\\,");@+app_scrap(insert,maybe_math);@+break; @.\\,@> - case math_break: app(opt);@+app_str("0");@+ + case math_break: app(opt);@+app('0');@+ app_scrap(insert,maybe_math);@+break; case line_break: app(force);@+app_scrap(insert,no_math);@+break; case left_preproc: app(force);@+app(preproc_line);@+app_str("\\#"); @@ -3573,7 +3553,7 @@ while (id_first<id_loc) { } else { switch (*id_first) { - case ' ':case '\\':case '#':case '%':case '$':case '^': + case ' ':case '\\':case '#':case '%':case '$':case '^': case '{': case '}': case '~': case '&': case '_': app('\\'); break; @.\\\ @> @.\\\\@> @@ -3649,7 +3629,7 @@ boolean scrapping) /* are we making this into a scrap? */ } else { app(res_flag+(int)(p-name_dir)); if (scrapping) { - if (p->ilk==alfop) app_scrap(ubinop,yes_math)@; + if (p->ilk==alfop) app_scrap(ubinop,yes_math)@t;@>@; else app_scrap(p->ilk,maybe_math); } } @@ -3717,7 +3697,7 @@ outer_parse(void) /* makes scraps from \CEE/ tokens and comments */ if (make_pb) app_str("\\PB{"); @.\\PB@> app(inner_tok_flag+(int)(q-tok_start)); - if (make_pb) app_tok('}'); + if (make_pb) app_tok('}'); if (next_control=='|') { bal=copy_comment(is_long_comment,bal); next_control=ignore; @@ -3735,7 +3715,7 @@ So far our programs have only built up multi-layered token lists in the desired final form. The job of converting token lists to characters in the \TEX/ output file is not difficult, although it is an implicitly recursive process. Four main considerations had to be kept in mind when -this part of \.{CWEAVE} was designed. (a) There are two modes of output: +this part of \.{CWEAVE} was designed. (a) There are two modes of output: |outer| mode, which translates tokens like |force| into line-breaking control sequences, and |inner| mode, which ignores them except that blank spaces take the place of line breaks. (b) The |cancel| instruction applies @@ -3743,7 +3723,7 @@ to adjacent token or tokens that are output, and this cuts across levels of recursion since `|cancel|' occurs at the beginning or end of a token list on one level. (c) The \TEX/ output file will be semi-readable if line breaks are inserted after the result of tokens like |break_space| and -|force|. (d) The final line break should be suppressed, and there should +|force|. (d) The final line break should be suppressed, and there should be no |force| token output immediately after `\.{\\Y\\B}'. @ The output process uses a stack to keep track of what is going on at @@ -3779,7 +3759,8 @@ typedef struct { } output_state; typedef output_state *stack_pointer; -@ @d cur_end cur_state.end_field /* current ending location in |tok_mem| */ +@ @d stack_size 400 /* number of simultaneous output levels */ +@d cur_end cur_state.end_field /* current ending location in |tok_mem| */ @d cur_tok cur_state.tok_field /* location of next output token in |tok_mem| */ @d cur_mode cur_state.mode_field /* current mode of interpretation */ @d init_stack stack_ptr=stack;cur_mode=outer /* initialize the stack */ @@ -3975,7 +3956,7 @@ if (a==identifier) { out(*p=='_'? 'x': *p=='$'? 'X': *p); break; } - else if (is_tiny(cur_name)) out('|')@; + else if (is_tiny(cur_name)) out('|')@t;@>@; @.\\|@> else { delim='.'; for (p=cur_name->byte_start;p<(cur_name+1)->byte_start;p++) @@ -4014,7 +3995,7 @@ if (a<break_space || a==preproc_line) { @.\\8@> if (a==opt) { b=get_output(); /* |opt| is followed by a digit */ - if (b!='0' || force_lines==false) out(b)@; + if (b!='0' || force_lines==false) out(b)@t;@>@; else out_str("{-1}"); /* |force_lines| encourages more \.{@@\v} breaks */ } } else if (a==opt) b=get_output(); /* ignore digit following |opt| */ @@ -4073,31 +4054,29 @@ routines, since the name may contain \CEE/ code embedded in input buffer and the translation process uses the end of the active |tok_mem| area. -@<Output a section name@>= { - out_str("\\X"); +@<Output a section name@>= +out_str("\\X"); @.\\X@> - cur_xref=(xref_pointer)cur_name->xref; - if (cur_xref->num==file_flag) {an_output=true; cur_xref=cur_xref->xlink;} - else an_output=false; - if (cur_xref->num>=def_flag) { - out_section(cur_xref->num-def_flag); - if (phase==3) { - cur_xref=cur_xref->xlink; - while (cur_xref->num>=def_flag) { - out_str(", "); - out_section(cur_xref->num-def_flag); - cur_xref=cur_xref->xlink; - } +cur_xref=(xref_pointer)cur_name->xref; +if ((an_output=(cur_xref->num==file_flag))==true) cur_xref=cur_xref->xlink; +if (cur_xref->num>=def_flag) { + out_section(cur_xref->num-def_flag); + if (phase==3) { + cur_xref=cur_xref->xlink; + while (cur_xref->num>=def_flag) { + out_str(", "); + out_section(cur_xref->num-def_flag); + cur_xref=cur_xref->xlink; } } - else out('0'); /* output the section number, or zero if it was undefined */ - out(':'); - if (an_output) out_str("\\.{"@q}@>); -@.\\.@> - @<Output the text of the section name@>@; - if (an_output) out_str(@q{@>" }"); - out_str("\\X"); } +else out('0'); /* output the section number, or zero if it was undefined */ +out(':'); +if (an_output) out_str("\\.{"@q}@>); +@.\\.@> +@<Output the text of the section name@>@; +if (an_output) out_str(@q{@>" }"); +out_str("\\X"); @ @<Output the text...@>= sprint_section_name(scratch,cur_name); @@ -4126,7 +4105,7 @@ while (k<k_limit) { default: out(b); } else - if (b!='|') out(b)@; + if (b!='|') out(b)@t;@>@; else { @<Copy the \CEE/ text into the |buffer| array@>@; save_loc=loc; save_limit=limit; loc=limit+2; limit=j+1; @@ -4186,10 +4165,12 @@ actually output the \TEX/ material instead of merely looking at the @c static void phase_two(void) { -reset_input(); if (show_progress) fputs("\nWriting the output file...",stdout); +phase=2; reset_input(); +if (show_progress) fputs("\nWriting the output file...",stdout); @.Writing the output file...@> section_count=0; format_visible=true; copy_limbo(); -finish_line(); flush_buffer(out_buf,false,false); /* insert a blank line, it looks nice */ +finish_line(); flush_buffer(out_buf,false,false); + /* insert a blank line, it looks nice */ while (!input_has_ended) @<Translate the current section@>@; } @@ -4233,7 +4214,7 @@ static boolean group_found=false; /* has a starred section occurred? */ output with the \TEX/ control sequence `\.{\\M}', followed by the section number. Similarly, `\.{@@*}' sections lead to the control sequence `\.{\\N}'. In this case there's an additional parameter, representing one plus the -specified depth, immediately after the \.{\\N}. +specified depth, immediately after the~\.{\\N}. If the section has changed, we put \.{\\*} just after the section number. @<Output the code for the beginning...@>= @@ -4262,7 +4243,7 @@ out('{'); out_section(section_count); out('}'); @ 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 { +@<Translate the \T...@>= do switch (next_control=copy_TeX()) { case '|': init_stack; output_C(); break; case '@@': out('@@'); break; @@ -4279,7 +4260,7 @@ index entries are not copied and \CEE/ text within \pb\ is translated. err_print("! You can't do that in TeX text"); break; @.You can't do that...@> } -} while (next_control<format_code); +while (next_control<format_code); @ When we get to the following code we have |next_control>=format_code|, and the token memory is in its initial empty state. @@ -4411,7 +4392,7 @@ if (next_control<=section_name) { @<Check that '=' or '==' follows this section name, and emit the scraps to start the section definition@>@; } - while (next_control<=section_name) { + while (next_control<=section_name) { outer_parse(); @<Emit the scrap for a section name if present@>@; } @@ -4463,8 +4444,7 @@ after the section ends. @<Show cross...@>= if (this_section>name_dir) { cur_xref=(xref_pointer)this_section->xref; - if (cur_xref->num==file_flag){an_output=true;cur_xref=cur_xref->xlink;} - else an_output=false; + if ((an_output=(cur_xref->num==file_flag))==true) cur_xref=cur_xref->xlink; if (cur_xref->num>def_flag) cur_xref=cur_xref->xlink; /* bypass current section number */ footnote(def_flag); footnote(cite_flag); footnote(0); @@ -4586,19 +4566,18 @@ the index section itself. @<Private...@>= static sixteen_bits k_section; /* runs through the sections */ -@ @<Tell about changed sections@>= { - /* remember that the index is already marked as changed */ - k_section=0; - while (!changed_section[++k_section]); - out_str("\\ch "); +@ @<Tell about changed sections@>= +/* remember that the index is already marked as changed */ +k_section=0; +while (!changed_section[++k_section]); +out_str("\\ch "); @.\\ch@> - out_section(k_section); - while (k_section<section_count) { - while (!changed_section[++k_section]); - out_str(", "); out_section(k_section); - } - out('.'); +out_section(k_section); +while (k_section<section_count) { + while (!changed_section[++k_section]); + out_str(", "); out_section(k_section); } +out('.'); @ A left-to-right radix sorting method is used, since this makes it easy to adjust the collating sequence and since the running time will be at worst @@ -4781,7 +4760,7 @@ while (sort_ptr>scrap_info) { } @ @<Output the name...@>= -switch (cur_name->ilk) {@+char *j; +switch (cur_name->ilk) {@+char *j;@+@t}\6{\4@> case normal: case func_template: if (is_tiny(cur_name)) out_str("\\|"); else { diff --git a/Build/source/texk/web2c/cwebdir/cwebmac.tex b/Build/source/texk/web2c/cwebdir/cwebmac.tex index a4686adf427..4673573cf76 100644 --- a/Build/source/texk/web2c/cwebdir/cwebmac.tex +++ b/Build/source/texk/web2c/cwebdir/cwebmac.tex @@ -1,8 +1,8 @@ % standard macros for CWEB listings (in addition to plain.tex) -% Version 4.3 --- May 2021 +% Version 4.4 --- June 2021 \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros -\xdef\fmtversion{\fmtversion+CWEB4.3} -\chardef\cwebversion=4 \chardef\cwebrevision=1 +\xdef\fmtversion{\fmtversion+CWEB4.4} +\chardef\cwebversion=4 \chardef\cwebrevision=4 \newif\ifpdf \ifx\pdf+\pdftrue\fi % Uncomment the following line if you want PDF goodies to be the default @@ -350,7 +350,7 @@ % \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) + \def\%{\cdot 2^{\aftergroup}}% power of two (via dirty trick) \let\~=\oct \let\^=\hex \let\\=\bin {#1}$}} \def\U{\note{This code is used in section}} % xref for use of a section \def\Us{\note{This code is used in sections}} % xref for uses of a section diff --git a/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch b/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch index ebc532cb207..6481c79debf 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.4)} @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.4 [\TeX~Live])} @z @x -\vskip 18pt\centerline{(Version 4.3 --- May 2021)} +\vskip 18pt\centerline{(Version 4.4 --- June 2021)} @y -\vskip 18pt\centerline{(Version 4.3 --- May 2021)% -\footnote*{This document describes the extended \.{CWEB} (Version 4.3 [\TeX~Live]).}} +\vskip 18pt\centerline{(Version 4.4 --- June 2021)% +\footnote*{This document describes the extended \.{CWEB} (Version 4.4 [\TeX~Live]).}} @z @x @@ -273,9 +273,9 @@ generated sections 27--31 of the file @z @x -\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CTANGLE}} +\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CTANGLE}} @y -\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CTANGLE}} +\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CTANGLE}} \subsection Translation by CTANGLE. @z @@ -314,9 +314,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.4)\}{ }\\vfill\}}\cr}$$ @y - \.{ { }\\vskip 15pt \\centerline\{(Version 4.3)\}{ }\\vfill\}}\cr}$$ + \.{ { }\\vskip 15pt \\centerline\{(Version 4.4)\}{ }\\vfill\}}\cr}$$ @z @x diff --git a/Build/source/texk/web2c/cwebdir/cwebman.tex b/Build/source/texk/web2c/cwebdir/cwebman.tex index 4d4206ee64d..e7706db1648 100644 --- a/Build/source/texk/web2c/cwebdir/cwebman.tex +++ b/Build/source/texk/web2c/cwebdir/cwebman.tex @@ -35,7 +35,7 @@ \def\lheader{\mainfont\the\pageno\hfill\sc\runninghead\hfill} \def\rheader{\hfill\sc\runninghead\hfill\mainfont\the\pageno} -\def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 4.3)} +\def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 4.4)} % This verbatim mode assumes that ! marks are !! in the text being copied. \def\verbatim{\begingroup @@ -49,7 +49,7 @@ \null\vfill \centerline{\titlefont The {\ttitlefont CWEB} System of Structured Documentation} -\vskip 18pt\centerline{(Version 4.3 --- May 2021)} +\vskip 18pt\centerline{(Version 4.4 --- June 2021)} \vskip 24pt \centerline{\authorfont Donald E. Knuth and Silvio Levy} \vfill @@ -139,7 +139,7 @@ for \CEE/ if you so desire. The philosophy behind \.{CWEB} is that programmers who want to provide the best possible documentation for their programs need two things -simultaneously: a language like \TEX/ for formatting, and a language like +simultaneously: a language like \TEX/ for formatting, and a language like \CEE/ for programming. Neither type of language can provide the best documentation by itself. But when both are appropriately combined, we obtain a system that is much more useful than either language separately. @@ -432,7 +432,7 @@ examples: $$ \displaylines{ \hbox{\.{if} \.{(x==0)} \.{@<Empty} \.{the} \.{|buffer|} \.{array@>}} \cr -\hbox{\.{...} \.{using} \.{the} \.{algorithm} +\hbox{\.{...} \.{using} \.{the} \.{algorithm} \.{in} \.{|@<Empty} \.{the} \.{|buffer|} \.{array@>|.}} } $$ The first of these excerpts @@ -480,7 +480,7 @@ 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 for hexadecimal digits makes the meaning of such constants clearer in -a document. For consistency, then, you should type `\.{|040|}' or +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 @@ -845,7 +845,8 @@ with a semicolon. Consider constructions like $$\lpile{\.{if (condition) macro @;}\cr \.{else break;}\cr}$$ where \\{macro} is defined to be a compound statement (enclosed in braces). -This is a well-known infelicity of \CEE/ syntax. +This is a well-known infelicity of \CEE/ syntax. You can add a visible +semicolon with \.{@t;@>} (before \.{@;}). \@{[} [MC] See \.{@]}. @@ -1262,15 +1263,13 @@ do { } while (limit==buffer); @ @<Move |buffer| and |limit| to |change_buffer| and |change_limit|@>= -{ - change_limit=change_buffer+(ptrdiff_t)(limit-buffer); - strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); -} +change_limit=change_buffer+(ptrdiff_t)(limit-buffer); +strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); !endgroup \endgroup \vfill\eject -\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CTANGLE}} +\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CTANGLE}} Here's the portion of the \CEE/ code generated by \.{CTANGLE} that corresponds to the source on the preceding page. Notice that sections~29, 30 and~31 @@ -1324,10 +1323,8 @@ return; /*31:*/ #line 270 "common.w" -{ change_limit= change_buffer+(ptrdiff_t)(limit-buffer); strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); -} /*:31*/ #line 234 "common.w" @@ -1496,12 +1493,10 @@ ${}\{{}$\1\6 \M{31}\B\X31:Move \PB{\\{buffer}} and \PB{\\{limit}} to \PB{\\{change\_buffer}} and \PB{\\{change\_limit}}\X${}\E{}$\6 -${}\{{}$\1\6 -${}\\{change\_limit}\K\\{change\_buffer}+(\&{ptrdiff\_t})(\\{limit}-% +$\\{change\_limit}\K\\{change\_buffer}+(\&{ptrdiff\_t})(\\{limit}-% \\{buffer});{}$\6 ${}\\{strncpy}(\\{change\_buffer},\39\\{buffer},\39(\&{size\_t})(\\{limit}-% -\\{buffer}+\T{1}));{}$\6 -\4${}\}{}$\2\par +\\{buffer}+\T{1})){}$;\par \Us27\ET32.\fi \vfil\eject\titletrue \rightskip=0pt % get out of C mode (cf. \B) @@ -1597,7 +1592,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.4)\}{ }\\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/po/cweb-tl.pot b/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot index 1ded3a5b408..965001fc802 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-06-06 11:08+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" @@ -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.4" msgstr "" #: ctwill-texlive.ch:39 -msgid "This is CTWILL, Version 4.3" +msgid "This is CTWILL, Version 4.4" msgstr "" #: cweav-texlive.ch:39 -msgid "This is CWEAVE, Version 4.3" +msgid "This is CWEAVE, Version 4.4" 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 ff4604f48f1..c9cb7cc42c1 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.3])" +msgid "This is CTANGLE (Version 4.4 [CWEBbin 2021.4])" msgstr "" #: cweav-twill.ch:61 -msgid "This is CTWILL (Version 4.3 [CWEBbin 2021.3])" +msgid "This is CTWILL (Version 4.4 [CWEBbin 2021.4])" msgstr "" #: cweav-i18n.ch:17 cweav-twill.ch:42 -msgid "This is CWEAVE (Version 4.3 [CWEBbin 2021.3])" +msgid "This is CWEAVE (Version 4.4 [CWEBbin 2021.4])" 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..34ea5e6042d 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-06-06 11:08+0200\n" +"PO-Revision-Date: 2021-06-06 11:09+0200\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.4" +msgstr "Dies ist CTANGLE, Version 4.4" #: ctwill-texlive.ch:39 -msgid "This is CTWILL, Version 4.3" -msgstr "Dies ist CTWILL, Version 4.3" +msgid "This is CTWILL, Version 4.4" +msgstr "Dies ist CTWILL, Version 4.4" #: cweav-texlive.ch:39 -msgid "This is CWEAVE, Version 4.3" -msgstr "Dies ist CWEAVE, Version 4.3" +msgid "This is CWEAVE, Version 4.4" +msgstr "Dies ist CWEAVE, Version 4.4" #: 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 263d64e02e6..75b90c1efcc 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.3])" -msgstr "Dies ist CTANGLE (Version 4.3 [CWEBbin 2021.3])" +msgid "This is CTANGLE (Version 4.4 [CWEBbin 2021.4])" +msgstr "Dies ist CTANGLE (Version 4.4 [CWEBbin 2021.4])" #: cweav-twill.ch:61 -msgid "This is CTWILL (Version 4.3 [CWEBbin 2021.3])" -msgstr "Dies ist CTWILL (Version 4.3 [CWEBbin 2021.3])" +msgid "This is CTWILL (Version 4.4 [CWEBbin 2021.4])" +msgstr "Dies ist CTWILL (Version 4.4 [CWEBbin 2021.4])" #: cweav-i18n.ch:17 cweav-twill.ch:42 -msgid "This is CWEAVE (Version 4.3 [CWEBbin 2021.3])" -msgstr "Dies ist CWEAVE (Version 4.3 [CWEBbin 2021.3])" +msgid "This is CWEAVE (Version 4.4 [CWEBbin 2021.4])" +msgstr "Dies ist CWEAVE (Version 4.4 [CWEBbin 2021.4])" #: cweav-i18n.ch:301 cweav-i18n.ch:309 msgid "buffer" diff --git a/Build/source/texk/web2c/cwebdir/po/it/cweb.po b/Build/source/texk/web2c/cwebdir/po/it/cweb.po index 5e2811e526d..f12275bde81 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-06-06 11:08+0200\n" +"PO-Revision-Date: 2021-06-06 11:10+0200\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.3])" -msgstr "Questo è CTANGLE (Versione 4.3 [CWEBbin 2021])" +msgid "This is CTANGLE (Version 4.4 [CWEBbin 2021.4])" +msgstr "Questo è CTANGLE (Versione 4.4 [CWEBbin 2021])" #: cweav-i18n.ch:17 -msgid "This is CWEAVE (Version 4.3 [CWEBbin 2021.3])" -msgstr "Questo è CWEAVE (Versione 4.3 [CWEBbin 2021])" +msgid "This is CWEAVE (Version 4.4 [CWEBbin 2021.4])" +msgstr "Questo è CWEAVE (Versione 4.4 [CWEBbin 2021])" #: cweav-twill.ch:68 -msgid "This is CTWILL (Version 4.3 [CWEBbin 2021.3])" -msgstr "Questo è CTWILL (Versione 4.3 [CWEBbin 2021])" +msgid "This is CTWILL (Version 4.4 [CWEBbin 2021.4])" +msgstr "Questo è CTWILL (Versione 4.4 [CWEBbin 2021])" #: cweav-i18n.ch:301 cweav-i18n.ch:309 msgid "buffer" diff --git a/Build/source/texk/web2c/cwebdir/prod-twill.w b/Build/source/texk/web2c/cwebdir/prod-twill.w index 91aeb63592c..fba592df5b7 100644 --- a/Build/source/texk/web2c/cwebdir/prod-twill.w +++ b/Build/source/texk/web2c/cwebdir/prod-twill.w @@ -68,8 +68,8 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \+& |exp| |semi| & |stmt| & |x=0;|\cr \+& |exp| |colon| & |tag| \hfill $E^*C$ & |found:|\cr \+& |exp| |rbrace| & |stmt| |rbrace| & end of \&{enum} list\cr -\+& |exp| \alt {|lpar| |rpar|} |cast| \alt|const_like| |case_like| & - |exp| \alt {|lpar| |rpar|} |cast| \hfill +\+& |exp| \alt {|lpar| |rpar|} |cast| \alt|const_like| |case_like| & + |exp| \alt {|lpar| |rpar|} |cast| \hfill \alt $R=R\.\ C$ $C_1=C_1\.\ C_2$ & \malt {|f() const|} {|f(int) throw|} \cr \+& |exp| \alt |exp| |cast| & |exp| & |time()|\cr @@ -161,7 +161,7 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \+& |else_like| |lbrace| & |else_head| |lbrace| & \&{else} $\{$\cr \+& |else_like| |stmt| & |stmt| \hfill $|force|\,E\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|$ & $\!\!$|else x=0;|\cr -\+& |else_head| \alt|stmt| |exp| & |stmt| \hfill +\+& |else_head| \alt|stmt| |exp| & |stmt| \hfill $|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 diff --git a/Build/source/texk/web2c/cwebdir/prod.w b/Build/source/texk/web2c/cwebdir/prod.w index f7994a1e25a..c4c75e0f4ab 100644 --- a/Build/source/texk/web2c/cwebdir/prod.w +++ b/Build/source/texk/web2c/cwebdir/prod.w @@ -68,8 +68,8 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \+& |exp| |semi| & |stmt| & |x=0;|\cr \+& |exp| |colon| & |tag| \hfill $E^*C$ & |found:|\cr \+& |exp| |rbrace| & |stmt| |rbrace| & end of \&{enum} list\cr -\+& |exp| \alt {|lpar| |rpar|} |cast| \alt|const_like| |case_like| & - |exp| \alt {|lpar| |rpar|} |cast| \hfill +\+& |exp| \alt {|lpar| |rpar|} |cast| \alt|const_like| |case_like| & + |exp| \alt {|lpar| |rpar|} |cast| \hfill \alt $R=R\.\ C$ $C_1=C_1\.\ C_2$ & \malt {|f() const|} {|f(int) throw|} \cr \+& |exp| \alt |exp| |cast| & |exp| & |time()|\cr @@ -161,7 +161,7 @@ We use \\{in}, \\{out}, \\{back}, \\{bsp}, and \\{din} as shorthands for \+& |else_like| |lbrace| & |else_head| |lbrace| & \&{else} $\{$\cr \+& |else_like| |stmt| & |stmt| \hfill $|force|\,E\,\\{in}\,\\{bsp}\,S\,\\{out}\,|force|$ & $\!\!$|else x=0;|\cr -\+& |else_head| \alt|stmt| |exp| & |stmt| \hfill +\+& |else_head| \alt|stmt| |exp| & |stmt| \hfill $|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 diff --git a/Build/source/texk/web2c/man/ChangeLog b/Build/source/texk/web2c/man/ChangeLog index 972b6227722..06ce47d1d29 100644 --- a/Build/source/texk/web2c/man/ChangeLog +++ b/Build/source/texk/web2c/man/ChangeLog @@ -1,3 +1,8 @@ +2021-06-06 Andreas Scherer <https://ascherer.github.io> + + * ctwill.man, + * cweb.man: CWEB 4.4 release. + 2021-04-13 Andreas Scherer <https://ascherer.github.io> * ctwill.man, diff --git a/Build/source/texk/web2c/man/ctwill.man b/Build/source/texk/web2c/man/ctwill.man index 0601bfd42ab..1170b07a1f6 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.14 .\" -.TH "CTWILL" "1" "April 24, 2021" "Web2c @VERSION@" "General Commands Manual" +.TH "CTWILL" "1" "June 6, 2021" "Web2c @VERSION@" "General Commands Manual" .hy .SH NAME .PP @@ -111,7 +111,7 @@ 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.4). .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. diff --git a/Build/source/texk/web2c/man/cweb.man b/Build/source/texk/web2c/man/cweb.man index b5e1c28cb47..23fb8c824e7 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.14 .\" -.TH "CWEB" "1" "April 24, 2021" "Web2c @VERSION@" "General Commands Manual" +.TH "CWEB" "1" "June 6, 2021" "Web2c @VERSION@" "General Commands Manual" .hy .SH NAME .PP |