diff options
author | Andreas Scherer <andreas_tex@freenet.de> | 2023-08-07 10:44:48 +0000 |
---|---|---|
committer | Andreas Scherer <andreas_tex@freenet.de> | 2023-08-07 10:44:48 +0000 |
commit | 37c1807d8ef20c6ab0bd4428e81cb4bc6244a429 (patch) | |
tree | 65748dee0cf7af78924fae217197253a390f0dd4 /Build | |
parent | 86964436a7cf7951a9f792964f82053774ded229 (diff) |
[CWEB] Code cleanup in COMMON and CTANGLE.
git-svn-id: svn://tug.org/texlive/trunk@67830 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/web2c/ctangleboot.cin | 394 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebboot.cin | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ChangeLog | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/common.c | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/common.w | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctang-w2c.ch | 12 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctangle.c | 192 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctangle.w | 26 |
8 files changed, 317 insertions, 333 deletions
diff --git a/Build/source/texk/web2c/ctangleboot.cin b/Build/source/texk/web2c/ctangleboot.cin index e614b2b5c95..19333f7898a 100644 --- a/Build/source/texk/web2c/ctangleboot.cin +++ b/Build/source/texk/web2c/ctangleboot.cin @@ -282,7 +282,7 @@ extern FILE*active_file; extern FILE*check_file; /*:16*//*116:*/ -#line 553 "cwebdir/ctang-w2c.ch" +#line 549 "cwebdir/ctang-w2c.ch" extern char cb_banner[]; @@ -355,33 +355,33 @@ static char cur_section_name_char; static char output_file_name[longest_name+1]; /*:45*//*52:*/ -#line 579 "cwebdir/ctangle.w" +#line 573 "cwebdir/ctangle.w" static boolean output_defs_seen= false; /*:52*//*57:*/ -#line 693 "cwebdir/ctangle.w" +#line 687 "cwebdir/ctangle.w" static char translit[0200][translit_length]; /*:57*//*62:*/ -#line 769 "cwebdir/ctangle.w" +#line 763 "cwebdir/ctangle.w" static eight_bits ccode[256]; /*:62*//*66:*/ -#line 829 "cwebdir/ctangle.w" +#line 823 "cwebdir/ctangle.w" static boolean comment_continues= false; /*:66*//*68:*/ -#line 866 "cwebdir/ctangle.w" +#line 860 "cwebdir/ctangle.w" static name_pointer cur_section_name; static boolean no_where; /*:68*//*82:*/ -#line 1183 "cwebdir/ctangle.w" +#line 1177 "cwebdir/ctangle.w" static text_pointer cur_text; static eight_bits next_control; @@ -445,39 +445,39 @@ static void get_output(void); static void flush_buffer(void); /*:44*//*49:*/ -#line 547 "cwebdir/ctangle.w" +#line 541 "cwebdir/ctangle.w" static void phase_two(void); /*:49*//*53:*/ -#line 582 "cwebdir/ctangle.w" +#line 576 "cwebdir/ctangle.w" static void output_defs(void); static void out_char(eight_bits); /*:53*//*65:*/ -#line 809 "cwebdir/ctangle.w" +#line 803 "cwebdir/ctangle.w" static eight_bits skip_ahead(void); static boolean skip_comment(boolean); /*:65*//*70:*/ -#line 916 "cwebdir/ctangle.w" +#line 910 "cwebdir/ctangle.w" static eight_bits get_next(void); /*:70*//*84:*/ -#line 1209 "cwebdir/ctangle.w" +#line 1203 "cwebdir/ctangle.w" static void scan_repl(eight_bits); /*:84*//*91:*/ -#line 1401 "cwebdir/ctangle.w" +#line 1395 "cwebdir/ctangle.w" static void scan_section(void); /*:91*//*99:*/ -#line 1478 "cwebdir/ctangle.w" +#line 1472 "cwebdir/ctangle.w" static void phase_one(void); /*:99*//*101:*/ -#line 1511 "cwebdir/ctangle.w" +#line 1505 "cwebdir/ctangle.w" static void skip_limbo(void); /*:101*/ @@ -515,16 +515,16 @@ last_unnamed= text_info;text_info->text_link= macro; cur_out_file= end_output_files= output_files+max_files; /*:46*//*58:*/ -#line 696 "cwebdir/ctangle.w" +#line 690 "cwebdir/ctangle.w" {int i; for(i= 0;i<0200;i++) snprintf(translit[i],translit_length,"X%02X",(unsigned int)(0200+i)); } -#line 178 "cwebdir/ctang-w2c.ch" +#line 174 "cwebdir/ctang-w2c.ch" /*:58*//*63:*/ -#line 772 "cwebdir/ctangle.w" +#line 766 "cwebdir/ctangle.w" { int c; for(c= 0;c<256;c++)ccode[c]= ignore; @@ -544,11 +544,11 @@ ccode['<']= ccode['(']= section_name; ccode['\'']= ord; /*:63*//*78:*/ -#line 1104 "cwebdir/ctangle.w" +#line 1098 "cwebdir/ctangle.w" section_text[0]= ' '; /*:78*//*117:*/ -#line 556 "cwebdir/ctang-w2c.ch" +#line 552 "cwebdir/ctang-w2c.ch" strncpy(cb_banner,banner,max_banner-1); @@ -716,7 +716,7 @@ cur_byte= cur_repl->tok_start;cur_section= 0; #line 515 "cwebdir/ctangle.w" /*51:*/ -#line 575 "cwebdir/ctangle.w" +#line 569 "cwebdir/ctangle.w" if(!output_defs_seen) output_defs(); @@ -731,38 +731,30 @@ fputs(_("\n! No program text was specified."),stdout);mark_harmless(); } else{ -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 525 "cwebdir/ctangle.w" -update_terminal(); -} -} -else{ if(show_progress){ -#line 109 "cwebdir/ctang-w2c.ch" -fputs(_("\nWriting the output files:"),stdout); -#line 531 "cwebdir/ctangle.w" +printf(cur_out_file==end_output_files? +#line 104 "cwebdir/ctang-w2c.ch" +_("\nWriting the output file (%s):"): +_("\nWriting the output files: (%s)"),C_file_name); +#line 526 "cwebdir/ctangle.w" -printf(" (%s)",C_file_name); update_terminal(); } -if(text_info->text_link==macro)goto writeloop; -} +if(text_info->text_link!=macro){ while(stack_ptr> stack)get_output(); flush_buffer(); -writeloop:/*50:*/ -#line 137 "cwebdir/ctang-w2c.ch" +} +/*50:*/ +#line 133 "cwebdir/ctang-w2c.ch" if(check_for_change){ fclose(C_file);C_file= NULL; /*106:*/ -#line 436 "cwebdir/ctang-w2c.ch" +#line 432 "cwebdir/ctang-w2c.ch" if((C_file= fopen(C_file_name,"r"))!=NULL){ /*107:*/ -#line 443 "cwebdir/ctang-w2c.ch" +#line 439 "cwebdir/ctang-w2c.ch" boolean comparison= false; @@ -771,7 +763,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*108:*/ -#line 457 "cwebdir/ctang-w2c.ch" +#line 453 "cwebdir/ctang-w2c.ch" do{ char x[BUFSIZ],y[BUFSIZ]; @@ -781,17 +773,17 @@ comparison= (x_size==y_size)&&!memcmp(x,y,x_size); }while(comparison&&!feof(C_file)&&!feof(check_file)); /*:108*/ -#line 450 "cwebdir/ctang-w2c.ch" +#line 446 "cwebdir/ctang-w2c.ch" fclose(C_file);C_file= NULL; fclose(check_file);check_file= NULL; /*:107*/ -#line 438 "cwebdir/ctang-w2c.ch" +#line 434 "cwebdir/ctang-w2c.ch" /*109:*/ -#line 468 "cwebdir/ctang-w2c.ch" +#line 464 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -801,20 +793,20 @@ rename(check_file_name,C_file_name); } /*:109*/ -#line 439 "cwebdir/ctang-w2c.ch" +#line 435 "cwebdir/ctang-w2c.ch" }else rename(check_file_name,C_file_name); /*:106*/ -#line 140 "cwebdir/ctang-w2c.ch" +#line 136 "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 427 "cwebdir/ctang-w2c.ch" +#line 423 "cwebdir/ctang-w2c.ch" { if((C_file= fopen(output_file_name,"a"))==NULL) fatal(_("! Cannot open output file "),output_file_name); @@ -825,7 +817,7 @@ fatal(_("! Cannot open output file "),check_file_name); } /*:105*/ -#line 145 "cwebdir/ctang-w2c.ch" +#line 141 "cwebdir/ctang-w2c.ch" else{ fclose(C_file); @@ -844,14 +836,14 @@ flush_buffer(); if(check_for_change){ fclose(C_file);C_file= NULL; /*110:*/ -#line 481 "cwebdir/ctang-w2c.ch" +#line 477 "cwebdir/ctang-w2c.ch" if(0==strcmp("/dev/stdout",output_file_name)) /*112:*/ -#line 508 "cwebdir/ctang-w2c.ch" +#line 504 "cwebdir/ctang-w2c.ch" { /*115:*/ -#line 539 "cwebdir/ctang-w2c.ch" +#line 535 "cwebdir/ctang-w2c.ch" char in_buf[BUFSIZ+1]; int in_size; @@ -861,7 +853,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*:115*/ -#line 509 "cwebdir/ctang-w2c.ch" +#line 505 "cwebdir/ctang-w2c.ch" do{ in_size= fread(in_buf,sizeof(char),BUFSIZ,check_file); @@ -870,7 +862,7 @@ fprintf(stdout,"%s",in_buf); }while(!feof(check_file)); fclose(check_file);check_file= NULL; /*111:*/ -#line 498 "cwebdir/ctang-w2c.ch" +#line 494 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -880,19 +872,19 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 516 "cwebdir/ctang-w2c.ch" +#line 512 "cwebdir/ctang-w2c.ch" } /*:112*/ -#line 483 "cwebdir/ctang-w2c.ch" +#line 479 "cwebdir/ctang-w2c.ch" else if(0==strcmp("/dev/stderr",output_file_name)) /*113:*/ -#line 521 "cwebdir/ctang-w2c.ch" +#line 517 "cwebdir/ctang-w2c.ch" { /*115:*/ -#line 539 "cwebdir/ctang-w2c.ch" +#line 535 "cwebdir/ctang-w2c.ch" char in_buf[BUFSIZ+1]; int in_size; @@ -902,7 +894,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*:115*/ -#line 522 "cwebdir/ctang-w2c.ch" +#line 518 "cwebdir/ctang-w2c.ch" do{ in_size= fread(in_buf,sizeof(char),BUFSIZ,check_file); @@ -911,7 +903,7 @@ fprintf(stderr,"%s",in_buf); }while(!feof(check_file)); fclose(check_file);check_file= NULL; /*111:*/ -#line 498 "cwebdir/ctang-w2c.ch" +#line 494 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -921,20 +913,20 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 529 "cwebdir/ctang-w2c.ch" +#line 525 "cwebdir/ctang-w2c.ch" } /*:113*/ -#line 485 "cwebdir/ctang-w2c.ch" +#line 481 "cwebdir/ctang-w2c.ch" else if(0==strcmp("/dev/null",output_file_name)) /*114:*/ -#line 534 "cwebdir/ctang-w2c.ch" +#line 530 "cwebdir/ctang-w2c.ch" { boolean comparison= true; /*111:*/ -#line 498 "cwebdir/ctang-w2c.ch" +#line 494 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -944,17 +936,17 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 536 "cwebdir/ctang-w2c.ch" +#line 532 "cwebdir/ctang-w2c.ch" } /*:114*/ -#line 487 "cwebdir/ctang-w2c.ch" +#line 483 "cwebdir/ctang-w2c.ch" else{ if((C_file= fopen(output_file_name,"r"))!=NULL){ /*107:*/ -#line 443 "cwebdir/ctang-w2c.ch" +#line 439 "cwebdir/ctang-w2c.ch" boolean comparison= false; @@ -963,7 +955,7 @@ fatal(_("! Cannot open output file "),check_file_name); /*108:*/ -#line 457 "cwebdir/ctang-w2c.ch" +#line 453 "cwebdir/ctang-w2c.ch" do{ char x[BUFSIZ],y[BUFSIZ]; @@ -973,17 +965,17 @@ comparison= (x_size==y_size)&&!memcmp(x,y,x_size); }while(comparison&&!feof(C_file)&&!feof(check_file)); /*:108*/ -#line 450 "cwebdir/ctang-w2c.ch" +#line 446 "cwebdir/ctang-w2c.ch" fclose(C_file);C_file= NULL; fclose(check_file);check_file= NULL; /*:107*/ -#line 490 "cwebdir/ctang-w2c.ch" +#line 486 "cwebdir/ctang-w2c.ch" /*111:*/ -#line 498 "cwebdir/ctang-w2c.ch" +#line 494 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -993,35 +985,35 @@ rename(check_file_name,output_file_name); } /*:111*/ -#line 491 "cwebdir/ctang-w2c.ch" +#line 487 "cwebdir/ctang-w2c.ch" }else rename(check_file_name,output_file_name); } /*:110*/ -#line 162 "cwebdir/ctang-w2c.ch" +#line 158 "cwebdir/ctang-w2c.ch" } } if(check_for_change) strcpy(check_file_name,""); -#line 570 "cwebdir/ctangle.w" +#line 564 "cwebdir/ctangle.w" /*:50*/ -#line 539 "cwebdir/ctangle.w" +#line 533 "cwebdir/ctangle.w" if(show_happiness){ if(show_progress)new_line(); -#line 115 "cwebdir/ctang-w2c.ch" +#line 111 "cwebdir/ctang-w2c.ch" fputs(_("Done."),stdout); -#line 543 "cwebdir/ctangle.w" +#line 537 "cwebdir/ctangle.w" } } } /*:48*//*54:*/ -#line 591 "cwebdir/ctangle.w" +#line 585 "cwebdir/ctangle.w" static void output_defs(void) @@ -1046,9 +1038,9 @@ a= (a-0200)*0400+*cur_byte++; if(a<024000){ cur_val= (int)a;out_char(identifier); } -#line 172 "cwebdir/ctang-w2c.ch" +#line 168 "cwebdir/ctang-w2c.ch" else if(a<050000)confusion(_("macro defs have strange char")); -#line 616 "cwebdir/ctangle.w" +#line 610 "cwebdir/ctangle.w" else{ cur_val= (int)a-050000;cur_section= (sixteen_bits)cur_val; out_char(section_number); @@ -1063,7 +1055,7 @@ pop_level(false); } /*:54*//*55:*/ -#line 634 "cwebdir/ctangle.w" +#line 628 "cwebdir/ctangle.w" static void out_char( @@ -1076,14 +1068,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 204 "cwebdir/ctang-w2c.ch" +#line 200 "cwebdir/ctang-w2c.ch" -#line 703 "cwebdir/ctangle.w" +#line 697 "cwebdir/ctangle.w" case identifier: if(out_state==num_or_id)C_putc(' '); for(j= (cur_val+name_dir)->byte_start; j<(cur_val+name_dir+1)->byte_start;j++) -#line 212 "cwebdir/ctang-w2c.ch" +#line 208 "cwebdir/ctang-w2c.ch" if(ishigh(*j)){ if(transliterate_utf_eight){ @@ -1094,14 +1086,14 @@ else if((eight_bits)(*j)>=0300)j+= 1; C_printf("%s",translit[(eight_bits)(*j)-0200]); } else C_putc(*j); -#line 710 "cwebdir/ctangle.w" +#line 704 "cwebdir/ctangle.w" out_state= num_or_id;break; /*:59*/ -#line 645 "cwebdir/ctangle.w" +#line 639 "cwebdir/ctangle.w" /*60:*/ -#line 712 "cwebdir/ctangle.w" +#line 706 "cwebdir/ctangle.w" case section_number: if(cur_val> 0)C_printf("/*%d:*/",cur_val); @@ -1128,10 +1120,10 @@ C_putc('"');C_putc('\n'); break; /*:60*/ -#line 646 "cwebdir/ctangle.w" +#line 640 "cwebdir/ctangle.w" /*56:*/ -#line 664 "cwebdir/ctangle.w" +#line 658 "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; @@ -1152,7 +1144,7 @@ case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal; break; /*:56*/ -#line 647 "cwebdir/ctangle.w" +#line 641 "cwebdir/ctangle.w" case'=':case'>':C_putc(cur_char);C_putc(' '); out_state= normal;break; @@ -1171,7 +1163,7 @@ default:C_putc(cur_char);out_state= normal;break; } /*:55*//*64:*/ -#line 793 "cwebdir/ctangle.w" +#line 787 "cwebdir/ctangle.w" static eight_bits skip_ahead(void) @@ -1189,7 +1181,7 @@ if(c!=ignore||*(loc-1)=='>')return c; } /*:64*//*67:*/ -#line 832 "cwebdir/ctangle.w" +#line 826 "cwebdir/ctangle.w" static boolean skip_comment( boolean is_long_comment) @@ -1200,9 +1192,9 @@ if(loc> limit){ if(is_long_comment){ if(get_line())return comment_continues= true; else{ -#line 227 "cwebdir/ctang-w2c.ch" +#line 223 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in mid-comment")); -#line 843 "cwebdir/ctangle.w" +#line 837 "cwebdir/ctangle.w" return comment_continues= false; } @@ -1215,9 +1207,9 @@ loc++;return comment_continues= false; } if(c=='@'){ if(ccode[(eight_bits)*loc]==new_section){ -#line 233 "cwebdir/ctang-w2c.ch" +#line 229 "cwebdir/ctang-w2c.ch" err_print(_("! Section name ended in mid-comment"));loc--; -#line 856 "cwebdir/ctangle.w" +#line 850 "cwebdir/ctangle.w" return comment_continues= false; } @@ -1227,7 +1219,7 @@ else loc++; } /*:67*//*69:*/ -#line 873 "cwebdir/ctangle.w" +#line 867 "cwebdir/ctangle.w" static eight_bits get_next(void) @@ -1241,7 +1233,7 @@ if(get_line()==false)return new_section; else if(print_where&&!no_where){ print_where= false; /*85:*/ -#line 1219 "cwebdir/ctangle.w" +#line 1213 "cwebdir/ctangle.w" { eight_bits a; @@ -1258,7 +1250,7 @@ store_id(a); } /*:85*/ -#line 885 "cwebdir/ctangle.w" +#line 879 "cwebdir/ctangle.w" } else return(eight_bits)'\n'; @@ -1271,7 +1263,7 @@ else continue; } loc++; if(xisdigit(c)||c=='.')/*73:*/ -#line 957 "cwebdir/ctangle.w" +#line 951 "cwebdir/ctangle.w" { boolean hex_flag= false; id_first= loc-1; @@ -1305,13 +1297,13 @@ return constant; } /*:73*/ -#line 896 "cwebdir/ctangle.w" +#line 890 "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 994 "cwebdir/ctangle.w" +#line 988 "cwebdir/ctangle.w" { char delim= (char)c; id_first= section_text+1; @@ -1323,15 +1315,15 @@ delim= *loc++;*++id_loc= delim; while(true){ if(loc>=limit){ if(*(limit-1)!='\\'){ -#line 239 "cwebdir/ctang-w2c.ch" +#line 235 "cwebdir/ctang-w2c.ch" err_print(_("! String didn't end"));loc= limit;break; -#line 1006 "cwebdir/ctangle.w" +#line 1000 "cwebdir/ctangle.w" } if(get_line()==false){ -#line 245 "cwebdir/ctang-w2c.ch" +#line 241 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in middle of string"));loc= buffer;break; -#line 1010 "cwebdir/ctangle.w" +#line 1004 "cwebdir/ctangle.w" } else if(++id_loc<=section_text_end)*id_loc= '\n'; @@ -1349,9 +1341,9 @@ c= (eight_bits)*loc++; if(++id_loc<=section_text_end)*id_loc= (char)c; } if(id_loc>=section_text_end){ -#line 251 "cwebdir/ctang-w2c.ch" +#line 247 "cwebdir/ctang-w2c.ch" fputs(_("\n! String too long: "),stdout); -#line 1028 "cwebdir/ctangle.w" +#line 1022 "cwebdir/ctangle.w" term_write(section_text+1,25); err_print("..."); @@ -1361,11 +1353,11 @@ return string; } /*:74*/ -#line 900 "cwebdir/ctangle.w" +#line 894 "cwebdir/ctangle.w" else if(isalpha((int)c)||isxalpha(c)||ishigh(c)) /*72:*/ -#line 948 "cwebdir/ctangle.w" +#line 942 "cwebdir/ctangle.w" { id_first= --loc; do @@ -1376,45 +1368,45 @@ id_loc= loc;return identifier; } /*:72*/ -#line 902 "cwebdir/ctangle.w" +#line 896 "cwebdir/ctangle.w" else if(c=='@')/*75:*/ -#line 1039 "cwebdir/ctangle.w" +#line 1033 "cwebdir/ctangle.w" switch(c= ccode[(eight_bits)*loc++]){ case ignore:continue; -#line 257 "cwebdir/ctang-w2c.ch" +#line 253 "cwebdir/ctang-w2c.ch" case translit_code:err_print(_("! Use @l in limbo only"));continue; -#line 1043 "cwebdir/ctangle.w" +#line 1037 "cwebdir/ctangle.w" case control_text:while((c= skip_ahead())=='@'); if(*(loc-1)!='>') -#line 263 "cwebdir/ctang-w2c.ch" +#line 259 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in control text")); -#line 1048 "cwebdir/ctangle.w" +#line 1042 "cwebdir/ctangle.w" continue; case section_name: cur_section_name_char= *(loc-1); /*77:*/ -#line 1084 "cwebdir/ctangle.w" +#line 1078 "cwebdir/ctangle.w" { char*k= section_text; /*79:*/ -#line 1106 "cwebdir/ctangle.w" +#line 1100 "cwebdir/ctangle.w" while(true){ if(loc> limit&&get_line()==false){ -#line 281 "cwebdir/ctang-w2c.ch" +#line 277 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in section name")); -#line 1110 "cwebdir/ctangle.w" +#line 1104 "cwebdir/ctangle.w" loc= buffer+1;break; } c= (eight_bits)*loc; /*80:*/ -#line 1129 "cwebdir/ctangle.w" +#line 1123 "cwebdir/ctangle.w" if(c=='@'){ c= (eight_bits)*(loc+1); @@ -1422,22 +1414,22 @@ if(c=='>'){ loc+= 2;break; } if(ccode[(eight_bits)c]==new_section){ -#line 293 "cwebdir/ctang-w2c.ch" +#line 289 "cwebdir/ctang-w2c.ch" err_print(_("! Section name didn't end"));break; -#line 1137 "cwebdir/ctangle.w" +#line 1131 "cwebdir/ctangle.w" } if(ccode[(eight_bits)c]==section_name){ -#line 299 "cwebdir/ctang-w2c.ch" +#line 295 "cwebdir/ctang-w2c.ch" err_print(_("! Nesting of section names not allowed"));break; -#line 1141 "cwebdir/ctangle.w" +#line 1135 "cwebdir/ctangle.w" } *(++k)= '@';loc++; } /*:80*/ -#line 1114 "cwebdir/ctangle.w" +#line 1108 "cwebdir/ctangle.w" loc++;if(k<section_text_end)k++; if(xisspace(c)){ @@ -1446,9 +1438,9 @@ c= (eight_bits)' ';if(*(k-1)==' ')k--; *k= (char)c; } if(k>=section_text_end){ -#line 287 "cwebdir/ctang-w2c.ch" +#line 283 "cwebdir/ctang-w2c.ch" fputs(_("\n! Section name too long: "),stdout); -#line 1123 "cwebdir/ctangle.w" +#line 1117 "cwebdir/ctangle.w" term_write(section_text+1,25); printf("...");mark_harmless(); @@ -1456,7 +1448,7 @@ printf("...");mark_harmless(); if(*k==' '&&k> section_text)k--; /*:79*/ -#line 1086 "cwebdir/ctangle.w" +#line 1080 "cwebdir/ctangle.w" if(k-section_text> 3&&strncmp(k-2,"...",3)==0) cur_section_name= section_lookup(section_text+1,k-3,true); @@ -1481,31 +1473,31 @@ else overflow(_("output files")); } /*:47*/ -#line 1094 "cwebdir/ctangle.w" +#line 1088 "cwebdir/ctangle.w" return section_name; } /*:77*/ -#line 1052 "cwebdir/ctangle.w" +#line 1046 "cwebdir/ctangle.w" case string:/*81:*/ -#line 1151 "cwebdir/ctangle.w" +#line 1145 "cwebdir/ctangle.w" id_first= loc++;*(limit+1)= '@';*(limit+2)= '>'; while(*loc!='@'||*(loc+1)!='>')loc++; -#line 305 "cwebdir/ctang-w2c.ch" +#line 301 "cwebdir/ctang-w2c.ch" if(loc>=limit)err_print(_("! Verbatim string didn't end")); -#line 1155 "cwebdir/ctangle.w" +#line 1149 "cwebdir/ctangle.w" id_loc= loc;loc+= 2; return string; /*:81*/ -#line 1053 "cwebdir/ctangle.w" +#line 1047 "cwebdir/ctangle.w" case ord:/*76:*/ -#line 1064 "cwebdir/ctangle.w" +#line 1058 "cwebdir/ctangle.w" id_first= loc; if(*loc=='\\') @@ -1513,17 +1505,17 @@ if(*++loc=='\'')loc++; while(*loc!='\''){ if(*loc=='@'){ if(*(loc+1)!='@') -#line 269 "cwebdir/ctang-w2c.ch" +#line 265 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in ASCII constant")); -#line 1072 "cwebdir/ctangle.w" +#line 1066 "cwebdir/ctangle.w" else loc++; } loc++; if(loc> limit){ -#line 275 "cwebdir/ctang-w2c.ch" +#line 271 "cwebdir/ctang-w2c.ch" err_print(_("! String didn't end"));loc= limit-1;break; -#line 1078 "cwebdir/ctangle.w" +#line 1072 "cwebdir/ctangle.w" } } @@ -1531,13 +1523,13 @@ loc++; return ord; /*:76*/ -#line 1054 "cwebdir/ctangle.w" +#line 1048 "cwebdir/ctangle.w" default:return c; } /*:75*/ -#line 903 "cwebdir/ctangle.w" +#line 897 "cwebdir/ctangle.w" else if(xisspace(c)){ if(!preprocessing||loc> limit)continue; @@ -1547,7 +1539,7 @@ else return(eight_bits)' '; } else if(c=='#'&&loc==buffer+1)preprocessing= true; mistake:/*71:*/ -#line 925 "cwebdir/ctangle.w" +#line 919 "cwebdir/ctangle.w" switch(c){ case'+':if(*loc=='+')compress(plus_plus);break; @@ -1572,14 +1564,14 @@ case'!':if(*loc=='=')compress(non_eq);break; } /*:71*/ -#line 911 "cwebdir/ctangle.w" +#line 905 "cwebdir/ctangle.w" return c; } } /*:69*//*83:*/ -#line 1187 "cwebdir/ctangle.w" +#line 1181 "cwebdir/ctangle.w" static void scan_repl( @@ -1587,7 +1579,7 @@ eight_bits t) { sixteen_bits a; if(t==section_name)/*85:*/ -#line 1219 "cwebdir/ctangle.w" +#line 1213 "cwebdir/ctangle.w" { eight_bits a; @@ -1604,11 +1596,11 @@ store_id(a); } /*:85*/ -#line 1193 "cwebdir/ctangle.w" +#line 1187 "cwebdir/ctangle.w" while(true)switch(a= get_next()){ /*86:*/ -#line 1234 "cwebdir/ctangle.w" +#line 1228 "cwebdir/ctangle.w" case identifier:store_id(a); if(*buffer=='#'&&( @@ -1621,28 +1613,28 @@ break; case section_name:if(t!=section_name)goto done; else{ /*87:*/ -#line 1275 "cwebdir/ctangle.w" +#line 1269 "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 341 "cwebdir/ctang-w2c.ch" +#line 337 "cwebdir/ctang-w2c.ch" if(*try_loc=='=')err_print(_("! Missing `@ ' before a named section")); -#line 1281 "cwebdir/ctangle.w" +#line 1275 "cwebdir/ctangle.w" } /*:87*/ -#line 1245 "cwebdir/ctangle.w" +#line 1239 "cwebdir/ctangle.w" a= cur_section_name-name_dir; app_repl((a/0400)+0250); app_repl(a%0400); /*85:*/ -#line 1219 "cwebdir/ctangle.w" +#line 1213 "cwebdir/ctangle.w" { eight_bits a; @@ -1659,13 +1651,13 @@ store_id(a); } /*:85*/ -#line 1249 "cwebdir/ctangle.w" +#line 1243 "cwebdir/ctangle.w" } break; -#line 329 "cwebdir/ctang-w2c.ch" +#line 325 "cwebdir/ctang-w2c.ch" case output_defs_code:if(t!=section_name)err_print(_("! Misplaced @h")); -#line 1253 "cwebdir/ctangle.w" +#line 1247 "cwebdir/ctangle.w" else{ output_defs_seen= true; @@ -1673,7 +1665,7 @@ a= output_defs_flag; app_repl((a/0400)+0200); app_repl(a%0400); /*85:*/ -#line 1219 "cwebdir/ctangle.w" +#line 1213 "cwebdir/ctangle.w" { eight_bits a; @@ -1690,21 +1682,21 @@ store_id(a); } /*:85*/ -#line 1259 "cwebdir/ctangle.w" +#line 1253 "cwebdir/ctangle.w" } break; case constant:case string: /*88:*/ -#line 1292 "cwebdir/ctangle.w" +#line 1286 "cwebdir/ctangle.w" app_repl(a); while(id_first<id_loc){ if(*id_first=='@'){ if(*(id_first+1)=='@')id_first++; -#line 347 "cwebdir/ctang-w2c.ch" +#line 343 "cwebdir/ctang-w2c.ch" else err_print(_("! Double @ should be used in string")); -#line 1298 "cwebdir/ctangle.w" +#line 1292 "cwebdir/ctangle.w" } else if(a==constant&&*id_first=='\''&&!keep_digit_separators) @@ -1714,12 +1706,12 @@ app_repl(*id_first++); app_repl(a); /*:88*/ -#line 1263 "cwebdir/ctangle.w" +#line 1257 "cwebdir/ctangle.w" break; case ord: /*89:*/ -#line 1310 "cwebdir/ctangle.w" +#line 1304 "cwebdir/ctangle.w" { int c= (int)((eight_bits)*id_first); if(c=='\\'){ @@ -1756,9 +1748,9 @@ break; case'\\':c= '\\';break; case'\'':c= '\'';break; case'\"':c= '\"';break; -#line 353 "cwebdir/ctang-w2c.ch" +#line 349 "cwebdir/ctang-w2c.ch" default:err_print(_("! Unrecognized escape sequence")); -#line 1347 "cwebdir/ctangle.w" +#line 1341 "cwebdir/ctangle.w" } } @@ -1771,20 +1763,20 @@ app_repl(constant); } /*:89*/ -#line 1266 "cwebdir/ctangle.w" +#line 1260 "cwebdir/ctangle.w" break; case definition:case format_code:case begin_C:if(t!=section_name)goto done; else{ -#line 335 "cwebdir/ctang-w2c.ch" +#line 331 "cwebdir/ctang-w2c.ch" err_print(_("! @d, @f and @c are ignored in C text"));continue; -#line 1271 "cwebdir/ctangle.w" +#line 1265 "cwebdir/ctangle.w" } case new_section:goto done; /*:86*/ -#line 1198 "cwebdir/ctangle.w" +#line 1192 "cwebdir/ctangle.w" case')':app_repl(a); if(t==macro)app_repl(' '); @@ -1792,14 +1784,14 @@ break; default:app_repl(a); } done:next_control= (eight_bits)a; -#line 323 "cwebdir/ctang-w2c.ch" +#line 319 "cwebdir/ctang-w2c.ch" if(text_ptr> text_info_end)overflow(_("text")); -#line 1206 "cwebdir/ctangle.w" +#line 1200 "cwebdir/ctangle.w" cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; } /*:83*//*90:*/ -#line 1368 "cwebdir/ctangle.w" +#line 1362 "cwebdir/ctangle.w" static void scan_section(void) @@ -1814,7 +1806,7 @@ printf("*%d",(int)section_count);update_terminal(); next_control= ignore; while(true){ /*92:*/ -#line 1409 "cwebdir/ctangle.w" +#line 1403 "cwebdir/ctangle.w" while(next_control<definition) @@ -1823,17 +1815,17 @@ loc-= 2;next_control= get_next(); } /*:92*/ -#line 1382 "cwebdir/ctangle.w" +#line 1376 "cwebdir/ctangle.w" if(next_control==definition){ /*93:*/ -#line 1416 "cwebdir/ctangle.w" +#line 1410 "cwebdir/ctangle.w" while((next_control= get_next())=='\n'); if(next_control!=identifier){ -#line 359 "cwebdir/ctang-w2c.ch" +#line 355 "cwebdir/ctang-w2c.ch" err_print(_("! Definition flushed, must start with identifier")); -#line 1420 "cwebdir/ctangle.w" +#line 1414 "cwebdir/ctangle.w" continue; } @@ -1845,7 +1837,7 @@ scan_repl(macro); cur_text->text_link= macro; /*:93*/ -#line 1384 "cwebdir/ctangle.w" +#line 1378 "cwebdir/ctangle.w" continue; } @@ -1855,14 +1847,14 @@ p= name_dir;break; if(next_control==section_name){ p= cur_section_name; /*94:*/ -#line 1438 "cwebdir/ctangle.w" +#line 1432 "cwebdir/ctangle.w" while((next_control= get_next())=='+'); if(next_control!='='&&next_control!=eq_eq) continue; /*:94*/ -#line 1392 "cwebdir/ctangle.w" +#line 1386 "cwebdir/ctangle.w" break; } @@ -1870,20 +1862,20 @@ return; } no_where= print_where= false; /*95:*/ -#line 1443 "cwebdir/ctangle.w" +#line 1437 "cwebdir/ctangle.w" /*96:*/ -#line 1448 "cwebdir/ctangle.w" +#line 1442 "cwebdir/ctangle.w" store_two_bytes((sixteen_bits)(0150000+section_count)); /*:96*/ -#line 1444 "cwebdir/ctangle.w" +#line 1438 "cwebdir/ctangle.w" scan_repl(section_name); /*97:*/ -#line 1452 "cwebdir/ctangle.w" +#line 1446 "cwebdir/ctangle.w" if(p==name_dir||p==NULL){ last_unnamed->text_link= cur_text-text_info;last_unnamed= cur_text; @@ -1900,16 +1892,16 @@ cur_text->text_link= section_flag; /*:97*/ -#line 1446 "cwebdir/ctangle.w" +#line 1440 "cwebdir/ctangle.w" /*:95*/ -#line 1398 "cwebdir/ctangle.w" +#line 1392 "cwebdir/ctangle.w" } /*:90*//*98:*/ -#line 1467 "cwebdir/ctangle.w" +#line 1461 "cwebdir/ctangle.w" static void phase_one(void){ @@ -1922,7 +1914,7 @@ check_complete(); } /*:98*//*100:*/ -#line 1483 "cwebdir/ctangle.w" +#line 1477 "cwebdir/ctangle.w" static void skip_limbo(void) @@ -1936,15 +1928,15 @@ char c= *loc++; switch(ccode[(eight_bits)c]){ case new_section:return; case translit_code:/*102:*/ -#line 1513 "cwebdir/ctangle.w" +#line 1507 "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 379 "cwebdir/ctang-w2c.ch" +#line 375 "cwebdir/ctang-w2c.ch" err_print(_("! Improper hex number following @l")); -#line 1519 "cwebdir/ctangle.w" +#line 1513 "cwebdir/ctangle.w" else{ unsigned int i; @@ -1954,9 +1946,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 385 "cwebdir/ctang-w2c.ch" +#line 381 "cwebdir/ctang-w2c.ch" err_print(_("! Replacement string in @l too long")); -#line 1529 "cwebdir/ctangle.w" +#line 1523 "cwebdir/ctangle.w" else{ strncpy(translit[i-0200],beg,(size_t)(loc-beg)); @@ -1965,21 +1957,21 @@ translit[i-0200][loc-beg]= '\0'; } /*:102*/ -#line 1495 "cwebdir/ctangle.w" +#line 1489 "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 365 "cwebdir/ctang-w2c.ch" +#line 361 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in control text")); -#line 1501 "cwebdir/ctangle.w" +#line 1495 "cwebdir/ctangle.w" break; -#line 372 "cwebdir/ctang-w2c.ch" +#line 368 "cwebdir/ctang-w2c.ch" }/* otherwise fall through */ default:err_print(_("! Double @ should be used in limbo")); -#line 1505 "cwebdir/ctangle.w" +#line 1499 "cwebdir/ctangle.w" } } @@ -1987,11 +1979,11 @@ default:err_print(_("! Double @ should be used in limbo")); } /*:100*//*103:*/ -#line 1539 "cwebdir/ctangle.w" +#line 1533 "cwebdir/ctangle.w" void print_stats(void){ -#line 398 "cwebdir/ctang-w2c.ch" +#line 394 "cwebdir/ctang-w2c.ch" puts(_("\nMemory usage statistics:")); printf(_("%td names (out of %ld)\n"), (ptrdiff_t)(name_ptr-name_dir),(long)max_names); @@ -2000,9 +1992,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 1550 "cwebdir/ctangle.w" +#line 1544 "cwebdir/ctangle.w" (ptrdiff_t)(tok_ptr-tok_mem),(long)max_toks); } -#line 411 "cwebdir/ctang-w2c.ch" +#line 407 "cwebdir/ctang-w2c.ch" /*:103*/ diff --git a/Build/source/texk/web2c/cwebboot.cin b/Build/source/texk/web2c/cwebboot.cin index e579678f617..fcd319d8df7 100644 --- a/Build/source/texk/web2c/cwebboot.cin +++ b/Build/source/texk/web2c/cwebboot.cin @@ -726,17 +726,17 @@ change_limit= change_buffer;changing= false; return; } if(limit> buffer+1&&buffer[0]=='@'){ -char xyz_code= xisupper(buffer[1])?tolower((int)buffer[1]):buffer[1]; +if(xisupper(buffer[1]))buffer[1]= tolower((int)buffer[1]); /*34:*/ #line 336 "cwebdir/common.w" -if(xyz_code=='x'||xyz_code=='z'){ +if(buffer[1]=='x'||buffer[1]=='z'){ #line 134 "cwebdir/comm-w2c.ch" loc= buffer+2;err_print(_("! Where is the matching @y?")); #line 339 "cwebdir/common.w" } -else if(xyz_code=='y'){ +else if(buffer[1]=='y'){ if(n> 0){ loc= buffer+2; printf("\n! Hmm... %d ",n); diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index 0926728bbde..586756acc43 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -1,3 +1,11 @@ +2023-08-07 Andreas Scherer <https://ascherer.github.io> + + * common.c, + * common.w, + * ctang-w2c.ch, + * ctangle.c, + * ctangle.w: Code cleanup. + 2023-08-06 Andreas Scherer <https://ascherer.github.io> * ctwill-hint.ch, diff --git a/Build/source/texk/web2c/cwebdir/common.c b/Build/source/texk/web2c/cwebdir/common.c index 05e8b9cb90b..797cda58ea7 100644 --- a/Build/source/texk/web2c/cwebdir/common.c +++ b/Build/source/texk/web2c/cwebdir/common.c @@ -546,15 +546,15 @@ change_limit= change_buffer;changing= false; return; } if(limit> buffer+1&&buffer[0]=='@'){ -char xyz_code= xisupper(buffer[1])?tolower((int)buffer[1]):buffer[1]; +if(xisupper(buffer[1]))buffer[1]= tolower((int)buffer[1]); /*34:*/ #line 336 "common.w" -if(xyz_code=='x'||xyz_code=='z'){ +if(buffer[1]=='x'||buffer[1]=='z'){ loc= buffer+2;err_print("! Where is the matching @y?"); } -else if(xyz_code=='y'){ +else if(buffer[1]=='y'){ if(n> 0){ loc= buffer+2; printf("\n! Hmm... %d ",n); diff --git a/Build/source/texk/web2c/cwebdir/common.w b/Build/source/texk/web2c/cwebdir/common.w index f3f22834853..83e37c14ac8 100644 --- a/Build/source/texk/web2c/cwebdir/common.w +++ b/Build/source/texk/web2c/cwebdir/common.w @@ -313,7 +313,7 @@ check_change(void) /* switches to |change_file| if the buffers match */ return; } if (limit>buffer+1 && buffer[0]=='@@') { - char xyz_code=xisupper(buffer[1])? tolower((int)buffer[1]): buffer[1]; + if (xisupper(buffer[1])) buffer[1]=tolower((int)buffer[1]); @<If the current line starts with \.{@@y}, report any discrepancies and |return|@>@; } @@ -334,11 +334,11 @@ check_change(void) /* switches to |change_file| if the buffers match */ @ @<Predecl...@>=@+static void check_change(void); @ @<If the current line starts with \.{@@y}...@>= -if (xyz_code=='x' || xyz_code=='z') { +if (buffer[1]=='x' || buffer[1]=='z') { loc=buffer+2; err_print("! Where is the matching @@y?"); @.Where is the match...@> } -else if (xyz_code=='y') { +else if (buffer[1]=='y') { if (n>0) { loc=buffer+2; printf("\n! Hmm... %d ",n); diff --git a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch index c8fd9a39d8c..464a0a25a63 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch @@ -98,15 +98,11 @@ @z @x - printf("\nWriting the output file (%s):",C_file_name); + "\nWriting the output file (%s):" : @| + "\nWriting the output files: (%s)",C_file_name); @y - printf(_("\nWriting the output file (%s):"),C_file_name); -@z - -@x - fputs("\nWriting the output files:",stdout); -@y - fputs(_("\nWriting the output files:"),stdout); + _("\nWriting the output file (%s):") : @| + _("\nWriting the output files: (%s)"),C_file_name); @z @x diff --git a/Build/source/texk/web2c/cwebdir/ctangle.c b/Build/source/texk/web2c/cwebdir/ctangle.c index e742f5abfdc..a060e8f678c 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.c +++ b/Build/source/texk/web2c/cwebdir/ctangle.c @@ -325,33 +325,33 @@ static char cur_section_name_char; static char output_file_name[longest_name+1]; /*:45*//*52:*/ -#line 579 "ctangle.w" +#line 573 "ctangle.w" static boolean output_defs_seen= false; /*:52*//*57:*/ -#line 693 "ctangle.w" +#line 687 "ctangle.w" static char translit[0200][translit_length]; /*:57*//*62:*/ -#line 769 "ctangle.w" +#line 763 "ctangle.w" static eight_bits ccode[256]; /*:62*//*66:*/ -#line 829 "ctangle.w" +#line 823 "ctangle.w" static boolean comment_continues= false; /*:66*//*68:*/ -#line 866 "ctangle.w" +#line 860 "ctangle.w" static name_pointer cur_section_name; static boolean no_where; /*:68*//*82:*/ -#line 1183 "ctangle.w" +#line 1177 "ctangle.w" static text_pointer cur_text; static eight_bits next_control; @@ -413,39 +413,39 @@ static void get_output(void); static void flush_buffer(void); /*:44*//*49:*/ -#line 547 "ctangle.w" +#line 541 "ctangle.w" static void phase_two(void); /*:49*//*53:*/ -#line 582 "ctangle.w" +#line 576 "ctangle.w" static void output_defs(void); static void out_char(eight_bits); /*:53*//*65:*/ -#line 809 "ctangle.w" +#line 803 "ctangle.w" static eight_bits skip_ahead(void); static boolean skip_comment(boolean); /*:65*//*70:*/ -#line 916 "ctangle.w" +#line 910 "ctangle.w" static eight_bits get_next(void); /*:70*//*84:*/ -#line 1209 "ctangle.w" +#line 1203 "ctangle.w" static void scan_repl(eight_bits); /*:84*//*91:*/ -#line 1401 "ctangle.w" +#line 1395 "ctangle.w" static void scan_section(void); /*:91*//*99:*/ -#line 1478 "ctangle.w" +#line 1472 "ctangle.w" static void phase_one(void); /*:99*//*101:*/ -#line 1511 "ctangle.w" +#line 1505 "ctangle.w" static void skip_limbo(void); /*:101*/ @@ -483,7 +483,7 @@ last_unnamed= text_info;text_info->text_link= macro; cur_out_file= end_output_files= output_files+max_files; /*:46*//*58:*/ -#line 696 "ctangle.w" +#line 690 "ctangle.w" {int i; for(i= 0;i<0200;i++) @@ -491,7 +491,7 @@ snprintf(translit[i],translit_length,"X%02X",(unsigned int)(0200+i)); } /*:58*//*63:*/ -#line 772 "ctangle.w" +#line 766 "ctangle.w" { int c; for(c= 0;c<256;c++)ccode[c]= ignore; @@ -511,7 +511,7 @@ ccode['<']= ccode['(']= section_name; ccode['\'']= ord; /*:63*//*78:*/ -#line 1104 "ctangle.w" +#line 1098 "ctangle.w" section_text[0]= ' '; /*:78*/ @@ -670,7 +670,7 @@ cur_byte= cur_repl->tok_start;cur_section= 0; #line 515 "ctangle.w" /*51:*/ -#line 575 "ctangle.w" +#line 569 "ctangle.w" if(!output_defs_seen) output_defs(); @@ -683,25 +683,19 @@ fputs("\n! No program text was specified.",stdout);mark_harmless(); } else{ -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){ -fputs("\nWriting the output files:",stdout); +printf(cur_out_file==end_output_files? +"\nWriting the output file (%s):": +"\nWriting the output files: (%s)",C_file_name); -printf(" (%s)",C_file_name); update_terminal(); } -if(text_info->text_link==macro)goto writeloop; -} +if(text_info->text_link!=macro){ while(stack_ptr> stack)get_output(); flush_buffer(); -writeloop:/*50:*/ -#line 553 "ctangle.w" +} +/*50:*/ +#line 547 "ctangle.w" for(an_output_file= end_output_files;an_output_file> cur_out_file;){ an_output_file--; @@ -721,7 +715,7 @@ flush_buffer(); } /*:50*/ -#line 539 "ctangle.w" +#line 533 "ctangle.w" if(show_happiness){ if(show_progress)new_line(); @@ -731,7 +725,7 @@ fputs("Done.",stdout); } /*:48*//*54:*/ -#line 591 "ctangle.w" +#line 585 "ctangle.w" static void output_defs(void) @@ -771,7 +765,7 @@ pop_level(false); } /*:54*//*55:*/ -#line 634 "ctangle.w" +#line 628 "ctangle.w" static void out_char( @@ -784,7 +778,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 702 "ctangle.w" +#line 696 "ctangle.w" case identifier: if(out_state==num_or_id)C_putc(' '); @@ -796,10 +790,10 @@ else C_printf("%s",translit[(eight_bits)(*j)-0200]); out_state= num_or_id;break; /*:59*/ -#line 645 "ctangle.w" +#line 639 "ctangle.w" /*60:*/ -#line 712 "ctangle.w" +#line 706 "ctangle.w" case section_number: if(cur_val> 0)C_printf("/*%d:*/",cur_val); @@ -826,10 +820,10 @@ C_putc('"');C_putc('\n'); break; /*:60*/ -#line 646 "ctangle.w" +#line 640 "ctangle.w" /*56:*/ -#line 664 "ctangle.w" +#line 658 "ctangle.w" case plus_plus:C_putc('+');C_putc('+');out_state= normal;break; case minus_minus:C_putc('-');C_putc('-');out_state= normal;break; @@ -850,7 +844,7 @@ case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal; break; /*:56*/ -#line 647 "ctangle.w" +#line 641 "ctangle.w" case'=':case'>':C_putc(cur_char);C_putc(' '); out_state= normal;break; @@ -869,7 +863,7 @@ default:C_putc(cur_char);out_state= normal;break; } /*:55*//*64:*/ -#line 793 "ctangle.w" +#line 787 "ctangle.w" static eight_bits skip_ahead(void) @@ -887,7 +881,7 @@ if(c!=ignore||*(loc-1)=='>')return c; } /*:64*//*67:*/ -#line 832 "ctangle.w" +#line 826 "ctangle.w" static boolean skip_comment( boolean is_long_comment) @@ -921,7 +915,7 @@ else loc++; } /*:67*//*69:*/ -#line 873 "ctangle.w" +#line 867 "ctangle.w" static eight_bits get_next(void) @@ -935,7 +929,7 @@ if(get_line()==false)return new_section; else if(print_where&&!no_where){ print_where= false; /*85:*/ -#line 1219 "ctangle.w" +#line 1213 "ctangle.w" { eight_bits a; @@ -952,7 +946,7 @@ store_id(a); } /*:85*/ -#line 885 "ctangle.w" +#line 879 "ctangle.w" } else return(eight_bits)'\n'; @@ -965,7 +959,7 @@ else continue; } loc++; if(xisdigit(c)||c=='.')/*73:*/ -#line 957 "ctangle.w" +#line 951 "ctangle.w" { boolean hex_flag= false; id_first= loc-1; @@ -999,13 +993,13 @@ return constant; } /*:73*/ -#line 896 "ctangle.w" +#line 890 "ctangle.w" else if(c=='\''||c=='"' ||((c=='L'||c=='u'||c=='U')&&(*loc=='\''||*loc=='"')) ||((c=='u'&&*loc=='8')&&(*(loc+1)=='\''||*(loc+1)=='"'))) /*74:*/ -#line 994 "ctangle.w" +#line 988 "ctangle.w" { char delim= (char)c; id_first= section_text+1; @@ -1049,11 +1043,11 @@ return string; } /*:74*/ -#line 900 "ctangle.w" +#line 894 "ctangle.w" else if(isalpha((int)c)||isxalpha(c)||ishigh(c)) /*72:*/ -#line 948 "ctangle.w" +#line 942 "ctangle.w" { id_first= --loc; do @@ -1064,10 +1058,10 @@ id_loc= loc;return identifier; } /*:72*/ -#line 902 "ctangle.w" +#line 896 "ctangle.w" else if(c=='@')/*75:*/ -#line 1039 "ctangle.w" +#line 1033 "ctangle.w" switch(c= ccode[(eight_bits)*loc++]){ case ignore:continue; @@ -1082,11 +1076,11 @@ continue; case section_name: cur_section_name_char= *(loc-1); /*77:*/ -#line 1084 "ctangle.w" +#line 1078 "ctangle.w" { char*k= section_text; /*79:*/ -#line 1106 "ctangle.w" +#line 1100 "ctangle.w" while(true){ if(loc> limit&&get_line()==false){ @@ -1096,7 +1090,7 @@ loc= buffer+1;break; } c= (eight_bits)*loc; /*80:*/ -#line 1129 "ctangle.w" +#line 1123 "ctangle.w" if(c=='@'){ c= (eight_bits)*(loc+1); @@ -1115,7 +1109,7 @@ err_print("! Nesting of section names not allowed");break; } /*:80*/ -#line 1114 "ctangle.w" +#line 1108 "ctangle.w" loc++;if(k<section_text_end)k++; if(xisspace(c)){ @@ -1132,7 +1126,7 @@ printf("...");mark_harmless(); if(*k==' '&&k> section_text)k--; /*:79*/ -#line 1086 "ctangle.w" +#line 1080 "ctangle.w" if(k-section_text> 3&&strncmp(k-2,"...",3)==0) cur_section_name= section_lookup(section_text+1,k-3,true); @@ -1155,16 +1149,16 @@ else overflow("output files"); } /*:47*/ -#line 1094 "ctangle.w" +#line 1088 "ctangle.w" return section_name; } /*:77*/ -#line 1052 "ctangle.w" +#line 1046 "ctangle.w" case string:/*81:*/ -#line 1151 "ctangle.w" +#line 1145 "ctangle.w" id_first= loc++;*(limit+1)= '@';*(limit+2)= '>'; while(*loc!='@'||*(loc+1)!='>')loc++; @@ -1174,10 +1168,10 @@ id_loc= loc;loc+= 2; return string; /*:81*/ -#line 1053 "ctangle.w" +#line 1047 "ctangle.w" case ord:/*76:*/ -#line 1064 "ctangle.w" +#line 1058 "ctangle.w" id_first= loc; if(*loc=='\\') @@ -1199,13 +1193,13 @@ loc++; return ord; /*:76*/ -#line 1054 "ctangle.w" +#line 1048 "ctangle.w" default:return c; } /*:75*/ -#line 903 "ctangle.w" +#line 897 "ctangle.w" else if(xisspace(c)){ if(!preprocessing||loc> limit)continue; @@ -1215,7 +1209,7 @@ else return(eight_bits)' '; } else if(c=='#'&&loc==buffer+1)preprocessing= true; mistake:/*71:*/ -#line 925 "ctangle.w" +#line 919 "ctangle.w" switch(c){ case'+':if(*loc=='+')compress(plus_plus);break; @@ -1240,14 +1234,14 @@ case'!':if(*loc=='=')compress(non_eq);break; } /*:71*/ -#line 911 "ctangle.w" +#line 905 "ctangle.w" return c; } } /*:69*//*83:*/ -#line 1187 "ctangle.w" +#line 1181 "ctangle.w" static void scan_repl( @@ -1255,7 +1249,7 @@ eight_bits t) { sixteen_bits a; if(t==section_name)/*85:*/ -#line 1219 "ctangle.w" +#line 1213 "ctangle.w" { eight_bits a; @@ -1272,11 +1266,11 @@ store_id(a); } /*:85*/ -#line 1193 "ctangle.w" +#line 1187 "ctangle.w" while(true)switch(a= get_next()){ /*86:*/ -#line 1234 "ctangle.w" +#line 1228 "ctangle.w" case identifier:store_id(a); if(*buffer=='#'&&( @@ -1289,7 +1283,7 @@ break; case section_name:if(t!=section_name)goto done; else{ /*87:*/ -#line 1275 "ctangle.w" +#line 1269 "ctangle.w" { char*try_loc= loc; while(*try_loc==' '&&try_loc<limit)try_loc++; @@ -1302,13 +1296,13 @@ if(*try_loc=='=')err_print("! Missing `@ ' before a named section"); } /*:87*/ -#line 1245 "ctangle.w" +#line 1239 "ctangle.w" a= cur_section_name-name_dir; app_repl((a/0400)+0250); app_repl(a%0400); /*85:*/ -#line 1219 "ctangle.w" +#line 1213 "ctangle.w" { eight_bits a; @@ -1325,7 +1319,7 @@ store_id(a); } /*:85*/ -#line 1249 "ctangle.w" +#line 1243 "ctangle.w" } break; @@ -1337,7 +1331,7 @@ a= output_defs_flag; app_repl((a/0400)+0200); app_repl(a%0400); /*85:*/ -#line 1219 "ctangle.w" +#line 1213 "ctangle.w" { eight_bits a; @@ -1354,13 +1348,13 @@ store_id(a); } /*:85*/ -#line 1259 "ctangle.w" +#line 1253 "ctangle.w" } break; case constant:case string: /*88:*/ -#line 1292 "ctangle.w" +#line 1286 "ctangle.w" app_repl(a); while(id_first<id_loc){ @@ -1376,12 +1370,12 @@ app_repl(*id_first++); app_repl(a); /*:88*/ -#line 1263 "ctangle.w" +#line 1257 "ctangle.w" break; case ord: /*89:*/ -#line 1310 "ctangle.w" +#line 1304 "ctangle.w" { int c= (int)((eight_bits)*id_first); if(c=='\\'){ @@ -1431,7 +1425,7 @@ app_repl(constant); } /*:89*/ -#line 1266 "ctangle.w" +#line 1260 "ctangle.w" break; case definition:case format_code:case begin_C:if(t!=section_name)goto done; @@ -1442,7 +1436,7 @@ err_print("! @d, @f and @c are ignored in C text");continue; case new_section:goto done; /*:86*/ -#line 1198 "ctangle.w" +#line 1192 "ctangle.w" case')':app_repl(a); if(t==macro)app_repl(' '); @@ -1455,7 +1449,7 @@ cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; } /*:83*//*90:*/ -#line 1368 "ctangle.w" +#line 1362 "ctangle.w" static void scan_section(void) @@ -1470,7 +1464,7 @@ printf("*%d",(int)section_count);update_terminal(); next_control= ignore; while(true){ /*92:*/ -#line 1409 "ctangle.w" +#line 1403 "ctangle.w" while(next_control<definition) @@ -1479,11 +1473,11 @@ loc-= 2;next_control= get_next(); } /*:92*/ -#line 1382 "ctangle.w" +#line 1376 "ctangle.w" if(next_control==definition){ /*93:*/ -#line 1416 "ctangle.w" +#line 1410 "ctangle.w" while((next_control= get_next())=='\n'); if(next_control!=identifier){ @@ -1499,7 +1493,7 @@ scan_repl(macro); cur_text->text_link= macro; /*:93*/ -#line 1384 "ctangle.w" +#line 1378 "ctangle.w" continue; } @@ -1509,14 +1503,14 @@ p= name_dir;break; if(next_control==section_name){ p= cur_section_name; /*94:*/ -#line 1438 "ctangle.w" +#line 1432 "ctangle.w" while((next_control= get_next())=='+'); if(next_control!='='&&next_control!=eq_eq) continue; /*:94*/ -#line 1392 "ctangle.w" +#line 1386 "ctangle.w" break; } @@ -1524,20 +1518,20 @@ return; } no_where= print_where= false; /*95:*/ -#line 1443 "ctangle.w" +#line 1437 "ctangle.w" /*96:*/ -#line 1448 "ctangle.w" +#line 1442 "ctangle.w" store_two_bytes((sixteen_bits)(0150000+section_count)); /*:96*/ -#line 1444 "ctangle.w" +#line 1438 "ctangle.w" scan_repl(section_name); /*97:*/ -#line 1452 "ctangle.w" +#line 1446 "ctangle.w" if(p==name_dir||p==NULL){ last_unnamed->text_link= cur_text-text_info;last_unnamed= cur_text; @@ -1554,16 +1548,16 @@ cur_text->text_link= section_flag; /*:97*/ -#line 1446 "ctangle.w" +#line 1440 "ctangle.w" /*:95*/ -#line 1398 "ctangle.w" +#line 1392 "ctangle.w" } /*:90*//*98:*/ -#line 1467 "ctangle.w" +#line 1461 "ctangle.w" static void phase_one(void){ @@ -1576,7 +1570,7 @@ check_complete(); } /*:98*//*100:*/ -#line 1483 "ctangle.w" +#line 1477 "ctangle.w" static void skip_limbo(void) @@ -1590,7 +1584,7 @@ char c= *loc++; switch(ccode[(eight_bits)c]){ case new_section:return; case translit_code:/*102:*/ -#line 1513 "ctangle.w" +#line 1507 "ctangle.w" while(xisspace(*loc)&&loc<limit)loc++; loc+= 3; @@ -1615,7 +1609,7 @@ translit[i-0200][loc-beg]= '\0'; } /*:102*/ -#line 1495 "ctangle.w" +#line 1489 "ctangle.w" break; case format_code:case'@':break; case control_text:if(c=='q'||c=='Q'){ @@ -1633,7 +1627,7 @@ default:err_print("! Double @ should be used in limbo"); } /*:100*//*103:*/ -#line 1539 "ctangle.w" +#line 1533 "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 dbdf94ec21d..304b704538e 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.w +++ b/Build/source/texk/web2c/cwebdir/ctangle.w @@ -519,24 +519,18 @@ phase_two (void) { @.No program text...@> } else { - 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) { - fputs("\nWriting the output files:",stdout); + if (show_progress) { + printf(cur_out_file==end_output_files ? @| + "\nWriting the output file (%s):" : @| + "\nWriting the output files: (%s)",C_file_name); @.Writing the output...@> - printf(" (%s)",C_file_name); - update_terminal(); - } - if (text_info->text_link==macro) goto writeloop; + update_terminal(); } - while (stack_ptr>stack) get_output(); - flush_buffer(); -writeloop: @<Write all the named output files@>@; + if (text_info->text_link!=macro) { + while (stack_ptr>stack) get_output(); + flush_buffer(); + } + @<Write all the named output files@>@; if (show_happiness) { if (show_progress) new_line(); fputs("Done.",stdout); |