diff options
author | Andreas Scherer <andreas_tex@freenet.de> | 2021-10-11 15:21:35 +0000 |
---|---|---|
committer | Andreas Scherer <andreas_tex@freenet.de> | 2021-10-11 15:21:35 +0000 |
commit | 885c6c0a19aea7e3583ab2c03916e1e0a4c04554 (patch) | |
tree | e9306a9299e79e1cae2a95a2ce8232876c70c062 /Build/source/texk/web2c/ctangleboot.cin | |
parent | 5a9a95dd3cc51469724c8b6f67d4d963ae05b0e5 (diff) |
[CWEB] Pre-release candidate 2 for CWEB 4.6.
When the CWEB programs are called with option '-c' (the default), no
intermediate output files are created at all. After thoroughly testing
these programs, I'll prepare the final release of CWEB 4.6 in the coming
weeks (months).
git-svn-id: svn://tug.org/texlive/trunk@60728 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/ctangleboot.cin')
-rw-r--r-- | Build/source/texk/web2c/ctangleboot.cin | 218 |
1 files changed, 119 insertions, 99 deletions
diff --git a/Build/source/texk/web2c/ctangleboot.cin b/Build/source/texk/web2c/ctangleboot.cin index 8ada08ca02e..291d08e358c 100644 --- a/Build/source/texk/web2c/ctangleboot.cin +++ b/Build/source/texk/web2c/ctangleboot.cin @@ -270,12 +270,12 @@ extern FILE*scn_file; extern FILE*active_file; extern FILE*check_file; -/*:15*//*115:*/ -#line 487 "cwebdir/ctang-w2c.ch" +/*:15*//*116:*/ +#line 504 "cwebdir/ctang-w2c.ch" extern char cb_banner[]; -/*:115*/ +/*:116*/ #line 69 "cwebdir/ctangle.w" /*19:*/ @@ -536,12 +536,12 @@ ccode['\'']= ord; #line 1114 "cwebdir/ctangle.w" section_text[0]= ' '; -/*:78*//*116:*/ -#line 490 "cwebdir/ctang-w2c.ch" +/*:78*//*117:*/ +#line 507 "cwebdir/ctang-w2c.ch" strncpy(cb_banner,banner,max_banner-1); -/*:116*/ +/*:117*/ #line 88 "cwebdir/ctangle.w" common_init(); @@ -748,13 +748,14 @@ flush_buffer(); writeloop:/*50:*/ #line 138 "cwebdir/ctang-w2c.ch" +if(check_for_change){ fclose(C_file);C_file= NULL; -/*105:*/ -#line 370 "cwebdir/ctang-w2c.ch" +/*106:*/ +#line 387 "cwebdir/ctang-w2c.ch" if((C_file= fopen(C_file_name,"r"))!=NULL){ -/*106:*/ -#line 377 "cwebdir/ctang-w2c.ch" +/*107:*/ +#line 394 "cwebdir/ctang-w2c.ch" boolean comparison= false; @@ -762,8 +763,8 @@ if((check_file= fopen(check_file_name,"r"))==NULL) fatal(_("! Cannot open output file "),check_file_name); -if(check_for_change)/*107:*/ -#line 391 "cwebdir/ctang-w2c.ch" +/*108:*/ +#line 408 "cwebdir/ctang-w2c.ch" do{ char x[BUFSIZ],y[BUFSIZ]; @@ -772,18 +773,18 @@ int y_size= fread(y,sizeof(char),BUFSIZ,check_file); comparison= (x_size==y_size)&&!memcmp(x,y,x_size); }while(comparison&&!feof(C_file)&&!feof(check_file)); -/*:107*/ -#line 384 "cwebdir/ctang-w2c.ch" +/*:108*/ +#line 401 "cwebdir/ctang-w2c.ch" fclose(C_file);C_file= NULL; fclose(check_file);check_file= NULL; -/*:106*/ -#line 372 "cwebdir/ctang-w2c.ch" +/*:107*/ +#line 389 "cwebdir/ctang-w2c.ch" -/*108:*/ -#line 402 "cwebdir/ctang-w2c.ch" +/*109:*/ +#line 419 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -792,24 +793,39 @@ remove(C_file_name); rename(check_file_name,C_file_name); } -/*:108*/ -#line 373 "cwebdir/ctang-w2c.ch" +/*:109*/ +#line 390 "cwebdir/ctang-w2c.ch" }else rename(check_file_name,C_file_name); -/*:105*/ -#line 140 "cwebdir/ctang-w2c.ch" +/*:106*/ +#line 141 "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 378 "cwebdir/ctang-w2c.ch" +{ if((C_file= fopen(output_file_name,"a"))==NULL) fatal(_("! Cannot open output file "),output_file_name); else fclose(C_file); if((C_file= fopen(check_file_name,"wb"))==NULL) fatal(_("! Cannot open output file "),check_file_name); +} + +/*:105*/ +#line 146 "cwebdir/ctang-w2c.ch" + +else{ +fclose(C_file); +if((C_file= fopen(output_file_name,"wb"))==NULL) +fatal(_("! Cannot open output file "),output_file_name); + +} if(show_progress){printf("\n(%s)",output_file_name);update_terminal;} cur_line= 1; stack_ptr= stack+1; @@ -818,16 +834,18 @@ cur_repl= (text_pointer)cur_name->equiv; cur_byte= cur_repl->tok_start; cur_end= (cur_repl+1)->tok_start; while(stack_ptr> stack)get_output(); -flush_buffer();fclose(C_file);C_file= NULL; -/*109:*/ -#line 415 "cwebdir/ctang-w2c.ch" +flush_buffer(); +if(check_for_change){ +fclose(C_file);C_file= NULL; +/*110:*/ +#line 432 "cwebdir/ctang-w2c.ch" if(0==strcmp("/dev/stdout",output_file_name)) -/*111:*/ -#line 442 "cwebdir/ctang-w2c.ch" +/*112:*/ +#line 459 "cwebdir/ctang-w2c.ch" { -/*114:*/ -#line 473 "cwebdir/ctang-w2c.ch" +/*115:*/ +#line 490 "cwebdir/ctang-w2c.ch" char in_buf[BUFSIZ+1]; int in_size; @@ -836,8 +854,8 @@ if((check_file= fopen(check_file_name,"r"))==NULL) fatal(_("! Cannot open output file "),check_file_name); -/*:114*/ -#line 443 "cwebdir/ctang-w2c.ch" +/*:115*/ +#line 460 "cwebdir/ctang-w2c.ch" do{ in_size= fread(in_buf,sizeof(char),BUFSIZ,check_file); @@ -845,8 +863,8 @@ in_buf[in_size]= '\0'; fprintf(stdout,"%s",in_buf); }while(!feof(check_file)); fclose(check_file);check_file= NULL; -/*110:*/ -#line 432 "cwebdir/ctang-w2c.ch" +/*111:*/ +#line 449 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -855,20 +873,20 @@ remove(output_file_name); rename(check_file_name,output_file_name); } -/*:110*/ -#line 450 "cwebdir/ctang-w2c.ch" +/*:111*/ +#line 467 "cwebdir/ctang-w2c.ch" } -/*:111*/ -#line 417 "cwebdir/ctang-w2c.ch" +/*:112*/ +#line 434 "cwebdir/ctang-w2c.ch" else if(0==strcmp("/dev/stderr",output_file_name)) -/*112:*/ -#line 455 "cwebdir/ctang-w2c.ch" +/*113:*/ +#line 472 "cwebdir/ctang-w2c.ch" { -/*114:*/ -#line 473 "cwebdir/ctang-w2c.ch" +/*115:*/ +#line 490 "cwebdir/ctang-w2c.ch" char in_buf[BUFSIZ+1]; int in_size; @@ -877,8 +895,8 @@ if((check_file= fopen(check_file_name,"r"))==NULL) fatal(_("! Cannot open output file "),check_file_name); -/*:114*/ -#line 456 "cwebdir/ctang-w2c.ch" +/*:115*/ +#line 473 "cwebdir/ctang-w2c.ch" do{ in_size= fread(in_buf,sizeof(char),BUFSIZ,check_file); @@ -886,8 +904,8 @@ in_buf[in_size]= '\0'; fprintf(stderr,"%s",in_buf); }while(!feof(check_file)); fclose(check_file);check_file= NULL; -/*110:*/ -#line 432 "cwebdir/ctang-w2c.ch" +/*111:*/ +#line 449 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -896,21 +914,21 @@ remove(output_file_name); rename(check_file_name,output_file_name); } -/*:110*/ -#line 463 "cwebdir/ctang-w2c.ch" +/*:111*/ +#line 480 "cwebdir/ctang-w2c.ch" } -/*:112*/ -#line 419 "cwebdir/ctang-w2c.ch" +/*:113*/ +#line 436 "cwebdir/ctang-w2c.ch" else if(0==strcmp("/dev/null",output_file_name)) -/*113:*/ -#line 468 "cwebdir/ctang-w2c.ch" +/*114:*/ +#line 485 "cwebdir/ctang-w2c.ch" { boolean comparison= true; -/*110:*/ -#line 432 "cwebdir/ctang-w2c.ch" +/*111:*/ +#line 449 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -919,18 +937,18 @@ remove(output_file_name); rename(check_file_name,output_file_name); } -/*:110*/ -#line 470 "cwebdir/ctang-w2c.ch" +/*:111*/ +#line 487 "cwebdir/ctang-w2c.ch" } -/*:113*/ -#line 421 "cwebdir/ctang-w2c.ch" +/*:114*/ +#line 438 "cwebdir/ctang-w2c.ch" else{ if((C_file= fopen(output_file_name,"r"))!=NULL){ -/*106:*/ -#line 377 "cwebdir/ctang-w2c.ch" +/*107:*/ +#line 394 "cwebdir/ctang-w2c.ch" boolean comparison= false; @@ -938,8 +956,8 @@ if((check_file= fopen(check_file_name,"r"))==NULL) fatal(_("! Cannot open output file "),check_file_name); -if(check_for_change)/*107:*/ -#line 391 "cwebdir/ctang-w2c.ch" +/*108:*/ +#line 408 "cwebdir/ctang-w2c.ch" do{ char x[BUFSIZ],y[BUFSIZ]; @@ -948,18 +966,18 @@ int y_size= fread(y,sizeof(char),BUFSIZ,check_file); comparison= (x_size==y_size)&&!memcmp(x,y,x_size); }while(comparison&&!feof(C_file)&&!feof(check_file)); -/*:107*/ -#line 384 "cwebdir/ctang-w2c.ch" +/*:108*/ +#line 401 "cwebdir/ctang-w2c.ch" fclose(C_file);C_file= NULL; fclose(check_file);check_file= NULL; -/*:106*/ -#line 424 "cwebdir/ctang-w2c.ch" +/*:107*/ +#line 441 "cwebdir/ctang-w2c.ch" -/*110:*/ -#line 432 "cwebdir/ctang-w2c.ch" +/*111:*/ +#line 449 "cwebdir/ctang-w2c.ch" if(comparison) remove(check_file_name); @@ -968,17 +986,19 @@ remove(output_file_name); rename(check_file_name,output_file_name); } -/*:110*/ -#line 425 "cwebdir/ctang-w2c.ch" +/*:111*/ +#line 442 "cwebdir/ctang-w2c.ch" }else rename(check_file_name,output_file_name); } -/*:109*/ -#line 159 "cwebdir/ctang-w2c.ch" +/*:110*/ +#line 164 "cwebdir/ctang-w2c.ch" } +} +if(check_for_change) strcpy(check_file_name,""); #line 581 "cwebdir/ctangle.w" @@ -1021,7 +1041,7 @@ a= (a-0200)*0400+*cur_byte++; if(a<024000){ cur_val= (int)a;out_char(identifier); } -#line 167 "cwebdir/ctang-w2c.ch" +#line 174 "cwebdir/ctang-w2c.ch" else if(a<050000)confusion(_("macro defs have strange char")); #line 626 "cwebdir/ctangle.w" else{ @@ -1165,7 +1185,7 @@ if(loc> limit){ if(is_long_comment){ if(get_line())return comment_continues= true; else{ -#line 173 "cwebdir/ctang-w2c.ch" +#line 180 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in mid-comment")); #line 853 "cwebdir/ctangle.w" @@ -1180,7 +1200,7 @@ loc++;return comment_continues= false; } if(c=='@'){ if(ccode[(eight_bits)*loc]==new_section){ -#line 179 "cwebdir/ctang-w2c.ch" +#line 186 "cwebdir/ctang-w2c.ch" err_print(_("! Section name ended in mid-comment"));loc--; #line 866 "cwebdir/ctangle.w" @@ -1288,13 +1308,13 @@ delim= *loc++;*++id_loc= delim; while(true){ if(loc>=limit){ if(*(limit-1)!='\\'){ -#line 185 "cwebdir/ctang-w2c.ch" +#line 192 "cwebdir/ctang-w2c.ch" err_print(_("! String didn't end"));loc= limit;break; #line 1016 "cwebdir/ctangle.w" } if(get_line()==false){ -#line 191 "cwebdir/ctang-w2c.ch" +#line 198 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in middle of string"));loc= buffer;break; #line 1020 "cwebdir/ctangle.w" @@ -1314,7 +1334,7 @@ c= (eight_bits)*loc++; if(++id_loc<=section_text_end)*id_loc= (char)c; } if(id_loc>=section_text_end){ -#line 197 "cwebdir/ctang-w2c.ch" +#line 204 "cwebdir/ctang-w2c.ch" fputs(_("\n! String too long: "),stdout); #line 1038 "cwebdir/ctangle.w" @@ -1348,14 +1368,14 @@ else if(c=='@')/*75:*/ switch(c= ccode[(eight_bits)*loc++]){ case ignore:continue; -#line 203 "cwebdir/ctang-w2c.ch" +#line 210 "cwebdir/ctang-w2c.ch" case translit_code:err_print(_("! Use @l in limbo only"));continue; #line 1053 "cwebdir/ctangle.w" case control_text:while((c= skip_ahead())=='@'); if(*(loc-1)!='>') -#line 209 "cwebdir/ctang-w2c.ch" +#line 216 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in control text")); #line 1058 "cwebdir/ctangle.w" @@ -1371,7 +1391,7 @@ char*k= section_text; while(true){ if(loc> limit&&get_line()==false){ -#line 227 "cwebdir/ctang-w2c.ch" +#line 234 "cwebdir/ctang-w2c.ch" err_print(_("! Input ended in section name")); #line 1120 "cwebdir/ctangle.w" @@ -1387,13 +1407,13 @@ if(c=='>'){ loc+= 2;break; } if(ccode[(eight_bits)c]==new_section){ -#line 239 "cwebdir/ctang-w2c.ch" +#line 246 "cwebdir/ctang-w2c.ch" err_print(_("! Section name didn't end"));break; #line 1147 "cwebdir/ctangle.w" } if(ccode[(eight_bits)c]==section_name){ -#line 245 "cwebdir/ctang-w2c.ch" +#line 252 "cwebdir/ctang-w2c.ch" err_print(_("! Nesting of section names not allowed"));break; #line 1151 "cwebdir/ctangle.w" @@ -1411,7 +1431,7 @@ c= (eight_bits)' ';if(*(k-1)==' ')k--; *k= (char)c; } if(k>=section_text_end){ -#line 233 "cwebdir/ctang-w2c.ch" +#line 240 "cwebdir/ctang-w2c.ch" fputs(_("\n! Section name too long: "),stdout); #line 1133 "cwebdir/ctangle.w" @@ -1459,7 +1479,7 @@ case string:/*81:*/ id_first= loc++;*(limit+1)= '@';*(limit+2)= '>'; while(*loc!='@'||*(loc+1)!='>')loc++; -#line 251 "cwebdir/ctang-w2c.ch" +#line 258 "cwebdir/ctang-w2c.ch" if(loc>=limit)err_print(_("! Verbatim string didn't end")); #line 1165 "cwebdir/ctangle.w" @@ -1478,7 +1498,7 @@ if(*++loc=='\'')loc++; while(*loc!='\''){ if(*loc=='@'){ if(*(loc+1)!='@') -#line 215 "cwebdir/ctang-w2c.ch" +#line 222 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in ASCII constant")); #line 1082 "cwebdir/ctangle.w" @@ -1486,7 +1506,7 @@ else loc++; } loc++; if(loc> limit){ -#line 221 "cwebdir/ctang-w2c.ch" +#line 228 "cwebdir/ctang-w2c.ch" err_print(_("! String didn't end"));loc= limit-1;break; #line 1088 "cwebdir/ctangle.w" @@ -1585,7 +1605,7 @@ 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 287 "cwebdir/ctang-w2c.ch" +#line 294 "cwebdir/ctang-w2c.ch" if(*try_loc=='=')err_print(_("! Missing `@ ' before a named section")); #line 1284 "cwebdir/ctangle.w" @@ -1621,7 +1641,7 @@ store_id(a); } break; -#line 275 "cwebdir/ctang-w2c.ch" +#line 282 "cwebdir/ctang-w2c.ch" case output_defs_code:if(t!=section_name)err_print(_("! Misplaced @h")); #line 1256 "cwebdir/ctangle.w" @@ -1660,7 +1680,7 @@ app_repl(a); while(id_first<id_loc){ if(*id_first=='@'){ if(*(id_first+1)=='@')id_first++; -#line 293 "cwebdir/ctang-w2c.ch" +#line 300 "cwebdir/ctang-w2c.ch" else err_print(_("! Double @ should be used in string")); #line 1301 "cwebdir/ctangle.w" @@ -1714,7 +1734,7 @@ break; case'\\':c= '\\';break; case'\'':c= '\'';break; case'\"':c= '\"';break; -#line 299 "cwebdir/ctang-w2c.ch" +#line 306 "cwebdir/ctang-w2c.ch" default:err_print(_("! Unrecognized escape sequence")); #line 1350 "cwebdir/ctangle.w" @@ -1734,7 +1754,7 @@ app_repl(constant); break; case definition:case format_code:case begin_C:if(t!=section_name)goto done; else{ -#line 281 "cwebdir/ctang-w2c.ch" +#line 288 "cwebdir/ctang-w2c.ch" err_print(_("! @d, @f and @c are ignored in C text"));continue; #line 1274 "cwebdir/ctangle.w" @@ -1750,7 +1770,7 @@ break; default:app_repl(a); } done:next_control= (eight_bits)a; -#line 269 "cwebdir/ctang-w2c.ch" +#line 276 "cwebdir/ctang-w2c.ch" if(text_ptr> text_info_end)overflow(_("text")); #line 1216 "cwebdir/ctangle.w" cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; @@ -1789,7 +1809,7 @@ if(next_control==definition){ while((next_control= get_next())=='\n'); if(next_control!=identifier){ -#line 305 "cwebdir/ctang-w2c.ch" +#line 312 "cwebdir/ctang-w2c.ch" err_print(_("! Definition flushed, must start with identifier")); #line 1423 "cwebdir/ctangle.w" @@ -1900,7 +1920,7 @@ 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 323 "cwebdir/ctang-w2c.ch" +#line 330 "cwebdir/ctang-w2c.ch" err_print(_("! Improper hex number following @l")); #line 1522 "cwebdir/ctangle.w" @@ -1912,7 +1932,7 @@ while(xisspace(*loc)&&loc<limit)loc++; beg= loc; while(loc<limit&&(xisalpha(*loc)||xisdigit(*loc)||*loc=='_'))loc++; if(loc-beg>=translit_length) -#line 329 "cwebdir/ctang-w2c.ch" +#line 336 "cwebdir/ctang-w2c.ch" err_print(_("! Replacement string in @l too long")); #line 1532 "cwebdir/ctangle.w" @@ -1929,13 +1949,13 @@ case format_code:case'@':break; case control_text:if(c=='q'||c=='Q'){ while((c= (char)skip_ahead())=='@'); if(*(loc-1)!='>') -#line 311 "cwebdir/ctang-w2c.ch" +#line 318 "cwebdir/ctang-w2c.ch" err_print(_("! Double @ should be used in control text")); #line 1504 "cwebdir/ctangle.w" break; } -#line 317 "cwebdir/ctang-w2c.ch" +#line 324 "cwebdir/ctang-w2c.ch" default:err_print(_("! Double @ should be used in limbo")); #line 1508 "cwebdir/ctangle.w" @@ -1949,7 +1969,7 @@ default:err_print(_("! Double @ should be used in limbo")); void print_stats(void){ -#line 342 "cwebdir/ctang-w2c.ch" +#line 349 "cwebdir/ctang-w2c.ch" puts(_("\nMemory usage statistics:")); printf(_("%td names (out of %ld)\n"), (ptrdiff_t)(name_ptr-name_dir),(long)max_names); @@ -1962,5 +1982,5 @@ printf(_("%td tokens (out of %ld)\n"), (ptrdiff_t)(tok_ptr-tok_mem),(long)max_toks); } -#line 355 "cwebdir/ctang-w2c.ch" +#line 362 "cwebdir/ctang-w2c.ch" /*:103*/ |