From 4e17498848c230539b58d870938a77805039046d Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Wed, 26 Jun 2013 10:10:01 +0000 Subject: dvipdfm-x: Bug fix, Reduce dvipdfmx/xdvipdfmx diffs git-svn-id: svn://tug.org/texlive/trunk@30951 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipdfm-x/ChangeLog | 13 ++++++ Build/source/texk/dvipdfm-x/src/dvipdfmx.test | 2 +- Build/source/texk/dvipdfm-x/src/spc_dvips.c | 53 +++++++++++++++++++++++++ Build/source/texk/dvipdfm-x/src/spc_dvips.h | 5 +++ Build/source/texk/dvipdfm-x/src/specials.c | 20 ++++++++++ Build/source/texk/dvipdfm-x/xsrc/spc_color.c | 18 --------- Build/source/texk/dvipdfm-x/xsrc/spc_color.h | 5 --- Build/source/texk/dvipdfm-x/xsrc/spc_dvips.c | 52 +++++++++++++----------- Build/source/texk/dvipdfm-x/xsrc/spc_dvips.h | 6 ++- Build/source/texk/dvipdfm-x/xsrc/spc_misc.c | 23 ----------- Build/source/texk/dvipdfm-x/xsrc/spc_misc.h | 5 --- Build/source/texk/dvipdfm-x/xsrc/spc_pdfm.c | 12 ------ Build/source/texk/dvipdfm-x/xsrc/spc_pdfm.h | 2 - Build/source/texk/dvipdfm-x/xsrc/spc_xtx.c | 25 ------------ Build/source/texk/dvipdfm-x/xsrc/spc_xtx.h | 5 --- Build/source/texk/dvipdfm-x/xsrc/specials.c | 38 +++++++++++------- Build/source/texk/dvipdfm-x/xsrc/xdvipdfmx.test | 2 +- 17 files changed, 149 insertions(+), 137 deletions(-) diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index 92c25d20178..256e1d838dd 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,16 @@ +2013-06-26 Peter Breitenlohner + + * src/dvipdfmx.test: Invoke ./dvipdfmx instead of dvipdfmx. + * xsrc/xdvipdfmx.test: Invoke ./xdvipdfmx instead of xdvipdfmx. + + Reduce dvipdfmx/xdvipdfmx diffs. + + * xsrc/spc_color.[ch], xsrc/spc_misc.[ch], xsrc/spc_pdfm.[ch], + xsrc/spc_xtx.[ch], xspc/specials.c: Drop no-op functions + spc_*_at_{begin,end}_{document,page}(). + * (x)spc/spc_dvips.[ch], (x)spc/specials.c: Use '#ifdef XETEX' + to avoid most diffs. + 2013-06-15 Peter Breitenlohner Merge dvipdfmx and xdvipdfmx into dvipdfm-x. diff --git a/Build/source/texk/dvipdfm-x/src/dvipdfmx.test b/Build/source/texk/dvipdfm-x/src/dvipdfmx.test index 56f7857e236..2a18fdf9be7 100755 --- a/Build/source/texk/dvipdfm-x/src/dvipdfmx.test +++ b/Build/source/texk/dvipdfm-x/src/dvipdfmx.test @@ -7,5 +7,5 @@ TEXMFCNF=${srcdir}/../../kpathsea \ DVIPDFMXINPUTS=${srcdir}/../data \ - dvipdfmx --help || exit 1 + ./dvipdfmx --help || exit 1 diff --git a/Build/source/texk/dvipdfm-x/src/spc_dvips.c b/Build/source/texk/dvipdfm-x/src/spc_dvips.c index bf5f4e5051c..07ea009172e 100644 --- a/Build/source/texk/dvipdfm-x/src/spc_dvips.c +++ b/Build/source/texk/dvipdfm-x/src/spc_dvips.c @@ -292,10 +292,63 @@ static struct spc_handler dvips_handlers[] = { {"\" ", spc_handler_ps_default} }; +#ifdef XETEX +int +spc_dvips_at_begin_document (void) +{ + FILE* fp; + + /* This, together with \pscharpath support code, must be moved to xtex.pro header. */ + global_defs = dpx_create_temp_file(); + if (!global_defs) { + WARN("Failed to create temporary input file for PSTricks image conversion."); + return -1; + } + + fp = fopen(global_defs, "wb"); + fprintf(fp, "tx@Dict begin /STV {} def end\n"); + fclose(fp); + return 0; +} + +int +spc_dvips_at_end_document (void) +{ + if (ps_headers) { + while (num_ps_headers > 0) + RELEASE(ps_headers[--num_ps_headers]); + free(ps_headers); + ps_headers = NULL; + } + dpx_delete_temp_file(global_defs, true); + dpx_delete_temp_file(page_defs, true); + return 0; +} + +int +spc_dvips_at_begin_page (void) +{ + if (page_defs) { + dpx_delete_temp_file(page_defs, true); + page_defs = 0; + } + + put_stack_depth = -1; + + return 0; +} +#endif + int spc_dvips_at_end_page (void) { mps_eop_cleanup(); +#ifdef XETEX + if (!temporary_defs) { + dpx_delete_temp_file(temporary_defs, true); + temporary_defs = 0; + } +#endif return 0; } diff --git a/Build/source/texk/dvipdfm-x/src/spc_dvips.h b/Build/source/texk/dvipdfm-x/src/spc_dvips.h index 85353786839..74b50ffa733 100644 --- a/Build/source/texk/dvipdfm-x/src/spc_dvips.h +++ b/Build/source/texk/dvipdfm-x/src/spc_dvips.h @@ -27,6 +27,11 @@ #include "specials.h" +#ifdef XETEX +extern int spc_dvips_at_begin_document (void); +extern int spc_dvips_at_end_document (void); +extern int spc_dvips_at_begin_page (void); +#endif extern int spc_dvips_at_end_page (void); extern int spc_dvips_check_special (const char *buffer, long size); diff --git a/Build/source/texk/dvipdfm-x/src/specials.c b/Build/source/texk/dvipdfm-x/src/specials.c index d55860b25ed..dc5bf600028 100644 --- a/Build/source/texk/dvipdfm-x/src/specials.c +++ b/Build/source/texk/dvipdfm-x/src/specials.c @@ -49,6 +49,9 @@ #include "spc_misc.h" #include "spc_color.h" #include "spc_dvips.h" +#ifdef XETEX +#include "spc_xtx.h" +#endif #include "specials.h" @@ -376,10 +379,27 @@ static struct { spc_pdfm_setup_handler }, +#ifdef XETEX + {"x:", + NULL, + NULL, + NULL, + NULL, + spc_xtx_check_special, + spc_xtx_setup_handler + }, +#endif + {"ps:", +#ifdef XETEX + spc_dvips_at_begin_document, + spc_dvips_at_end_document, + spc_dvips_at_begin_page, +#else NULL, NULL, NULL, +#endif spc_dvips_at_end_page, spc_dvips_check_special, spc_dvips_setup_handler diff --git a/Build/source/texk/dvipdfm-x/xsrc/spc_color.c b/Build/source/texk/dvipdfm-x/xsrc/spc_color.c index c12e3d7f214..53b3550627a 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/spc_color.c +++ b/Build/source/texk/dvipdfm-x/xsrc/spc_color.c @@ -47,24 +47,6 @@ * implicitely. */ -int -spc_color_at_begin_page (void) -{ - return 0; -} - -int -spc_color_at_end_page (void) -{ - return 0; -} - -int -spc_color_at_begin_document (void) -{ - return 0; -} - int spc_color_at_end_document (void) { diff --git a/Build/source/texk/dvipdfm-x/xsrc/spc_color.h b/Build/source/texk/dvipdfm-x/xsrc/spc_color.h index fcb04258cf4..4af9ac8d21e 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/spc_color.h +++ b/Build/source/texk/dvipdfm-x/xsrc/spc_color.h @@ -25,11 +25,6 @@ #ifndef _SPC_COLOR_H_ #define _SPC_COLOR_H_ -extern int spc_color_at_begin_page (void); -extern int spc_color_at_end_page (void); -extern int spc_color_at_begin_document (void); -extern int spc_color_at_end_document (void); - extern int spc_color_check_special (const char *buffer, long size); extern int spc_color_setup_handler (struct spc_handler *handle, struct spc_env *spe, struct spc_arg *args); diff --git a/Build/source/texk/dvipdfm-x/xsrc/spc_dvips.c b/Build/source/texk/dvipdfm-x/xsrc/spc_dvips.c index 7deb3b2bdcf..d9e713511a5 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/spc_dvips.c +++ b/Build/source/texk/dvipdfm-x/xsrc/spc_dvips.c @@ -869,30 +869,7 @@ static struct spc_handler dvips_handlers[] = { {"\" ", spc_handler_ps_default} }; -int -spc_dvips_at_begin_page (void) -{ - if (page_defs) { - dpx_delete_temp_file(page_defs, true); - page_defs = 0; - } - - put_stack_depth = -1; - - return 0; -} - -int -spc_dvips_at_end_page (void) -{ - mps_eop_cleanup(); - if (!temporary_defs) { - dpx_delete_temp_file(temporary_defs, true); - temporary_defs = 0; - } - return 0; -} - +#ifdef XETEX int spc_dvips_at_begin_document (void) { @@ -925,6 +902,33 @@ spc_dvips_at_end_document (void) return 0; } +int +spc_dvips_at_begin_page (void) +{ + if (page_defs) { + dpx_delete_temp_file(page_defs, true); + page_defs = 0; + } + + put_stack_depth = -1; + + return 0; +} +#endif + +int +spc_dvips_at_end_page (void) +{ + mps_eop_cleanup(); +#ifdef XETEX + if (!temporary_defs) { + dpx_delete_temp_file(temporary_defs, true); + temporary_defs = 0; + } +#endif + return 0; +} + int spc_dvips_check_special (const char *buf, long len) { diff --git a/Build/source/texk/dvipdfm-x/xsrc/spc_dvips.h b/Build/source/texk/dvipdfm-x/xsrc/spc_dvips.h index 1f11ab25393..74b50ffa733 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/spc_dvips.h +++ b/Build/source/texk/dvipdfm-x/xsrc/spc_dvips.h @@ -27,10 +27,12 @@ #include "specials.h" -extern int spc_dvips_at_begin_page (void); -extern int spc_dvips_at_end_page (void); +#ifdef XETEX extern int spc_dvips_at_begin_document (void); extern int spc_dvips_at_end_document (void); +extern int spc_dvips_at_begin_page (void); +#endif +extern int spc_dvips_at_end_page (void); extern int spc_dvips_check_special (const char *buffer, long size); extern int spc_dvips_setup_handler (struct spc_handler *handle, diff --git a/Build/source/texk/dvipdfm-x/xsrc/spc_misc.c b/Build/source/texk/dvipdfm-x/xsrc/spc_misc.c index 2568b7b5151..ae8ee12e421 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/spc_misc.c +++ b/Build/source/texk/dvipdfm-x/xsrc/spc_misc.c @@ -49,29 +49,6 @@ #include "spc_util.h" #include "spc_misc.h" -int -spc_misc_at_begin_page (void) -{ - return 0; -} - -int spc_misc_at_end_page (void) -{ - return 0; -} - -int -spc_misc_at_begin_document (void) -{ - return 0; -} - -int -spc_misc_at_end_document (void) -{ - return 0; -} - static int spc_handler_postscriptbox (struct spc_env *spe, struct spc_arg *ap) { diff --git a/Build/source/texk/dvipdfm-x/xsrc/spc_misc.h b/Build/source/texk/dvipdfm-x/xsrc/spc_misc.h index ec7fb46591c..7774f30018b 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/spc_misc.h +++ b/Build/source/texk/dvipdfm-x/xsrc/spc_misc.h @@ -27,11 +27,6 @@ #include "specials.h" -extern int spc_misc_at_begin_page (void); -extern int spc_misc_at_end_page (void); -extern int spc_misc_at_begin_document (void); -extern int spc_misc_at_end_document (void); - extern int spc_misc_check_special (const char *buffer, long size); extern int spc_misc_setup_handler (struct spc_handler *handle, struct spc_env *spe, struct spc_arg *args); diff --git a/Build/source/texk/dvipdfm-x/xsrc/spc_pdfm.c b/Build/source/texk/dvipdfm-x/xsrc/spc_pdfm.c index 8e90a0dca65..7aa8863ae9b 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/spc_pdfm.c +++ b/Build/source/texk/dvipdfm-x/xsrc/spc_pdfm.c @@ -203,18 +203,6 @@ spc_pdfm_at_end_document (void) return spc_handler_pdfm__clean(NULL, NULL, sd); } -int -spc_pdfm_at_begin_page (void) -{ - return 0; -} - -int -spc_pdfm_at_end_page (void) -{ - return 0; -} - /* Dvipdfm specials */ static int diff --git a/Build/source/texk/dvipdfm-x/xsrc/spc_pdfm.h b/Build/source/texk/dvipdfm-x/xsrc/spc_pdfm.h index 7cfb8f1104b..5cbfa8c596b 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/spc_pdfm.h +++ b/Build/source/texk/dvipdfm-x/xsrc/spc_pdfm.h @@ -27,8 +27,6 @@ #include "specials.h" -extern int spc_pdfm_at_begin_page (void); -extern int spc_pdfm_at_end_page (void); extern int spc_pdfm_at_begin_document (void); extern int spc_pdfm_at_end_document (void); diff --git a/Build/source/texk/dvipdfm-x/xsrc/spc_xtx.c b/Build/source/texk/dvipdfm-x/xsrc/spc_xtx.c index c6307da3870..a039c36371c 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/spc_xtx.c +++ b/Build/source/texk/dvipdfm-x/xsrc/spc_xtx.c @@ -59,31 +59,6 @@ #include "spc_xtx.h" -int -spc_xtx_at_begin_document (void) -{ - return 0; -} - -int -spc_xtx_at_end_document (void) -{ - return 0; -} - -int -spc_xtx_at_begin_page (void) -{ - /*pdf_dev_set_fixed_point(0, 0);*/ - return 0; -} - -int -spc_xtx_at_end_page (void) -{ - return 0; -} - int spc_handler_xtx_do_transform (double x_user, double y_user, double a, double b, double c, double d, double e, double f) { diff --git a/Build/source/texk/dvipdfm-x/xsrc/spc_xtx.h b/Build/source/texk/dvipdfm-x/xsrc/spc_xtx.h index 626907312ab..b4f75f4abb3 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/spc_xtx.h +++ b/Build/source/texk/dvipdfm-x/xsrc/spc_xtx.h @@ -30,11 +30,6 @@ #include "specials.h" -extern int spc_xtx_at_begin_page (void); -extern int spc_xtx_at_end_page (void); -extern int spc_xtx_at_begin_document (void); -extern int spc_xtx_at_end_document (void); - extern int spc_xtx_check_special (const char *buffer, long size); extern int spc_xtx_setup_handler (struct spc_handler *handle, struct spc_env *spe, struct spc_arg *args); diff --git a/Build/source/texk/dvipdfm-x/xsrc/specials.c b/Build/source/texk/dvipdfm-x/xsrc/specials.c index 05739ff2339..0b9800eb81b 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/specials.c +++ b/Build/source/texk/dvipdfm-x/xsrc/specials.c @@ -49,7 +49,9 @@ #include "spc_misc.h" #include "spc_color.h" #include "spc_dvips.h" +#ifdef XETEX #include "spc_xtx.h" +#endif #include "specials.h" @@ -390,35 +392,43 @@ static struct { {"pdf:", spc_pdfm_at_begin_document, spc_pdfm_at_end_document, - spc_pdfm_at_begin_page, - spc_pdfm_at_end_page, + NULL, + NULL, spc_pdfm_check_special, spc_pdfm_setup_handler }, +#ifdef XETEX {"x:", - spc_xtx_at_begin_document, - spc_xtx_at_end_document, - spc_xtx_at_begin_page, - spc_xtx_at_end_page, + NULL, + NULL, + NULL, + NULL, spc_xtx_check_special, spc_xtx_setup_handler }, +#endif {"ps:", +#ifdef XETEX spc_dvips_at_begin_document, spc_dvips_at_end_document, spc_dvips_at_begin_page, +#else + NULL, + NULL, + NULL, +#endif spc_dvips_at_end_page, spc_dvips_check_special, spc_dvips_setup_handler }, {"color", - spc_color_at_begin_document, - spc_color_at_end_document, - spc_color_at_begin_page, - spc_color_at_end_page, + NULL, + NULL, + NULL, + NULL, spc_color_check_special, spc_color_setup_handler }, @@ -442,10 +452,10 @@ static struct { }, {"unknown", - spc_misc_at_begin_document, - spc_misc_at_end_document, - spc_misc_at_begin_page, - spc_misc_at_end_page, + NULL, + NULL, + NULL, + NULL, spc_misc_check_special, spc_misc_setup_handler }, diff --git a/Build/source/texk/dvipdfm-x/xsrc/xdvipdfmx.test b/Build/source/texk/dvipdfm-x/xsrc/xdvipdfmx.test index d7ad55efd0f..bbe4876d246 100755 --- a/Build/source/texk/dvipdfm-x/xsrc/xdvipdfmx.test +++ b/Build/source/texk/dvipdfm-x/xsrc/xdvipdfmx.test @@ -7,5 +7,5 @@ TEXMFCNF=${srcdir}/../../kpathsea \ DVIPDFMXINPUTS=${srcdir}/../data \ - xdvipdfmx -h || exit 1 + ./xdvipdfmx -h || exit 1 -- cgit v1.2.3