summaryrefslogtreecommitdiff
path: root/Build/source/texk/seetexk
diff options
context:
space:
mode:
authorTakuji Tanaka <KXD02663@nifty.ne.jp>2017-06-19 13:53:02 +0000
committerTakuji Tanaka <KXD02663@nifty.ne.jp>2017-06-19 13:53:02 +0000
commit47200cf750c5f351fe840f9d9b57bde6cc75167c (patch)
treec1d9986d76a5ebdf93b5d0fb3b86d507a2f491fa /Build/source/texk/seetexk
parentbd2881589ba386c2275e3e32c304a63c49ff46f8 (diff)
texk/seetexk: Support pTeX dvi by H. Yamashita-san
git-svn-id: svn://tug.org/texlive/trunk@44637 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/seetexk')
-rw-r--r--Build/source/texk/seetexk/ChangeLog13
-rw-r--r--Build/source/texk/seetexk/Makefile.am8
-rw-r--r--Build/source/texk/seetexk/Makefile.in8
-rw-r--r--Build/source/texk/seetexk/dvibook.c95
-rw-r--r--Build/source/texk/seetexk/dvibook.man8
-rw-r--r--Build/source/texk/seetexk/dviclass.c13
-rw-r--r--Build/source/texk/seetexk/dviclass.h5
-rw-r--r--Build/source/texk/seetexk/dvicodes.h13
-rw-r--r--Build/source/texk/seetexk/dviconcat.c26
-rw-r--r--Build/source/texk/seetexk/dviselect.c28
-rw-r--r--Build/source/texk/seetexk/dvitodvi.c28
-rwxr-xr-xBuild/source/texk/seetexk/seetexk.test66
-rw-r--r--Build/source/texk/seetexk/tests/playbook.32
-rw-r--r--Build/source/texk/seetexk/tests/playbook.42
-rw-r--r--Build/source/texk/seetexk/tests/playconc.35
-rw-r--r--Build/source/texk/seetexk/tests/playdvi.32
-rw-r--r--Build/source/texk/seetexk/tests/playsel.32
-rw-r--r--Build/source/texk/seetexk/tests/playtate.dvibin0 -> 2484 bytes
18 files changed, 316 insertions, 8 deletions
diff --git a/Build/source/texk/seetexk/ChangeLog b/Build/source/texk/seetexk/ChangeLog
index 962a2fbf06c..9fdec592050 100644
--- a/Build/source/texk/seetexk/ChangeLog
+++ b/Build/source/texk/seetexk/ChangeLog
@@ -1,3 +1,16 @@
+2017-06-18 Hironobu Yamashita <h.y.acetaminophen@gmail.com>
+
+ * dvibook.c, dviclass.[ch], dvicodes.h, dviconcat.c,
+ dviselect.c, dvitodvi.c: Add support for pTeX tate-kumi
+ DVI. The patch is based on the work by H. Kagotani in 1992.
+ * dvibook.c: Add -r option to generate right-hand side binding
+ books. It would be useful for Japanese tate-kumi documents.
+ * dvibook.man: Add -r option.
+ * seetexk.test: Add tests for pTeX support.
+ * playbook.3, playbook.4, playconc.3, playdvi.3, playsel.3,
+ playtate.dvi: Added.
+ * Makefile.am: Adjusted for pTeX support.
+
2017-06-11 TANAKA Takuji <ttk@t-lab.opal.ne.jp>
* dvibook.c, dviconcat.c, dviselect.c, dvitodvi.c:
diff --git a/Build/source/texk/seetexk/Makefile.am b/Build/source/texk/seetexk/Makefile.am
index c438b2ee661..a0099579fe3 100644
--- a/Build/source/texk/seetexk/Makefile.am
+++ b/Build/source/texk/seetexk/Makefile.am
@@ -3,7 +3,7 @@
## Copyright (C) 2009-2015 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.
##
-AM_CPPFLAGS = $(KPATHSEA_INCLUDES) -DUNIX -DKPATHSEA
+AM_CPPFLAGS = $(KPATHSEA_INCLUDES) -DUNIX -DKPATHSEA -DASCIIPTEX
AM_CFLAGS = $(WARNING_CFLAGS)
noinst_LIBRARIES = libtex.a
@@ -52,6 +52,8 @@ EXTRA_DIST = $(TESTS)
## seetexk.test
EXTRA_DIST += \
tests/play.dvi tests/playbook.2 tests/playconc.2 \
- tests/playdvi.2 tests/playnot.2 tests/playsel.2
-DISTCLEANFILES = play*.2 play*.dvi
+ tests/playdvi.2 tests/playnot.2 tests/playsel.2 \
+ tests/playtate.dvi tests/playbook.3 tests/playbook.4 \
+ tests/playconc.3 tests/playdvi.3 tests/playsel.3
+DISTCLEANFILES = play*.2 play*.3 play*.4 play*.dvi
diff --git a/Build/source/texk/seetexk/Makefile.in b/Build/source/texk/seetexk/Makefile.in
index 08183abcc55..8cf56231cb1 100644
--- a/Build/source/texk/seetexk/Makefile.in
+++ b/Build/source/texk/seetexk/Makefile.in
@@ -572,7 +572,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-AM_CPPFLAGS = $(KPATHSEA_INCLUDES) -DUNIX -DKPATHSEA
+AM_CPPFLAGS = $(KPATHSEA_INCLUDES) -DUNIX -DKPATHSEA -DASCIIPTEX
AM_CFLAGS = $(WARNING_CFLAGS)
noinst_LIBRARIES = libtex.a
libtex_a_SOURCES = \
@@ -601,8 +601,10 @@ noinst_HEADERS = \
dist_man1_MANS = dvibook.man dviconcat.man dviselect.man dvitodvi.man
TESTS = seetexk.test
EXTRA_DIST = $(TESTS) tests/play.dvi tests/playbook.2 tests/playconc.2 \
- tests/playdvi.2 tests/playnot.2 tests/playsel.2
-DISTCLEANFILES = play*.2 play*.dvi
+ tests/playdvi.2 tests/playnot.2 tests/playsel.2 \
+ tests/playtate.dvi tests/playbook.3 tests/playbook.4 \
+ tests/playconc.3 tests/playdvi.3 tests/playsel.3
+DISTCLEANFILES = play*.2 play*.3 play*.4 play*.dvi
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
diff --git a/Build/source/texk/seetexk/dvibook.c b/Build/source/texk/seetexk/dvibook.c
index 747952c1657..3c590e0478f 100644
--- a/Build/source/texk/seetexk/dvibook.c
+++ b/Build/source/texk/seetexk/dvibook.c
@@ -107,6 +107,10 @@ int UseThisPage; /* true => current page is selected */
i32 InputPageNumber; /* current absolute page in old DVI file */
int NumberOfOutputPages; /* number of pages in new DVI file */
+#ifdef ASCIIPTEX
+int ptexdvi; /* true if dvi file is extended (TATEKUMI) */
+int inverse; /* true if 'right-hand side binding' */
+#endif
i32 Numerator; /* numerator from DVI file */
i32 Denominator; /* denominator from DVI file */
@@ -142,6 +146,9 @@ static void WriteFont(struct fontinfo *fi);
static void PutFontSelector(i32 index);
static void ScanDVIFile(void);
static void HandleDVIFile(void);
+#ifdef ASCIIPTEX
+static void HandleDVIFileRighty(void);
+#endif
static int HandlePage(void);
static void PutEmptyPage(void);
@@ -293,6 +300,11 @@ HandlePostAmble(void)
putbyte(outf, DVI_POSTPOST);
PutLong(outf, StartOfLastPage); /* actually start of postamble */
+#ifdef ASCIIPTEX
+ if(ptexdvi)
+ putbyte(outf, DVI_PTEXVERSION);
+ else
+#endif
putbyte(outf, DVI_VERSION);
putbyte(outf, DVI_FILLER);
putbyte(outf, DVI_FILLER);
@@ -388,10 +400,17 @@ main(int argc, char **argv)
Signature = 0;
+#ifdef ASCIIPTEX
+ inverse = 0;
+#endif
ProgName = *argv;
setbuf(stderr, serrbuf);
+#ifdef ASCIIPTEX
+ while ((c = getopt(argc, argv, "i:o:s:qr")) != EOF) {
+#else
while ((c = getopt(argc, argv, "i:o:s:q")) != EOF) {
+#endif
switch (c) {
case 'q': /* silent */
@@ -420,12 +439,23 @@ main(int argc, char **argv)
error(1, -1,
"-s parameter must be a multiple of 4");
break;
+#ifdef ASCIIPTEX
+ case 'r':
+ inverse = 1;
+ break;
+#endif
case '?':
usage:
+#ifdef ASCIIPTEX
+ (void) fprintf(stderr, "\
+Usage: %s [-s signature] [-q] [-i infile] [-o outfile] [-r] [infile [outfile]]\n",
+ ProgName);
+#else
(void) fprintf(stderr, "\
Usage: %s [-s signature] [-q] [-i infile] [-o outfile] [infile [outfile]]\n",
ProgName);
+#endif
(void) fflush(stderr);
exit(1);
}
@@ -465,10 +495,18 @@ Usage: %s [-s signature] [-q] [-i infile] [-o outfile] [infile [outfile]]\n",
if ((inf = SeekFile(inf)) == NULL) {
error(1, 0, "can't seek file");
}
+#ifdef ASCIIPTEX
+ ptexdvi = 0;
+#endif
InputPageNumber = 0;
StartOfLastPage = -1;
HandlePreAmble();
ScanDVIFile();
+#ifdef ASCIIPTEX
+ if(inverse)
+ HandleDVIFileRighty();
+ else
+#endif
HandleDVIFile();
HandlePostAmble();
if (!SFlag)
@@ -659,7 +697,12 @@ char oplen[128] = {
0, /* DVI_PRE */
0, /* DVI_POST */
0, /* DVI_POSTPOST */
+#ifdef ASCIIPTEX
+ 0, 0, 0, 0, 0, /* 250 .. 254 */
+ 0, /* DVI_DIR */
+#else
0, 0, 0, 0, 0, 0, /* 250 .. 255 */
+#endif
};
/*
@@ -710,11 +753,53 @@ HandleDVIFile(void)
"can't seek page %d", ActualPage+1);
HandlePage();
} else
+ PutEmptyPage();
+ }
+ if (fseek(inf, StartOfPage[InputPageNumber]+1, 0) == -1)
+ error(1, -1, "can't seek last page");
+}
+
+#ifdef ASCIIPTEX
+/*
+ * Here we read the input DVI file and write relevant pages to the
+ * output DVI file. We also keep track of font changes, handle font
+ * definitions, and perform some other housekeeping.
+ */
+static void
+HandleDVIFileRighty(void)
+{
+ int CurrentPage, ActualPage, MaxPage;
+
+ UseThisPage = 1;
+
+ MaxPage = InputPageNumber + (4-InputPageNumber%4)%4;
+
+ if (!Signature)
+ Signature = MaxPage;
+ for (CurrentPage = 0; CurrentPage < MaxPage; CurrentPage++) {
+ ActualPage = CurrentPage - CurrentPage%Signature;
+ switch (CurrentPage%4) {
+ case 1: /* case 0: */
+ case 2: /* case 3: */
+ ActualPage += Signature-1-(CurrentPage%Signature)/2;
+ break;
+ case 0: /* case 1: */
+ case 3: /* case 2: */
+ ActualPage += (CurrentPage%Signature)/2;
+ break;
+ }
+ if (ActualPage < InputPageNumber) {
+ if (fseek(inf, StartOfPage[ActualPage], 0) == -1)
+ error(1, -1,
+ "can't seek page %d", ActualPage+1);
+ HandlePage();
+ } else
PutEmptyPage();
}
if (fseek(inf, StartOfPage[InputPageNumber]+1, 0) == -1)
error(1, -1, "can't seek last page");
}
+#endif
static int
HandlePage(void)
@@ -845,6 +930,16 @@ HandlePage(void)
HandleFontDef(p);
continue;
+#ifdef ASCIIPTEX
+ case DT_DIR:
+ ptexdvi = 1;
+
+ putbyte(outf, c);
+ putbyte(outf, p);
+ CurrentPosition += 2;
+ continue;
+#endif
+
default:
panic("HandleDVIFile DVI_DT(%d)=%d",
c, DVI_DT(c));
diff --git a/Build/source/texk/seetexk/dvibook.man b/Build/source/texk/seetexk/dvibook.man
index 01ee1d6b05e..715c9be766b 100644
--- a/Build/source/texk/seetexk/dvibook.man
+++ b/Build/source/texk/seetexk/dvibook.man
@@ -10,6 +10,8 @@ dvibook \- rearrange pages in DVI file into signatures
] [
.B \-s\fI<num>
] [
+.B \-r
+] [
.B \-i
.I infile
] [
@@ -35,6 +37,12 @@ should be a multiple of four. The default is to use one signature for the
whole file. Extra blank sides will be added if the file does not contain a
multiple of four pages.
.PP
+By default, dvibook rearranges the pages into left\-hand side binding
+signatures; the
+.I \-r
+option switches to right\-hand side binding signatures. This might be useful
+for pTeX vertical writing (tate\-kumi) documents.
+.PP
Dvibook normally prints the page numbers of the pages rearranged; the
.I \-q
option suppresses this.
diff --git a/Build/source/texk/seetexk/dviclass.c b/Build/source/texk/seetexk/dviclass.c
index 5c3b3dd63c9..d9b68b0655f 100644
--- a/Build/source/texk/seetexk/dviclass.c
+++ b/Build/source/texk/seetexk/dviclass.c
@@ -28,6 +28,9 @@
/* shorthand---in lowercase for contrast (read on!) */
#define four(x) x, x, x, x
+#ifdef ASCIIPTEX
+#define five(x) four(x), x
+#endif /* ASCIIPTEX */
#define six(x) four(x), x, x
#define sixteen(x) four(x), four(x), four(x), four(x)
#define sixty_four(x) sixteen(x), sixteen(x), sixteen(x), sixteen(x)
@@ -72,7 +75,12 @@ char dvi_oplen[256] = {
DPL_NONE, /* DVI_PRE */
DPL_NONE, /* DVI_POST */
DPL_NONE, /* DVI_POSTPOST */
+#ifdef ASCIIPTEX
+ five(DPL_NONE), /* 250 through 254 */
+ DPL_UNS1, /* DVI_DIR */
+#else /* !ASCIIPTEX */
six(DPL_NONE) /* 250 through 255 */
+#endif /* !ASCIIPTEX */
};
char dvi_dt[256] = {
@@ -104,5 +112,10 @@ char dvi_dt[256] = {
DT_PRE, /* DVI_PRE */
DT_POST, /* DVI_POST */
DT_POSTPOST, /* DVI_POSTPOST */
+#ifdef ASCIIPTEX
+ five(DT_UNDEF), /* 250 through 254 */
+ DT_DIR, /* DVI_DIR */
+#else /* !ASCIIPTEX */
six(DT_UNDEF) /* 250 through 255 */
+#endif /* !ASCIIPTEX */
};
diff --git a/Build/source/texk/seetexk/dviclass.h b/Build/source/texk/seetexk/dviclass.h
index 3fa69fbafd0..62e96da6fb2 100644
--- a/Build/source/texk/seetexk/dviclass.h
+++ b/Build/source/texk/seetexk/dviclass.h
@@ -61,7 +61,12 @@
#define DT_PRE 24
#define DT_POST 25
#define DT_POSTPOST 26
+#ifdef ASCIIPTEX
+#define DT_DIR 27
+#define DT_UNDEF 28
+#else /* !ASCIIPTEX */
#define DT_UNDEF 27
+#endif /* !ASCIIPTEX */
/*
* Symbolic names for parameter lengths, obtained via the macro
diff --git a/Build/source/texk/seetexk/dvicodes.h b/Build/source/texk/seetexk/dvicodes.h
index 34d7ba9606c..8b281252242 100644
--- a/Build/source/texk/seetexk/dvicodes.h
+++ b/Build/source/texk/seetexk/dvicodes.h
@@ -24,6 +24,11 @@
#define DVI_VERSION 2 /* version number that should appear in
pre- and post-ambles */
+#ifdef ASCIIPTEX
+#define DVI_PTEXVERSION 3 /* version number that should appear in
+ post-ambles which are contained in
+ dvi files using DIR command*/
+#endif /* ASCIIPTEX */
#define DVI_SET1 128 /* set character, 1 byte param */
#define DVI_SET2 129 /* set character, 2 byte param */
@@ -38,8 +43,13 @@
#define DVI_NOP 138 /* no-op */
#define DVI_BOP 139 /* begin page */
#define DVI_EOP 140 /* end page */
+#ifdef ASCIIPTEX
+#define DVI_PUSH 141 /* push h,v,w,x,y,z,d */
+#define DVI_POP 142 /* pop h,v,w,x,y,z,d */
+#else /* !ASCIIPTEX */
#define DVI_PUSH 141 /* push h,v,w,x,y,z */
#define DVI_POP 142 /* pop h,v,w,x,y,z */
+#endif /* !ASCIIPTEX */
#define DVI_RIGHT1 143 /* move right, 1 byte signed param */
#define DVI_RIGHT2 144 /* move right, 2 byte signed param */
#define DVI_RIGHT3 145 /* etc */
@@ -85,4 +95,7 @@
#define DVI_PRE 247 /* preamble */
#define DVI_POST 248 /* postamble */
#define DVI_POSTPOST 249 /* end of postamble */
+#ifdef ASCIIPTEX
+#define DVI_DIR 255 /* d (direction) = 1 byte signed param */
+#endif /* ASCIIPTEX */
#define DVI_FILLER 223 /* filler bytes at end of dvi file */
diff --git a/Build/source/texk/seetexk/dviconcat.c b/Build/source/texk/seetexk/dviconcat.c
index dad528e4806..9082c1d5676 100644
--- a/Build/source/texk/seetexk/dviconcat.c
+++ b/Build/source/texk/seetexk/dviconcat.c
@@ -85,6 +85,9 @@ long StartOfLastPage; /* The file position just before we started
long CurrentPosition; /* The current position of the file */
int NumberOfOutputPages; /* number of pages in new DVI file */
+#ifdef ASCIIPTEX
+int ptexdvi; /* true => dvi format is extended (TATEKUMI) */
+#endif /* ASCIIPTEX */
i32 Numerator; /* numerator from current DVI file */
i32 Denominator; /* denominator from current DVI file */
@@ -225,6 +228,11 @@ WritePostAmble(void)
putbyte(outf, DVI_POSTPOST);
PutLong(outf, postpos);
+#ifdef ASCIIPTEX
+ if (ptexdvi)
+ putbyte(outf, DVI_PTEXVERSION);
+ else
+#endif /* ASCIIPTEX */
putbyte(outf, DVI_VERSION);
putbyte(outf, DVI_FILLER);
putbyte(outf, DVI_FILLER);
@@ -372,6 +380,9 @@ doit(const char *name, FILE *fp)
{
static int started;
+#ifdef ASCIIPTEX
+ ptexdvi = 0;
+#endif
DVIFileName = name;
inf = fp;
if (HandlePreAmble(started ? 0 : 1))
@@ -664,7 +675,12 @@ char oplen[128] = {
0, /* DVI_PRE */
0, /* DVI_POST */
0, /* DVI_POSTPOST */
+#ifdef ASCIIPTEX
+ 0, 0, 0, 0, 0, /* 250 .. 254 */
+ 0, /* DVI_DIR */
+#else /* !ASCIIPTEX */
0, 0, 0, 0, 0, 0, /* 250 .. 255 */
+#endif /* !ASCIIPTEX */
};
/*
@@ -751,6 +767,16 @@ HandleDVIFile(void)
HandleFontDef(p);
continue;
+#ifdef ASCIIPTEX
+ case DT_DIR:
+ ptexdvi = 1;
+
+ putbyte(outf, c);
+ putbyte(outf, p);
+ CurrentPosition += 2;
+ continue;
+#endif /* ASCIIPTEX */
+
default:
panic("HandleDVIFile DVI_DT(%d)=%d",
c, DVI_DT(c));
diff --git a/Build/source/texk/seetexk/dviselect.c b/Build/source/texk/seetexk/dviselect.c
index 5f8a79d9aa7..1f401072503 100644
--- a/Build/source/texk/seetexk/dviselect.c
+++ b/Build/source/texk/seetexk/dviselect.c
@@ -145,6 +145,9 @@ long StartOfLastPage; /* The file position just before we started
long CurrentPosition; /* The current position of the file */
int UseThisPage; /* true => current page is selected */
+#ifdef ASCIIPTEX
+int ptexdvi; /* true => dvi format is extended (TATEKUMI) */
+#endif /* ASCIIPTEX */
i32 InputPageNumber; /* current absolute page in old DVI file */
int NumberOfOutputPages; /* number of pages in new DVI file */
@@ -396,6 +399,11 @@ HandlePostAmble(void)
putbyte(outf, DVI_POSTPOST);
PutLong(outf, StartOfLastPage); /* actually start of postamble */
+#ifdef ASCIIPTEX
+ if (ptexdvi)
+ putbyte(outf, DVI_PTEXVERSION);
+ else
+#endif /* ASCIIPTEX */
putbyte(outf, DVI_VERSION);
putbyte(outf, DVI_FILLER);
putbyte(outf, DVI_FILLER);
@@ -585,6 +593,9 @@ Usage: %s [-s] [-i infile] [-o outfile] pages [...] [infile [outfile]]\n",
StartOfLastPage = -1;
ReadPreAmble();
+#ifdef ASCIIPTEX
+ ptexdvi = 0;
+#endif /* ASCIIPTEX */
HandleDVIFile();
HandlePostAmble();
if (NumberOfOutputPages > 0) {
@@ -952,7 +963,12 @@ char oplen[128] = {
0, /* DVI_PRE */
0, /* DVI_POST */
0, /* DVI_POSTPOST */
+#ifdef ASCIIPTEX
+ 0, 0, 0, 0, 0, /* 250 .. 254 */
+ 0, /* DVI_DIR */
+#else /* !ASCIIPTEX */
0, 0, 0, 0, 0, 0, /* 250 .. 255 */
+#endif /* !ASCIIPTEX */
};
/*
@@ -1089,6 +1105,18 @@ HandleDVIFile(void)
HandleFontDef(p);
continue;
+#ifdef ASCIIPTEX
+ case DT_DIR:
+ if (!UseThisPage)
+ continue;
+ ptexdvi = 1;
+
+ putbyte(outf, c);
+ putbyte(outf, p);
+ CurrentPosition += 2;
+ continue;
+#endif /* ASCIIPTEX */
+
default:
panic("HandleDVIFile DVI_DT(%d)=%d",
c, DVI_DT(c));
diff --git a/Build/source/texk/seetexk/dvitodvi.c b/Build/source/texk/seetexk/dvitodvi.c
index deffc3146bd..91c94d75b58 100644
--- a/Build/source/texk/seetexk/dvitodvi.c
+++ b/Build/source/texk/seetexk/dvitodvi.c
@@ -114,6 +114,9 @@ int WritingPage; /* true while writing a page */
i32 InputPageNumber; /* current absolute page in old DVI file */
int NumberOfOutputPages; /* number of pages in new DVI file */
+#ifdef ASCIIPTEX
+int ptexdvi; /* true if dvi file is extended (TATEKUMI) */
+#endif
i32 Numerator; /* numerator from DVI file */
i32 Denominator; /* denominator from DVI file */
@@ -520,6 +523,11 @@ HandlePostAmble(void)
putbyte(outf, DVI_POSTPOST);
PutLong(outf, StartOfLastPage); /* actually start of postamble */
+#ifdef ASCIIPTEX
+ if(ptexdvi)
+ putbyte(outf, DVI_PTEXVERSION);
+ else
+#endif
putbyte(outf, DVI_VERSION);
putbyte(outf, DVI_FILLER);
putbyte(outf, DVI_FILLER);
@@ -708,6 +716,9 @@ Usage: %s [-q] [-i infile] [-o outfile] [-w width] [-h height] <pagespecs> [infi
error(1, 0, "can't seek file");
}
+#ifdef ASCIIPTEX
+ ptexdvi = 0;
+#endif
InputPageNumber = 0;
StartOfLastPage = -1;
HandlePreAmble();
@@ -914,7 +925,12 @@ char oplen[128] = {
0, /* DVI_PRE */
0, /* DVI_POST */
0, /* DVI_POSTPOST */
+#ifdef ASCIIPTEX
+ 0, 0, 0, 0, 0, /* 250 .. 254 */
+ 0, /* DVI_DIR */
+#else
0, 0, 0, 0, 0, 0, /* 250 .. 255 */
+#endif
};
static int
@@ -1046,6 +1062,18 @@ HandlePage(int first, int last, i32 hoffset, i32 voffset)
HandleFontDef(p);
continue;
+#ifdef ASCIIPTEX
+ case DT_DIR:
+ if (!UseThisPage)
+ continue;
+ ptexdvi = 1;
+
+ putbyte(outf, c);
+ putbyte(outf, p);
+ CurrentPosition += 2;
+ continue;
+#endif
+
default:
panic("HandleDVIFile DVI_DT(%d)=%d",
c, DVI_DT(c));
diff --git a/Build/source/texk/seetexk/seetexk.test b/Build/source/texk/seetexk/seetexk.test
index af3c7d011ae..0fb9f1b0328 100755
--- a/Build/source/texk/seetexk/seetexk.test
+++ b/Build/source/texk/seetexk/seetexk.test
@@ -41,8 +41,30 @@ cat $srcdir/tests/play.dvi | ./dviselect =5:15 >playsel.dvi \
&& diff playsel.2 $srcdir/tests/playsel.2 \
|| exit 1
+rm -rf play*
+./dviselect =25 <$srcdir/tests/play.dvi >playsel.dvi \
+ 2>playsel.2 \
+ && exit 1
+ touch playnot.dvi \
+ && diff playsel.dvi playnot.dvi \
+ && diff playsel.2 $srcdir/tests/playnot.2 \
+ || exit 1
+
+rm -rf play*
+./dviselect =5:15 <$srcdir/tests/play.dvi >playsel.dvi \
+ 2>playsel.2 \
+ && diff playsel.2 $srcdir/tests/playsel.2 \
+ || exit 1
+
echo dviselect with stdin and stdout tests OK
+./dviselect =5:15 $srcdir/tests/playtate.dvi playselt.dvi \
+ 2>playsel.3 \
+ && diff playsel.3 $srcdir/tests/playsel.3 \
+ || exit 1
+
+echo dviselect pTeX tests OK
+
./dvibook -s4 playsel.dvi playbook.dvi \
2>playbook.2 \
&& diff playbook.2 $srcdir/tests/playbook.2 \
@@ -51,14 +73,31 @@ echo dviselect with stdin and stdout tests OK
echo dvibook tests OK
rm -f playbook.2
-
cat playsel.dvi | ./dvibook -s4 >playbook.dvi \
2>playbook.2 \
&& diff playbook.2 $srcdir/tests/playbook.2 \
|| exit 1
+rm -f playbook.2
+./dvibook -s4 <playsel.dvi >playbook.dvi \
+ 2>playbook.2 \
+ && diff playbook.2 $srcdir/tests/playbook.2 \
+ || exit 1
+
echo dvibook with stdin and stdout tests OK
+./dvibook -s4 playselt.dvi playbook.dvi \
+ 2>playbook.3 \
+ && diff playbook.3 $srcdir/tests/playbook.3 \
+ || exit 1
+
+./dvibook -r -s4 playselt.dvi playbook.dvi \
+ 2>playbook.4 \
+ && diff playbook.4 $srcdir/tests/playbook.4 \
+ || exit 1
+
+echo dvibook pTeX tests OK
+
./dviselect =5:7 $srcdir/tests/play.dvi playsel1.dvi \
2>playconc.2 \
&& ./dviselect 23:25 $srcdir/tests/play.dvi playsel2.dvi \
@@ -70,6 +109,17 @@ echo dvibook with stdin and stdout tests OK
echo dviconcat tests OK
+./dviselect =5:7 $srcdir/tests/playtate.dvi playsel1.dvi \
+ 2>playconc.3 \
+ && ./dviselect 23:25 $srcdir/tests/playtate.dvi playsel2.dvi \
+ 2>>playconc.3 \
+ && ./dviconcat -o playconc.dvi playsel2.dvi playsel1.dvi \
+ 2>>playconc.3 \
+ && diff playconc.3 $srcdir/tests/playconc.3 \
+ || exit 1
+
+echo dviconcat pTeX tests OK
+
./dvitodvi '4:500@0+1(16.5cm,0)+2(0,28cm)+3(16.5cm,28cm)' playsel.dvi playdvi.dvi \
2>playdvi.2 \
&& diff playdvi.2 $srcdir/tests/playdvi.2 \
@@ -78,11 +128,23 @@ echo dviconcat tests OK
echo dvitodvi tests OK
rm -f playdvi.2
-
cat playsel.dvi | ./dvitodvi '4:500@0+1(16.5cm,0)+2(0,28cm)+3(16.5cm,28cm)' -o playdvi.dvi \
2>playdvi.2 \
&& diff playdvi.2 $srcdir/tests/playdvi.2 \
|| exit 1
+rm -f playdvi.2
+./dvitodvi '4:500@0+1(16.5cm,0)+2(0,28cm)+3(16.5cm,28cm)' -o playdvi.dvi <playsel.dvi \
+ 2>playdvi.2 \
+ && diff playdvi.2 $srcdir/tests/playdvi.2 \
+ || exit 1
+
echo dvitodvi reading stdin tests OK
+./dvitodvi '4:500@0+1(16.5cm,0)+2(0,28cm)+3(16.5cm,28cm)' playselt.dvi playdvi.dvi \
+ 2>playdvi.3 \
+ && diff playdvi.3 $srcdir/tests/playdvi.3 \
+ || exit 1
+
+echo dvitodvi pTeX tests OK
+
diff --git a/Build/source/texk/seetexk/tests/playbook.3 b/Build/source/texk/seetexk/tests/playbook.3
new file mode 100644
index 00000000000..4ba522ffffb
--- /dev/null
+++ b/Build/source/texk/seetexk/tests/playbook.3
@@ -0,0 +1,2 @@
+[18] [15] [16] [17] [22] [19] [20] [21] [*] [23] [24] [25]
+Wrote 12 pages, 1520 bytes
diff --git a/Build/source/texk/seetexk/tests/playbook.4 b/Build/source/texk/seetexk/tests/playbook.4
new file mode 100644
index 00000000000..303d2060246
--- /dev/null
+++ b/Build/source/texk/seetexk/tests/playbook.4
@@ -0,0 +1,2 @@
+[15] [18] [17] [16] [19] [22] [21] [20] [23] [*] [25] [24]
+Wrote 12 pages, 1520 bytes
diff --git a/Build/source/texk/seetexk/tests/playconc.3 b/Build/source/texk/seetexk/tests/playconc.3
new file mode 100644
index 00000000000..a12dc68d059
--- /dev/null
+++ b/Build/source/texk/seetexk/tests/playconc.3
@@ -0,0 +1,5 @@
+[15] [16] [17]
+Wrote 3 pages, 500 bytes
+[23] [24] [25]
+Wrote 3 pages, 512 bytes
+Wrote 6 pages, 844 bytes
diff --git a/Build/source/texk/seetexk/tests/playdvi.3 b/Build/source/texk/seetexk/tests/playdvi.3
new file mode 100644
index 00000000000..ef5c90c91da
--- /dev/null
+++ b/Build/source/texk/seetexk/tests/playdvi.3
@@ -0,0 +1,2 @@
+[15] [19] [23]
+Wrote 3 pages, 1108 bytes
diff --git a/Build/source/texk/seetexk/tests/playsel.3 b/Build/source/texk/seetexk/tests/playsel.3
new file mode 100644
index 00000000000..58c2f2c1102
--- /dev/null
+++ b/Build/source/texk/seetexk/tests/playsel.3
@@ -0,0 +1,2 @@
+[15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25]
+Wrote 11 pages, 1408 bytes
diff --git a/Build/source/texk/seetexk/tests/playtate.dvi b/Build/source/texk/seetexk/tests/playtate.dvi
new file mode 100644
index 00000000000..5126e2d2626
--- /dev/null
+++ b/Build/source/texk/seetexk/tests/playtate.dvi
Binary files differ