Skip to content

Commit

Permalink
[CWEB] Refurbish 'phase_three'.
Browse files Browse the repository at this point in the history
git-svn-id: svn://tug.org/texlive/trunk/Build/source@67887 c570f23f-e606-0410-a88d-b1316a301751
  • Loading branch information
Andreas Scherer committed Aug 11, 2023
1 parent 5173167 commit 8c40e20
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 63 deletions.
7 changes: 7 additions & 0 deletions texk/web2c/cwebdir/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2023-08-11 Andreas Scherer <https://ascherer.github.io>

* ctwill-mini.ch,
* ctwill-w2c.ch,
* cweav-w2c.ch,
* cweave.w: Refurbish 'phase_three'.

2023-08-08 Andreas Scherer <https://ascherer.github.io>

* comm-w2c.ch,
Expand Down
8 changes: 8 additions & 0 deletions texk/web2c/cwebdir/ctwill-mini.ch
Original file line number Diff line number Diff line change
Expand Up @@ -1874,6 +1874,14 @@ Section 261.
@-footnote@>
@z
Section 264.
@x
@** Phase three processing.
@y
@r @** Phase three processing.
@z
Section 265.
@x
Expand Down
34 changes: 7 additions & 27 deletions texk/web2c/cwebdir/ctwill-w2c.ch
Original file line number Diff line number Diff line change
Expand Up @@ -1112,24 +1112,16 @@ out_str("}\\FI"); finish_line();
@z
@x
if (no_xref) {
finish_line();
out_str("\\end");
@.\\end@>
finish_line();
}
if (show_progress) fputs("\nWriting the index...",stdout);
@y
if (no_xref) {
finish_line();
out_str("\\end");
@.\\end@>
}
if (show_progress) fputs(_("\nWriting the index..."),stdout);
@z
@x
phase=3; if (show_progress) fputs("\nWriting the index...",stdout);
if (change_exists) {
@<Tell about changed sections@>@; finish_line(); finish_line();
}
@y
phase=3; if (show_progress) fputs(_("\nWriting the index..."),stdout);
@z
@x
Expand All @@ -1138,28 +1130,16 @@ if (no_xref) {
fatal(_("! Cannot open index file "),idx_file_name);
@z
@x
if (change_exists) {
@<Tell about changed sections@>@; finish_line(); finish_line();
}
@y
@z
@x
fatal("! Cannot open section file ",scn_file_name);
@y
fatal(_("! Cannot open section file "),scn_file_name);
@z
@x
@.\\end@>
finish_line();
fclose(active_file);
}
fclose(active_file);
@y
@.\\end@>
}
finish_line(); fclose(active_file); active_file=tex_file=NULL;
fclose(active_file); active_file=tex_file=NULL;
if (check_for_change) @<Update the result when it has changed@>@;
@z
Expand Down
28 changes: 4 additions & 24 deletions texk/web2c/cwebdir/cweav-w2c.ch
Original file line number Diff line number Diff line change
Expand Up @@ -515,24 +515,9 @@ if (show_progress) fputs(_("\nWriting the output file..."),stdout);
@z
@x
if (no_xref) {
finish_line();
out_str("\\end");
@.\\end@>
finish_line();
}
@y
if (no_xref) {
finish_line();
out_str("\\end");
@.\\end@>
}
@z
@x
phase=3; if (show_progress) fputs("\nWriting the index...",stdout);
if (show_progress) fputs("\nWriting the index...",stdout);
@y
phase=3; if (show_progress) fputs(_("\nWriting the index..."),stdout);
if (show_progress) fputs(_("\nWriting the index..."),stdout);
@z
@x
Expand All @@ -548,14 +533,9 @@ if (no_xref) {
@z
@x
@.\\end@>
finish_line();
fclose(active_file);
}
fclose(active_file);
@y
@.\\end@>
}
finish_line(); fclose(active_file); active_file=tex_file=NULL;
fclose(active_file); active_file=tex_file=NULL;
if (check_for_change) @<Update the result when it has changed@>@;
@z
Expand Down
26 changes: 14 additions & 12 deletions texk/web2c/cwebdir/cweave.w
Original file line number Diff line number Diff line change
Expand Up @@ -4525,44 +4525,46 @@ contents.
@c
static void
phase_three(void) {
if (no_xref) {
finish_line();
phase=3;
finish_line(); /* the bulk of |tex_file| has been written */
if (no_xref)
out_str("\\end");
@.\\end@>
finish_line();
}
else {
phase=3; if (show_progress) fputs("\nWriting the index...",stdout);
if (show_progress) fputs("\nWriting the index...",stdout);
@.Writing the index...@>
finish_line();
if ((idx_file=fopen(idx_file_name,"wb"))==NULL)
fatal("! Cannot open index file ",idx_file_name);
@.Cannot open index file@>
if (change_exists) {
@<Tell about changed sections@>@; finish_line(); finish_line();
}
out_str("\\inx"); finish_line();
@.\\inx@>
@#
if ((idx_file=fopen(idx_file_name,"wb"))==NULL)
fatal("! Cannot open index file ",idx_file_name);
@.Cannot open index file@>
active_file=idx_file; /* change active file to the index file */
@<Do the first pass of sorting@>@;
@<Sort and output the index@>@;
finish_line(); fclose(active_file); /* finished with |idx_file| */
@#
active_file=tex_file; /* switch back to |tex_file| for a tic */
out_str("\\fin"); finish_line();
@.\\fin@>
@#
if ((scn_file=fopen(scn_file_name,"wb"))==NULL)
fatal("! Cannot open section file ",scn_file_name);
@.Cannot open section file@>
active_file=scn_file; /* change active file to section listing file */
@<Output all the section names@>@;
finish_line(); fclose(active_file); /* finished with |scn_file| */
active_file=tex_file;
@#
active_file=tex_file; /* switch back to |tex_file| for the last time */
if (group_found) out_str("\\con");@+else out_str("\\end");
@.\\con@>
@.\\end@>
finish_line();
fclose(active_file);
}
finish_line();
fclose(active_file);
if (show_happiness) {
if (show_progress) new_line();
fputs("Done.",stdout);
Expand Down

0 comments on commit 8c40e20

Please sign in to comment.