texlive[65806] Build/source/texk/web2c: propagate enctex \special

commits+karl at tug.org commits+karl at tug.org
Mon Feb 13 00:11:07 CET 2023


Revision: 65806
          http://tug.org/svn/texlive?view=revision&revision=65806
Author:   karl
Date:     2023-02-13 00:11:07 +0100 (Mon, 13 Feb 2023)
Log Message:
-----------
propagate enctex \special changes to the new \special shipout, thus avoiding a (valid) compiler warning about assigning |write_stream(tail):=null|

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/ChangeLog
    trunk/Build/source/texk/web2c/enctexdir/enctex2.ch
    trunk/Build/source/texk/web2c/pdftexdir/ChangeLog
    trunk/Build/source/texk/web2c/pdftexdir/pdftex.web

Modified: trunk/Build/source/texk/web2c/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ChangeLog	2023-02-12 22:48:31 UTC (rev 65805)
+++ trunk/Build/source/texk/web2c/ChangeLog	2023-02-12 23:11:07 UTC (rev 65806)
@@ -1,3 +1,11 @@
+2023-02-12  Phelype Oleinik <phe.h.o1 at gmail.com>
+        and Karl Berry  <karl at freefriends.org>
+
+	* enctexdir/enctex2.ch: make parallel change for ``late''
+	\special shipout. This code is what avoids the invalid
+	write_stream(tail):=null assignment in the original code.
+	See pdftex.web (Implement \.{\\special}) for more.
+
 2023-01-28  TANAKA Takuji  <ttk at t-lab.opal.ne.jp>
 
 	* Makefile.in, ac/web2c.ac (ptex, uptex):

Modified: trunk/Build/source/texk/web2c/enctexdir/enctex2.ch
===================================================================
--- trunk/Build/source/texk/web2c/enctexdir/enctex2.ch	2023-02-12 22:48:31 UTC (rev 65805)
+++ trunk/Build/source/texk/web2c/enctexdir/enctex2.ch	2023-02-12 23:11:07 UTC (rev 65806)
@@ -600,6 +600,27 @@
      else write_mubyte(tail) := mubyte_out + mubyte_zero;
 @z
 
+% see pdftex.web for more about this.
+ at x [53.1353] - encTeX: late \special stores specialout and mubyteout values
+begin new_whatsit(latespecial_node,write_node_size); write_stream(tail):=null;
+p:=scan_toks(false,false); write_tokens(tail):=def_ref;
+ at y
+begin new_whatsit(latespecial_node,write_node_size);
+if spec_out + mubyte_zero < 0 then write_stream(tail) := 0
+else if spec_out + mubyte_zero >= 2*mubyte_zero then
+       write_stream(tail) := 2*mubyte_zero - 1
+     else write_stream(tail) := spec_out + mubyte_zero;
+if mubyte_out + mubyte_zero < 0 then write_mubyte(tail) := 0
+else if mubyte_out + mubyte_zero >= 2*mubyte_zero then
+       write_mubyte(tail) := 2*mubyte_zero - 1
+     else write_mubyte(tail) := mubyte_out + mubyte_zero;
+if (spec_out = 2) or (spec_out = 3) then
+  if (mubyte_out > 2) or (mubyte_out = -1) or (mubyte_out = -2) then
+    write_noexpanding := true;
+p:=scan_toks(false,false); write_tokens(tail):=def_ref;
+write_noexpanding := false;
+ at z
+
 @x [53.1353] - encTeX: \special stores specialout and mubyteout values
 begin new_whatsit(special_node,write_node_size); write_stream(tail):=null;
 p:=scan_toks(false,true); write_tokens(tail):=def_ref;

Modified: trunk/Build/source/texk/web2c/pdftexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/ChangeLog	2023-02-12 22:48:31 UTC (rev 65805)
+++ trunk/Build/source/texk/web2c/pdftexdir/ChangeLog	2023-02-12 23:11:07 UTC (rev 65806)
@@ -1,3 +1,10 @@
+2023-02-12  Phelype Oleinik <phe.h.o1 at gmail.com>
+        and Karl Berry  <karl at freefriends.org>
+
+	* pdftex.web (Implement \.{\\special}): add comments explaining
+	that write_stream(tail):=null is an overflow assignment with the
+	current memory_word structure, and is overwritten in enctex2.ch.
+
 2023-02-11  Thanh Han The  <hanthethanh at gmail.com>
 
 	* pdftex.ch (pdf_font_has_space_char): xmalloc and maintain new array.

Modified: trunk/Build/source/texk/web2c/pdftexdir/pdftex.web
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/pdftex.web	2023-02-12 22:48:31 UTC (rev 65805)
+++ trunk/Build/source/texk/web2c/pdftexdir/pdftex.web	2023-02-12 23:11:07 UTC (rev 65806)
@@ -34003,6 +34003,21 @@
 list as in \.{\\xdef} and \.{\\mark}.  When marked with \.{shipout}, we keep
 tokens unexpanded for now.
 
+Unfortunately, the |write_stream(tail):=null| done here is not a valid
+assignment in Web2C, because |null| (a.k.a.\ |min_halfword|) is a large
+negative number ($-268435455 = -@"FFFFFFF$, set in \.{tex.ch}); too
+large to fit in the {\bf short} structure element that's being assigned.
+The warning from gcc~8.5.0 was:
+
+\.{pdftex0.c: In function 'doextension':}
+\.{pdftex0.c:37849:40: warning: overflow in conversion from 'long int' to 'short int'}
+\.{changes value from '-268435455' to '1' [-Woverflow]}\hfil\break
+\.{  mem [curlist .tailfield + 1 ].hh.b0 = -268435455L ;}
+
+The correct thing to do is not immediately evident. However, for Web2C,
+it does not matter, because these lines are changed for enc\TeX, in
+\.{enctex2.ch}, and now zero is assigned, instead of |null|.
+
 @<Implement \.{\\special}@>=
 begin if scan_keyword("shipout") then
 begin new_whatsit(latespecial_node,write_node_size); write_stream(tail):=null;



More information about the tex-live-commits mailing list.