texlive[49247] Build/source/texk/dviout-util: dviout-util: version

commits+hironobu at tug.org commits+hironobu at tug.org
Sun Nov 25 15:29:12 CET 2018


Revision: 49247
          http://tug.org/svn/texlive?view=revision&revision=49247
Author:   hironobu
Date:     2018-11-25 15:29:11 +0100 (Sun, 25 Nov 2018)
Log Message:
-----------
dviout-util: version 20181125

Modified Paths:
--------------
    trunk/Build/source/texk/dviout-util/ChangeLog
    trunk/Build/source/texk/dviout-util/Makefile.am
    trunk/Build/source/texk/dviout-util/Makefile.in
    trunk/Build/source/texk/dviout-util/chkdvifont.c
    trunk/Build/source/texk/dviout-util/configure
    trunk/Build/source/texk/dviout-util/configure.ac
    trunk/Build/source/texk/dviout-util/dvispc-en.txt
    trunk/Build/source/texk/dviout-util/dvispc-ja.txt
    trunk/Build/source/texk/dviout-util/dvispc.c
    trunk/Build/source/texk/dviout-util/dvispc.man
    trunk/Build/source/texk/dviout-util/dvispc.test

Added Paths:
-----------
    trunk/Build/source/texk/dviout-util/tests/first.dry
    trunk/Build/source/texk/dviout-util/tests/firstpn.dry
    trunk/Build/source/texk/dviout-util/tests/oldindep.dry
    trunk/Build/source/texk/dviout-util/tests/reverse.dry
    trunk/Build/source/texk/dviout-util/tests/tpicpn.dry
    trunk/Build/source/texk/dviout-util/tests/tpicsh.dry
    trunk/Build/source/texk/dviout-util/tests/under.dvi
    trunk/Build/source/texk/dviout-util/tests/under.tex
    trunk/Build/source/texk/dviout-util/tests/underout.dvi

Modified: trunk/Build/source/texk/dviout-util/ChangeLog
===================================================================
--- trunk/Build/source/texk/dviout-util/ChangeLog	2018-11-25 01:23:33 UTC (rev 49246)
+++ trunk/Build/source/texk/dviout-util/ChangeLog	2018-11-25 14:29:11 UTC (rev 49247)
@@ -1,3 +1,28 @@
+2018-11-25  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
+
+	* configure.ac: Version 20181125.
+
+2018-11-10  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
+
+	* dvispc.c, dvispc.man, dvispc-{ja,en}.txt: Better help message.
+
+2018-10-16  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
+
+	* dvispc.test: Add tests for underflow.
+	* tests/under.{tex,dvi}, tests/underout.dvi: New tests.
+	* Makefile.am: Adjusted.
+
+2018-10-15  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
+
+	* dvispc.c: Use common routine for EXE2MODIFY and EXE2CHECK
+	for simplicity.
+	* dvispc.test: Add tests for consistency between EXE2MODIFY
+	and EXE2CHECK.
+	* tests/oldindep.dry, tests/tpicpn.dry, tests/tpicsh.dry,
+	tests/reverse.dry, tests/first.dry, tests/firstpn.dry:
+	New tests.
+	* Makefile.am: Adjusted.
+
 2018-10-14  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
 
 	* dvispc.c: Fix a bug that modification of non-stack

Modified: trunk/Build/source/texk/dviout-util/Makefile.am
===================================================================
--- trunk/Build/source/texk/dviout-util/Makefile.am	2018-11-25 01:23:33 UTC (rev 49246)
+++ trunk/Build/source/texk/dviout-util/Makefile.am	2018-11-25 14:29:11 UTC (rev 49247)
@@ -31,18 +31,32 @@
 
 ## dvispc.test
 EXTRA_DIST += tests/oldindep.spc \
-	tests/oldindep.tex tests/oldindep.dvi tests/oldindepout.dvi \
-	tests/tpicpn.tex tests/tpicpn.dvi tests/tpicpnout.dvi \
+	tests/oldindep.tex tests/oldindep.dvi \
+	tests/oldindep.dry tests/oldindepout.dvi \
+	tests/under.tex tests/under.dvi \
+	tests/underout.dvi \
+	tests/tpicpn.tex tests/tpicpn.dvi \
+	tests/tpicpn.dry 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/tpicsh.dry \
+	tests/reverse.tex tests/reverse.dvi \
+	tests/reverse.dry tests/reverseout.dvi \
+	tests/first.tex tests/first.dvi \
+	tests/first.dry tests/firstout.dvi \
 	tests/firstpn.tex tests/firstpn.dvi \
+	tests/firstpn.dry \
 	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*firstout.dvi \
+	x*oldindepa.txt x*oldindepax.dvi \
+	x*oldindep.dry x*oldindepout.dvi \
+	x*underout.dvi \
+	x*tpicpn.dry x*tpicpnout.dvi \
+	x*tpicsh.dry \
+	x*reverse.dry x*reverseout.dvi \
+	x*first.dry x*firstout.dvi \
+	x*firstpn.dry \
 	x*write.dvi x*writeout.dvi
 
 ## chkdvifont.test

Modified: trunk/Build/source/texk/dviout-util/Makefile.in
===================================================================
--- trunk/Build/source/texk/dviout-util/Makefile.in	2018-11-25 01:23:33 UTC (rev 49246)
+++ trunk/Build/source/texk/dviout-util/Makefile.in	2018-11-25 14:29:11 UTC (rev 49247)
@@ -560,11 +560,14 @@
 dist_man1_MANS = dvispc.man chkdvifont.man
 TESTS = dvispc.test chkdvifont.test
 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/first.tex tests/first.dvi \
-	tests/firstout.dvi tests/firstpn.tex tests/firstpn.dvi \
+	tests/oldindep.dvi tests/oldindep.dry tests/oldindepout.dvi \
+	tests/under.tex tests/under.dvi tests/underout.dvi \
+	tests/tpicpn.tex tests/tpicpn.dvi tests/tpicpn.dry \
+	tests/tpicpnout.dvi tests/tpicsh.tex tests/tpicsh.dvi \
+	tests/tpicsh.dry tests/reverse.tex tests/reverse.dvi \
+	tests/reverse.dry tests/reverseout.dvi tests/first.tex \
+	tests/first.dvi tests/first.dry tests/firstout.dvi \
+	tests/firstpn.tex tests/firstpn.dvi tests/firstpn.dry \
 	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 \
@@ -571,10 +574,11 @@
 	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*firstout.dvi x*write.dvi x*writeout.dvi oldindep.dvi \
-	xoldindep.cfn xjis.cfn xeufm10.cfn xeufm10.ed.cfn xcmr10.cfn \
-	xupjisr-h.cfn
+	x*oldindep.dry x*oldindepout.dvi x*underout.dvi x*tpicpn.dry \
+	x*tpicpnout.dvi x*tpicsh.dry x*reverse.dry x*reverseout.dvi \
+	x*first.dry x*firstout.dvi x*firstpn.dry 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
 

Modified: trunk/Build/source/texk/dviout-util/chkdvifont.c
===================================================================
--- trunk/Build/source/texk/dviout-util/chkdvifont.c	2018-11-25 01:23:33 UTC (rev 49246)
+++ trunk/Build/source/texk/dviout-util/chkdvifont.c	2018-11-25 14:29:11 UTC (rev 49247)
@@ -1266,7 +1266,7 @@
  exit(1);
 
   show:
-	fprintf(stderr,
+	fprintf(stderr, "\n\n"
 #endif
 			"Errorlevel is the sum of the following number\n"
 			"\t  1: cmbsy5-9, cmcsc8-9, cmex7-9, cmmib5-9\n"

Modified: trunk/Build/source/texk/dviout-util/configure
===================================================================
--- trunk/Build/source/texk/dviout-util/configure	2018-11-25 01:23:33 UTC (rev 49246)
+++ trunk/Build/source/texk/dviout-util/configure	2018-11-25 14:29:11 UTC (rev 49247)
@@ -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) 20181014.
+# Generated by GNU Autoconf 2.69 for dviout-util (TeX Live) 20181125.
 #
 # Report bugs to <tex-k at tug.org>.
 #
@@ -590,8 +590,8 @@
 # Identity of this package.
 PACKAGE_NAME='dviout-util (TeX Live)'
 PACKAGE_TARNAME='dviout-util--tex-live-'
-PACKAGE_VERSION='20181014'
-PACKAGE_STRING='dviout-util (TeX Live) 20181014'
+PACKAGE_VERSION='20181125'
+PACKAGE_STRING='dviout-util (TeX Live) 20181125'
 PACKAGE_BUGREPORT='tex-k at tug.org'
 PACKAGE_URL=''
 
@@ -1332,7 +1332,7 @@
   # 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) 20181014 to adapt to many kinds of systems.
+\`configure' configures dviout-util (TeX Live) 20181125 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1403,7 +1403,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of dviout-util (TeX Live) 20181014:";;
+     short | recursive ) echo "Configuration of dviout-util (TeX Live) 20181125:";;
    esac
   cat <<\_ACEOF
 
@@ -1524,7 +1524,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-dviout-util (TeX Live) configure 20181014
+dviout-util (TeX Live) configure 20181125
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2180,7 +2180,7 @@
 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 20181014, which was
+It was created by dviout-util (TeX Live) $as_me 20181125, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -7865,7 +7865,7 @@
 
 # Define the identity of the package.
  PACKAGE='dviout-util--tex-live-'
- VERSION='20181014'
+ VERSION='20181125'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -13891,7 +13891,7 @@
 Report bugs to <bug-libtool at gnu.org>."
 
 lt_cl_version="\
-dviout-util (TeX Live) config.lt 20181014
+dviout-util (TeX Live) config.lt 20181125
 configured by $0, generated by GNU Autoconf 2.69.
 
 Copyright (C) 2011 Free Software Foundation, Inc.
@@ -15496,7 +15496,7 @@
 # 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 20181014, which was
+This file was extended by dviout-util (TeX Live) $as_me 20181125, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -15562,7 +15562,7 @@
 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 20181014
+dviout-util (TeX Live) config.status 20181125
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 

Modified: trunk/Build/source/texk/dviout-util/configure.ac
===================================================================
--- trunk/Build/source/texk/dviout-util/configure.ac	2018-11-25 01:23:33 UTC (rev 49246)
+++ trunk/Build/source/texk/dviout-util/configure.ac	2018-11-25 14:29:11 UTC (rev 49247)
@@ -6,7 +6,7 @@
 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)], [20181014], [tex-k at tug.org])
+AC_INIT([dviout-util (TeX Live)], [20181125], [tex-k at tug.org])
 AC_PREREQ([2.65])
 AC_CONFIG_SRCDIR([dvispc.c])
 AC_CONFIG_AUX_DIR([../../build-aux])

Modified: trunk/Build/source/texk/dviout-util/dvispc-en.txt
===================================================================
--- trunk/Build/source/texk/dviout-util/dvispc-en.txt	2018-11-25 01:23:33 UTC (rev 49246)
+++ trunk/Build/source/texk/dviout-util/dvispc-en.txt	2018-11-25 14:29:11 UTC (rev 49247)
@@ -10,8 +10,8 @@
        dvispc -x[..] [-ltv][-r..] [input_text_file] output_dvi_file
 
 Mode options:
-   -c: make page-indepent DVI in specials (default)
-   -d: check page-independence
+   -c: correct input DVI to be page-indepent in specials (default)
+   -d: dry run to check page-independence
    -s: show specials
    -a: translate DVI to Text
    -x: translate Text to DVI (-x0:str0 1:chkfnt 2:variety)

Modified: trunk/Build/source/texk/dviout-util/dvispc-ja.txt
===================================================================
--- trunk/Build/source/texk/dviout-util/dvispc-ja.txt	2018-11-25 01:23:33 UTC (rev 49246)
+++ trunk/Build/source/texk/dviout-util/dvispc-ja.txt	2018-11-25 14:29:11 UTC (rev 49247)
@@ -10,8 +10,8 @@
        dvispc -x[..] [-ltv][-r..] [input_text_file] output_dvi_file
 
 Mode options:
-   -c: make page-indepent DVI in specials (default)
-   -d: check page-independence
+   -c: correct input DVI to be page-indepent in specials (default)
+   -d: dry run to check page-independence
    -s: show specials
    -a: translate DVI to Text
    -x: translate Text to DVI (-x0:str0 1:chkfnt 2:variety)

Modified: trunk/Build/source/texk/dviout-util/dvispc.c
===================================================================
--- trunk/Build/source/texk/dviout-util/dvispc.c	2018-11-25 01:23:33 UTC (rev 49246)
+++ trunk/Build/source/texk/dviout-util/dvispc.c	2018-11-25 14:29:11 UTC (rev 49247)
@@ -248,6 +248,7 @@
 
 int  f_ptex = 0;
 int  f_prescan = 0;
+int  f_last = 0;
 int  max_stack;
 char *out_pages ="T-L";
 int  total_book_page;
@@ -441,8 +442,8 @@
 #endif
     "       dvispc -x[..] [-ltv][-r..] [input_text_file] output_dvi_file\n\n"
     "Mode options:\n"
-    "   -c: make page-indepent DVI in specials (default)\n"
-    "   -d: check page-independence\n"
+    "   -c: correct input DVI to be page-indepent in specials (default)\n"
+    "   -d: dry run to check page-independence\n"
     "   -s: show specials\n"
     "   -a: translate DVI to Text\n"
     "   -x: translate Text to DVI (-x0:str0 1:chkfnt 2:variety)\n\n"
@@ -802,6 +803,10 @@
     int len;
     len = strlen(sp);
 
+    if(f_debug)
+        fprintf(fp_out, "%s", sp);
+    if(f_mode != EXE2MODIFY || f_last)
+        return; /* dry-run for EXE2CHECK */
     if(len <= 0xff)
         fprintf(fp, "%c%c%s", XXX1, len, sp);
     else if(len <= 0xffffffff){
@@ -813,6 +818,15 @@
         Exit(1);
     }
 }
+void write_sp_nodebug(FILE *fp, char *sp)
+{   /* omit debug message (for backward compatibility) */
+    if(f_debug){
+        f_debug = 0;    /* disable debug printing temporarily */
+        write_sp(fp, sp);
+        f_debug = 1;
+    }else
+        write_sp(fp, sp);
+}
 
 
 void translate(DVIFILE_INFO *dvi, DIMENSION *dim)
@@ -831,6 +845,7 @@
         fp = NULL;
 
     f_needs_corr = flag = 0;
+    f_last = 0;
 
     if(f_mode == EXE2TEXT || f_mode == EXE2SPECIAL){
         while(out_pages && *out_pages){
@@ -916,81 +931,46 @@
                                            pos = position of EOP + 1 */
         if(f_debug){    /* EXE2CHECK always falls into this */
             fprintf(fp_out, "[%d]", page);
-            flag = color_depth;
-            flag += pdf_color_depth;
-            flag += pdf_annot_depth;
-            if(background[0] && !f_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){
-                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++)
-                fprintf(fp_out, "\n%d:%s", count+1, color_pt[count]);
-            for(count = 0; count < pdf_color_depth; count++)
-                fprintf(fp_out, "\n%d:%s", count+1, pdf_color_pt[count]);
-            for(count = 0; count < pdf_annot_depth; count++)
-                fprintf(fp_out, "\n%d:%s", count+1, pdf_annot_pt[count]);
-            if(f_pn < 0){
-                if(!tpic_pn_prev[0])
-                    fprintf(stderr, "Cannot find valid tpic pn.\n"
-                                    "Please check your LaTeX source.\n");
-                else{
-                    fprintf(fp_out, "\n%s", tpic_pn_prev);
-                    flag++;
-                }
-            }
-            if(flag){
-                fprintf(fp_out, "\n"); /* at least one special printed */
-                f_needs_corr += flag;
-            }
+            flag = f_needs_corr;    /* reserved for later check */
         }
-        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);
-            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.
+        /* [Process 2] Before writing the current page, handle non-stack specials.
+            * If not found but necessary, put one.
+            * If found, save current status before going back to the loop head
+              for the next page (= scanning the whole next page might overwrite it!).
            Also, if the page is suffering from stack underflow,
-           open lacking stacks beforehand */
+           open lacking stacks beforehand. */
         while(color_under > 0){     /* recover underflow of color stack */
-            write_sp(fp, "color push  Black");
+            write_sp_nodebug(fp, "color push  Black");
             f_needs_corr++;
             color_under--;
         }
         while(pdf_color_under > 0){ /* recover underflow of pdf:bcolor ... pdf:ecolor stack */
-            write_sp(fp, "pdf:bcolor [0]");
+            write_sp_nodebug(fp, "pdf:bcolor [0]");
             f_needs_corr++;
             pdf_color_under--;
         }
-        if(background[0] && !f_background){     /* background from the former page is effective */
-            if(!background_prev[0]) /* assume white */
-                write_sp(fp, "background gray 1");
-            else
-                write_sp(fp, background_prev);
-            f_needs_corr++;
+        if(background[0]){  /* background used somewhere */
+            if(!f_background){  /* no background in this page */
+                if(f_debug) fprintf(fp_out, "\n");
+                if(!background_prev[0]) /* assume white */
+                    write_sp(fp, "background gray 1");
+                else
+                    write_sp(fp, background_prev);
+                f_needs_corr++;
+            }else               /* this page had one! */
+                strncpy(background_prev, background, MAX_LEN);      /* save current */
         }
-        if(pdf_bgcolor[0] && !f_pdf_bgcolor){   /* pdf:bgcolor from the former page is effective */
-            if(!pdf_bgcolor_prev[0]) /* assume white */
-                write_sp(fp, "pdf:bgcolor [1]");
-            else
-                write_sp(fp, pdf_bgcolor_prev);
-            f_needs_corr++;
+        if(pdf_bgcolor[0]){ /* pdf:bgcolor used somewhere */
+            if(!f_pdf_bgcolor){ /* no pdf:bgcolor in this page */
+                if(f_debug) fprintf(fp_out, "\n");
+                if(!pdf_bgcolor_prev[0]) /* assume white */
+                    write_sp(fp, "pdf:bgcolor [1]");
+                else
+                    write_sp(fp, pdf_bgcolor_prev);
+                f_needs_corr++;
+            }else               /* this page had one! */
+                strncpy(pdf_bgcolor_prev, pdf_bgcolor, MAX_LEN);    /* save current */
         }
 //        while(pdf_annot_under > 0){ /* recover underflow of pdf:bann ... pdf:eann stack */
 //            /* [TODO] what should we do here? */
@@ -997,67 +977,79 @@
 //            f_needs_corr++;
 //            pdf_annot_under--;
 //        }
-        if(f_pn < 0) {    /* tpic_pn from the former page is effective */
-            if(!tpic_pn_prev[0])
+        if(f_pn < 0) {  /* tpic_pn from the former page should be effective ... */
+            if(!tpic_pn_prev[0])    /* ... but nothing found before */
                 fprintf(stderr, "\nCannot find valid tpic pn."
                                 "\nPlease check your LaTeX source.");
-            else{
+            else{                   /* ... OK */
+                if(f_debug) fprintf(fp_out, "\n");
                 write_sp(fp, tpic_pn_prev);
                 f_needs_corr++;
             }
         }
+        if(tpic_pn[0] && f_pn)  /* tpic_pn used in this page */
+            strncpy(tpic_pn_prev, tpic_pn, MAX_LEN);    /* save current */
 
-        /* [Process 3] write contents of the current page */
-        fseek(dvi->file_ptr, dim->page_index[page]+45, SEEK_SET);
-        for(size = pos - dim->page_index[page] - 46; size > 0; size--)
-            write_byte(read_byte(dvi->file_ptr), fp);
+        /* [Process 3] Write contents of the current page. */
+        if(f_mode == EXE2MODIFY){
+            fseek(dvi->file_ptr, dim->page_index[page]+45, SEEK_SET);
+            for(size = pos - dim->page_index[page] - 46; size > 0; size--)
+                write_byte(read_byte(dvi->file_ptr), fp);
+        }
 
-        /* [Process 4] at the end of page,
-           close not-yet-closed stacks */
+        /* [Process 4] After writing the current page,
+           close not-yet-closed stacks. */
         for(count = 0; count < color_depth; count++){
-            write_sp(fp, "color pop");
+            write_sp_nodebug(fp, "color pop");
             f_needs_corr++;
         }
         for(count = 0; count < pdf_color_depth; count++){
-            write_sp(fp, "pdf:ecolor");
+            write_sp_nodebug(fp, "pdf:ecolor");
             f_needs_corr++;
         }
 //        for(count = 0; count < pdf_annot_depth; count++){
-//            write_sp(fp, "pdf:eann");
+//            write_sp_nodebug(fp, "pdf:eann");
 //            f_needs_corr++;
 //        }
-        write_byte((uchar)EOP, fp); /* write EOP */
-        former = current;
-        current = ftell(fp);        /* get position of BOP/POST */
+        if(f_mode == EXE2MODIFY){
+            write_byte((uchar)EOP, fp); /* write EOP */
+            former = current;
+            current = ftell(fp);        /* get position of BOP/POST */
+        }
 
-        /* [Process 5] except for the last page,
-           start the next page with passing not-yet-closed stacks */
-        if(page < dim->total_page){
+        if(page == dim->total_page)
+            f_last = 1; /* reached the last page, change behavior of write_sp(fp,sp) */
+
+        /* [Process 5] Except for the last page,
+           start the next page with passing not-yet-closed stacks. */
+        if(f_mode == EXE2MODIFY && !f_last){
             fseek(dvi->file_ptr, dim->page_index[page+1], SEEK_SET);
             for(size = 41; size > 0; size--)  /* write BOP and c[] */
                 write_byte(read_byte(dvi->file_ptr), fp);
             write_long(former, fp); /* position of BOP of the former page */
-            for(count = 0; count < color_depth; count++)
-                write_sp(fp, color_pt[count]);
-            for(count = 0; count < pdf_color_depth; count++)
-                write_sp(fp, pdf_color_pt[count]);
-//            for(count = 0; count < pdf_annot_depth; count++)
-//                write_sp(fp, pdf_annot_pt[count]);
-            f_needs_corr += color_depth;
-            f_needs_corr += pdf_color_depth;
-//            f_needs_corr += pdf_annot_depth;
-            /* 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);
         }
+        for(count = 0; count < color_depth; count++){
+            if(f_debug) fprintf(fp_out, "\n%d:", count+1);
+            write_sp(fp, color_pt[count]);
+        }
+        for(count = 0; count < pdf_color_depth; count++){
+            if(f_debug) fprintf(fp_out, "\n%d:", count+1);
+            write_sp(fp, pdf_color_pt[count]);
+        }
+//        for(count = 0; count < pdf_annot_depth; count++){
+//            if(f_debug) fprintf(fp_out, "\n%d:", count+1);
+//            write_sp(fp, pdf_annot_pt[count]);
+//        }
+        /* f_needs_corr already set properly in [Process 4] */
+
+        if(f_debug){    /* EXE2CHECK always falls into this */
+            if(flag != f_needs_corr)    /* at least one special printed for debug */
+                fprintf(fp_out, "\n");
+        }
+        f_last = 0; /* restore write_sp(fp,sp) */
     } /* page loop end */
 
-    if(f_debug) {
+    if(f_debug) {   /* EXE2CHECK always falls into this */
         if(color_depth_max)
             fprintf(fp_out, "\nMaximal depth of color stack:%d", color_depth_max);
         if(pdf_color_depth_max)

Modified: trunk/Build/source/texk/dviout-util/dvispc.man
===================================================================
--- trunk/Build/source/texk/dviout-util/dvispc.man	2018-11-25 01:23:33 UTC (rev 49246)
+++ trunk/Build/source/texk/dviout-util/dvispc.man	2018-11-25 14:29:11 UTC (rev 49247)
@@ -26,10 +26,10 @@
 is a utility to modify/edit \*(TX DVI file with the following features:
 .PP
     Mode option \fB\-c\fR (default):
-        modify an input DVI to be page-independent in specials (default)
+        correct an input DVI to be page-independent in specials (default)
 .PP
     Mode option \fB\-d\fR:
-        check if an input DVI is page-independent in specials
+        dry run to check if an input DVI is page-independent in specials
 .PP
     Mode option \fB\-s\fR:
         show all specials in the input DVI

Modified: trunk/Build/source/texk/dviout-util/dvispc.test
===================================================================
--- trunk/Build/source/texk/dviout-util/dvispc.test	2018-11-25 01:23:33 UTC (rev 49246)
+++ trunk/Build/source/texk/dviout-util/dvispc.test	2018-11-25 14:29:11 UTC (rev 49247)
@@ -49,8 +49,11 @@
   cmp $testdir/oldindep.dvi x3oldindepax.dvi && echo || exit 7
 
 
-## EXE2INDEP
+## EXE2MODIFY & EXE2CHECK (should be consistent)
 
+./dvispc -d $testdir/oldindep.dvi >x0oldindep.dry
+  diff $diffoptCRLF $testdir/oldindep.dry x0oldindep.dry && echo || exit 1
+
 ./dvispc -c $testdir/oldindep.dvi x0oldindepout.dvi && \
   cmp $testdir/oldindepout.dvi x0oldindepout.dvi && echo || exit 1
 
@@ -75,6 +78,13 @@
 #  ./dvispc x3write.dvi
 #  cmp $testdir/oldindepout.dvi x3write.dvi && echo || exit 5
 
+## case of underflow
+./dvispc $testdir/under.dvi x0underout.dvi && \
+  cmp $testdir/underout.dvi x0underout.dvi && echo || exit 6
+rm -f x1underout.dvi
+./dvispc x0underout.dvi x1underout.dvi && \
+  if test -f x1underout.dvi; then exit 1; else echo; fi || exit 6
+
 ./dvispc && echo || exit 0
 
 # the following tests will not pass for old version written by SHIMA.
@@ -82,39 +92,55 @@
 # exit code 1 for usage without argument. (the above line did it!)
 
 # correction for tpicpn.dvi is needed but should be minimal
+./dvispc -d $testdir/tpicpn.dvi >x0tpicpn.dry
+  diff $diffoptCRLF $testdir/tpicpn.dry x0tpicpn.dry && echo || exit 1
 ./dvispc $testdir/tpicpn.dvi x0tpicpnout.dvi && \
   cmp $testdir/tpicpnout.dvi x0tpicpnout.dvi && echo || exit 1
 
 # correction for tpicsh.dvi is never needed, check no output
+./dvispc -d $testdir/tpicsh.dvi >x0tpicsh.dry
+  diff $diffoptCRLF $testdir/tpicsh.dry x0tpicsh.dry && echo || exit 1
 rm -f x0tpicshout.dvi
 ./dvispc $testdir/tpicsh.dvi x0tpicshout.dvi && \
-  if test -f x0tpicshout.dvi; then exit 1; else echo; fi
+  if test -f x0tpicshout.dvi; then exit 1; else echo; fi || exit 1
 
 ## page independence in reverse order which requires prior scanning
+./dvispc -d $testdir/reverse.dvi >xreverse.dry
+  diff $diffoptCRLF $testdir/reverse.dry xreverse.dry && echo || exit 1
 ./dvispc $testdir/reverse.dvi xreverseout.dvi && \
   cmp $testdir/reverseout.dvi xreverseout.dvi && echo || exit 1
 
 # prior scanning should not mess up
+./dvispc -d $testdir/first.dvi >xfirst.dry
+  diff $diffoptCRLF $testdir/first.dry xfirst.dry && echo || exit 1
 ./dvispc $testdir/first.dvi xfirstout.dvi && \
   cmp $testdir/firstout.dvi xfirstout.dvi && echo || exit 1
 
 # prior scanning should not mess up (no correction)
+./dvispc -d $testdir/firstpn.dvi >xfirstpn.dry
+  diff $diffoptCRLF $testdir/firstpn.dry xfirstpn.dry && echo || exit 1
 rm -f xfirstpn.dvi
 ./dvispc $testdir/firstpn.dvi xfirstpn.dvi && \
-  if test -f xfirstpn.dvi; then exit 1; else echo; fi
+  if test -f xfirstpn.dvi; then exit 1; else echo; fi || exit 1
 
 # ==== future work start ====
 
 ## page independence of annotation
+#./dvispc -d $testdir/annot.dvi >xannot.dry
+#  diff $diffoptCRLF $testdir/annot.dry xannot.dry && echo || exit 2
 #./dvispc $testdir/annot.dvi xannotout.dvi && \
 #  cmp $testdir/annotout.dvi xannotout.dvi && echo || exit 2
 
 ## page independence of long (>255) specials (e.g. annotation)
 ## disabled because annotation is unsupported
+#./dvispc -d $testdir/longspec.dvi >xlongspec.dry
+#  diff $diffoptCRLF $testdir/longspec.dry xlongspec.dry && echo || exit 3
 #./dvispc $testdir/longspec.dvi xlongspecout.dvi && \
 #  cmp $testdir/longspecout.dvi xlongspecout.dvi && echo || exit 3
 
 ## flatten nested anotation
+#./dvispc -d $testdir/flatnest.dvi >xflatnest.dry
+#  diff $diffoptCRLF $testdir/flatnest.dry xflatnest.dry && echo || exit 3
 #./dvispc $testdir/flatnest.dvi xflatnestout.dvi && \
 #  cmp $testdir/flatnestout.dvi xflatnestout.dvi && echo || exit 4
 

Added: trunk/Build/source/texk/dviout-util/tests/first.dry
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/first.dry	                        (rev 0)
+++ trunk/Build/source/texk/dviout-util/tests/first.dry	2018-11-25 14:29:11 UTC (rev 49247)
@@ -0,0 +1,9 @@
+[1]
+background gray 1
+[2]
+background gray 1
+[3][4]
+background rgb 1 0 0
+
+Maximal depth of color stack:1
+Some corrections are necessary!

Added: trunk/Build/source/texk/dviout-util/tests/firstpn.dry
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/firstpn.dry	                        (rev 0)
+++ trunk/Build/source/texk/dviout-util/tests/firstpn.dry	2018-11-25 14:29:11 UTC (rev 49247)
@@ -0,0 +1,2 @@
+[1][2][3]
+No modification is necessary

Added: trunk/Build/source/texk/dviout-util/tests/oldindep.dry
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/oldindep.dry	                        (rev 0)
+++ trunk/Build/source/texk/dviout-util/tests/oldindep.dry	2018-11-25 14:29:11 UTC (rev 49247)
@@ -0,0 +1,8 @@
+[1][2]
+background rgb 1 0 0
+1:color push rgb 0 0 1
+[3][4]
+background gray 1
+
+Maximal depth of color stack:2
+Some corrections are necessary!

Added: trunk/Build/source/texk/dviout-util/tests/reverse.dry
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/reverse.dry	                        (rev 0)
+++ trunk/Build/source/texk/dviout-util/tests/reverse.dry	2018-11-25 14:29:11 UTC (rev 49247)
@@ -0,0 +1,23 @@
+[1]
+background gray 1
+[2]
+background gray 1
+[3][4]
+background rgb 1 0 0
+[5]
+background rgb 1 0 0
+[6][7]
+background gray 1
+[8]
+background gray 1
+1:color push rgb 1 0 0
+[9]
+background gray 1
+1:color push rgb 1 0 0
+[10]
+background gray 1
+[11]
+background gray 1
+
+Maximal depth of color stack:2
+Some corrections are necessary!

Added: trunk/Build/source/texk/dviout-util/tests/tpicpn.dry
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/tpicpn.dry	                        (rev 0)
+++ trunk/Build/source/texk/dviout-util/tests/tpicpn.dry	2018-11-25 14:29:11 UTC (rev 49247)
@@ -0,0 +1,10 @@
+[1][2]
+pn 30
+[3][4][5]
+pn 5
+[6][7][8]
+pn 30
+[9]
+pn 30
+
+Some corrections are necessary!

Added: trunk/Build/source/texk/dviout-util/tests/tpicsh.dry
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/tpicsh.dry	                        (rev 0)
+++ trunk/Build/source/texk/dviout-util/tests/tpicsh.dry	2018-11-25 14:29:11 UTC (rev 49247)
@@ -0,0 +1,2 @@
+[1][2]
+No modification is necessary

Added: trunk/Build/source/texk/dviout-util/tests/under.dvi
===================================================================
(Binary files differ)

Index: trunk/Build/source/texk/dviout-util/tests/under.dvi
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/under.dvi	2018-11-25 01:23:33 UTC (rev 49246)
+++ trunk/Build/source/texk/dviout-util/tests/under.dvi	2018-11-25 14:29:11 UTC (rev 49247)

Property changes on: trunk/Build/source/texk/dviout-util/tests/under.dvi
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Build/source/texk/dviout-util/tests/under.tex
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/under.tex	                        (rev 0)
+++ trunk/Build/source/texk/dviout-util/tests/under.tex	2018-11-25 14:29:11 UTC (rev 49247)
@@ -0,0 +1,44 @@
+% check underflow
+\documentclass{article}
+\usepackage[dvips]{color}
+\usepackage{atbegshi}
+\begin{document}
+black
+\newpage
+\AtBeginShipoutNext{\AtBeginShipoutDiscard}
+{\color{red}
+ start red (but discarded)
+\newpage
+ \AtBeginShipoutNext{\AtBeginShipoutDiscard}
+ {\color{blue}
+  start blue (but discarded)
+\newpage
+  \AtBeginShipoutNext{\AtBeginShipoutDiscard}
+  {\color{green}
+   start green (but discarded)
+\newpage
+   end green}
+\newpage
+  end blue}
+\newpage
+ end red}
+\newpage
+black
+\newpage
+\AtBeginShipoutNext{\AtBeginShipoutDiscard}
+{\color{red}
+ start red (but discarded)
+ {\color{blue}
+  start blue (but discarded)
+\newpage
+  end blue}
+ end red}
+\newpage
+black
+\newpage
+{\color{yellow}
+ start yellow
+\newpage
+ \AtBeginShipoutNext{\AtBeginShipoutDiscard}
+ end yellow (but discarded)}
+\end{document}


Property changes on: trunk/Build/source/texk/dviout-util/tests/under.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Build/source/texk/dviout-util/tests/underout.dvi
===================================================================
(Binary files differ)

Index: trunk/Build/source/texk/dviout-util/tests/underout.dvi
===================================================================
--- trunk/Build/source/texk/dviout-util/tests/underout.dvi	2018-11-25 01:23:33 UTC (rev 49246)
+++ trunk/Build/source/texk/dviout-util/tests/underout.dvi	2018-11-25 14:29:11 UTC (rev 49247)

Property changes on: trunk/Build/source/texk/dviout-util/tests/underout.dvi
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property


More information about the tex-live-commits mailing list