From ac8aa6125a7b9bf9ca60d3acd7d23c78f74c9d0d Mon Sep 17 00:00:00 2001 From: Hironobu Yamashita Date: Thu, 11 Oct 2018 14:22:06 +0000 Subject: dviout-util: import aminophen/dviout-util@28bf5ad git-svn-id: svn://tug.org/texlive/trunk@48882 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/README | 1 + Build/source/texk/dviout-util/ChangeLog | 8 ++++ Build/source/texk/dviout-util/Makefile.am | 13 ++++--- Build/source/texk/dviout-util/Makefile.in | 13 ++++--- Build/source/texk/dviout-util/dvispc.c | 42 ++++++++++++--------- Build/source/texk/dviout-util/dvispc.test | 22 +++++++---- Build/source/texk/dviout-util/tests/longspec.dvi | Bin 0 -> 1372 bytes Build/source/texk/dviout-util/tests/longspec.tex | 9 +++++ .../source/texk/dviout-util/tests/longspecout.dvi | Bin 0 -> 1668 bytes 9 files changed, 72 insertions(+), 36 deletions(-) create mode 100644 Build/source/texk/dviout-util/tests/longspec.dvi create mode 100644 Build/source/texk/dviout-util/tests/longspec.tex create mode 100644 Build/source/texk/dviout-util/tests/longspecout.dvi diff --git a/Build/source/texk/README b/Build/source/texk/README index d2ea4cf7c81..eaf8b3edc66 100644 --- a/Build/source/texk/README +++ b/Build/source/texk/README @@ -49,6 +49,7 @@ dviljk - maintained here, by Joachim Schrod dviout-util - by Japanese TeX Development Community (Hironobu, Takuji et al.) https://github.com/texjporg/tex-jp-build + but also: https://github.com/aminophen/dviout-util dvipdfm-x - maintained here, by us, contains dvipdfmx diff --git a/Build/source/texk/dviout-util/ChangeLog b/Build/source/texk/dviout-util/ChangeLog index e53d6bd67ed..e6a5a5136f8 100644 --- a/Build/source/texk/dviout-util/ChangeLog +++ b/Build/source/texk/dviout-util/ChangeLog @@ -1,3 +1,11 @@ +2018-10-11 Hironobu Yamashita + + * dvispc.c: Support page-independence even with long + specials. Use MAX_... constants for error messages. + * dvispc.test: Test long specials. + * tests/longspec.{tex,dvi}, tests/longspecout.dvi: New tests. + * Makefile.am: Adjusted. + 2018-10-10 Hironobu Yamashita * dvispc.c: Clean up code, more comments. Mostly revert diff --git a/Build/source/texk/dviout-util/Makefile.am b/Build/source/texk/dviout-util/Makefile.am index d1f3daa9a0e..760bb4e7276 100644 --- a/Build/source/texk/dviout-util/Makefile.am +++ b/Build/source/texk/dviout-util/Makefile.am @@ -30,12 +30,13 @@ chkdvifont.log: chkdvifont$(EXEEXT) EXTRA_DIST = $(TESTS) ## dvispc.test -EXTRA_DIST += \ - tests/test.tex tests/test.dvi \ - tests/oldindep.tex tests/oldindep.dvi \ - tests/test.spc tests/testout.dvi tests/oldindepout.dvi -DISTCLEANFILES = x*test.spc x*testa.txt x*testax.dvi \ - x*oldindepout.dvi x*testout.dvi +EXTRA_DIST += tests/test.spc \ + tests/test.tex tests/test.dvi tests/testout.dvi \ + tests/oldindep.tex tests/oldindep.dvi tests/oldindepout.dvi \ + tests/longspec.tex tests/longspec.dvi tests/longspecout.dvi +DISTCLEANFILES = x*test.spc \ + x*testa.txt x*testax.dvi \ + x*testout.dvi x*oldindepout.dvi x*longspecout.dvi ## chkdvifont.test EXTRA_DIST += tests/test.cfn \ diff --git a/Build/source/texk/dviout-util/Makefile.in b/Build/source/texk/dviout-util/Makefile.in index 0b5946824a0..a7068163c3c 100644 --- a/Build/source/texk/dviout-util/Makefile.in +++ b/Build/source/texk/dviout-util/Makefile.in @@ -559,14 +559,15 @@ LDADD = $(KPATHSEA_LIBS) dvispc_LDADD = $(PTEXENC_LIBS) $(LDADD) dist_man1_MANS = dvispc.man chkdvifont.man TESTS = dvispc.test chkdvifont.test -EXTRA_DIST = $(TESTS) tests/test.tex tests/test.dvi tests/oldindep.tex \ - tests/oldindep.dvi tests/test.spc tests/testout.dvi \ - tests/oldindepout.dvi tests/test.cfn tests/jis.tfm \ +EXTRA_DIST = $(TESTS) tests/test.spc tests/test.tex tests/test.dvi \ + tests/testout.dvi tests/oldindep.tex tests/oldindep.dvi \ + tests/oldindepout.dvi tests/longspec.tex tests/longspec.dvi \ + tests/longspecout.dvi tests/test.cfn tests/jis.tfm \ tests/jis.cfn tests/eufm10.tfm tests/eufm10.cfn tests/cmr10.pk \ tests/cmr10.cfn tests/upjisr-h.vf tests/upsjir-h.cfn -DISTCLEANFILES = x*test.spc x*testa.txt x*testax.dvi x*oldindepout.dvi \ - x*testout.dvi test.dvi xtest.cfn xjis.cfn xeufm10.cfn \ - xeufm10.ed.cfn xcmr10.cfn xupjisr-h.cfn +DISTCLEANFILES = x*test.spc x*testa.txt x*testax.dvi x*testout.dvi \ + x*oldindepout.dvi x*longspecout.dvi test.dvi xtest.cfn \ + xjis.cfn xeufm10.cfn xeufm10.ed.cfn xcmr10.cfn xupjisr-h.cfn all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am diff --git a/Build/source/texk/dviout-util/dvispc.c b/Build/source/texk/dviout-util/dvispc.c index a747df6feee..89da842e531 100644 --- a/Build/source/texk/dviout-util/dvispc.c +++ b/Build/source/texk/dviout-util/dvispc.c @@ -221,15 +221,14 @@ struct DIMENSION_REC { int f_dtl = 0; enum { - EXE2NONE, EXE2MODIFY, EXE2CHECK, EXE2SPECIAL, EXE2TEXT, EXE2DVI + EXE2MODIFY, EXE2CHECK, EXE2SPECIAL, EXE2TEXT, EXE2DVI }; -int f_mode = EXE2NONE; /* 1: -c modify - 2: -d report only - 3: -s specials - 4: -a to_Text - 5: -x to_DVI */ -/* default mode will be set in main() to be page_indep */ +int f_mode = EXE2MODIFY; /* 0: -c modify + 1: -d report only + 2: -s specials + 3: -a to_Text + 4: -x to_DVI */ int f_debug = 0; /* -v */ int f_overwrite = 0; @@ -610,8 +609,6 @@ skip: ; cf. argc = (number of all arguments) + 1 {argv[0] is the program name itself} ^^^ */ - if(!f_mode) f_mode = EXE2MODIFY; /* default mode */ - fnum = 0; if(!isatty(fileno(stdin))){ /* if stdin is redirected from a file */ fp_in = stdin; @@ -796,11 +793,16 @@ void write_sp(FILE *fp, char *sp) int len; len = strlen(sp); - if(len > 255){ + if(len <= 0xff) + fprintf(fp, "%c%c%s", XXX1, len, sp); + else if(len <= 0xffffffff){ + fprintf(fp, "%c", XXX1+3); + write_long(len, fp); + fprintf(fp, "%s", sp); + }else{ fprintf(stderr, "Too long special:\n%s\n", sp); Exit(1); } - fprintf(fp, "%c%c%s", XXX1, len, sp); } @@ -1368,8 +1370,10 @@ void sp_color(char *sp) return; } if(strstr(sp, "push")){ - if(color_depth >= MAX_COLOR) - error("Too many color push > 512"); + if(color_depth >= MAX_COLOR){ + fprintf(stderr, "Too many color push > %d\n", MAX_COLOR); + Exit(1); + } if(color_depth){ s = color_pt[color_depth-1]; s += strlen(s) + 1; @@ -1393,8 +1397,10 @@ void sp_pdf_bcolor(char *sp) char *s; /* copied from "color push" routine of sp_color */ - if(pdf_color_depth >= MAX_COLOR) - error("Too many pdf:bcolor > 512"); + if(pdf_color_depth >= MAX_COLOR){ + fprintf(stderr, "Too many pdf:bcolor > %d\n", MAX_COLOR); + Exit(1); + } if(pdf_color_depth){ s = pdf_color_pt[pdf_color_depth-1]; s += strlen(s) + 1; @@ -1430,8 +1436,10 @@ void sp_pdf_ecolor(char *sp) void sp_pdf_bann(char *sp) { char *s; - if(pdf_annot_depth >= MAX_ANNOT) - error("Too many pdf:bann > 8"); + if(pdf_annot_depth >= MAX_ANNOT){ + fprintf(stderr, "Too many pdf:bann > %d\n", MAX_ANNOT); + Exit(1); + } if(pdf_annot_depth){ s = pdf_annot_pt[pdf_annot_depth-1]; s += strlen(s) + 1; diff --git a/Build/source/texk/dviout-util/dvispc.test b/Build/source/texk/dviout-util/dvispc.test index 5af3aace3db..a22519496ec 100755 --- a/Build/source/texk/dviout-util/dvispc.test +++ b/Build/source/texk/dviout-util/dvispc.test @@ -43,34 +43,35 @@ diff --strip-trailing-cr $testdir/test.spc $testdir/test.spc \ # not working as expected only for test ?? #./dvispc -a $testdir/test.dvi | ./dvispc -x x2testax.dvi && \ -# cmp $testdir/test.dvi x2testax.dvi && echo || exit 5 +# cmp $testdir/test.dvi x2testax.dvi && echo || exit 6 ./dvispc -a $testdir/test.dvi | ./dvispc -x > x2testax.dvi && \ - cmp $testdir/test.dvi x2testax.dvi && echo || exit 5 + cmp $testdir/test.dvi x2testax.dvi && echo || exit 7 ## EXE2INDEP ./dvispc -c $testdir/oldindep.dvi xoldindepout.dvi && \ - cmp $testdir/oldindepout.dvi xoldindepout.dvi && echo || exit 6 + cmp $testdir/oldindepout.dvi xoldindepout.dvi && echo || exit 8 ./dvispc -c $testdir/oldindep.dvi > x1oldindepout.dvi && \ - cmp $testdir/oldindepout.dvi x1oldindepout.dvi && echo || exit 7 + cmp $testdir/oldindepout.dvi x1oldindepout.dvi && echo || exit 9 ./dvispc && echo || exit 0 # the following tests include # * correction of dvipdfmx-style specials +# * correction of long (>255) specials # * correction in reversed order which requires prior scanning # so will not pass for old version written by SHIMA. # that version can be distinguished from the new version by # exit code 1 for usage without argument. (the above line did it!) ./dvispc -c $testdir/test.dvi xtestout.dvi && \ - cmp $testdir/testout.dvi xtestout.dvi && echo || exit 8 + cmp $testdir/testout.dvi xtestout.dvi && echo || exit 10 ./dvispc -c $testdir/test.dvi > x1testout.dvi && \ - cmp $testdir/testout.dvi x1testout.dvi && echo || exit 9 + cmp $testdir/testout.dvi x1testout.dvi && echo || exit 11 ## invalid usage #./dvispc -c < $testdir/test.dvi x2testout.dvi && \ @@ -78,7 +79,14 @@ diff --strip-trailing-cr $testdir/test.spc $testdir/test.spc \ ## stdin is a DVI, random access may not be supported, no test #./dvispc -c < $testdir/test.dvi > x3testout.dvi && \ -# cmp $testdir/testout.dvi x3testout.dvi && echo || exit 10 +# cmp $testdir/testout.dvi x3testout.dvi && echo || exit 12 + +./dvispc -c $testdir/longspec.dvi xlongspecout.dvi && \ + cmp $testdir/longspecout.dvi xlongspecout.dvi && echo || exit 13 + +## check default is -c +./dvispc $testdir/longspec.dvi x1longspecout.dvi && \ + cmp $testdir/longspecout.dvi x1longspecout.dvi && echo || exit 14 exit 0 diff --git a/Build/source/texk/dviout-util/tests/longspec.dvi b/Build/source/texk/dviout-util/tests/longspec.dvi new file mode 100644 index 00000000000..0515d1ffee6 Binary files /dev/null and b/Build/source/texk/dviout-util/tests/longspec.dvi differ diff --git a/Build/source/texk/dviout-util/tests/longspec.tex b/Build/source/texk/dviout-util/tests/longspec.tex new file mode 100644 index 00000000000..d7b72b59d18 --- /dev/null +++ b/Build/source/texk/dviout-util/tests/longspec.tex @@ -0,0 +1,9 @@ +\documentclass[dvipdfmx]{article} +\usepackage{hyperref} +\begin{document} +\noindent +% length of special: 282 (0x0000011A) +\href{https://www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/datavisualization/tikzlibrarydatavisualization.formats.functions.code.tex?revision=20236&view=markup}{% +A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\% +A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A\\A} +\end{document} diff --git a/Build/source/texk/dviout-util/tests/longspecout.dvi b/Build/source/texk/dviout-util/tests/longspecout.dvi new file mode 100644 index 00000000000..55833fd03be Binary files /dev/null and b/Build/source/texk/dviout-util/tests/longspecout.dvi differ -- cgit v1.2.3