summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-03-24 22:32:46 +0000
committerKarl Berry <karl@freefriends.org>2024-03-24 22:32:46 +0000
commita9d91916b07b2dab362448123a8cfcb93ec4dd3c (patch)
tree1159860696ff156f10143a4c33e5b253fd9a6959
parent28f1639049b3aabaa6b742e18fadc13ed0466dda (diff)
\aftergroup \output routine fix from DRF
git-svn-id: svn://tug.org/texlive/trunk@70752 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/web2c/ChangeLog7
-rw-r--r--Build/source/texk/web2c/tests/aftergroupout.tex24
-rw-r--r--Build/source/texk/web2c/unbalanced-braces.ch19
3 files changed, 48 insertions, 2 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog
index b596f6db3ab..f2b53abdf84 100644
--- a/Build/source/texk/web2c/ChangeLog
+++ b/Build/source/texk/web2c/ChangeLog
@@ -1,3 +1,10 @@
+2024-03-24 Karl Berry <karl@freefriends.org>
+
+ * unbalanced-braces.ch: fix from DRF in order to make
+ \aftergroup work again with the output routine. Report
+ from David Carlisle and Frank Mittelbach, thread starts at:
+ https://tug.org/pipermail/tex-live/2024-March/050290.html
+
2024-03-10 Karl Berry <karl@tug.org>
* TL'24 release.
diff --git a/Build/source/texk/web2c/tests/aftergroupout.tex b/Build/source/texk/web2c/tests/aftergroupout.tex
new file mode 100644
index 00000000000..7be0466a022
--- /dev/null
+++ b/Build/source/texk/web2c/tests/aftergroupout.tex
@@ -0,0 +1,24 @@
+% $Id$
+% Public domain. Based on a post by David Carlisle to tex-live,
+% https://tug.org/pipermail/tex-live/2024-March/050292.html
+%
+\catcode`\{=1 \catcode`\}=2
+\pdfoutput = 1
+\pdfmapline{cmr10 CMR10 <cmr10.pfb}
+\font\f = cmr10 \f
+\hsize=6in
+\vsize=9in
+\parfillskip=0pt plus1fil
+
+% with original TL24 binaries, \aftergroup on the \output routine didn't work.
+\def\xxx{\aftergroup should-appear!\global\let\xxx\relax}
+
+\output{\xxx\global\advance\count0 by 1 \shipout\box255}
+
+page1
+
+\penalty-10000
+
+page2
+
+\end
diff --git a/Build/source/texk/web2c/unbalanced-braces.ch b/Build/source/texk/web2c/unbalanced-braces.ch
index fab92f736a0..9cecdd465ef 100644
--- a/Build/source/texk/web2c/unbalanced-braces.ch
+++ b/Build/source/texk/web2c/unbalanced-braces.ch
@@ -47,7 +47,7 @@
begin decr(param_ptr);
flush_list(param_stack[param_ptr]);
end
- else if (token_type=output_text)and(output_active) then
+ else if (token_type=output_text)and(not output_can_end) then
fatal_error("Unbalanced output routine");
@.Unbalanced output routine@>
@z
@@ -103,6 +103,19 @@ while (loc=null)and(token_type<>v_template)
% that we were just finished with it, so it's where the brace
% came from.
+@x [45.989] l.19364 p.B417
+@!output_active:boolean; {are we in the midst of an output routine?}
+@y
+@!output_active:boolean; {are we in the midst of an output routine?}
+@!output_can_end:boolean; {is this an auspicious time for it to end?}
+@z
+
+@x [45.989] l.19367 p.B417
+output_active:=false; insert_penalties:=0;
+@y
+output_active:=false; output_can_end:=false; insert_penalties:=0;
+@z
+
% In <Resume the page builder after an output routine has come to an end>:
@x [45.1026] l.19938 p.B432
begin if (loc<>null) or
@@ -121,8 +134,10 @@ begin
end_token_list; {conserve stack space in case more outputs are triggered}
end_graf; unsave; output_active:=false; insert_penalties:=0;@/
@y
-end_graf; unsave; output_active:=false; insert_penalties:=0;@/
+output_can_end:=true;
end_token_list; {conserve stack space in case more outputs are triggered}
+output_can_end:=false;
+end_graf; unsave; output_active:=false; insert_penalties:=0;@/
@z
% <Expand macros in the token list and...> had set mode:=0 while