summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHironobu Yamashita <h.y.acetaminophen@gmail.com>2019-02-06 10:58:23 +0000
committerHironobu Yamashita <h.y.acetaminophen@gmail.com>2019-02-06 10:58:23 +0000
commit174b83580efb7953436f4ab9cfbebddc19936217 (patch)
treeae8a7c89151ee9f93a9555f56d7bc6138ff0b6b3
parent9904a9f5b98acf226b7295d30db24f951991faa3 (diff)
kanji-internal (ptex and friends 1 of 5)
git-svn-id: svn://tug.org/texlive/trunk@49955 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/ptexenc/ChangeLog5
-rw-r--r--Build/source/texk/ptexenc/ptexenc.c4
-rw-r--r--Build/source/texk/ptexenc/ptexenc/ptexenc.h4
-rw-r--r--Build/source/texk/web2c/Makefile.in25
-rw-r--r--Build/source/texk/web2c/eptexdir/ChangeLog4
-rw-r--r--Build/source/texk/web2c/eptexdir/eptex.defines3
-rw-r--r--Build/source/texk/web2c/ptexdir/ChangeLog14
-rw-r--r--Build/source/texk/web2c/ptexdir/am/ptex.am2
-rw-r--r--Build/source/texk/web2c/ptexdir/kanji.c15
-rw-r--r--Build/source/texk/web2c/ptexdir/kanji.h6
-rw-r--r--Build/source/texk/web2c/ptexdir/kanji_dump.c48
-rw-r--r--Build/source/texk/web2c/ptexdir/ptex-base.ch14
-rw-r--r--Build/source/texk/web2c/ptexdir/ptex.defines2
-rw-r--r--Build/source/texk/web2c/uptexdir/ChangeLog6
-rw-r--r--Build/source/texk/web2c/uptexdir/kanji_dump.c7
-rw-r--r--Build/source/texk/web2c/uptexdir/uptex-m.ch14
16 files changed, 149 insertions, 24 deletions
diff --git a/Build/source/texk/ptexenc/ChangeLog b/Build/source/texk/ptexenc/ChangeLog
index 6d6b10f3c71..5f6f77f01ba 100644
--- a/Build/source/texk/ptexenc/ChangeLog
+++ b/Build/source/texk/ptexenc/ChangeLog
@@ -1,3 +1,8 @@
+2019-01-23 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * ptexenc.c, ptexenc/ptexenc.h: define enc_to_string() and
+ get_internal_enc() as extern.
+
2018-06-14 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
* ptexenc.c, ptexenc/ptexenc.h: remove sjisterminal (w32 only).
diff --git a/Build/source/texk/ptexenc/ptexenc.c b/Build/source/texk/ptexenc/ptexenc.c
index 43696693227..6c8238c4a2c 100644
--- a/Build/source/texk/ptexenc/ptexenc.c
+++ b/Build/source/texk/ptexenc/ptexenc.c
@@ -49,7 +49,7 @@ static int file_enc = ENC_UNKNOWN;
static int internal_enc = ENC_UNKNOWN;
static int terminal_enc = ENC_UNKNOWN;
-static const_string enc_to_string(int enc)
+const_string enc_to_string(int enc)
{
switch (enc) {
case ENC_JIS: return "jis";
@@ -114,7 +114,7 @@ static int get_file_enc(void)
return file_enc;
}
-static int get_internal_enc(void)
+int get_internal_enc(void)
{
if (internal_enc == ENC_UNKNOWN) set_internal_enc(get_default_enc());
return internal_enc;
diff --git a/Build/source/texk/ptexenc/ptexenc/ptexenc.h b/Build/source/texk/ptexenc/ptexenc/ptexenc.h
index 2417c5e6150..93004162390 100644
--- a/Build/source/texk/ptexenc/ptexenc/ptexenc.h
+++ b/Build/source/texk/ptexenc/ptexenc/ptexenc.h
@@ -39,6 +39,10 @@ extern PTENCDLL boolean set_enc_string(const_string file, const_string inter);
#define getencstring get_enc_string
#define setencstring set_enc_string
+/* get internal Kanji encode (used in kanji_dump.c) */
+extern PTENCDLL const_string enc_to_string(int enc);
+extern PTENCDLL int get_internal_enc(void);
+
/* decide if internal Kanji encode is SJIS/UPTEX or not */
extern PTENCDLL boolean is_internalSJIS(void);
extern PTENCDLL boolean is_internalEUC(void);
diff --git a/Build/source/texk/web2c/Makefile.in b/Build/source/texk/web2c/Makefile.in
index 5f55f48afce..7a7e5b81130 100644
--- a/Build/source/texk/web2c/Makefile.in
+++ b/Build/source/texk/web2c/Makefile.in
@@ -550,7 +550,8 @@ am_libff_a_OBJECTS = luatexdir/luafontloader/fontforge/fontforge/libff_a-autohin
libff_a_OBJECTS = $(am_libff_a_OBJECTS)
libkanji_a_AR = $(AR) $(ARFLAGS)
libkanji_a_LIBADD =
-am_libkanji_a_OBJECTS = ptexdir/libkanji_a-kanji.$(OBJEXT)
+am_libkanji_a_OBJECTS = ptexdir/libkanji_a-kanji.$(OBJEXT) \
+ ptexdir/libkanji_a-kanji_dump.$(OBJEXT)
libkanji_a_OBJECTS = $(am_libkanji_a_OBJECTS)
libluaffi_a_AR = $(AR) $(ARFLAGS)
libluaffi_a_LIBADD =
@@ -2063,6 +2064,7 @@ am__depfiles_remade = ./$(DEPDIR)/aleph-aleph-pool.Po \
pdftexdir/regex/$(DEPDIR)/libpdftex_a-regex_internal.Po \
pdftexdir/regex/$(DEPDIR)/libpdftex_a-regexec.Po \
ptexdir/$(DEPDIR)/libkanji_a-kanji.Po \
+ ptexdir/$(DEPDIR)/libkanji_a-kanji_dump.Po \
ptexdir/$(DEPDIR)/ptex-ptexextra.Po \
synctexdir/$(DEPDIR)/eptex-synctex.Po \
synctexdir/$(DEPDIR)/etex-synctex.Po \
@@ -3626,7 +3628,7 @@ ptex_dependencies = libkanji.a $(pproglib) $(PTEXENC_DEPEND) $(default_dependenc
p_tangle = $(tangle_silent)WEBINPUTS=.:$(srcdir)/ptexdir:$(srcdir) $(buildenv) $(TANGLE)
pweb_programs = pbibtex pdvitype ppltotf ptftopl
pproglib = lib/libp.a
-libkanji_a_SOURCES = ptexdir/kanji.c ptexdir/kanji.h
+libkanji_a_SOURCES = ptexdir/kanji.c ptexdir/kanji.h ptexdir/kanji_dump.c
libkanji_a_CPPFLAGS = $(ptex_cppflags)
ptex_CPPFLAGS = $(ptex_cppflags) $(am__append_121)
@@ -5292,6 +5294,8 @@ ptexdir/$(DEPDIR)/$(am__dirstamp):
@: > ptexdir/$(DEPDIR)/$(am__dirstamp)
ptexdir/libkanji_a-kanji.$(OBJEXT): ptexdir/$(am__dirstamp) \
ptexdir/$(DEPDIR)/$(am__dirstamp)
+ptexdir/libkanji_a-kanji_dump.$(OBJEXT): ptexdir/$(am__dirstamp) \
+ ptexdir/$(DEPDIR)/$(am__dirstamp)
libkanji.a: $(libkanji_a_OBJECTS) $(libkanji_a_DEPENDENCIES) $(EXTRA_libkanji_a_DEPENDENCIES)
$(AM_V_at)-rm -f libkanji.a
@@ -7737,6 +7741,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@pdftexdir/regex/$(DEPDIR)/libpdftex_a-regex_internal.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@pdftexdir/regex/$(DEPDIR)/libpdftex_a-regexec.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@ptexdir/$(DEPDIR)/libkanji_a-kanji.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@ptexdir/$(DEPDIR)/libkanji_a-kanji_dump.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@ptexdir/$(DEPDIR)/ptex-ptexextra.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@synctexdir/$(DEPDIR)/eptex-synctex.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@synctexdir/$(DEPDIR)/etex-synctex.Po@am__quote@ # am--include-marker
@@ -8408,6 +8413,20 @@ ptexdir/libkanji_a-kanji.obj: ptexdir/kanji.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkanji_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ptexdir/libkanji_a-kanji.obj `if test -f 'ptexdir/kanji.c'; then $(CYGPATH_W) 'ptexdir/kanji.c'; else $(CYGPATH_W) '$(srcdir)/ptexdir/kanji.c'; fi`
+ptexdir/libkanji_a-kanji_dump.o: ptexdir/kanji_dump.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkanji_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ptexdir/libkanji_a-kanji_dump.o -MD -MP -MF ptexdir/$(DEPDIR)/libkanji_a-kanji_dump.Tpo -c -o ptexdir/libkanji_a-kanji_dump.o `test -f 'ptexdir/kanji_dump.c' || echo '$(srcdir)/'`ptexdir/kanji_dump.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ptexdir/$(DEPDIR)/libkanji_a-kanji_dump.Tpo ptexdir/$(DEPDIR)/libkanji_a-kanji_dump.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ptexdir/kanji_dump.c' object='ptexdir/libkanji_a-kanji_dump.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkanji_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ptexdir/libkanji_a-kanji_dump.o `test -f 'ptexdir/kanji_dump.c' || echo '$(srcdir)/'`ptexdir/kanji_dump.c
+
+ptexdir/libkanji_a-kanji_dump.obj: ptexdir/kanji_dump.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkanji_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ptexdir/libkanji_a-kanji_dump.obj -MD -MP -MF ptexdir/$(DEPDIR)/libkanji_a-kanji_dump.Tpo -c -o ptexdir/libkanji_a-kanji_dump.obj `if test -f 'ptexdir/kanji_dump.c'; then $(CYGPATH_W) 'ptexdir/kanji_dump.c'; else $(CYGPATH_W) '$(srcdir)/ptexdir/kanji_dump.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ptexdir/$(DEPDIR)/libkanji_a-kanji_dump.Tpo ptexdir/$(DEPDIR)/libkanji_a-kanji_dump.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ptexdir/kanji_dump.c' object='ptexdir/libkanji_a-kanji_dump.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libkanji_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ptexdir/libkanji_a-kanji_dump.obj `if test -f 'ptexdir/kanji_dump.c'; then $(CYGPATH_W) 'ptexdir/kanji_dump.c'; else $(CYGPATH_W) '$(srcdir)/ptexdir/kanji_dump.c'; fi`
+
luatexdir/luaffi/libluaffi_a-call.o: luatexdir/luaffi/call.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libluaffi_a_CPPFLAGS) $(CPPFLAGS) $(libluaffi_a_CFLAGS) $(CFLAGS) -MT luatexdir/luaffi/libluaffi_a-call.o -MD -MP -MF luatexdir/luaffi/$(DEPDIR)/libluaffi_a-call.Tpo -c -o luatexdir/luaffi/libluaffi_a-call.o `test -f 'luatexdir/luaffi/call.c' || echo '$(srcdir)/'`luatexdir/luaffi/call.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) luatexdir/luaffi/$(DEPDIR)/libluaffi_a-call.Tpo luatexdir/luaffi/$(DEPDIR)/libluaffi_a-call.Po
@@ -17086,6 +17105,7 @@ distclean: distclean-recursive
-rm -f pdftexdir/regex/$(DEPDIR)/libpdftex_a-regex_internal.Po
-rm -f pdftexdir/regex/$(DEPDIR)/libpdftex_a-regexec.Po
-rm -f ptexdir/$(DEPDIR)/libkanji_a-kanji.Po
+ -rm -f ptexdir/$(DEPDIR)/libkanji_a-kanji_dump.Po
-rm -f ptexdir/$(DEPDIR)/ptex-ptexextra.Po
-rm -f synctexdir/$(DEPDIR)/eptex-synctex.Po
-rm -f synctexdir/$(DEPDIR)/etex-synctex.Po
@@ -17737,6 +17757,7 @@ maintainer-clean: maintainer-clean-recursive
-rm -f pdftexdir/regex/$(DEPDIR)/libpdftex_a-regex_internal.Po
-rm -f pdftexdir/regex/$(DEPDIR)/libpdftex_a-regexec.Po
-rm -f ptexdir/$(DEPDIR)/libkanji_a-kanji.Po
+ -rm -f ptexdir/$(DEPDIR)/libkanji_a-kanji_dump.Po
-rm -f ptexdir/$(DEPDIR)/ptex-ptexextra.Po
-rm -f synctexdir/$(DEPDIR)/eptex-synctex.Po
-rm -f synctexdir/$(DEPDIR)/etex-synctex.Po
diff --git a/Build/source/texk/web2c/eptexdir/ChangeLog b/Build/source/texk/web2c/eptexdir/ChangeLog
index 02c9bbcc20a..b1ad6f6545b 100644
--- a/Build/source/texk/web2c/eptexdir/ChangeLog
+++ b/Build/source/texk/web2c/eptexdir/ChangeLog
@@ -1,3 +1,7 @@
+2019-01-23 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * eptex.defines: Add dumpkanji and undumpkanji.
+
2018-09-09 Karl Berry <karl@tug.org>
* eptriptest.test,
diff --git a/Build/source/texk/web2c/eptexdir/eptex.defines b/Build/source/texk/web2c/eptexdir/eptex.defines
index e6d9a441504..8e99be92023 100644
--- a/Build/source/texk/web2c/eptexdir/eptex.defines
+++ b/Build/source/texk/web2c/eptexdir/eptex.defines
@@ -40,6 +40,9 @@
@define function getintone ();
@define procedure setintone ();
+@define procedure dumpkanji ();
+@define procedure undumpkanji ();
+
@define procedure initstarttime;
@define procedure getcreationdate;
@define procedure getfilemoddate();
diff --git a/Build/source/texk/web2c/ptexdir/ChangeLog b/Build/source/texk/web2c/ptexdir/ChangeLog
index ebf446f369a..7ae83fc9c73 100644
--- a/Build/source/texk/web2c/ptexdir/ChangeLog
+++ b/Build/source/texk/web2c/ptexdir/ChangeLog
@@ -1,3 +1,17 @@
+2019-01-23 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * ptex-base.ch: Add dump_kanji and undump_kanji.
+ * ptex.defines: Add dumpkanji and undumpkanji.
+ * kanji.c: Factor out init_kanji().
+ * kanji_dump.c: New file for dumping/undumping kanji encoding.
+ * kanji.h: Add init_kanji(), dump_kanji(), and undump_kanji().
+ * am/ptex.am (libkanji_a_SOURCES): Add kanji_dump.c.
+ (all changes based on tl r23753 of upTeX, dated 2011-08-29.)
+
+ * kanji_dump.c: Throw a warning when kanji internal encoding
+ is incompatible with the preloaded format.
+ https://github.com/texjporg/tex-jp-build/issues/55
+
2018-09-09 Karl Berry <karl@tug.org>
* ptriptest.test: LC_ALL=LANGUAGE=C.
diff --git a/Build/source/texk/web2c/ptexdir/am/ptex.am b/Build/source/texk/web2c/ptexdir/am/ptex.am
index eccef3f920c..d8485ff1ca5 100644
--- a/Build/source/texk/web2c/ptexdir/am/ptex.am
+++ b/Build/source/texk/web2c/ptexdir/am/ptex.am
@@ -21,7 +21,7 @@ $(pproglib): $(KPATHSEA_DEPEND) ${srcdir}/lib/*.c
## libkanji.a for pTeX and e-pTeX
##
EXTRA_LIBRARIES += libkanji.a
-libkanji_a_SOURCES = ptexdir/kanji.c ptexdir/kanji.h
+libkanji_a_SOURCES = ptexdir/kanji.c ptexdir/kanji.h ptexdir/kanji_dump.c
libkanji_a_CPPFLAGS = $(ptex_cppflags)
## pTeX
diff --git a/Build/source/texk/web2c/ptexdir/kanji.c b/Build/source/texk/web2c/ptexdir/kanji.c
index 4fd39d2f293..a3f56607612 100644
--- a/Build/source/texk/web2c/ptexdir/kanji.c
+++ b/Build/source/texk/web2c/ptexdir/kanji.c
@@ -72,18 +72,23 @@ integer kcatcodekey(integer c)
return Hi(toDVI(c));
}
-void init_default_kanji (const_string file_str, const_string internal_str)
+void init_kanji (const_string file_str, const_string internal_str)
{
- char *p;
-
- enable_UPTEX (false); /* disable */
-
if (!set_enc_string (file_str, internal_str)) {
fprintf (stderr, "Bad kanji encoding \"%s\" or \"%s\".\n",
file_str ? file_str : "NULL",
internal_str ? internal_str : "NULL");
uexit(1);
}
+}
+
+void init_default_kanji (const_string file_str, const_string internal_str)
+{
+ char *p;
+
+ enable_UPTEX (false); /* disable */
+
+ init_kanji (file_str, internal_str);
p = getenv ("PTEX_KANJI_ENC");
if (p) {
diff --git a/Build/source/texk/web2c/ptexdir/kanji.h b/Build/source/texk/web2c/ptexdir/kanji.h
index b8404c7f1f8..97a458a1087 100644
--- a/Build/source/texk/web2c/ptexdir/kanji.h
+++ b/Build/source/texk/web2c/ptexdir/kanji.h
@@ -39,6 +39,7 @@ extern integer calc_pos (integer c);
#define calcpos calc_pos
extern integer kcatcodekey (integer c);
+extern void init_kanji (const_string file_str, const_string internal_str);
extern void init_default_kanji (const_string file_str, const_string internal_str);
#ifdef PBIBTEX
/* pBibTeX is EUC only */
@@ -63,4 +64,9 @@ extern void init_default_kanji (const_string file_str, const_string internal_str
#define inputline2(fp,buff,pos,size) input_line2(fp,buff,pos,size,NULL)
#endif
+extern void dump_kanji (FILE *fp);
+extern void undump_kanji (FILE *fp);
+#define dumpkanji dump_kanji
+#define undumpkanji undump_kanji
+
#endif /* not KANJI_H */
diff --git a/Build/source/texk/web2c/ptexdir/kanji_dump.c b/Build/source/texk/web2c/ptexdir/kanji_dump.c
new file mode 100644
index 00000000000..991440b3756
--- /dev/null
+++ b/Build/source/texk/web2c/ptexdir/kanji_dump.c
@@ -0,0 +1,48 @@
+/*
+ * Dump/undump Kanji encoding for (e)ptex.
+ */
+
+#include "kanji.h"
+#include <texmfmp.h>
+
+void dump_kanji (FILE *fp)
+{
+ char buffer[12];
+ const char *p = get_enc_string ();
+ size_t len = strlen (p);
+
+ if (len > 11) {
+ fprintf (stderr, "Kanji encoding string \"%s\" exceeds 11 bytes.\n", p);
+ uexit(1);
+ }
+
+ strcpy (buffer, p);
+ for (len++; len < 12; len++)
+ buffer[len] = 0;
+ do_dump (buffer, 1, 12, fp);
+}
+
+void undump_kanji (FILE *fp)
+{
+ char buffer[12];
+ char *p;
+ int i;
+
+ do_undump (buffer, 1, 12, fp);
+ buffer[11] = 0; /* force string termination, just in case */
+
+ p = strchr (buffer, '.');
+ if (p)
+ *p++ = 0;
+ else
+ p = buffer;
+
+ i = get_internal_enc();
+
+ /* Now BUFFER and P are the file and internal encoding strings. */
+ init_kanji (NULL, p);
+ if (get_internal_enc() != i) {
+ fprintf (stderr, "Option --kanji-internal invalid when a format file is loaded.\n", p);
+ fprintf (stderr, "I'll stick to %s.\n", enc_to_string(get_internal_enc()));
+ }
+}
diff --git a/Build/source/texk/web2c/ptexdir/ptex-base.ch b/Build/source/texk/web2c/ptexdir/ptex-base.ch
index 10b657db89e..1020afe8ace 100644
--- a/Build/source/texk/web2c/ptexdir/ptex-base.ch
+++ b/Build/source/texk/web2c/ptexdir/ptex-base.ch
@@ -6144,6 +6144,20 @@ show_code: @<Show the current meaning of a token, then |goto common_ending|@>;
show_mode: @<Show the current japanese processing mode@>;
@z
+@x
+libc_free(format_engine);@/
+@y
+libc_free(format_engine);@/
+dump_kanji(fmt_file);
+@z
+
+@x
+libc_free(format_engine);
+@y
+libc_free(format_engine);
+undump_kanji(fmt_file);
+@z
+
@x l.24982
font_info:=xmalloc_array(fmemory_word, font_mem_size);
@y
diff --git a/Build/source/texk/web2c/ptexdir/ptex.defines b/Build/source/texk/web2c/ptexdir/ptex.defines
index 12caba8bfcd..b64e1b950e2 100644
--- a/Build/source/texk/web2c/ptexdir/ptex.defines
+++ b/Build/source/texk/web2c/ptexdir/ptex.defines
@@ -28,4 +28,6 @@
@define function calcpos ();
@define function kcatcodekey ();
+@define procedure dumpkanji ();
@define procedure initkanji;
+@define procedure undumpkanji ();
diff --git a/Build/source/texk/web2c/uptexdir/ChangeLog b/Build/source/texk/web2c/uptexdir/ChangeLog
index 8d1bb7cca2b..dda72bb8cf2 100644
--- a/Build/source/texk/web2c/uptexdir/ChangeLog
+++ b/Build/source/texk/web2c/uptexdir/ChangeLog
@@ -1,3 +1,9 @@
+2019-01-23 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * kanji_dump.c: Throw a warning when kanji internal encoding
+ is incompatible with the preloaded format.
+ https://github.com/texjporg/tex-jp-build/issues/55
+
2018-09-16 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
* upbibtex.ch: Fix bug of substring$
diff --git a/Build/source/texk/web2c/uptexdir/kanji_dump.c b/Build/source/texk/web2c/uptexdir/kanji_dump.c
index 83760980e95..ce1b6d7d407 100644
--- a/Build/source/texk/web2c/uptexdir/kanji_dump.c
+++ b/Build/source/texk/web2c/uptexdir/kanji_dump.c
@@ -26,6 +26,7 @@ void undump_kanji (FILE *fp)
{
char buffer[12];
char *p;
+ int i;
do_undump (buffer, 1, 12, fp);
buffer[11] = 0; /* force string termination, just in case */
@@ -36,6 +37,12 @@ void undump_kanji (FILE *fp)
else
p = buffer;
+ i = get_internal_enc();
+
/* Now BUFFER and P are the file and internal encoding strings. */
init_kanji (NULL, p);
+ if (get_internal_enc() != i) {
+ fprintf (stderr, "Option --kanji-internal invalid when a format file is loaded.\n", p);
+ fprintf (stderr, "I'll stick to %s.\n", enc_to_string(get_internal_enc()));
+ }
}
diff --git a/Build/source/texk/web2c/uptexdir/uptex-m.ch b/Build/source/texk/web2c/uptexdir/uptex-m.ch
index 848783bce7a..6d52e7f24ba 100644
--- a/Build/source/texk/web2c/uptexdir/uptex-m.ch
+++ b/Build/source/texk/web2c/uptexdir/uptex-m.ch
@@ -1082,20 +1082,6 @@ if (t<cs_token_flag+single_base)and(not check_kanji(t)) then
@z
@x
-libc_free(format_engine);@/
-@y
-libc_free(format_engine);@/
-dump_kanji(fmt_file);
-@z
-
-@x
-libc_free(format_engine);
-@y
-libc_free(format_engine);
-undump_kanji(fmt_file);
-@z
-
-@x
@d set_auto_xspacing_code=3
@y
@d set_auto_xspacing_code=3