diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-08-30 08:10:12 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-08-30 08:10:12 +0000 |
commit | cad740e59da5645afeef3045f6e9440deddf898a (patch) | |
tree | e3393f228d618623773ac68a09198a0bcf4e7b37 | |
parent | fe6ea2842c978f1855eff73d5fc05c4196873ae2 (diff) |
(e-)upTeX: dump/undump internal kanji encoding
git-svn-id: svn://tug.org/texlive/trunk@23753 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/web2c/Makefile.in | 20 | ||||
-rw-r--r-- | Build/source/texk/web2c/euptexdir/ChangeLog | 1 | ||||
-rw-r--r-- | Build/source/texk/web2c/euptexdir/euptex.defines | 3 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/am/uptex.am | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/kanji.c | 17 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/kanji.h | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/kanji_dump.c | 41 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/uptex-m.ch | 14 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/uptex.defines | 2 |
10 files changed, 104 insertions, 9 deletions
diff --git a/Build/source/texk/web2c/Makefile.in b/Build/source/texk/web2c/Makefile.in index 777c393a0d3..cb9036f28f2 100644 --- a/Build/source/texk/web2c/Makefile.in +++ b/Build/source/texk/web2c/Makefile.in @@ -545,7 +545,8 @@ am_libpdftex_a_OBJECTS = libpdftex_a-avl.$(OBJEXT) \ libpdftex_a_OBJECTS = $(am_libpdftex_a_OBJECTS) libukanji_a_AR = $(AR) $(ARFLAGS) libukanji_a_LIBADD = -am_libukanji_a_OBJECTS = libukanji_a-kanji.$(OBJEXT) +am_libukanji_a_OBJECTS = libukanji_a-kanji.$(OBJEXT) \ + libukanji_a-kanji_dump.$(OBJEXT) libukanji_a_OBJECTS = $(am_libukanji_a_OBJECTS) libxetex_a_AR = $(AR) $(ARFLAGS) libxetex_a_LIBADD = @@ -1944,7 +1945,7 @@ upweb_tests = \ uptexdir/uppltotf.test \ uptexdir/uptftopl.test -libukanji_a_SOURCES = uptexdir/kanji.c uptexdir/kanji.h +libukanji_a_SOURCES = uptexdir/kanji.c uptexdir/kanji.h uptexdir/kanji_dump.c libukanji_a_CPPFLAGS = $(uptex_cppflags) uptex_CPPFLAGS = $(uptex_cppflags) $(am__append_97) @@ -3433,6 +3434,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpdftex_a-writettf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpdftex_a-writezip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libukanji_a-kanji.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libukanji_a-kanji_dump.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxetex_a-FontTableCache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxetex_a-XeTeXFontInst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxetex_a-XeTeXFontInst_FT2.Po@am__quote@ @@ -7177,6 +7179,20 @@ libukanji_a-kanji.obj: uptexdir/kanji.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libukanji_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libukanji_a-kanji.obj `if test -f 'uptexdir/kanji.c'; then $(CYGPATH_W) 'uptexdir/kanji.c'; else $(CYGPATH_W) '$(srcdir)/uptexdir/kanji.c'; fi` +libukanji_a-kanji_dump.o: uptexdir/kanji_dump.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libukanji_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libukanji_a-kanji_dump.o -MD -MP -MF $(DEPDIR)/libukanji_a-kanji_dump.Tpo -c -o libukanji_a-kanji_dump.o `test -f 'uptexdir/kanji_dump.c' || echo '$(srcdir)/'`uptexdir/kanji_dump.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libukanji_a-kanji_dump.Tpo $(DEPDIR)/libukanji_a-kanji_dump.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='uptexdir/kanji_dump.c' object='libukanji_a-kanji_dump.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libukanji_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libukanji_a-kanji_dump.o `test -f 'uptexdir/kanji_dump.c' || echo '$(srcdir)/'`uptexdir/kanji_dump.c + +libukanji_a-kanji_dump.obj: uptexdir/kanji_dump.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libukanji_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libukanji_a-kanji_dump.obj -MD -MP -MF $(DEPDIR)/libukanji_a-kanji_dump.Tpo -c -o libukanji_a-kanji_dump.obj `if test -f 'uptexdir/kanji_dump.c'; then $(CYGPATH_W) 'uptexdir/kanji_dump.c'; else $(CYGPATH_W) '$(srcdir)/uptexdir/kanji_dump.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libukanji_a-kanji_dump.Tpo $(DEPDIR)/libukanji_a-kanji_dump.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='uptexdir/kanji_dump.c' object='libukanji_a-kanji_dump.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libukanji_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libukanji_a-kanji_dump.obj `if test -f 'uptexdir/kanji_dump.c'; then $(CYGPATH_W) 'uptexdir/kanji_dump.c'; else $(CYGPATH_W) '$(srcdir)/uptexdir/kanji_dump.c'; fi` + libxetex_a-XeTeX_ext.o: xetexdir/XeTeX_ext.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxetex_a_CPPFLAGS) $(CPPFLAGS) $(libxetex_a_CFLAGS) $(CFLAGS) -MT libxetex_a-XeTeX_ext.o -MD -MP -MF $(DEPDIR)/libxetex_a-XeTeX_ext.Tpo -c -o libxetex_a-XeTeX_ext.o `test -f 'xetexdir/XeTeX_ext.c' || echo '$(srcdir)/'`xetexdir/XeTeX_ext.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libxetex_a-XeTeX_ext.Tpo $(DEPDIR)/libxetex_a-XeTeX_ext.Po diff --git a/Build/source/texk/web2c/euptexdir/ChangeLog b/Build/source/texk/web2c/euptexdir/ChangeLog index 44f50dc779d..45d39060765 100644 --- a/Build/source/texk/web2c/euptexdir/ChangeLog +++ b/Build/source/texk/web2c/euptexdir/ChangeLog @@ -1,6 +1,7 @@ 2011-08-29 Peter Breitenlohner <peb@mppmu.mpg.de> * euptex.defines: Remove setptexencuptex. + Add dumpkanji and undumpkanji. 2011-08-24 Peter Breitenlohner <peb@mppmu.mpg.de> diff --git a/Build/source/texk/web2c/euptexdir/euptex.defines b/Build/source/texk/web2c/euptexdir/euptex.defines index 9de987e72be..c888699960f 100644 --- a/Build/source/texk/web2c/euptexdir/euptex.defines +++ b/Build/source/texk/web2c/euptexdir/euptex.defines @@ -44,3 +44,6 @@ @define function getintone(); @define procedure setintone(); + +@define procedure dumpkanji (); +@define procedure undumpkanji (); diff --git a/Build/source/texk/web2c/uptexdir/ChangeLog b/Build/source/texk/web2c/uptexdir/ChangeLog index 157d48cf4b8..d4dc6381cc7 100644 --- a/Build/source/texk/web2c/uptexdir/ChangeLog +++ b/Build/source/texk/web2c/uptexdir/ChangeLog @@ -3,6 +3,13 @@ * kanji.h, uptex.defines: Remove setptexencuptex. * upbibtex.ch: Use nil, not 0 as arg of set_enc_string(). + * uptex-m.ch: Add dump_kanji and undump_kanji. + * uptex.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/uptex.am (libukanji_a_SOURCES): Add kanji_dump.c. + 2011-08-24 Peter Breitenlohner <peb@mppmu.mpg.de> Imported upTeX into TeX Live, based on the W32TeX version diff --git a/Build/source/texk/web2c/uptexdir/am/uptex.am b/Build/source/texk/web2c/uptexdir/am/uptex.am index 98b589bb106..545b6bad4b2 100644 --- a/Build/source/texk/web2c/uptexdir/am/uptex.am +++ b/Build/source/texk/web2c/uptexdir/am/uptex.am @@ -25,7 +25,7 @@ DISTCLEANFILES += $(upweb_programs:=.c) $(upweb_programs:=.h) \ ## libukanji.a for upTeX and e-upTeX ## EXTRA_LIBRARIES += libukanji.a -libukanji_a_SOURCES = uptexdir/kanji.c uptexdir/kanji.h +libukanji_a_SOURCES = uptexdir/kanji.c uptexdir/kanji.h uptexdir/kanji_dump.c libukanji_a_CPPFLAGS = $(uptex_cppflags) ## upTeX diff --git a/Build/source/texk/web2c/uptexdir/kanji.c b/Build/source/texk/web2c/uptexdir/kanji.c index 533785ccaeb..36ffdc22db5 100644 --- a/Build/source/texk/web2c/uptexdir/kanji.c +++ b/Build/source/texk/web2c/uptexdir/kanji.c @@ -361,6 +361,16 @@ integer multilenbuffchar(integer c) return 0; } +void init_kanji (const_string file_str, const_string internal_str) +{ + 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; @@ -382,10 +392,5 @@ void init_default_kanji (const_string file_str, const_string internal_str) } #endif - 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); - } + init_kanji (file_str, internal_str); } diff --git a/Build/source/texk/web2c/uptexdir/kanji.h b/Build/source/texk/web2c/uptexdir/kanji.h index 68b2b50a2d5..76e577bdd0a 100644 --- a/Build/source/texk/web2c/uptexdir/kanji.h +++ b/Build/source/texk/web2c/uptexdir/kanji.h @@ -37,6 +37,7 @@ extern integer calc_pos (integer c); extern integer kcatcodekey (integer c); extern integer multilenbuffchar (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); /* for upTeX and e-upTeX */ #define initdefaultkanji() init_default_kanji("utf8", "uptex") @@ -57,4 +58,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/uptexdir/kanji_dump.c b/Build/source/texk/web2c/uptexdir/kanji_dump.c new file mode 100644 index 00000000000..83760980e95 --- /dev/null +++ b/Build/source/texk/web2c/uptexdir/kanji_dump.c @@ -0,0 +1,41 @@ +/* + * Dump/undump Kanji encoding for (e)upTeX. + */ + +#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; + + 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; + + /* Now BUFFER and P are the file and internal encoding strings. */ + init_kanji (NULL, p); +} diff --git a/Build/source/texk/web2c/uptexdir/uptex-m.ch b/Build/source/texk/web2c/uptexdir/uptex-m.ch index 677385b5247..f08018be63a 100644 --- a/Build/source/texk/web2c/uptexdir/uptex-m.ch +++ b/Build/source/texk/web2c/uptexdir/uptex-m.ch @@ -1005,6 +1005,20 @@ if (t<cs_token_flag+single_base)and(check_kanji(t,7)<2) 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 begin p:=cur_chr; scan_int; n:=cur_val; scan_optional_equals; scan_int; if not check_kanji(cur_val) then @y diff --git a/Build/source/texk/web2c/uptexdir/uptex.defines b/Build/source/texk/web2c/uptexdir/uptex.defines index 53b133a2e20..9871d4a15e0 100644 --- a/Build/source/texk/web2c/uptexdir/uptex.defines +++ b/Build/source/texk/web2c/uptexdir/uptex.defines @@ -42,6 +42,8 @@ @define function multilenbuffchar (); @define function nrestmultichr (); +@define procedure dumpkanji (); @define procedure initkanji; +@define procedure undumpkanji (); @define var sjisterminal; |