diff options
Diffstat (limited to 'Build/source/texk')
-rw-r--r-- | Build/source/texk/web2c/ctangleboot.cin | 447 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctang-bs.ch | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctang-w2c.ch | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctangle.c | 241 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctangle.w | 42 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/cweave.w | 14 |
7 files changed, 373 insertions, 382 deletions
diff --git a/Build/source/texk/web2c/ctangleboot.cin b/Build/source/texk/web2c/ctangleboot.cin index 500d7b141b7..340a9c48f65 100644 --- a/Build/source/texk/web2c/ctangleboot.cin +++ b/Build/source/texk/web2c/ctangleboot.cin @@ -121,11 +121,13 @@ #define output_defs_flag (2*024000-1) \ #define stack_size 50 -#define cur_end cur_state.end_field +#define cur_state stack[stack_size+1] \ + #define cur_byte cur_state.byte_field #define cur_name cur_state.name_field #define cur_repl cur_state.repl_field -#define cur_section cur_state.section_field \ +#define cur_section cur_state.section_field +#define cur_end (cur_repl+1) ->tok_start \ #define section_number 0201 #define identifier 0202 \ @@ -140,6 +142,8 @@ #define C_printf(c,a) fprintf(C_file,c,a) #define C_putc(c) putc((int) (c) ,C_file) \ +#define macro_end (cur_text+1) ->tok_start \ + #define translit_length 10 \ #define transliterate_utf_eight flags['u'] \ @@ -277,7 +281,7 @@ extern FILE*active_file; extern FILE*check_file; /*:15*//*116:*/ -#line 555 "cwebdir/ctang-w2c.ch" +#line 553 "cwebdir/ctang-w2c.ch" extern char cb_banner[]; @@ -295,10 +299,9 @@ typedef text*text_pointer; #line 66 "cwebdir/ctang-w2c.ch" /*:19*//*31:*/ -#line 274 "cwebdir/ctangle.w" +#line 271 "cwebdir/ctangle.w" typedef struct{ -eight_bits*end_field; eight_bits*byte_field; name_pointer name_field; text_pointer repl_field; @@ -325,27 +328,25 @@ static eight_bits*tok_ptr; static text_pointer last_unnamed; /*:26*//*32:*/ -#line 291 "cwebdir/ctangle.w" +#line 289 "cwebdir/ctangle.w" -static output_state cur_state; - -static output_state stack[stack_size+1]; +static output_state stack[stack_size+2]; static stack_pointer stack_end= stack+stack_size; static stack_pointer stack_ptr; /*:32*//*37:*/ -#line 367 "cwebdir/ctangle.w" +#line 361 "cwebdir/ctangle.w" static int cur_val; /*:37*//*42:*/ -#line 459 "cwebdir/ctangle.w" +#line 453 "cwebdir/ctangle.w" static eight_bits out_state; static boolean protect; /*:42*//*45:*/ -#line 490 "cwebdir/ctangle.w" +#line 484 "cwebdir/ctangle.w" static name_pointer output_files[max_files]; static name_pointer*cur_out_file,*end_output_files,*an_output_file; @@ -353,33 +354,33 @@ static char cur_section_name_char; static char output_file_name[longest_name+1]; /*:45*//*52:*/ -#line 590 "cwebdir/ctangle.w" +#line 583 "cwebdir/ctangle.w" static boolean output_defs_seen= false; /*:52*//*57:*/ -#line 703 "cwebdir/ctangle.w" +#line 697 "cwebdir/ctangle.w" static char translit[0200][translit_length]; /*:57*//*62:*/ -#line 779 "cwebdir/ctangle.w" +#line 773 "cwebdir/ctangle.w" static eight_bits ccode[256]; /*:62*//*66:*/ -#line 839 "cwebdir/ctangle.w" +#line 833 "cwebdir/ctangle.w" static boolean comment_continues= false; /*:66*//*68:*/ -#line 876 "cwebdir/ctangle.w" +#line 870 "cwebdir/ctangle.w" static name_pointer cur_section_name; static boolean no_where; /*:68*//*82:*/ -#line 1193 "cwebdir/ctangle.w" +#line 1187 "cwebdir/ctangle.w" static text_pointer cur_text; static eight_bits next_control; @@ -427,53 +428,53 @@ extern void cb_show_banner(void); static void store_two_bytes(sixteen_bits); /*:30*//*35:*/ -#line 330 "cwebdir/ctangle.w" +#line 325 "cwebdir/ctangle.w" static void push_level(name_pointer); static void pop_level(boolean); /*:35*//*39:*/ -#line 404 "cwebdir/ctangle.w" +#line 398 "cwebdir/ctangle.w" static void get_output(void); /*:39*//*44:*/ -#line 480 "cwebdir/ctangle.w" +#line 474 "cwebdir/ctangle.w" static void flush_buffer(void); /*:44*//*49:*/ -#line 557 "cwebdir/ctangle.w" +#line 551 "cwebdir/ctangle.w" static void phase_two(void); /*:49*//*53:*/ -#line 593 "cwebdir/ctangle.w" +#line 586 "cwebdir/ctangle.w" static void output_defs(void); static void out_char(eight_bits); /*:53*//*65:*/ -#line 819 "cwebdir/ctangle.w" +#line 813 "cwebdir/ctangle.w" static eight_bits skip_ahead(void); static boolean skip_comment(boolean); /*:65*//*70:*/ -#line 926 "cwebdir/ctangle.w" +#line 920 "cwebdir/ctangle.w" static eight_bits get_next(void); /*:70*//*84:*/ -#line 1219 "cwebdir/ctangle.w" +#line 1213 "cwebdir/ctangle.w" static void scan_repl(eight_bits); /*:84*//*91:*/ -#line 1411 "cwebdir/ctangle.w" +#line 1405 "cwebdir/ctangle.w" static void scan_section(void); /*:91*//*99:*/ -#line 1488 "cwebdir/ctangle.w" +#line 1482 "cwebdir/ctangle.w" static void phase_one(void); /*:99*//*101:*/ -#line 1521 "cwebdir/ctangle.w" +#line 1515 "cwebdir/ctangle.w" static void skip_limbo(void); /*:101*/ @@ -506,21 +507,21 @@ init_node(name_dir); last_unnamed= text_info;text_info->text_link= macro; /*:27*//*46:*/ -#line 500 "cwebdir/ctangle.w" +#line 494 "cwebdir/ctangle.w" cur_out_file= end_output_files= output_files+max_files; /*:46*//*58:*/ -#line 706 "cwebdir/ctangle.w" +#line 700 "cwebdir/ctangle.w" { int i; for(i= 0;i<0200;i++)sprintf(translit[i],"X%02X",(unsigned int)(0200+i)); } -#line 180 "cwebdir/ctang-w2c.ch" +#line 178 "cwebdir/ctang-w2c.ch" /*:58*//*63:*/ -#line 782 "cwebdir/ctangle.w" +#line 776 "cwebdir/ctangle.w" { int c; for(c= 0;c<256;c++)ccode[c]= ignore; @@ -540,11 +541,11 @@ ccode['<']= ccode['(']= section_name; ccode['\'']= ord; /*:63*//*78:*/ -#line 1114 "cwebdir/ctangle.w" +#line 1108 "cwebdir/ctangle.w" section_text[0]= ' '; /*:78*//*117:*/ -#line 558 "cwebdir/ctang-w2c.ch" +#line 556 "cwebdir/ctang-w2c.ch" strncpy(cb_banner,banner,max_banner-1); @@ -599,7 +600,7 @@ if(tok_ptr+2> tok_mem_end)overflow(_("token")); } /*:29*//*34:*/ -#line 315 "cwebdir/ctangle.w" +#line 311 "cwebdir/ctangle.w" static void push_level( @@ -607,18 +608,17 @@ name_pointer p) { #line 79 "cwebdir/ctang-w2c.ch" if(stack_ptr==stack_end)overflow(_("stack")); -#line 321 "cwebdir/ctangle.w" +#line 317 "cwebdir/ctangle.w" *stack_ptr= cur_state; stack_ptr++; if(p!=NULL){ cur_name= p;cur_repl= (text_pointer)p->equiv; -cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start; -cur_section= 0; +cur_byte= cur_repl->tok_start;cur_section= 0; } } /*:34*//*36:*/ -#line 338 "cwebdir/ctangle.w" +#line 333 "cwebdir/ctangle.w" static void pop_level( @@ -626,15 +626,14 @@ boolean flag) { if(flag&&cur_repl->text_link<section_flag){ cur_repl= cur_repl->text_link+text_info; -cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start; -return; +cur_byte= cur_repl->tok_start;return; } stack_ptr--; if(stack_ptr> stack)cur_state= *stack_ptr; } /*:36*//*38:*/ -#line 374 "cwebdir/ctangle.w" +#line 368 "cwebdir/ctangle.w" static void get_output(void) @@ -657,7 +656,7 @@ switch(a/024000){ case 0:cur_val= (int)a;out_char(identifier);break; case 1:if(a==output_defs_flag)output_defs(); else/*40:*/ -#line 409 "cwebdir/ctangle.w" +#line 403 "cwebdir/ctangle.w" { a-= 024000; @@ -665,7 +664,7 @@ if((a+name_dir)->equiv!=(void*)text_info)push_level(a+name_dir); else if(a!=0){ #line 85 "cwebdir/ctang-w2c.ch" fputs(_("\n! Not present: <"),stdout); -#line 415 "cwebdir/ctangle.w" +#line 409 "cwebdir/ctangle.w" print_section_name(a+name_dir);err_print(">"); } @@ -673,7 +672,7 @@ goto restart; } /*:40*/ -#line 395 "cwebdir/ctangle.w" +#line 389 "cwebdir/ctangle.w" break; default:cur_val= (int)a-050000; @@ -684,7 +683,7 @@ out_char(section_number); } /*:38*//*43:*/ -#line 467 "cwebdir/ctangle.w" +#line 461 "cwebdir/ctangle.w" static void flush_buffer(void) @@ -699,7 +698,7 @@ cur_line++; } /*:43*//*48:*/ -#line 519 "cwebdir/ctangle.w" +#line 513 "cwebdir/ctangle.w" static void phase_two(void){ @@ -707,27 +706,27 @@ phase= 2; web_file_open= false; cur_line= 1; /*33:*/ -#line 304 "cwebdir/ctangle.w" +#line 300 "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; +cur_byte= cur_repl->tok_start;cur_section= 0; /*:33*/ -#line 525 "cwebdir/ctangle.w" +#line 519 "cwebdir/ctangle.w" /*51:*/ -#line 586 "cwebdir/ctangle.w" +#line 579 "cwebdir/ctangle.w" if(!output_defs_seen) output_defs(); /*:51*/ -#line 526 "cwebdir/ctangle.w" +#line 520 "cwebdir/ctangle.w" if(text_info->text_link==macro&&cur_out_file==end_output_files){ #line 97 "cwebdir/ctang-w2c.ch" fputs(_("\n! No program text was specified."),stdout);mark_harmless; -#line 529 "cwebdir/ctangle.w" +#line 523 "cwebdir/ctangle.w" } else{ @@ -735,7 +734,7 @@ if(cur_out_file==end_output_files){ if(show_progress){ #line 103 "cwebdir/ctang-w2c.ch" printf(_("\nWriting the output file (%s):"),C_file_name); -#line 535 "cwebdir/ctangle.w" +#line 529 "cwebdir/ctangle.w" update_terminal; } } @@ -743,7 +742,7 @@ else{ if(show_progress){ #line 109 "cwebdir/ctang-w2c.ch" fputs(_("\nWriting the output files:"),stdout); -#line 541 "cwebdir/ctangle.w" +#line 535 "cwebdir/ctangle.w" printf(" (%s)",C_file_name); update_terminal; @@ -753,16 +752,16 @@ if(text_info->text_link==macro)goto writeloop; while(stack_ptr> stack)get_output(); flush_buffer(); writeloop:/*50:*/ -#line 138 "cwebdir/ctang-w2c.ch" +#line 137 "cwebdir/ctang-w2c.ch" if(check_for_change){ fclose(C_file);C_file= NULL; /*106:*/ -#line 438 "cwebdir/ctang-w2c.ch" +#line 436 "cwebdir/ctang-w2c.ch" if((C_file= fopen(C_file_name,"r"))!=NULL){ /*107:*/ -#line 445 "cwebdir/ctang-w2c.ch" +#line 443 "cwebdir/ctang-w2c.ch" boolean comparison= false; @@ -771,7 +770,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*108:*/ -#line 459 "cwebdir/ctang-w2c.ch" +#line 457 "cwebdir/ctang-w2c.ch" do{ char x[BUFSIZ],y[BUFSIZ]; @@ -781,17 +780,17 @@ comparison= (x_size==y_size)&&!memcmp(x,y,x_size); }while(comparison&&!feof(C_file)&&!feof(check_file)); /*:108*/ -#line 452 "cwebdir/ctang-w2c.ch" +#line 450 "cwebdir/ctang-w2c.ch" fclose(C_file);C_file= NULL; fclose(check_file);check_file= NULL; /*:107*/ -#line 440 "cwebdir/ctang-w2c.ch" +#line 438 "cwebdir/ctang-w2c.ch" /*109:*/ -#line 470 "cwebdir/ctang-w2c.ch" +#line 468 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -801,20 +800,20 @@ rename(check_file_name,C_file_name); } /*:109*/ -#line 441 "cwebdir/ctang-w2c.ch" +#line 439 "cwebdir/ctang-w2c.ch" }else rename(check_file_name,C_file_name); /*:106*/ -#line 141 "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--; sprint_section_name(output_file_name,*an_output_file); if(check_for_change)/*105:*/ -#line 429 "cwebdir/ctang-w2c.ch" +#line 427 "cwebdir/ctang-w2c.ch" { if((C_file= fopen(output_file_name,"a"))==NULL) fatal(_("! Cannot open output file "),output_file_name); @@ -825,7 +824,7 @@ fatal(_("! Cannot open output file "),check_file_name); } /*:105*/ -#line 146 "cwebdir/ctang-w2c.ch" +#line 145 "cwebdir/ctang-w2c.ch" else{ fclose(C_file); @@ -839,20 +838,19 @@ stack_ptr= stack+1; 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(); if(check_for_change){ fclose(C_file);C_file= NULL; /*110:*/ -#line 483 "cwebdir/ctang-w2c.ch" +#line 481 "cwebdir/ctang-w2c.ch" if(0==strcmp("/dev/stdout",output_file_name)) /*112:*/ -#line 510 "cwebdir/ctang-w2c.ch" +#line 508 "cwebdir/ctang-w2c.ch" { /*115:*/ -#line 541 "cwebdir/ctang-w2c.ch" +#line 539 "cwebdir/ctang-w2c.ch" char in_buf[BUFSIZ+1]; int in_size; @@ -862,7 +860,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*:115*/ -#line 511 "cwebdir/ctang-w2c.ch" +#line 509 "cwebdir/ctang-w2c.ch" do{ in_size= fread(in_buf,sizeof(char),BUFSIZ,check_file); @@ -871,7 +869,7 @@ fprintf(stdout,"%s",in_buf); }while(!feof(check_file)); fclose(check_file);check_file= NULL; /*111:*/ -#line 500 "cwebdir/ctang-w2c.ch" +#line 498 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -881,19 +879,19 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 518 "cwebdir/ctang-w2c.ch" +#line 516 "cwebdir/ctang-w2c.ch" } /*:112*/ -#line 485 "cwebdir/ctang-w2c.ch" +#line 483 "cwebdir/ctang-w2c.ch" else if(0==strcmp("/dev/stderr",output_file_name)) /*113:*/ -#line 523 "cwebdir/ctang-w2c.ch" +#line 521 "cwebdir/ctang-w2c.ch" { /*115:*/ -#line 541 "cwebdir/ctang-w2c.ch" +#line 539 "cwebdir/ctang-w2c.ch" char in_buf[BUFSIZ+1]; int in_size; @@ -903,7 +901,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*:115*/ -#line 524 "cwebdir/ctang-w2c.ch" +#line 522 "cwebdir/ctang-w2c.ch" do{ in_size= fread(in_buf,sizeof(char),BUFSIZ,check_file); @@ -912,7 +910,7 @@ fprintf(stderr,"%s",in_buf); }while(!feof(check_file)); fclose(check_file);check_file= NULL; /*111:*/ -#line 500 "cwebdir/ctang-w2c.ch" +#line 498 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -922,20 +920,20 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 531 "cwebdir/ctang-w2c.ch" +#line 529 "cwebdir/ctang-w2c.ch" } /*:113*/ -#line 487 "cwebdir/ctang-w2c.ch" +#line 485 "cwebdir/ctang-w2c.ch" else if(0==strcmp("/dev/null",output_file_name)) /*114:*/ -#line 536 "cwebdir/ctang-w2c.ch" +#line 534 "cwebdir/ctang-w2c.ch" { boolean comparison= true; /*111:*/ -#line 500 "cwebdir/ctang-w2c.ch" +#line 498 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -945,17 +943,17 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 538 "cwebdir/ctang-w2c.ch" +#line 536 "cwebdir/ctang-w2c.ch" } /*:114*/ -#line 489 "cwebdir/ctang-w2c.ch" +#line 487 "cwebdir/ctang-w2c.ch" else{ if((C_file= fopen(output_file_name,"r"))!=NULL){ /*107:*/ -#line 445 "cwebdir/ctang-w2c.ch" +#line 443 "cwebdir/ctang-w2c.ch" boolean comparison= false; @@ -964,7 +962,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*108:*/ -#line 459 "cwebdir/ctang-w2c.ch" +#line 457 "cwebdir/ctang-w2c.ch" do{ char x[BUFSIZ],y[BUFSIZ]; @@ -974,17 +972,17 @@ comparison= (x_size==y_size)&&!memcmp(x,y,x_size); }while(comparison&&!feof(C_file)&&!feof(check_file)); /*:108*/ -#line 452 "cwebdir/ctang-w2c.ch" +#line 450 "cwebdir/ctang-w2c.ch" fclose(C_file);C_file= NULL; fclose(check_file);check_file= NULL; /*:107*/ -#line 492 "cwebdir/ctang-w2c.ch" +#line 490 "cwebdir/ctang-w2c.ch" /*111:*/ -#line 500 "cwebdir/ctang-w2c.ch" +#line 498 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -994,35 +992,35 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 493 "cwebdir/ctang-w2c.ch" +#line 491 "cwebdir/ctang-w2c.ch" }else rename(check_file_name,output_file_name); } /*:110*/ -#line 164 "cwebdir/ctang-w2c.ch" +#line 162 "cwebdir/ctang-w2c.ch" } } if(check_for_change) strcpy(check_file_name,""); -#line 581 "cwebdir/ctangle.w" +#line 574 "cwebdir/ctangle.w" /*:50*/ -#line 549 "cwebdir/ctangle.w" +#line 543 "cwebdir/ctangle.w" if(show_happiness){ if(show_progress)new_line; #line 115 "cwebdir/ctang-w2c.ch" fputs(_("Done."),stdout); -#line 553 "cwebdir/ctangle.w" +#line 547 "cwebdir/ctangle.w" } } } /*:48*//*54:*/ -#line 600 "cwebdir/ctangle.w" +#line 595 "cwebdir/ctangle.w" static void output_defs(void) @@ -1032,13 +1030,12 @@ push_level(NULL); for(cur_text= text_info+1;cur_text<text_ptr;cur_text++) if(cur_text->text_link==macro){ cur_byte= cur_text->tok_start; -cur_end= (cur_text+1)->tok_start; C_printf("%s","#define "); out_state= normal; protect= true; -while(cur_byte<cur_end){ +while(cur_byte<macro_end){ a= *cur_byte++; -if(cur_byte==cur_end&&a=='\n')break; +if(cur_byte==macro_end&&a=='\n')break; if(out_state==verbatim&&a!=string&&a!=constant&&a!='\n') C_putc(a); @@ -1048,9 +1045,9 @@ a= (a-0200)*0400+*cur_byte++; if(a<024000){ cur_val= (int)a;out_char(identifier); } -#line 174 "cwebdir/ctang-w2c.ch" +#line 172 "cwebdir/ctang-w2c.ch" else if(a<050000)confusion(_("macro defs have strange char")); -#line 626 "cwebdir/ctangle.w" +#line 620 "cwebdir/ctangle.w" else{ cur_val= (int)a-050000;cur_section= (sixteen_bits)cur_val; out_char(section_number); @@ -1065,7 +1062,7 @@ pop_level(false); } /*:54*//*55:*/ -#line 644 "cwebdir/ctangle.w" +#line 638 "cwebdir/ctangle.w" static void out_char( @@ -1078,14 +1075,14 @@ 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 206 "cwebdir/ctang-w2c.ch" +#line 204 "cwebdir/ctang-w2c.ch" -#line 713 "cwebdir/ctangle.w" +#line 707 "cwebdir/ctangle.w" case identifier: if(out_state==num_or_id)C_putc(' '); for(j= (cur_val+name_dir)->byte_start,k= (cur_val+name_dir+1)->byte_start; j<k;j++) -#line 214 "cwebdir/ctang-w2c.ch" +#line 212 "cwebdir/ctang-w2c.ch" if(ishigh(*j)){ if(transliterate_utf_eight){ @@ -1096,14 +1093,14 @@ else if((eight_bits)(*j)>=0300)j+= 1; C_printf("%s",translit[(eight_bits)(*j)-0200]); } else C_putc(*j); -#line 720 "cwebdir/ctangle.w" +#line 714 "cwebdir/ctangle.w" out_state= num_or_id;break; /*:59*/ -#line 655 "cwebdir/ctangle.w" +#line 649 "cwebdir/ctangle.w" /*60:*/ -#line 722 "cwebdir/ctangle.w" +#line 716 "cwebdir/ctangle.w" case section_number: if(cur_val> 0)C_printf("/*%d:*/",cur_val); @@ -1130,10 +1127,10 @@ C_putc('"');C_putc('\n'); break; /*:60*/ -#line 656 "cwebdir/ctangle.w" +#line 650 "cwebdir/ctangle.w" /*56:*/ -#line 674 "cwebdir/ctangle.w" +#line 668 "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; @@ -1154,7 +1151,7 @@ case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal; break; /*:56*/ -#line 657 "cwebdir/ctangle.w" +#line 651 "cwebdir/ctangle.w" case'=':case'>':C_putc(cur_char);C_putc(' '); out_state= normal;break; @@ -1173,7 +1170,7 @@ default:C_putc(cur_char);out_state= normal;break; } /*:55*//*64:*/ -#line 803 "cwebdir/ctangle.w" +#line 797 "cwebdir/ctangle.w" static eight_bits skip_ahead(void) @@ -1191,7 +1188,7 @@ if(c!=ignore||*(loc-1)=='>')return c; } /*:64*//*67:*/ -#line 842 "cwebdir/ctangle.w" +#line 836 "cwebdir/ctangle.w" static boolean skip_comment( boolean is_long_comment) @@ -1202,9 +1199,9 @@ if(loc> limit){ if(is_long_comment){ if(get_line())return comment_continues= true; else{ -#line 229 "cwebdir/ctang-w2c.ch" +#line 227 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in mid-comment")); -#line 853 "cwebdir/ctangle.w" +#line 847 "cwebdir/ctangle.w" return comment_continues= false; } @@ -1217,9 +1214,9 @@ loc++;return comment_continues= false; } if(c=='@'){ if(ccode[(eight_bits)*loc]==new_section){ -#line 235 "cwebdir/ctang-w2c.ch" +#line 233 "cwebdir/ctang-w2c.ch" err_print(_("! Section name ended in mid-comment"));loc--; -#line 866 "cwebdir/ctangle.w" +#line 860 "cwebdir/ctangle.w" return comment_continues= false; } @@ -1229,7 +1226,7 @@ else loc++; } /*:67*//*69:*/ -#line 883 "cwebdir/ctangle.w" +#line 877 "cwebdir/ctangle.w" static eight_bits get_next(void) @@ -1243,7 +1240,7 @@ if(get_line()==false)return new_section; else if(print_where&&!no_where){ print_where= false; /*85:*/ -#line 1229 "cwebdir/ctangle.w" +#line 1223 "cwebdir/ctangle.w" { eight_bits a; @@ -1260,7 +1257,7 @@ store_id(a); } /*:85*/ -#line 895 "cwebdir/ctangle.w" +#line 889 "cwebdir/ctangle.w" } else return(eight_bits)'\n'; @@ -1273,7 +1270,7 @@ else continue; } loc++; if(xisdigit(c)||c=='.')/*73:*/ -#line 967 "cwebdir/ctangle.w" +#line 961 "cwebdir/ctangle.w" { boolean hex_flag= false; id_first= loc-1; @@ -1307,13 +1304,13 @@ return constant; } /*:73*/ -#line 906 "cwebdir/ctangle.w" +#line 900 "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 1004 "cwebdir/ctangle.w" +#line 998 "cwebdir/ctangle.w" { char delim= (char)c; id_first= section_text+1; @@ -1325,15 +1322,15 @@ delim= *loc++;*++id_loc= delim; while(true){ if(loc>=limit){ if(*(limit-1)!='\\'){ -#line 241 "cwebdir/ctang-w2c.ch" +#line 239 "cwebdir/ctang-w2c.ch" err_print(_("! String didn't end"));loc= limit;break; -#line 1016 "cwebdir/ctangle.w" +#line 1010 "cwebdir/ctangle.w" } if(get_line()==false){ -#line 247 "cwebdir/ctang-w2c.ch" +#line 245 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in middle of string"));loc= buffer;break; -#line 1020 "cwebdir/ctangle.w" +#line 1014 "cwebdir/ctangle.w" } else if(++id_loc<=section_text_end)*id_loc= '\n'; @@ -1351,9 +1348,9 @@ c= (eight_bits)*loc++; if(++id_loc<=section_text_end)*id_loc= (char)c; } if(id_loc>=section_text_end){ -#line 253 "cwebdir/ctang-w2c.ch" +#line 251 "cwebdir/ctang-w2c.ch" fputs(_("\n! String too long: "),stdout); -#line 1038 "cwebdir/ctangle.w" +#line 1032 "cwebdir/ctangle.w" term_write(section_text+1,25); err_print("..."); @@ -1363,11 +1360,11 @@ return string; } /*:74*/ -#line 910 "cwebdir/ctangle.w" +#line 904 "cwebdir/ctangle.w" else if(isalpha((int)c)||isxalpha(c)||ishigh(c)) /*72:*/ -#line 958 "cwebdir/ctangle.w" +#line 952 "cwebdir/ctangle.w" { id_first= --loc; do @@ -1378,45 +1375,45 @@ id_loc= loc;return identifier; } /*:72*/ -#line 912 "cwebdir/ctangle.w" +#line 906 "cwebdir/ctangle.w" else if(c=='@')/*75:*/ -#line 1049 "cwebdir/ctangle.w" +#line 1043 "cwebdir/ctangle.w" switch(c= ccode[(eight_bits)*loc++]){ case ignore:continue; -#line 259 "cwebdir/ctang-w2c.ch" +#line 257 "cwebdir/ctang-w2c.ch" case translit_code:err_print(_("! Use @l in limbo only"));continue; -#line 1053 "cwebdir/ctangle.w" +#line 1047 "cwebdir/ctangle.w" case control_text:while((c= skip_ahead())=='@'); if(*(loc-1)!='>') -#line 265 "cwebdir/ctang-w2c.ch" +#line 263 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in control text")); -#line 1058 "cwebdir/ctangle.w" +#line 1052 "cwebdir/ctangle.w" continue; case section_name: cur_section_name_char= *(loc-1); /*77:*/ -#line 1094 "cwebdir/ctangle.w" +#line 1088 "cwebdir/ctangle.w" { char*k= section_text; /*79:*/ -#line 1116 "cwebdir/ctangle.w" +#line 1110 "cwebdir/ctangle.w" while(true){ if(loc> limit&&get_line()==false){ -#line 283 "cwebdir/ctang-w2c.ch" +#line 281 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in section name")); -#line 1120 "cwebdir/ctangle.w" +#line 1114 "cwebdir/ctangle.w" loc= buffer+1;break; } c= (eight_bits)*loc; /*80:*/ -#line 1139 "cwebdir/ctangle.w" +#line 1133 "cwebdir/ctangle.w" if(c=='@'){ c= (eight_bits)*(loc+1); @@ -1424,22 +1421,22 @@ if(c=='>'){ loc+= 2;break; } if(ccode[(eight_bits)c]==new_section){ -#line 295 "cwebdir/ctang-w2c.ch" +#line 293 "cwebdir/ctang-w2c.ch" err_print(_("! Section name didn't end"));break; -#line 1147 "cwebdir/ctangle.w" +#line 1141 "cwebdir/ctangle.w" } if(ccode[(eight_bits)c]==section_name){ -#line 301 "cwebdir/ctang-w2c.ch" +#line 299 "cwebdir/ctang-w2c.ch" err_print(_("! Nesting of section names not allowed"));break; -#line 1151 "cwebdir/ctangle.w" +#line 1145 "cwebdir/ctangle.w" } *(++k)= '@';loc++; } /*:80*/ -#line 1124 "cwebdir/ctangle.w" +#line 1118 "cwebdir/ctangle.w" loc++;if(k<section_text_end)k++; if(xisspace(c)){ @@ -1448,9 +1445,9 @@ c= (eight_bits)' ';if(*(k-1)==' ')k--; *k= (char)c; } if(k>=section_text_end){ -#line 289 "cwebdir/ctang-w2c.ch" +#line 287 "cwebdir/ctang-w2c.ch" fputs(_("\n! Section name too long: "),stdout); -#line 1133 "cwebdir/ctangle.w" +#line 1127 "cwebdir/ctangle.w" term_write(section_text+1,25); printf("...");mark_harmless; @@ -1458,7 +1455,7 @@ printf("...");mark_harmless; if(*k==' '&&k> section_text)k--; /*:79*/ -#line 1096 "cwebdir/ctangle.w" +#line 1090 "cwebdir/ctangle.w" if(k-section_text> 3&&strncmp(k-2,"...",3)==0) cur_section_name= section_lookup(section_text+1,k-3,true); @@ -1467,7 +1464,7 @@ else cur_section_name= section_lookup(section_text+1,k,false); if(cur_section_name_char=='(') /*47:*/ -#line 504 "cwebdir/ctangle.w" +#line 498 "cwebdir/ctangle.w" { for(an_output_file= cur_out_file; @@ -1478,36 +1475,36 @@ if(cur_out_file> output_files) *--cur_out_file= cur_section_name; #line 91 "cwebdir/ctang-w2c.ch" else overflow(_("output files")); -#line 513 "cwebdir/ctangle.w" +#line 507 "cwebdir/ctangle.w" } } /*:47*/ -#line 1104 "cwebdir/ctangle.w" +#line 1098 "cwebdir/ctangle.w" return section_name; } /*:77*/ -#line 1062 "cwebdir/ctangle.w" +#line 1056 "cwebdir/ctangle.w" case string:/*81:*/ -#line 1161 "cwebdir/ctangle.w" +#line 1155 "cwebdir/ctangle.w" id_first= loc++;*(limit+1)= '@';*(limit+2)= '>'; while(*loc!='@'||*(loc+1)!='>')loc++; -#line 307 "cwebdir/ctang-w2c.ch" +#line 305 "cwebdir/ctang-w2c.ch" if(loc>=limit)err_print(_("! Verbatim string didn't end")); -#line 1165 "cwebdir/ctangle.w" +#line 1159 "cwebdir/ctangle.w" id_loc= loc;loc+= 2; return string; /*:81*/ -#line 1063 "cwebdir/ctangle.w" +#line 1057 "cwebdir/ctangle.w" case ord:/*76:*/ -#line 1074 "cwebdir/ctangle.w" +#line 1068 "cwebdir/ctangle.w" id_first= loc; if(*loc=='\\') @@ -1515,17 +1512,17 @@ if(*++loc=='\'')loc++; while(*loc!='\''){ if(*loc=='@'){ if(*(loc+1)!='@') -#line 271 "cwebdir/ctang-w2c.ch" +#line 269 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in ASCII constant")); -#line 1082 "cwebdir/ctangle.w" +#line 1076 "cwebdir/ctangle.w" else loc++; } loc++; if(loc> limit){ -#line 277 "cwebdir/ctang-w2c.ch" +#line 275 "cwebdir/ctang-w2c.ch" err_print(_("! String didn't end"));loc= limit-1;break; -#line 1088 "cwebdir/ctangle.w" +#line 1082 "cwebdir/ctangle.w" } } @@ -1533,13 +1530,13 @@ loc++; return ord; /*:76*/ -#line 1064 "cwebdir/ctangle.w" +#line 1058 "cwebdir/ctangle.w" default:return c; } /*:75*/ -#line 913 "cwebdir/ctangle.w" +#line 907 "cwebdir/ctangle.w" else if(xisspace(c)){ if(!preprocessing||loc> limit)continue; @@ -1549,7 +1546,7 @@ else return(eight_bits)' '; } else if(c=='#'&&loc==buffer+1)preprocessing= true; mistake:/*71:*/ -#line 935 "cwebdir/ctangle.w" +#line 929 "cwebdir/ctangle.w" switch(c){ case'+':if(*loc=='+')compress(plus_plus);break; @@ -1574,14 +1571,14 @@ case'!':if(*loc=='=')compress(non_eq);break; } /*:71*/ -#line 921 "cwebdir/ctangle.w" +#line 915 "cwebdir/ctangle.w" return c; } } /*:69*//*83:*/ -#line 1197 "cwebdir/ctangle.w" +#line 1191 "cwebdir/ctangle.w" static void scan_repl( @@ -1589,7 +1586,7 @@ eight_bits t) { sixteen_bits a; if(t==section_name)/*85:*/ -#line 1229 "cwebdir/ctangle.w" +#line 1223 "cwebdir/ctangle.w" { eight_bits a; @@ -1606,11 +1603,11 @@ store_id(a); } /*:85*/ -#line 1203 "cwebdir/ctangle.w" +#line 1197 "cwebdir/ctangle.w" while(true)switch(a= get_next()){ /*86:*/ -#line 1244 "cwebdir/ctangle.w" +#line 1238 "cwebdir/ctangle.w" case identifier:store_id(a); if(*buffer=='#'&&( @@ -1623,28 +1620,28 @@ break; case section_name:if(t!=section_name)goto done; else{ /*87:*/ -#line 1285 "cwebdir/ctangle.w" +#line 1279 "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 343 "cwebdir/ctang-w2c.ch" +#line 341 "cwebdir/ctang-w2c.ch" if(*try_loc=='=')err_print(_("! Missing `@ ' before a named section")); -#line 1291 "cwebdir/ctangle.w" +#line 1285 "cwebdir/ctangle.w" } /*:87*/ -#line 1255 "cwebdir/ctangle.w" +#line 1249 "cwebdir/ctangle.w" a= cur_section_name-name_dir; app_repl((a/0400)+0250); app_repl(a%0400); /*85:*/ -#line 1229 "cwebdir/ctangle.w" +#line 1223 "cwebdir/ctangle.w" { eight_bits a; @@ -1661,13 +1658,13 @@ store_id(a); } /*:85*/ -#line 1259 "cwebdir/ctangle.w" +#line 1253 "cwebdir/ctangle.w" } break; -#line 331 "cwebdir/ctang-w2c.ch" +#line 329 "cwebdir/ctang-w2c.ch" case output_defs_code:if(t!=section_name)err_print(_("! Misplaced @h")); -#line 1263 "cwebdir/ctangle.w" +#line 1257 "cwebdir/ctangle.w" else{ output_defs_seen= true; @@ -1675,7 +1672,7 @@ a= output_defs_flag; app_repl((a/0400)+0200); app_repl(a%0400); /*85:*/ -#line 1229 "cwebdir/ctangle.w" +#line 1223 "cwebdir/ctangle.w" { eight_bits a; @@ -1692,21 +1689,21 @@ store_id(a); } /*:85*/ -#line 1269 "cwebdir/ctangle.w" +#line 1263 "cwebdir/ctangle.w" } break; case constant:case string: /*88:*/ -#line 1302 "cwebdir/ctangle.w" +#line 1296 "cwebdir/ctangle.w" app_repl(a); while(id_first<id_loc){ if(*id_first=='@'){ if(*(id_first+1)=='@')id_first++; -#line 349 "cwebdir/ctang-w2c.ch" +#line 347 "cwebdir/ctang-w2c.ch" else err_print(_("! Double @ should be used in string")); -#line 1308 "cwebdir/ctangle.w" +#line 1302 "cwebdir/ctangle.w" } else if(a==constant&&*id_first=='\''&&!keep_digit_separators) @@ -1716,12 +1713,12 @@ app_repl(*id_first++); app_repl(a); /*:88*/ -#line 1273 "cwebdir/ctangle.w" +#line 1267 "cwebdir/ctangle.w" break; case ord: /*89:*/ -#line 1320 "cwebdir/ctangle.w" +#line 1314 "cwebdir/ctangle.w" { int c= (int)((eight_bits)*id_first); if(c=='\\'){ @@ -1758,9 +1755,9 @@ break; case'\\':c= '\\';break; case'\'':c= '\'';break; case'\"':c= '\"';break; -#line 355 "cwebdir/ctang-w2c.ch" +#line 353 "cwebdir/ctang-w2c.ch" default:err_print(_("! Unrecognized escape sequence")); -#line 1357 "cwebdir/ctangle.w" +#line 1351 "cwebdir/ctangle.w" } } @@ -1773,20 +1770,20 @@ app_repl(constant); } /*:89*/ -#line 1276 "cwebdir/ctangle.w" +#line 1270 "cwebdir/ctangle.w" break; case definition:case format_code:case begin_C:if(t!=section_name)goto done; else{ -#line 337 "cwebdir/ctang-w2c.ch" +#line 335 "cwebdir/ctang-w2c.ch" err_print(_("! @d, @f and @c are ignored in C text"));continue; -#line 1281 "cwebdir/ctangle.w" +#line 1275 "cwebdir/ctangle.w" } case new_section:goto done; /*:86*/ -#line 1208 "cwebdir/ctangle.w" +#line 1202 "cwebdir/ctangle.w" case')':app_repl(a); if(t==macro)app_repl(' '); @@ -1794,14 +1791,14 @@ break; default:app_repl(a); } done:next_control= (eight_bits)a; -#line 325 "cwebdir/ctang-w2c.ch" +#line 323 "cwebdir/ctang-w2c.ch" if(text_ptr> text_info_end)overflow(_("text")); -#line 1216 "cwebdir/ctangle.w" +#line 1210 "cwebdir/ctangle.w" cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; } /*:83*//*90:*/ -#line 1378 "cwebdir/ctangle.w" +#line 1372 "cwebdir/ctangle.w" static void scan_section(void) @@ -1816,7 +1813,7 @@ printf("*%d",(int)section_count);update_terminal; next_control= ignore; while(true){ /*92:*/ -#line 1419 "cwebdir/ctangle.w" +#line 1413 "cwebdir/ctangle.w" while(next_control<definition) @@ -1825,17 +1822,17 @@ loc-= 2;next_control= get_next(); } /*:92*/ -#line 1392 "cwebdir/ctangle.w" +#line 1386 "cwebdir/ctangle.w" if(next_control==definition){ /*93:*/ -#line 1426 "cwebdir/ctangle.w" +#line 1420 "cwebdir/ctangle.w" while((next_control= get_next())=='\n'); if(next_control!=identifier){ -#line 361 "cwebdir/ctang-w2c.ch" +#line 359 "cwebdir/ctang-w2c.ch" err_print(_("! Definition flushed, must start with identifier")); -#line 1430 "cwebdir/ctangle.w" +#line 1424 "cwebdir/ctangle.w" continue; } @@ -1847,7 +1844,7 @@ scan_repl(macro); cur_text->text_link= macro; /*:93*/ -#line 1394 "cwebdir/ctangle.w" +#line 1388 "cwebdir/ctangle.w" continue; } @@ -1857,14 +1854,14 @@ p= name_dir;break; if(next_control==section_name){ p= cur_section_name; /*94:*/ -#line 1448 "cwebdir/ctangle.w" +#line 1442 "cwebdir/ctangle.w" while((next_control= get_next())=='+'); if(next_control!='='&&next_control!=eq_eq) continue; /*:94*/ -#line 1402 "cwebdir/ctangle.w" +#line 1396 "cwebdir/ctangle.w" break; } @@ -1872,20 +1869,20 @@ return; } no_where= print_where= false; /*95:*/ -#line 1453 "cwebdir/ctangle.w" +#line 1447 "cwebdir/ctangle.w" /*96:*/ -#line 1458 "cwebdir/ctangle.w" +#line 1452 "cwebdir/ctangle.w" store_two_bytes((sixteen_bits)(0150000+section_count)); /*:96*/ -#line 1454 "cwebdir/ctangle.w" +#line 1448 "cwebdir/ctangle.w" scan_repl(section_name); /*97:*/ -#line 1462 "cwebdir/ctangle.w" +#line 1456 "cwebdir/ctangle.w" if(p==name_dir||p==NULL){ last_unnamed->text_link= cur_text-text_info;last_unnamed= cur_text; @@ -1902,16 +1899,16 @@ cur_text->text_link= section_flag; /*:97*/ -#line 1456 "cwebdir/ctangle.w" +#line 1450 "cwebdir/ctangle.w" /*:95*/ -#line 1408 "cwebdir/ctangle.w" +#line 1402 "cwebdir/ctangle.w" } /*:90*//*98:*/ -#line 1477 "cwebdir/ctangle.w" +#line 1471 "cwebdir/ctangle.w" static void phase_one(void){ @@ -1924,7 +1921,7 @@ check_complete(); } /*:98*//*100:*/ -#line 1493 "cwebdir/ctangle.w" +#line 1487 "cwebdir/ctangle.w" static void skip_limbo(void) @@ -1938,15 +1935,15 @@ char c= *loc++; switch(ccode[(eight_bits)c]){ case new_section:return; case translit_code:/*102:*/ -#line 1523 "cwebdir/ctangle.w" +#line 1517 "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 381 "cwebdir/ctang-w2c.ch" +#line 379 "cwebdir/ctang-w2c.ch" err_print(_("! Improper hex number following @l")); -#line 1529 "cwebdir/ctangle.w" +#line 1523 "cwebdir/ctangle.w" else{ unsigned int i; @@ -1956,9 +1953,9 @@ while(xisspace(*loc)&&loc<limit)loc++; beg= loc; while(loc<limit&&(xisalpha(*loc)||xisdigit(*loc)||isxalpha(*loc)))loc++; if(loc-beg>=translit_length) -#line 387 "cwebdir/ctang-w2c.ch" +#line 385 "cwebdir/ctang-w2c.ch" err_print(_("! Replacement string in @l too long")); -#line 1539 "cwebdir/ctangle.w" +#line 1533 "cwebdir/ctangle.w" else{ strncpy(translit[i-0200],beg,(size_t)(loc-beg)); @@ -1967,21 +1964,21 @@ translit[i-0200][loc-beg]= '\0'; } /*:102*/ -#line 1505 "cwebdir/ctangle.w" +#line 1499 "cwebdir/ctangle.w" break; case format_code:case'@':break; case control_text:if(c=='q'||c=='Q'){ while((c= (char)skip_ahead())=='@'); if(*(loc-1)!='>') -#line 367 "cwebdir/ctang-w2c.ch" +#line 365 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in control text")); -#line 1511 "cwebdir/ctangle.w" +#line 1505 "cwebdir/ctangle.w" break; -#line 374 "cwebdir/ctang-w2c.ch" +#line 372 "cwebdir/ctang-w2c.ch" }/* otherwise fall through */ default:err_print(_("! Double @ should be used in limbo")); -#line 1515 "cwebdir/ctangle.w" +#line 1509 "cwebdir/ctangle.w" } } @@ -1989,11 +1986,11 @@ default:err_print(_("! Double @ should be used in limbo")); } /*:100*//*103:*/ -#line 1549 "cwebdir/ctangle.w" +#line 1543 "cwebdir/ctangle.w" void print_stats(void){ -#line 400 "cwebdir/ctang-w2c.ch" +#line 398 "cwebdir/ctang-w2c.ch" puts(_("\nMemory usage statistics:")); printf(_("%td names (out of %ld)\n"), (ptrdiff_t)(name_ptr-name_dir),(long)max_names); @@ -2002,9 +1999,9 @@ printf(_("%td replacement texts (out of %ld)\n"), printf(_("%td bytes (out of %ld)\n"), (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes); printf(_("%td tokens (out of %ld)\n"), -#line 1560 "cwebdir/ctangle.w" +#line 1554 "cwebdir/ctangle.w" (ptrdiff_t)(tok_ptr-tok_mem),(long)max_toks); } -#line 413 "cwebdir/ctang-w2c.ch" +#line 411 "cwebdir/ctang-w2c.ch" /*:103*/ diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index a6ef501eb1d..bfec99e0f19 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -1,3 +1,10 @@ +2023-07-13 Andreas Scherer <https://ascherer.github.io> + + * ctang-{bs,w2c}.ch, + * ctangle.c, + + ctangle.w, + * cweave.w: Merge 'cur_state' into 'stack'. + 2023-07-09 Andreas Scherer <https://ascherer.github.io> * comm-ql.ch, diff --git a/Build/source/texk/web2c/cwebdir/ctang-bs.ch b/Build/source/texk/web2c/cwebdir/ctang-bs.ch index e3966f64584..bf4a443f1d1 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-bs.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-bs.ch @@ -144,10 +144,8 @@ text_ptr=text_info+1; text_ptr->tok_start=tok_mem; @x Section 31. - eight_bits *end_field; /* ending location of replacement text */ eight_bits *byte_field; /* present location within replacement text */ @y - eight_bits huge* end_field; /* ending location of replacement text */ eight_bits huge* byte_field; /* present location within replacement text */ @z diff --git a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch index 312c2be8988..d4ccabf789d 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch @@ -130,7 +130,6 @@ for (an_output_file=end_output_files; an_output_file>cur_out_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(); } @@ -156,7 +155,6 @@ for (an_output_file=end_output_files; an_output_file>cur_out_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(); if (check_for_change) { diff --git a/Build/source/texk/web2c/cwebdir/ctangle.c b/Build/source/texk/web2c/cwebdir/ctangle.c index 35c1ed709a2..8f18594c465 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.c +++ b/Build/source/texk/web2c/cwebdir/ctangle.c @@ -107,11 +107,13 @@ #define output_defs_flag (2*024000-1) \ #define stack_size 50 -#define cur_end cur_state.end_field +#define cur_state stack[stack_size+1] \ + #define cur_byte cur_state.byte_field #define cur_name cur_state.name_field #define cur_repl cur_state.repl_field -#define cur_section cur_state.section_field \ +#define cur_section cur_state.section_field +#define cur_end (cur_repl+1) ->tok_start \ #define section_number 0201 #define identifier 0202 \ @@ -126,6 +128,8 @@ #define C_printf(c,a) fprintf(C_file,c,a) #define C_putc(c) putc((int) (c) ,C_file) \ +#define macro_end (cur_text+1) ->tok_start \ + #define translit_length 10 \ #define ignore 00 @@ -265,10 +269,9 @@ sixteen_bits text_link; typedef text*text_pointer; /*:19*//*31:*/ -#line 274 "ctangle.w" +#line 271 "ctangle.w" typedef struct{ -eight_bits*end_field; eight_bits*byte_field; name_pointer name_field; text_pointer repl_field; @@ -295,27 +298,25 @@ static eight_bits*tok_ptr; static text_pointer last_unnamed; /*:26*//*32:*/ -#line 291 "ctangle.w" - -static output_state cur_state; +#line 289 "ctangle.w" -static output_state stack[stack_size+1]; +static output_state stack[stack_size+2]; static stack_pointer stack_end= stack+stack_size; static stack_pointer stack_ptr; /*:32*//*37:*/ -#line 367 "ctangle.w" +#line 361 "ctangle.w" static int cur_val; /*:37*//*42:*/ -#line 459 "ctangle.w" +#line 453 "ctangle.w" static eight_bits out_state; static boolean protect; /*:42*//*45:*/ -#line 490 "ctangle.w" +#line 484 "ctangle.w" static name_pointer output_files[max_files]; static name_pointer*cur_out_file,*end_output_files,*an_output_file; @@ -323,33 +324,33 @@ static char cur_section_name_char; static char output_file_name[longest_name+1]; /*:45*//*52:*/ -#line 590 "ctangle.w" +#line 583 "ctangle.w" static boolean output_defs_seen= false; /*:52*//*57:*/ -#line 703 "ctangle.w" +#line 697 "ctangle.w" static char translit[0200][translit_length]; /*:57*//*62:*/ -#line 779 "ctangle.w" +#line 773 "ctangle.w" static eight_bits ccode[256]; /*:62*//*66:*/ -#line 839 "ctangle.w" +#line 833 "ctangle.w" static boolean comment_continues= false; /*:66*//*68:*/ -#line 876 "ctangle.w" +#line 870 "ctangle.w" static name_pointer cur_section_name; static boolean no_where; /*:68*//*82:*/ -#line 1193 "ctangle.w" +#line 1187 "ctangle.w" static text_pointer cur_text; static eight_bits next_control; @@ -396,53 +397,53 @@ extern void print_stats(void); static void store_two_bytes(sixteen_bits); /*:30*//*35:*/ -#line 330 "ctangle.w" +#line 325 "ctangle.w" static void push_level(name_pointer); static void pop_level(boolean); /*:35*//*39:*/ -#line 404 "ctangle.w" +#line 398 "ctangle.w" static void get_output(void); /*:39*//*44:*/ -#line 480 "ctangle.w" +#line 474 "ctangle.w" static void flush_buffer(void); /*:44*//*49:*/ -#line 557 "ctangle.w" +#line 551 "ctangle.w" static void phase_two(void); /*:49*//*53:*/ -#line 593 "ctangle.w" +#line 586 "ctangle.w" static void output_defs(void); static void out_char(eight_bits); /*:53*//*65:*/ -#line 819 "ctangle.w" +#line 813 "ctangle.w" static eight_bits skip_ahead(void); static boolean skip_comment(boolean); /*:65*//*70:*/ -#line 926 "ctangle.w" +#line 920 "ctangle.w" static eight_bits get_next(void); /*:70*//*84:*/ -#line 1219 "ctangle.w" +#line 1213 "ctangle.w" static void scan_repl(eight_bits); /*:84*//*91:*/ -#line 1411 "ctangle.w" +#line 1405 "ctangle.w" static void scan_section(void); /*:91*//*99:*/ -#line 1488 "ctangle.w" +#line 1482 "ctangle.w" static void phase_one(void); /*:99*//*101:*/ -#line 1521 "ctangle.w" +#line 1515 "ctangle.w" static void skip_limbo(void); /*:101*/ @@ -475,12 +476,12 @@ init_node(name_dir); last_unnamed= text_info;text_info->text_link= macro; /*:27*//*46:*/ -#line 500 "ctangle.w" +#line 494 "ctangle.w" cur_out_file= end_output_files= output_files+max_files; /*:46*//*58:*/ -#line 706 "ctangle.w" +#line 700 "ctangle.w" { int i; @@ -488,7 +489,7 @@ for(i= 0;i<0200;i++)sprintf(translit[i],"X%02X",(unsigned int)(0200+i)); } /*:58*//*63:*/ -#line 782 "ctangle.w" +#line 776 "ctangle.w" { int c; for(c= 0;c<256;c++)ccode[c]= ignore; @@ -508,7 +509,7 @@ ccode['<']= ccode['(']= section_name; ccode['\'']= ord; /*:63*//*78:*/ -#line 1114 "ctangle.w" +#line 1108 "ctangle.w" section_text[0]= ' '; /*:78*/ @@ -558,7 +559,7 @@ if(tok_ptr+2> tok_mem_end)overflow("token"); } /*:29*//*34:*/ -#line 315 "ctangle.w" +#line 311 "ctangle.w" static void push_level( @@ -569,13 +570,12 @@ if(stack_ptr==stack_end)overflow("stack"); stack_ptr++; if(p!=NULL){ cur_name= p;cur_repl= (text_pointer)p->equiv; -cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start; -cur_section= 0; +cur_byte= cur_repl->tok_start;cur_section= 0; } } /*:34*//*36:*/ -#line 338 "ctangle.w" +#line 333 "ctangle.w" static void pop_level( @@ -583,15 +583,14 @@ boolean flag) { if(flag&&cur_repl->text_link<section_flag){ cur_repl= cur_repl->text_link+text_info; -cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start; -return; +cur_byte= cur_repl->tok_start;return; } stack_ptr--; if(stack_ptr> stack)cur_state= *stack_ptr; } /*:36*//*38:*/ -#line 374 "ctangle.w" +#line 368 "ctangle.w" static void get_output(void) @@ -614,7 +613,7 @@ switch(a/024000){ case 0:cur_val= (int)a;out_char(identifier);break; case 1:if(a==output_defs_flag)output_defs(); else/*40:*/ -#line 409 "ctangle.w" +#line 403 "ctangle.w" { a-= 024000; @@ -628,7 +627,7 @@ goto restart; } /*:40*/ -#line 395 "ctangle.w" +#line 389 "ctangle.w" break; default:cur_val= (int)a-050000; @@ -639,7 +638,7 @@ out_char(section_number); } /*:38*//*43:*/ -#line 467 "ctangle.w" +#line 461 "ctangle.w" static void flush_buffer(void) @@ -654,7 +653,7 @@ cur_line++; } /*:43*//*48:*/ -#line 519 "ctangle.w" +#line 513 "ctangle.w" static void phase_two(void){ @@ -662,22 +661,22 @@ phase= 2; web_file_open= false; cur_line= 1; /*33:*/ -#line 304 "ctangle.w" +#line 300 "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; +cur_byte= cur_repl->tok_start;cur_section= 0; /*:33*/ -#line 525 "ctangle.w" +#line 519 "ctangle.w" /*51:*/ -#line 586 "ctangle.w" +#line 579 "ctangle.w" if(!output_defs_seen) output_defs(); /*:51*/ -#line 526 "ctangle.w" +#line 520 "ctangle.w" if(text_info->text_link==macro&&cur_out_file==end_output_files){ fputs("\n! No program text was specified.",stdout);mark_harmless; @@ -702,7 +701,7 @@ if(text_info->text_link==macro)goto writeloop; while(stack_ptr> stack)get_output(); flush_buffer(); writeloop:/*50:*/ -#line 563 "ctangle.w" +#line 557 "ctangle.w" for(an_output_file= end_output_files;an_output_file> cur_out_file;){ an_output_file--; @@ -717,13 +716,12 @@ stack_ptr= stack+1; 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(); } /*:50*/ -#line 549 "ctangle.w" +#line 543 "ctangle.w" if(show_happiness){ if(show_progress)new_line; @@ -733,7 +731,7 @@ fputs("Done.",stdout); } /*:48*//*54:*/ -#line 600 "ctangle.w" +#line 595 "ctangle.w" static void output_defs(void) @@ -743,13 +741,12 @@ push_level(NULL); for(cur_text= text_info+1;cur_text<text_ptr;cur_text++) if(cur_text->text_link==macro){ cur_byte= cur_text->tok_start; -cur_end= (cur_text+1)->tok_start; C_printf("%s","#define "); out_state= normal; protect= true; -while(cur_byte<cur_end){ +while(cur_byte<macro_end){ a= *cur_byte++; -if(cur_byte==cur_end&&a=='\n')break; +if(cur_byte==macro_end&&a=='\n')break; if(out_state==verbatim&&a!=string&&a!=constant&&a!='\n') C_putc(a); @@ -774,7 +771,7 @@ pop_level(false); } /*:54*//*55:*/ -#line 644 "ctangle.w" +#line 638 "ctangle.w" static void out_char( @@ -787,7 +784,7 @@ case'\n':if(protect&&out_state!=verbatim)C_putc(' '); if(protect||out_state==verbatim)C_putc('\\'); flush_buffer();if(out_state!=verbatim)out_state= normal;break; /*59:*/ -#line 712 "ctangle.w" +#line 706 "ctangle.w" case identifier: if(out_state==num_or_id)C_putc(' '); @@ -799,10 +796,10 @@ else C_printf("%s",translit[(eight_bits)(*j)-0200]); out_state= num_or_id;break; /*:59*/ -#line 655 "ctangle.w" +#line 649 "ctangle.w" /*60:*/ -#line 722 "ctangle.w" +#line 716 "ctangle.w" case section_number: if(cur_val> 0)C_printf("/*%d:*/",cur_val); @@ -829,10 +826,10 @@ C_putc('"');C_putc('\n'); break; /*:60*/ -#line 656 "ctangle.w" +#line 650 "ctangle.w" /*56:*/ -#line 674 "ctangle.w" +#line 668 "ctangle.w" case plus_plus:C_putc('+');C_putc('+');out_state= normal;break; case minus_minus:C_putc('-');C_putc('-');out_state= normal;break; @@ -853,7 +850,7 @@ case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal; break; /*:56*/ -#line 657 "ctangle.w" +#line 651 "ctangle.w" case'=':case'>':C_putc(cur_char);C_putc(' '); out_state= normal;break; @@ -872,7 +869,7 @@ default:C_putc(cur_char);out_state= normal;break; } /*:55*//*64:*/ -#line 803 "ctangle.w" +#line 797 "ctangle.w" static eight_bits skip_ahead(void) @@ -890,7 +887,7 @@ if(c!=ignore||*(loc-1)=='>')return c; } /*:64*//*67:*/ -#line 842 "ctangle.w" +#line 836 "ctangle.w" static boolean skip_comment( boolean is_long_comment) @@ -924,7 +921,7 @@ else loc++; } /*:67*//*69:*/ -#line 883 "ctangle.w" +#line 877 "ctangle.w" static eight_bits get_next(void) @@ -938,7 +935,7 @@ if(get_line()==false)return new_section; else if(print_where&&!no_where){ print_where= false; /*85:*/ -#line 1229 "ctangle.w" +#line 1223 "ctangle.w" { eight_bits a; @@ -955,7 +952,7 @@ store_id(a); } /*:85*/ -#line 895 "ctangle.w" +#line 889 "ctangle.w" } else return(eight_bits)'\n'; @@ -968,7 +965,7 @@ else continue; } loc++; if(xisdigit(c)||c=='.')/*73:*/ -#line 967 "ctangle.w" +#line 961 "ctangle.w" { boolean hex_flag= false; id_first= loc-1; @@ -1002,13 +999,13 @@ return constant; } /*:73*/ -#line 906 "ctangle.w" +#line 900 "ctangle.w" else if(c=='\''||c=='"' ||((c=='L'||c=='u'||c=='U')&&(*loc=='\''||*loc=='"')) ||((c=='u'&&*loc=='8')&&(*(loc+1)=='\''||*(loc+1)=='"'))) /*74:*/ -#line 1004 "ctangle.w" +#line 998 "ctangle.w" { char delim= (char)c; id_first= section_text+1; @@ -1052,11 +1049,11 @@ return string; } /*:74*/ -#line 910 "ctangle.w" +#line 904 "ctangle.w" else if(isalpha((int)c)||isxalpha(c)||ishigh(c)) /*72:*/ -#line 958 "ctangle.w" +#line 952 "ctangle.w" { id_first= --loc; do @@ -1067,10 +1064,10 @@ id_loc= loc;return identifier; } /*:72*/ -#line 912 "ctangle.w" +#line 906 "ctangle.w" else if(c=='@')/*75:*/ -#line 1049 "ctangle.w" +#line 1043 "ctangle.w" switch(c= ccode[(eight_bits)*loc++]){ case ignore:continue; @@ -1085,11 +1082,11 @@ continue; case section_name: cur_section_name_char= *(loc-1); /*77:*/ -#line 1094 "ctangle.w" +#line 1088 "ctangle.w" { char*k= section_text; /*79:*/ -#line 1116 "ctangle.w" +#line 1110 "ctangle.w" while(true){ if(loc> limit&&get_line()==false){ @@ -1099,7 +1096,7 @@ loc= buffer+1;break; } c= (eight_bits)*loc; /*80:*/ -#line 1139 "ctangle.w" +#line 1133 "ctangle.w" if(c=='@'){ c= (eight_bits)*(loc+1); @@ -1118,7 +1115,7 @@ err_print("! Nesting of section names not allowed");break; } /*:80*/ -#line 1124 "ctangle.w" +#line 1118 "ctangle.w" loc++;if(k<section_text_end)k++; if(xisspace(c)){ @@ -1135,7 +1132,7 @@ printf("...");mark_harmless; if(*k==' '&&k> section_text)k--; /*:79*/ -#line 1096 "ctangle.w" +#line 1090 "ctangle.w" if(k-section_text> 3&&strncmp(k-2,"...",3)==0) cur_section_name= section_lookup(section_text+1,k-3,true); @@ -1144,7 +1141,7 @@ else cur_section_name= section_lookup(section_text+1,k,false); if(cur_section_name_char=='(') /*47:*/ -#line 504 "ctangle.w" +#line 498 "ctangle.w" { for(an_output_file= cur_out_file; @@ -1158,16 +1155,16 @@ else overflow("output files"); } /*:47*/ -#line 1104 "ctangle.w" +#line 1098 "ctangle.w" return section_name; } /*:77*/ -#line 1062 "ctangle.w" +#line 1056 "ctangle.w" case string:/*81:*/ -#line 1161 "ctangle.w" +#line 1155 "ctangle.w" id_first= loc++;*(limit+1)= '@';*(limit+2)= '>'; while(*loc!='@'||*(loc+1)!='>')loc++; @@ -1177,10 +1174,10 @@ id_loc= loc;loc+= 2; return string; /*:81*/ -#line 1063 "ctangle.w" +#line 1057 "ctangle.w" case ord:/*76:*/ -#line 1074 "ctangle.w" +#line 1068 "ctangle.w" id_first= loc; if(*loc=='\\') @@ -1202,13 +1199,13 @@ loc++; return ord; /*:76*/ -#line 1064 "ctangle.w" +#line 1058 "ctangle.w" default:return c; } /*:75*/ -#line 913 "ctangle.w" +#line 907 "ctangle.w" else if(xisspace(c)){ if(!preprocessing||loc> limit)continue; @@ -1218,7 +1215,7 @@ else return(eight_bits)' '; } else if(c=='#'&&loc==buffer+1)preprocessing= true; mistake:/*71:*/ -#line 935 "ctangle.w" +#line 929 "ctangle.w" switch(c){ case'+':if(*loc=='+')compress(plus_plus);break; @@ -1243,14 +1240,14 @@ case'!':if(*loc=='=')compress(non_eq);break; } /*:71*/ -#line 921 "ctangle.w" +#line 915 "ctangle.w" return c; } } /*:69*//*83:*/ -#line 1197 "ctangle.w" +#line 1191 "ctangle.w" static void scan_repl( @@ -1258,7 +1255,7 @@ eight_bits t) { sixteen_bits a; if(t==section_name)/*85:*/ -#line 1229 "ctangle.w" +#line 1223 "ctangle.w" { eight_bits a; @@ -1275,11 +1272,11 @@ store_id(a); } /*:85*/ -#line 1203 "ctangle.w" +#line 1197 "ctangle.w" while(true)switch(a= get_next()){ /*86:*/ -#line 1244 "ctangle.w" +#line 1238 "ctangle.w" case identifier:store_id(a); if(*buffer=='#'&&( @@ -1292,7 +1289,7 @@ break; case section_name:if(t!=section_name)goto done; else{ /*87:*/ -#line 1285 "ctangle.w" +#line 1279 "ctangle.w" { char*try_loc= loc; while(*try_loc==' '&&try_loc<limit)try_loc++; @@ -1305,13 +1302,13 @@ if(*try_loc=='=')err_print("! Missing `@ ' before a named section"); } /*:87*/ -#line 1255 "ctangle.w" +#line 1249 "ctangle.w" a= cur_section_name-name_dir; app_repl((a/0400)+0250); app_repl(a%0400); /*85:*/ -#line 1229 "ctangle.w" +#line 1223 "ctangle.w" { eight_bits a; @@ -1328,7 +1325,7 @@ store_id(a); } /*:85*/ -#line 1259 "ctangle.w" +#line 1253 "ctangle.w" } break; @@ -1340,7 +1337,7 @@ a= output_defs_flag; app_repl((a/0400)+0200); app_repl(a%0400); /*85:*/ -#line 1229 "ctangle.w" +#line 1223 "ctangle.w" { eight_bits a; @@ -1357,13 +1354,13 @@ store_id(a); } /*:85*/ -#line 1269 "ctangle.w" +#line 1263 "ctangle.w" } break; case constant:case string: /*88:*/ -#line 1302 "ctangle.w" +#line 1296 "ctangle.w" app_repl(a); while(id_first<id_loc){ @@ -1379,12 +1376,12 @@ app_repl(*id_first++); app_repl(a); /*:88*/ -#line 1273 "ctangle.w" +#line 1267 "ctangle.w" break; case ord: /*89:*/ -#line 1320 "ctangle.w" +#line 1314 "ctangle.w" { int c= (int)((eight_bits)*id_first); if(c=='\\'){ @@ -1434,7 +1431,7 @@ app_repl(constant); } /*:89*/ -#line 1276 "ctangle.w" +#line 1270 "ctangle.w" break; case definition:case format_code:case begin_C:if(t!=section_name)goto done; @@ -1445,7 +1442,7 @@ err_print("! @d, @f and @c are ignored in C text");continue; case new_section:goto done; /*:86*/ -#line 1208 "ctangle.w" +#line 1202 "ctangle.w" case')':app_repl(a); if(t==macro)app_repl(' '); @@ -1458,7 +1455,7 @@ cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; } /*:83*//*90:*/ -#line 1378 "ctangle.w" +#line 1372 "ctangle.w" static void scan_section(void) @@ -1473,7 +1470,7 @@ printf("*%d",(int)section_count);update_terminal; next_control= ignore; while(true){ /*92:*/ -#line 1419 "ctangle.w" +#line 1413 "ctangle.w" while(next_control<definition) @@ -1482,11 +1479,11 @@ loc-= 2;next_control= get_next(); } /*:92*/ -#line 1392 "ctangle.w" +#line 1386 "ctangle.w" if(next_control==definition){ /*93:*/ -#line 1426 "ctangle.w" +#line 1420 "ctangle.w" while((next_control= get_next())=='\n'); if(next_control!=identifier){ @@ -1502,7 +1499,7 @@ scan_repl(macro); cur_text->text_link= macro; /*:93*/ -#line 1394 "ctangle.w" +#line 1388 "ctangle.w" continue; } @@ -1512,14 +1509,14 @@ p= name_dir;break; if(next_control==section_name){ p= cur_section_name; /*94:*/ -#line 1448 "ctangle.w" +#line 1442 "ctangle.w" while((next_control= get_next())=='+'); if(next_control!='='&&next_control!=eq_eq) continue; /*:94*/ -#line 1402 "ctangle.w" +#line 1396 "ctangle.w" break; } @@ -1527,20 +1524,20 @@ return; } no_where= print_where= false; /*95:*/ -#line 1453 "ctangle.w" +#line 1447 "ctangle.w" /*96:*/ -#line 1458 "ctangle.w" +#line 1452 "ctangle.w" store_two_bytes((sixteen_bits)(0150000+section_count)); /*:96*/ -#line 1454 "ctangle.w" +#line 1448 "ctangle.w" scan_repl(section_name); /*97:*/ -#line 1462 "ctangle.w" +#line 1456 "ctangle.w" if(p==name_dir||p==NULL){ last_unnamed->text_link= cur_text-text_info;last_unnamed= cur_text; @@ -1557,16 +1554,16 @@ cur_text->text_link= section_flag; /*:97*/ -#line 1456 "ctangle.w" +#line 1450 "ctangle.w" /*:95*/ -#line 1408 "ctangle.w" +#line 1402 "ctangle.w" } /*:90*//*98:*/ -#line 1477 "ctangle.w" +#line 1471 "ctangle.w" static void phase_one(void){ @@ -1579,7 +1576,7 @@ check_complete(); } /*:98*//*100:*/ -#line 1493 "ctangle.w" +#line 1487 "ctangle.w" static void skip_limbo(void) @@ -1593,7 +1590,7 @@ char c= *loc++; switch(ccode[(eight_bits)c]){ case new_section:return; case translit_code:/*102:*/ -#line 1523 "ctangle.w" +#line 1517 "ctangle.w" while(xisspace(*loc)&&loc<limit)loc++; loc+= 3; @@ -1618,7 +1615,7 @@ translit[i-0200][loc-beg]= '\0'; } /*:102*/ -#line 1505 "ctangle.w" +#line 1499 "ctangle.w" break; case format_code:case'@':break; case control_text:if(c=='q'||c=='Q'){ @@ -1636,7 +1633,7 @@ default:err_print("! Double @ should be used in limbo"); } /*:100*//*103:*/ -#line 1549 "ctangle.w" +#line 1543 "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 ee3f9199681..309f4387a9a 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.w +++ b/Build/source/texk/web2c/cwebdir/ctangle.w @@ -247,13 +247,10 @@ sixteen_bits x) @** Stacks for output. The output process uses a stack to keep track of what is going on at different ``levels'' as the sections are being -written out. Entries on this stack have five parts: +written out. Entries on this stack have four parts: -\yskip\hang |end_field| is the |tok_mem| location where the replacement -text of a particular level will end; - -\hang |byte_field| is the |tok_mem| location from which the next token -on a particular level will be read; +\yskip\hang |byte_field| is the |tok_mem| location from which the next +token on a particular level will be read; \hang |name_field| points to the name corresponding to a particular level; @@ -262,10 +259,10 @@ at a particular level; \hang |section_field| is the section number, or zero if this is a macro. -\yskip\noindent The current values of these five quantities are referred to -quite frequently, so they are stored in a separate place instead of in -the |stack| array. We call the current values |cur_end|, |cur_byte|, -|cur_name|, |cur_repl|, and |cur_section|. +\yskip\noindent The current values of these four quantities are referred to +quite frequently, so they are stored in an extra slot at the very end of the +|stack| array. We call the current values |cur_byte|, |cur_name|, |cur_repl|, +and |cur_section|. The global variable |stack_ptr| tells how many levels of output are currently in progress. The end of all output occurs when the stack is @@ -273,7 +270,6 @@ empty, i.e., when |stack_ptr==stack|. @<Typed...@>= typedef struct { - eight_bits *end_field; /* ending location of replacement text */ eight_bits *byte_field; /* present location within replacement text */ name_pointer name_field; /* |byte_start| index for text being output */ text_pointer repl_field; /* |tok_start| index for text being output */ @@ -282,16 +278,16 @@ typedef struct { typedef output_state *stack_pointer; @ @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_state stack[stack_size+1] /* |cur_byte|, |cur_name|, |cur_repl|, + and |cur_section| */ @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 */ @d cur_section cur_state.section_field /* current section number being expanded */ +@d cur_end (cur_repl+1)->tok_start /* current ending location in |tok_mem| */ @<Private...@>= -static output_state cur_state; /* |cur_end|, |cur_byte|, |cur_name|, |cur_repl|, - and |cur_section| */ -static output_state stack[stack_size+1]; /* info for non-current levels */ +static output_state stack[stack_size+2]; /* info for non-current levels */ static stack_pointer stack_end=stack+stack_size; /* end of |stack| */ static stack_pointer stack_ptr; /* first unused location in the output state stack */ @@ -303,7 +299,7 @@ error message will have been generated before we do any of the initialization. @<Initialize the output stacks@>= 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; +cur_byte=cur_repl->tok_start; cur_section=0; @ When the replacement text for name |p| is to be inserted into the output, the following subroutine is called to save the old level of output and get @@ -322,8 +318,7 @@ name_pointer p) stack_ptr++; if (p!=NULL) { /* |p==NULL| means we are in |output_defs| */ cur_name=p; cur_repl=(text_pointer)p->equiv; - cur_byte=cur_repl->tok_start; cur_end=(cur_repl+1)->tok_start; - cur_section=0; + cur_byte=cur_repl->tok_start; cur_section=0; } } @@ -342,8 +337,7 @@ boolean flag) /* |flag==false| means we are in |output_defs| */ { if (flag && cur_repl->text_link<section_flag) { /* link to a continuation */ cur_repl=cur_repl->text_link+text_info; /* stay on the same level */ - cur_byte=cur_repl->tok_start; cur_end=(cur_repl+1)->tok_start; - return; + cur_byte=cur_repl->tok_start; return; } stack_ptr--; /* go down to the previous level */ if (stack_ptr>stack) cur_state=*stack_ptr; @@ -574,7 +568,6 @@ for (an_output_file=end_output_files; an_output_file>cur_out_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(); } @@ -596,6 +589,8 @@ static void out_char(eight_bits); @ @d C_printf(c,a) fprintf(C_file,c,a) @d C_putc(c) putc((int)(c),C_file) /* isn't \CEE/ wonderfully consistent? */ +@# +@d macro_end (cur_text+1)->tok_start /* end of |macro| replacement text */ @c static void @@ -606,13 +601,12 @@ output_defs(void) for (cur_text=text_info+1; cur_text<text_ptr; cur_text++) if (cur_text->text_link==macro) { /* |cur_text| is the text for a |macro| */ cur_byte=cur_text->tok_start; - cur_end=(cur_text+1)->tok_start; C_printf("%s","#define "); out_state=normal; protect=true; /* newlines should be preceded by |'\\'| */ - while (cur_byte<cur_end) { + while (cur_byte<macro_end) { a=*cur_byte++; - if (cur_byte==cur_end && a=='\n') break; /* disregard a final newline */ + if (cur_byte==macro_end && a=='\n') break; /* disregard a final newline */ if (out_state==verbatim && a!=string && a!=constant && a!='\n') C_putc(a); /* a high-bit character can occur in a string */ @^high-bit character handling@> diff --git a/Build/source/texk/web2c/cwebdir/cweave.w b/Build/source/texk/web2c/cwebdir/cweave.w index 61fdc0a0889..59aa484cce4 100644 --- a/Build/source/texk/web2c/cwebdir/cweave.w +++ b/Build/source/texk/web2c/cwebdir/cweave.w @@ -3754,8 +3754,8 @@ on a particular level will be read; \yskip\hang |mode_field| is the current mode, either |inner| or |outer|. \yskip\noindent The current values of these quantities are referred to -quite frequently, so they are stored in a separate place instead of in the -|stack| array. We call the current values |cur_end|, |cur_tok|, and +quite frequently, so they are stored in an extra slot at the very end of +the |stack| array. We call the current values |cur_end|, |cur_tok|, and |cur_mode|. The global variable |stack_ptr| tells how many levels of output are @@ -3763,10 +3763,10 @@ currently in progress. The end of output occurs when an |end_translation| token is found, so the stack is never empty except when we first begin the output process. -@d inner false /* value of |mode| for \CEE/ texts within \TEX/ texts */ -@d outer true /* value of |mode| for \CEE/ texts in sections */ +@d inner false /* mode value for \CEE/ texts within \TEX/ texts */ +@d outer true /* mode value for \CEE/ texts in sections */ -@<Typed...@>= typedef int mode; +@<Typed...@>= typedef struct { token_pointer end_field; /* ending location of token list */ token_pointer tok_field; /* present location within token list */ @@ -3775,14 +3775,14 @@ typedef struct { typedef output_state *stack_pointer; @ @d stack_size 2000 /* number of simultaneous output levels */ +@d cur_state stack[stack_size] /* |cur_end|, |cur_tok|, |cur_mode| */ @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 */ @<Private...@>= -static output_state cur_state; /* |cur_end|, |cur_tok|, |cur_mode| */ -static output_state stack[stack_size]; /* info for non-current levels */ +static output_state stack[stack_size+1]; /* info for non-current levels */ static stack_pointer stack_end=stack+stack_size-1; /* end of |stack| */ static stack_pointer stack_ptr; /* first unused location in the output state stack */ static stack_pointer max_stack_ptr; /* largest value assumed by |stack_ptr| */ |