From 8c40e20351ab565f8d7cf6b670c878b36884288f Mon Sep 17 00:00:00 2001 From: Andreas Scherer Date: Fri, 11 Aug 2023 16:49:21 +0000 Subject: [PATCH] [CWEB] Refurbish 'phase_three'. git-svn-id: svn://tug.org/texlive/trunk/Build/source@67887 c570f23f-e606-0410-a88d-b1316a301751 --- texk/web2c/cwebdir/ChangeLog | 7 +++++++ texk/web2c/cwebdir/ctwill-mini.ch | 8 ++++++++ texk/web2c/cwebdir/ctwill-w2c.ch | 34 +++++++------------------------ texk/web2c/cwebdir/cweav-w2c.ch | 28 ++++--------------------- texk/web2c/cwebdir/cweave.w | 26 ++++++++++++----------- 5 files changed, 40 insertions(+), 63 deletions(-) diff --git a/texk/web2c/cwebdir/ChangeLog b/texk/web2c/cwebdir/ChangeLog index 9a83c7963f..1a77bcdf76 100644 --- a/texk/web2c/cwebdir/ChangeLog +++ b/texk/web2c/cwebdir/ChangeLog @@ -1,3 +1,10 @@ +2023-08-11 Andreas Scherer + + * ctwill-mini.ch, + * ctwill-w2c.ch, + * cweav-w2c.ch, + * cweave.w: Refurbish 'phase_three'. + 2023-08-08 Andreas Scherer * comm-w2c.ch, diff --git a/texk/web2c/cwebdir/ctwill-mini.ch b/texk/web2c/cwebdir/ctwill-mini.ch index 463e238010..a5b4f759fa 100644 --- a/texk/web2c/cwebdir/ctwill-mini.ch +++ b/texk/web2c/cwebdir/ctwill-mini.ch @@ -1874,6 +1874,14 @@ Section 261. @-footnote@> @z +Section 264. + +@x +@** Phase three processing. +@y +@r @** Phase three processing. +@z + Section 265. @x diff --git a/texk/web2c/cwebdir/ctwill-w2c.ch b/texk/web2c/cwebdir/ctwill-w2c.ch index 78d42b860e..a65dcf7915 100644 --- a/texk/web2c/cwebdir/ctwill-w2c.ch +++ b/texk/web2c/cwebdir/ctwill-w2c.ch @@ -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) { + @@; finish_line(); finish_line(); + } @y - phase=3; if (show_progress) fputs(_("\nWriting the index..."),stdout); @z @x @@ -1138,13 +1130,6 @@ if (no_xref) { fatal(_("! Cannot open index file "),idx_file_name); @z -@x - if (change_exists) { - @@; finish_line(); finish_line(); - } -@y -@z - @x fatal("! Cannot open section file ",scn_file_name); @y @@ -1152,14 +1137,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) @@; @z diff --git a/texk/web2c/cwebdir/cweav-w2c.ch b/texk/web2c/cwebdir/cweav-w2c.ch index 90ff6b8ee0..f60360c791 100644 --- a/texk/web2c/cwebdir/cweav-w2c.ch +++ b/texk/web2c/cwebdir/cweav-w2c.ch @@ -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 @@ -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) @@; @z diff --git a/texk/web2c/cwebdir/cweave.w b/texk/web2c/cwebdir/cweave.w index 4cd934c1e1..41ade6e503 100644 --- a/texk/web2c/cwebdir/cweave.w +++ b/texk/web2c/cwebdir/cweave.w @@ -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) { @@; 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 */ @@; @@; 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 */ @@; 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);