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/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 +++++----- 5 files changed, 121 insertions(+), 73 deletions(-) (limited to 'Build/source/texk/web2c/cwebdir') 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