From e665a6c3a8f6b343142332c31758ca1e18159d4b Mon Sep 17 00:00:00 2001 From: Hironobu Yamashita Date: Sat, 5 Feb 2022 23:54:51 +0000 Subject: ptex: quote in \write18, non-JP file name (H. Kitagawa) git-svn-id: svn://tug.org/texlive/trunk@61906 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/eptexdir/ChangeLog | 4 ++ Build/source/texk/web2c/eptexdir/eptex.defines | 2 + Build/source/texk/web2c/euptexdir/ChangeLog | 4 ++ Build/source/texk/web2c/euptexdir/euptex.defines | 1 + Build/source/texk/web2c/ptexdir/ChangeLog | 7 +++ Build/source/texk/web2c/ptexdir/ptex-base.ch | 57 +++++++++++++++++++++++- Build/source/texk/web2c/ptexdir/ptex.defines | 2 + Build/source/texk/web2c/uptexdir/ChangeLog | 4 ++ Build/source/texk/web2c/uptexdir/uptex.defines | 1 + 9 files changed, 80 insertions(+), 2 deletions(-) (limited to 'Build/source/texk/web2c') diff --git a/Build/source/texk/web2c/eptexdir/ChangeLog b/Build/source/texk/web2c/eptexdir/ChangeLog index 1a80cdacd32..9e22b2ac306 100644 --- a/Build/source/texk/web2c/eptexdir/ChangeLog +++ b/Build/source/texk/web2c/eptexdir/ChangeLog @@ -1,3 +1,7 @@ +2022-02-05 Hironori Kitagawa + + * eptex.defines: Add isinternalUPTEX and isterminalUTF8. + 2022-01-22 Hironori Kitagawa * eptex.ech, etex.ch0, etex.ch1, pdfutils.ch: diff --git a/Build/source/texk/web2c/eptexdir/eptex.defines b/Build/source/texk/web2c/eptexdir/eptex.defines index fc154904830..165d23acee1 100644 --- a/Build/source/texk/web2c/eptexdir/eptex.defines +++ b/Build/source/texk/web2c/eptexdir/eptex.defines @@ -8,6 +8,8 @@ @define function getencstring; @define function setencstring (); +@define function isinternalUPTEX; +@define function isterminalUTF8; @define function iskanji1 (); @define function multistrlen (); diff --git a/Build/source/texk/web2c/euptexdir/ChangeLog b/Build/source/texk/web2c/euptexdir/ChangeLog index 72a0056a658..9e99b82e96a 100644 --- a/Build/source/texk/web2c/euptexdir/ChangeLog +++ b/Build/source/texk/web2c/euptexdir/ChangeLog @@ -1,3 +1,7 @@ +2022-02-05 Hironori Kitagawa + + * euptex.defines: Add isterminalUTF8. + 2022-01-22 Hironori Kitagawa * euptex.ch1, pdfstrcmp-eup-post.ch, pdfstrcmp-eup-pre.ch: diff --git a/Build/source/texk/web2c/euptexdir/euptex.defines b/Build/source/texk/web2c/euptexdir/euptex.defines index 0fb52bbdd86..ac6960dcefc 100644 --- a/Build/source/texk/web2c/euptexdir/euptex.defines +++ b/Build/source/texk/web2c/euptexdir/euptex.defines @@ -10,6 +10,7 @@ @define function setencstring (); @define procedure setpriorfileenc; @define function isinternalUPTEX; +@define function isterminalUTF8; @define function iskanji1 (); @define function is1stchr (); diff --git a/Build/source/texk/web2c/ptexdir/ChangeLog b/Build/source/texk/web2c/ptexdir/ChangeLog index a74cc8e1597..d854aa2b4f0 100644 --- a/Build/source/texk/web2c/ptexdir/ChangeLog +++ b/Build/source/texk/web2c/ptexdir/ChangeLog @@ -1,3 +1,10 @@ +2022-02-05 Hironori Kitagawa + + * 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 * ptex-base.ch: Fix \chardef code 256 in math. diff --git a/Build/source/texk/web2c/ptexdir/ptex-base.ch b/Build/source/texk/web2c/ptexdir/ptex-base.ch index d6e205cecb3..6a85178de99 100644 --- a/Build/source/texk/web2c/ptexdir/ptex-base.ch +++ b/Build/source/texk/web2c/ptexdir/ptex-base.ch @@ -2854,6 +2854,59 @@ if #<>0 then @y @z +@x [29.519] +@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 +@y +@d append_to_name_char(#)==begin incr(k); + if k<=file_name_size then name_of_file[k]:=xchr[#]; + end + +@d append_to_name_hex(#)==if (#)<10 then append_to_name_char((#)+"0") + else append_to_name_char((#)-10+"a") + +@d append_to_name(#)==begin c:=#; if not (c="""") then append_to_name_char(c); end + +@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 +@z + +@x l.10389 +name_of_file:= xmalloc_array (ASCII_code, length(a)+length(n)+length(e)+1); +@y +name_of_file:= xmalloc_array (ASCII_code, (length(a)+length(n)+length(e))*4+1); +@z + +@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])); +@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])); +@z + +@x l.10444 +name_of_file := xmalloc_array (ASCII_code, n+(b-a+1)+format_ext_length+1); +@y +name_of_file := xmalloc_array (ASCII_code, (n+(b-a+1)+format_ext_length)*4+1); +@z + @x [29.526] l.10668 - pTeX: scan file name loop@+begin if (cur_cmd>other_char)or(cur_chr>255) then {not a character} begin back_input; goto done; @@ -6687,10 +6740,10 @@ end 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 diff --git a/Build/source/texk/web2c/ptexdir/ptex.defines b/Build/source/texk/web2c/ptexdir/ptex.defines index 462ee6227ea..7e3103f930b 100644 --- a/Build/source/texk/web2c/ptexdir/ptex.defines +++ b/Build/source/texk/web2c/ptexdir/ptex.defines @@ -4,6 +4,8 @@ @define function getencstring; @define function setencstring (); +@define function isinternalUPTEX; +@define function isterminalUTF8; @define function iskanji1 (); @define function multistrlen (); diff --git a/Build/source/texk/web2c/uptexdir/ChangeLog b/Build/source/texk/web2c/uptexdir/ChangeLog index e7de0652135..242537d6007 100644 --- a/Build/source/texk/web2c/uptexdir/ChangeLog +++ b/Build/source/texk/web2c/uptexdir/ChangeLog @@ -1,3 +1,7 @@ +2022-02-05 Hironori Kitagawa + + * uptex.defines: Add isterminalUTF8. + 2022-01-29 Hironobu Yamashita * uptex-m.ch: Adapt to ptex-base.ch fixes. diff --git a/Build/source/texk/web2c/uptexdir/uptex.defines b/Build/source/texk/web2c/uptexdir/uptex.defines index 8afdb7e109a..81adea6de5d 100644 --- a/Build/source/texk/web2c/uptexdir/uptex.defines +++ b/Build/source/texk/web2c/uptexdir/uptex.defines @@ -11,6 +11,7 @@ @define procedure setpriorfileenc; @define function isinternalUPTEX; @define function isinternalEUC; +@define function isterminalUTF8; @define function iskanji1 (); @define function is1stchr (); -- cgit v1.2.3