From 885c6c0a19aea7e3583ab2c03916e1e0a4c04554 Mon Sep 17 00:00:00 2001 From: Andreas Scherer Date: Mon, 11 Oct 2021 15:21:35 +0000 Subject: [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 --- Build/source/texk/web2c/ChangeLog | 5 + Build/source/texk/web2c/ctangleboot.cin | 218 ++++++++++++++------------ Build/source/texk/web2c/cwebboot.cin | 87 ++++++---- Build/source/texk/web2c/cwebdir/ChangeLog | 7 + Build/source/texk/web2c/cwebdir/comm-w2c.ch | 66 +++++--- Build/source/texk/web2c/cwebdir/ctang-w2c.ch | 71 +++++---- Build/source/texk/web2c/cwebdir/ctwill-w2c.ch | 25 +-- Build/source/texk/web2c/cwebdir/cweav-w2c.ch | 25 +-- 8 files changed, 299 insertions(+), 205 deletions(-) (limited to 'Build/source/texk') diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index ef1f540253c..2152cebc0ab 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,3 +1,8 @@ +2021-10-11 Andreas Scherer + + * ctangleboot.cin, + * cwebboot.cin: CWEB 4.6 pre-release RC2. + 2021-09-21 Karl Berry * ac/web2c.ac (kpse_tex_progs): include hitex, disabled by default. 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 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||!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=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*/ diff --git a/Build/source/texk/web2c/cwebboot.cin b/Build/source/texk/web2c/cwebboot.cin index 0e0dedba9f4..abf7dd7c338 100644 --- a/Build/source/texk/web2c/cwebboot.cin +++ b/Build/source/texk/web2c/cwebboot.cin @@ -22,8 +22,8 @@ #include #include -/*:3*//*89:*/ -#line 717 "cwebdir/comm-w2c.ch" +/*:3*//*91:*/ +#line 739 "cwebdir/comm-w2c.ch" #if HAVE_GETTEXT #include @@ -33,21 +33,21 @@ #define textdomain(a) "" #endif -/*:89*//*91:*/ -#line 764 "cwebdir/comm-w2c.ch" +/*:91*//*93:*/ +#line 786 "cwebdir/comm-w2c.ch" #include #include #include -/*:91*//*94:*/ -#line 801 "cwebdir/comm-w2c.ch" +/*:93*//*96:*/ +#line 823 "cwebdir/comm-w2c.ch" #define CWEB #include "help.h" -/*:94*/ +/*:96*/ #line 63 "cwebdir/common.w" #define _(s) gettext(s) \ @@ -395,13 +395,13 @@ char*found_filename; #line 601 "cwebdir/comm-w2c.ch" /*:83*//*86:*/ -#line 646 "cwebdir/comm-w2c.ch" +#line 629 "cwebdir/comm-w2c.ch" const char*use_language= ""; /*:86*//*87:*/ -#line 659 "cwebdir/comm-w2c.ch" +#line 642 "cwebdir/comm-w2c.ch" char cb_banner[max_banner]; string texmf_locale; @@ -476,13 +476,13 @@ static int section_name_cmp(char**,size_t,name_pointer); static void scan_args(void); #line 507 "cwebdir/comm-w2c.ch" -/*:76*//*96:*/ -#line 814 "cwebdir/comm-w2c.ch" +/*:76*//*98:*/ +#line 836 "cwebdir/comm-w2c.ch" static void cb_usage(const_string str); static void cb_usagehelp(const_string*message,const_string bug_email); -/*:96*/ +/*:98*/ #line 67 "cwebdir/common.w" @@ -509,17 +509,17 @@ for(h= hash;h<=hash_end;*h++= NULL); /*:47*/ #line 78 "cwebdir/comm-w2c.ch" -/*92:*/ -#line 776 "cwebdir/comm-w2c.ch" +/*94:*/ +#line 798 "cwebdir/comm-w2c.ch" kpse_set_program_name(argv[0],"cweb"); -/*:92*/ +/*:94*/ #line 79 "cwebdir/comm-w2c.ch" #line 85 "cwebdir/comm-w2c.ch" -/*90:*/ -#line 726 "cwebdir/comm-w2c.ch" +/*92:*/ +#line 748 "cwebdir/comm-w2c.ch" setlocale(LC_MESSAGES,setlocale(LC_CTYPE,"")); texmf_locale= kpse_var_expand("${TEXMFLOCALEDIR}"); @@ -534,7 +534,7 @@ free(texmf_locale); textdomain("cweb"); -/*:90*/ +/*:92*/ #line 85 "cwebdir/comm-w2c.ch" /*74:*/ @@ -553,6 +553,9 @@ make_xrefs= true; scan_args(); if(program==ctangle){ +if(check_for_change)/*88:*/ +#line 659 "cwebdir/comm-w2c.ch" +{ if((C_file= fopen(C_file_name,"a"))==NULL) fatal(_("! Cannot open output file "),C_file_name); @@ -565,11 +568,22 @@ else strcpy(dot_pos,".ttp"); } if((C_file= fopen(check_file_name,"wb"))==NULL) fatal(_("! Cannot open output file "),check_file_name); +} + +/*:88*/ +#line 604 "cwebdir/comm-w2c.ch" + +else if((C_file= fopen(C_file_name,"wb"))==NULL) +fatal(_("! Cannot open output file "),C_file_name); } else{ +if(check_for_change)/*89:*/ +#line 674 "cwebdir/comm-w2c.ch" +{ if((tex_file= fopen(tex_file_name,"a"))==NULL) fatal(_("! Cannot open output file "),tex_file_name); + else fclose(tex_file); strcpy(check_file_name,tex_file_name); if(check_file_name[0]!='\0'){ @@ -580,9 +594,16 @@ else strcpy(dot_pos,".wtp"); if((tex_file= fopen(check_file_name,"wb"))==NULL) fatal(_("! Cannot open output file "),check_file_name); } + +/*:89*/ +#line 610 "cwebdir/comm-w2c.ch" + +else if((tex_file= fopen(tex_file_name,"wb"))==NULL) +fatal(_("! Cannot open output file "),tex_file_name); +} #line 1287 "cwebdir/common.w" -#line 636 "cwebdir/comm-w2c.ch" +#line 619 "cwebdir/comm-w2c.ch" /*:84*/ #line 101 "cwebdir/common.w" @@ -1332,8 +1353,8 @@ puts(_("(That was a fatal error, my friend.)")); /*:69*/ #line 394 "cwebdir/comm-w2c.ch" -/*88:*/ -#line 670 "cwebdir/comm-w2c.ch" +/*90:*/ +#line 692 "cwebdir/comm-w2c.ch" if(C_file)fclose(C_file); if(tex_file)fclose(tex_file); @@ -1341,7 +1362,7 @@ if(check_file)fclose(check_file); if(strlen(check_file_name)) remove(check_file_name); -/*:88*/ +/*:90*/ #line 395 "cwebdir/comm-w2c.ch" #line 402 "cwebdir/comm-w2c.ch" @@ -1408,27 +1429,27 @@ if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*80:*/ { if(strcmp("-help",*argv)==0||strcmp("--help",*argv)==0) -/*95:*/ -#line 805 "cwebdir/comm-w2c.ch" +/*97:*/ +#line 827 "cwebdir/comm-w2c.ch" cb_usagehelp(program==ctangle?CTANGLEHELP: program==cweave?CWEAVEHELP:CTWILLHELP,NULL); -/*:95*/ +/*:97*/ #line 523 "cwebdir/comm-w2c.ch" if(strcmp("-version",*argv)==0||strcmp("--version",*argv)==0) -/*98:*/ -#line 853 "cwebdir/comm-w2c.ch" +/*100:*/ +#line 875 "cwebdir/comm-w2c.ch" printversionandexit(cb_banner, program==ctwill?"Donald E. Knuth":"Silvio Levy and Donald E. Knuth", NULL,"Contemporary development on https://github.com/ascherer/cweb.\n"); -/*:98*/ +/*:100*/ #line 526 "cwebdir/comm-w2c.ch" if(strcmp("-verbose",*argv)==0||strcmp("--verbose",*argv)==0) @@ -1594,8 +1615,8 @@ cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); } -/*:75*//*97:*/ -#line 818 "cwebdir/comm-w2c.ch" +/*:75*//*99:*/ +#line 840 "cwebdir/comm-w2c.ch" static void cb_usage(const_string str) { @@ -1628,8 +1649,8 @@ textdomain("cweb"); history= spotless;exit(wrap_up()); } -/*:97*//*99:*/ -#line 861 "cwebdir/comm-w2c.ch" +/*:99*//*101:*/ +#line 883 "cwebdir/comm-w2c.ch" void cb_show_banner(void) { @@ -1640,4 +1661,4 @@ textdomain("cweb"); } -/*:99*/ +/*:101*/ diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index fa004fb9664..1a2270214dd 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -1,3 +1,10 @@ +2021-10-11 Andreas Scherer + + * comm-w2c.ch, + * ctang-w2c.ch, + * ctwill-w2c.ch, + * cweav-w2c.ch: CWEB 4.6 pre-release RC2. + 2021-09-16 Andreas Scherer * comm-{bs,vms,w2c,w32}.ch, diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.ch b/Build/source/texk/web2c/cwebdir/comm-w2c.ch index 264d2b2f1e4..0bb4f8b70fc 100644 --- a/Build/source/texk/web2c/cwebdir/comm-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/comm-w2c.ch @@ -601,32 +601,15 @@ else { @ @= scan_args(); if (program==ctangle) { - if ((C_file=fopen(C_file_name,"a"))==NULL) + if (check_for_change) @@; + else if ((C_file=fopen(C_file_name,"wb"))==NULL) fatal(_("! Cannot open output file "), C_file_name); -@.Cannot open output file@> - else fclose(C_file); /* Test accessability */ - strcpy(check_file_name,C_file_name); - if(check_file_name[0]!='\0') { - char *dot_pos=strrchr(check_file_name,'.'); - if(dot_pos==NULL) strcat(check_file_name,".ttp"); - else strcpy(dot_pos,".ttp"); - } - if ((C_file=fopen(check_file_name,"wb"))==NULL) - fatal(_("! Cannot open output file "), check_file_name); @.Cannot open output file@> } else { - if ((tex_file=fopen(tex_file_name,"a"))==NULL) + if (check_for_change) @@; + else if ((tex_file=fopen(tex_file_name,"wb"))==NULL) fatal(_("! Cannot open output file "), tex_file_name); - else fclose(tex_file); /* Test accessability */ - strcpy(check_file_name,tex_file_name); - if(check_file_name[0]!='\0') { - char *dot_pos=strrchr(check_file_name,'.'); - if(dot_pos==NULL) strcat(check_file_name,".wtp"); - else strcpy(dot_pos,".wtp"); - } - if ((tex_file=fopen(check_file_name,"wb"))==NULL) - fatal(_("! Cannot open output file "), check_file_name); } @z @@ -664,7 +647,46 @@ string texmf_locale;@/ #endif char separators[]=SEPARATORS; -@* Temporary file output. Before we leave the program we have to make +@* Temporary file output. Most \CEE/ projects are controlled by a \.{Makefile} +that automatically takes care of the temporal dependecies between the different +source modules. It may be convenient that \.{CWEB} doesn't create new output +for all existing files, when there are only changes to some of them. Thus the +\.{make} process will only recompile those modules where necessary. You can +activate this feature with the `\.{+c}' command-line option. The idea and basic +implementation of this mechanism can be found in the program \.{NUWEB} by +Preston Briggs, to whom credit is due. + +@= { + if ((C_file=fopen(C_file_name,"a"))==NULL) + fatal(_("! Cannot open output file "), C_file_name); +@.Cannot open output file@> + else fclose(C_file); /* Test accessability */ + strcpy(check_file_name,C_file_name); + if(check_file_name[0]!='\0') { + char *dot_pos=strrchr(check_file_name,'.'); + if(dot_pos==NULL) strcat(check_file_name,".ttp"); + else strcpy(dot_pos,".ttp"); + } + if ((C_file=fopen(check_file_name,"wb"))==NULL) + fatal(_("! Cannot open output file "), check_file_name); +} + +@ @= { + if ((tex_file=fopen(tex_file_name,"a"))==NULL) + fatal(_("! Cannot open output file "), tex_file_name); +@.Cannot open output file@> + else fclose(tex_file); /* Test accessability */ + strcpy(check_file_name,tex_file_name); + if(check_file_name[0]!='\0') { + char *dot_pos=strrchr(check_file_name,'.'); + if(dot_pos==NULL) strcat(check_file_name,".wtp"); + else strcpy(dot_pos,".wtp"); + } + if ((tex_file=fopen(check_file_name,"wb"))==NULL) + fatal(_("! Cannot open output file "), check_file_name); +} + +@ Before we leave the program we have to make sure that the output files are correctly written. @= diff --git a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch index af21d211ce8..359f1eaa0b0 100644 --- a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch @@ -136,29 +136,36 @@ for (an_output_file=end_output_files; an_output_file>cur_out_file;) { } @y @= -fclose(C_file); C_file=NULL; -@@; +if (check_for_change) { + fclose(C_file); C_file=NULL; + @@; +} 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 ((C_file=fopen(output_file_name,"a"))==NULL) + an_output_file--; + sprint_section_name(output_file_name,*an_output_file); + if (check_for_change) @@; + else { + fclose(C_file); + if ((C_file=fopen(output_file_name,"wb"))==NULL) fatal(_("! Cannot open output file "),output_file_name); @.Cannot open output file@> - else fclose(C_file); /* Test accessability */ - if((C_file=fopen(check_file_name,"wb"))==NULL) - fatal(_("! Cannot open output file "),check_file_name); - if (show_progress) { printf("\n(%s)",output_file_name); update_terminal; } - cur_line=1; - stack_ptr=stack+1; - cur_name=*an_output_file; - cur_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; + } + if (show_progress) { printf("\n(%s)",output_file_name); update_terminal; } + cur_line=1; + stack_ptr=stack+1; + cur_name=*an_output_file; + cur_repl=(text_pointer)cur_name->equiv; + cur_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; @@; + } } -strcpy(check_file_name,""); /* We want to get rid of the temporary file */ +if (check_for_change) + strcpy(check_file_name,""); /* We want to get rid of the temporary file */ @z @x @@ -359,15 +366,25 @@ course of a quarter century. Care has been taken to keep the original section numbering intact, so this new material should nicely integrate with the original ``\&{104.~Index}.'' -@* Output file update. Most \CEE/ projects are controlled by a -\.{Makefile} that automatically takes care of the temporal dependecies -between the different source modules. It is suitable that \.{CWEB} doesn't -create new output for all existing files, when there are only changes to -some of them. Thus the \.{make} process will only recompile those modules -where necessary. The idea and basic implementation of this mechanism can -be found in the program \.{NUWEB} by Preston Briggs, to whom credit is due. +@* Output file update. Most \CEE/ projects are controlled by a \.{Makefile} +that automatically takes care of the temporal dependecies between the different +source modules. It may be convenient that \.{CWEB} doesn't create new output +for all existing files, when there are only changes to some of them. Thus the +\.{make} process will only recompile those modules where necessary. You can +activate this feature with the `\.{+c}' command-line option. The idea and basic +implementation of this mechanism can be found in the program \.{NUWEB} by +Preston Briggs, to whom credit is due. + +@= { + if ((C_file=fopen(output_file_name,"a"))==NULL) + fatal(_("! Cannot open output file "),output_file_name); +@.Cannot open output file@> + else fclose(C_file); /* Test accessability */ + if((C_file=fopen(check_file_name,"wb"))==NULL) + fatal(_("! Cannot open output file "),check_file_name); +} -@= +@ @= if((C_file=fopen(C_file_name,"r"))!=NULL) { @@; @@; @@ -381,7 +398,7 @@ if((C_file=fopen(C_file_name,"r"))!=NULL) { fatal(_("! Cannot open output file "),check_file_name); @.Cannot open output file@> - if (check_for_change) @@; + @@; fclose(C_file); C_file=NULL; fclose(check_file); check_file=NULL; diff --git a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch index 1add5c76364..d46f2d6eb33 100644 --- a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch @@ -1157,7 +1157,6 @@ if (no_xref) { finish_line(); out_str("\\end"); @.\\end@> - active_file=tex_file; } @z @@ -1194,8 +1193,8 @@ if (no_xref) { @y @.\\end@> } -finish_line(); fclose(active_file); active_file=NULL; -@@; +finish_line(); fclose(active_file); active_file=tex_file=NULL; +if (check_for_change) @@; @z @x @@ -1981,15 +1980,16 @@ a function block. @= order_decl_stmt=true; -@* Output file update. Most \CEE/ projects are controlled by a -\.{Makefile} that automatically takes care of the temporal dependecies -between the different source modules. It is suitable that \.{CWEB} doesn't -create new output for all existing files, when there are only changes to -some of them. Thus the \.{make} process will only recompile those modules -where necessary. The idea and basic implementation of this mechanism can -be found in the program \.{NUWEB} by Preston Briggs, to whom credit is due. +@* Output file update. Most \CEE/ projects are controlled by a \.{Makefile} +that automatically takes care of the temporal dependecies between the different +source modules. It may be convenient that \.{CWEB} doesn't create new output +for all existing files, when there are only changes to some of them. Thus the +\.{make} process will only recompile those modules where necessary. You can +activate this feature with the `\.{+c}' command-line option. The idea and basic +implementation of this mechanism can be found in the program \.{NUWEB} by +Preston Briggs, to whom credit is due. -@= +@= { if((tex_file=fopen(tex_file_name,"r"))!=NULL) { boolean comparison=false; @@ -1997,7 +1997,7 @@ if((tex_file=fopen(tex_file_name,"r"))!=NULL) { fatal(_("! Cannot open output file "),check_file_name); @.Cannot open output file@> - if (check_for_change) @@; + @@; fclose(tex_file); tex_file=NULL; fclose(check_file); check_file=NULL; @@ -2007,6 +2007,7 @@ if((tex_file=fopen(tex_file_name,"r"))!=NULL) { rename(check_file_name,tex_file_name); /* This was the first run */ strcpy(check_file_name,""); /* We want to get rid of the temporary file */ +} @ We hope that this runs fast on most systems. diff --git a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch index 6eb45064430..e0fabf749b1 100644 --- a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch @@ -558,7 +558,6 @@ if (no_xref) { finish_line(); out_str("\\end"); @.\\end@> - active_file=tex_file; } @z @@ -588,8 +587,8 @@ if (no_xref) { @y @.\\end@> } -finish_line(); fclose(active_file); active_file=NULL; -@@; +finish_line(); fclose(active_file); active_file=tex_file=NULL; +if (check_for_change) @@; @z @x @@ -678,15 +677,16 @@ a function block. @= order_decl_stmt=true; -@* Output file update. Most \CEE/ projects are controlled by a -\.{Makefile} that automatically takes care of the temporal dependecies -between the different source modules. It is suitable that \.{CWEB} doesn't -create new output for all existing files, when there are only changes to -some of them. Thus the \.{make} process will only recompile those modules -where necessary. The idea and basic implementation of this mechanism can -be found in the program \.{NUWEB} by Preston Briggs, to whom credit is due. +@* Output file update. Most \CEE/ projects are controlled by a \.{Makefile} +that automatically takes care of the temporal dependecies between the different +source modules. It may be convenient that \.{CWEB} doesn't create new output +for all existing files, when there are only changes to some of them. Thus the +\.{make} process will only recompile those modules where necessary. You can +activate this feature with the `\.{+c}' command-line option. The idea and basic +implementation of this mechanism can be found in the program \.{NUWEB} by +Preston Briggs, to whom credit is due. -@= +@= { if((tex_file=fopen(tex_file_name,"r"))!=NULL) { boolean comparison=false; @@ -694,7 +694,7 @@ if((tex_file=fopen(tex_file_name,"r"))!=NULL) { fatal(_("! Cannot open output file "),check_file_name); @.Cannot open output file@> - if (check_for_change) @@; + @@; fclose(tex_file); tex_file=NULL; fclose(check_file); check_file=NULL; @@ -704,6 +704,7 @@ if((tex_file=fopen(tex_file_name,"r"))!=NULL) { rename(check_file_name,tex_file_name); /* This was the first run */ strcpy(check_file_name,""); /* We want to get rid of the temporary file */ +} @ We hope that this runs fast on most systems. -- cgit v1.2.3