diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-11-22 09:32:12 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-11-22 09:32:12 +0000 |
commit | bf1100bc0559d7736900cd939457223bba155f96 (patch) | |
tree | 289c948662695bd47fdaf8183bec8ccf34e38428 /Build | |
parent | 22e7bc1f115d9c255d3940ffc7f7b26b0bac7a75 (diff) |
dvi2tty: upTeX support from Tanaka Takuji
git-svn-id: svn://tug.org/texlive/trunk@24634 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
20 files changed, 981 insertions, 157 deletions
diff --git a/Build/source/configure b/Build/source/configure index 8aaf9323a2c..c1defc0a213 100755 --- a/Build/source/configure +++ b/Build/source/configure @@ -4554,7 +4554,7 @@ $as_echo "$as_me: Assuming \`--enable-dvi2tty=$enable_dvi2tty'" >&6;} esac test "x$enable_dvi2tty" = xno || { - need_kpathsea=yes + need_ptexenc=yes } diff --git a/Build/source/libs/configure b/Build/source/libs/configure index 00247b92153..047e02d0a80 100755 --- a/Build/source/libs/configure +++ b/Build/source/libs/configure @@ -3879,7 +3879,7 @@ $as_echo "$as_me: Assuming \`--enable-dvi2tty=$enable_dvi2tty'" >&6;} esac test "x$enable_dvi2tty" = xno || { - need_kpathsea=yes + need_ptexenc=yes } diff --git a/Build/source/texk/configure b/Build/source/texk/configure index 1bd477f63cb..4a5d2c8498a 100755 --- a/Build/source/texk/configure +++ b/Build/source/texk/configure @@ -3899,7 +3899,7 @@ $as_echo "$as_me: Assuming \`--enable-dvi2tty=$enable_dvi2tty'" >&6;} esac test "x$enable_dvi2tty" = xno || { - need_kpathsea=yes + need_ptexenc=yes } diff --git a/Build/source/texk/dvi2tty/ChangeLog b/Build/source/texk/dvi2tty/ChangeLog index 24e3660cd92..5625227339e 100644 --- a/Build/source/texk/dvi2tty/ChangeLog +++ b/Build/source/texk/dvi2tty/ChangeLog @@ -1,3 +1,10 @@ +2011-11-21 Peter Breitenlohner <peb@mppmu.mpg.de> + + Add upTeX support from Tanaka Takuji <KXD02663@nifty.ne.jp>. + * ac/withenable.ac, Makefile.am: Require ptexenc. + * version.ac (new): Define dvi2tty_version. + * configure.ac: Adapted. + 2011-01-26 Peter Breitenlohner <peb@mppmu.mpg.de> * dvi2tty.test: Unset DVI2TTY to nullify dvi2tty options. diff --git a/Build/source/texk/dvi2tty/Makefile.am b/Build/source/texk/dvi2tty/Makefile.am index 67257f9bb85..f25c6d327ac 100644 --- a/Build/source/texk/dvi2tty/Makefile.am +++ b/Build/source/texk/dvi2tty/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am for the TeX Live subdirectory texk/dvi2tty/ ## -## Copyright (C) 2009 - 2011 Peter Breitenlohner <tex-live@tug.org> +## Copyright (C) 2009-2011 Peter Breitenlohner <tex-live@tug.org> ## You may freely use, modify and/or distribute this file. ## ACLOCAL_AMFLAGS = -I ../../m4 @@ -17,7 +17,7 @@ EXTRA_DIST += $(DVI2TTY_TREE)-PATCHES dist-hook: rm -rf `find $(distdir) -name .svn` -INCLUDES = $(KPATHSEA_INCLUDES) +INCLUDES = $(PTEXENC_INCLUDES) $(KPATHSEA_INCLUDES) AM_CPPFLAGS = -DKPATHSEA AM_CFLAGS = $(WARNING_CFLAGS) @@ -36,13 +36,19 @@ dvi2tty_SOURCES = \ $(DVI2TTY_TREE)/dvi2tty.c \ $(DVI2TTY_TREE)/dvi2tty.h \ $(DVI2TTY_TREE)/dvistuff.c - -$(dvi2tty_OBJECTS): $(KPATHSEA_DEPEND) + +$(dvi2tty_OBJECTS): $(KPATHSEA_DEPEND) $(PTEXENC_DEPEND) + +dvi2tty_LDADD = $(PTEXENC_LIBS) $(LDADD) man1_MANS = \ $(DVI2TTY_TREE)/disdvi.1 \ $(DVI2TTY_TREE)/dvi2tty.1 +## Rebuild libkpathsea & libptexenc +@KPATHSEA_RULE@ +@PTEXENC_RULE@ + ## Tests. ## TESTS = dvi2tty.test diff --git a/Build/source/texk/dvi2tty/Makefile.in b/Build/source/texk/dvi2tty/Makefile.in index 71db038c303..79f2ae81537 100644 --- a/Build/source/texk/dvi2tty/Makefile.in +++ b/Build/source/texk/dvi2tty/Makefile.in @@ -52,12 +52,13 @@ DIST_COMMON = $(am__configure_deps) \ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../../m4/kpse-common.m4 \ $(top_srcdir)/../../m4/kpse-kpathsea-flags.m4 \ + $(top_srcdir)/../../m4/kpse-ptexenc-flags.m4 \ $(top_srcdir)/../../m4/kpse-warnings.m4 \ $(top_srcdir)/../../m4/libtool.m4 \ $(top_srcdir)/../../m4/ltoptions.m4 \ $(top_srcdir)/../../m4/ltsugar.m4 \ $(top_srcdir)/../../m4/ltversion.m4 \ - $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 $(top_srcdir)/version.ac \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -76,8 +77,8 @@ am__DEPENDENCIES_1 = disdvi_DEPENDENCIES = $(am__DEPENDENCIES_1) am_dvi2tty_OBJECTS = dvi2tty.$(OBJEXT) dvistuff.$(OBJEXT) dvi2tty_OBJECTS = $(am_dvi2tty_OBJECTS) -dvi2tty_LDADD = $(LDADD) -dvi2tty_DEPENDENCIES = $(am__DEPENDENCIES_1) +am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) +dvi2tty_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/../../build-aux/depcomp am__depfiles_maybe = depfiles @@ -193,6 +194,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PTEXENC_DEPEND = @PTEXENC_DEPEND@ +PTEXENC_INCLUDES = @PTEXENC_INCLUDES@ +PTEXENC_LIBS = @PTEXENC_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -255,7 +259,7 @@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I ../../m4 EXTRA_DIST = $(DVI2TTY_TREE) $(DVI2TTY_TREE)-PATCHES $(TESTS) \ ligtest.tty test.tty testc.tty tests.tty testu.tty -INCLUDES = $(KPATHSEA_INCLUDES) +INCLUDES = $(PTEXENC_INCLUDES) $(KPATHSEA_INCLUDES) AM_CPPFLAGS = -DKPATHSEA AM_CFLAGS = $(WARNING_CFLAGS) LDADD = $(KPATHSEA_LIBS) @@ -269,6 +273,7 @@ dvi2tty_SOURCES = \ $(DVI2TTY_TREE)/dvi2tty.h \ $(DVI2TTY_TREE)/dvistuff.c +dvi2tty_LDADD = $(PTEXENC_LIBS) $(LDADD) man1_MANS = \ $(DVI2TTY_TREE)/disdvi.1 \ $(DVI2TTY_TREE)/dvi2tty.1 @@ -941,7 +946,10 @@ dist-hook: $(disdvi_OBJECTS): $(KPATHSEA_DEPEND) -$(dvi2tty_OBJECTS): $(KPATHSEA_DEPEND) +$(dvi2tty_OBJECTS): $(KPATHSEA_DEPEND) $(PTEXENC_DEPEND) + +@KPATHSEA_RULE@ +@PTEXENC_RULE@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/Build/source/texk/dvi2tty/ac/withenable.ac b/Build/source/texk/dvi2tty/ac/withenable.ac index 09ef82add68..ac1b7444bc8 100644 --- a/Build/source/texk/dvi2tty/ac/withenable.ac +++ b/Build/source/texk/dvi2tty/ac/withenable.ac @@ -1,7 +1,7 @@ ## texk/dvi2tty/ac/withenable.ac: configure.ac fragment for the TeX Live subdirectory texk/dvi2tty/ dnl -dnl Copyright (C) 2009 Peter Breitenlohner <tex-live@tug.org> +dnl Copyright (C) 2009, 2011 Peter Breitenlohner <tex-live@tug.org> dnl You may freely use, modify and/or distribute this file. dnl ## configure options and TL libraries required for dvi2tty -KPSE_ENABLE_PROG([dvi2tty], [kpathsea]) +KPSE_ENABLE_PROG([dvi2tty], [ptexenc]) diff --git a/Build/source/texk/dvi2tty/aclocal.m4 b/Build/source/texk/dvi2tty/aclocal.m4 index d77f3a9c0b1..63ec116f56c 100644 --- a/Build/source/texk/dvi2tty/aclocal.m4 +++ b/Build/source/texk/dvi2tty/aclocal.m4 @@ -991,6 +991,7 @@ AC_SUBST([am__untar]) m4_include([../../m4/kpse-common.m4]) m4_include([../../m4/kpse-kpathsea-flags.m4]) +m4_include([../../m4/kpse-ptexenc-flags.m4]) m4_include([../../m4/kpse-warnings.m4]) m4_include([../../m4/libtool.m4]) m4_include([../../m4/ltoptions.m4]) diff --git a/Build/source/texk/dvi2tty/configure b/Build/source/texk/dvi2tty/configure index e59d8776ba9..510bfbe92f0 100755 --- a/Build/source/texk/dvi2tty/configure +++ b/Build/source/texk/dvi2tty/configure @@ -617,6 +617,10 @@ am__EXEEXT_TRUE LTLIBOBJS LIBOBJS DVI2TTY_TREE +PTEXENC_RULE +PTEXENC_DEPEND +PTEXENC_LIBS +PTEXENC_INCLUDES KPATHSEA_RULE KPATHSEA_DEPEND KPATHSEA_LIBS @@ -750,6 +754,9 @@ enable_compiler_warnings with_system_kpathsea with_kpathsea_includes with_kpathsea_libdir +with_system_ptexenc +with_ptexenc_includes +with_ptexenc_libdir ' ac_precious_vars='build_alias host_alias @@ -1408,6 +1415,11 @@ Optional Packages: kpathsea headers installed in DIR --with-kpathsea-libdir=DIR kpathsea library installed in DIR + --with-system-ptexenc use installed ptexenc headers and library + --with-ptexenc-includes=DIR + ptexenc headers installed in DIR + --with-ptexenc-libdir=DIR + ptexenc library installed in DIR Some influential environment variables: CC C compiler command @@ -14040,6 +14052,44 @@ if test "x$kpse_cv_kpse_debug" != xyes; then : KPATHSEA_INCLUDES="$KPATHSEA_INCLUDES -DNO_DEBUG" fi +## _KPSE_LIB_FLAGS: Setup ptexenc (-lptexenc) flags + +# Check whether --with-system-ptexenc was given. +if test "${with_system_ptexenc+set}" = set; then : + withval=$with_system_ptexenc; +fi + +# Check whether --with-ptexenc-includes was given. +if test "${with_ptexenc_includes+set}" = set; then : + withval=$with_ptexenc_includes; +fi + +# Check whether --with-ptexenc-libdir was given. +if test "${with_ptexenc_libdir+set}" = set; then : + withval=$with_ptexenc_libdir; +fi +if test "x$with_system_ptexenc" = xyes; then + if test "x$with_ptexenc_includes" != x && test "x$with_ptexenc_includes" != xyes; then + PTEXENC_INCLUDES="-I$with_ptexenc_includes" +fi +PTEXENC_LIBS="-lptexenc" +if test "x$with_ptexenc_libdir" != x && test "x$with_ptexenc_libdir" != xyes; then + PTEXENC_LIBS="-L$with_ptexenc_libdir $PTEXENC_LIBS" +fi +else + PTEXENC_INCLUDES=`echo '-IBLD/texk/ptexenc -ISRC/texk/ptexenc' | sed \ + -e "s,SRC/,$kpse_SRC/,g" \ + -e "s,BLD/,$kpse_BLD/,g"` + PTEXENC_LIBS=`echo 'BLD/texk/ptexenc/libptexenc.la' | sed \ + -e "s,BLD/,$kpse_BLD/,g"` + + PTEXENC_DEPEND=`echo 'BLD/texk/ptexenc/libptexenc.la' | sed \ + -e 's,BLD/texk/,${top_builddir}/../,g'` + PTEXENC_RULE='# Rebuild libptexenc +$(PTEXENC_DEPEND): ${top_srcdir}/../ptexenc/*.c ${top_srcdir}/../ptexenc/ptexenc/*.h + cd ${top_builddir}/../ptexenc && $(MAKE) $(AM_MAKEFLAGS) rebuild' +fi + DVI2TTY_TREE=dvi2tty-5.3.4 diff --git a/Build/source/texk/dvi2tty/configure.ac b/Build/source/texk/dvi2tty/configure.ac index ebaea23d17b..bd80a5601b6 100644 --- a/Build/source/texk/dvi2tty/configure.ac +++ b/Build/source/texk/dvi2tty/configure.ac @@ -1,12 +1,12 @@ dnl Process this file with autoconf to produce a configure script. dnl -dnl Copyright (C) 2009, 2010 Peter Breitenlohner <tex-live@tug.org> +dnl Copyright (C) 2009-2011 Peter Breitenlohner <tex-live@tug.org> dnl dnl This file is free software; the copyright holder dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl -m4_define([dvi2tty_version], [5.3.4])[]dnl using unmodified dvi2tty source tree +m4_include([version.ac])[] dnl define dvi2tty_version AC_INIT([dvi2tty for TeX Live], dvi2tty_version, [tex-k@tug.org]) AC_PREREQ([2.65]) AC_CONFIG_SRCDIR([dvi2tty-]dvi2tty_version[/dvi2tty.c]) @@ -19,9 +19,9 @@ KPSE_COMMON([dvi2tty]) AC_CONFIG_HEADERS([c-auto.h:c-auto.in]) KPSE_KPATHSEA_FLAGS +KPSE_PTEXENC_FLAGS -DVI2TTY_TREE=[dvi2tty-]dvi2tty_version -AC_SUBST([DVI2TTY_TREE]) +AC_SUBST([DVI2TTY_TREE], [dvi2tty-]dvi2tty_version) AC_CONFIG_FILES([Makefile]) diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.4-PATCHES/ChangeLog b/Build/source/texk/dvi2tty/dvi2tty-5.3.4-PATCHES/ChangeLog index 2678b33e926..01f2e471a77 100644 --- a/Build/source/texk/dvi2tty/dvi2tty-5.3.4-PATCHES/ChangeLog +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.4-PATCHES/ChangeLog @@ -1,9 +1,16 @@ +2011-11-21 Peter Breitenlohner <peb@mppmu.mpg.de> + + * patch-03-uptex: New patch for upTeX support + from Tanaka Takuji <KXD02663@nifty.ne.jp>. + 2011-01-27 Peter Breitenlohner <peb@mppmu.mpg.de> + * patch-02-initialize: New patch: * dvistuff.c (fontdef): Initialize the fontnum member. 2011-01-26 Peter Breitenlohner <peb@mppmu.mpg.de> + * patch-01-typecast: New patch: * dvistuff.c (dopage): Typecast dochar() argument to the parameter type 'unsigned char', not to 'char'. diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.4-PATCHES/patch-03-uptex b/Build/source/texk/dvi2tty/dvi2tty-5.3.4-PATCHES/patch-03-uptex new file mode 100644 index 00000000000..7e50b25af42 --- /dev/null +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.4-PATCHES/patch-03-uptex @@ -0,0 +1,646 @@ +diff -ur dvi2tty-5.3.4.orig/Changelog dvi2tty-5.3.4/Changelog +--- dvi2tty-5.3.4.orig/Changelog 2010-11-13 16:36:04.000000000 +0100 ++++ dvi2tty-5.3.4/Changelog 2011-11-21 19:56:42.000000000 +0100 +@@ -1,4 +1,9 @@ + /****************************************************************************** ++ * Takuji Tanaka: 20111119 (KXD02663@nifty.ne.jp) ++ * Used ptexenc library for Japanese TeX. ++ * Enabled UTF8 output for Japanese TeX with option -Eu. ++ * Added upTeX DVI support with option -U. ++ * Added auto detected Japanese fonts in japanese-otf package. + * Marcel Mol: 20101113 (marcel@mesa.nl) + * Version 5.3.4 + * Fix VERSION code +diff -ur dvi2tty-5.3.4.orig/dvi2tty.1 dvi2tty-5.3.4/dvi2tty.1 +--- dvi2tty-5.3.4.orig/dvi2tty.1 2010-11-13 16:30:56.000000000 +0100 ++++ dvi2tty-5.3.4/dvi2tty.1 2011-11-21 21:26:24.000000000 +0100 +@@ -129,7 +129,7 @@ + Note this may interfere with -u. Best not to use -u and -s together. + .TP + .B \-J +-Auto detect NTT JTeX and ASCII pTeX dvi format. ++Auto detect NTT JTeX, ASCII pTeX, and upTeX dvi format. + .TP + .B \-N + Display NTT JTeX dvi. +@@ -137,6 +137,13 @@ + .B \-A + Display ASCII pTeX dvi. + .TP ++.B \-U ++Display upTeX dvi. ++.TP ++.B \-Eenc ++Set output Japanese encoding. The enc argument 'e', 's', 'j', and 'u' ++denotes EUC-JP, Shift_JIS, ISO-2022-JP, and UTF-8, respectively. ++.TP + .B \-bdelim + Print the name of fonts when switching to it (and ending it). The delim + argument is used to delimit the fontname. +diff -ur dvi2tty-5.3.4.orig/dvi2tty.c dvi2tty-5.3.4/dvi2tty.c +--- dvi2tty-5.3.4.orig/dvi2tty.c 2010-11-13 16:33:50.000000000 +0100 ++++ dvi2tty-5.3.4/dvi2tty.c 2011-11-21 22:30:24.000000000 +0100 +@@ -55,11 +55,11 @@ + + #define MAXLEN 100 /* size of char-arrays for strings */ + #if defined(MSDOS) || defined(VMS) || defined(AMIGA) +-#define OPTSET "haJwepPousltvbcAN" /* legal options */ +-#define OPTWARG "wepPovb" /* options with argument */ ++#define OPTSET "haJweEpPousltvbcANU" /* legal options */ ++#define OPTWARG "weEpPovb" /* options with argument */ + #else +-#define OPTSET "haJwepPousqlfFtvbcAN"/* legal options */ +-#define OPTWARG "wepPoFvb" /* options with argument */ ++#define OPTSET "haJweEpPousqlfFtvbcANU" /* legal options */ ++#define OPTWARG "weEpPoFvb" /* options with argument */ + #endif + + /* +@@ -75,10 +75,9 @@ + #define bdopt 7 /* bad option */ + #define onepp 8 /* only one page list allowed */ + #define noarg 9 /* argument expected */ +-#define confl 10 /* -N and -A conflict */ +-#define confj 11 /* -J conflicts -N or -A */ ++#define confl 10 /* -J, -N, -A, and -U conflict */ + #if defined(THINK_C) +-#define nored 12 /* if no input file, redirect stdin */ ++#define nored 11 /* if no input file, redirect stdin */ + #endif + + +@@ -166,6 +165,7 @@ + Argc = argc; + Argv = argv; + ++ set_enc_string (NULL, "default"); + getargs(); /* read command line arguments */ + #if defined(THINK_C) + if (inputfromfile) { +@@ -380,10 +380,35 @@ + j = strlen(optarg); + break; + #endif +- /* case 'J' : japan = TRUE; break; */ + case 'J' : jautodetect = TRUE; break; +- case 'A' : asciip = TRUE; break; /* ASCII pTeX */ +- case 'N' : japan = TRUE; break; /* NTT jTeX */ ++ case 'U' : uptex = TRUE; japan = TRUE; /* upTeX */ ++ jautodetect = FALSE; ++ enable_UPTEX(true); ++ set_enc_string (NULL, UPTEX_INTERNAL_ENC); ++ break; ++ case 'A' : asciip = TRUE; japan = TRUE; /* ASCII pTeX */ ++ jautodetect = FALSE; ++ set_enc_string (NULL, PTEX_INTERNAL_ENC); ++ break; ++ case 'N' : nttj = TRUE; japan = TRUE; /* NTT jTeX */ ++ jautodetect = FALSE; ++ set_enc_string (NULL, JTEX_INTERNAL_ENC); ++ break; ++ case 'E' : ++ switch (optarg[0]) { ++ case 'e' : ++ set_enc_string ("euc", NULL); break; ++ case 's' : ++ set_enc_string ("sjis", NULL); break; ++ case 'j' : ++ set_enc_string ("jis", NULL); break; ++ case 'u' : ++ set_enc_string ("utf8", NULL); break; ++ default : ++ usage(noarg); ++ } ++ j++; ++ break; + case 't' : ttfont = TRUE; break; + case 'l' : noffd = TRUE; break; + case 's' : scascii ^= 1; break; +@@ -436,14 +461,12 @@ + } + + /* Option conflict */ +- if (japan && asciip) { ++ if ((asciip && uptex) || ++ (nttj && (asciip || uptex)) || ++ (jautodetect && (nttj || asciip || uptex))) { + usage(confl); + } + +- if (jautodetect && (japan || asciip)) { +- usage(confj); +- } +- + return; + + } /* setoption */ +@@ -707,7 +730,10 @@ + void usage(int uerr) + { + +- fprintf(stderr, "%s", Copyright); ++ if (jautodetect || nttj || asciip || uptex) ++ fprintf(stderr, "%s (%s) %s", Progname, get_enc_string(), Copyright); ++ else ++ fprintf(stderr, "%s %s", Progname, Copyright); + + if (uerr != ign) { + fprintf(stderr,"\n%s: ", progname); +@@ -734,9 +760,7 @@ + break; + case onepp : fprintf(stderr, "only one pagelist allowed"); + break; +- case confl : fprintf(stderr, "-N and -A are conflicting"); +- break; +- case confj : fprintf(stderr, "-J conflicts -N or -A"); ++ case confl : fprintf(stderr, "-J, -N, -A, and -U are mutually exclusive"); + break; + #if defined(THINK_C) + case nored : fprintf(stderr, "\nIf no input file is given in\ +@@ -794,12 +818,16 @@ + fprintf(stderr, + " -u Toggle latin1 support (default %s).\n", DEFLATIN1 ? "on" : "off"); + fprintf(stderr, +- " -J Enable auto detect for NTT JTeX and ASCII pTeX (japanese fonts).\n"); ++ " -J Enable auto detect for NTT JTeX, ASCII pTeX, and upTeX (japanese fonts).\n"); + fprintf(stderr, + " -N Support NTT JTeX dvi.\n"); + fprintf(stderr, + " -A Support ASCII pTeX dvi.\n"); + fprintf(stderr, ++ " -U Support upTeX dvi.\n"); ++ fprintf(stderr, ++ " -Eenc Output Japanese encoding. e:EUC s:SJIS j:JIS, u:UTF8.\n"); ++ fprintf(stderr, + " -c Override -a -u -s and print all characters 0-255.\n"); + fprintf(stderr, + " -bdelim Print font switch as text: delimcmr10miled\n"); +diff -ur dvi2tty-5.3.4.orig/dvi2tty.h dvi2tty-5.3.4/dvi2tty.h +--- dvi2tty-5.3.4.orig/dvi2tty.h 2010-11-13 16:33:42.000000000 +0100 ++++ dvi2tty-5.3.4/dvi2tty.h 2011-11-21 22:28:42.000000000 +0100 +@@ -20,7 +20,8 @@ + + #define VERSION "5.3.4" + +-#define Copyright "dvi2tty Copyright (C) 1984, 1985, 1986 Svante Lindahl.\n\ ++#define Progname "dvi2tty" ++#define Copyright "Copyright (C) 1984, 1985, 1986 Svante Lindahl.\n\ + Copyright (C) 1989-2010 M.J.E. Mol, MESA Consulting B.V." + + +@@ -54,6 +55,18 @@ + */ + #define MAXTERMWIDTH 332 + ++#include <ptexenc/ptexenc.h> ++#include <ptexenc/unicode.h> ++ ++/* internal encoding for NTT JTeX : "euc" */ ++#define JTEX_INTERNAL_ENC "euc" ++ ++/* internal encoding for ASCII pTeX : "euc" or "sjis" */ ++#define PTEX_INTERNAL_ENC "euc" ++ ++/* internal encoding for upTeX : "uptex" */ ++#define UPTEX_INTERNAL_ENC "uptex" ++ + /* + * ERROR CODES , don't start with 0 + */ +@@ -109,9 +122,11 @@ + extern bool latin1; /* latin1 chars (dvistuff.c) */ + extern bool accent; /* Output accent stuff(dvistuff.c) */ + extern bool ttfont; /* tt font assumed (dvistuff.c) */ +-extern bool japan; /* NTT jTeX font support (dvistuff.c) */ ++extern bool jautodetect; /* Autodetect NTT jTeX, ASCII pTeX and upTeX (dvistuff.c) */ ++extern bool nttj; /* NTT jTeX font support (dvistuff.c) */ + extern bool asciip; /* ASCII pTeX font support (dvistuff.c) */ +-extern bool jautodetect; /* Autodetect NTT jTex and ASCII pTeX (dvistuff.c) */ ++extern bool uptex; /* upTeX font support (dvistuff.c) */ ++extern bool japan; /* japanized TeX font support (dvistuff.c) */ + extern bool noffd; /* output ^L or formfeed (dvistuff.c) */ + extern bool printfont; /* include font switches (dvistuff.c) */ + extern bool allchar; /* output all characters (dvistuff.c */ +diff -ur dvi2tty-5.3.4.orig/dvi2tty.tex dvi2tty-5.3.4/dvi2tty.tex +--- dvi2tty-5.3.4.orig/dvi2tty.tex 2010-10-30 12:13:29.000000000 +0200 ++++ dvi2tty-5.3.4/dvi2tty.tex 2011-11-21 21:26:57.000000000 +0100 +@@ -192,11 +192,16 @@ + terminals in Scandinavia are mapped to ``\{$|$\}[\bs ]''. + Note this may interfere with -u. Best not to use -u and -s together. + \item[{{\bf -J}}] +-Auto detect NTT JTeX and ASCII pTeX dvi format. ++Auto detect NTT JTeX, ASCII pTeX, and upTeX dvi format. + \item[{{\bf -N}}] + Display NTT JTeX dvi. + \item[{{\bf -A}}] + Display ASCII pTeX dvi. ++\item[{{\bf -U}}] ++Display upTeX dvi. ++\item[{{\bf -Eenc}}] ++Set output Japanese encoding. The enc argument 'e', 's', 'j', and 'u' ++denotes EUC-JP, Shift\_JIS, ISO-2022-JP, and UTF-8, respectively. + \end{list} + % + % NOTE --- No other files are used under VMS. +diff -ur dvi2tty-5.3.4.orig/dvistuff.c dvi2tty-5.3.4/dvistuff.c +--- dvi2tty-5.3.4.orig/dvistuff.c 2011-01-27 13:20:02.000000000 +0100 ++++ dvi2tty-5.3.4/dvistuff.c 2011-11-21 22:41:54.000000000 +0100 +@@ -87,13 +87,6 @@ + #define sget3() snum(3) + #define sget4() snum(4) + +-#if !defined(JIS) +-# define JIS 1 /* if 0 then EUC or SJIS */ +-#endif +-#if !defined(SJIS) +-# define SJIS 0 /* if !JIS, 0 then EUC */ +-#endif +- + + /* + * Structure and variable definitions +@@ -122,7 +115,7 @@ + long num; + struct _font * next; + char * name; +- char flags; /* to store font types, to get rid of japan/asciip/ttfont/symbolfon/mifont vars */ ++ char flags; /* to store font types, to get rid of nttj/asciip/uptex/ttfont/symbolfon/mifont vars */ + int fontnum; /* helper for japanese fonts */ + } font; + +@@ -140,8 +133,10 @@ + bool accent; /* if true output accents etc: \'{e} etc. */ + bool ttfont = FALSE; /* if true we assumed ttfonts, not cmr */ + bool symbolfont = FALSE; /* true if font is a symbol font */ +-bool japan = FALSE; /* switch to NTT japanese fonts ... */ ++bool nttj = FALSE; /* switch to NTT japanese fonts ... */ + bool asciip = FALSE; /* switch to ASCII japanese fonts ... */ ++bool uptex = FALSE; /* switch to upTeX CJK fonts ... */ ++bool japan = FALSE; /* switch to NTT/ASCII/.. japanese fonts ... */ + bool jautodetect = FALSE; /* switch if do auto detection of Japanese TeX */ + bool jdetect = FALSE; /* switch if Japanese TeX detection is done */ + bool mifont = FALSE; /* ASCII japanese font ??? */ +@@ -177,14 +172,7 @@ + font * fonts = NULL; /* List of fontnames defined */ + font * fnt = NULL; /* Current font */ + +-#if JIS +-# define SJIS 0 +-int inkanji = 0; /* is in kanji sequence */ +-# define KANJIIN "\033$B" /* was $@ in debian 5.1-13 patch.. */ +-# define KANJIOUT "\033(J" +-#endif +-int kanji1 = 0; /* is first kanji character */ +-int kanji2 = 0; /* is second kanji character */ ++int kanji1 = 0; /* number of rest of trailer bytes in kanji character */ + + + +@@ -219,7 +207,7 @@ + void setfont (long); + void jischar (unsigned long); + int compute_jis (int, unsigned int, unsigned int *, unsigned int *); +-void dokanji (unsigned long); ++void dokanji (long); + int getjsubfont (char *); + + #else +@@ -249,7 +237,7 @@ + void setfont (long fntnum); + void jischar (unsigned long ch); + void compute_jis (int f, unsigned int c, unsigned int * ku, unsigned int * ten); +-void dokanji (unsigned long ch); ++void dokanji (long ch); + int getjsubfont (char * s); + #if defined(VMS) + long vmsseek (); +@@ -448,9 +436,9 @@ + errorexit(illop); + else + switch (opcode) { +- case SET1 : japan ? jischar(get1()) : setchar(get1());break; +- case SET2 : asciip ? dokanji(get2()) : setchar(get2()); break; +- case SET3 : setchar(get3()); break; ++ case SET1 : nttj ? jischar(get1()) : setchar(get1());break; ++ case SET2 : (asciip || uptex) ? dokanji(get2()) : setchar(get2()); break; ++ case SET3 : uptex ? dokanji(get3()) : setchar(get3()); break; + case SET4 : setchar(get4()); break; + case SET_RULE : { long height = sget4(); + rule(MOVE, sget4(), height); break; +@@ -617,8 +605,9 @@ + + void printpage(void) + { +- register int i, j; ++ register int i, j, k; + register unsigned char ch; ++ unsigned char buff[4]; + + if (sptr != 0) + fprintf(stderr, "dvi2tty: warning - stack not empty at eop.\n"); +@@ -637,75 +626,59 @@ + i++, j++) { + ch = currentline->text[i - leftmargin]; + +- if (asciip) { +- if (kanji1) { +-#if !JIS && !SJIS +- ch |= 0x80; +-#endif +- kanji2 = 1; +- kanji1 = 0; +- } +- if (!kanji2 && ch > 127) { +- kanji1 = 1; +-#if JIS +- if (!inkanji) { +- inkanji = 1; +- fprintf(output, KANJIIN); +- } +- ch &= 0x7f; +-#endif +- } +-#if JIS +- if (!kanji1 && !kanji2 && inkanji) { +- fprintf(output, KANJIOUT); +- inkanji = 0; +- } +-#endif +- if (kanji1 && (j >= (int) foo) && +- (currentline->charactercount > i+1)) { +-#if JIS +- if (inkanji) +- fprintf(output, KANJIOUT); +-#endif +- fprintf(output, "*\n"); /* if line to large */ +- fprintf(output, " *"); /* mark output */ +-#if JIS +- if (inkanji) +- fprintf(output, KANJIIN); +-#endif +- j = 2; +- } +- } +- +- if (ch >= SPACE || allchar) +- putc(ch, output); ++ if (japan) { ++ if (ch > 127) { ++ for (k = 0; k < 4; k++) { ++ if (i - leftmargin + k < LINELEN+1) ++ buff[k] = currentline->text[i - leftmargin + k]; ++ else buff[k] = '\0'; ++ } ++ kanji1 = multistrlen(buff, 4, 0) - 1; ++ } ++ else kanji1 = 0; ++ if (kanji1 && (j + kanji1 > (int) foo) && ++ (currentline->charactercount > i+1)) { ++ putc2('*', output); ++ putc2('\n', output); /* if line to large */ ++ putc2(' ', output); ++ putc2('*', output); /* mark output */ ++ j = 2; ++ } ++ } ++ ++ if (ch >= SPACE || allchar) { ++ if (japan) { ++ for (k = 0; k < kanji1; k++) { ++ putc2(ch, output); ++ i++; j++; ++ ch = currentline->text[i - leftmargin]; ++ } ++ putc2(ch, output); ++ } ++ else ++ putc(ch, output); ++ } + if ((j > (int) foo) && (currentline->charactercount > i+1)) { +-#if JIS +- if (asciip && inkanji) +- fprintf(output,KANJIOUT); +-#endif +- fprintf(output, "*\n"); /* if line to large */ +- fprintf(output, " *"); /* mark output */ +-#if JIS +- if (asciip && inkanji) +- fprintf(output, KANJIIN); +-#endif +- j = 2; +- } +- if (asciip) +- kanji2 = 0; ++ if (japan) { ++ putc2('*', output); ++ putc2('\n', output); /* if line to large */ ++ putc2(' ', output); ++ putc2('*', output); /* mark output */ ++ } ++ else { ++ fprintf(output, "*\n"); /* if line to large */ ++ fprintf(output, " *"); /* mark output */ ++ } ++ j = 2; ++ } + } + } +- putc('\n', output); ++ if (japan) ++ putc2('\n', output); ++ else ++ putc('\n', output); + } + +-#if JIS +- if (asciip && !kanji1 && !kanji2 && inkanji) { +- fprintf(output, KANJIOUT); +- inkanji = 0; +- } +-#endif +- + currentline = firstline; + while (currentline->next != nil) { + currentline = currentline->next; +@@ -988,23 +961,19 @@ + * DOKANJI -- Process a kanji character opcode. + */ + +-void dokanji(unsigned long ch) ++void dokanji(long ch) + { +-#if SJIS +- register int c1, c2; ++ long i; + +- c1 = (ch >> 8) & 0xff; +- c2 = ch & 0xff; ++ i = toBUFF(fromDVI(ch)); ++ kanji1 = 3; ++ if (BYTE1(i) != 0) outchar(BYTE1(i)); ++ kanji1 = 2; ++ if (BYTE2(i) != 0) outchar(BYTE2(i)); + kanji1 = 1; +- outchar((((c1 - 1) >> 1) + ((c1 <= 0x5e) ? 0x71 : 0xb1))); ++ /* always */ outchar(BYTE3(i)); + kanji1 = 0; +- outchar((c2 + ((c1 & 1) ? ((c2 < 0x60) ? 0x1f : 0x20) : 0x7e))); +-#else +- kanji1 = 1; +- outchar(0x80 | ( ch >> 8 )); +- kanji1 = 0; +- outchar(ch & 0xff); +-#endif ++ /* always */ outchar(BYTE4(i)); + + return; + +@@ -1019,7 +988,7 @@ + void dochar(unsigned char ch) + { + +- if (japan && fnt->fontnum) ++ if (nttj && fnt->fontnum) + jischar((long) ch); + else if (symbolfont == TRUE) + symchar(ch); +@@ -1048,8 +1017,8 @@ + case 14: ch = 'O'; break; + case 15: ch = 'o'; break; + case 24: ch = '~'; break; +- case 32: ch = japan ? '<' : 32; break; /* really only for japan? */ +- case 33: ch = japan ? '>' : 33; break; /* really only for japan? */ ++ case 32: ch = nttj ? '<' : 32; break; /* really only for japan? */ ++ case 33: ch = nttj ? '>' : 33; break; /* really only for japan? */ + case 102: ch = '{'; break; + case 103: ch = '}'; break; + case 104: ch = '<'; break; +@@ -1284,6 +1253,14 @@ + /*----------------- end of 'latin1 / Scandinavian code' ----------------*/ + + if (foo == leftmargin-1) { ++ if (japan) { ++ while (((currentline->text[j - leftmargin] != SPACE) || ++ (kanji1 && (currentline->text[j+kanji1 - leftmargin] != SPACE))) ++ && (j < rightmargin)) { ++ j++; ++ h += charwidth; ++ } ++ } else { + while (j < rightmargin && + ( (currentline->text[j - leftmargin] != SPACE) || + (kanji1 && (currentline->text[j+1 - leftmargin] != SPACE)) +@@ -1291,6 +1268,7 @@ + j++; + h += charwidth; + } ++ } + } + if ( allchar || ((ch >= SPACE) && (ch != DEL)) || + ((latin1 || scascii) && (ch == 23)) ) { +@@ -1321,7 +1299,7 @@ + register long saveh; + + saveh = h; +- if (japan) ++ if (nttj) + dochar((unsigned char) charnr); + else if (allchar || ((charnr >= 0) && (charnr <= LASTCHAR))) + outchar((unsigned char) charnr); +@@ -1351,6 +1329,43 @@ + } /* setchar */ + + ++static const char *ptex_fontchk[] = { ++ "min", "goth", "jis", ++ "hmin", "hgoth", "hmgoth", /* japanese-otf package */ ++ "nmlmin", "nmlgoth", "nmlmgoth", ++ "hiramin", "hirakaku", "hiramaru", ++ NULL /* end */ ++}; ++ ++static const char *uptex_fontchk[] = { ++ "umin", "ugoth", "ujis", ++ "upjis", "upjpn", "upsch", "uptch", "upkor", ++ "uphmin", "uphgoth", "uphmgoth", /* japanese-otf package */ ++ "upnmlmin", "upnmlgoth", "upnmlmgoth", ++ "uphiramin", "uphirakaku", "uphiramaru", ++ NULL /* end */ ++}; ++ ++static const char *jtex_fontchk[] = { ++ "dmj", "dgj", ++ NULL /* end */ ++}; ++ ++static int checkjfont(const char **jfontlist, const char *name) ++{ ++ int i, len; ++ const char *tmpfont; ++ ++ i=0; ++ while ( (tmpfont=jfontlist[i]) != NULL ) { ++ len=strlen(tmpfont); ++ if ( !strncmp(tmpfont, name, len) ) return 1; ++ i++; ++ } ++ return 0; ++} /* checkjfont */ ++ ++ + + /* + * FONTDEF -- Process a font definition. +@@ -1402,22 +1417,33 @@ + */ + fonts->flags = 0; + +- if (jautodetect && asciip == FALSE && japan == FALSE && !jdetect) { +- if (!strncmp("min", name, 3) || !strncmp("got", name, 3)) { ++ if ((asciip == FALSE && nttj == FALSE && uptex == FALSE) ++ && (!jdetect) && jautodetect) { ++ if ( checkjfont(ptex_fontchk, name) ) { + /* Detect as ASCII TeX */ + asciip = TRUE; +- japan = FALSE; +- jdetect = TRUE; ++ nttj = uptex = FALSE; ++ japan = jdetect = TRUE; ++ fonts->flags |= MIFONT; ++ set_enc_string (NULL, PTEX_INTERNAL_ENC); ++ } else if ( checkjfont(uptex_fontchk, name) ) { ++ /* Detect as upTeX */ ++ uptex = TRUE; ++ nttj = asciip = FALSE; ++ japan = jdetect = TRUE; + fonts->flags |= MIFONT; +- } else if (!strncmp("dmj", name, 3) || !strncmp("dgj", name, 3)) { ++ enable_UPTEX(true); ++ set_enc_string (NULL, UPTEX_INTERNAL_ENC); ++ } else if ( checkjfont(jtex_fontchk, name) ) { + /* Detect as NTT JTeX */ +- asciip = FALSE; +- japan = TRUE; +- jdetect = TRUE; ++ nttj = TRUE; ++ asciip = uptex = FALSE; ++ japan = jdetect = TRUE; + fonts->flags |= JAPFONT; ++ set_enc_string (NULL, JTEX_INTERNAL_ENC); + } + } +- if (japan) ++ if (nttj) + fonts->fontnum = getjsubfont(name); + else + fonts->fontnum = 0; +@@ -1511,7 +1537,9 @@ + unsigned int Ku, Ten; + + compute_jis(fnt->fontnum, (unsigned int) ch, &Ku, &Ten); ++ kanji1 = 1; + outchar(Ku+128); ++ kanji1 = 0; + outchar(Ten+128); + + return; diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.4/Changelog b/Build/source/texk/dvi2tty/dvi2tty-5.3.4/Changelog index 135aa30bf0c..85580a948e8 100644 --- a/Build/source/texk/dvi2tty/dvi2tty-5.3.4/Changelog +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.4/Changelog @@ -1,4 +1,9 @@ /****************************************************************************** + * Takuji Tanaka: 20111119 (KXD02663@nifty.ne.jp) + * Used ptexenc library for Japanese TeX. + * Enabled UTF8 output for Japanese TeX with option -Eu. + * Added upTeX DVI support with option -U. + * Added auto detected Japanese fonts in japanese-otf package. * Marcel Mol: 20101113 (marcel@mesa.nl) * Version 5.3.4 * Fix VERSION code diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.1 b/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.1 index 443308ccd57..0c3a7da6177 100644 --- a/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.1 +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.1 @@ -129,7 +129,7 @@ terminals in Scandinavia are mapped to ``{|}[\\]''. Note this may interfere with -u. Best not to use -u and -s together. .TP .B \-J -Auto detect NTT JTeX and ASCII pTeX dvi format. +Auto detect NTT JTeX, ASCII pTeX, and upTeX dvi format. .TP .B \-N Display NTT JTeX dvi. @@ -137,6 +137,13 @@ Display NTT JTeX dvi. .B \-A Display ASCII pTeX dvi. .TP +.B \-U +Display upTeX dvi. +.TP +.B \-Eenc +Set output Japanese encoding. The enc argument 'e', 's', 'j', and 'u' +denotes EUC-JP, Shift_JIS, ISO-2022-JP, and UTF-8, respectively. +.TP .B \-bdelim Print the name of fonts when switching to it (and ending it). The delim argument is used to delimit the fontname. diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.c b/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.c index a673c1f21ad..a77000c5c0a 100644 --- a/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.c +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.c @@ -55,11 +55,11 @@ #define MAXLEN 100 /* size of char-arrays for strings */ #if defined(MSDOS) || defined(VMS) || defined(AMIGA) -#define OPTSET "haJwepPousltvbcAN" /* legal options */ -#define OPTWARG "wepPovb" /* options with argument */ +#define OPTSET "haJweEpPousltvbcANU" /* legal options */ +#define OPTWARG "weEpPovb" /* options with argument */ #else -#define OPTSET "haJwepPousqlfFtvbcAN"/* legal options */ -#define OPTWARG "wepPoFvb" /* options with argument */ +#define OPTSET "haJweEpPousqlfFtvbcANU" /* legal options */ +#define OPTWARG "weEpPoFvb" /* options with argument */ #endif /* @@ -75,10 +75,9 @@ #define bdopt 7 /* bad option */ #define onepp 8 /* only one page list allowed */ #define noarg 9 /* argument expected */ -#define confl 10 /* -N and -A conflict */ -#define confj 11 /* -J conflicts -N or -A */ +#define confl 10 /* -J, -N, -A, and -U conflict */ #if defined(THINK_C) -#define nored 12 /* if no input file, redirect stdin */ +#define nored 11 /* if no input file, redirect stdin */ #endif @@ -166,6 +165,7 @@ int main(int argc, char **argv) Argc = argc; Argv = argv; + set_enc_string (NULL, "default"); getargs(); /* read command line arguments */ #if defined(THINK_C) if (inputfromfile) { @@ -380,10 +380,35 @@ void setoption(const char *optarg) j = strlen(optarg); break; #endif - /* case 'J' : japan = TRUE; break; */ case 'J' : jautodetect = TRUE; break; - case 'A' : asciip = TRUE; break; /* ASCII pTeX */ - case 'N' : japan = TRUE; break; /* NTT jTeX */ + case 'U' : uptex = TRUE; japan = TRUE; /* upTeX */ + jautodetect = FALSE; + enable_UPTEX(true); + set_enc_string (NULL, UPTEX_INTERNAL_ENC); + break; + case 'A' : asciip = TRUE; japan = TRUE; /* ASCII pTeX */ + jautodetect = FALSE; + set_enc_string (NULL, PTEX_INTERNAL_ENC); + break; + case 'N' : nttj = TRUE; japan = TRUE; /* NTT jTeX */ + jautodetect = FALSE; + set_enc_string (NULL, JTEX_INTERNAL_ENC); + break; + case 'E' : + switch (optarg[0]) { + case 'e' : + set_enc_string ("euc", NULL); break; + case 's' : + set_enc_string ("sjis", NULL); break; + case 'j' : + set_enc_string ("jis", NULL); break; + case 'u' : + set_enc_string ("utf8", NULL); break; + default : + usage(noarg); + } + j++; + break; case 't' : ttfont = TRUE; break; case 'l' : noffd = TRUE; break; case 's' : scascii ^= 1; break; @@ -436,14 +461,12 @@ void setoption(const char *optarg) } /* Option conflict */ - if (japan && asciip) { + if ((asciip && uptex) || + (nttj && (asciip || uptex)) || + (jautodetect && (nttj || asciip || uptex))) { usage(confl); } - if (jautodetect && (japan || asciip)) { - usage(confj); - } - return; } /* setoption */ @@ -707,7 +730,10 @@ void errorexit(int errorcode) void usage(int uerr) { - fprintf(stderr, "%s", Copyright); + if (jautodetect || nttj || asciip || uptex) + fprintf(stderr, "%s (%s) %s", Progname, get_enc_string(), Copyright); + else + fprintf(stderr, "%s %s", Progname, Copyright); if (uerr != ign) { fprintf(stderr,"\n%s: ", progname); @@ -734,9 +760,7 @@ void usage(int uerr) break; case onepp : fprintf(stderr, "only one pagelist allowed"); break; - case confl : fprintf(stderr, "-N and -A are conflicting"); - break; - case confj : fprintf(stderr, "-J conflicts -N or -A"); + case confl : fprintf(stderr, "-J, -N, -A, and -U are mutually exclusive"); break; #if defined(THINK_C) case nored : fprintf(stderr, "\nIf no input file is given in\ @@ -794,12 +818,16 @@ void usage(int uerr) fprintf(stderr, " -u Toggle latin1 support (default %s).\n", DEFLATIN1 ? "on" : "off"); fprintf(stderr, - " -J Enable auto detect for NTT JTeX and ASCII pTeX (japanese fonts).\n"); + " -J Enable auto detect for NTT JTeX, ASCII pTeX, and upTeX (japanese fonts).\n"); fprintf(stderr, " -N Support NTT JTeX dvi.\n"); fprintf(stderr, " -A Support ASCII pTeX dvi.\n"); fprintf(stderr, + " -U Support upTeX dvi.\n"); + fprintf(stderr, + " -Eenc Output Japanese encoding. e:EUC s:SJIS j:JIS, u:UTF8.\n"); + fprintf(stderr, " -c Override -a -u -s and print all characters 0-255.\n"); fprintf(stderr, " -bdelim Print font switch as text: delimcmr10miled\n"); diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.h b/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.h index e4f7294e1c7..924c467c725 100644 --- a/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.h +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.h @@ -20,7 +20,8 @@ #define VERSION "5.3.4" -#define Copyright "dvi2tty Copyright (C) 1984, 1985, 1986 Svante Lindahl.\n\ +#define Progname "dvi2tty" +#define Copyright "Copyright (C) 1984, 1985, 1986 Svante Lindahl.\n\ Copyright (C) 1989-2010 M.J.E. Mol, MESA Consulting B.V." @@ -54,6 +55,18 @@ Copyright (C) 1989-2010 M.J.E. Mol, MESA Consulting B.V." */ #define MAXTERMWIDTH 332 +#include <ptexenc/ptexenc.h> +#include <ptexenc/unicode.h> + +/* internal encoding for NTT JTeX : "euc" */ +#define JTEX_INTERNAL_ENC "euc" + +/* internal encoding for ASCII pTeX : "euc" or "sjis" */ +#define PTEX_INTERNAL_ENC "euc" + +/* internal encoding for upTeX : "uptex" */ +#define UPTEX_INTERNAL_ENC "uptex" + /* * ERROR CODES , don't start with 0 */ @@ -109,9 +122,11 @@ extern bool scascii; /* Scand. nat. chars (dvistuff.c) */ extern bool latin1; /* latin1 chars (dvistuff.c) */ extern bool accent; /* Output accent stuff(dvistuff.c) */ extern bool ttfont; /* tt font assumed (dvistuff.c) */ -extern bool japan; /* NTT jTeX font support (dvistuff.c) */ +extern bool jautodetect; /* Autodetect NTT jTeX, ASCII pTeX and upTeX (dvistuff.c) */ +extern bool nttj; /* NTT jTeX font support (dvistuff.c) */ extern bool asciip; /* ASCII pTeX font support (dvistuff.c) */ -extern bool jautodetect; /* Autodetect NTT jTex and ASCII pTeX (dvistuff.c) */ +extern bool uptex; /* upTeX font support (dvistuff.c) */ +extern bool japan; /* japanized TeX font support (dvistuff.c) */ extern bool noffd; /* output ^L or formfeed (dvistuff.c) */ extern bool printfont; /* include font switches (dvistuff.c) */ extern bool allchar; /* output all characters (dvistuff.c */ diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.tex b/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.tex index b33e48858fa..5687d5e013c 100644 --- a/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.tex +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvi2tty.tex @@ -192,11 +192,16 @@ Toggle option to process the special Scandinavian characters that on most (?) terminals in Scandinavia are mapped to ``\{$|$\}[\bs ]''. Note this may interfere with -u. Best not to use -u and -s together. \item[{{\bf -J}}] -Auto detect NTT JTeX and ASCII pTeX dvi format. +Auto detect NTT JTeX, ASCII pTeX, and upTeX dvi format. \item[{{\bf -N}}] Display NTT JTeX dvi. \item[{{\bf -A}}] Display ASCII pTeX dvi. +\item[{{\bf -U}}] +Display upTeX dvi. +\item[{{\bf -Eenc}}] +Set output Japanese encoding. The enc argument 'e', 's', 'j', and 'u' +denotes EUC-JP, Shift\_JIS, ISO-2022-JP, and UTF-8, respectively. \end{list} % % NOTE --- No other files are used under VMS. diff --git a/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvistuff.c b/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvistuff.c index a53dfb48380..697c8351444 100644 --- a/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvistuff.c +++ b/Build/source/texk/dvi2tty/dvi2tty-5.3.4/dvistuff.c @@ -87,13 +87,6 @@ #define sget3() snum(3) #define sget4() snum(4) -#if !defined(JIS) -# define JIS 1 /* if 0 then EUC or SJIS */ -#endif -#if !defined(SJIS) -# define SJIS 0 /* if !JIS, 0 then EUC */ -#endif - /* * Structure and variable definitions @@ -122,7 +115,7 @@ typedef struct _font { long num; struct _font * next; char * name; - char flags; /* to store font types, to get rid of japan/asciip/ttfont/symbolfon/mifont vars */ + char flags; /* to store font types, to get rid of nttj/asciip/uptex/ttfont/symbolfon/mifont vars */ int fontnum; /* helper for japanese fonts */ } font; @@ -140,8 +133,10 @@ bool latin1; /* if true make latin1 chars right */ bool accent; /* if true output accents etc: \'{e} etc. */ bool ttfont = FALSE; /* if true we assumed ttfonts, not cmr */ bool symbolfont = FALSE; /* true if font is a symbol font */ -bool japan = FALSE; /* switch to NTT japanese fonts ... */ +bool nttj = FALSE; /* switch to NTT japanese fonts ... */ bool asciip = FALSE; /* switch to ASCII japanese fonts ... */ +bool uptex = FALSE; /* switch to upTeX CJK fonts ... */ +bool japan = FALSE; /* switch to NTT/ASCII/.. japanese fonts ... */ bool jautodetect = FALSE; /* switch if do auto detection of Japanese TeX */ bool jdetect = FALSE; /* switch if Japanese TeX detection is done */ bool mifont = FALSE; /* ASCII japanese font ??? */ @@ -177,14 +172,7 @@ int sptr; /* stack pointer */ font * fonts = NULL; /* List of fontnames defined */ font * fnt = NULL; /* Current font */ -#if JIS -# define SJIS 0 -int inkanji = 0; /* is in kanji sequence */ -# define KANJIIN "\033$B" /* was $@ in debian 5.1-13 patch.. */ -# define KANJIOUT "\033(J" -#endif -int kanji1 = 0; /* is first kanji character */ -int kanji2 = 0; /* is second kanji character */ +int kanji1 = 0; /* number of rest of trailer bytes in kanji character */ @@ -219,7 +207,7 @@ void fontdef (int); void setfont (long); void jischar (unsigned long); int compute_jis (int, unsigned int, unsigned int *, unsigned int *); -void dokanji (unsigned long); +void dokanji (long); int getjsubfont (char *); #else @@ -249,7 +237,7 @@ void fontdef (int x); void setfont (long fntnum); void jischar (unsigned long ch); void compute_jis (int f, unsigned int c, unsigned int * ku, unsigned int * ten); -void dokanji (unsigned long ch); +void dokanji (long ch); int getjsubfont (char * s); #if defined(VMS) long vmsseek (); @@ -448,9 +436,9 @@ void dopage(void) errorexit(illop); else switch (opcode) { - case SET1 : japan ? jischar(get1()) : setchar(get1());break; - case SET2 : asciip ? dokanji(get2()) : setchar(get2()); break; - case SET3 : setchar(get3()); break; + case SET1 : nttj ? jischar(get1()) : setchar(get1());break; + case SET2 : (asciip || uptex) ? dokanji(get2()) : setchar(get2()); break; + case SET3 : uptex ? dokanji(get3()) : setchar(get3()); break; case SET4 : setchar(get4()); break; case SET_RULE : { long height = sget4(); rule(MOVE, sget4(), height); break; @@ -617,8 +605,9 @@ void skippage(void) void printpage(void) { - register int i, j; + register int i, j, k; register unsigned char ch; + unsigned char buff[4]; if (sptr != 0) fprintf(stderr, "dvi2tty: warning - stack not empty at eop.\n"); @@ -637,75 +626,59 @@ void printpage(void) i++, j++) { ch = currentline->text[i - leftmargin]; - if (asciip) { - if (kanji1) { -#if !JIS && !SJIS - ch |= 0x80; -#endif - kanji2 = 1; - kanji1 = 0; - } - if (!kanji2 && ch > 127) { - kanji1 = 1; -#if JIS - if (!inkanji) { - inkanji = 1; - fprintf(output, KANJIIN); - } - ch &= 0x7f; -#endif - } -#if JIS - if (!kanji1 && !kanji2 && inkanji) { - fprintf(output, KANJIOUT); - inkanji = 0; - } -#endif - if (kanji1 && (j >= (int) foo) && - (currentline->charactercount > i+1)) { -#if JIS - if (inkanji) - fprintf(output, KANJIOUT); -#endif - fprintf(output, "*\n"); /* if line to large */ - fprintf(output, " *"); /* mark output */ -#if JIS - if (inkanji) - fprintf(output, KANJIIN); -#endif - j = 2; - } - } - - if (ch >= SPACE || allchar) - putc(ch, output); + if (japan) { + if (ch > 127) { + for (k = 0; k < 4; k++) { + if (i - leftmargin + k < LINELEN+1) + buff[k] = currentline->text[i - leftmargin + k]; + else buff[k] = '\0'; + } + kanji1 = multistrlen(buff, 4, 0) - 1; + } + else kanji1 = 0; + if (kanji1 && (j + kanji1 > (int) foo) && + (currentline->charactercount > i+1)) { + putc2('*', output); + putc2('\n', output); /* if line to large */ + putc2(' ', output); + putc2('*', output); /* mark output */ + j = 2; + } + } + + if (ch >= SPACE || allchar) { + if (japan) { + for (k = 0; k < kanji1; k++) { + putc2(ch, output); + i++; j++; + ch = currentline->text[i - leftmargin]; + } + putc2(ch, output); + } + else + putc(ch, output); + } if ((j > (int) foo) && (currentline->charactercount > i+1)) { -#if JIS - if (asciip && inkanji) - fprintf(output,KANJIOUT); -#endif - fprintf(output, "*\n"); /* if line to large */ - fprintf(output, " *"); /* mark output */ -#if JIS - if (asciip && inkanji) - fprintf(output, KANJIIN); -#endif - j = 2; - } - if (asciip) - kanji2 = 0; + if (japan) { + putc2('*', output); + putc2('\n', output); /* if line to large */ + putc2(' ', output); + putc2('*', output); /* mark output */ + } + else { + fprintf(output, "*\n"); /* if line to large */ + fprintf(output, " *"); /* mark output */ + } + j = 2; + } } } - putc('\n', output); + if (japan) + putc2('\n', output); + else + putc('\n', output); } -#if JIS - if (asciip && !kanji1 && !kanji2 && inkanji) { - fprintf(output, KANJIOUT); - inkanji = 0; - } -#endif - currentline = firstline; while (currentline->next != nil) { currentline = currentline->next; @@ -988,23 +961,19 @@ long snum(int size) * DOKANJI -- Process a kanji character opcode. */ -void dokanji(unsigned long ch) +void dokanji(long ch) { -#if SJIS - register int c1, c2; + long i; - c1 = (ch >> 8) & 0xff; - c2 = ch & 0xff; + i = toBUFF(fromDVI(ch)); + kanji1 = 3; + if (BYTE1(i) != 0) outchar(BYTE1(i)); + kanji1 = 2; + if (BYTE2(i) != 0) outchar(BYTE2(i)); kanji1 = 1; - outchar((((c1 - 1) >> 1) + ((c1 <= 0x5e) ? 0x71 : 0xb1))); + /* always */ outchar(BYTE3(i)); kanji1 = 0; - outchar((c2 + ((c1 & 1) ? ((c2 < 0x60) ? 0x1f : 0x20) : 0x7e))); -#else - kanji1 = 1; - outchar(0x80 | ( ch >> 8 )); - kanji1 = 0; - outchar(ch & 0xff); -#endif + /* always */ outchar(BYTE4(i)); return; @@ -1019,7 +988,7 @@ void dokanji(unsigned long ch) void dochar(unsigned char ch) { - if (japan && fnt->fontnum) + if (nttj && fnt->fontnum) jischar((long) ch); else if (symbolfont == TRUE) symchar(ch); @@ -1048,8 +1017,8 @@ void symchar(unsigned char ch) case 14: ch = 'O'; break; case 15: ch = 'o'; break; case 24: ch = '~'; break; - case 32: ch = japan ? '<' : 32; break; /* really only for japan? */ - case 33: ch = japan ? '>' : 33; break; /* really only for japan? */ + case 32: ch = nttj ? '<' : 32; break; /* really only for japan? */ + case 33: ch = nttj ? '>' : 33; break; /* really only for japan? */ case 102: ch = '{'; break; case 103: ch = '}'; break; case 104: ch = '<'; break; @@ -1284,6 +1253,14 @@ void outchar(unsigned char ch) /*----------------- end of 'latin1 / Scandinavian code' ----------------*/ if (foo == leftmargin-1) { + if (japan) { + while (((currentline->text[j - leftmargin] != SPACE) || + (kanji1 && (currentline->text[j+kanji1 - leftmargin] != SPACE))) + && (j < rightmargin)) { + j++; + h += charwidth; + } + } else { while (j < rightmargin && ( (currentline->text[j - leftmargin] != SPACE) || (kanji1 && (currentline->text[j+1 - leftmargin] != SPACE)) @@ -1291,6 +1268,7 @@ void outchar(unsigned char ch) j++; h += charwidth; } + } } if ( allchar || ((ch >= SPACE) && (ch != DEL)) || ((latin1 || scascii) && (ch == 23)) ) { @@ -1321,7 +1299,7 @@ void putcharacter(long charnr) register long saveh; saveh = h; - if (japan) + if (nttj) dochar((unsigned char) charnr); else if (allchar || ((charnr >= 0) && (charnr <= LASTCHAR))) outchar((unsigned char) charnr); @@ -1351,6 +1329,43 @@ void setchar(long charnr) } /* setchar */ +static const char *ptex_fontchk[] = { + "min", "goth", "jis", + "hmin", "hgoth", "hmgoth", /* japanese-otf package */ + "nmlmin", "nmlgoth", "nmlmgoth", + "hiramin", "hirakaku", "hiramaru", + NULL /* end */ +}; + +static const char *uptex_fontchk[] = { + "umin", "ugoth", "ujis", + "upjis", "upjpn", "upsch", "uptch", "upkor", + "uphmin", "uphgoth", "uphmgoth", /* japanese-otf package */ + "upnmlmin", "upnmlgoth", "upnmlmgoth", + "uphiramin", "uphirakaku", "uphiramaru", + NULL /* end */ +}; + +static const char *jtex_fontchk[] = { + "dmj", "dgj", + NULL /* end */ +}; + +static int checkjfont(const char **jfontlist, const char *name) +{ + int i, len; + const char *tmpfont; + + i=0; + while ( (tmpfont=jfontlist[i]) != NULL ) { + len=strlen(tmpfont); + if ( !strncmp(tmpfont, name, len) ) return 1; + i++; + } + return 0; +} /* checkjfont */ + + /* * FONTDEF -- Process a font definition. @@ -1402,22 +1417,33 @@ void fontdef(int x) */ fonts->flags = 0; - if (jautodetect && asciip == FALSE && japan == FALSE && !jdetect) { - if (!strncmp("min", name, 3) || !strncmp("got", name, 3)) { + if ((asciip == FALSE && nttj == FALSE && uptex == FALSE) + && (!jdetect) && jautodetect) { + if ( checkjfont(ptex_fontchk, name) ) { /* Detect as ASCII TeX */ asciip = TRUE; - japan = FALSE; - jdetect = TRUE; + nttj = uptex = FALSE; + japan = jdetect = TRUE; + fonts->flags |= MIFONT; + set_enc_string (NULL, PTEX_INTERNAL_ENC); + } else if ( checkjfont(uptex_fontchk, name) ) { + /* Detect as upTeX */ + uptex = TRUE; + nttj = asciip = FALSE; + japan = jdetect = TRUE; fonts->flags |= MIFONT; - } else if (!strncmp("dmj", name, 3) || !strncmp("dgj", name, 3)) { + enable_UPTEX(true); + set_enc_string (NULL, UPTEX_INTERNAL_ENC); + } else if ( checkjfont(jtex_fontchk, name) ) { /* Detect as NTT JTeX */ - asciip = FALSE; - japan = TRUE; - jdetect = TRUE; + nttj = TRUE; + asciip = uptex = FALSE; + japan = jdetect = TRUE; fonts->flags |= JAPFONT; + set_enc_string (NULL, JTEX_INTERNAL_ENC); } } - if (japan) + if (nttj) fonts->fontnum = getjsubfont(name); else fonts->fontnum = 0; @@ -1511,7 +1537,9 @@ void jischar(unsigned long ch) unsigned int Ku, Ten; compute_jis(fnt->fontnum, (unsigned int) ch, &Ku, &Ten); + kanji1 = 1; outchar(Ku+128); + kanji1 = 0; outchar(Ten+128); return; diff --git a/Build/source/texk/dvi2tty/version.ac b/Build/source/texk/dvi2tty/version.ac new file mode 100644 index 00000000000..9d7b1e313c2 --- /dev/null +++ b/Build/source/texk/dvi2tty/version.ac @@ -0,0 +1,11 @@ +dnl +dnl Copyright (C) 2011 Peter Breitenlohner <tex-live@tug.org> +dnl +dnl This file is free software; the copyright holder +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl -------------------------------------------------------- +dnl +dnl m4-include this file to define the current dvi2tty version +m4_define([dvi2tty_version], [5.3.4]) diff --git a/Build/source/utils/configure b/Build/source/utils/configure index 99ee6b103e7..a7038190817 100755 --- a/Build/source/utils/configure +++ b/Build/source/utils/configure @@ -3875,7 +3875,7 @@ $as_echo "$as_me: Assuming \`--enable-dvi2tty=$enable_dvi2tty'" >&6;} esac test "x$enable_dvi2tty" = xno || { - need_kpathsea=yes + need_ptexenc=yes } |