texlive[61906] Build/source/texk: ptex: quote in \write18, non-JP

commits+hironobu at tug.org commits+hironobu at tug.org
Sun Feb 6 00:54:51 CET 2022


Revision: 61906
          http://tug.org/svn/texlive?view=revision&revision=61906
Author:   hironobu
Date:     2022-02-06 00:54:51 +0100 (Sun, 06 Feb 2022)
Log Message:
-----------
ptex: quote in \write18, non-JP file name (H. Kitagawa)

Modified Paths:
--------------
    trunk/Build/source/texk/ptexenc/ChangeLog
    trunk/Build/source/texk/ptexenc/ptexenc/ptexenc.h
    trunk/Build/source/texk/ptexenc/ptexenc.c
    trunk/Build/source/texk/web2c/eptexdir/ChangeLog
    trunk/Build/source/texk/web2c/eptexdir/eptex.defines
    trunk/Build/source/texk/web2c/euptexdir/ChangeLog
    trunk/Build/source/texk/web2c/euptexdir/euptex.defines
    trunk/Build/source/texk/web2c/ptexdir/ChangeLog
    trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch
    trunk/Build/source/texk/web2c/ptexdir/ptex.defines
    trunk/Build/source/texk/web2c/uptexdir/ChangeLog
    trunk/Build/source/texk/web2c/uptexdir/uptex.defines

Modified: trunk/Build/source/texk/ptexenc/ChangeLog
===================================================================
--- trunk/Build/source/texk/ptexenc/ChangeLog	2022-02-05 22:45:39 UTC (rev 61905)
+++ trunk/Build/source/texk/ptexenc/ChangeLog	2022-02-05 23:54:51 UTC (rev 61906)
@@ -1,3 +1,7 @@
+2022-02-05  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
+
+	* ptexenc.c, ptexenc/ptexenc.h: Add is_terminalUTF8.
+
 2022-01-22  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
 
 	* ptexenc.c, ptexenc/ptexenc.h, unicode.c, ptexenc/unicode.h:

Modified: trunk/Build/source/texk/ptexenc/ptexenc/ptexenc.h
===================================================================
--- trunk/Build/source/texk/ptexenc/ptexenc/ptexenc.h	2022-02-05 22:45:39 UTC (rev 61905)
+++ trunk/Build/source/texk/ptexenc/ptexenc/ptexenc.h	2022-02-05 23:54:51 UTC (rev 61906)
@@ -52,6 +52,9 @@
 #define isinternalEUC   is_internalEUC
 #define isinternalUPTEX is_internalUPTEX
 
+extern PTENCDLL boolean  is_terminalUTF8(void);
+#define isterminalUTF8 is_terminalUTF8
+
 /* check char range */
 extern PTENCDLL boolean ismultichr (int length, int nth, int c);
 extern PTENCDLL boolean iskanji1(int c);

Modified: trunk/Build/source/texk/ptexenc/ptexenc.c
===================================================================
--- trunk/Build/source/texk/ptexenc/ptexenc.c	2022-02-05 22:45:39 UTC (rev 61905)
+++ trunk/Build/source/texk/ptexenc/ptexenc.c	2022-02-05 23:54:51 UTC (rev 61906)
@@ -222,7 +222,16 @@
     return (internal_enc == ENC_UPTEX);
 }
 
+boolean is_terminalUTF8(void)
+{
+#ifdef WIN32
+    return false;
+#else
+    get_terminal_enc(); return (terminal_enc == ENC_UTF8);
+#endif
+}
 
+
 /* check char range */
 boolean ismultichr (int length, int nth, int c)
 {

Modified: trunk/Build/source/texk/web2c/eptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/ChangeLog	2022-02-05 22:45:39 UTC (rev 61905)
+++ trunk/Build/source/texk/web2c/eptexdir/ChangeLog	2022-02-05 23:54:51 UTC (rev 61906)
@@ -1,3 +1,7 @@
+2022-02-05  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
+
+	* eptex.defines: Add isinternalUPTEX and isterminalUTF8.
+
 2022-01-22  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
 
 	* eptex.ech, etex.ch0, etex.ch1, pdfutils.ch:

Modified: trunk/Build/source/texk/web2c/eptexdir/eptex.defines
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/eptex.defines	2022-02-05 22:45:39 UTC (rev 61905)
+++ trunk/Build/source/texk/web2c/eptexdir/eptex.defines	2022-02-05 23:54:51 UTC (rev 61906)
@@ -8,6 +8,8 @@
 
 @define function getencstring;
 @define function setencstring ();
+ at define function isinternalUPTEX;
+ at define function isterminalUTF8;
 
 @define function iskanji1 ();
 @define function multistrlen ();

Modified: trunk/Build/source/texk/web2c/euptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/euptexdir/ChangeLog	2022-02-05 22:45:39 UTC (rev 61905)
+++ trunk/Build/source/texk/web2c/euptexdir/ChangeLog	2022-02-05 23:54:51 UTC (rev 61906)
@@ -1,3 +1,7 @@
+2022-02-05  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
+
+	* euptex.defines: Add isterminalUTF8.
+
 2022-01-22  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
 
 	* euptex.ch1, pdfstrcmp-eup-post.ch, pdfstrcmp-eup-pre.ch:

Modified: trunk/Build/source/texk/web2c/euptexdir/euptex.defines
===================================================================
--- trunk/Build/source/texk/web2c/euptexdir/euptex.defines	2022-02-05 22:45:39 UTC (rev 61905)
+++ trunk/Build/source/texk/web2c/euptexdir/euptex.defines	2022-02-05 23:54:51 UTC (rev 61906)
@@ -10,6 +10,7 @@
 @define function setencstring ();
 @define procedure setpriorfileenc;
 @define function isinternalUPTEX;
+ at define function isterminalUTF8;
 
 @define function iskanji1 ();
 @define function is1stchr ();

Modified: trunk/Build/source/texk/web2c/ptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/ChangeLog	2022-02-05 22:45:39 UTC (rev 61905)
+++ trunk/Build/source/texk/web2c/ptexdir/ChangeLog	2022-02-05 23:54:51 UTC (rev 61906)
@@ -1,3 +1,10 @@
+2022-02-05  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
+
+	* ptex-base.ch: Fix for \write18 with quotation.
+	  Convert non-Japanese non-ASCII bytes in name_of_file to
+	  "^^" format. (Thanks Yukimasa Morimi)
+	* ptex.defines: Add isinternalUPTEX and isterminalUTF8.
+
 2022-01-29  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
 
 	* ptex-base.ch: Fix \chardef code 256 in math.

Modified: trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch	2022-02-05 22:45:39 UTC (rev 61905)
+++ trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch	2022-02-05 23:54:51 UTC (rev 61906)
@@ -2854,6 +2854,59 @@
 @y
 @z
 
+ at x [29.519]
+ at d append_to_name(#)==begin c:=#; if not (c="""") then begin incr(k);
+  if k<=file_name_size then name_of_file[k]:=xchr[c];
+  end end
+ at y
+ at d append_to_name_char(#)==begin incr(k);
+  if k<=file_name_size then name_of_file[k]:=xchr[#];
+  end
+
+ at d append_to_name_hex(#)==if (#)<10 then append_to_name_char((#)+"0")
+  else append_to_name_char((#)-10+"a")
+
+ at d append_to_name(#)==begin c:=#; if not (c="""") then append_to_name_char(c); end
+
+ at d append_to_name_str_pool(#)==begin
+  if (#)>=@"100 then begin
+    c:=(#)-@"100;
+    append_to_name_char(c);
+  end else begin
+    c:=#;
+    if (c>=@"80) and (not isinternalUPTEX) and isterminalUTF8 then begin
+      append_to_name_char("^");
+      append_to_name_char("^");
+      append_to_name_hex(c div 16);
+      append_to_name_hex(c mod 16);
+    end else if not (c="""") then
+      append_to_name_char(c);
+  end
+end
+ at z
+
+ at x l.10389
+name_of_file:= xmalloc_array (ASCII_code, length(a)+length(n)+length(e)+1);
+ at y
+name_of_file:= xmalloc_array (ASCII_code, (length(a)+length(n)+length(e))*4+1);
+ at z
+
+ at x [29.519] pack_file_name
+for j:=str_start[a] to str_start[a+1]-1 do append_to_name(so(str_pool[j]));
+for j:=str_start[n] to str_start[n+1]-1 do append_to_name(so(str_pool[j]));
+for j:=str_start[e] to str_start[e+1]-1 do append_to_name(so(str_pool[j]));
+ at y
+for j:=str_start[a] to str_start[a+1]-1 do append_to_name_str_pool(so(str_pool[j]));
+for j:=str_start[n] to str_start[n+1]-1 do append_to_name_str_pool(so(str_pool[j]));
+for j:=str_start[e] to str_start[e+1]-1 do append_to_name_str_pool(so(str_pool[j]));
+ at z
+
+ at x l.10444
+name_of_file := xmalloc_array (ASCII_code, n+(b-a+1)+format_ext_length+1);
+ at y
+name_of_file := xmalloc_array (ASCII_code, (n+(b-a+1)+format_ext_length)*4+1);
+ at z
+
 @x [29.526] l.10668 - pTeX: scan file name
 loop at +begin if (cur_cmd>other_char)or(cur_chr>255) then {not a character}
     begin back_input; goto done;
@@ -6687,10 +6740,10 @@
                                               str_pool[str_start[str_ptr]])));
 @y
       if name_of_file then libc_free(name_of_file);
-      name_of_file := xmalloc(cur_length * 3 + 2);
+      name_of_file := xmalloc(cur_length*4+1);
       k := 0;
       for d:=0 to cur_length-1 do
-        append_to_name(str_pool[str_start[str_ptr]+d]);
+        append_to_name_char(str_pool[str_start[str_ptr]+d]); {do not remove quote}
       name_of_file[k+1] := 0;
       runsystem_ret := runsystem(conststringcast(name_of_file+1));
 @z

Modified: trunk/Build/source/texk/web2c/ptexdir/ptex.defines
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/ptex.defines	2022-02-05 22:45:39 UTC (rev 61905)
+++ trunk/Build/source/texk/web2c/ptexdir/ptex.defines	2022-02-05 23:54:51 UTC (rev 61906)
@@ -4,6 +4,8 @@
 
 @define function getencstring;
 @define function setencstring ();
+ at define function isinternalUPTEX;
+ at define function isterminalUTF8;
 
 @define function iskanji1 ();
 @define function multistrlen ();

Modified: trunk/Build/source/texk/web2c/uptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/uptexdir/ChangeLog	2022-02-05 22:45:39 UTC (rev 61905)
+++ trunk/Build/source/texk/web2c/uptexdir/ChangeLog	2022-02-05 23:54:51 UTC (rev 61906)
@@ -1,3 +1,7 @@
+2022-02-05  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
+
+	* uptex.defines: Add isterminalUTF8.
+
 2022-01-29  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
 
 	* uptex-m.ch: Adapt to ptex-base.ch fixes.

Modified: trunk/Build/source/texk/web2c/uptexdir/uptex.defines
===================================================================
--- trunk/Build/source/texk/web2c/uptexdir/uptex.defines	2022-02-05 22:45:39 UTC (rev 61905)
+++ trunk/Build/source/texk/web2c/uptexdir/uptex.defines	2022-02-05 23:54:51 UTC (rev 61906)
@@ -11,6 +11,7 @@
 @define procedure setpriorfileenc;
 @define function isinternalUPTEX;
 @define function isinternalEUC;
+ at define function isterminalUTF8;
 
 @define function iskanji1 ();
 @define function is1stchr ();



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