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/cwebdir | |
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/cwebdir')
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/comm-w2c.ch | 66 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctang-w2c.ch | 71 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ctwill-w2c.ch | 25 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/cweav-w2c.ch | 25 |
5 files changed, 121 insertions, 73 deletions
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 <https://ascherer.github.io> + + * comm-w2c.ch, + * ctang-w2c.ch, + * ctwill-w2c.ch, + * cweav-w2c.ch: CWEB 4.6 pre-release RC2. + 2021-09-16 Andreas Scherer <https://ascherer.github.io> * 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 arguments and open output files@>= scan_args(); if (program==ctangle) { - if ((C_file=fopen(C_file_name,"a"))==NULL) + if (check_for_change) @<Open intermediate \CEE/ output file@>@; + 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) @<Open intermediate \TEX/ output file@>@; + 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. + +@<Open intermediate \CEE/ output file@>= { + 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); +} + +@ @<Open intermediate \TEX/ output file@>= { + 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. @<Remove the temporary file...@>= 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 @<Write all the named output files@>= -fclose(C_file); C_file=NULL; -@<Update the primary result when it has changed@>@; +if (check_for_change) { + fclose(C_file); C_file=NULL; + @<Update the primary result when it has changed@>@; +} 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) @<Open the intermediate output file@>@; + 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; @<Update the secondary results when they have changed@>@; + } } -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. + +@<Open the intermediate output file@>= { + 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); +} -@<Update the primary result...@>= +@ @<Update the primary result...@>= if((C_file=fopen(C_file_name,"r"))!=NULL) { @<Set up the comparison of temporary output@>@; @<Create the primary output depending on the comparison@>@; @@ -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) @<Compare the temporary output...@>@; + @<Compare the temporary output...@>@; 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; -@<Update the result when it has changed@>@; +finish_line(); fclose(active_file); active_file=tex_file=NULL; +if (check_for_change) @<Update the result when it has changed@>@; @z @x @@ -1981,15 +1980,16 @@ a function block. @<Set init...@>= 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. -@<Update the result...@>= +@<Update the result...@>= { 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) @<Compare the temporary output...@>@; + @<Compare the temporary output...@>@; 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; -@<Update the result when it has changed@>@; +finish_line(); fclose(active_file); active_file=tex_file=NULL; +if (check_for_change) @<Update the result when it has changed@>@; @z @x @@ -678,15 +677,16 @@ a function block. @<Set init...@>= 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. -@<Update the result...@>= +@<Update the result...@>= { 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) @<Compare the temporary output...@>@; + @<Compare the temporary output...@>@; 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. |