summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHironobu Yamashita <h.y.acetaminophen@gmail.com>2018-10-13 17:43:13 +0000
committerHironobu Yamashita <h.y.acetaminophen@gmail.com>2018-10-13 17:43:13 +0000
commit192d971f371510873c8f0dc2e8119ca4195599ea (patch)
tree94bced98675c69f14e80491e94fe994c6bd31b32
parente1bed2de3bcddcea384fcf9f9a14b4e26abbac26 (diff)
import aminophen/dviout-util@6fb3d4a
git-svn-id: svn://tug.org/texlive/trunk@48902 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/dviout-util/ChangeLog15
-rw-r--r--Build/source/texk/dviout-util/Makefile.am4
-rw-r--r--Build/source/texk/dviout-util/Makefile.in17
-rwxr-xr-xBuild/source/texk/dviout-util/configure22
-rw-r--r--Build/source/texk/dviout-util/configure.ac2
-rw-r--r--Build/source/texk/dviout-util/dvispc.c52
-rwxr-xr-xBuild/source/texk/dviout-util/dvispc.test11
-rw-r--r--Build/source/texk/dviout-util/tests/first.dvibin0 -> 940 bytes
-rw-r--r--Build/source/texk/dviout-util/tests/first.tex14
-rw-r--r--Build/source/texk/dviout-util/tests/firstout.dvibin0 -> 1000 bytes
-rw-r--r--Build/source/texk/dviout-util/tests/firstpn.dvibin0 -> 764 bytes
-rw-r--r--Build/source/texk/dviout-util/tests/firstpn.tex28
12 files changed, 123 insertions, 42 deletions
diff --git a/Build/source/texk/dviout-util/ChangeLog b/Build/source/texk/dviout-util/ChangeLog
index 04ce0ca6c4e..c3e836f9182 100644
--- a/Build/source/texk/dviout-util/ChangeLog
+++ b/Build/source/texk/dviout-util/ChangeLog
@@ -1,9 +1,13 @@
2018-10-14 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
- * dvispc.c: Fix a bug that modification for tpic_pn was
- not working (my previous fault). Minimize correction
- for tpic_pn, report effective tpic_pn properly.
- * tests/tpicpn.{tex,dvi}, tests/tpicsh.{tex,dvi}: Added.
+ * dvispc.c: Fix a bug that modification of non-stack
+ specials was almost broken (my fault when prior scanning
+ was introduced). Minimize correction for tpic_pn, report
+ effective tpic_pn properly.
+ * tests/tpicpn.{tex,dvi}, tests/tpicsh.{tex,dvi},
+ tests/first.{tex,dvi}, tests/firstpn.{tex,dvi}: New tests.
+ * Makefile.am: Adjusted.
+ * configure.ac: Version 20181014.
2018-10-13 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
@@ -124,7 +128,8 @@
2017-06-03 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
- * dvispc.c: Support page indendence in reverse order.
+ * dvispc.c: Support page indendence in reverse order by
+ prior scanning.
2017-06-03 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
diff --git a/Build/source/texk/dviout-util/Makefile.am b/Build/source/texk/dviout-util/Makefile.am
index 1ae55c4b30c..8f7ea28287e 100644
--- a/Build/source/texk/dviout-util/Makefile.am
+++ b/Build/source/texk/dviout-util/Makefile.am
@@ -35,12 +35,14 @@ EXTRA_DIST += tests/oldindep.spc \
tests/tpicpn.tex tests/tpicpn.dvi tests/tpicpnout.dvi \
tests/tpicsh.tex tests/tpicsh.dvi \
tests/reverse.tex tests/reverse.dvi tests/reverseout.dvi \
+ tests/first.tex tests/first.dvi tests/firstout.dvi \
+ tests/firstpn.tex tests/firstpn.dvi \
tests/annot.tex tests/annot.dvi \
tests/longspec.tex tests/longspec.dvi \
tests/flatnest.tex tests/flatnest.dvi
DISTCLEANFILES = x*oldindep.spc \
x*oldindepa.txt x*oldindepax.dvi x*oldindepout.dvi \
- x*tpicpnout.dvi x*reverseout.dvi \
+ x*tpicpnout.dvi x*reverseout.dvi x*firstout.dvi \
x*write.dvi x*writeout.dvi
## chkdvifont.test
diff --git a/Build/source/texk/dviout-util/Makefile.in b/Build/source/texk/dviout-util/Makefile.in
index a015c5a0db5..ee034add300 100644
--- a/Build/source/texk/dviout-util/Makefile.in
+++ b/Build/source/texk/dviout-util/Makefile.in
@@ -563,15 +563,18 @@ EXTRA_DIST = $(TESTS) tests/oldindep.spc tests/oldindep.tex \
tests/oldindep.dvi tests/oldindepout.dvi tests/tpicpn.tex \
tests/tpicpn.dvi tests/tpicpnout.dvi tests/tpicsh.tex \
tests/tpicsh.dvi tests/reverse.tex tests/reverse.dvi \
- tests/reverseout.dvi tests/annot.tex tests/annot.dvi \
- tests/longspec.tex tests/longspec.dvi tests/flatnest.tex \
- tests/flatnest.dvi tests/oldindep.cfn tests/jis.tfm \
- tests/jis.cfn tests/eufm10.tfm tests/eufm10.cfn tests/cmr10.pk \
+ tests/reverseout.dvi tests/first.tex tests/first.dvi \
+ tests/firstout.dvi tests/firstpn.tex tests/firstpn.dvi \
+ tests/annot.tex tests/annot.dvi tests/longspec.tex \
+ tests/longspec.dvi tests/flatnest.tex tests/flatnest.dvi \
+ tests/oldindep.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*oldindep.spc x*oldindepa.txt x*oldindepax.dvi \
- x*oldindepout.dvi x*tpicpnout.dvi x*reverseout.dvi x*write.dvi \
- x*writeout.dvi oldindep.dvi xoldindep.cfn xjis.cfn xeufm10.cfn \
- xeufm10.ed.cfn xcmr10.cfn xupjisr-h.cfn
+ x*oldindepout.dvi x*tpicpnout.dvi x*reverseout.dvi \
+ x*firstout.dvi x*write.dvi x*writeout.dvi oldindep.dvi \
+ xoldindep.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/configure b/Build/source/texk/dviout-util/configure
index 0672e7c36ea..365bb621ac5 100755
--- a/Build/source/texk/dviout-util/configure
+++ b/Build/source/texk/dviout-util/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for dviout-util (TeX Live) 20181010.
+# Generated by GNU Autoconf 2.69 for dviout-util (TeX Live) 20181014.
#
# Report bugs to <tex-k@tug.org>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='dviout-util (TeX Live)'
PACKAGE_TARNAME='dviout-util--tex-live-'
-PACKAGE_VERSION='20181010'
-PACKAGE_STRING='dviout-util (TeX Live) 20181010'
+PACKAGE_VERSION='20181014'
+PACKAGE_STRING='dviout-util (TeX Live) 20181014'
PACKAGE_BUGREPORT='tex-k@tug.org'
PACKAGE_URL=''
@@ -1332,7 +1332,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures dviout-util (TeX Live) 20181010 to adapt to many kinds of systems.
+\`configure' configures dviout-util (TeX Live) 20181014 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1403,7 +1403,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of dviout-util (TeX Live) 20181010:";;
+ short | recursive ) echo "Configuration of dviout-util (TeX Live) 20181014:";;
esac
cat <<\_ACEOF
@@ -1524,7 +1524,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-dviout-util (TeX Live) configure 20181010
+dviout-util (TeX Live) configure 20181014
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2180,7 +2180,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by dviout-util (TeX Live) $as_me 20181010, which was
+It was created by dviout-util (TeX Live) $as_me 20181014, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -7865,7 +7865,7 @@ fi
# Define the identity of the package.
PACKAGE='dviout-util--tex-live-'
- VERSION='20181010'
+ VERSION='20181014'
cat >>confdefs.h <<_ACEOF
@@ -13891,7 +13891,7 @@ Usage: $0 [OPTIONS]
Report bugs to <bug-libtool@gnu.org>."
lt_cl_version="\
-dviout-util (TeX Live) config.lt 20181010
+dviout-util (TeX Live) config.lt 20181014
configured by $0, generated by GNU Autoconf 2.69.
Copyright (C) 2011 Free Software Foundation, Inc.
@@ -15496,7 +15496,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by dviout-util (TeX Live) $as_me 20181010, which was
+This file was extended by dviout-util (TeX Live) $as_me 20181014, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -15562,7 +15562,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-dviout-util (TeX Live) config.status 20181010
+dviout-util (TeX Live) config.status 20181014
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/Build/source/texk/dviout-util/configure.ac b/Build/source/texk/dviout-util/configure.ac
index 506dcfdb99e..eca9fa8d0ad 100644
--- a/Build/source/texk/dviout-util/configure.ac
+++ b/Build/source/texk/dviout-util/configure.ac
@@ -6,7 +6,7 @@ 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
-AC_INIT([dviout-util (TeX Live)], [20181010], [tex-k@tug.org])
+AC_INIT([dviout-util (TeX Live)], [20181014], [tex-k@tug.org])
AC_PREREQ([2.65])
AC_CONFIG_SRCDIR([dvispc.c])
AC_CONFIG_AUX_DIR([../../build-aux])
diff --git a/Build/source/texk/dviout-util/dvispc.c b/Build/source/texk/dviout-util/dvispc.c
index eecd552fdb1..914e7fca8d2 100644
--- a/Build/source/texk/dviout-util/dvispc.c
+++ b/Build/source/texk/dviout-util/dvispc.c
@@ -254,8 +254,10 @@ int total_book_page;
/* non-stack specials */
char background[MAX_LEN];
+char background_prev[MAX_LEN];
int f_background = 0; /* in each page, 0: not found; 1: found */
char pdf_bgcolor[MAX_LEN];
+char pdf_bgcolor_prev[MAX_LEN];
int f_pdf_bgcolor = 0; /* in each page, 0: not found; 1: found */
char tpic_pn[MAX_LEN];
char tpic_pn_prev[MAX_LEN];
@@ -884,10 +886,11 @@ lastpage: if(isdigit(*++out_pages)){
if((f_mode == EXE2MODIFY) and (f_mode == EXE2CHECK)) */
/* Prior scanning. This ensures page independence in reverse order too,
- by checking whether non-stack specials appears somewhere in DVI.
+ (e.g. Page 1 & 2 without background (= white) and Page 3 with background)
+ by checking whether non-stack specials (except tpic_pn) appears somewhere in DVI.
Specials with paired syntax (push/pop, bcolor/ecolor) are already safe
without pre-scanning, so these are skipped due to f_prescan = 1.
- Other specials (background, pdf_bgcolor, pn) are handled in this scanning. */
+ Other specials (background, pdf_bgcolor) are handled in this scanning. */
f_prescan = 1; /* change behavior of interpret(dvi) */
for(page = 1; page <= dim->total_page; page++){
fseek(dvi->file_ptr, dim->page_index[page], SEEK_SET);
@@ -911,18 +914,23 @@ lastpage: if(isdigit(*++out_pages)){
fseek(dvi->file_ptr, dim->page_index[page], SEEK_SET);
pos = interpret(dvi->file_ptr); /* scanned the whole page content; now
pos = position of EOP + 1 */
- if(f_debug){
+ if(f_debug){ /* EXE2CHECK always falls into this */
fprintf(fp_out, "[%d]", page);
- /* if(page <= dim->total_page){ */ /* always true inside loop */
flag = color_depth;
flag += pdf_color_depth;
flag += pdf_annot_depth;
if(background[0] && !f_background){
- fprintf(fp_out, "\n%s", background);
+ if(!background_prev[0]) /* assume white */
+ fprintf(fp_out, "\nbackground gray 1");
+ else
+ fprintf(fp_out, "\n%s", background_prev);
flag++;
}
if(pdf_bgcolor[0] && !f_pdf_bgcolor){
- fprintf(fp_out, "\n%s", pdf_bgcolor);
+ if(!pdf_bgcolor_prev[0]) /* assume white */
+ fprintf(fp_out, "\npdf:bgcolor [1]");
+ else
+ fprintf(fp_out, "\n%s", pdf_bgcolor_prev);
flag++;
}
for(count = 0; count < color_depth; count++)
@@ -944,13 +952,17 @@ lastpage: if(isdigit(*++out_pages)){
fprintf(fp_out, "\n"); /* at least one special printed */
f_needs_corr += flag;
}
- /* } */
+ }
+ if(f_mode == EXE2CHECK){
+ if(background[0] && f_background) /* save current status of background */
+ strncpy(background_prev, background, MAX_LEN);
+ if(pdf_bgcolor[0] && f_pdf_bgcolor) /* save current status of pdf_bgcolor */
+ strncpy(pdf_bgcolor_prev, pdf_bgcolor, MAX_LEN);
if(tpic_pn[0]) /* save current status of tpic_pn */
strncpy(tpic_pn_prev, tpic_pn, MAX_LEN);
- }
- if(f_mode == EXE2CHECK)
continue; /* skip loop if (f_mode == EXE2CHECK);
* remainings in this loop are for (f_mode == EXE2MODIFY) */
+ }
/* [Process 2] At the beginning of each page,
put non-stack specials if necessary.
@@ -967,11 +979,17 @@ lastpage: if(isdigit(*++out_pages)){
pdf_color_under--;
}
if(background[0] && !f_background){ /* background from the former page is effective */
- write_sp(fp, background);
+ if(!background_prev[0]) /* assume white */
+ write_sp(fp, "background gray 1");
+ else
+ write_sp(fp, background_prev);
f_needs_corr++;
}
if(pdf_bgcolor[0] && !f_pdf_bgcolor){ /* pdf:bgcolor from the former page is effective */
- write_sp(fp, pdf_bgcolor);
+ if(!pdf_bgcolor_prev[0]) /* assume white */
+ write_sp(fp, "pdf:bgcolor [1]");
+ else
+ write_sp(fp, pdf_bgcolor_prev);
f_needs_corr++;
}
// while(pdf_annot_under > 0){ /* recover underflow of pdf:bann ... pdf:eann stack */
@@ -1028,10 +1046,12 @@ lastpage: if(isdigit(*++out_pages)){
f_needs_corr += color_depth;
f_needs_corr += pdf_color_depth;
// f_needs_corr += pdf_annot_depth;
- /* Special case for tpic_pn:
- save current status of tpic_pn now, before it is (probably)
- overwritten after scanning the whole next page.
- Note that pn can have different values in the same page! */
+ /* Save current status of now, before it is (probably)
+ overwritten after scanning the whole next page. */
+ if(background[0] && f_background) /* save current status of background */
+ strncpy(background_prev, background, MAX_LEN);
+ if(pdf_bgcolor[0] && f_pdf_bgcolor) /* save current status of pdf_bgcolor */
+ strncpy(pdf_bgcolor_prev, pdf_bgcolor, MAX_LEN);
if(tpic_pn[0]) /* save current status of tpic_pn */
strncpy(tpic_pn_prev, tpic_pn, MAX_LEN);
}
@@ -1346,7 +1366,7 @@ skip: while (tmp--)
while(*special && ((uchar)*special) <= ' ')
special++;
if(!strsubcmp(special, "pn")){ /* pn: tpic pen size */
- strncpy(tpic_pn, special, MAX_LEN);
+ if(!f_prescan) strncpy(tpic_pn, special, MAX_LEN);
if(!f_pn)
f_pn = 1;
}else if(!f_pn &&
diff --git a/Build/source/texk/dviout-util/dvispc.test b/Build/source/texk/dviout-util/dvispc.test
index fb327ff59ac..41ed78c8138 100755
--- a/Build/source/texk/dviout-util/dvispc.test
+++ b/Build/source/texk/dviout-util/dvispc.test
@@ -91,9 +91,18 @@ rm -f x0tpicshout.dvi
if test -f x0tpicshout.dvi; then exit 1; else echo; fi
## page independence in reverse order which requires prior scanning
-./dvispc -c $testdir/reverse.dvi xreverseout.dvi && \
+./dvispc $testdir/reverse.dvi xreverseout.dvi && \
cmp $testdir/reverseout.dvi xreverseout.dvi && echo || exit 1
+# prior scanning should not mess up
+./dvispc $testdir/first.dvi xfirstout.dvi && \
+ cmp $testdir/firstout.dvi xfirstout.dvi && echo || exit 1
+
+# prior scanning should not mess up (no correction)
+rm -f xfirstpn.dvi
+./dvispc $testdir/firstpn.dvi xfirstpn.dvi && \
+ if test -f xfirstpn.dvi; then exit 1; else echo; fi
+
# ==== future work start ====
## page independence of annotation
diff --git a/Build/source/texk/dviout-util/tests/first.dvi b/Build/source/texk/dviout-util/tests/first.dvi
new file mode 100644
index 00000000000..04c1049ae34
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/first.dvi
Binary files differ
diff --git a/Build/source/texk/dviout-util/tests/first.tex b/Build/source/texk/dviout-util/tests/first.tex
new file mode 100644
index 00000000000..05d1b8c38a9
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/first.tex
@@ -0,0 +1,14 @@
+% page independence in reverse order too
+\documentclass{article}
+\usepackage[dvips]{color}
+\begin{document}
+\Huge
+white
+\newpage
+white
+\newpage
+\pagecolor{red}
+red
+\newpage
+red
+\end{document}
diff --git a/Build/source/texk/dviout-util/tests/firstout.dvi b/Build/source/texk/dviout-util/tests/firstout.dvi
new file mode 100644
index 00000000000..5c29be89025
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/firstout.dvi
Binary files differ
diff --git a/Build/source/texk/dviout-util/tests/firstpn.dvi b/Build/source/texk/dviout-util/tests/firstpn.dvi
new file mode 100644
index 00000000000..2049bd420a5
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/firstpn.dvi
Binary files differ
diff --git a/Build/source/texk/dviout-util/tests/firstpn.tex b/Build/source/texk/dviout-util/tests/firstpn.tex
new file mode 100644
index 00000000000..edc5aa90cea
--- /dev/null
+++ b/Build/source/texk/dviout-util/tests/firstpn.tex
@@ -0,0 +1,28 @@
+% page independence in reverse order should not mess it up
+\documentclass{article}
+\begin{document}
+
+\unitlength 0.001in
+
+No PN (invalid usage for test purpose only)\par
+\begin{picture}(850,550)(-50,-500)
+ \special{ar 400 250 400 250 0 6.28319}%
+ \put(400,-250){\makebox(0,0){document}}%
+\end{picture}
+\newpage
+
+No PN (invalid usage for test purpose only)\par
+\begin{picture}(850,550)(-50,-500)
+ \special{ar 400 250 400 250 0 6.28319}%
+ \put(400,-250){\makebox(0,0){document}}%
+\end{picture}
+\newpage
+
+PN 30 (explicit)\par
+\begin{picture}(850,550)(-50,-500)
+ \special{pn 30}%
+ \special{ar 400 250 400 250 0 6.28319}%
+ \put(400,-250){\makebox(0,0){document}}%
+\end{picture}
+
+\end{document}