texlive[65330] Build/source/texk: uptex-{sjis, euc}: accept file names
commits+takuji at tug.org
commits+takuji at tug.org
Thu Dec 22 13:28:49 CET 2022
Revision: 65330
http://tug.org/svn/texlive?view=revision&revision=65330
Author: takuji
Date: 2022-12-22 13:28:48 +0100 (Thu, 22 Dec 2022)
Log Message:
-----------
uptex-{sjis,euc}: accept file names with JIS X 0208 (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/ptexenc/version.ac
trunk/Build/source/texk/web2c/Makefile.in
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/lib/ChangeLog
trunk/Build/source/texk/web2c/lib/texmfmp.c
trunk/Build/source/texk/web2c/ptexdir/ChangeLog
trunk/Build/source/texk/web2c/ptexdir/am/ptex.am
trunk/Build/source/texk/web2c/ptexdir/kanji.h
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/am/uptex.am
trunk/Build/source/texk/web2c/uptexdir/kanji.h
trunk/Build/source/texk/web2c/uptexdir/uptex.defines
Added Paths:
-----------
trunk/Build/source/texk/web2c/ptexdir/wcfname.test
trunk/Build/source/texk/web2c/tests/fn-euc.txt
trunk/Build/source/texk/web2c/tests/fn-sjis.txt
trunk/Build/source/texk/web2c/tests/fn-utf8.txt
trunk/Build/source/texk/web2c/tests/fn{U+00B1}{U+00D7}{U+00F7}{U+00A7}{U+00B6}-utf8.tex
trunk/Build/source/texk/web2c/tests/fn{U+3055}{U+3055}{U+6CE2}-euc.tex
trunk/Build/source/texk/web2c/tests/fn{U+3055}{U+3055}{U+6CE2}-sjis.tex
trunk/Build/source/texk/web2c/tests/fn{U+3055}{U+3055}{U+6CE2}-utf8.tex
trunk/Build/source/texk/web2c/uptexdir/wcfname.test
Modified: trunk/Build/source/texk/ptexenc/ChangeLog
===================================================================
--- trunk/Build/source/texk/ptexenc/ChangeLog 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/ptexenc/ChangeLog 2022-12-22 12:28:48 UTC (rev 65330)
@@ -1,3 +1,12 @@
+2022-12-22 Hironori Kitagawa <h_kitagawa2001 at yahoo.co.jp>
+
+ * ptexenc.c, ptexenc/ptexenc.h:
+ Add a new function ptenc_conv_first_line()
+ to accept file names with JIS X 0208 characters
+ in `(e)(u)ptex --kanji-internal={euc,sjis}`.
+ https://github.com/texjporg/tex-jp-build/issues/136
+ * version.ac: Bump to 1.4.3/dev.
+
2022-09-24 TANAKA Takuji <ttk at t-lab.opal.ne.jp>
* ptexenc.c: Skip guessing file encoding if input is from pipe.
Modified: trunk/Build/source/texk/ptexenc/ptexenc/ptexenc.h
===================================================================
--- trunk/Build/source/texk/ptexenc/ptexenc/ptexenc.h 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/ptexenc/ptexenc/ptexenc.h 2022-12-22 12:28:48 UTC (rev 65330)
@@ -112,5 +112,6 @@
extern PTENCDLL unsigned char *ptenc_from_internal_enc_string_to_utf8(const unsigned char *is);
extern PTENCDLL int ptenc_get_command_line_args(int *p_ac, char ***p_av);
#endif
+extern PTENCDLL long ptenc_conv_first_line(long pos, long limit, unsigned char *buff, const long buffsize);
#endif /* PTEXENC_PTEXENC_H */
Modified: trunk/Build/source/texk/ptexenc/ptexenc.c
===================================================================
--- trunk/Build/source/texk/ptexenc/ptexenc.c 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/ptexenc/ptexenc.c 2022-12-22 12:28:48 UTC (rev 65330)
@@ -1150,6 +1150,10 @@
{
infile_enc[fileno(fp)] = ENC_UNKNOWN;
}
+long ptenc_conv_first_line(long pos, long last, unsigned char *buff, const long buffsize)
+{
+ return last;
+}
#else /* !WIN32 */
static const_string in_filter = NULL;
static FILE *piped_fp[NOFILE];
@@ -1361,4 +1365,21 @@
return 0;
}
+long ptenc_conv_first_line(long pos, long last, unsigned char *buff, const long buffsize)
+ /* return new last */
+{
+ unsigned char *old, *new_buf; long new_last, i;
+ if (internal_enc==ENC_UPTEX) return last; /* no conversion needed */
+ old = xmalloc(last-pos+2);
+ if (old==NULL) return last;
+ strncpy(old, buff+pos, last-pos+1); old[last-pos+1]='\0';
+ new_buf = ptenc_from_utf8_string_to_internal_enc(old);
+ if (new_buf==NULL) { free(old); return last; }
+ new_last=pos+strlen(new_buf)-1;
+ if (new_last>=buffsize) new_last=buffsize-1;
+ for (i=0;i<strlen(new_buf); i++) buff[pos+i]=new_buf[i];
+ free(old); free(new_buf);
+ return new_last;
+}
+
#endif /* !WIN32 */
Modified: trunk/Build/source/texk/ptexenc/version.ac
===================================================================
--- trunk/Build/source/texk/ptexenc/version.ac 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/ptexenc/version.ac 2022-12-22 12:28:48 UTC (rev 65330)
@@ -1,4 +1,5 @@
dnl $Id$
+dnl Copyright 2022 Japanese TeX Development Community <issue at texjp.org>
dnl Copyright 2016-2022 Karl Berry <tex-live at tug.org>
dnl Copyright 2011-2015 Peter Breitenlohner <tex-live at tug.org>
dnl
@@ -10,4 +11,4 @@
dnl see kpathsea/version.ac.
dnl
dnl This file is m4-included from configure.ac.
-m4_define([ptexenc_version], [1.4.2/dev])
+m4_define([ptexenc_version], [1.4.3/dev])
Modified: trunk/Build/source/texk/web2c/Makefile.in
===================================================================
--- trunk/Build/source/texk/web2c/Makefile.in 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/web2c/Makefile.in 2022-12-22 12:28:48 UTC (rev 65330)
@@ -4499,7 +4499,7 @@
# pTeX Tests
#
-ptex_tests = ptexdir/ptriptest.test ptexdir/pver.test
+ptex_tests = ptexdir/ptriptest.test ptexdir/pver.test ptexdir/wcfname.test
eptex_CPPFLAGS = $(PTEXENC_INCLUDES) $(AM_CPPFLAGS) -I$(srcdir)/libmd5 \
$(ZLIB_INCLUDES) $(am__append_144)
@@ -4602,7 +4602,7 @@
uptftopl_DEPENDENCIES = $(uptex_dependencies)
# upTeX Tests
-uptex_tests = uptexdir/uptriptest.test uptexdir/upver.test uptexdir/upkcat.test
+uptex_tests = uptexdir/uptriptest.test uptexdir/upver.test uptexdir/upkcat.test uptexdir/wcfname.test
# uppPLtoTF/upTFtoPL
upweb_tests = uptexdir/upbibtex.test uptexdir/updvitype.test \
uptexdir/uppltotf.test uptexdir/uptftopl.test \
Modified: trunk/Build/source/texk/web2c/eptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/ChangeLog 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/web2c/eptexdir/ChangeLog 2022-12-22 12:28:48 UTC (rev 65330)
@@ -1,3 +1,10 @@
+2022-12-22 Hironori Kitagawa <h_kitagawa2001 at yahoo.co.jp>
+
+ * eptex.defines:
+ Accept file names with JIS X 0208 characters
+ in `eptex --kanji-internal={euc,sjis}`.
+ https://github.com/texjporg/tex-jp-build/issues/136
+
2022-11-03 Hironobu Yamashita <h.y.acetaminophen at gmail.com>
* eptex.ech: Adapt to ptex-base.ch.
Modified: trunk/Build/source/texk/web2c/eptexdir/eptex.defines
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/eptex.defines 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/web2c/eptexdir/eptex.defines 2022-12-22 12:28:48 UTC (rev 65330)
@@ -24,6 +24,7 @@
@define function putc2 ();
@define function fputs2 ();
@define function inputline2 ();
+ at define function ptencconvfirstline ();
@define function setinfileenc ();
@define function setstdinenc ();
Modified: trunk/Build/source/texk/web2c/euptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/euptexdir/ChangeLog 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/web2c/euptexdir/ChangeLog 2022-12-22 12:28:48 UTC (rev 65330)
@@ -1,3 +1,10 @@
+2022-12-22 Hironori Kitagawa <h_kitagawa2001 at yahoo.co.jp>
+
+ * euptex.defines:
+ Accept file names with JIS X 0208 characters
+ in `euptex --kanji-internal={euc,sjis}`.
+ https://github.com/texjporg/tex-jp-build/issues/136
+
2022-11-03 Hironobu Yamashita <h.y.acetaminophen at gmail.com>
* euptex.ch0, euptex.ch1: Adapt to ptex-base.ch.
Modified: trunk/Build/source/texk/web2c/euptexdir/euptex.defines
===================================================================
--- trunk/Build/source/texk/web2c/euptexdir/euptex.defines 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/web2c/euptexdir/euptex.defines 2022-12-22 12:28:48 UTC (rev 65330)
@@ -28,6 +28,7 @@
@define function putc2 ();
@define function fputs2 ();
@define function inputline2 ();
+ at define function ptencconvfirstline ();
@define function setinfileenc ();
@define function setstdinenc ();
Modified: trunk/Build/source/texk/web2c/lib/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/lib/ChangeLog 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/web2c/lib/ChangeLog 2022-12-22 12:28:48 UTC (rev 65330)
@@ -1,3 +1,10 @@
+2022-12-22 Hironori Kitagawa <h_kitagawa2001 at yahoo.co.jp>
+
+ * texmfmp.c:
+ Accept file names with JIS X 0208 characters
+ in `(e)(u)ptex --kanji-internal={euc,sjis}`.
+ https://github.com/texjporg/tex-jp-build/issues/136
+
2022-06-12 TANAKA Takuji <ttk at t-lab.opal.ne.jp>
* texmfmp.c:
Modified: trunk/Build/source/texk/web2c/lib/texmfmp.c
===================================================================
--- trunk/Build/source/texk/web2c/lib/texmfmp.c 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/web2c/lib/texmfmp.c 2022-12-22 12:28:48 UTC (rev 65330)
@@ -849,9 +849,6 @@
enc = kpse_var_value("command_line_encoding");
get_command_line_args_utf8(enc, &argc, &argv);
#endif
-#if IS_pTeX && !IS_upTeX && !defined(WIN32)
- ptenc_get_command_line_args(&argc, &argv);
-#endif
/* If the user says --help or --version, we need to notice early. And
since we want the --ini option, have to do it before getting into
@@ -1016,7 +1013,14 @@
/* If run like `tex \&foo', reasonable to guess "foo" as the fmt name. */
if (!main_input_file) {
if (argv[1] && *argv[1] == '&') {
+#if IS_pTeX && !defined(WIN32)
+ string new_arg;
+ is_terminalUTF8(); /* To call get_terminal_enc(). return value is not used */
+ new_arg = ptenc_from_utf8_string_to_internal_enc(argv[1]);
+ dump_name = argv[1] + 1; argv[1] = new_arg;
+#else
dump_name = argv[1] + 1;
+#endif
}
}
@@ -1056,12 +1060,25 @@
unsigned ext_len = strlen (DUMP_EXT);
/* Provide extension if not there already. */
+#if IS_pTeX && !defined(WIN32)
+ string new_dump_name;
+ is_terminalUTF8(); /* To call get_terminal_enc(). return value is not used */
+ new_dump_name = ptenc_from_utf8_string_to_internal_enc(dump_name);
+ if (!new_dump_name) new_dump_name = (string)dump_name;
if (name_len > ext_len
&& FILESTRCASEEQ (dump_name + name_len - ext_len, DUMP_EXT)) {
+ with_ext = new_dump_name;
+ } else {
+ with_ext = concat(new_dump_name, DUMP_EXT);
+ }
+#else
+ if (name_len > ext_len
+ && FILESTRCASEEQ (dump_name + name_len - ext_len, DUMP_EXT)) {
with_ext = dump_name;
} else {
with_ext = concat (dump_name, DUMP_EXT);
}
+#endif
DUMP_VAR = concat (" ", with_ext); /* adjust array for Pascal */
DUMP_LENGTH_VAR = strlen (DUMP_VAR + 1);
} else {
@@ -3095,7 +3112,16 @@
{
strnumber ret = name; int i, l, p;
if (c_job_name != NULL)
+#if IS_pTeX && !defined(WIN32)
+ {
+ string new_job_name;
+ is_terminalUTF8();
+ new_job_name = ptenc_from_utf8_string_to_internal_enc(c_job_name);
+ ret = maketexstring(new_job_name? new_job_name : c_job_name);
+ }
+#else
ret = maketexstring(c_job_name);
+#endif
#if IS_pTeX
i = strstart[ret]; l = strstart[ret+1];
while (i<l)
Modified: trunk/Build/source/texk/web2c/ptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/ChangeLog 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/web2c/ptexdir/ChangeLog 2022-12-22 12:28:48 UTC (rev 65330)
@@ -1,3 +1,17 @@
+2022-12-22 TANAKA Takuji <ttk at t-lab.opal.ne.jp>
+
+ * wcfname.test, am/ptex.am:
+ Add tests for file names with JIS X 0208 characters
+ in `ptex --kanji-internal={euc,sjis}`.
+ https://github.com/texjporg/tex-jp-build/issues/136
+
+2022-12-22 Hironori Kitagawa <h_kitagawa2001 at yahoo.co.jp>
+
+ * ptex-base.ch, ptex.defines, kanji.h, am/ptex.am:
+ Accept file names with JIS X 0208 characters
+ in `ptex --kanji-internal={euc,sjis}`.
+ https://github.com/texjporg/tex-jp-build/issues/136
+
2022-12-12 Hironori Kitagawa <h_kitagawa2001 at yahoo.co.jp>
* ptex-base.ch: Increase INHIBIT/KINSOKU table size to 1024.
Modified: trunk/Build/source/texk/web2c/ptexdir/am/ptex.am
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/am/ptex.am 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/web2c/ptexdir/am/ptex.am 2022-12-22 12:28:48 UTC (rev 65330)
@@ -171,7 +171,7 @@
# pTeX Tests
#
-ptex_tests = ptexdir/ptriptest.test ptexdir/pver.test
+ptex_tests = ptexdir/ptriptest.test ptexdir/pver.test ptexdir/wcfname.test
ptexdir/ptriptest.log: ptex$(EXEEXT) dvitype$(EXEEXT) pltotf$(EXEEXT) tftopl$(EXEEXT)
ptexdir/pver.log: ptex$(EXEEXT)
#pweb_tests = \
Modified: trunk/Build/source/texk/web2c/ptexdir/kanji.h
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/kanji.h 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/web2c/ptexdir/kanji.h 2022-12-22 12:28:48 UTC (rev 65330)
@@ -72,6 +72,7 @@
#else
#define inputline2(fp,buff,pos,size) input_line2(fp,buff,NULL,pos,size,NULL)
#endif
+#define ptencconvfirstline(pos,limit,buff,size) ptenc_conv_first_line(pos,limit,buff,size)
extern void dump_kanji (gzFile fp);
extern void undump_kanji (gzFile fp);
Modified: trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/web2c/ptexdir/ptex-base.ch 2022-12-22 12:28:48 UTC (rev 65330)
@@ -6861,6 +6861,13 @@
font_info:=xmalloc_array (memory_word, font_mem_size);
@z
+ at x
+fix_date_and_time;@/
+ at y
+last:=ptenc_conv_first_line(loc, last, buffer, buf_size); limit:=last;
+fix_date_and_time;@/
+ at z
+
@x [51.1337] l.25563 - pTeX:
font_check:=xmalloc_array(four_quarters, font_max);
@y
Modified: trunk/Build/source/texk/web2c/ptexdir/ptex.defines
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/ptex.defines 2022-12-22 00:50:03 UTC (rev 65329)
+++ trunk/Build/source/texk/web2c/ptexdir/ptex.defines 2022-12-22 12:28:48 UTC (rev 65330)
@@ -21,6 +21,7 @@
@define function putc2 ();
@define function fputs2 ();
@define function inputline2 ();
+ at define function ptencconvfirstline ();
@define function fromJIS ();
@define function fromEUC ();
Added: trunk/Build/source/texk/web2c/ptexdir/wcfname.test
===================================================================
--- trunk/Build/source/texk/web2c/ptexdir/wcfname.test (rev 0)
+++ trunk/Build/source/texk/web2c/ptexdir/wcfname.test 2022-12-22 12:28:48 UTC (rev 65330)
@@ -0,0 +1,51 @@
+#! /bin/sh -vx
+#
+# Copyright 2022 Japanese TeX Development Community <issue at texjp.org>
+# You may freely use, modify and/or distribute this file.
+
+test -d ptests || mkdir -p ptests
+rm -f ptests/fn*.log ptests/fn*.txt ptests/fn*.tex
+
+rc=0
+
+TEXMFCNF=$srcdir/../kpathsea
+TEXINPUTS=$srcdir/tests:.
+export TEXMFCNF TEXINPUTS
+
+# pTeX internal encoding
+fenc="utf8"
+for ienc in euc sjis; do
+for doc in fnさざ波-$fenc; do
+
+ echo '>>> Document:'$doc ' File Encoding:'$fenc ' Internal Encoding:'$ienc
+ ./ptex -ini -interaction nonstopmode -jobname=$doc-$ienc -kanji=$fenc --kanji-internal=$ienc --shell-escape $doc.tex >ptests/$doc-$ienc-term.log || $rc=1
+ mv $doc-$ienc.txt $doc-$ienc.log $doc-tmp.tex ptests/
+ diff ptests/$doc-$ienc.txt $srcdir/tests/fn-utf8.txt || $rc=2
+
+done
+done
+
+
+# pTeX, regacy encoding
+for fenc in sjis euc; do
+for doc in fnさざ波-$fenc; do
+
+ ienc=$fenc
+ if [ "$COMSPEC" != "" ]; then
+ echo "*** We guess OS is Windows."
+ if [ $fenc != euc ]; then ienc="sjis"; fi
+ else
+ echo "*** We guess OS is not Windows."
+ if [ $fenc != sjis ]; then ienc="euc"; fi
+ fi
+
+ echo '>>> Document:'$doc ' File Encoding:'$fenc ' Internal Encoding:'$ienc
+ ./ptex -ini -interaction nonstopmode -jobname=$doc-$ienc -kanji=$fenc --kanji-internal=$ienc --shell-escape $doc.tex >ptests/$doc-$fenc-term.log || $rc=3
+ mv $doc-$ienc.txt $doc-$ienc.log $doc-tmp.tex ptests/
+ diff ptests/$doc-$ienc.txt $srcdir/tests/fn-$fenc.txt || $rc=4
+
+done
+done
+
+
+exit $rc
Property changes on: trunk/Build/source/texk/web2c/ptexdir/wcfname.test
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/Build/source/texk/web2c/tests/fn-euc.txt
===================================================================
--- trunk/Build/source/texk/web2c/tests/fn-euc.txt (rev 0)
+++ trunk/Build/source/texk/web2c/tests/fn-euc.txt 2022-12-22 12:28:48 UTC (rev 65330)
@@ -0,0 +1 @@
+abc \xA6\xC1\xA6¦\xC3 \xA7ѧҧ\xD3 \xA4\xA2\xA5\xA2\xA2\xA8\xA1\xEF ŷ\xC3Ͽ\xCD
Added: trunk/Build/source/texk/web2c/tests/fn-sjis.txt
===================================================================
--- trunk/Build/source/texk/web2c/tests/fn-sjis.txt (rev 0)
+++ trunk/Build/source/texk/web2c/tests/fn-sjis.txt 2022-12-22 12:28:48 UTC (rev 65330)
@@ -0,0 +1 @@
+abc \x83\xBF\x83\xC0\x83\xC1 \x84p\x84q\x84r \x82\xA0\x83A\x81\xA6\x81\x8F \x93V\x92n\x90l
Added: trunk/Build/source/texk/web2c/tests/fn-utf8.txt
===================================================================
--- trunk/Build/source/texk/web2c/tests/fn-utf8.txt (rev 0)
+++ trunk/Build/source/texk/web2c/tests/fn-utf8.txt 2022-12-22 12:28:48 UTC (rev 65330)
@@ -0,0 +1 @@
+abc αβγ абв あア※¥ 天地人
More information about the tex-live-commits
mailing list.