[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian packaging of texlive-bin) branch, master, updated. debian/2012.20130315.29398-1-5-g8760484



The following commit has been merged in the master branch:
commit 87604842ee6f0a0f4dfcb812a0806cc77838a13d
Author: Norbert Preining <preining@logic.at>
Date:   Thu May 9 20:10:22 2013 +0900

    first work on integration pmpost1801 from Kakuto-san

diff --git a/debian/patches/pmpost-texlive-integration b/debian/patches/pmpost-texlive-integration
new file mode 100644
index 0000000..d1ee828
--- /dev/null
+++ b/debian/patches/pmpost-texlive-integration
@@ -0,0 +1,49 @@
+---
+ texk/kpathsea/texmf.cnf |    1 +
+ texk/web2c/Makefile.am  |    3 +++
+ texk/web2c/ac/web2c.ac  |    1 +
+ texk/web2c/configure.ac |    1 +
+ 4 files changed, 6 insertions(+)
+
+--- texlive-bin.orig/texk/kpathsea/texmf.cnf
++++ texlive-bin/texk/kpathsea/texmf.cnf
+@@ -624,6 +624,7 @@
+ % Used by makempx to run TeX.  We use "etex" because MetaPost is
+ % expecting DVI, and not "tex" because we want first line parsing.
+ TEX = etex
++TEX.pmpost = eptex
+ 
+ % These variables specify the external program called for the
+ % interactive `e' option.  %d is replaced by the line number and %s by
+--- texlive-bin.orig/texk/web2c/Makefile.am
++++ texlive-bin/texk/web2c/Makefile.am
+@@ -177,6 +177,9 @@
+ ## MetaPost
+ include $(srcdir)/mplibdir/am/mplib.am
+ 
++## pMetaPost
++include $(srcdir)/pmplibdir/am/pmpost.am
++
+ ## libmplib, used by MetaPost and luaTeX
+ include $(srcdir)/mplibdir/am/libmplib.am
+ 
+--- texlive-bin.orig/texk/web2c/ac/web2c.ac
++++ texlive-bin/texk/web2c/ac/web2c.ac
+@@ -41,6 +41,7 @@
+ [[pdftex], [yes], [yes], [pdfTeX],  [xpdf libpng]],
+ [[luatex], [yes], [],    [luaTeX],  [poppler cairo libpng zziplib]],
+ [[mp],     [yes], [],    [MetaPost],[cairo libpng]],
++[[pmp],    [yes], [],    [pMetaPost],[cairo libpng]],
+ [[xetex],  [yes], [yes], [XeTeX],   [poppler libpng freetype2 icu teckit graphite2 harfbuzz]],
+ ])[]dnl
+ m4_foreach([Kpse_Prog], [kpse_tex_progs],
+--- texlive-bin.orig/texk/web2c/configure.ac
++++ texlive-bin/texk/web2c/configure.ac
+@@ -202,6 +202,7 @@
+                      [KPSE_MFWIN_DEFINE(Kpse_Win)])])[]dnl
+ 
+ AM_CONDITIONAL([MP], [test "x$enable_mp" != xno])
++AM_CONDITIONAL([PMP], [test "x$enable_pmp" != xno])
+ 
+ AM_CONDITIONAL([WEB], [test "x$enable_web_progs" != xno])
+ 
diff --git a/debian/patches/pmpost-20121106-tl12 b/debian/patches/pmpost1801-2010509
similarity index 69%
copy from debian/patches/pmpost-20121106-tl12
copy to debian/patches/pmpost1801-2010509
index fbbdd2d..cdb76b5 100644
--- a/debian/patches/pmpost-20121106-tl12
+++ b/debian/patches/pmpost1801-2010509
@@ -1,139 +1,16 @@
 ---
- texk/kpathsea/texmf.cnf           |    1 
- texk/web2c/Makefile.am            |    3 
- texk/web2c/ac/web2c.ac            |    1 
- texk/web2c/configure.ac           |    1 
- texk/web2c/pmplibdir/am/pmpost.am |   78 ++++++
- texk/web2c/pmplibdir/jfm.ch       |  110 ++++++++
- texk/web2c/pmplibdir/jmp.ch       |  283 +++++++++++++++++++++
- texk/web2c/pmplibdir/jmppsw.ch    |   76 +++++
- texk/web2c/pmplibdir/pdvitomp.ch  |  494 ++++++++++++++++++++++++++++++++++++++
- texk/web2c/pmplibdir/pmpost.ch    |  234 ++++++++++++++++++
- 10 files changed, 1281 insertions(+)
+ texk/web2c/pmplibdir/jfm.ch          |  110 +++++++
+ texk/web2c/pmplibdir/jmp.ch          |  340 ++++++++++++++++++++++++
+ texk/web2c/pmplibdir/jmppsw.ch       |   74 +++++
+ texk/web2c/pmplibdir/mp.ch           |   20 +
+ texk/web2c/pmplibdir/mpmathdouble.ch |   76 +++++
+ texk/web2c/pmplibdir/mpost.ch        |  310 +++++++++++++++++++++
+ texk/web2c/pmplibdir/mpxout.ch       |    8 
+ texk/web2c/pmplibdir/pdvitomp.ch     |  494 +++++++++++++++++++++++++++++++++++
+ texk/web2c/pmplibdir/psout.ch        |   42 ++
+ texk/web2c/pmplibdir/svgout.ch       |   60 ++++
+ 10 files changed, 1534 insertions(+)
 
---- texlive-bin.orig/texk/kpathsea/texmf.cnf
-+++ texlive-bin/texk/kpathsea/texmf.cnf
-@@ -624,6 +624,7 @@
- % Used by makempx to run TeX.  We use "etex" because MetaPost is
- % expecting DVI, and not "tex" because we want first line parsing.
- TEX = etex
-+TEX.pmpost = eptex
- 
- % These variables specify the external program called for the
- % interactive `e' option.  %d is replaced by the line number and %s by
---- texlive-bin.orig/texk/web2c/Makefile.am
-+++ texlive-bin/texk/web2c/Makefile.am
-@@ -177,6 +177,9 @@
- ## MetaPost
- include $(srcdir)/mplibdir/am/mplib.am
- 
-+## pMetaPost
-+include $(srcdir)/pmplibdir/am/pmpost.am
-+
- ## libmplib, used by MetaPost and luaTeX
- include $(srcdir)/mplibdir/am/libmplib.am
- 
---- texlive-bin.orig/texk/web2c/ac/web2c.ac
-+++ texlive-bin/texk/web2c/ac/web2c.ac
-@@ -41,6 +41,7 @@
- [[pdftex], [yes], [yes], [pdfTeX],  [xpdf libpng]],
- [[luatex], [yes], [],    [luaTeX],  [poppler cairo libpng zziplib]],
- [[mp],     [yes], [],    [MetaPost],[cairo libpng]],
-+[[pmp],    [yes], [],    [pMetaPost],[cairo libpng]],
- [[xetex],  [yes], [yes], [XeTeX],   [poppler libpng freetype2 icu teckit graphite2 harfbuzz]],
- ])[]dnl
- m4_foreach([Kpse_Prog], [kpse_tex_progs],
---- texlive-bin.orig/texk/web2c/configure.ac
-+++ texlive-bin/texk/web2c/configure.ac
-@@ -202,6 +202,7 @@
-                      [KPSE_MFWIN_DEFINE(Kpse_Win)])])[]dnl
- 
- AM_CONDITIONAL([MP], [test "x$enable_mp" != xno])
-+AM_CONDITIONAL([PMP], [test "x$enable_pmp" != xno])
- 
- AM_CONDITIONAL([WEB], [test "x$enable_web_progs" != xno])
- 
---- /dev/null
-+++ texlive-bin/texk/web2c/pmplibdir/am/pmpost.am
-@@ -0,0 +1,78 @@
-+## texk/web2c/pmplibdir/am/pmpost.am: Makefile fragment for MetaPost.
-+##
-+## Copyright (C) 2009-2011 Peter Breitenlohner <tex-live@tug.org>
-+## You may freely use, modify and/or distribute this file.
-+
-+## pMetaPost
-+##
-+if PMP
-+bin_PROGRAMS += pmpost
-+bin_links += pmpost$(EXEEXT):pdvitomp
-+endif PMP
-+EXTRA_PROGRAMS += pmpost
-+
-+pmpost_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/pmplibdir -I$(srcdir)/mplibdir $(PTEXENC_INCLUDES)
-+pmpost_LDADD = $(KPATHSEA_LIBS) -lm $(PTEXENC_LIBS)
-+
-+
-+.PHONY: install-pmpost-links uninstall-pmpost-links
-+
-+# Creating one file: just one rule
-+pmp_ctangle = CWEBINPUTS=.:$(srcdir)/pmplibdir $(ctangle)
-+# Creating several files: need stamp file and two rules with identical recipes
-+pmp_ctangle_sh = CWEBINPUTS=.:$(srcdir)/pmplibdir $(SHELL) ./tangle-sh $@ $(CTANGLE)
-+
-+## pMetaPost C sources
-+pmpost_SOURCES = mplibdir/avl.h mplibdir/avl.c
-+nodist_pmpost_SOURCES = pmpost.c $(pmpxout_c_h) $(pmp_c_h) $(pmpmath_c_h) $(ppsout_c_h) $(psvgout_c_h) ptfmin.c
-+pmpxout_c_h = pmpxout.c pmpxout.h
-+pmp_c_h =  pmp.c pmplib.h pmpmp.h
-+pmpmath_c_h = pmpmath.h pmpmath.c
-+ppsout_c_h = pmppsout.h ppsout.c pmplibps.h
-+psvgout_c_h = pmplibsvg.h pmpsvgout.h psvgout.c
-+pmp_sed = "s/mpxout\\.h/pmpxout.h/;s/mpmp\\.h/pmpmp.h/;s/mplib\\.h/pmplib.h/;s/mppsout\\.h/pmppsout.h/;s/mplibps\\.h/pmplibps.h/;s/mplibsvg\\.h/pmplibsvg.h/;s/mpsvgout\\.h/pmpsvgout.h/;s/mpmath\\.h/pmpmath.h/"
-+
-+ptfmin.c: ctangle$(EXEEXT) mplibdir/tfmin.w
-+	cat $(srcdir)/mplibdir/tfmin.w | sed $(pmp_sed) > ptfmin.w
-+	$(pmp_ctangle) ptfmin.w jfm.ch
-+pmpost.c: ctangle$(EXEEXT) mplibdir/mpost.w
-+	cat $(srcdir)/mplibdir/mpost.w | sed $(pmp_sed) > pmpost.w
-+	$(pmp_ctangle) pmpost.w pmpost.ch
-+$(pmp_c_h): pmp-tangle
-+	@$(pmp_ctangle_sh) pmp.w jmp.ch
-+$(ppsout_c_h): ppsout-tangle
-+	@$(pmp_ctangle_sh) ppsout.w jmppsw.ch
-+$(pmpxout_c_h): pmpxout-tangle
-+	@$(pmp_ctangle_sh) pmpxout pdvitomp.ch
-+pmp-tangle: ctangle$(EXEEXT) mplibdir/mp.w tangle-sh
-+	cat $(srcdir)/mplibdir/mp.w | sed $(pmp_sed) > pmp.w
-+	@$(pmp_ctangle_sh) pmp.w jmp.ch
-+ppsout-tangle: ctangle$(EXEEXT) mplibdir/psout.w tangle-sh
-+	cat $(srcdir)/mplibdir/psout.w | sed $(pmp_sed) > ppsout.w
-+	@$(pmp_ctangle_sh) ppsout.w jmppsw.ch
-+pmpxout-tangle: ctangle$(EXEEXT) mplibdir/mpxout.w tangle-sh
-+	cat $(srcdir)/mplibdir/mpxout.w | sed $(pmp_sed) > pmpxout.w
-+	@$(pmp_ctangle_sh) pmpxout pdvitomp.ch
-+
-+$(psvgout_c_h): psvgout-tangle
-+	@$(pmp_ctangle_sh) psvgout
-+psvgout-tangle: ctangle$(EXEEXT) mplibdir/svgout.w tangle-sh
-+	cat $(srcdir)/mplibdir/svgout.w | sed $(pmp_sed) > psvgout.w
-+	@$(pmp_ctangle_sh) psvgout
-+$(pmpmath_c_h): pmpmath-tangle
-+	@$(pmp_ctangle_sh) pmpmath
-+pmpmath-tangle: ctangle$(EXEEXT) mplibdir/mpmath.w tangle-sh
-+	cat $(srcdir)/mplibdir/mpmath.w | sed $(pmp_sed) > pmpmath.w
-+	@$(pmp_ctangle_sh) pmpmath
-+
-+
-+## pMetaPost CWeb sources
-+pmpost_web = mplibdir/mpost.w mplibdir/mpxout.w 
-+pmpost_web += mplibdir/mp.w mplibdir/psout.w mplibdir/svgout.w 
-+pmpost_web += mplibdir/mpmath.w mplibdir/tfmin.w
-+
-+
-+$(pmpost_OBJECTS): $(nodist_pmpost_SOURCES)
-+
-+DISTCLEANFILES += $(nodist_pmpost_SOURCES)
-+
 --- /dev/null
 +++ texlive-bin/texk/web2c/pmplibdir/jfm.ch
 @@ -0,0 +1,110 @@
@@ -249,7 +126,7 @@
 +@z
 --- /dev/null
 +++ texlive-bin/texk/web2c/pmplibdir/jmp.ch
-@@ -0,0 +1,283 @@
+@@ -0,0 +1,340 @@
 +% jMetaPost change file for MetaPost
 +%
 +% written by Michio Matsuyama <fwhw5892@mb.infoweb.ne.jp>
@@ -258,22 +135,22 @@
 +% $Id: jmp.ch,v 1.42 2000/03/20 02:55:50 hideyuki Exp $
 +
 +%
++%
 +% change file of mp.w for pMetaPost (CWEB version)
 +% Akira Kakuto (translated the WEB version)
 +%
-+% rewrited for TeX Live 2011
-+% Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
++%
 +
 +@x
-+@d default_banner "This is MetaPost, Version 1.504" /* printed when \MP\ starts */
++@d default_banner "This is MetaPost, Version 1.801" /* printed when \MP\ starts */
 +@y
-+@d default_banner "This is pMetaPost, Version 1.504-0.04" /* printed when \MP\ starts */
++@d default_banner "This is pMetaPost, Version 1.801-0.04" /* printed when \MP\ starts */
 +@z
 +
 +@x
-+#define metapost_version "1.504"
++#define metapost_version "1.801"
 +@y
-+#define metapost_version "1.504-0.04"
++#define metapost_version "1.801-0.04"
 +@z
 +
 +@x
@@ -282,15 +159,43 @@
 +@y
 +#  include <unistd.h>           /* for access */
 +#endif
-+#include <ptexenc/ptexenc.h>
++#include <kpathsea/config.h>
 +#include <kpathsea/kpathsea.h>
++#include <ptexenc/ptexenc.h>
 +#include <errno.h>
 +@z
 +
 +@x
++void mp_close_file (MP mp, void *f) {
++  (void) mp;
++  if (f != NULL)
++    fclose ((FILE *) f);
++@y
++void mp_close_file (MP mp, void *f) {
++  (void) mp;
++#ifdef WIN32
++  if (f != NULL) {
++    clear_infile_enc((FILE *)f);
++    fclose ((FILE *) f);
++  }
++#else
++  if (f != NULL)
++    fclose ((FILE *) f);
++#endif
++@z
++
++@x
 +mp->buf_size = 200;
 +@y
-+mp->buf_size = atoi(kpse_var_value("buf_size"));
++{
++  char *kpse_buf = kpse_var_value("buf_size");
++  if(kpse_buf) {
++    mp->buf_size = atoi(kpse_buf);
++    free(kpse_buf);
++  } else {
++    mp->buf_size = 500000;
++  }
++}
 +@z
 +
 +@x
@@ -328,7 +233,7 @@
 +    exit (1);
 +  }
 +  if (i == '\r') {
-+    while ((i = fgetc (f)) == EOF && errno == EINTR)
++    while ((i = getc (f)) == EOF && errno == EINTR)
 +      ;
 +    if (i != '\n')
 +      ungetc (i, f);
@@ -378,11 +283,6 @@
 +rectangle that needs to be transformed according to the transformation
 +parameters stored in the text node.
 +
-+@<Other cases for updating the bounding box...@>=
-+case mp_text_node_type:
-+x1 = mp_take_scaled (mp, txx_val (p), width_val (p));
-+y0 = mp_take_scaled (mp, txy_val (p), -depth_val (p));
-+y1 = mp_take_scaled (mp, txy_val (p), height_val (p));
 +@y
 +@ The height width and depth information stored in a text node determines a
 +rectangle that needs to be transformed according to the transformation
@@ -394,33 +294,67 @@
 +@d tate_jfm_id   9  /* `tate-kumi' fonts */
 +@d font_jfm_p(A) (mp->font_id[(A)]!=0)
 +
-+@<Other cases for updating the bounding box...@>=
-+case mp_text_node_type:
++@z
++
++@x
++  mp_number x0a, y0a, x1a, y1a, arg1;
++  mp_text_node p0 = (mp_text_node)p;
++  new_number (x0a);
++  new_number (x1a);
++  new_number (y0a);
++  new_number (y1a);
++  new_number (arg1);
++  number_clone (arg1, p0->depth);
++  number_negate (arg1);
++  take_scaled (x1a, p0->txx, p0->width);
++  take_scaled (y0a, p0->txy, arg1);
++  take_scaled (y1a, p0->txy, p0->height);
++@y
++  mp_number x0a, y0a, x1a, y1a, arg1, arg2;
++  mp_text_node p0 = (mp_text_node)p;
++  new_number (x0a);
++  new_number (x1a);
++  new_number (y0a);
++  new_number (y1a);
++  new_number (arg1);
++  new_number (arg2);
++  number_clone (arg1, p0->depth);
++  number_negate (arg1);
++  number_clone (arg2, p0->width);
++  number_negate (arg2);
 +  if ( mp->font_id[mp_font_n(p)]!=tate_jfm_id ) {
-+    x1 = mp_take_scaled(mp, txx_val(p), width_val(p));
-+    y0 = mp_take_scaled(mp, txy_val(p), -depth_val(p));
-+    y1 = mp_take_scaled(mp, txy_val(p), height_val(p));
++     take_scaled (x1a, p0->txx, p0->width);
++     take_scaled (y0a, p0->txy, arg1);
++     take_scaled (y1a, p0->txy, p0->height);
 +  } else {
-+    x1 = mp_take_scaled(mp, txy_val(p), -width_val(p));
-+    y0 = mp_take_scaled(mp, txx_val(p), -depth_val(p));
-+    y1 = mp_take_scaled(mp, txx_val(p), height_val(p));
-+  };
++     take_scaled (x1a, p0->txy, arg2);
++     take_scaled (y0a, p0->txx, arg1);
++     take_scaled (y1a, p0->txx, p0->height);
++  }
 +@z
 +
 +@x
-+x1 = mp_take_scaled (mp, tyx_val (p), width_val (p));
-+y0 = mp_take_scaled (mp, tyy_val (p), -depth_val (p));
-+y1 = mp_take_scaled (mp, tyy_val (p), height_val (p));
++  take_scaled (x1a, p0->tyx, p0->width);
++  number_clone (arg1, p0->depth);
++  number_negate (arg1);
++  take_scaled (y0a, p0->tyy, arg1);
++  take_scaled (y1a, p0->tyy, p0->height);
 +@y
-+if ( mp->font_id[mp_font_n(p)]!=tate_jfm_id ) {
-+  x1 = mp_take_scaled(mp, tyx_val(p), width_val(p));
-+  y0 = mp_take_scaled(mp, tyy_val(p), -depth_val(p));
-+  y1 = mp_take_scaled(mp, tyy_val(p),height_val(p));
-+} else {
-+  x1 = mp_take_scaled(mp, tyy_val(p), -width_val(p));
-+  y0 = mp_take_scaled(mp, tyx_val(p), -depth_val(p));
-+  y1 = mp_take_scaled(mp, tyx_val(p), height_val(p));
-+};
++  if ( mp->font_id[mp_font_n(p)]!=tate_jfm_id ) {
++     take_scaled (x1a, p0->tyx, p0->width);
++     number_clone (arg1, p0->depth);
++     number_negate (arg1);
++     take_scaled (y0a, p0->tyy, arg1);
++     take_scaled (y1a, p0->tyy, p0->height);
++  } else {
++     number_clone (arg1, p0->depth);
++     number_negate (arg1);
++     number_clone (arg2, p0->width);
++     number_negate (arg2);
++     take_scaled (x1a, p0->tyy, arg2);
++     take_scaled (y0a, p0->tyx, arg1);
++     take_scaled (y1a, p0->tyx, p0->height);
++  }
 +@z
 +
 +@x
@@ -492,10 +426,10 @@
 +%
 +% lookup character type table
 +@x
-+void mp_set_text_box (MP mp, mp_node p) {
++void mp_set_text_box (MP mp, mp_text_node p) {
 +@y
 +@<Declare JFM function for text measuring@>;
-+void mp_set_text_box (MP mp, mp_node p) {
++void mp_set_text_box (MP mp, mp_text_node p) {
 +@z
 +
 +@x
@@ -506,11 +440,11 @@
 +@y
 +  if ( ((*(mp_text_p (p)->str + k) < bc) || (*(mp_text_p (p)->str + k) > ec)) && (mp->font_id[f]==0) ) {
 +    mp_lost_warning (mp, f, *(mp_text_p (p)->str + k));
-+  } else { if (mp->font_id[f]==0) {
++  } else if (mp->font_id[f]==0) {
 +    cc = char_mp_info (f, *(mp_text_p (p)->str + k));
 +  } else {
 +    cc=char_mp_info(f,mp_lookup_ctype(mp, f,fromBUFF(mp_text_p(p)->str,limit,k)));
-+    k++; }
++    k++;
 +@z
 +
 +@x
@@ -535,22 +469,20 @@
 +@z
 --- /dev/null
 +++ texlive-bin/texk/web2c/pmplibdir/jmppsw.ch
-@@ -0,0 +1,76 @@
+@@ -0,0 +1,74 @@
 +%
 +%
 +% change file of psout.w for jMetaPost (CWEB version)
 +% Akira Kakuto (translated the WEB version)
 +%
-+% rewrited for TeX Live 2011
-+% Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
 +%
 +
 +@x
-+#include "pmppsout.h" /* internal header */
-+#include "pmpmath.h" /* internal header */
++#include "mppsout.h" /* internal header */
++#include "mpmath.h" /* internal header */
 +@y
-+#include "pmppsout.h" /* internal header */
-+#include "pmpmath.h" /* internal header */
++#include "mppsout.h" /* internal header */
++#include "mpmath.h" /* internal header */
 +#include <ptexenc/ptexenc.h>
 +@z
 +
@@ -567,13 +499,13 @@
 +static void mp_print_initial_comment(MP mp,mp_edge_object *hh, int prologues);
 +@y
 +static void mp_print_initial_comment(MP mp,mp_edge_object *hh, int prologues);
-+void mp_ps_kanji_string_out (MP mp, string s);
++void mp_ps_kanji_string_out (MP mp,mp_string s);
 +
 +#define Hi(x) (((x) >> 8) & 0xff)
 +#define Lo(x) ((x) & 0xff)
 +
 +@ @c
-+void mp_ps_kanji_string_out (MP mp, string s)
++void mp_ps_kanji_string_out (MP mp, char *s)
 +{
 +int i, len;
 +int c;
@@ -613,523 +545,139 @@
 +        mp_ps_name_out(mp, mp->font_name[gr_font_n(p)],false);
 +@z
 --- /dev/null
-+++ texlive-bin/texk/web2c/pmplibdir/pdvitomp.ch
-@@ -0,0 +1,494 @@
-+@x
-+#include "pmpxout.h"
-+@h
-+@y
-+#include "pmpxout.h"
-+#include <ptexenc/ptexenc.h>
-+@h
-+@z
-+
-+@x
-+@d max_widths (256*max_fonts) /* maximum number of different characters among all fonts */
-+@y
-+@d max_widths 512000 /* maximum number of different characters among all fonts */
-+@z
-+
-+@x
-+@d undefined_commands 250: case 251: case 252: case 253: case 254: case 255
++++ texlive-bin/texk/web2c/pmplibdir/mp.ch
+@@ -0,0 +1,20 @@
++@x
++  /* open the terminal for output */
++  t_open_out();
++#if DEBUG
++  setlinebuf(stdout);
++  setlinebuf(mp->term_out);
++#endif
 +@y
-+@d dir 255 /* p\TeX\ direction */
-+@d undefined_commands 250: case 251: case 252: case 253: case 254
++  /* open the terminal for output */
++  t_open_out();
++#if DEBUG
++#ifdef WIN32
++  setvbuf(stdout, (char *) NULL, _IONBF, 0);
++  setvbuf(mp->term_out, (char *) NULL, _IONBF, 0);
++#else
++  setlinebuf(stdout);
++  setlinebuf(mp->term_out);
++#endif
++#endif
 +@z
-+
+--- /dev/null
++++ texlive-bin/texk/web2c/pmplibdir/mpmathdouble.ch
+@@ -0,0 +1,76 @@
 +@x
-+mpx_read_tfm_word(mpx); lh=mpx->b2*(int)(256)+mpx->b3;
++#define _ISOC99_SOURCE /* to get the round() prototype */
++#include <w2c/config.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
 +@y
-+mpx_read_tfm_word(mpx);
-+@<Read the pTeX header data@>;@/
-+lh=mpx->b2*(int)(256)+mpx->b3;
++#define _ISOC99_SOURCE /* to get the round() prototype */
++#include <w2c/config.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#ifdef _MSC_VER
++double round(double x);
++#endif
 +@z
 +
 +@x
-+    if ( mpx->b0<128 ) 
-+      mpx->tfm_check_sum=((mpx->b0*(int)(256)+mpx->b1)*256+mpx->b2)*256+mpx->b3;
-+    else 
-+      mpx->tfm_check_sum=(((mpx->b0-256)*(int)(256)+mpx->b1)*256+mpx->b2)*256+mpx->b3;
++void mp_init_randoms (MP mp, int seed) {
++  int j, jj, k;    /* more or less random integers */
++  int i;        /* index into |randoms| */
++  j =  abs (seed);
++  while (j >= fraction_one) {
++    j = j/2;
 +  }
-+  if ( k==5 ) {
-+    if (mpx->mode == mpx_troff_mode) {
-+      mpx->font_design_size[f]=(((mpx->b0*(int)(256)+mpx->b1)*256+mpx->b2)*256+mpx->b3)/(65536.0*16);
-+    }
++  k = 1;
++  for (i = 0; i <= 54; i++) {
++    jj = k;
++    k = j - k;
++    j = jj;
++    if (k<0)
++      k += fraction_one;
++    mp->randoms[(i * 21) % 55].data.dval = j;
 +  }
++  mp_new_randoms (mp);
++  mp_new_randoms (mp);
++  mp_new_randoms (mp);          /* ``warm up'' the array */
 +}
 +@y
-+    if ( mpx->b0<128 ) 
-+      mpx->tfm_check_sum=((mpx->b0*(int)(256)+mpx->b1)*256+mpx->b2)*256+mpx->b3;
-+    else 
-+      mpx->tfm_check_sum=(((mpx->b0-256)*(int)(256)+mpx->b1)*256+mpx->b2)*256+mpx->b3;
++void mp_init_randoms (MP mp, int seed) {
++  int j, jj, k;    /* more or less random integers */
++  int i;        /* index into |randoms| */
++  j =  abs (seed);
++  while (j >= fraction_one) {
++    j = j/2;
 +  }
-+  if ( k==5 ) {
-+    if (mpx->mode == mpx_troff_mode) {
-+      mpx->font_design_size[f]=(((mpx->b0*(int)(256)+mpx->b1)*256+mpx->b2)*256+mpx->b3)/(65536.0*16);
-+    }
++  k = 1;
++  for (i = 0; i <= 54; i++) {
++    jj = k;
++    k = j - k;
++    j = jj;
++    if (k<0)
++      k += fraction_one;
++    mp->randoms[(i * 21) % 55].data.dval = j;
 +  }
++  mp_new_randoms (mp);
++  mp_new_randoms (mp);
++  mp_new_randoms (mp);          /* ``warm up'' the array */
 +}
-+@<Read JFM character type table@>;
-+@z
-+
-+@x
-+@<Width of character |c| in font |f|@>=
-+floor(mpx->dvi_scale*mpx->font_scaled_size[f]*char_width(f,c))
-+
-+@ @<Width of character |p| in font |cur_font|@>=
-+floor(mpx->dvi_scale*mpx->font_scaled_size[cur_font]*char_width(cur_font,p))
-+@y
-+@ @c @<Declare JFM character type table lookup routine@>@; /* p\TeX */
-+integer mpx_scaled_char_width (MPX mpx,integer f,integer c)
++#ifdef _MSC_VER
++#  include <math.h>
++double round(double x)
 +{
-+  if (mpx->font_id[f]!=0) c=mpx_lookup_ctype(mpx, f,c);
-+  return floor(mpx->dvi_scale*mpx->font_scaled_size[f]*char_width(f,c));
-+}
-+@z
-+
-+@x
-+@ @c @<Declare a procedure called |finish_last_char|@>@;
-+static void mpx_do_set_char (MPX mpx,web_integer f, web_integer c) {
-+  if ( (c<mpx->font_bc[f])||(c>mpx->font_ec[f]) )
-+    mpx_abort(mpx,"attempt to typeset invalid character %d",c);
-+@.attempt to typeset...@>
-+@y
-+@ PDVItoMP: |do_set_char| is called with non-virtual font.
-+In the case of non-virtual Kanji font, the width is looked up
-+with the character type, and the character is printed by the
-+function |set_kanji_char|.
-+
-+When the width written in the virtual font is same as
-+the width of the substituted font, the next character can be
-+written in the same string in output mpx file.
-+In other words, the width of the character is calculated
-+in |do_dvi_commands|. So even if the width is wrong here, the output PostScript file is not affected.
-+
-+@ @c @<Declare a procedure called |finish_last_char|@>@;
-+void mpx_do_set_char (MPX mpx,integer f,integer c)
-+{
-+integer kkk;
-+
-+if (mpx->font_id[f]!=0) {
-+  kkk=mpx_lookup_ctype(mpx, f,c);
-+  if ( (kkk<mpx->font_bc[f]) || (kkk>mpx->font_ec[f]) )
-+    mpx_abort(mpx,"attempt to typeset invalid character (JFM) %d",c);
-+} else if ( (c<mpx->font_bc[f])||(c>mpx->font_ec[f]) ) {
-+  mpx_abort(mpx,"attempt to typeset invalid character %d",c);
-+}
-+@.attempt to typeset...@>
-+@z
-+
-+@x
-+  if ((mpx->h!=mpx->str_h2)||(mpx->v!=mpx->str_v)||
-+      (f!=mpx->str_f)||(mpx->dvi_scale!=mpx->str_scale) ) {
-+@y
-+  if ((mpx->h!=mpx->str_h2)||(mpx->v!=mpx->str_v2)||
-+      (f!=mpx->str_f)||(mpx->dvi_scale!=mpx->str_scale) ) {
-+@z
-+
-+@x
-+    fprintf(mpx->mpxfile,"_s("); mpx->print_col=3;@/
-+    mpx->str_scale=mpx->dvi_scale; mpx->str_f=f; 
-+    mpx->str_v=mpx->v; mpx->str_h1=mpx->h;
-+@y
-+  if ((mpx->d==0) || (mpx->font_id[f]==9)) {
-+    fprintf(mpx->mpxfile,"_s("); mpx->print_col=3;}@/
-+  else {
-+    fprintf(mpx->mpxfile,"_sr("); mpx->print_col=4;}@/
-+  mpx->str_scale=mpx->dvi_scale; mpx->str_f=f;
-+  mpx->str_v1=mpx->v; mpx->str_h1=mpx->h;
-+@z
-+
-+@x
-+  mpx_print_char(mpx, (unsigned char)c);
-+  mpx->str_h2=(web_integer)(mpx->h+@<Width of character |c| in font |f|@>);
-+@y
-+  if (mpx->font_id[f]!=0)
-+    mpx_print_kanji_char(mpx, c);
-+  else
-+    mpx_print_char(mpx, c);
-+  if (mpx->d==0) {
-+    mpx->str_h2=mpx->h+mpx_scaled_char_width(mpx, f, c);
-+    mpx->str_v2=mpx->v;
-+  } else {
-+    mpx->str_h2=mpx->h;
-+    mpx->str_v2=mpx->v+mpx_scaled_char_width(mpx, f, c);
-+  }
-+@z
-+
-+@x
-+web_integer str_h1;
-+web_integer str_v; /* starting position for current output string */
-+web_integer str_h2; /* where the current output string ends */
-+@y
-+integer str_h1;
-+integer str_v1; /* starting position for current output string */
-+integer str_h2;
-+integer str_v2; /* where the current output string ends */
-+@z
-+
-+@x
-+  fprintf(mpx->mpxfile,"vardef _s(expr _t,_f,_m,_x,_y)(text _c)=\n");
-+  fprintf(mpx->mpxfile,
-+          "  addto _p also _t infont _f scaled _m shifted (_x,_y) _c; enddef;\n");
-+@y
-+  fprintf(mpx->mpxfile,"vardef _s(expr _t,_f,_m,_x,_y)(text _c)=\n");
-+  fprintf(mpx->mpxfile,
-+          "  addto _p also _t infont _f scaled _m shifted (_x,_y) _c; enddef;\n");
-+  fprintf(mpx->mpxfile,"vardef _sr(expr _t,_f,_m,_x,_y)=\n");  
-+  fprintf(mpx->mpxfile,"  addto _p also _t infont _f rotated -90");
-+  fprintf(mpx->mpxfile," scaled _m shifted (_x,_y); enddef;\n");
-+@z
-+
-+@x
-+      x=mpx->conv*mpx->str_h1; 
-+      y=mpx->conv*(-mpx->str_v);
-+@y
-+      x=mpx->conv*mpx->str_h1;
-+      y=mpx->conv*(-mpx->str_v1);
-+@z
-+
-+@x
-+@<Handle a special rule that determines the box size@>=
-+{ 
-+  mpx->pic_wd=mpx->h; mpx->pic_dp=mpx->v; mpx->pic_ht=ht-mpx->v; 
-+}
-+@y
-+@<Handle a special rule that determines the box size@>=
-+{ if (mpx->d==0) {
-+    mpx->pic_wd=mpx->h; mpx->pic_dp=mpx->v; mpx->pic_ht=ht-mpx->v;
-+  } else {
-+    mpx->pic_wd=mpx->v; mpx->pic_dp=-mpx->h; mpx->pic_ht=ht+mpx->h;
-+  }
-+}
-+@z
-+
-+@x
-+  mpx->str_v=0;
-+  mpx->str_h2=0;
-+  mpx->str_scale=1.0; /* values don't matter */
-+@y
-+  mpx->str_h2=0;
-+  mpx->str_v2=0;
-+  mpx->str_scale=1.0; /* values don't matter */
-+@z
-+
-+@x
-+dd=-mpx->pic_dp*mpx->conv;
-+w=mpx->conv*mpx->pic_wd; 
-+h=mpx->conv*mpx->pic_ht;
-+fprintf(mpx->mpxfile,
-+        "setbounds _p to (0,%1.4f)--(%1.4f,%1.4f)--\n" 
-+        " (%1.4f,%1.4f)--(0,%1.4f)--cycle;\n",dd,w,dd,w,h,h)
-+@y
-+if (mpx->d==0) {
-+  dd=-mpx->pic_dp*mpx->conv;
-+  w=mpx->conv*mpx->pic_wd;
-+  h=mpx->conv*mpx->pic_ht;
-+  fprintf(mpx->mpxfile,
-+        "setbounds _p to (0,%1.4f)--(%1.4f,%1.4f)--\n",dd,w,dd);
-+  fprintf(mpx->mpxfile,
-+        " (%1.4f,%1.4f)--(0,%1.4f)--cycle;\n",w,h,h);
-+} else {
-+  dd=-mpx->pic_dp*mpx->conv;
-+  w=-mpx->pic_wd*mpx->conv;
-+  h=mpx->conv*mpx->pic_ht;
-+  fprintf(mpx->mpxfile,
-+        "setbounds _p to (%1.4f,0)--(%1.4f,%1.4f)--\n",h,h,w);
-+  fprintf(mpx->mpxfile,
-+        " (%1.4f,%1.4f)--(%1.4f,0)--cycle;\n", dd,w,dd);
-+}
-+@z
-+
-+@x
-+web_integer w;web_integer x;web_integer y;web_integer z;
-+  /* current state values (|h| and |v| have already been declared) */
-+web_integer hstack[(stack_size+1)];
-+web_integer vstack[(stack_size+1)];
-+web_integer wstack[(stack_size+1)];
-+web_integer xstack[(stack_size+1)];
-+web_integer ystack[(stack_size+1)];
-+web_integer zstack[(stack_size+1)]; /* pushed down values in \.{DVI} units */
-+@y
-+integer w;integer x;integer y;integer z;integer d;
-+  /* current state values (|h| and |v| have already been declared) */
-+integer hstack[(stack_size+1)];
-+integer vstack[(stack_size+1)];
-+integer wstack[(stack_size+1)];
-+integer xstack[(stack_size+1)];
-+integer ystack[(stack_size+1)];
-+integer zstack[(stack_size+1)];
-+integer dstack[(stack_size+1)]; /* pushed down values in \.{DVI} units */
-+@z
-+
-+@x
-+mpx->h=0; mpx->v=0;
-+@y
-+mpx->h=0; mpx->v=0; mpx->d=0;
-+@z
-+
-+@x
-+  mpx->hstack[mpx->stk_siz]=mpx->h; 
-+  mpx->vstack[mpx->stk_siz]=mpx->v; mpx->wstack[mpx->stk_siz]=mpx->w;
-+  mpx->xstack[mpx->stk_siz]=mpx->x; 
-+  mpx->ystack[mpx->stk_siz]=mpx->y; mpx->zstack[mpx->stk_siz]=mpx->z;
-+@y 
-+  mpx->hstack[mpx->stk_siz]=mpx->h; 
-+  mpx->vstack[mpx->stk_siz]=mpx->v; mpx->wstack[mpx->stk_siz]=mpx->w;
-+  mpx->xstack[mpx->stk_siz]=mpx->x; 
-+  mpx->ystack[mpx->stk_siz]=mpx->y; mpx->zstack[mpx->stk_siz]=mpx->z;
-+  mpx->dstack[mpx->stk_siz]=mpx->d;
-+@z
-+
-+@x
-+    mpx->h=mpx->hstack[mpx->stk_siz]; 
-+    mpx->v=mpx->vstack[mpx->stk_siz]; mpx->w=mpx->wstack[mpx->stk_siz];
-+    mpx->x=mpx->xstack[mpx->stk_siz]; 
-+    mpx->y=mpx->ystack[mpx->stk_siz]; mpx->z=mpx->zstack[mpx->stk_siz];
-+@y
-+    mpx->h=mpx->hstack[mpx->stk_siz]; 
-+    mpx->v=mpx->vstack[mpx->stk_siz]; mpx->w=mpx->wstack[mpx->stk_siz];
-+    mpx->x=mpx->xstack[mpx->stk_siz]; 
-+    mpx->y=mpx->ystack[mpx->stk_siz]; mpx->z=mpx->zstack[mpx->stk_siz];
-+    mpx->d=mpx->dstack[mpx->stk_siz];
-+@z
-+
-+@x
-+  case z0: return mpx->z; break;
-+@y
-+  case z0: return mpx->z; break;
-+  case dir: return mpx_get_byte(mpx); break;
-+@z
-+
-+@x
-+    mpx->h += @<Width of character |p| in font |cur_font|@>;
-+@y
-+    if (mpx->d==0) {
-+      mpx->h+=mpx_scaled_char_width(mpx, cur_font, p);
-+    } else {
-+      mpx->v+=mpx_scaled_char_width(mpx, cur_font, p);
-+    }
-+@z
-+
-+@x
-+      mpx->h += q;
-+@y
-+      if (mpx->d==0) {
-+        mpx->h += q;
-+      } else {
-+        mpx->v += q;
-+      }
-+@z
-+
-+@x
-+case pop: 
-+  mpx_do_pop(mpx);
-+  break;
-+@y
-+case pop: 
-+  mpx_do_pop(mpx);
-+  break;
-+case dir:
-+  mpx->d=p;
-+  break;
-+@z
-+
-+@x
-+case four_cases(right1):
-+  mpx->h += trunc(p*mpx->dvi_scale);
-+  break;
-+case w0: case four_cases(w1): 
-+  mpx->w = (web_integer)trunc(p*mpx->dvi_scale); mpx->h += mpx->w;
-+  break;
-+case x0: case four_cases(x1): 
-+  mpx->x = (web_integer)trunc(p*mpx->dvi_scale); mpx->h += mpx->x;
-+  break;
-+case four_cases(down1):
-+  mpx->v += trunc(p*mpx->dvi_scale);
-+  break;
-+case y0: case four_cases(y1): 
-+  mpx->y = (web_integer)trunc(p*mpx->dvi_scale); mpx->v += mpx->y;
-+  break;
-+case z0: case four_cases(z1): 
-+  mpx->z = (web_integer)trunc(p*mpx->dvi_scale); mpx->v += mpx->z;
-+  break;
-+@y
-+case four_cases(right1):
-+  if (mpx->d==0) {
-+    mpx->h+=trunc(p*mpx->dvi_scale);
-+  } else {
-+    mpx->v+=trunc(p*mpx->dvi_scale);
-+  }
-+  break;
-+case w0: case four_cases(w1):
-+  if (mpx->d==0) {
-+    mpx->h+=mpx->w;
-+  } else {
-+    mpx->v+=mpx->w;
-+  }
-+  break;
-+case x0: case four_cases(x1):
-+  if (mpx->d==0) {
-+    mpx->h+=mpx->x;
-+  } else {
-+    mpx->v+=mpx->x;
-+  }
-+  break;
-+case four_cases(down1):
-+  if (mpx->d==0) {
-+    mpx->v+=trunc(p*mpx->dvi_scale);
-+  } else {
-+    mpx->h-=trunc(p*mpx->dvi_scale);
-+  }
-+  break;
-+case y0: case four_cases(y1):
-+  if (mpx->d==0) {
-+    mpx->v+=mpx->y;
-+  } else {
-+    mpx->h-=mpx->y;
-+  }
-+  break;
-+case z0: case four_cases(z1):
-+  if (mpx->d==0) {
-+    mpx->v+=mpx->z;
-+  } else {
-+    mpx->h-=mpx->z;
-+  }
-+  break;
-+@z
-+
-+@x
-+@<Check if mp file is newer than mpxfile, exit if not@>=
-+if (mpx_newer(mpxopt->mpname, mpxopt->mpxname))
-+   return 0
-+@y
-+@<Check if mp file is newer than mpxfile, exit if not@>=
-+if (mpx_newer(mpxopt->mpname, mpxopt->mpxname))
-+   return 0
-+
-+@ ASCII p\TeX JFM ID
-+@d yoko_jfm_id   11 /* for `yoko-kumi' fonts */
-+@d tate_jfm_id   9  /* for `tate-kumi' fonts */
-+@d font_jfm_p(A)   (mpx->font_id[(A)]!=0)
-+
-+@ @<Global...@>=
-+integer font_nt[max_fonts+1]; /* number of words in ctype table */
-+integer font_id[max_fonts+1];
-+integer jfm_char_code[max_widths+1];
-+integer jfm_char_type[max_widths+1];
-+integer jfm_char_index[max_fonts+1];
-+integer next_jfm_char_index;
-+
-+@ @<Set init...@>=
-+mpx->font_nt[0]=0;
-+mpx->font_id[0]=0;
-+mpx->jfm_char_type[0]=0;
-+mpx->next_jfm_char_index=0;
-+
-+@ JFM character type table is stored in the array |jfm_char_code| and
-+|jfm_char_type|. The character code and the character type of $i$-th
-+record is stored in |jfm_char_code[i]| and |jfm_char_type[i]|, respectively.
-+The table is in the order of character code.
-+
-+@<Read the pTeX header data@>=
-+mpx->font_id[f]=mpx->b0*(int)(256)+mpx->b1;
-+if ((mpx->font_id[f]==yoko_jfm_id) || (mpx->font_id[f]==tate_jfm_id)) {
-+  mpx->font_nt[f]=mpx->b2*(int)(256)+mpx->b3;
-+  mpx_read_tfm_word(mpx);
-+} else {
-+  mpx->font_id[f]=0;
-+  mpx->font_nt[f]=0;
-+}
-+
-+@ @<Read JFM character type table@>=
-+mpx->jfm_char_index[f]=mpx->next_jfm_char_index;
-+k=mpx->jfm_char_index[f];
-+mpx->next_jfm_char_index+=mpx->font_nt[f];
-+while (k<mpx->next_jfm_char_index) {
-+  mpx_read_tfm_word(mpx);
-+  mpx->jfm_char_code[k]=mpx->b0*(int)(256)+mpx->b1;
-+  mpx->jfm_char_type[k]=mpx->b2*(int)(256)+mpx->b3;
-+  k++;
-+}
-+
-+@ JFM character type table is looked up by binary search.
-+
-+@<Declare JFM character type table lookup routine@>=
-+integer mpx_lookup_ctype (MPX mpx,integer f, integer c)
-+{
-+  integer l, u, r, ch;
-+  l=0; u=mpx->font_nt[f]-1;
-+  while (l<u) {
-+    r=(l+u)/2;
-+    ch=mpx->jfm_char_code[mpx->jfm_char_index[f]+r];
-+    if (ch==c) {
-+      return mpx->jfm_char_type[mpx->jfm_char_index[f]+r];
-+    }
-+    if (ch<c)
-+      l=r+1;
++    double c, f, d1, d2;
++
++    c = ceil(x);
++    f = floor(x);
++    d1 = fabs(c - x);
++    d2 = fabs(x - f);
++    if (d1 > d2)
++        return f;
 +    else
-+      u=r-1;
-+  }
-+  return 0;
-+}
-+
-+@ Every Kanji characters are supposed to be printable here,
-+so that the state always results in normal at the end of the procedure.
-+Kanji characters need to be converted into output Kanji encoding
-+from DVI(JIS).
-+
-+@d Hi(x) (((x)>> 8) & 0xff)
-+@d Lo(x) ( (x)      & 0xff)
-+
-+@<Declare subroutines for printing strings@>=
-+void mpx_print_kanji_char (MPX mpx,integer c)
-+{
-+  if (mpx->print_col+2>line_length-2 ) {
-+    if (mpx->state==normal) {
-+      fprintf(mpx->mpxfile, "\"");
-+      mpx->state=special;
-+    }
-+    fprintf(mpx->mpxfile, " \n");
-+    mpx->print_col=0;
-+  }
-+  if (mpx->state==special) {
-+    fprintf(mpx->mpxfile,"&");
-+    mpx->print_col++;
-+  }
-+  if (mpx->state!=normal) {
-+    fprintf(mpx->mpxfile, "\"");
-+    mpx->print_col++;
-+    mpx->state=normal;
-+  }
-+  c=toBUFF(fromDVI(c));
-+  putc2(Hi(c), mpx->mpxfile);
-+  mpx->print_col++;
-+  putc2(Lo(c), mpx->mpxfile);
-+  mpx->print_col++;
++        return c;
 +}
++#endif
 +@z
 --- /dev/null
-+++ texlive-bin/texk/web2c/pmplibdir/pmpost.ch
-@@ -0,0 +1,234 @@
++++ texlive-bin/texk/web2c/pmplibdir/mpost.ch
+@@ -0,0 +1,310 @@
 +@x
-+#include <pmpxout.h>
++#include <kpathsea/kpathsea.h>
 +@y
-+#include <pmpxout.h>
-+#include <ptexenc/ptexenc.h>
++#include <kpathsea/kpathsea.h>
++#ifdef WIN32
 +char kanjioption[16];
++#endif
 +@z
 +
 +@x
 +@d TEX     "tex"
-+@y
-+@d TEX     "ptex"
-+@z
++@d TROFF   "soelim | eqn -Tps -d$$ | troff -Tps"
 +
-+@x
++@c
++#ifndef MPXCOMMAND
 +#define MPXCOMMAND "makempx"
++#endif
 +@y
++@d TEX     "ptex"
++@d TROFF   "gsoelim | geqn -Tps -d$$ | gtroff -Tps"
++
++@c
++#ifndef MPXCOMMAND
++#ifdef WIN32
 +#define MPXCOMMAND "pmakempx"
++#else
++#define MPXCOMMAND "makempx"
++#endif
++#endif
 +@z
 +
 +@x
@@ -1144,7 +692,7 @@
 +    if (cnf_cmd!=NULL && (strcmp (cnf_cmd, "1")!=0)) {
 +      if (kanjioption[0])
 +        cnf_cmd = concatn (cnf_cmd, " --kanji=", kanjioption, NULL);
-+      if (mp_troff_mode(mp)!=0)
++      if (mp_troff_mode(mp))
 +        cmd = concatn (cnf_cmd, " -troff ",
 +                       qmpname, " ", qmpxname, NULL);
 +      else if (mpost_tex_program!=NULL && *mpost_tex_program != '\0')
@@ -1153,11 +701,18 @@
 +@z
 +
 +@x
-+      mpxopt = mpost_xmalloc(sizeof(mpx_options));
 +      if (mpost_tex_program != NULL && *mpost_tex_program != '\0') {
++        maincmd = mpost_xstrdup(mpost_tex_program);
++      } else {
++        if (mpxmode == mpx_tex_mode) {
++          s = kpse_var_value("TEX");
++          if (s==NULL) s = kpse_var_value("MPXMAINCMD");
++          if (s==NULL) s = mpost_xstrdup (TEX);
++          maincmd = (char *)mpost_xmalloc (strlen(s)+strlen(default_args)+1);
++          strcpy(maincmd,s);
 +@y
-+      mpxopt = mpost_xmalloc(sizeof(mpx_options));
 +      if (mpost_tex_program != NULL && *mpost_tex_program != '\0') {
++#ifdef WIN32
 +        if (kanjioption[0]) {
 +          maincmd = (char *)mpost_xmalloc (strlen(mpost_tex_program) +
 +                                   strlen(kanjioption) + 15);
@@ -1165,32 +720,44 @@
 +          strcat(maincmd, " --kanji=");
 +          strcat(maincmd, kanjioption);
 +        } else
-+@z
-+
-+@x
-+          if (s==NULL) s = mpost_xstrdup (TEX);
-+@y
++          maincmd = mpost_xstrdup(mpost_tex_program);
++#else
++        maincmd = mpost_xstrdup(mpost_tex_program);
++#endif
++      } else {
++        if (mpxmode == mpx_tex_mode) {
++          s = kpse_var_value("TEX");
++          if (s==NULL) s = kpse_var_value("MPXMAINCMD");
 +          if (s==NULL) s = mpost_xstrdup (TEX);
++#ifdef WIN32
 +          if (kanjioption[0])
 +            maincmd = (char *)mpost_xmalloc (strlen(s)+strlen(default_args)+
 +                                             strlen(kanjioption)+13);
 +          else
-+@z
-+
-+@x
-+          strcat(maincmd,default_args);
-+@y
++            maincmd = (char *)mpost_xmalloc (strlen(s)+strlen(default_args)+1);
++#else
++          maincmd = (char *)mpost_xmalloc (strlen(s)+strlen(default_args)+1);
++#endif
++          strcpy(maincmd,s);
++#ifdef WIN32
 +          if (kanjioption[0]) {
 +            strcat(maincmd, " --kanji=");
 +            strcat(maincmd, kanjioption);
 +          }
-+          strcat(maincmd,default_args);
++#endif
 +@z
 +
 +@x
 +        const char *banner = "% Written by metapost version ";
 +@y
-+        const char *banner = "% Written by pmetapost version ";
++        const char *banner = "% Written by pmpost version ";
++@z
++
++@x
++  mpost_xfree (cnf_cmd);
++@y
++  if(cnf_cmd)
++    mpost_xfree (cnf_cmd);
 +@z
 +
 +@x
@@ -1214,11 +781,13 @@
 +        if (user_progname == NULL) 
 +	      user_progname = optarg;
 +      }
++#ifdef WIN32
 +    } else if (ARGUMENT_IS ("kanji")) {
 +      strcpy(kanjioption, optarg);
 +      if(!set_enc_string(optarg, optarg)) {
 +        fprintf(stderr,"Ignoring unknown argument `%s' to --kanji", optarg);
 +      }
++#endif
 +@z
 +
 +@x
@@ -1229,91 +798,109 @@
 +@z
 +
 +@x
++    } else if (option_is ("progname")) {
 +      user_progname = optarg;
 +@y
++    } else if (option_is ("progname")) {
 +      user_progname = optarg;
++#ifdef WIN32
 +    } else if (option_is ("kanji")) {
 +      strcpy (kanjioption, optarg);
 +      if(!set_enc_string(optarg, optarg)) {
 +        fprintf(stderr,"Ignoring unknown argument `%s' to --kanji", optarg);
 +      }
++#endif
 +@z
 +
 +@x
-+if (dvitomp_only)
 +  fprintf(stdout, "This is dvitomp %s" WEB2CVERSION "\n", s);
 +else
 +  fprintf(stdout, "This is MetaPost %s" WEB2CVERSION "\n", s);
-+@y
-+if (dvitomp_only)
-+  fprintf(stdout, "This is pdvitomp %s" WEB2CVERSION "\n", s);
-+else
-+  fprintf(stdout, "This is pMetaPost %s" WEB2CVERSION "\n", s);
-+@z
-+
-+@x
++mpost_xfree(s);
++fprintf(stdout,
++"\n"
 +"Usage: mpost [OPTION] [&MEMNAME] [MPNAME[.mp]] [COMMANDS]\n"
 +"       mpost --dvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
-+@y
-+"Usage: pmetapost [OPTION] [&MEMNAME] [MPNAME[.mp]] [COMMANDS]\n"
-+"       pmetapost --dvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
-+@z
-+
-+@x
++"\n"
 +"  Run MetaPost on MPNAME, usually creating MPNAME.NNN (and perhaps\n"
-+@y
-+"  Run pMetaPost on MPNAME, usually creating MPNAME.NNN (and perhaps\n"
-+@z
-+
-+@x
++"  MPNAME.tfm), where NNN are the character numbers generated.\n"
++"  Any remaining COMMANDS are processed as MetaPost input,\n"
++"  after MPNAME is read.\n\n"
 +"  With a --dvitomp argument, MetaPost acts as DVI-to-MPX converter only.\n"
 +"  Call MetaPost with --dvitomp --help for option explanations.\n\n");
++fprintf(stdout,
++"  -ini                      be inimpost, for dumping mem files\n"
++"  -interaction=STRING       set interaction mode (STRING=batchmode/nonstopmode/\n"
++"                            scrollmode/errorstopmode)\n"
++"  -numbersystem=STRING      set number system mode (STRING=scaled/double/binary/decimal)\n"
++"  -jobname=STRING           set the job name to STRING\n"
 +@y
++  fprintf(stdout, "This is pdvitomp %s" WEB2CVERSION "\n", s);
++else
++  fprintf(stdout, "This is pMetaPost %s" WEB2CVERSION "\n", s);
++mpost_xfree(s);
++fprintf(stdout,
++"\n"
++"Usage: pmpost [OPTION] [&MEMNAME] [MPNAME[.mp]] [COMMANDS]\n"
++"       pmpost --dvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
++"\n"
++"  Run pMetaPost on MPNAME, usually creating MPNAME.NNN (and perhaps\n"
++"  MPNAME.tfm), where NNN are the character numbers generated.\n"
++"  Any remaining COMMANDS are processed as pMetaPost input,\n"
++"  after MPNAME is read.\n\n"
 +"  With a --dvitomp argument, pMetaPost acts as DVI-to-MPX converter only.\n"
 +"  Call pMetaPost with --dvitomp --help for option explanations.\n\n");
++fprintf(stdout,
++"  -ini                      be inipmpost, for dumping mem files\n"
++"  -interaction=STRING       set interaction mode (STRING=batchmode/nonstopmode/\n"
++"                            scrollmode/errorstopmode)\n"
++"  -numbersystem=STRING      set number system mode (STRING=scaled/double/binary/decimal)\n"
++"  -jobname=STRING           set the job name to STRING\n"
++"  -kanji=STRING             set the Japanese encoding to STRING\n"
 +@z
 +
 +@x
-+"  -jobname=STRING           set the job name to STRING\n"
++"  -version                  output version information and exit\n"
++"\n"
++"Email bug reports to mp-implementors@@tug.org.\n"
 +@y
-+"  -jobname=STRING           set the job name to STRING\n"
-+"  -kanji=STRING             set the Japanese encoding to STRING\n"
++"  -version                  output version information and exit\n"
 +@z
 +
 +@x
-+if (dvitomp_only)
 +  fprintf(stdout, "This is dvitomp %s" WEB2CVERSION "\n", s);
 +else
 +  fprintf(stdout, "This is MetaPost %s" WEB2CVERSION "\n", s);
++mpost_xfree(s);
++fprintf(stdout,
++"\n"
++"Usage: dvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
++"       mpost --dvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
++"\n"
++"  Convert a TeX DVI file to a MetaPost MPX file.\n\n");
++fprintf(stdout,
++"  -progname=STRING          set program name to STRING\n"
 +@y
-+if (dvitomp_only)
 +  fprintf(stdout, "This is pdvitomp %s" WEB2CVERSION "\n", s);
 +else
 +  fprintf(stdout, "This is pMetaPost %s" WEB2CVERSION "\n", s);
-+@z
-+
-+@x
-+"Usage: dvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
-+"       mpost --dvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
-+@y
++mpost_xfree(s);
++fprintf(stdout,
++"\n"
 +"Usage: pdvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
-+"       pmetapost --dvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
-+@z
-+
-+@x
-+"  -progname=STRING          set program name to STRING\n"
-+@y
++"       pmpost --dvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
++"\n"
++"  Convert a TeX DVI file to a MetaPost MPX file.\n\n");
++fprintf(stdout,
 +"  -progname=STRING          set program name to STRING\n"
 +"  -kanji=STRING             set kanji encoding (sjis, jis, euc, utf8)\n"
 +@z
 +
 +@x
-+if (dvitomp_only)
 +  fprintf(stdout, "dvitomp (MetaPost) %s" WEB2CVERSION "\n", s);
 +else
 +  fprintf(stdout, "MetaPost %s" WEB2CVERSION "\n", s);
 +@y
-+if (dvitomp_only)
 +  fprintf(stdout, "pdvitomp (pMetaPost) %s" WEB2CVERSION "\n", s);
 +else
 +  fprintf(stdout, "pMetaPost %s" WEB2CVERSION "\n", s);
@@ -1333,16 +920,658 @@
 +@z
 +
 +@x
++  options->print_found_names = (int)true;
++  {
++    const char *base = xbasename(argv[0]);
 +    if (!strcmp(base, "dvitomp") || !strcasecmp(base, "dvitomp.exe"))
++      dvitomp_only=1;
++  }
++  if (dvitomp_only) {
++    @<Read and set dvitomp command line options@>;
++  } else {
 +@y
-+    kanjioption[0] = '\0';
-+    enable_UPTEX (false);
-+    set_enc_string(NULL, "default");
-+    if (!strcmp(base, "pdvitomp") || !strcasecmp(base, "pdvitomp.exe"))
++  options->print_found_names = (int)true;
++
++#if defined(WIN32)
++  {
++    char *p , *q;
++    p = (char *)xbasename(argv[0]);
++    if ((q = strrchr(p, '.')) && !stricmp(q, ".exe"))
++       *q = '\0';
++    argv[0] = p;
++   }
++  kanjioption[0] = '\0';
++  enable_UPTEX (false);
++  set_enc_string("sjis", "sjis");
++#endif
++
++  if (strstr(argv[0], "dvitomp") != NULL) {
++    dvitomp_only=1;
++    @<Read and set dvitomp command line options@>;
++  } else {
++#ifdef WIN32
++    options->mem_name = mpost_xstrdup(argv[0]);
++#endif
 +@z
 +
 +@x
 +  if(putenv(xstrdup("engine=metapost")))
 +@y
-+  if(putenv(xstrdup("engine=pmetapost")))
++  if(putenv(xstrdup("engine=pmpost")))
++@z
+--- /dev/null
++++ texlive-bin/texk/web2c/pmplibdir/mpxout.ch
+@@ -0,0 +1,8 @@
++@x
++#include <process.h>
++@y
++#include <process.h>
++#define R_OK 4
++typedef int boolean;
++typedef int integer;
++@z
+--- /dev/null
++++ texlive-bin/texk/web2c/pmplibdir/pdvitomp.ch
+@@ -0,0 +1,494 @@
++@x
++#include "mpxout.h"
++@h
++@y
++#include "mpxout.h"
++#include <ptexenc/ptexenc.h>
++@h
++@z
++
++@x
++@d max_widths (256*max_fonts) /* maximum number of different characters among all fonts */
++@y
++@d max_widths 512000 /* maximum number of different characters among all fonts */
++@z
++
++@x
++@d undefined_commands 250: case 251: case 252: case 253: case 254: case 255
++@y
++@d dir 255 /* p\TeX\ direction */
++@d undefined_commands 250: case 251: case 252: case 253: case 254
++@z
++
++@x
++mpx_read_tfm_word(mpx); lh=mpx->b2*(int)(256)+mpx->b3;
++@y
++mpx_read_tfm_word(mpx);
++@<Read the pTeX header data@>;@/
++lh=mpx->b2*(int)(256)+mpx->b3;
++@z
++
++@x
++    if ( mpx->b0<128 ) 
++      mpx->tfm_check_sum=((mpx->b0*(int)(256)+mpx->b1)*256+mpx->b2)*256+mpx->b3;
++    else 
++      mpx->tfm_check_sum=(((mpx->b0-256)*(int)(256)+mpx->b1)*256+mpx->b2)*256+mpx->b3;
++  }
++  if ( k==5 ) {
++    if (mpx->mode == mpx_troff_mode) {
++      mpx->font_design_size[f]=(((mpx->b0*(int)(256)+mpx->b1)*256+mpx->b2)*256+mpx->b3)/(65536.0*16);
++    }
++  }
++}
++@y
++    if ( mpx->b0<128 ) 
++      mpx->tfm_check_sum=((mpx->b0*(int)(256)+mpx->b1)*256+mpx->b2)*256+mpx->b3;
++    else 
++      mpx->tfm_check_sum=(((mpx->b0-256)*(int)(256)+mpx->b1)*256+mpx->b2)*256+mpx->b3;
++  }
++  if ( k==5 ) {
++    if (mpx->mode == mpx_troff_mode) {
++      mpx->font_design_size[f]=(((mpx->b0*(int)(256)+mpx->b1)*256+mpx->b2)*256+mpx->b3)/(65536.0*16);
++    }
++  }
++}
++@<Read JFM character type table@>;
++@z
++
++@x
++@<Width of character |c| in font |f|@>=
++floor(mpx->dvi_scale*mpx->font_scaled_size[f]*char_width(f,c))
++
++@ @<Width of character |p| in font |cur_font|@>=
++floor(mpx->dvi_scale*mpx->font_scaled_size[cur_font]*char_width(cur_font,p))
++@y
++@ @c @<Declare JFM character type table lookup routine@>@; /* p\TeX */
++integer mpx_scaled_char_width (MPX mpx,integer f,integer c)
++{
++  if (mpx->font_id[f]!=0) c=mpx_lookup_ctype(mpx, f,c);
++  return floor(mpx->dvi_scale*mpx->font_scaled_size[f]*char_width(f,c));
++}
++@z
++
++@x
++@ @c @<Declare a procedure called |finish_last_char|@>@;
++static void mpx_do_set_char (MPX mpx,web_integer f, web_integer c) {
++  if ( (c<mpx->font_bc[f])||(c>mpx->font_ec[f]) )
++    mpx_abort(mpx,"attempt to typeset invalid character %d",c);
++@.attempt to typeset...@>
++@y
++@ PDVItoMP: |do_set_char| is called with non-virtual font.
++In the case of non-virtual Kanji font, the width is looked up
++with the character type, and the character is printed by the
++function |set_kanji_char|.
++
++When the width written in the virtual font is same as
++the width of the substituted font, the next character can be
++written in the same string in output mpx file.
++In other words, the width of the character is calculated
++in |do_dvi_commands|. So even if the width is wrong here, the output PostScript file is not affected.
++
++@ @c @<Declare a procedure called |finish_last_char|@>@;
++void mpx_do_set_char (MPX mpx,integer f,integer c)
++{
++integer kkk;
++
++if (mpx->font_id[f]!=0) {
++  kkk=mpx_lookup_ctype(mpx, f,c);
++  if ( (kkk<mpx->font_bc[f]) || (kkk>mpx->font_ec[f]) )
++    mpx_abort(mpx,"attempt to typeset invalid character (JFM) %d",c);
++} else if ( (c<mpx->font_bc[f])||(c>mpx->font_ec[f]) ) {
++  mpx_abort(mpx,"attempt to typeset invalid character %d",c);
++}
++@.attempt to typeset...@>
++@z
++
++@x
++  if ((mpx->h!=mpx->str_h2)||(mpx->v!=mpx->str_v)||
++      (f!=mpx->str_f)||(mpx->dvi_scale!=mpx->str_scale) ) {
++@y
++  if ((mpx->h!=mpx->str_h2)||(mpx->v!=mpx->str_v2)||
++      (f!=mpx->str_f)||(mpx->dvi_scale!=mpx->str_scale) ) {
++@z
++
++@x
++    fprintf(mpx->mpxfile,"_s("); mpx->print_col=3;@/
++    mpx->str_scale=mpx->dvi_scale; mpx->str_f=f; 
++    mpx->str_v=mpx->v; mpx->str_h1=mpx->h;
++@y
++  if ((mpx->d==0) || (mpx->font_id[f]==9)) {
++    fprintf(mpx->mpxfile,"_s("); mpx->print_col=3;}@/
++  else {
++    fprintf(mpx->mpxfile,"_sr("); mpx->print_col=4;}@/
++  mpx->str_scale=mpx->dvi_scale; mpx->str_f=f;
++  mpx->str_v1=mpx->v; mpx->str_h1=mpx->h;
++@z
++
++@x
++  mpx_print_char(mpx, (unsigned char)c);
++  mpx->str_h2=(web_integer)(mpx->h+@<Width of character |c| in font |f|@>);
++@y
++  if (mpx->font_id[f]!=0)
++    mpx_print_kanji_char(mpx, c);
++  else
++    mpx_print_char(mpx, c);
++  if (mpx->d==0) {
++    mpx->str_h2=mpx->h+mpx_scaled_char_width(mpx, f, c);
++    mpx->str_v2=mpx->v;
++  } else {
++    mpx->str_h2=mpx->h;
++    mpx->str_v2=mpx->v+mpx_scaled_char_width(mpx, f, c);
++  }
++@z
++
++@x
++web_integer str_h1;
++web_integer str_v; /* starting position for current output string */
++web_integer str_h2; /* where the current output string ends */
++@y
++integer str_h1;
++integer str_v1; /* starting position for current output string */
++integer str_h2;
++integer str_v2; /* where the current output string ends */
++@z
++
++@x
++  fprintf(mpx->mpxfile,"vardef _s(expr _t,_f,_m,_x,_y)(text _c)=\n");
++  fprintf(mpx->mpxfile,
++          "  addto _p also _t infont _f scaled _m shifted (_x,_y) _c; enddef;\n");
++@y
++  fprintf(mpx->mpxfile,"vardef _s(expr _t,_f,_m,_x,_y)(text _c)=\n");
++  fprintf(mpx->mpxfile,
++          "  addto _p also _t infont _f scaled _m shifted (_x,_y) _c; enddef;\n");
++  fprintf(mpx->mpxfile,"vardef _sr(expr _t,_f,_m,_x,_y)=\n");  
++  fprintf(mpx->mpxfile,"  addto _p also _t infont _f rotated -90");
++  fprintf(mpx->mpxfile," scaled _m shifted (_x,_y); enddef;\n");
++@z
++
++@x
++      x=mpx->conv*mpx->str_h1; 
++      y=mpx->conv*(-mpx->str_v);
++@y
++      x=mpx->conv*mpx->str_h1;
++      y=mpx->conv*(-mpx->str_v1);
++@z
++
++@x
++@<Handle a special rule that determines the box size@>=
++{ 
++  mpx->pic_wd=mpx->h; mpx->pic_dp=mpx->v; mpx->pic_ht=ht-mpx->v; 
++}
++@y
++@<Handle a special rule that determines the box size@>=
++{ if (mpx->d==0) {
++    mpx->pic_wd=mpx->h; mpx->pic_dp=mpx->v; mpx->pic_ht=ht-mpx->v;
++  } else {
++    mpx->pic_wd=mpx->v; mpx->pic_dp=-mpx->h; mpx->pic_ht=ht+mpx->h;
++  }
++}
++@z
++
++@x
++  mpx->str_v=0;
++  mpx->str_h2=0;
++  mpx->str_scale=1.0; /* values don't matter */
++@y
++  mpx->str_h2=0;
++  mpx->str_v2=0;
++  mpx->str_scale=1.0; /* values don't matter */
++@z
++
++@x
++dd=-mpx->pic_dp*mpx->conv;
++w=mpx->conv*mpx->pic_wd; 
++h=mpx->conv*mpx->pic_ht;
++fprintf(mpx->mpxfile,
++        "setbounds _p to (0,%1.4f)--(%1.4f,%1.4f)--\n" 
++        " (%1.4f,%1.4f)--(0,%1.4f)--cycle;\n",dd,w,dd,w,h,h)
++@y
++if (mpx->d==0) {
++  dd=-mpx->pic_dp*mpx->conv;
++  w=mpx->conv*mpx->pic_wd;
++  h=mpx->conv*mpx->pic_ht;
++  fprintf(mpx->mpxfile,
++        "setbounds _p to (0,%1.4f)--(%1.4f,%1.4f)--\n",dd,w,dd);
++  fprintf(mpx->mpxfile,
++        " (%1.4f,%1.4f)--(0,%1.4f)--cycle;\n",w,h,h);
++} else {
++  dd=-mpx->pic_dp*mpx->conv;
++  w=-mpx->pic_wd*mpx->conv;
++  h=mpx->conv*mpx->pic_ht;
++  fprintf(mpx->mpxfile,
++        "setbounds _p to (%1.4f,0)--(%1.4f,%1.4f)--\n",h,h,w);
++  fprintf(mpx->mpxfile,
++        " (%1.4f,%1.4f)--(%1.4f,0)--cycle;\n", dd,w,dd);
++}
++@z
++
++@x
++web_integer w;web_integer x;web_integer y;web_integer z;
++  /* current state values (|h| and |v| have already been declared) */
++web_integer hstack[(stack_size+1)];
++web_integer vstack[(stack_size+1)];
++web_integer wstack[(stack_size+1)];
++web_integer xstack[(stack_size+1)];
++web_integer ystack[(stack_size+1)];
++web_integer zstack[(stack_size+1)]; /* pushed down values in \.{DVI} units */
++@y
++integer w;integer x;integer y;integer z;integer d;
++  /* current state values (|h| and |v| have already been declared) */
++integer hstack[(stack_size+1)];
++integer vstack[(stack_size+1)];
++integer wstack[(stack_size+1)];
++integer xstack[(stack_size+1)];
++integer ystack[(stack_size+1)];
++integer zstack[(stack_size+1)];
++integer dstack[(stack_size+1)]; /* pushed down values in \.{DVI} units */
++@z
++
++@x
++mpx->h=0; mpx->v=0;
++@y
++mpx->h=0; mpx->v=0; mpx->d=0;
++@z
++
++@x
++  mpx->hstack[mpx->stk_siz]=mpx->h; 
++  mpx->vstack[mpx->stk_siz]=mpx->v; mpx->wstack[mpx->stk_siz]=mpx->w;
++  mpx->xstack[mpx->stk_siz]=mpx->x; 
++  mpx->ystack[mpx->stk_siz]=mpx->y; mpx->zstack[mpx->stk_siz]=mpx->z;
++@y 
++  mpx->hstack[mpx->stk_siz]=mpx->h; 
++  mpx->vstack[mpx->stk_siz]=mpx->v; mpx->wstack[mpx->stk_siz]=mpx->w;
++  mpx->xstack[mpx->stk_siz]=mpx->x; 
++  mpx->ystack[mpx->stk_siz]=mpx->y; mpx->zstack[mpx->stk_siz]=mpx->z;
++  mpx->dstack[mpx->stk_siz]=mpx->d;
++@z
++
++@x
++    mpx->h=mpx->hstack[mpx->stk_siz]; 
++    mpx->v=mpx->vstack[mpx->stk_siz]; mpx->w=mpx->wstack[mpx->stk_siz];
++    mpx->x=mpx->xstack[mpx->stk_siz]; 
++    mpx->y=mpx->ystack[mpx->stk_siz]; mpx->z=mpx->zstack[mpx->stk_siz];
++@y
++    mpx->h=mpx->hstack[mpx->stk_siz]; 
++    mpx->v=mpx->vstack[mpx->stk_siz]; mpx->w=mpx->wstack[mpx->stk_siz];
++    mpx->x=mpx->xstack[mpx->stk_siz]; 
++    mpx->y=mpx->ystack[mpx->stk_siz]; mpx->z=mpx->zstack[mpx->stk_siz];
++    mpx->d=mpx->dstack[mpx->stk_siz];
++@z
++
++@x
++  case z0: return mpx->z; break;
++@y
++  case z0: return mpx->z; break;
++  case dir: return mpx_get_byte(mpx); break;
++@z
++
++@x
++    mpx->h += @<Width of character |p| in font |cur_font|@>;
++@y
++    if (mpx->d==0) {
++      mpx->h+=mpx_scaled_char_width(mpx, cur_font, p);
++    } else {
++      mpx->v+=mpx_scaled_char_width(mpx, cur_font, p);
++    }
++@z
++
++@x
++      mpx->h += q;
++@y
++      if (mpx->d==0) {
++        mpx->h += q;
++      } else {
++        mpx->v += q;
++      }
++@z
++
++@x
++case pop: 
++  mpx_do_pop(mpx);
++  break;
++@y
++case pop: 
++  mpx_do_pop(mpx);
++  break;
++case dir:
++  mpx->d=p;
++  break;
++@z
++
++@x
++case four_cases(right1):
++  mpx->h += trunc(p*mpx->dvi_scale);
++  break;
++case w0: case four_cases(w1): 
++  mpx->w = (web_integer)trunc(p*mpx->dvi_scale); mpx->h += mpx->w;
++  break;
++case x0: case four_cases(x1): 
++  mpx->x = (web_integer)trunc(p*mpx->dvi_scale); mpx->h += mpx->x;
++  break;
++case four_cases(down1):
++  mpx->v += trunc(p*mpx->dvi_scale);
++  break;
++case y0: case four_cases(y1): 
++  mpx->y = (web_integer)trunc(p*mpx->dvi_scale); mpx->v += mpx->y;
++  break;
++case z0: case four_cases(z1): 
++  mpx->z = (web_integer)trunc(p*mpx->dvi_scale); mpx->v += mpx->z;
++  break;
++@y
++case four_cases(right1):
++  if (mpx->d==0) {
++    mpx->h+=trunc(p*mpx->dvi_scale);
++  } else {
++    mpx->v+=trunc(p*mpx->dvi_scale);
++  }
++  break;
++case w0: case four_cases(w1):
++  if (mpx->d==0) {
++    mpx->h+=mpx->w;
++  } else {
++    mpx->v+=mpx->w;
++  }
++  break;
++case x0: case four_cases(x1):
++  if (mpx->d==0) {
++    mpx->h+=mpx->x;
++  } else {
++    mpx->v+=mpx->x;
++  }
++  break;
++case four_cases(down1):
++  if (mpx->d==0) {
++    mpx->v+=trunc(p*mpx->dvi_scale);
++  } else {
++    mpx->h-=trunc(p*mpx->dvi_scale);
++  }
++  break;
++case y0: case four_cases(y1):
++  if (mpx->d==0) {
++    mpx->v+=mpx->y;
++  } else {
++    mpx->h-=mpx->y;
++  }
++  break;
++case z0: case four_cases(z1):
++  if (mpx->d==0) {
++    mpx->v+=mpx->z;
++  } else {
++    mpx->h-=mpx->z;
++  }
++  break;
++@z
++
++@x
++@<Check if mp file is newer than mpxfile, exit if not@>=
++if (mpx_newer(mpxopt->mpname, mpxopt->mpxname))
++   return 0
++@y
++@<Check if mp file is newer than mpxfile, exit if not@>=
++if (mpx_newer(mpxopt->mpname, mpxopt->mpxname))
++   return 0
++
++@ ASCII p\TeX JFM ID
++@d yoko_jfm_id   11 /* for `yoko-kumi' fonts */
++@d tate_jfm_id   9  /* for `tate-kumi' fonts */
++@d font_jfm_p(A)   (mpx->font_id[(A)]!=0)
++
++@ @<Global...@>=
++integer font_nt[max_fonts+1]; /* number of words in ctype table */
++integer font_id[max_fonts+1];
++integer jfm_char_code[max_widths+1];
++integer jfm_char_type[max_widths+1];
++integer jfm_char_index[max_fonts+1];
++integer next_jfm_char_index;
++
++@ @<Set init...@>=
++mpx->font_nt[0]=0;
++mpx->font_id[0]=0;
++mpx->jfm_char_type[0]=0;
++mpx->next_jfm_char_index=0;
++
++@ JFM character type table is stored in the array |jfm_char_code| and
++|jfm_char_type|. The character code and the character type of $i$-th
++record is stored in |jfm_char_code[i]| and |jfm_char_type[i]|, respectively.
++The table is in the order of character code.
++
++@<Read the pTeX header data@>=
++mpx->font_id[f]=mpx->b0*(int)(256)+mpx->b1;
++if ((mpx->font_id[f]==yoko_jfm_id) || (mpx->font_id[f]==tate_jfm_id)) {
++  mpx->font_nt[f]=mpx->b2*(int)(256)+mpx->b3;
++  mpx_read_tfm_word(mpx);
++} else {
++  mpx->font_id[f]=0;
++  mpx->font_nt[f]=0;
++}
++
++@ @<Read JFM character type table@>=
++mpx->jfm_char_index[f]=mpx->next_jfm_char_index;
++k=mpx->jfm_char_index[f];
++mpx->next_jfm_char_index+=mpx->font_nt[f];
++while (k<mpx->next_jfm_char_index) {
++  mpx_read_tfm_word(mpx);
++  mpx->jfm_char_code[k]=mpx->b0*(int)(256)+mpx->b1;
++  mpx->jfm_char_type[k]=mpx->b2*(int)(256)+mpx->b3;
++  k++;
++}
++
++@ JFM character type table is looked up by binary search.
++
++@<Declare JFM character type table lookup routine@>=
++integer mpx_lookup_ctype (MPX mpx,integer f, integer c)
++{
++  integer l, u, r, ch;
++  l=0; u=mpx->font_nt[f]-1;
++  while (l<u) {
++    r=(l+u)/2;
++    ch=mpx->jfm_char_code[mpx->jfm_char_index[f]+r];
++    if (ch==c) {
++      return mpx->jfm_char_type[mpx->jfm_char_index[f]+r];
++    }
++    if (ch<c)
++      l=r+1;
++    else
++      u=r-1;
++  }
++  return 0;
++}
++
++@ Every Kanji characters are supposed to be printable here,
++so that the state always results in normal at the end of the procedure.
++Kanji characters need to be converted into output Kanji encoding
++from DVI(JIS).
++
++@d Hi(x) (((x)>> 8) & 0xff)
++@d Lo(x) ( (x)      & 0xff)
++
++@<Declare subroutines for printing strings@>=
++void mpx_print_kanji_char (MPX mpx,integer c)
++{
++  if (mpx->print_col+2>line_length-2 ) {
++    if (mpx->state==normal) {
++      fprintf(mpx->mpxfile, "\"");
++      mpx->state=special;
++    }
++    fprintf(mpx->mpxfile, " \n");
++    mpx->print_col=0;
++  }
++  if (mpx->state==special) {
++    fprintf(mpx->mpxfile,"&");
++    mpx->print_col++;
++  }
++  if (mpx->state!=normal) {
++    fprintf(mpx->mpxfile, "\"");
++    mpx->print_col++;
++    mpx->state=normal;
++  }
++  c=toBUFF(fromDVI(c));
++  putc2(Hi(c), mpx->mpxfile);
++  mpx->print_col++;
++  putc2(Lo(c), mpx->mpxfile);
++  mpx->print_col++;
++}
++@z
+--- /dev/null
++++ texlive-bin/texk/web2c/pmplibdir/psout.ch
+@@ -0,0 +1,42 @@
++@x
++integer ps_offset;
++@y
++integer ps_offset;
++integer is_mapfile_read;
++@z
++
++@x
++mp->ps->ps_offset = 0;
++@y
++mp->ps->ps_offset = 0;
++mp->ps->is_mapfile_read = 0;
++@z
++
++@x
++        mp->ps->fm_file = (mp->open_file)(mp, n, "r", mp_filetype_fontmap);
++        if (!mp->ps->fm_file) {
++@y
++        mp->ps->fm_file = (mp->open_file)(mp, n, "r", mp_filetype_fontmap);
++        if (!mp->ps->fm_file) {
++            mp->ps->mitem->map_line = mp_xstrdup (mp,psf_tab_name);
++            n = mp->ps->mitem->map_line;
++            mp->ps->fm_file = (mp->open_file)(mp, n, "r", mp_filetype_fontmap);
++        }
++        if (!mp->ps->fm_file) {
++@z
++
++@x
++@d ps_tab_name "psfonts.map"  /* locates font name translation table */
++@y
++@d ps_tab_name "mpost.map"  /* locates font name translation table */
++@d psf_tab_name "psfonts.map"  /* locates font name translation table */
++@z
++
++@x
++  fm_read_info (mp);
++@y
++  if (mp->ps->is_mapfile_read == 0) {
++    mp->ps->is_mapfile_read++;
++    fm_read_info (mp);
++  }
++@z
+--- /dev/null
++++ texlive-bin/texk/web2c/pmplibdir/svgout.ch
+@@ -0,0 +1,60 @@
++@x 
++@<Character |k| is not allowed in SVG output@>=
++ (k=='&')||(k=='>')||(k=='<')
++@y
++@<Character |k| is not allowed in SVG output@>=
++ (k=='&')||(k=='>')||(k=='<')||(k>=0x7F)
++@z
++
++@x
++@ Now for outputting the actual graphic objects. 
++@y
++@ Now for outputting the actual graphic objects. 
++
++@d yoko_jfm_id   11 /* `yoko-kumi' fonts */
++@d tate_jfm_id   9  /* `tate-kumi' fonts */
++@d font_jfm_p(A) (mp->font_id[(A)]!=0)
++@z
++
++@x Even if prologues=3, Japanese texts are not converted into paths.
++  if (prologues == 3 ) {
++@y
++  if (prologues == 3 && mp->font_id[gr_font_n(p)]==0) {
++@z
++
++@x To realise vertical Japanese texts ...
++    mp_svg_attribute(mp, "font-size", mp->svg->buf);
++@y
++    mp_svg_attribute(mp, "font-size", mp->svg->buf);
++    if ( mp->font_id[gr_font_n(p)]==tate_jfm_id ) {
++      mp_svg_reset_buf(mp);
++      append_string("tb-rl");
++      mp_svg_attribute(mp, "writing-mode", mp->svg->buf);
++    }
++@z
++
++@x
++    while (l-->0) {
++      k=(int)*s++;
++      if (@<Character |k| is illegal in SVG output@>) {
++@y
++    if ( mp->font_id[gr_font_n(p)]!=0 ) {
++    l >>= 1;
++    while (l-->0) {
++         k =((int)*s++)*0x100; k += (int)*s++;
++ 	 fprintf(stderr, "\n>>> %d\n", k); 
++         append_string("&#");
++         mp_svg_store_int(mp,toUCS(k));
++         append_char(';');
++       }
++    } else
++    while (l-->0) {
++      k=(int)*s++;
++      if (@<Character |k| is illegal in SVG output@>) {
++@z
++
++@x
++    mp_svg_print(mp, "<?xml version=\"1.0\"?>");
++@y
++    mp_svg_print(mp, "<?xml version=\"1.0\" encoding=\"utf-8\"?>");
 +@z
diff --git a/debian/patches/series b/debian/patches/series
index 4fcb240..d84e741 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,6 +3,8 @@ debian-builtin-searchpath
 debian-no-linked-scripts
 60_unneeded_linking
 61_path_max.diff
-pmpost-20121106-tl12
-pmpost-svg-20120119-tl11.diff
+pmpost1801-2010509
+pmpost-texlive-integration
+#pmpost-20121106-tl12
+#??? still necessary??? pmpost-svg-20120119-tl11.diff
 #xdvi-upupstream-fixes

-- 
Debian packaging of texlive-bin)


Reply to: