mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-28 12:26:59 +00:00
Add dtl tools to 3rdparty/
We need to compile our own (patched) version of the app on Windows. See #11325
This commit is contained in:
parent
eea4ef9b6e
commit
d6f9fdcaef
148
3rdparty/dtl/README
vendored
Normal file
148
3rdparty/dtl/README
vendored
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
This file is public domain.
|
||||||
|
Originally written 1995, Geoffrey Tobin.
|
||||||
|
The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
|
||||||
|
This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
|
||||||
|
|
||||||
|
README for DTL package - Thu 9 March 1995
|
||||||
|
-----------------------------------------
|
||||||
|
Author: Geoffrey Tobin <G.Tobin@ee.latrobe.edu.au>
|
||||||
|
Version: 0.6.1
|
||||||
|
CTAN Archive-path: dviware/dtl
|
||||||
|
Brief Description:
|
||||||
|
DTL (DVI Text Language) files are equivalent to TeX's DVI files,
|
||||||
|
but are humanly readable, instead of binary. Two programs are
|
||||||
|
provided to translate between DVI and DTL: dv2dt, dt2dv.
|
||||||
|
dt2dv warns if byte addresses or string lengths recorded in a DTL
|
||||||
|
file are incorrect, then overrides them. This makes DTL files
|
||||||
|
editable. It also allows quoted apostrophes (\') and quoted quotes
|
||||||
|
(\\) in strings. The current DTL variety, sequences-6, separates
|
||||||
|
font paths into directory and font, which makes them freely editable.
|
||||||
|
In this release, DTL line numbers are correctly calculated, and three
|
||||||
|
memory leaks have been fixed.
|
||||||
|
Keywords: dvi, TeX
|
||||||
|
Includes:
|
||||||
|
Makefile README dt2dv.c dtl.h dv2dt.c
|
||||||
|
man2ps dtl.doc dvi.doc dt2dv.man dv2dt.man
|
||||||
|
hello.tex example.tex tripvdu.tex edited.txt
|
||||||
|
|
||||||
|
Motivation:
|
||||||
|
|
||||||
|
When TeX has typeset a document, it writes its handiwork to a DVI
|
||||||
|
file, for DVI processing software (such as viewers, printer drivers,
|
||||||
|
dvidvi, and dvicopy) to read.
|
||||||
|
|
||||||
|
The file dvi.doc lists the DVI file commands, with their opcodes
|
||||||
|
(byte values), nominal command names, arguments, and meanings. For a
|
||||||
|
detailed description of DVI file structure, see one of these:
|
||||||
|
1. Donald E. Knuth's book _TeX: The Program_;
|
||||||
|
2. The file tex.web, which contains source and documentation for TeX:
|
||||||
|
CTAN: systems/knuth/tex/tex.web
|
||||||
|
3. The source for Knuth's dvitype program:
|
||||||
|
CTAN: systems/knuth/texware/dvitype.web
|
||||||
|
4. Joachim Schrod's DVI drivers standard document, the relevant part
|
||||||
|
of which is at
|
||||||
|
CTAN: dviware/driv-standard/level-0
|
||||||
|
|
||||||
|
Sometimes human beings are interested to see exactly what TeX has
|
||||||
|
produced, for example when viewing or printing of the DVI file gives
|
||||||
|
unexpected results. However, a DVI file is a compact binary
|
||||||
|
representation, so we need software to display its contents.
|
||||||
|
|
||||||
|
Binary file editors, when available, can show the DVI bytes, but not
|
||||||
|
their meanings, except for the portions that represent embedded text.
|
||||||
|
In particular, the command names are not shown, and the command
|
||||||
|
boundaries are not respected.
|
||||||
|
|
||||||
|
By contrast, Knuth's dvitype program is designed as an example of a
|
||||||
|
DVI driver. However, dvitype is inconvenient for studying the DVI
|
||||||
|
file alone, for the following reasons:
|
||||||
|
1. Being a DVI driver, dvitype endeavors to read the TFM font metric
|
||||||
|
files referenced in the DVI file. If a TFM file is absent, dvitype
|
||||||
|
quits with an error message.
|
||||||
|
2. When it starts, it prompts the user interactively for each of a
|
||||||
|
series of options.
|
||||||
|
3. Even the least verbose option gives masses of information that is
|
||||||
|
not contained in the DVI file, coming instead from a combination of
|
||||||
|
the data in the DVI file and TFM files.
|
||||||
|
4. It does NOT show the DVI information in a way that accurately
|
||||||
|
reflects the structure of the DVI file.
|
||||||
|
5. Its output, if redirected to a file, produces a very large file.
|
||||||
|
6. There is no automated procedure for converting the output of
|
||||||
|
dvitype back to a DVI file, and doing it by hand is totally
|
||||||
|
unreasonable.
|
||||||
|
|
||||||
|
The first disadvantage is a killer if a TFM file is absent.
|
||||||
|
Disadvantages two to four make dvitype very inconvenient for studying
|
||||||
|
a DVI file. The fifth problem makes dvitype's output tedious,
|
||||||
|
disk-hungry (so one deletes it almost immediately), and unsuitable for
|
||||||
|
file transfer.
|
||||||
|
|
||||||
|
The sixth disadvantage of dvitype is important to those people who are
|
||||||
|
interested in editing DVI files. Since the DVI files refer explicitly
|
||||||
|
to their own internal byte addresses, it's very easy to mess up a DVI
|
||||||
|
file if one were to try to edit it directly, even apart from the problem
|
||||||
|
of how to recognise a command.
|
||||||
|
|
||||||
|
So an exact, concise, textual representation of a DVI file is needed,
|
||||||
|
but dvitype does not produce one.
|
||||||
|
|
||||||
|
Resolution:
|
||||||
|
|
||||||
|
Therefore, working from Joachim Schrod's description, I designed DTL
|
||||||
|
and its conversion programs dv2dt (DVI -> DTL) and dt2dv (DTL -> DVI),
|
||||||
|
which are provided as C sources:
|
||||||
|
|
||||||
|
dtl.h
|
||||||
|
dv2dt.c
|
||||||
|
dt2dv.c
|
||||||
|
|
||||||
|
Although I was motivated by the TFM <-> PL conversion provided by
|
||||||
|
Knuth's tftopl and pltotf programs, I deliberately designed DTL to be
|
||||||
|
a much more concise and literal translation than the `property list'
|
||||||
|
structure exemplified by PL. The result is that a DTL file is
|
||||||
|
typically three times the size of its equivalent DVI file. The
|
||||||
|
document dtl.doc lists the correspondence between the DTL command
|
||||||
|
names and the (nominal) DVI command names.
|
||||||
|
|
||||||
|
A clear advantage of an exact two-way conversion is that we can check
|
||||||
|
(and prove) whether the converters worked truly on a given DVI file.
|
||||||
|
The provided plain TeX files:
|
||||||
|
example.tex
|
||||||
|
tripvdu.tex
|
||||||
|
can be used to test whether the compiled programs are behaving
|
||||||
|
sensibly. Whereas example.tex is a simple document that uses a
|
||||||
|
variety of plain TeX commands, tripvdu.tex provides a kind of
|
||||||
|
`trip test' for DVI processor programs. Both documents are taken,
|
||||||
|
with permission, from Andrew K. Trevorrow's dvitovdu (alias dvi2vdu)
|
||||||
|
distribution (and are also part of the dvgt viewer distribution).
|
||||||
|
|
||||||
|
The Makefile might have to be edited for your site, as it assumes
|
||||||
|
gcc for your C compiler. Makefile compiles dv2dt and dt2dv, then
|
||||||
|
runs tex on example.tex and tripvdu.tex, and also converts the
|
||||||
|
resulting DVI files to DTL files, back to DVI files (with a change
|
||||||
|
of name), then back again to DTL files, so that the results can be
|
||||||
|
compared using a textual differencing program. (Many computer systems
|
||||||
|
have such a program; on unix, as assumed by Makefile, this is named
|
||||||
|
`diff'; ms-dos has one named `comp'.) This should produce a
|
||||||
|
zero-length .dif file for each document, proving that the two DTL
|
||||||
|
files are identical.
|
||||||
|
|
||||||
|
A keen tester might also use a binary difference program on the DVI
|
||||||
|
files, to check that they are identical, as they need to be. (On unix
|
||||||
|
systems, the `diff' program suffices for that purpose.)
|
||||||
|
|
||||||
|
Note:
|
||||||
|
|
||||||
|
In representing numeric quantities, I have mainly opted to use
|
||||||
|
decimal notation, as this is how most of us are trained to think.
|
||||||
|
However, for the checksums in the `fd' (font definition) commands, I
|
||||||
|
chose octal notation, as this is used for checksums in Knuth's PL
|
||||||
|
files, against which DVI files must be compared when a DVI driver
|
||||||
|
loads a font.
|
||||||
|
|
||||||
|
Caveat:
|
||||||
|
|
||||||
|
The length of DTL commands is limited by the size of the line buffer
|
||||||
|
in dt2dv.c.
|
||||||
|
|
||||||
|
End of README
|
2856
3rdparty/dtl/dt2dv.c
vendored
Normal file
2856
3rdparty/dtl/dt2dv.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
160
3rdparty/dtl/dt2dv.man
vendored
Normal file
160
3rdparty/dtl/dt2dv.man
vendored
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
.\" This file is public domain.
|
||||||
|
.\" Originally written 1995, Geoffrey Tobin.
|
||||||
|
.\" The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
|
||||||
|
.\" This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
|
||||||
|
.\" ====================================================================
|
||||||
|
.\" @Troff-man-file{
|
||||||
|
.\" author = "Nelson H. F. Beebe and Geoffrey R. D. Tobin",
|
||||||
|
.\" version = "0.6.0",
|
||||||
|
.\" date = "08 March 1995",
|
||||||
|
.\" time = "19:57:00 GMT +11",
|
||||||
|
.\" filename = "dt2dv.man",
|
||||||
|
.\" address = "Center for Scientific Computing
|
||||||
|
.\" Department of Mathematics
|
||||||
|
.\" University of Utah
|
||||||
|
.\" Salt Lake City, UT 84112
|
||||||
|
.\" USA",
|
||||||
|
.\" telephone = "+1 801 581 5254",
|
||||||
|
.\" FAX = "+1 801 581 4148",
|
||||||
|
.\" checksum = "03708 156 634 4989",
|
||||||
|
.\" email = "beebe@math.utah.edu (Internet)",
|
||||||
|
.\" codetable = "ISO/ASCII",
|
||||||
|
.\" keywords = "DVI, TeX",
|
||||||
|
.\" supported = "no",
|
||||||
|
.\" docstring = "This file contains the UNIX manual pages
|
||||||
|
.\" for the dt2dv utility, a program for
|
||||||
|
.\" converting a DTL text representation of a TeX
|
||||||
|
.\" DVI file, usually produced by the companion
|
||||||
|
.\" dv2dt utility, back to a binary DVI file.
|
||||||
|
.\"
|
||||||
|
.\" The checksum field above contains a CRC-16
|
||||||
|
.\" checksum as the first value, followed by the
|
||||||
|
.\" equivalent of the standard UNIX wc (word
|
||||||
|
.\" count) utility output of lines, words, and
|
||||||
|
.\" characters. This is produced by Robert
|
||||||
|
.\" Solovay's checksum utility.",
|
||||||
|
.\" }
|
||||||
|
.\" ====================================================================
|
||||||
|
.if t .ds Te T\\h'-0.1667m'\\v'0.20v'E\\v'-0.20v'\\h'-0.125m'X
|
||||||
|
.if n .ds Te TeX
|
||||||
|
.TH DT2DV 1 "08 March 1995" "Version 0.6.0"
|
||||||
|
.\"======================================================================
|
||||||
|
.SH NAME
|
||||||
|
dt2dv \- convert a DTL text representation of a TeX DVI file to a binary DVI file
|
||||||
|
.\"======================================================================
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B dt2dv
|
||||||
|
.RB [ \-debug ]
|
||||||
|
.RB [ \-group ]
|
||||||
|
.RB [ \-si ]
|
||||||
|
.RB [ \-so ]
|
||||||
|
.I [input-DTL-file]
|
||||||
|
.I [output-DVI-file]
|
||||||
|
.PP
|
||||||
|
In the absence of the
|
||||||
|
.B \-si
|
||||||
|
and
|
||||||
|
.B \-so
|
||||||
|
options,
|
||||||
|
both file arguments are
|
||||||
|
.IR required
|
||||||
|
in the order
|
||||||
|
.B input-DTL-file output-DVI-file .
|
||||||
|
But also see the OPTIONS section below.
|
||||||
|
No default file extensions are supplied.
|
||||||
|
.\"======================================================================
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B dt2dv
|
||||||
|
converts a text representation of a \*(Te\& DVI
|
||||||
|
file, usually produced by the companion
|
||||||
|
.BR dv2dt (1)
|
||||||
|
utility, back to a binary DVI file. DTL
|
||||||
|
.RI ( "DVI Text Language" )
|
||||||
|
files can be edited, with care, and then restored
|
||||||
|
to DVI form for processing by any \*(Te\& DVI
|
||||||
|
driver program. In DTL files, font directory names
|
||||||
|
and font names are preceded by a length field,
|
||||||
|
which must be updated if the names are modified.
|
||||||
|
.PP
|
||||||
|
.BR dvitype (1)
|
||||||
|
can also display a textual representation of DVI
|
||||||
|
files, but in some implementations at least, it
|
||||||
|
cannot be used in batch mode, and its output is
|
||||||
|
not well-suited for conversion back to a DVI file.
|
||||||
|
.PP
|
||||||
|
The format of \*(Te\& DVI files is fully described
|
||||||
|
in
|
||||||
|
Donald E. Knuth,
|
||||||
|
.IR "\*(Te\&: The Program" ,
|
||||||
|
Addison-Wesley (1986), ISBN 0-201-13437-3, as well
|
||||||
|
as in the
|
||||||
|
.BR dvitype (1)
|
||||||
|
literate program source code. Brief descriptions
|
||||||
|
of the DTL and DVI formats are given in
|
||||||
|
.BR dv2dt (1).
|
||||||
|
.\"======================================================================
|
||||||
|
.SH OPTIONS
|
||||||
|
.\"-----------------------------------------------
|
||||||
|
.TP \w'\-debug'u+3n
|
||||||
|
.B \-debug
|
||||||
|
Turn on detailed debugging output.
|
||||||
|
.\"-----------------------------------------------
|
||||||
|
.TP
|
||||||
|
.B \-group
|
||||||
|
Expect each DTL command to be in parentheses.
|
||||||
|
.\"-----------------------------------------------
|
||||||
|
.TP
|
||||||
|
.B \-si
|
||||||
|
Read all DTL commands from standard input.
|
||||||
|
.\"-----------------------------------------------
|
||||||
|
.TP
|
||||||
|
.B \-so
|
||||||
|
Write all DVI commands to standard output.
|
||||||
|
.\"======================================================================
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR dv2dt (1),
|
||||||
|
.BR dvitype (1),
|
||||||
|
.BR tex (1).
|
||||||
|
.\"======================================================================
|
||||||
|
.SH FILES
|
||||||
|
.TP \w'\fI*.dvi\fP'u+3n
|
||||||
|
.I *.dvi
|
||||||
|
binary \*(Te\& DVI file.
|
||||||
|
.TP
|
||||||
|
.I *.dtl
|
||||||
|
text representation of a \*(Te\& DVI file in
|
||||||
|
.I "DVI Text Language"
|
||||||
|
format.
|
||||||
|
.\"======================================================================
|
||||||
|
.SH AUTHOR
|
||||||
|
.B dt2dv
|
||||||
|
and
|
||||||
|
.BR dv2dt (1)
|
||||||
|
were written by
|
||||||
|
.RS
|
||||||
|
.nf
|
||||||
|
Geoffrey Tobin
|
||||||
|
Department of Electronic Engineering
|
||||||
|
La Trobe University
|
||||||
|
Bundoora, Victoria 3083
|
||||||
|
Australia
|
||||||
|
Tel: +61 3 479 3736
|
||||||
|
FAX: +61 3 479 3025
|
||||||
|
Email: <G.Tobin@ee.latrobe.edu.au>
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
These manual pages were written primarily by
|
||||||
|
.RS
|
||||||
|
.nf
|
||||||
|
Nelson H. F. Beebe, Ph.D.
|
||||||
|
Center for Scientific Computing
|
||||||
|
Department of Mathematics
|
||||||
|
University of Utah
|
||||||
|
Salt Lake City, UT 84112
|
||||||
|
Tel: +1 801 581 5254
|
||||||
|
FAX: +1 801 581 4148
|
||||||
|
Email: <beebe@math.utah.edu>
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
.\"==============================[The End]==============================
|
82
3rdparty/dtl/dtl.doc
vendored
Normal file
82
3rdparty/dtl/dtl.doc
vendored
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
This file is public domain.
|
||||||
|
Originally written 1995, Geoffrey Tobin.
|
||||||
|
The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
|
||||||
|
This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
|
||||||
|
|
||||||
|
``dtl.doc''
|
||||||
|
Wed 8 March 1995
|
||||||
|
Geoffrey Tobin
|
||||||
|
|
||||||
|
Correspondence between DTL and DVI files.
|
||||||
|
-----------------------------------------
|
||||||
|
|
||||||
|
DTL variety sequences-6, version 0.6.0
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
Note: `DTL' stands for `Device-Independent Text Language', and is an
|
||||||
|
ASCII text representation of a DVI file.
|
||||||
|
|
||||||
|
References for DVI file structure:
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
In this distribution:
|
||||||
|
|
||||||
|
dvi.doc
|
||||||
|
|
||||||
|
In the TeX archives:
|
||||||
|
|
||||||
|
CTAN: dviware/driv-standard/level-0/dvistd0.tex
|
||||||
|
|
||||||
|
"The DVI Driver Standard, Level 0",
|
||||||
|
by The TUG DVI Driver Standards Committee (now defunct)
|
||||||
|
chaired by Joachim Schrod.
|
||||||
|
Appendix A, "Device-Independent File Format",
|
||||||
|
section A.2, "Summary of DVI commands".
|
||||||
|
|
||||||
|
DTL Commands
|
||||||
|
------------
|
||||||
|
|
||||||
|
variety <variety-name> Specifies name of DTL file type.
|
||||||
|
|
||||||
|
Naturally, `variety' has no DVI equivalent.
|
||||||
|
|
||||||
|
The other DTL commands correspond one-to-one with DVI commands, but I
|
||||||
|
have used briefer names (except for `special') than those used in the
|
||||||
|
DVI standards document.
|
||||||
|
|
||||||
|
DTL : DVI
|
||||||
|
|
||||||
|
(text) : series of set_char commands, for printable ASCII text
|
||||||
|
\( : literal ASCII left parenthesis in (text)
|
||||||
|
\) : literal ASCII right parenthesis in (text)
|
||||||
|
\\ : literal ASCII backslash in (text)
|
||||||
|
\" : literal ASCII double quote in (text)
|
||||||
|
\XY : set_char for character with hexadecimal code XY,
|
||||||
|
not in parentheses, but by itself for readability
|
||||||
|
s1, s2, s2, s3 : set, with (1,2,3,4)-byte charcodes
|
||||||
|
sr : set_rule
|
||||||
|
p1, p2, p2, p3 : put, with (1,2,3,4)-byte charcodes
|
||||||
|
pr : put_rule
|
||||||
|
nop : nop (do nothing)
|
||||||
|
bop : bop (beginning of page)
|
||||||
|
eop : eop (end of page)
|
||||||
|
[ : push
|
||||||
|
] : pop
|
||||||
|
r1, r2, r3, r4 : right, with (1,2,3,4)-byte argument
|
||||||
|
w0, w1, w2, w3, w4 : as in DVI
|
||||||
|
x0, x1, x2, x3, x4 : as in DVI
|
||||||
|
d1, d2, d3, d4 : down, with (1,2,3,4)-byte argument
|
||||||
|
y0, y1, y2, y3, y4 : as in DVI
|
||||||
|
z0, z1, z2, z3, z4 : as in DVI
|
||||||
|
fn : fnt_num (set current font to font number in 0 to 63)
|
||||||
|
f1, f2, f3, f4 : fnt (set current font to (1,2,3,4)-byte font number)
|
||||||
|
special : xxx (special commands with (1,2,3,4)-byte string length)
|
||||||
|
fd : fnt_def (assign a number to a named font)
|
||||||
|
pre : preamble
|
||||||
|
post : post (begin postamble)
|
||||||
|
post_post : post_post (end postamble)
|
||||||
|
opcode : undefined DVI command (250 to 255)
|
||||||
|
|
||||||
|
---------------
|
||||||
|
EOF ``dtl.doc''
|
||||||
|
---------------
|
180
3rdparty/dtl/dtl.h
vendored
Normal file
180
3rdparty/dtl/dtl.h
vendored
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
/* dtl.h
|
||||||
|
|
||||||
|
This file is public domain.
|
||||||
|
Originally written 1995, Geoffrey Tobin.
|
||||||
|
The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
|
||||||
|
This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
|
||||||
|
|
||||||
|
- header for dv2dt.c and dt2dv.c, conversion programs
|
||||||
|
for human-readable "DTL" <-> DVI.
|
||||||
|
- (ANSI C) version 0.6.0 - 18:31 GMT +11 Wed 8 March 1995
|
||||||
|
- author: Geoffrey Tobin G.Tobin@ee.latrobe.edu.au
|
||||||
|
- patch: Michal Tomczak-Jaegermann ntomczak@vm.ucs.ualberta.ca
|
||||||
|
- Reference: "The DVI Driver Standard, Level 0",
|
||||||
|
by The TUG DVI Driver Standards Committee.
|
||||||
|
Appendix A, "Device-Independent File Format".
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* variety of DTL produced */
|
||||||
|
#define VARIETY "sequences-6"
|
||||||
|
|
||||||
|
/* version of DTL programs */
|
||||||
|
#define VERSION "0.6.0"
|
||||||
|
|
||||||
|
/* Test for ANSI/ISO Standard C */
|
||||||
|
#if (defined(__cplusplus) || defined(__STDC__) || defined(c_plusplus))
|
||||||
|
#define STDC 1
|
||||||
|
#else
|
||||||
|
#define STDC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Version (Traditional or ANSI) of C affects prototype and type definitions */
|
||||||
|
#if STDC
|
||||||
|
#define ARGS(parenthesized_list) parenthesized_list
|
||||||
|
#else /* NOT STDC */
|
||||||
|
#define ARGS(parenthesized_list) ()
|
||||||
|
#endif /* NOT STDC */
|
||||||
|
|
||||||
|
#if STDC
|
||||||
|
#define Void void
|
||||||
|
#define VOID void
|
||||||
|
#define FILE_BEGIN SEEK_SET
|
||||||
|
#else /* NOT STDC */
|
||||||
|
#define Void int
|
||||||
|
#define VOID
|
||||||
|
#define FILE_BEGIN 0
|
||||||
|
#endif /* NOT STDC */
|
||||||
|
|
||||||
|
/* types to store 4 byte signed and unsigned integers */
|
||||||
|
typedef long S4;
|
||||||
|
typedef unsigned long U4;
|
||||||
|
/* scanf and printf formats to read or write those */
|
||||||
|
#define SF4 "%ld"
|
||||||
|
#define UF4 "%lu"
|
||||||
|
/* 4 byte hexadecimal */
|
||||||
|
/* #define XF4 "%04lx" */
|
||||||
|
#define XF4 "%lx"
|
||||||
|
/* 4 byte octal */
|
||||||
|
#define OF4 "%lo"
|
||||||
|
|
||||||
|
/* type for byte count for DVI file */
|
||||||
|
/* COUNT must be large enough to hold a U4 (unsigned 4 byte) value */
|
||||||
|
typedef U4 COUNT;
|
||||||
|
|
||||||
|
/* size of a TeX and DVI word is 32 bits; in some systems a `long int' is needed */
|
||||||
|
typedef long int word_t;
|
||||||
|
/* format for a DVI word */
|
||||||
|
#define WF "%ld"
|
||||||
|
|
||||||
|
/* string of 8-bit characters for machine: keyboard, screen, memory */
|
||||||
|
|
||||||
|
#define MAXSTRLEN 256
|
||||||
|
typedef char String[MAXSTRLEN+1];
|
||||||
|
|
||||||
|
/* string s of length l and maximum length m */
|
||||||
|
typedef struct {int l; int m; char * s;} Lstring;
|
||||||
|
|
||||||
|
int debug = 0; /* normally, debugging is off */
|
||||||
|
|
||||||
|
/* Is each DTL command parenthesised by a BCOM and an ECOM? */
|
||||||
|
|
||||||
|
int group = 0; /* by default, no grouping */
|
||||||
|
|
||||||
|
/* signals of beginning and end of a command and its arguments */
|
||||||
|
/* these apply only if group is nonzero */
|
||||||
|
|
||||||
|
# define BCOM "{"
|
||||||
|
# define ECOM "}"
|
||||||
|
|
||||||
|
# define BCOM_CHAR '{'
|
||||||
|
# define ECOM_CHAR '}'
|
||||||
|
|
||||||
|
/* beginning and end of a message string */
|
||||||
|
|
||||||
|
#define BMES "'"
|
||||||
|
#define EMES BMES
|
||||||
|
|
||||||
|
#define BMES_CHAR '\''
|
||||||
|
#define EMES_CHAR BMES_CHAR
|
||||||
|
|
||||||
|
/* beginning and end of sequence of font characters */
|
||||||
|
|
||||||
|
#define BSEQ "("
|
||||||
|
#define ESEQ ")"
|
||||||
|
|
||||||
|
#define BSEQ_CHAR '('
|
||||||
|
#define ESEQ_CHAR ')'
|
||||||
|
|
||||||
|
/* escape and quote characters */
|
||||||
|
|
||||||
|
#define ESC_CHAR '\\'
|
||||||
|
#define QUOTE_CHAR '\"'
|
||||||
|
|
||||||
|
/* command names in DTL */
|
||||||
|
|
||||||
|
#define SETCHAR "\\"
|
||||||
|
#define SET "s"
|
||||||
|
#define SET1 "s1"
|
||||||
|
#define SET2 "s2"
|
||||||
|
#define SET3 "s3"
|
||||||
|
#define SET4 "s4"
|
||||||
|
#define SETRULE "sr"
|
||||||
|
#define PUT "p"
|
||||||
|
#define PUT1 "p1"
|
||||||
|
#define PUT2 "p2"
|
||||||
|
#define PUT3 "p3"
|
||||||
|
#define PUT4 "p4"
|
||||||
|
#define PUTRULE "pr"
|
||||||
|
#define NOP "nop"
|
||||||
|
#define BOP "bop"
|
||||||
|
#define EOP "eop"
|
||||||
|
#define PUSH "["
|
||||||
|
#define POP "]"
|
||||||
|
#define RIGHT "r"
|
||||||
|
#define RIGHT1 "r1"
|
||||||
|
#define RIGHT2 "r2"
|
||||||
|
#define RIGHT3 "r3"
|
||||||
|
#define RIGHT4 "r4"
|
||||||
|
#define W "w"
|
||||||
|
#define W0 "w0"
|
||||||
|
#define W1 "w1"
|
||||||
|
#define W2 "w2"
|
||||||
|
#define W3 "w3"
|
||||||
|
#define W4 "w4"
|
||||||
|
#define X "x"
|
||||||
|
#define X0 "x0"
|
||||||
|
#define X1 "x1"
|
||||||
|
#define X2 "x2"
|
||||||
|
#define X3 "x3"
|
||||||
|
#define X4 "x4"
|
||||||
|
#define DOWN "d"
|
||||||
|
#define DOWN1 "d1"
|
||||||
|
#define DOWN2 "d2"
|
||||||
|
#define DOWN3 "d3"
|
||||||
|
#define DOWN4 "d4"
|
||||||
|
#define Y "y"
|
||||||
|
#define Y0 "y0"
|
||||||
|
#define Y1 "y1"
|
||||||
|
#define Y2 "y2"
|
||||||
|
#define Y3 "y3"
|
||||||
|
#define Y4 "y4"
|
||||||
|
#define Z "z"
|
||||||
|
#define Z0 "z0"
|
||||||
|
#define Z1 "z1"
|
||||||
|
#define Z2 "z2"
|
||||||
|
#define Z3 "z3"
|
||||||
|
#define Z4 "z4"
|
||||||
|
#define FONT "f"
|
||||||
|
#define FONT1 "f1"
|
||||||
|
#define FONT2 "f2"
|
||||||
|
#define FONT3 "f3"
|
||||||
|
#define FONT4 "f4"
|
||||||
|
#define FONTDEF "fd"
|
||||||
|
#define FONTNUM "fn"
|
||||||
|
#define SPECIAL "special"
|
||||||
|
#define PRE "pre"
|
||||||
|
#define POST "post"
|
||||||
|
#define POSTPOST "post_post"
|
||||||
|
#define OPCODE "opcode"
|
||||||
|
|
||||||
|
/* end dtl.h */
|
925
3rdparty/dtl/dv2dt.c
vendored
Normal file
925
3rdparty/dtl/dv2dt.c
vendored
Normal file
@ -0,0 +1,925 @@
|
|||||||
|
/* dv2dt - convert DVI file to human-readable "DTL" format.
|
||||||
|
|
||||||
|
This file is public domain.
|
||||||
|
Originally written 1995, Geoffrey Tobin.
|
||||||
|
The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
|
||||||
|
This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
|
||||||
|
|
||||||
|
- (ANSI C) version 0.6.0 - 17:54 GMT +11 Wed 8 March 1995
|
||||||
|
- author: Geoffrey Tobin ecsgrt@luxor.latrobe.edu.au
|
||||||
|
- patch: Michal Tomczak-Jaegermann ntomczak@vm.ucs.ualberta.ca
|
||||||
|
- Reference: "The DVI Driver Standard, Level 0",
|
||||||
|
by The TUG DVI Driver Standards Committee.
|
||||||
|
Appendix A, "Device-Independent File Format".
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* unix version; read from stdin, write to stdout, by default. */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include "dtl.h"
|
||||||
|
|
||||||
|
#define PRINT_BCOM if (group) fprintf (dtl, "%s", BCOM)
|
||||||
|
#define PRINT_ECOM if (group) fprintf (dtl, "%s", ECOM)
|
||||||
|
|
||||||
|
/*
|
||||||
|
operation's:
|
||||||
|
opcode,
|
||||||
|
name,
|
||||||
|
number of args,
|
||||||
|
string of arguments.
|
||||||
|
*/
|
||||||
|
struct op_info_st {int code; char * name; int nargs; char * args; };
|
||||||
|
|
||||||
|
typedef struct op_info_st op_info;
|
||||||
|
|
||||||
|
/*
|
||||||
|
table's:
|
||||||
|
name,
|
||||||
|
first opcode,
|
||||||
|
last opcode,
|
||||||
|
pointer to opcode info.
|
||||||
|
*/
|
||||||
|
struct op_table_st {char * name; int first; int last; op_info * list; };
|
||||||
|
|
||||||
|
typedef struct op_table_st op_table;
|
||||||
|
|
||||||
|
/* Table for opcodes 128 to 170 inclusive. */
|
||||||
|
|
||||||
|
op_info op_info_128_170 [] =
|
||||||
|
{
|
||||||
|
{128, "s1", 1, "1"},
|
||||||
|
{129, "s2", 1, "2"},
|
||||||
|
{130, "s3", 1, "3"},
|
||||||
|
{131, "s4", 1, "-4"},
|
||||||
|
{132, "sr", 2, "-4 -4"},
|
||||||
|
{133, "p1", 1, "1"},
|
||||||
|
{134, "p2", 1, "2"},
|
||||||
|
{135, "p3", 1, "3"},
|
||||||
|
{136, "p4", 1, "-4"},
|
||||||
|
{137, "pr", 2, "-4 -4"},
|
||||||
|
{138, "nop", 0, ""},
|
||||||
|
{139, "bop", 11, "-4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4"},
|
||||||
|
{140, "eop", 0, ""},
|
||||||
|
{141, "[", 0, ""},
|
||||||
|
{142, "]", 0, ""},
|
||||||
|
{143, "r1", 1, "-1"},
|
||||||
|
{144, "r2", 1, "-2"},
|
||||||
|
{145, "r3", 1, "-3"},
|
||||||
|
{146, "r4", 1, "-4"},
|
||||||
|
{147, "w0", 0, ""},
|
||||||
|
{148, "w1", 1, "-1"},
|
||||||
|
{149, "w2", 1, "-2"},
|
||||||
|
{150, "w3", 1, "-3"},
|
||||||
|
{151, "w4", 1, "-4"},
|
||||||
|
{152, "x0", 0, ""},
|
||||||
|
{153, "x1", 1, "-1"},
|
||||||
|
{154, "x2", 1, "-2"},
|
||||||
|
{155, "x3", 1, "-3"},
|
||||||
|
{156, "x4", 1, "-4"},
|
||||||
|
{157, "d1", 1, "-1"},
|
||||||
|
{158, "d2", 1, "-2"},
|
||||||
|
{159, "d3", 1, "-3"},
|
||||||
|
{160, "d4", 1, "-4"},
|
||||||
|
{161, "y0", 0, ""},
|
||||||
|
{162, "y1", 1, "-1"},
|
||||||
|
{163, "y2", 1, "-2"},
|
||||||
|
{164, "y3", 1, "-3"},
|
||||||
|
{165, "y4", 1, "-4"},
|
||||||
|
{166, "z0", 0, ""},
|
||||||
|
{167, "z1", 1, "-1"},
|
||||||
|
{168, "z2", 1, "-2"},
|
||||||
|
{169, "z3", 1, "-3"},
|
||||||
|
{170, "z4", 1, "-4"}
|
||||||
|
}; /* op_info op_info_128_170 [] */
|
||||||
|
|
||||||
|
op_table op_128_170 = {"op_128_170", 128, 170, op_info_128_170};
|
||||||
|
|
||||||
|
/* Table for font with 1 to 4 bytes (opcodes 235 to 238) inclusive. */
|
||||||
|
|
||||||
|
op_info fnt_n [] =
|
||||||
|
{
|
||||||
|
{235, "f1", 1, "1"},
|
||||||
|
{236, "f2", 1, "2"},
|
||||||
|
{237, "f3", 1, "3"},
|
||||||
|
{238, "f4", 1, "-4"}
|
||||||
|
}; /* op_info fnt_n [] */
|
||||||
|
|
||||||
|
op_table fnt = {"f", 235, 238, fnt_n};
|
||||||
|
|
||||||
|
|
||||||
|
/* function prototypes */
|
||||||
|
|
||||||
|
int open_dvi ARGS((char * dvi_file, FILE ** dvi));
|
||||||
|
int open_dtl ARGS((char * dtl_file, FILE ** dtl));
|
||||||
|
int dv2dt ARGS((FILE * dvi, FILE * dtl));
|
||||||
|
|
||||||
|
COUNT wunsigned ARGS((int n, FILE * dvi, FILE * dtl));
|
||||||
|
COUNT wsigned ARGS((int n, FILE * dvi, FILE * dtl));
|
||||||
|
S4 rsigned ARGS((int n, FILE * dvi));
|
||||||
|
U4 runsigned ARGS((int n, FILE * dvi));
|
||||||
|
|
||||||
|
COUNT wtable ARGS((op_table table, int opcode, FILE * dvi, FILE * dtl));
|
||||||
|
|
||||||
|
COUNT setseq ARGS((int opcode, FILE * dvi, FILE * dtl));
|
||||||
|
Void setpchar ARGS((int charcode, FILE * dtl));
|
||||||
|
Void xferstring ARGS((int k, FILE * dvi, FILE * dtl));
|
||||||
|
|
||||||
|
COUNT special ARGS((FILE * dvi, FILE * dtl, int n));
|
||||||
|
COUNT fontdef ARGS((FILE * dvi, FILE * dtl, int n));
|
||||||
|
COUNT preamble ARGS((FILE * dvi, FILE * dtl));
|
||||||
|
COUNT postamble ARGS((FILE * dvi, FILE * dtl));
|
||||||
|
COUNT postpost ARGS((FILE * dvi, FILE * dtl));
|
||||||
|
|
||||||
|
|
||||||
|
String program; /* name of dv2dt program */
|
||||||
|
|
||||||
|
int
|
||||||
|
main
|
||||||
|
#ifdef STDC
|
||||||
|
(int argc, char * argv[])
|
||||||
|
#else
|
||||||
|
(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char * argv[];
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
FILE * dvi = stdin;
|
||||||
|
FILE * dtl = stdout;
|
||||||
|
|
||||||
|
/* Watch out: C's standard library's string functions are dicey */
|
||||||
|
strncpy (program, argv[0], MAXSTRLEN);
|
||||||
|
|
||||||
|
if (argc > 1)
|
||||||
|
open_dvi (argv[1], &dvi);
|
||||||
|
|
||||||
|
if (argc > 2)
|
||||||
|
open_dtl (argv[2], &dtl);
|
||||||
|
|
||||||
|
dv2dt (dvi, dtl);
|
||||||
|
|
||||||
|
return 0; /* OK */
|
||||||
|
}
|
||||||
|
/* end main */
|
||||||
|
|
||||||
|
int
|
||||||
|
open_dvi
|
||||||
|
#ifdef STDC
|
||||||
|
(char * dvi_file, FILE ** pdvi)
|
||||||
|
#else
|
||||||
|
(dvi_file, pdvi)
|
||||||
|
char * dvi_file;
|
||||||
|
FILE ** pdvi;
|
||||||
|
#endif
|
||||||
|
/* I: dvi_file; I: pdvi; O: *pdvi. */
|
||||||
|
{
|
||||||
|
if (pdvi == NULL)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: address of dvi variable is NULL.\n", program);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
*pdvi = fopen (dvi_file, "rb");
|
||||||
|
|
||||||
|
if (*pdvi == NULL)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: Cannot open \"%s\" for binary reading.\n",
|
||||||
|
program, dvi_file);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1; /* OK */
|
||||||
|
}
|
||||||
|
/* open_dvi */
|
||||||
|
|
||||||
|
int
|
||||||
|
open_dtl
|
||||||
|
#ifdef STDC
|
||||||
|
(char * dtl_file, FILE ** pdtl)
|
||||||
|
#else
|
||||||
|
(dtl_file, pdtl)
|
||||||
|
char * dtl_file;
|
||||||
|
FILE ** pdtl;
|
||||||
|
#endif
|
||||||
|
/* I: dtl_file; I: pdtl; O: *pdtl. */
|
||||||
|
{
|
||||||
|
if (pdtl == NULL)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: address of dtl variable is NULL.\n", program);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
*pdtl = fopen (dtl_file, "w");
|
||||||
|
|
||||||
|
if (*pdtl == NULL)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: Cannot open \"%s\" for text writing.\n",
|
||||||
|
program, dtl_file);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1; /* OK */
|
||||||
|
}
|
||||||
|
/* open_dtl */
|
||||||
|
|
||||||
|
int
|
||||||
|
dv2dt
|
||||||
|
#ifdef STDC
|
||||||
|
(FILE * dvi, FILE * dtl)
|
||||||
|
#else
|
||||||
|
(dvi, dtl)
|
||||||
|
FILE * dvi;
|
||||||
|
FILE * dtl;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int opcode;
|
||||||
|
COUNT count; /* intended to count bytes to DVI file; as yet unused. */
|
||||||
|
|
||||||
|
PRINT_BCOM;
|
||||||
|
fprintf (dtl, "variety ");
|
||||||
|
/* fprintf (dtl, BMES); */
|
||||||
|
fprintf (dtl, VARIETY);
|
||||||
|
/* fprintf (dtl, EMES); */
|
||||||
|
PRINT_ECOM;
|
||||||
|
fprintf (dtl, "\n");
|
||||||
|
|
||||||
|
/* start counting DVI bytes */
|
||||||
|
count = 0;
|
||||||
|
while ((opcode = fgetc (dvi)) != EOF)
|
||||||
|
{
|
||||||
|
PRINT_BCOM; /* start of command and parameters */
|
||||||
|
if (opcode < 0 || opcode > 255)
|
||||||
|
{
|
||||||
|
count += 1;
|
||||||
|
fprintf (stderr, "%s: Non-byte from \"fgetc()\"!\n", program);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
else if (opcode <= 127)
|
||||||
|
{
|
||||||
|
/* setchar commands */
|
||||||
|
/* count += 1; */
|
||||||
|
/* fprintf (dtl, "%s%d", SETCHAR, opcode); */
|
||||||
|
count +=
|
||||||
|
setseq (opcode, dvi, dtl);
|
||||||
|
}
|
||||||
|
else if (opcode >= 128 && opcode <= 170)
|
||||||
|
{
|
||||||
|
count +=
|
||||||
|
wtable (op_128_170, opcode, dvi, dtl);
|
||||||
|
}
|
||||||
|
else if (opcode >= 171 && opcode <= 234)
|
||||||
|
{
|
||||||
|
count += 1;
|
||||||
|
fprintf (dtl, "%s%d", FONTNUM, opcode - 171);
|
||||||
|
}
|
||||||
|
else if (opcode >= 235 && opcode <= 238)
|
||||||
|
{
|
||||||
|
count +=
|
||||||
|
wtable (fnt, opcode, dvi, dtl);
|
||||||
|
}
|
||||||
|
else if (opcode >= 239 && opcode <= 242)
|
||||||
|
{
|
||||||
|
count +=
|
||||||
|
special (dvi, dtl, opcode - 238);
|
||||||
|
}
|
||||||
|
else if (opcode >= 243 && opcode <= 246)
|
||||||
|
{
|
||||||
|
count +=
|
||||||
|
fontdef (dvi, dtl, opcode - 242);
|
||||||
|
}
|
||||||
|
else if (opcode == 247)
|
||||||
|
{
|
||||||
|
count +=
|
||||||
|
preamble (dvi, dtl);
|
||||||
|
}
|
||||||
|
else if (opcode == 248)
|
||||||
|
{
|
||||||
|
count +=
|
||||||
|
postamble (dvi, dtl);
|
||||||
|
}
|
||||||
|
else if (opcode == 249)
|
||||||
|
{
|
||||||
|
count +=
|
||||||
|
postpost (dvi, dtl);
|
||||||
|
}
|
||||||
|
else if (opcode >= 250 && opcode <= 255)
|
||||||
|
{
|
||||||
|
count += 1;
|
||||||
|
fprintf (dtl, "opcode%d", opcode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
count += 1;
|
||||||
|
fprintf (stderr, "%s: unknown byte.\n", program);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
PRINT_ECOM; /* end of command and parameters */
|
||||||
|
fprintf (dtl, "\n");
|
||||||
|
if (fflush (dtl) == EOF)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: fflush on dtl file gave write error!\n", program);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
} /* end while */
|
||||||
|
|
||||||
|
return 1; /* OK */
|
||||||
|
}
|
||||||
|
/* dv2dt */
|
||||||
|
|
||||||
|
|
||||||
|
COUNT
|
||||||
|
wunsigned
|
||||||
|
#ifdef STDC
|
||||||
|
(int n, FILE * dvi, FILE * dtl)
|
||||||
|
#else
|
||||||
|
(n, dvi, dtl)
|
||||||
|
int n;
|
||||||
|
FILE * dvi;
|
||||||
|
FILE * dtl;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
U4 unum;
|
||||||
|
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
unum = runsigned (n, dvi);
|
||||||
|
fprintf (dtl, UF4, unum);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
/* end wunsigned */
|
||||||
|
|
||||||
|
COUNT
|
||||||
|
wsigned
|
||||||
|
#ifdef STDC
|
||||||
|
(int n, FILE * dvi, FILE * dtl)
|
||||||
|
#else
|
||||||
|
(n, dvi, dtl)
|
||||||
|
int n;
|
||||||
|
FILE * dvi;
|
||||||
|
FILE * dtl;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
S4 snum;
|
||||||
|
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
snum = rsigned (n, dvi);
|
||||||
|
fprintf (dtl, SF4, snum);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
/* end wsigned */
|
||||||
|
|
||||||
|
U4
|
||||||
|
runsigned
|
||||||
|
#ifdef STDC
|
||||||
|
(int n, FILE * dvi)
|
||||||
|
#else
|
||||||
|
(n, dvi)
|
||||||
|
int n;
|
||||||
|
FILE * dvi;
|
||||||
|
#endif
|
||||||
|
/* read 1 <= n <= 4 bytes for an unsigned integer from dvi file */
|
||||||
|
/* DVI format uses Big-endian storage of numbers. */
|
||||||
|
{
|
||||||
|
U4 integer;
|
||||||
|
int ibyte = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (n < 1 || n > 4)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
"%s: runsigned() asked for %d bytes. Must be 1 to 4.\n", program, n);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Following calculation works iff storage is big-endian. */
|
||||||
|
integer = 0;
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
integer *= 256;
|
||||||
|
ibyte = fgetc (dvi);
|
||||||
|
integer += ibyte;
|
||||||
|
}
|
||||||
|
|
||||||
|
return integer;
|
||||||
|
}
|
||||||
|
/* end runsigned */
|
||||||
|
|
||||||
|
S4
|
||||||
|
rsigned
|
||||||
|
#ifdef STDC
|
||||||
|
(int n, FILE * dvi)
|
||||||
|
#else
|
||||||
|
(n, dvi)
|
||||||
|
int n;
|
||||||
|
FILE * dvi;
|
||||||
|
#endif
|
||||||
|
/* read 1 <= n <= 4 bytes for a signed integer from dvi file */
|
||||||
|
/* DVI format uses Big-endian storage of numbers. */
|
||||||
|
{
|
||||||
|
S4 integer;
|
||||||
|
int ibyte = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (n < 1 || n > 4)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
"%s: rsigned() asked for %d bytes. Must be 1 to 4.\n", program, n);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Following calculation works iff storage is big-endian. */
|
||||||
|
integer = 0;
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
integer *= 256;
|
||||||
|
ibyte = fgetc (dvi);
|
||||||
|
/* Big-endian implies sign byte is first byte. */
|
||||||
|
if (i == 0 && ibyte >= 128)
|
||||||
|
{
|
||||||
|
ibyte -= 256;
|
||||||
|
}
|
||||||
|
integer += ibyte;
|
||||||
|
}
|
||||||
|
|
||||||
|
return integer;
|
||||||
|
}
|
||||||
|
/* end rsigned */
|
||||||
|
|
||||||
|
COUNT
|
||||||
|
wtable
|
||||||
|
#ifdef STDC
|
||||||
|
(op_table table, int opcode, FILE * dvi, FILE * dtl)
|
||||||
|
#else
|
||||||
|
(table, opcode, dvi, dtl)
|
||||||
|
op_table table;
|
||||||
|
int opcode;
|
||||||
|
FILE * dvi;
|
||||||
|
FILE * dtl;
|
||||||
|
#endif
|
||||||
|
/* write command with given opcode in given table */
|
||||||
|
/* return number of DVI bytes in this command */
|
||||||
|
{
|
||||||
|
op_info op; /* pointer into table of operations and arguments */
|
||||||
|
COUNT bcount = 0; /* number of bytes in arguments of this opcode */
|
||||||
|
String args; /* arguments string */
|
||||||
|
int i; /* count of arguments read from args */
|
||||||
|
int pos; /* position in args */
|
||||||
|
|
||||||
|
/* Defensive programming. */
|
||||||
|
if (opcode < table.first || opcode > table.last)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
"%s: opcode %d is outside table %s [ %d to %d ] !\n",
|
||||||
|
program, opcode, table.name, table.first, table.last);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
op = table.list [opcode - table.first];
|
||||||
|
|
||||||
|
/* Further defensive programming. */
|
||||||
|
if (op.code != opcode)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: internal table %s wrong!\n", program, table.name);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
bcount = 1;
|
||||||
|
fprintf (dtl, "%s", op.name);
|
||||||
|
|
||||||
|
/* NB: sscanf does an ungetc, */
|
||||||
|
/* so args must be writable. */
|
||||||
|
|
||||||
|
strncpy (args, op.args, MAXSTRLEN);
|
||||||
|
|
||||||
|
pos = 0;
|
||||||
|
for (i = 0; i < op.nargs; i++)
|
||||||
|
{
|
||||||
|
int argtype; /* sign and number of bytes in current argument */
|
||||||
|
int nconv; /* number of successful conversions from args */
|
||||||
|
int nread; /* number of bytes read from args */
|
||||||
|
|
||||||
|
nconv = sscanf (args + pos, "%d%n", &argtype, &nread);
|
||||||
|
|
||||||
|
/* internal consistency checks */
|
||||||
|
if (nconv != 1 || nread <= 0)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
"%s: internal read of table %s failed!\n", program, table.name);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
pos += nread;
|
||||||
|
|
||||||
|
bcount += ( argtype < 0 ?
|
||||||
|
wsigned (-argtype, dvi, dtl) :
|
||||||
|
wunsigned (argtype, dvi, dtl) ) ;
|
||||||
|
} /* end for */
|
||||||
|
|
||||||
|
return bcount;
|
||||||
|
|
||||||
|
}
|
||||||
|
/* wtable */
|
||||||
|
|
||||||
|
COUNT
|
||||||
|
setseq
|
||||||
|
#ifdef STDC
|
||||||
|
(int opcode, FILE * dvi, FILE * dtl)
|
||||||
|
#else
|
||||||
|
(opcode, dvi, dtl)
|
||||||
|
int opcode;
|
||||||
|
FILE * dvi;
|
||||||
|
FILE * dtl;
|
||||||
|
#endif
|
||||||
|
/* write a sequence of setchar commands */
|
||||||
|
/* return count of DVI bytes interpreted into DTL */
|
||||||
|
{
|
||||||
|
int charcode = opcode; /* fortuitous */
|
||||||
|
int ccount = 0;
|
||||||
|
|
||||||
|
if (!isprint (charcode))
|
||||||
|
{
|
||||||
|
ccount = 1;
|
||||||
|
fprintf (dtl, "%s%02X", SETCHAR, opcode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* start of sequence of font characters */
|
||||||
|
fprintf (dtl, BSEQ);
|
||||||
|
|
||||||
|
/* first character */
|
||||||
|
ccount = 1;
|
||||||
|
setpchar (charcode, dtl);
|
||||||
|
|
||||||
|
/* subsequent characters */
|
||||||
|
while ((opcode = fgetc (dvi)) != EOF)
|
||||||
|
{
|
||||||
|
if (opcode < 0 || opcode > 127)
|
||||||
|
{
|
||||||
|
break; /* not a setchar command, so sequence has ended */
|
||||||
|
}
|
||||||
|
charcode = opcode; /* fortuitous */
|
||||||
|
if (!isprint (charcode)) /* not printable ascii */
|
||||||
|
{
|
||||||
|
break; /* end of font character sequence, as for other commands */
|
||||||
|
}
|
||||||
|
else /* printable ASCII */
|
||||||
|
{
|
||||||
|
ccount += 1;
|
||||||
|
setpchar (charcode, dtl);
|
||||||
|
}
|
||||||
|
} /* end for loop */
|
||||||
|
|
||||||
|
/* prepare to reread opcode of next DVI command */
|
||||||
|
if (ungetc (opcode, dvi) == EOF)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "setseq: cannot push back a byte\n");
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* end of sequence of font characters */
|
||||||
|
fprintf (dtl, ESEQ);
|
||||||
|
}
|
||||||
|
return ccount;
|
||||||
|
}
|
||||||
|
/* setseq */
|
||||||
|
|
||||||
|
Void
|
||||||
|
setpchar
|
||||||
|
#ifdef STDC
|
||||||
|
(int charcode, FILE * dtl)
|
||||||
|
#else
|
||||||
|
(charcode, dtl)
|
||||||
|
int charcode;
|
||||||
|
FILE * dtl;
|
||||||
|
#endif
|
||||||
|
/* set printable character */
|
||||||
|
{
|
||||||
|
switch (charcode)
|
||||||
|
{
|
||||||
|
case ESC_CHAR:
|
||||||
|
fprintf (dtl, "%c", ESC_CHAR);
|
||||||
|
fprintf (dtl, "%c", ESC_CHAR);
|
||||||
|
break;
|
||||||
|
case QUOTE_CHAR:
|
||||||
|
fprintf (dtl, "%c", ESC_CHAR);
|
||||||
|
fprintf (dtl, "%c", QUOTE_CHAR);
|
||||||
|
break;
|
||||||
|
case BSEQ_CHAR:
|
||||||
|
fprintf (dtl, "%c", ESC_CHAR);
|
||||||
|
fprintf (dtl, "%c", BSEQ_CHAR);
|
||||||
|
break;
|
||||||
|
case ESEQ_CHAR:
|
||||||
|
fprintf (dtl, "%c", ESC_CHAR);
|
||||||
|
fprintf (dtl, "%c", ESEQ_CHAR);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf (dtl, "%c", charcode);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* setpchar */
|
||||||
|
|
||||||
|
Void
|
||||||
|
xferstring
|
||||||
|
#ifdef STDC
|
||||||
|
(int k, FILE * dvi, FILE * dtl)
|
||||||
|
#else
|
||||||
|
(k, dvi, dtl)
|
||||||
|
int k;
|
||||||
|
FILE * dvi;
|
||||||
|
FILE * dtl;
|
||||||
|
#endif
|
||||||
|
/* copy string of k characters from dvi file to dtl file */
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int ch;
|
||||||
|
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
fprintf (dtl, "'");
|
||||||
|
for (i=0; i < k; i++)
|
||||||
|
{
|
||||||
|
ch = fgetc (dvi);
|
||||||
|
if (ch == ESC_CHAR || ch == EMES_CHAR)
|
||||||
|
{
|
||||||
|
fprintf (dtl, "%c", ESC_CHAR);
|
||||||
|
}
|
||||||
|
fprintf (dtl, "%c", ch);
|
||||||
|
}
|
||||||
|
fprintf (dtl, "'");
|
||||||
|
}
|
||||||
|
/* xferstring */
|
||||||
|
|
||||||
|
COUNT
|
||||||
|
special
|
||||||
|
#ifdef STDC
|
||||||
|
(FILE * dvi, FILE * dtl, int n)
|
||||||
|
#else
|
||||||
|
(dvi, dtl, n)
|
||||||
|
FILE * dvi;
|
||||||
|
FILE * dtl;
|
||||||
|
int n;
|
||||||
|
#endif
|
||||||
|
/* read special 1 .. 4 from dvi and write in dtl */
|
||||||
|
/* return number of DVI bytes interpreted into DTL */
|
||||||
|
{
|
||||||
|
U4 k;
|
||||||
|
|
||||||
|
if (n < 1 || n > 4)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: special %d, range is 1 to 4.\n", program, n);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf (dtl, "%s%d", SPECIAL, n);
|
||||||
|
|
||||||
|
/* k[n] = length of special string */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
k = runsigned (n, dvi);
|
||||||
|
fprintf (dtl, UF4, k);
|
||||||
|
|
||||||
|
/* x[k] = special string */
|
||||||
|
xferstring (k, dvi, dtl);
|
||||||
|
|
||||||
|
return (1 + n + k);
|
||||||
|
}
|
||||||
|
/* end special */
|
||||||
|
|
||||||
|
COUNT
|
||||||
|
fontdef
|
||||||
|
#ifdef STDC
|
||||||
|
(FILE * dvi, FILE * dtl, int n)
|
||||||
|
#else
|
||||||
|
(dvi, dtl, n)
|
||||||
|
FILE * dvi;
|
||||||
|
FILE * dtl;
|
||||||
|
int n;
|
||||||
|
#endif
|
||||||
|
/* read fontdef 1 .. 4 from dvi and write in dtl */
|
||||||
|
/* return number of DVI bytes interpreted into DTL */
|
||||||
|
{
|
||||||
|
U4 ku, c, s, d, a, l;
|
||||||
|
S4 ks;
|
||||||
|
|
||||||
|
if (n < 1 || n > 4)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "%s: font def %d, range is 1 to 4.\n", program, n);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf (dtl, "%s%d", FONTDEF, n);
|
||||||
|
|
||||||
|
/* k[n] = font number */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
if (n == 4)
|
||||||
|
{
|
||||||
|
ks = rsigned (n, dvi);
|
||||||
|
fprintf (dtl, SF4, ks);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ku = runsigned (n, dvi);
|
||||||
|
fprintf (dtl, UF4, ku);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* c[4] = checksum */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
c = runsigned (4, dvi);
|
||||||
|
#ifdef HEX_CHECKSUM
|
||||||
|
fprintf (dtl, XF4, c);
|
||||||
|
#else /* NOT HEX_CHECKSUM */
|
||||||
|
/* write in octal, to allow quick comparison with tftopl's output */
|
||||||
|
fprintf (dtl, OF4, c);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* s[4] = scale factor */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
s = runsigned (4, dvi);
|
||||||
|
fprintf (dtl, UF4, s);
|
||||||
|
|
||||||
|
/* d[4] = design size */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
d = runsigned (4, dvi);
|
||||||
|
fprintf (dtl, UF4, d);
|
||||||
|
|
||||||
|
/* a[1] = length of area (directory) name */
|
||||||
|
a = runsigned (1, dvi);
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
fprintf (dtl, UF4, a);
|
||||||
|
|
||||||
|
/* l[1] = length of font name */
|
||||||
|
l = runsigned (1, dvi);
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
fprintf (dtl, UF4, l);
|
||||||
|
|
||||||
|
/* n[a+l] = font pathname string => area (directory) + font */
|
||||||
|
xferstring (a, dvi, dtl);
|
||||||
|
xferstring (l, dvi, dtl);
|
||||||
|
|
||||||
|
return (1 + n + 4 + 4 + 4 + 1 + 1 + a + l);
|
||||||
|
}
|
||||||
|
/* end fontdef */
|
||||||
|
|
||||||
|
COUNT
|
||||||
|
preamble
|
||||||
|
#ifdef STDC
|
||||||
|
(FILE * dvi, FILE * dtl)
|
||||||
|
#else
|
||||||
|
(dvi, dtl)
|
||||||
|
FILE * dvi;
|
||||||
|
FILE * dtl;
|
||||||
|
#endif
|
||||||
|
/* read preamble from dvi and write in dtl */
|
||||||
|
/* return number of DVI bytes interpreted into DTL */
|
||||||
|
{
|
||||||
|
U4 id, num, den, mag, k;
|
||||||
|
|
||||||
|
fprintf (dtl, "pre");
|
||||||
|
|
||||||
|
/* i[1] = DVI format identification */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
id = runsigned (1, dvi);
|
||||||
|
fprintf (dtl, UF4, id);
|
||||||
|
|
||||||
|
/* num[4] = numerator of DVI unit */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
num = runsigned (4, dvi);
|
||||||
|
fprintf (dtl, UF4, num);
|
||||||
|
|
||||||
|
/* den[4] = denominator of DVI unit */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
den = runsigned (4, dvi);
|
||||||
|
fprintf (dtl, UF4, den);
|
||||||
|
|
||||||
|
/* mag[4] = 1000 x magnification */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
mag = runsigned (4, dvi);
|
||||||
|
fprintf (dtl, UF4, mag);
|
||||||
|
|
||||||
|
/* k[1] = length of comment */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
k = runsigned (1, dvi);
|
||||||
|
fprintf (dtl, UF4, k);
|
||||||
|
|
||||||
|
/* x[k] = comment string */
|
||||||
|
xferstring (k, dvi, dtl);
|
||||||
|
|
||||||
|
return (1 + 1 + 4 + 4 + 4 + 1 + k);
|
||||||
|
}
|
||||||
|
/* end preamble */
|
||||||
|
|
||||||
|
COUNT
|
||||||
|
postamble
|
||||||
|
#ifdef STDC
|
||||||
|
(FILE * dvi, FILE * dtl)
|
||||||
|
#else
|
||||||
|
(dvi, dtl)
|
||||||
|
FILE * dvi;
|
||||||
|
FILE * dtl;
|
||||||
|
#endif
|
||||||
|
/* read postamble from dvi and write in dtl */
|
||||||
|
/* return number of bytes */
|
||||||
|
{
|
||||||
|
U4 p, num, den, mag, l, u, s, t;
|
||||||
|
|
||||||
|
fprintf (dtl, "post");
|
||||||
|
|
||||||
|
/* p[4] = pointer to final bop */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
p = runsigned (4, dvi);
|
||||||
|
fprintf (dtl, UF4, p);
|
||||||
|
|
||||||
|
/* num[4] = numerator of DVI unit */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
num = runsigned (4, dvi);
|
||||||
|
fprintf (dtl, UF4, num);
|
||||||
|
|
||||||
|
/* den[4] = denominator of DVI unit */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
den = runsigned (4, dvi);
|
||||||
|
fprintf (dtl, UF4, den);
|
||||||
|
|
||||||
|
/* mag[4] = 1000 x magnification */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
mag = runsigned (4, dvi);
|
||||||
|
fprintf (dtl, UF4, mag);
|
||||||
|
|
||||||
|
/* l[4] = height + depth of tallest page */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
l = runsigned (4, dvi);
|
||||||
|
fprintf (dtl, UF4, l);
|
||||||
|
|
||||||
|
/* u[4] = width of widest page */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
u = runsigned (4, dvi);
|
||||||
|
fprintf (dtl, UF4, u);
|
||||||
|
|
||||||
|
/* s[2] = maximum stack depth */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
s = runsigned (2, dvi);
|
||||||
|
fprintf (dtl, UF4, s);
|
||||||
|
|
||||||
|
/* t[2] = total number of pages (bop commands) */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
t = runsigned (2, dvi);
|
||||||
|
fprintf (dtl, UF4, t);
|
||||||
|
|
||||||
|
/* return (29); */
|
||||||
|
return (1 + 4 + 4 + 4 + 4 + 4 + 4 + 2 + 2);
|
||||||
|
}
|
||||||
|
/* end postamble */
|
||||||
|
|
||||||
|
COUNT
|
||||||
|
postpost
|
||||||
|
#ifdef STDC
|
||||||
|
(FILE * dvi, FILE * dtl)
|
||||||
|
#else
|
||||||
|
(dvi, dtl)
|
||||||
|
FILE * dvi;
|
||||||
|
FILE * dtl;
|
||||||
|
#endif
|
||||||
|
/* read post_post from dvi and write in dtl */
|
||||||
|
/* return number of bytes */
|
||||||
|
{
|
||||||
|
U4 q, id;
|
||||||
|
int b223; /* hope this is 8-bit clean */
|
||||||
|
int n223; /* number of "223" bytes in final padding */
|
||||||
|
|
||||||
|
fprintf (dtl, "post_post");
|
||||||
|
|
||||||
|
/* q[4] = pointer to post command */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
q = runsigned (4, dvi);
|
||||||
|
fprintf (dtl, UF4, q);
|
||||||
|
|
||||||
|
/* i[1] = DVI identification byte */
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
id = runsigned (1, dvi);
|
||||||
|
fprintf (dtl, UF4, id);
|
||||||
|
|
||||||
|
/* final padding by "223" bytes */
|
||||||
|
/* hope this way of obtaining b223 is 8-bit clean */
|
||||||
|
for (n223 = 0; (b223 = fgetc (dvi)) == 223; n223++)
|
||||||
|
{
|
||||||
|
fprintf (dtl, " ");
|
||||||
|
fprintf (dtl, "%d", 223);
|
||||||
|
}
|
||||||
|
if (n223 < 4)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
"%s: bad post_post: fewer than four \"223\" bytes.\n", program);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
if (b223 != EOF)
|
||||||
|
{
|
||||||
|
fprintf (stderr,
|
||||||
|
"%s: bad post_post: doesn't end with a \"223\".\n", program);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (1 + 4 + 1 + n223);
|
||||||
|
}
|
||||||
|
/* end postpost */
|
||||||
|
|
||||||
|
/* end of "dv2dt.c" */
|
719
3rdparty/dtl/dv2dt.man
vendored
Normal file
719
3rdparty/dtl/dv2dt.man
vendored
Normal file
@ -0,0 +1,719 @@
|
|||||||
|
.\" This file is public domain.
|
||||||
|
.\" Originally written 1995, Geoffrey Tobin.
|
||||||
|
.\" The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
|
||||||
|
.\" This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
|
||||||
|
.\" ====================================================================
|
||||||
|
.\" @Troff-man-file{
|
||||||
|
.\" author = "Nelson H. F. Beebe and Geoffrey Tobin",
|
||||||
|
.\" version = "0.6.0",
|
||||||
|
.\" date = "08 March 1995",
|
||||||
|
.\" time = "19:52:00 GMT +11",
|
||||||
|
.\" filename = "dv2dt.man",
|
||||||
|
.\" address = "Center for Scientific Computing
|
||||||
|
.\" Department of Mathematics
|
||||||
|
.\" University of Utah
|
||||||
|
.\" Salt Lake City, UT 84112
|
||||||
|
.\" USA",
|
||||||
|
.\" telephone = "+1 801 581 5254",
|
||||||
|
.\" FAX = "+1 801 581 4148",
|
||||||
|
.\" checksum = "32328 715 2191 12898",
|
||||||
|
.\" email = "beebe@math.utah.edu (Internet)",
|
||||||
|
.\" codetable = "ISO/ASCII",
|
||||||
|
.\" keywords = "DVI, TeX",
|
||||||
|
.\" supported = "no",
|
||||||
|
.\" docstring = "This file contains the UNIX manual pages
|
||||||
|
.\" for the dv2dt utility, a program for
|
||||||
|
.\" converting a binary TeX DVI file to an
|
||||||
|
.\" editable text representation in DTL (DVI Text
|
||||||
|
.\" Language). The companion dt2dv utility can
|
||||||
|
.\" convert the output DTL file back to a binary
|
||||||
|
.\" DVI file.
|
||||||
|
.\"
|
||||||
|
.\" The checksum field above contains a CRC-16
|
||||||
|
.\" checksum as the first value, followed by the
|
||||||
|
.\" equivalent of the standard UNIX wc (word
|
||||||
|
.\" count) utility output of lines, words, and
|
||||||
|
.\" characters. This is produced by Robert
|
||||||
|
.\" Solovay's checksum utility.",
|
||||||
|
.\" }
|
||||||
|
.\" ====================================================================
|
||||||
|
.if t .ds Te T\\h'-0.1667m'\\v'0.20v'E\\v'-0.20v'\\h'-0.125m'X
|
||||||
|
.if n .ds Te TeX
|
||||||
|
.if t .ds Xe X\\h'-0.1667m'\\v'0.20v'E\\v'-0.20v'\\h'-0.125m'T
|
||||||
|
.if n .ds Xe XeT
|
||||||
|
.TH DV2DT 1 "08 March 1995" "Version 0.6.0"
|
||||||
|
.\"======================================================================
|
||||||
|
.SH NAME
|
||||||
|
dv2dt \- convert a binary TeX DVI file to DTL text representation
|
||||||
|
.\"======================================================================
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B dv2dt
|
||||||
|
.I input-DVI-file
|
||||||
|
.I output-DTL-file
|
||||||
|
.PP
|
||||||
|
If the filenames are omitted, then
|
||||||
|
.I stdin
|
||||||
|
and
|
||||||
|
.I stdout
|
||||||
|
are assumed.
|
||||||
|
.\"======================================================================
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B dv2dt
|
||||||
|
converts a binary \*(Te\& DVI file to an editable
|
||||||
|
text file in DTL
|
||||||
|
.RI ( "DVI Text Language" )
|
||||||
|
format. The companion
|
||||||
|
.BR dt2dv (1)
|
||||||
|
utility can convert the DTL file back to a binary
|
||||||
|
DVI file.
|
||||||
|
.\"======================================================================
|
||||||
|
.SH "DVI COMMAND DESCRIPTION"
|
||||||
|
\*(Te\& DVI files contain a compact binary
|
||||||
|
description of typeset pages, as a stream of
|
||||||
|
operation code bytes, each immediately followed by
|
||||||
|
zero or more parameter bytes. The format of DVI
|
||||||
|
files is fully described in Donald E. Knuth,
|
||||||
|
.IR "\*(Te\&: The Program" ,
|
||||||
|
Addison-Wesley (1986), ISBN 0-201-13437-3, as well
|
||||||
|
as in the
|
||||||
|
.BR dvitype (1)
|
||||||
|
literate program source code.
|
||||||
|
.PP
|
||||||
|
For convenience, we provide a summary of DVI
|
||||||
|
commands here. In the following list, operation
|
||||||
|
code bytes are given as unsigned decimal values,
|
||||||
|
followed by their symbolic names (not present in
|
||||||
|
the DVI file), and a short description. A
|
||||||
|
designation like
|
||||||
|
.I b[+n]
|
||||||
|
means that the operation code byte is followed by
|
||||||
|
a parameter
|
||||||
|
.I b
|
||||||
|
which uses
|
||||||
|
.I n
|
||||||
|
bytes, and is signed. Without the plus sign, the
|
||||||
|
parameter is unsigned. Signed integer parameter
|
||||||
|
values are always represented in two's complement
|
||||||
|
arithmetic, which is the system followed by most
|
||||||
|
computers manufactured today, including all
|
||||||
|
personal computers and workstations.
|
||||||
|
.if n .TP \w'\fI128_set1__c[1]\fP'u+3n
|
||||||
|
.if t .TP \w'\fI243_fnt_def1__k[1]_c[4]_s[4]_d[4]_a[1]_l[1]_n[a+l]\fP'u+3n
|
||||||
|
.I "0 set_char_0"
|
||||||
|
Set character 0 from current font.
|
||||||
|
.TP
|
||||||
|
.I .\|.\|.
|
||||||
|
.TP
|
||||||
|
.I "127 set_char_127"
|
||||||
|
Set character 127 from current font.
|
||||||
|
.TP
|
||||||
|
.I "128 set1 c[1]"
|
||||||
|
Set 1-byte unsigned character (uchar) number
|
||||||
|
.IR c .
|
||||||
|
.TP
|
||||||
|
.I "129 set2 c[2]"
|
||||||
|
Set 2-byte uchar number
|
||||||
|
.IR c .
|
||||||
|
.TP
|
||||||
|
.I "130 set3 c[3]"
|
||||||
|
Set 3-byte uchar number
|
||||||
|
.IR c .
|
||||||
|
.TP
|
||||||
|
.I "131 set4 c[+4]"
|
||||||
|
Set 4-byte signed character (schar) number
|
||||||
|
.IR c .
|
||||||
|
.TP
|
||||||
|
.I "132 set_rule a[+4] b[+4]"
|
||||||
|
Set rule, height
|
||||||
|
.IR a ,
|
||||||
|
width
|
||||||
|
.IR b .
|
||||||
|
.TP
|
||||||
|
.I "133 put1 c[1]"
|
||||||
|
Put 1-byte uchar
|
||||||
|
.IR c .
|
||||||
|
.TP
|
||||||
|
.I "134 put2 c[2]"
|
||||||
|
Put 2-byte uchar
|
||||||
|
.IR c .
|
||||||
|
.TP
|
||||||
|
.I "135 put3 c[3]"
|
||||||
|
Put 3-byte uchar
|
||||||
|
.IR c .
|
||||||
|
.TP
|
||||||
|
.I "136 put4 c[+4]"
|
||||||
|
Put 4-byte schar
|
||||||
|
.IR c .
|
||||||
|
.TP
|
||||||
|
.I "137 put_rule a[+4] b[+4]"
|
||||||
|
Put rule, height
|
||||||
|
.IR a ,
|
||||||
|
width
|
||||||
|
.IR b .
|
||||||
|
.TP
|
||||||
|
.I "138 nop"
|
||||||
|
Do nothing.
|
||||||
|
.TP
|
||||||
|
.I "139 bop c0[+4] .\|.\|. c9[+4] p[+4]"
|
||||||
|
Beginning of page. The parameters
|
||||||
|
.I "c0 .\|.\|. c9"
|
||||||
|
are the \*(Te\& page counters, the contents of
|
||||||
|
\*(Te\& count registers
|
||||||
|
.IR "\ecount0 .\|.\|. \ecount9" .
|
||||||
|
The parameter
|
||||||
|
.I p
|
||||||
|
is the byte offset from the beginning of the DVI
|
||||||
|
file of the previous
|
||||||
|
.I bop
|
||||||
|
operation code byte. The first such command in
|
||||||
|
the file has
|
||||||
|
.IR "p = \-1" .
|
||||||
|
.TP
|
||||||
|
.I "140 eop"
|
||||||
|
End of page.
|
||||||
|
.TP
|
||||||
|
.I "141 push"
|
||||||
|
Push
|
||||||
|
.RI ( h,v,w,x,y,z )
|
||||||
|
onto stack.
|
||||||
|
.TP
|
||||||
|
.I "142 pop"
|
||||||
|
Pop
|
||||||
|
.RI ( h,v,w,x,y,z )
|
||||||
|
from stack.
|
||||||
|
.TP
|
||||||
|
.I "143 right1 b[+1]"
|
||||||
|
Move right
|
||||||
|
.I b
|
||||||
|
units.
|
||||||
|
.TP
|
||||||
|
.I "144 right2 b[+2]"
|
||||||
|
Move right
|
||||||
|
.I b
|
||||||
|
units.
|
||||||
|
.TP
|
||||||
|
.I "145 right3 b[+3]"
|
||||||
|
Move right
|
||||||
|
.I b
|
||||||
|
units.
|
||||||
|
.TP
|
||||||
|
.I "146 right4 b[+4]"
|
||||||
|
Move right
|
||||||
|
.I b
|
||||||
|
units.
|
||||||
|
.TP
|
||||||
|
.I "147 w0"
|
||||||
|
Move right
|
||||||
|
.I w
|
||||||
|
units.
|
||||||
|
.TP
|
||||||
|
.I "148 w1 b[+1]"
|
||||||
|
Move right
|
||||||
|
.I b
|
||||||
|
units, and set
|
||||||
|
.IR "w = b" .
|
||||||
|
.TP
|
||||||
|
.I "149 w2 b[+2]"
|
||||||
|
Move right
|
||||||
|
.I b
|
||||||
|
units, and set
|
||||||
|
.IR "w = b" .
|
||||||
|
.TP
|
||||||
|
.I "150 w3 b[+3]"
|
||||||
|
Move right
|
||||||
|
.I b
|
||||||
|
units, and set
|
||||||
|
.IR "w = b" .
|
||||||
|
.TP
|
||||||
|
.I "151 w4 b[+4]"
|
||||||
|
Move right
|
||||||
|
.I b
|
||||||
|
units, and set
|
||||||
|
.IR "w = b" .
|
||||||
|
.TP
|
||||||
|
.I "152 x0"
|
||||||
|
Move right
|
||||||
|
.I x
|
||||||
|
units.
|
||||||
|
.TP
|
||||||
|
.I "153 x1 b[+1]"
|
||||||
|
Move right
|
||||||
|
.I b
|
||||||
|
units, and set
|
||||||
|
.IR "x = b" .
|
||||||
|
.TP
|
||||||
|
.I "154 x2 b[+2]"
|
||||||
|
Move right
|
||||||
|
.I b
|
||||||
|
units, and set
|
||||||
|
.IR "x = b" .
|
||||||
|
.TP
|
||||||
|
.I "155 x3 b[+3]"
|
||||||
|
Move right
|
||||||
|
.I b
|
||||||
|
units, and set
|
||||||
|
.IR "x = b" .
|
||||||
|
.TP
|
||||||
|
.I "156 x4 b[+4]"
|
||||||
|
Move right
|
||||||
|
.I b
|
||||||
|
units, and set
|
||||||
|
.IR "x = b" .
|
||||||
|
.TP
|
||||||
|
.I "157 down1 a[+1]"
|
||||||
|
Move down
|
||||||
|
.I a
|
||||||
|
units.
|
||||||
|
.TP
|
||||||
|
.I "158 down2 a[+2]"
|
||||||
|
Move down
|
||||||
|
.I a
|
||||||
|
units.
|
||||||
|
.TP
|
||||||
|
.I "159 down3 a[+3]"
|
||||||
|
Move down
|
||||||
|
.I a
|
||||||
|
units.
|
||||||
|
.TP
|
||||||
|
.I "160 down4 a[+4]"
|
||||||
|
Move down
|
||||||
|
.I a
|
||||||
|
units.
|
||||||
|
.TP
|
||||||
|
.I "161 y0"
|
||||||
|
Move right
|
||||||
|
.I y
|
||||||
|
units.
|
||||||
|
.TP
|
||||||
|
.I "162 y1 a[+1]"
|
||||||
|
Move right
|
||||||
|
.I a
|
||||||
|
units, and set
|
||||||
|
.IR "y = a" .
|
||||||
|
.TP
|
||||||
|
.I "163 y2 a[+2]"
|
||||||
|
Move right
|
||||||
|
.I a
|
||||||
|
units, and set
|
||||||
|
.IR "y = a" .
|
||||||
|
.TP
|
||||||
|
.I "164 y3 a[+3]"
|
||||||
|
Move right
|
||||||
|
.I a
|
||||||
|
units, and set
|
||||||
|
.IR "y = a" .
|
||||||
|
.TP
|
||||||
|
.I "165 y4 a[+4]"
|
||||||
|
Move right
|
||||||
|
.I a
|
||||||
|
units, and set
|
||||||
|
.IR "y = a" .
|
||||||
|
.TP
|
||||||
|
.I "166 z0"
|
||||||
|
Move right
|
||||||
|
.I z
|
||||||
|
units.
|
||||||
|
.TP
|
||||||
|
.I "167 z1 a[+1]"
|
||||||
|
Move right
|
||||||
|
.I a
|
||||||
|
units, and set
|
||||||
|
.IR "z = a" .
|
||||||
|
.TP
|
||||||
|
.I "168 z2 a[+2]"
|
||||||
|
Move right
|
||||||
|
.I a
|
||||||
|
units, and set
|
||||||
|
.IR "z = a" .
|
||||||
|
.TP
|
||||||
|
.I "169 z3 a[+3]"
|
||||||
|
Move right
|
||||||
|
.I a
|
||||||
|
units, and set
|
||||||
|
.IR "z = a" .
|
||||||
|
.TP
|
||||||
|
.I "170 z4 a[+4]"
|
||||||
|
Move right
|
||||||
|
.I a
|
||||||
|
units, and set
|
||||||
|
.IR "z = a" .
|
||||||
|
.TP
|
||||||
|
.I "171 fnt_num_0"
|
||||||
|
Set current font number
|
||||||
|
.IR "(f) = 0" .
|
||||||
|
.TP
|
||||||
|
.I .\|.\|.
|
||||||
|
.TP
|
||||||
|
.I "234 fnt_num_63"
|
||||||
|
Set
|
||||||
|
.IR "f = 63" .
|
||||||
|
.TP
|
||||||
|
.I "235 fnt1 k[1]"
|
||||||
|
Set
|
||||||
|
.IR "f = k" .
|
||||||
|
.TP
|
||||||
|
.I "236 fnt2 k[2]"
|
||||||
|
Set
|
||||||
|
.IR "f = k" .
|
||||||
|
.TP
|
||||||
|
.I "237 fnt3 k[3]"
|
||||||
|
Set
|
||||||
|
.IR "f = k" .
|
||||||
|
.TP
|
||||||
|
.I "238 fnt4 k[+4]"
|
||||||
|
Set
|
||||||
|
.IR "f = k" .
|
||||||
|
.TP
|
||||||
|
.I "239 xxx1 k[1] x[k]"
|
||||||
|
Special string
|
||||||
|
.I x
|
||||||
|
with
|
||||||
|
.I k
|
||||||
|
bytes.
|
||||||
|
.TP
|
||||||
|
.I "240 xxx2 k[2] x[k]"
|
||||||
|
Special string
|
||||||
|
.I x
|
||||||
|
with
|
||||||
|
.I k
|
||||||
|
bytes.
|
||||||
|
.TP
|
||||||
|
.I "241 xxx3 k[3] x[k]"
|
||||||
|
Special string
|
||||||
|
.I x
|
||||||
|
with
|
||||||
|
.I k
|
||||||
|
bytes.
|
||||||
|
.TP
|
||||||
|
.I "242 xxx4 k[4] x[k]"
|
||||||
|
Special string
|
||||||
|
.I x
|
||||||
|
with (unsigned)
|
||||||
|
.I k
|
||||||
|
bytes.
|
||||||
|
.TP
|
||||||
|
.I "243 fnt_def1 k[1] c[4] s[4] d[4] a[1] l[1] n[a+l]"
|
||||||
|
Define font
|
||||||
|
.IR k .
|
||||||
|
The parameters are:
|
||||||
|
.RS
|
||||||
|
.TP \w'\fIm\fP'u+3n
|
||||||
|
.I c
|
||||||
|
Checksum for TFM file.
|
||||||
|
.TP
|
||||||
|
.I s
|
||||||
|
Scale factor, in DVI units.
|
||||||
|
.TP
|
||||||
|
.I d
|
||||||
|
Design size, in DVI units.
|
||||||
|
.TP
|
||||||
|
.I a
|
||||||
|
Length of the ``area'' or directory.
|
||||||
|
.TP
|
||||||
|
.I l
|
||||||
|
Length of the font name.
|
||||||
|
.TP
|
||||||
|
.I n
|
||||||
|
Area and font name string(s).
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
.I "244 fnt_def2 k[2] c[4] s[4] d[4] a[1] l[1] n[a+l]"
|
||||||
|
Define font
|
||||||
|
.IR k .
|
||||||
|
.TP
|
||||||
|
.I "245 fnt_def3 k[3] c[4] s[4] d[4] a[1] l[1] n[a+l]"
|
||||||
|
Define font
|
||||||
|
.IR k .
|
||||||
|
.TP
|
||||||
|
.I "246 fnt_def4 k[+4] c[4] s[4] d[4] a[1] l[1] n[a+l]"
|
||||||
|
Define font
|
||||||
|
.IR k .
|
||||||
|
.TP
|
||||||
|
.I "247 pre i[1] num[4] den[4] mag[4] k[1] x[k]"
|
||||||
|
Begin preamble. The parameters are:
|
||||||
|
.RS
|
||||||
|
.TP \w'\fInum\fP'u+3n
|
||||||
|
.I i
|
||||||
|
DVI format. Standard \*(Te\& has
|
||||||
|
.IR "ID = 2" ,
|
||||||
|
and \*(Te\&-\*(Xe\& has
|
||||||
|
.IR "ID = 3" .
|
||||||
|
.TP
|
||||||
|
.I num
|
||||||
|
Numerator of 100 nm / DVI unit.
|
||||||
|
.TP
|
||||||
|
.I den
|
||||||
|
Denominator of 100 nm / DVI unit.
|
||||||
|
.TP
|
||||||
|
.I mag
|
||||||
|
1000 * magnification.
|
||||||
|
.TP
|
||||||
|
.I k
|
||||||
|
Comment length.
|
||||||
|
.TP
|
||||||
|
.I x
|
||||||
|
Comment string.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
.I "248 post p[4] num[4] den[4] mag[4] l[4] u[4] s[2] t[2]"
|
||||||
|
Begin postamble. The parameters are:
|
||||||
|
.RS
|
||||||
|
.TP \w'\fInum\fP'u+3n
|
||||||
|
.I p
|
||||||
|
Pointer to final bop.
|
||||||
|
.TP
|
||||||
|
.I "num, den, mag"
|
||||||
|
Duplicates of values in preamble.
|
||||||
|
.TP
|
||||||
|
.I l
|
||||||
|
Height-plus-depth of tallest page, in DVI units.
|
||||||
|
.TP
|
||||||
|
.I u
|
||||||
|
Width of widest page, in DVI units.
|
||||||
|
.TP
|
||||||
|
.I s
|
||||||
|
Maximum stack depth needed to process this DVI file.
|
||||||
|
.TP
|
||||||
|
.I t
|
||||||
|
Total number of pages
|
||||||
|
.RI ( bop
|
||||||
|
commands) present.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
.I "249 post_post q[4] i[1] 223 .\|.\|. 223"
|
||||||
|
End postamble. The parameters are:
|
||||||
|
.RS
|
||||||
|
.TP \w'\fI223\fP'u+3n
|
||||||
|
.I q
|
||||||
|
Byte offset from the beginning of the DVI file to
|
||||||
|
the
|
||||||
|
.I post
|
||||||
|
command that started the postamble.
|
||||||
|
.TP
|
||||||
|
.I i
|
||||||
|
DVI format ID, as in the preamble.
|
||||||
|
.TP
|
||||||
|
.I
|
||||||
|
223
|
||||||
|
At least four
|
||||||
|
.I 223
|
||||||
|
bytes.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
.I "250"
|
||||||
|
Undefined.
|
||||||
|
.TP
|
||||||
|
.I .\|.\|.
|
||||||
|
.TP
|
||||||
|
.I "255"
|
||||||
|
Undefined.
|
||||||
|
.\"======================================================================
|
||||||
|
.SH "DTL COMMAND DESCRIPTION"
|
||||||
|
A DTL file contains one line per command, with a
|
||||||
|
limit of 1024 characters per line. Each command
|
||||||
|
contains a symbolic operation name, followed by
|
||||||
|
zero or more parameter values. The parameter
|
||||||
|
value descriptions are not repeated here; they can
|
||||||
|
be found in the previous section.
|
||||||
|
.TP \w'\fIw0,_w1,_w2,_w3,_w4\fP'u+3n
|
||||||
|
variety <variety-name>
|
||||||
|
This command specifies the name of the DTL file
|
||||||
|
type; it has no DVI file equivalent.
|
||||||
|
.TP
|
||||||
|
.I (text)
|
||||||
|
Series of set_char commands, for printable ASCII text.
|
||||||
|
.TP
|
||||||
|
.I \e(
|
||||||
|
Literal ASCII left parenthesis in (text).
|
||||||
|
.TP
|
||||||
|
.I \e)
|
||||||
|
Literal ASCII right parenthesis in (text).
|
||||||
|
.TP
|
||||||
|
.I \e\e
|
||||||
|
Literal ASCII backslash in (text).
|
||||||
|
.TP
|
||||||
|
.I \e"
|
||||||
|
Literal ASCII double quote in (text).
|
||||||
|
.TP
|
||||||
|
.I \eXY
|
||||||
|
Set_char for character with hexadecimal code XY,
|
||||||
|
not in parentheses, but by itself for readability.
|
||||||
|
.TP
|
||||||
|
.I "s1, s2, s2, s3"
|
||||||
|
Set, with (1,2,3,4)-byte charcodes.
|
||||||
|
.TP
|
||||||
|
.I sr
|
||||||
|
.IR set_rule .
|
||||||
|
.TP
|
||||||
|
.I "p1, p2, p2, p3"
|
||||||
|
Put, with (1,2,3,4)-byte charcodes.
|
||||||
|
.TP
|
||||||
|
.I pr
|
||||||
|
.IR put_rule .
|
||||||
|
.TP
|
||||||
|
.I nop
|
||||||
|
.I nop
|
||||||
|
(do nothing).
|
||||||
|
.TP
|
||||||
|
.I bop
|
||||||
|
.I bop
|
||||||
|
(beginning of page).
|
||||||
|
.TP
|
||||||
|
.I eop
|
||||||
|
.I eop
|
||||||
|
(end of page).
|
||||||
|
.TP
|
||||||
|
.I [
|
||||||
|
Push.
|
||||||
|
.TP
|
||||||
|
.I ]
|
||||||
|
Pop.
|
||||||
|
.TP
|
||||||
|
.I "r1, r2, r3, r4"
|
||||||
|
Right, with (1,2,3,4)-byte argument.
|
||||||
|
.TP
|
||||||
|
.I "w0, w1, w2, w3, w4"
|
||||||
|
As in DVI.
|
||||||
|
.TP
|
||||||
|
.I "x0, x1, x2, x3, x4"
|
||||||
|
As in DVI.
|
||||||
|
.TP
|
||||||
|
.I "d1, d2, d3, d4"
|
||||||
|
Down, with (1,2,3,4)-byte argument.
|
||||||
|
.TP
|
||||||
|
.I "y0, y1, y2, y3, y4"
|
||||||
|
As in DVI.
|
||||||
|
.TP
|
||||||
|
.I "z0, z1, z2, z3, z4"
|
||||||
|
As in DVI.
|
||||||
|
.TP
|
||||||
|
.I fn
|
||||||
|
.I fnt_num
|
||||||
|
(set current font to font number in 0 to 63).
|
||||||
|
.TP
|
||||||
|
.I "f1, f2, f3, f4"
|
||||||
|
.I fnt
|
||||||
|
(set current font to (1,2,3,4)-byte font number).
|
||||||
|
.TP
|
||||||
|
.I special
|
||||||
|
.I xxx
|
||||||
|
(special commands with (1,2,3,4)-byte string length).
|
||||||
|
.TP
|
||||||
|
.I fd
|
||||||
|
.I fnt_def
|
||||||
|
(assign a number to a named font).
|
||||||
|
.TP
|
||||||
|
.I pre
|
||||||
|
Preamble.
|
||||||
|
.TP
|
||||||
|
.I post
|
||||||
|
.I post
|
||||||
|
(begin postamble).
|
||||||
|
.TP
|
||||||
|
.I post_post
|
||||||
|
.I post_post
|
||||||
|
(end postamble).
|
||||||
|
.TP
|
||||||
|
.I opcode
|
||||||
|
Undefined DVI command (250 to 255).
|
||||||
|
.\"======================================================================
|
||||||
|
.SH "SAMPLE DTL FILE"
|
||||||
|
The following 2-line \*(Te\& file
|
||||||
|
.RS
|
||||||
|
.nf
|
||||||
|
Hello.
|
||||||
|
\ebye
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
when processed with the commands
|
||||||
|
.RS
|
||||||
|
.nf
|
||||||
|
tex hello.tex
|
||||||
|
dv2dt hello.dvi hello.dtl
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
produces this DTL file:
|
||||||
|
.RS
|
||||||
|
.nf
|
||||||
|
variety sequences-6
|
||||||
|
pre 2 25400000 473628672 1000 27 ' TeX output 1995.03.02:2334'
|
||||||
|
bop 1 0 0 0 0 0 0 0 0 0 -1
|
||||||
|
[
|
||||||
|
d3 -917504
|
||||||
|
]
|
||||||
|
d4 42152922
|
||||||
|
[
|
||||||
|
d4 -41497562
|
||||||
|
[
|
||||||
|
r3 1310720
|
||||||
|
fd1 0 11374260171 655360 655360 0 5 '' 'cmr10'
|
||||||
|
fn0
|
||||||
|
(Hello.)
|
||||||
|
]
|
||||||
|
]
|
||||||
|
d3 1572864
|
||||||
|
[
|
||||||
|
r4 15229091
|
||||||
|
(1)
|
||||||
|
]
|
||||||
|
eop
|
||||||
|
post 42 25400000 473628672 1000 43725786 30785863 2 1
|
||||||
|
fd1 0 11374260171 655360 655360 0 5 'cmr10'
|
||||||
|
post_post 152 2 223 223 223 223
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
The command
|
||||||
|
.RS
|
||||||
|
.nf
|
||||||
|
dt2dv hello.dtl hello.dvi
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
will reconstruct the original DVI file.
|
||||||
|
.\"======================================================================
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR dt2dv (1),
|
||||||
|
.BR dvitype (1),
|
||||||
|
.BR tex (1).
|
||||||
|
.\"======================================================================
|
||||||
|
.SH FILES
|
||||||
|
.TP \w'\fI*.dvi\fP'u+3n
|
||||||
|
.I *.dvi
|
||||||
|
binary \*(Te\& DVI file.
|
||||||
|
.TP
|
||||||
|
.I *.dtl
|
||||||
|
text representation of a \*(Te\& DVI file in
|
||||||
|
.I "DVI Text Language"
|
||||||
|
format.
|
||||||
|
.\"======================================================================
|
||||||
|
.SH AUTHOR
|
||||||
|
.B dv2dt
|
||||||
|
and
|
||||||
|
.BR dt2dv (1)
|
||||||
|
were written by
|
||||||
|
.RS
|
||||||
|
.nf
|
||||||
|
Geoffrey Tobin
|
||||||
|
Department of Electronic Engineering
|
||||||
|
La Trobe University
|
||||||
|
Bundoora, Victoria 3083
|
||||||
|
Australia
|
||||||
|
Tel: +61 3 479 3736
|
||||||
|
FAX: +61 3 479 3025
|
||||||
|
Email: <G.Tobin@ee.latrobe.edu.au>
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
These manual pages were primarily written by
|
||||||
|
.RS
|
||||||
|
.nf
|
||||||
|
Nelson H. F. Beebe, Ph.D.
|
||||||
|
Center for Scientific Computing
|
||||||
|
Department of Mathematics
|
||||||
|
University of Utah
|
||||||
|
Salt Lake City, UT 84112
|
||||||
|
Tel: +1 801 581 5254
|
||||||
|
FAX: +1 801 581 4148
|
||||||
|
Email: <beebe@math.utah.edu>
|
||||||
|
.fi
|
||||||
|
.RE
|
||||||
|
.\"==============================[The End]==============================
|
159
3rdparty/dtl/dvi.doc
vendored
Normal file
159
3rdparty/dtl/dvi.doc
vendored
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
This file is public domain.
|
||||||
|
Originally written 1995, Geoffrey Tobin.
|
||||||
|
The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
|
||||||
|
This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
|
||||||
|
|
||||||
|
``dvi.doc''
|
||||||
|
Mon 27 Feb 1995
|
||||||
|
Geoffrey Tobin
|
||||||
|
|
||||||
|
Description of the DVI file structure.
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
Reference:
|
||||||
|
----------
|
||||||
|
|
||||||
|
CTAN: dviware/driv-standard/level-0/dvistd0.tex
|
||||||
|
|
||||||
|
"The DVI Driver Standard, Level 0",
|
||||||
|
by The TUG DVI Driver Standards Committee (now defunct)
|
||||||
|
chaired by Joachim Schrod.
|
||||||
|
Appendix A, "Device-Independent File Format",
|
||||||
|
section A.2, "Summary of DVI commands".
|
||||||
|
|
||||||
|
|
||||||
|
DVI Commands
|
||||||
|
------------
|
||||||
|
Listed in the free format:
|
||||||
|
"Opcode Symbol Parameter[Signed? Bytes] ... Action".
|
||||||
|
|
||||||
|
|
||||||
|
0 set_char_0 - set character 0 from current font
|
||||||
|
...
|
||||||
|
127 set_char_127 - set character 127 from current font
|
||||||
|
|
||||||
|
128 set1 c[1] - set 1-byte unsigned character (uchar) number c
|
||||||
|
129 set2 c[2] - set 2-byte uchar number c
|
||||||
|
130 set3 c[3] - set 3-byte uchar number c
|
||||||
|
131 set4 c[+4] - set 4-byte signed character (schar) number c
|
||||||
|
|
||||||
|
132 set_rule a[+4] b[+4] - set rule, height a, width b
|
||||||
|
|
||||||
|
133 put1 c[1] - put 1-byte uchar c
|
||||||
|
134 put2 c[2] - put 2-byte uchar
|
||||||
|
135 put3 c[3] - put 3-byte uchar
|
||||||
|
136 put4 c[+4] - put 4-byte schar
|
||||||
|
|
||||||
|
137 put_rule a[+4] b[+4] - put rule, height a, width b
|
||||||
|
|
||||||
|
138 nop - do nothing
|
||||||
|
|
||||||
|
139 bop c0[+4] ... c9[+4] p[+4] - beginning of page
|
||||||
|
140 eop - end of page
|
||||||
|
|
||||||
|
141 push - push (h,v,w,x,y,z) onto stack
|
||||||
|
142 pop - pop (h,v,w,x,y,z) from stack
|
||||||
|
|
||||||
|
143 right1 b[+1] - move right b units
|
||||||
|
144 right2 b[+2] - move right b units
|
||||||
|
145 right3 b[+3] - move right b units
|
||||||
|
146 right4 b[+4] - move right b units
|
||||||
|
|
||||||
|
147 w0 - move right w units
|
||||||
|
148 w1 b[+1] - move right b units, and set w = b
|
||||||
|
149 w2 b[+2] - move right b units, and set w = b
|
||||||
|
150 w3 b[+3] - move right b units, and set w = b
|
||||||
|
151 w4 b[+4] - move right b units, and set w = b
|
||||||
|
|
||||||
|
152 x0 - move right x units
|
||||||
|
153 x1 b[+1] - move right b units, and set x = b
|
||||||
|
154 x2 b[+2] - move right b units, and set x = b
|
||||||
|
155 x3 b[+3] - move right b units, and set x = b
|
||||||
|
156 x4 b[+4] - move right b units, and set x = b
|
||||||
|
|
||||||
|
157 down1 a[+1] - move down a units
|
||||||
|
158 down2 a[+2] - move down a units
|
||||||
|
159 down3 a[+3] - move down a units
|
||||||
|
160 down4 a[+4] - move down a units
|
||||||
|
|
||||||
|
161 y0 - move right y units
|
||||||
|
162 y1 a[+1] - move right a units, and set y = a
|
||||||
|
163 y2 a[+2] - move right a units, and set y = a
|
||||||
|
164 y3 a[+3] - move right a units, and set y = a
|
||||||
|
165 y4 a[+4] - move right a units, and set y = a
|
||||||
|
|
||||||
|
166 z0 - move right z units
|
||||||
|
167 z1 a[+1] - move right a units, and set z = a
|
||||||
|
168 z2 a[+2] - move right a units, and set z = a
|
||||||
|
169 z3 a[+3] - move right a units, and set z = a
|
||||||
|
170 z4 a[+4] - move right a units, and set z = a
|
||||||
|
|
||||||
|
171 fnt_num_0 - set current font number (f) = 0
|
||||||
|
...
|
||||||
|
234 fnt_num_63 - set f = 63
|
||||||
|
|
||||||
|
235 fnt1 k[1] - set f = k
|
||||||
|
236 fnt2 k[2] - set f = k
|
||||||
|
237 fnt3 k[3] - set f = k
|
||||||
|
238 fnt4 k[+4] - set f = k
|
||||||
|
|
||||||
|
239 xxx1 k[1] x[k] - special string x with k bytes
|
||||||
|
240 xxx2 k[2] x[k] - special string x with k bytes
|
||||||
|
241 xxx3 k[3] x[k] - special string x with k bytes
|
||||||
|
242 xxx4 k[4] x[k] - special string x with (unsigned) k bytes
|
||||||
|
|
||||||
|
243 fnt_def1 k[1] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k
|
||||||
|
244 fnt_def2 k[2] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k
|
||||||
|
245 fnt_def3 k[3] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k
|
||||||
|
246 fnt_def4 k[+4] c[4] s[4] d[4] a[1] l[1] n[a+l] - define font k
|
||||||
|
|
||||||
|
247 pre i[1] num[4] den[4] mag[4] k[1] x[k] - begin preamble
|
||||||
|
|
||||||
|
248 post p[4] num[4] den[4] mag[4] l[4] u[4] s[2] t[2] - begin postamble
|
||||||
|
249 post_post q[4] i[1] 223 ... 223 - end postamble
|
||||||
|
|
||||||
|
250 - undefined
|
||||||
|
...
|
||||||
|
255 - undefined
|
||||||
|
|
||||||
|
In bop:
|
||||||
|
|
||||||
|
c0[+4] ... c9[+4] = page counters, \`a la TeX.
|
||||||
|
p[+4] = pointer to previous bop (its byte address); first bop has p = -1 .
|
||||||
|
|
||||||
|
In the font definitions:
|
||||||
|
|
||||||
|
c[4] = check sum for TFM file.
|
||||||
|
s[4] = scale factor, in DVI units.
|
||||||
|
d[4] = design size, in DVI units.
|
||||||
|
a[1] = length of the "area" or directory.
|
||||||
|
l[1] = length of the font name.
|
||||||
|
n[a+l] = area and font name string(s).
|
||||||
|
|
||||||
|
In the preamble:
|
||||||
|
|
||||||
|
i[1] = DVI format ID = 2, except TeX-XeT has 3.
|
||||||
|
num[4] = numerator of 100 nm / DVI unit.
|
||||||
|
den[4] = denominator of 100 nm / DVI unit.
|
||||||
|
mag[4] = 1000 * magnification.
|
||||||
|
k[1] = comment length.
|
||||||
|
x[k] = comment string.
|
||||||
|
|
||||||
|
In the postamble:
|
||||||
|
|
||||||
|
p[4] = pointer to final bop.
|
||||||
|
num[4], den[4], mag[4] = duplicates of values in preamble.
|
||||||
|
l[4] = height-plus-depth of tallest page, in DVI units.
|
||||||
|
u[4] = width of widest page, in DVI units.
|
||||||
|
s[2] = maximum stack depth needed to process this DVI file.
|
||||||
|
t[2] = total number of pages (bop commands) present.
|
||||||
|
|
||||||
|
In the post-postamble:
|
||||||
|
|
||||||
|
q[4] = pointer to the "post" command that started the postamble.
|
||||||
|
i[1] = DVI format ID, as in the preamble.
|
||||||
|
223 ... 223 = at least four "223" bytes.
|
||||||
|
|
||||||
|
---------------
|
||||||
|
EOF ``dvi.doc''
|
||||||
|
---------------
|
3854
3rdparty/dtl/edited.txt
vendored
Normal file
3854
3rdparty/dtl/edited.txt
vendored
Normal file
File diff suppressed because it is too large
Load Diff
237
3rdparty/dtl/example.tex
vendored
Normal file
237
3rdparty/dtl/example.tex
vendored
Normal file
@ -0,0 +1,237 @@
|
|||||||
|
% This file is public domain.
|
||||||
|
% Originally written 1995, Geoffrey Tobin.
|
||||||
|
% The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
|
||||||
|
% This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
|
||||||
|
|
||||||
|
% This is the TeX source file for the "TeXnical Typesetting" document.
|
||||||
|
% Notice how you can put in comments? If TeX sees a % it simply ignores
|
||||||
|
% the rest of the line.
|
||||||
|
|
||||||
|
% A4 paper is 8.3in wide and 11.7in high; we set the page dimensions so that
|
||||||
|
% there are 1in margins all around:
|
||||||
|
\hsize 6.3in % page width
|
||||||
|
\vsize 9.7in % page height
|
||||||
|
|
||||||
|
\parskip 8pt plus 2pt minus 1pt % glue before a paragraph
|
||||||
|
|
||||||
|
% Define a few extra fonts for later use:
|
||||||
|
\font\bigrm=cmr10 scaled\magstep4 % big version of the standard roman font
|
||||||
|
\font\ninerm=cmr9 % 9pt roman
|
||||||
|
\font\fiverm=cmr5 % 5pt roman
|
||||||
|
\font\sm=cmcsc10 % caps and small caps
|
||||||
|
\font\ss=cmss10 % sans serif
|
||||||
|
|
||||||
|
% Here's a macro that we'll use to produce all subheadings:
|
||||||
|
\def\subhead#1{\bigskip % extra glue before subheading
|
||||||
|
\noindent{\bf #1}\par % unindented boldface subheading
|
||||||
|
\nobreak} % prevent a page break after subheading
|
||||||
|
|
||||||
|
\centerline{\bigrm \TeX nical Typesetting}
|
||||||
|
|
||||||
|
\vskip 2.5cm % dimensions can be metric
|
||||||
|
|
||||||
|
\subhead{What is \TeX?}
|
||||||
|
|
||||||
|
\TeX\ (pronounced ``teck'') is a computerized typesetting system developed by
|
||||||
|
Donald Knuth and others at Stanford University. It is used to create
|
||||||
|
high-quality documents, particularly those containing mathematics.
|
||||||
|
The name \TeX\ is an uppercase form of the Greek letters $\tau\epsilon\chi$,
|
||||||
|
the first three letters of a Greek word meaning {\sl art} as well as
|
||||||
|
{\sl technology}.
|
||||||
|
The lowering of the ``E'' is a reminder that \TeX\ is about typesetting,
|
||||||
|
which can be thought of as the next stage beyond word processing.
|
||||||
|
On devices where such lowering is difficult or impossible you may see \TeX\
|
||||||
|
written as {\tt TeX}.
|
||||||
|
|
||||||
|
% the above blank line ends the first paragraph
|
||||||
|
|
||||||
|
Most word processors allow you to
|
||||||
|
create and modify a document interactively --- what
|
||||||
|
you see on the screen is usually what your output will look like.
|
||||||
|
\TeX\ does {\it not} work in this way.
|
||||||
|
Like other typesetting systems (such as SCRIBE and
|
||||||
|
{\sl troff\/}), \TeX\ is known as a ``document compiler''. Using your
|
||||||
|
favourite text editor you need to create a file containing the
|
||||||
|
text of your manuscript along with the \TeX\ typesetting commands.
|
||||||
|
\TeX\ gives you the ability to produce printed matter with a quality
|
||||||
|
matching that found in books, depending on the output device.
|
||||||
|
Adelaide University has an {\sm imagen} laser printer
|
||||||
|
with a resolution of 240 dots per inch.
|
||||||
|
This publication shows both the capabilities of \TeX\ and
|
||||||
|
the output quality of the laser printer.
|
||||||
|
|
||||||
|
\subhead{Fonts}
|
||||||
|
|
||||||
|
One of the more obvious advantages of \TeX\ is the large range of fonts from
|
||||||
|
which you can choose. A font is a collection of characters each having a
|
||||||
|
similar size and style. Some of the fonts currently available include:
|
||||||
|
$$ % enter display math mode just to get space above and below \line
|
||||||
|
\line
|
||||||
|
{\hfil % infinitely stretchable glue
|
||||||
|
\rm roman\hfil \sl slanted\hfil \it italic\hfil \bf boldface\hfil
|
||||||
|
\tt typewriter\hfil \ss sans serif\hfil \sm small caps\hfil
|
||||||
|
} % take care to ensure each { has a matching }
|
||||||
|
$$
|
||||||
|
Many of these also come in a variety of sizes:
|
||||||
|
$$
|
||||||
|
\centerline{{\bigrm from the very big},~ % extra space after comma
|
||||||
|
{\ninerm to the very small},~
|
||||||
|
{\fiverm to the ridiculous}.}
|
||||||
|
$$
|
||||||
|
Apart from a large selection of mathematical symbols,
|
||||||
|
many special characters and accents are available:
|
||||||
|
$$
|
||||||
|
\vbox
|
||||||
|
{\tabskip 10pt plus 1fil % glue before and after all columns
|
||||||
|
\halign to\hsize
|
||||||
|
{& \hfil#\hfil\cr % specify a variable number of centred columns
|
||||||
|
\copyright& \it\$& \S& \P& \dag& \ddag&
|
||||||
|
$\circ$& $\bigcirc$& % some symbols must be accessed from math mode
|
||||||
|
$\leftarrow$& $\rightarrow$& $\triangle$& $\clubsuit$&
|
||||||
|
\`a& \'e& \c c& \^o& \"u\cr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$$
|
||||||
|
\TeX\ does a few subtle things automatically.
|
||||||
|
Certain sequences of characters in your text will
|
||||||
|
be replaced by {\sl ligatures} in the printed output (consider the ``{\tt ffi}''
|
||||||
|
in ``difficult''), while other pairs of characters need to be {\sl kerned}
|
||||||
|
(e.g., the ``o'' and ``x'' in ``box'' look better if they are moved closer
|
||||||
|
together). The range and quality of fonts available will continue to improve.
|
||||||
|
|
||||||
|
\subhead{Mathematics}
|
||||||
|
|
||||||
|
A major design goal of \TeX\ was to simplify the task of typesetting
|
||||||
|
mathematics --- and to do it properly. Mathematicians will be pleasantly
|
||||||
|
surprised at the ease with which formulae and expressions can be created;
|
||||||
|
from simple in-line equations
|
||||||
|
such as $e^{i\pi}=-1$ and $f_{n+2}=f_{n+1}+f_n$, to more extravagant displays:
|
||||||
|
$$
|
||||||
|
\sum_{k\ge1} \sqrt{x_k-\ln k}\quad\ne\quad
|
||||||
|
\int_{0}^\infty {e^{-x^3}+\sqrt{x} \over \left(123-x\right)^3} \,dx
|
||||||
|
$$
|
||||||
|
\TeX\ looks after most of the nitty gritty details, such as spacing things
|
||||||
|
correctly and choosing the right sizes for superscripts, parentheses,
|
||||||
|
square root signs etc. (The discoverer of the above relation wishes to
|
||||||
|
remain anonymous.)
|
||||||
|
|
||||||
|
\subhead{Alignment}
|
||||||
|
|
||||||
|
The preparation of tabular material such as in lists and matrices can be a
|
||||||
|
tedious job for a person armed only with a typewriter and a bottle of
|
||||||
|
correction fluid. With a little help from \TeX, computers can make it so
|
||||||
|
much easier:
|
||||||
|
$$
|
||||||
|
\vcenter % a vertically centred \vbox
|
||||||
|
{\tabskip 0pt % no space before column 1
|
||||||
|
\halign to 3.5in % width of table
|
||||||
|
{\strut#& % col 1 is a strut
|
||||||
|
\vrule#\tabskip .5em plus2em& % col 2 is a vrule; also set col spacing
|
||||||
|
#\hfil& % col 3 is left justified
|
||||||
|
\vrule#& % col 4 is a vrule
|
||||||
|
\hfil#\hfil& % col 5 is centred
|
||||||
|
\vrule#& % col 6 is a vrule
|
||||||
|
\hfil#& % col 7 is right justified
|
||||||
|
\vrule#\tabskip 0pt % col 8 is a vrule; no space after it
|
||||||
|
\cr % end of the preamble
|
||||||
|
\noalign{\hrule}
|
||||||
|
& & \multispan5 \hfil Oldest players to represent\hfil& \cr
|
||||||
|
& & \multispan5 \hfil England in a Test Match\hfil& \cr
|
||||||
|
\noalign{\hrule}
|
||||||
|
& & \omit\hfil Name\hfil& & % \omit ignores template in preamble
|
||||||
|
\omit\hfil Age\hfil& &
|
||||||
|
\omit\hfil Versus\hfil& \cr
|
||||||
|
\noalign{\hrule}
|
||||||
|
& & W.Rhodes& & 52y 165d& & West Indies, 1930& \cr
|
||||||
|
\noalign{\hrule}
|
||||||
|
& & W.G.Grace& & 50y 320d& & Australia, 1899& \cr
|
||||||
|
\noalign{\hrule}
|
||||||
|
& & G.Gunn& & 50y 303d& & West Indies, 1929& \cr
|
||||||
|
\noalign{\hrule}
|
||||||
|
& & J.Southerton{\ninerm*}& & 49y 139d& & Australia, 1877& \cr
|
||||||
|
\noalign{\hrule\smallskip}
|
||||||
|
& \multispan7\ninerm* (This was actually his Test debut.)\hfil \cr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\hskip .5in % space between table and matrix
|
||||||
|
A=\pmatrix % parenthesized matrix
|
||||||
|
{a_{11}& a_{12}& \ldots& a_{1n}\cr
|
||||||
|
a_{21}& a_{22}& \ldots& a_{2n}\cr
|
||||||
|
\vdots& \vdots& \ddots& \vdots\cr
|
||||||
|
a_{m1}& a_{m2}& \ldots& a_{mn}\cr
|
||||||
|
}
|
||||||
|
$$
|
||||||
|
|
||||||
|
\vskip -\the\belowdisplayskip % avoid too much space below display
|
||||||
|
|
||||||
|
\subhead{Other features}
|
||||||
|
|
||||||
|
Space does not permit examples of all the things \TeX\ can do. Here are some
|
||||||
|
more features you might like to know about:
|
||||||
|
|
||||||
|
\item{$\bullet$}
|
||||||
|
Multi-column output can be generated.
|
||||||
|
|
||||||
|
{\parskip=0pt % temporarily turn off the skipping between paragraphs
|
||||||
|
\item{$\bullet$}
|
||||||
|
\TeX\ has a very sophisticated paragraph building algorithm and rarely needs
|
||||||
|
to resort to hyphenation. Paragraphs can be indented and shaped in many
|
||||||
|
different ways.
|
||||||
|
|
||||||
|
\item{$\bullet$}
|
||||||
|
Automatic insertion of footnotes,\footnote{\dag}{\ninerm Here is
|
||||||
|
a footnote.} running heads, page numbers etc.
|
||||||
|
|
||||||
|
\item{$\bullet$}
|
||||||
|
\TeX\ makes provision for generating a table of contents, a bibliography, even
|
||||||
|
an index. Automatic section numbering and cross referencing are also possible.
|
||||||
|
|
||||||
|
\item{$\bullet$}
|
||||||
|
A powerful macro facility is built into \TeX. This lets you do some very
|
||||||
|
useful things, like creating an abbreviation for a commonly used phrase, or
|
||||||
|
defining a new command that will have varying effects depending on the
|
||||||
|
parameters it is given. A macro package can enhance \TeX\ by making it much
|
||||||
|
easier to generate a document in a predefined format.
|
||||||
|
\par % end the last paragraph BEFORE ending the group
|
||||||
|
} % \parskip will now revert to its previous value
|
||||||
|
|
||||||
|
\subhead{What CAN'T \TeX\ do?}
|
||||||
|
|
||||||
|
Complex graphics such as diagrams and illustrations pose
|
||||||
|
a major problem --- at the moment you have to leave an appropriate amount of
|
||||||
|
blank space and paste them in later.
|
||||||
|
Graphic facilities are the subject of current research.
|
||||||
|
|
||||||
|
\subhead{\TeX\ and VAX/VMS}
|
||||||
|
|
||||||
|
The \TeX\ source file used to generate this document is available for
|
||||||
|
inspection on any VAX node that has \TeX ---
|
||||||
|
just type `{\tt scroll tex\char'137 inputs:example.tex}'.
|
||||||
|
A few steps are needed to print such a file:
|
||||||
|
|
||||||
|
\item{(1)}
|
||||||
|
Type `{\tt tex example}' to ``compile'' the file.
|
||||||
|
(\TeX\ looks for a {\tt .tex} file by default. If it can't find the given
|
||||||
|
file in your current directory it will look in {\tt tex\char'137 inputs}.)
|
||||||
|
Two new files will be created in your current directory:
|
||||||
|
{\tt example.dvi} and {\tt example.lis}.
|
||||||
|
The former is a device independent description of the document;
|
||||||
|
the latter is simply a log of the \TeX\ run.
|
||||||
|
|
||||||
|
{\parskip=0pt % temporarily turn off \parskip
|
||||||
|
\item{(2)}
|
||||||
|
Type `{\tt dvitovdu example}' to preview the document on a terminal screen.
|
||||||
|
This program can be used to detect a variety of formatting problems,
|
||||||
|
saving both time and paper.
|
||||||
|
|
||||||
|
\item{(3)}
|
||||||
|
Type `{\tt imprint example}' to print the document.
|
||||||
|
(Note that the DVIto\kern-.15em VDU and IMPRINT commands
|
||||||
|
accept a {\tt .dvi} file by default).
|
||||||
|
|
||||||
|
} % restore \parskip
|
||||||
|
|
||||||
|
Detailed help on all these commands is available on-line --- try typing
|
||||||
|
`{\tt help tex}' to get started.
|
||||||
|
|
||||||
|
\bye
|
7
3rdparty/dtl/hello.tex
vendored
Normal file
7
3rdparty/dtl/hello.tex
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
% This file is public domain.
|
||||||
|
% Originally written 1995, Geoffrey Tobin.
|
||||||
|
% The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
|
||||||
|
% This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
|
||||||
|
|
||||||
|
Hello.
|
||||||
|
\bye
|
41
3rdparty/dtl/man2ps
vendored
Normal file
41
3rdparty/dtl/man2ps
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# This file is public domain.
|
||||||
|
# Originally written 1995, Geoffrey Tobin.
|
||||||
|
# The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
|
||||||
|
# This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
|
||||||
|
#
|
||||||
|
# Filter for converting "troff -mxx" to PostScript. This script is
|
||||||
|
# normally linked to the names man2ps, ms2ps, me2ps, and mm2ps.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# man2ps [<] cc.1 >cc.ps
|
||||||
|
# me2ps [<] foo.me >foo.ps
|
||||||
|
# mm2ps [<] foo.mm >foo.ps
|
||||||
|
# ms2ps [<] foo.ms >foo.ps
|
||||||
|
#
|
||||||
|
# [08-May-1993]
|
||||||
|
|
||||||
|
# Choose a troff format according to the scrip name.
|
||||||
|
case `basename $0` in
|
||||||
|
man*) FORMAT=-man ;;
|
||||||
|
me*) FORMAT=-me ;;
|
||||||
|
mm*) FORMAT=-mm ;;
|
||||||
|
ms*) FORMAT=-ms ;;
|
||||||
|
*) echo "Unknown troff format:" ; exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# We can use either GNU groff or Sun Solaris troff + dpost
|
||||||
|
if [ -x /usr/local/bin/groff ]
|
||||||
|
then # GNU groff
|
||||||
|
TROFF="groff $FORMAT"
|
||||||
|
TROFF2PS="cat"
|
||||||
|
elif [ -x /usr/lib/lp/postscript/dpost ]
|
||||||
|
then # Solaris 2.1
|
||||||
|
TROFF="troff $FORMAT"
|
||||||
|
TROFF2PS="/usr/lib/lp/postscript/dpost"
|
||||||
|
else
|
||||||
|
echo "Cannot find troff-to-PostScript filter"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
tbl $* | eqn | $TROFF | $TROFF2PS
|
284
3rdparty/dtl/tripvdu.tex
vendored
Normal file
284
3rdparty/dtl/tripvdu.tex
vendored
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
% This file is public domain.
|
||||||
|
% Originally written 1995, Geoffrey Tobin.
|
||||||
|
% The author has expressed the hope that any modification will retain enough content to remain useful. He would also appreciate being acknowledged as the original author in the documentation.
|
||||||
|
% This declaration added 2008/11/14 by Clea F. Rees with the permission of Geoffrey Tobin.
|
||||||
|
|
||||||
|
% TeX source file for creating TRIPVDU.DVI, a torture file for DVItoVDU
|
||||||
|
% (using the same philosophy as Donald Knuth's torture test for TeX).
|
||||||
|
|
||||||
|
\nopagenumbers
|
||||||
|
\topskip 0pt
|
||||||
|
\parindent 0pt
|
||||||
|
\parskip 0pt
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 1
|
||||||
|
% This page is completely empty but has some \special stuff.
|
||||||
|
|
||||||
|
\message{Empty page.}
|
||||||
|
\null
|
||||||
|
\special{DVItoVDU should warn user that it is ignoring this stuff.}
|
||||||
|
\special{And this.}
|
||||||
|
\vfil\eject
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 2
|
||||||
|
% This page has 1 black pixel at (0,0).
|
||||||
|
|
||||||
|
\message{1 black pixel at (0,0).}
|
||||||
|
\hrule height 1sp width 1sp depth 0sp
|
||||||
|
\vfil\eject
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 3
|
||||||
|
% This page will fill an A4 sheet with black pixels, assuming A4 paper is
|
||||||
|
% 8.3in by 11.7in and (0,0) is 1in from the top and left edges.
|
||||||
|
|
||||||
|
\message{A4 sheet full of black pixels.}
|
||||||
|
{% change page size and location temporarily
|
||||||
|
\hsize 10in
|
||||||
|
\vsize 12in
|
||||||
|
\hoffset -1in
|
||||||
|
\voffset -1in
|
||||||
|
% Because ref pts of rules are at BOTTOM left corner we first need to output
|
||||||
|
% a rule that will guarantee Minv = -1in, then output the large rule with
|
||||||
|
% slightly less than A4 height.
|
||||||
|
\hrule height 1sp width 8.299in depth 0sp
|
||||||
|
\hrule height 11.695in width 8.299in depth 0sp
|
||||||
|
\vfil\eject
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 4
|
||||||
|
% This page is 1 pixel wider than page 3.
|
||||||
|
% DVItoVDU should detect that page is too wide for A4 paper.
|
||||||
|
|
||||||
|
\message{As above but 1 pixel too wide.}
|
||||||
|
\hrule height 1sp width 8.301in depth 0sp
|
||||||
|
\hrule height 11.695in width 8.301in depth 0sp
|
||||||
|
\vfil\eject
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 5
|
||||||
|
% This page is 1 pixel longer than page 3.
|
||||||
|
% DVItoVDU should detect that page is too low for A4 paper.
|
||||||
|
|
||||||
|
\message{As above but 1 pixel too low.}
|
||||||
|
\hrule height 11.701in width 8.299in depth 0sp
|
||||||
|
\vfil\eject
|
||||||
|
|
||||||
|
}% reset page size and location
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 6
|
||||||
|
% This page has a rulelist with a full ruletable (= 300 rules).
|
||||||
|
% Note that DVItoVDU does not impose any limits
|
||||||
|
% on the number of rules or characters in a page. Pages 6 to 9
|
||||||
|
% test the list manipulating code in DVIReader and DVItoVDU.
|
||||||
|
|
||||||
|
\message{Page with ruletablesize rules.}
|
||||||
|
\newcount\temp
|
||||||
|
\temp=300
|
||||||
|
\loop\ifnum\temp>0
|
||||||
|
\hrule height 1sp width \hsize % 1 pixel high
|
||||||
|
\vfil
|
||||||
|
\advance\temp by -1
|
||||||
|
\repeat
|
||||||
|
\vfil\eject
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 7
|
||||||
|
% This page has ruletablesize+1 rules (so rulelist has 2 nodes).
|
||||||
|
|
||||||
|
\message{Page with ruletablesize+1 rules.}
|
||||||
|
\temp=301
|
||||||
|
\loop\ifnum\temp>0
|
||||||
|
\hrule height 1sp width \hsize % 1 pixel high
|
||||||
|
\vfil
|
||||||
|
\advance\temp by -1
|
||||||
|
\repeat
|
||||||
|
\vfil\eject
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 8
|
||||||
|
% This page has a charlist with a full chartable (= 3000 characters).
|
||||||
|
|
||||||
|
\message{Page with chartablesize characters from one font.}
|
||||||
|
\font\small=cmr5
|
||||||
|
{\small \offinterlineskip
|
||||||
|
\temp=30
|
||||||
|
\loop\ifnum\temp>0
|
||||||
|
\leftline{iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||||
|
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii} % 100 chars
|
||||||
|
\advance\temp by -1
|
||||||
|
\repeat
|
||||||
|
}
|
||||||
|
\vfil\eject
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 9
|
||||||
|
% This page has chartablesize+1 characters (so charlist has 2 nodes).
|
||||||
|
|
||||||
|
\message{Page with chartablesize+1 characters from one font.}
|
||||||
|
{\small \offinterlineskip
|
||||||
|
\temp=30
|
||||||
|
\loop\ifnum\temp>0
|
||||||
|
\leftline{iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||||
|
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii} % 100 chars
|
||||||
|
\advance\temp by -1
|
||||||
|
\repeat
|
||||||
|
\leftline{i} % the extra character
|
||||||
|
}
|
||||||
|
\vfil\eject
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 10
|
||||||
|
|
||||||
|
\message{Multiple TeX page counters.}
|
||||||
|
\footline={\hss\tenrm\folio\hss} % turn on page numbers
|
||||||
|
\pageno=0
|
||||||
|
\count1=1 \count2=2 \count3=3 \count4=4 \count9=9
|
||||||
|
\noindent
|
||||||
|
This is \TeX\ page [0.1.2.3.4.....9].
|
||||||
|
\vfil\eject
|
||||||
|
|
||||||
|
\count1=0 \count2=0 \count3=0 \count4=0 \count9=0 % reset TeX counters
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 11
|
||||||
|
|
||||||
|
\message{Negative TeX page.}
|
||||||
|
\pageno=-11
|
||||||
|
\noindent
|
||||||
|
This is \TeX\ page [-11].
|
||||||
|
\vfil\eject
|
||||||
|
|
||||||
|
\pageno=12 % DVI page = TeX page again
|
||||||
|
\nopagenumbers % turn off page numbers again
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 12
|
||||||
|
% This page has characters from many fonts.
|
||||||
|
% Note that the page is off the right edge of A4 paper.
|
||||||
|
|
||||||
|
\message{Page with characters from many fonts.}
|
||||||
|
% avoid redefining plain TeX's \i, \j etc.
|
||||||
|
\font\Fb=cmr5
|
||||||
|
\font\Fc=cmr5 scaled\magstep5
|
||||||
|
\font\Fe=cmr10 scaled\magstep5
|
||||||
|
\font\Fg=cmbx10
|
||||||
|
\font\Fh=cmbx10 scaled\magstep5
|
||||||
|
\font\Fj=cmsl10
|
||||||
|
\font\Fk=cmsl10 scaled\magstep5
|
||||||
|
\font\Fm=cmtt10
|
||||||
|
\font\Fn=cmtt10 scaled\magstep5
|
||||||
|
\font\Fo=cmss10
|
||||||
|
\font\Fp=cmcsc10
|
||||||
|
\font\Fq=cmdunh10
|
||||||
|
|
||||||
|
\leftline{\Fb These characters are from CMR5 at mag 1000.}
|
||||||
|
\leftline{\Fc These characters are from CMR5 at mag 2488.}
|
||||||
|
\leftline{\tenrm These characters are from CMR10 at mag 1000.}
|
||||||
|
\leftline{\Fe These characters are from CMR10 at mag 2488.}
|
||||||
|
\leftline{\Fg These characters are from CMBX10 at mag 1000.}
|
||||||
|
\leftline{\Fh These characters are from CMBX10 at mag 2488.}
|
||||||
|
\leftline{\Fj These characters are from CMSL10 at mag 1000.}
|
||||||
|
\leftline{\Fk These characters are from CMSL10 at mag 2488.}
|
||||||
|
\leftline{\Fm These characters are from CMTT10 at mag 1000.}
|
||||||
|
\leftline{\Fn These characters are from CMTT10 at mag 2488.}
|
||||||
|
\leftline{\Fo These characters are from CMSS10 at mag 1000.}
|
||||||
|
\leftline{\Fp These characters are from CMCSC10 at mag 1000.}
|
||||||
|
\leftline{\Fq These characters are from CMDUNH10 at mag 1000.}
|
||||||
|
\vfil\eject
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 13
|
||||||
|
% This page has characters from many fonts, some of which have no corresponding
|
||||||
|
% PXL file. DVItoVDU should warn user about non-existent font files and
|
||||||
|
% continue as best it can by loading dummy font info.
|
||||||
|
% Note that the page is off the right edge of A4 paper.
|
||||||
|
|
||||||
|
\message{Page with characters from fonts at unknown magnifications.}
|
||||||
|
% PXL files do not exist at the requested magnifications:
|
||||||
|
\font\Fr=cmr5 scaled 500
|
||||||
|
\font\Fs=cmr5 scaled 3000
|
||||||
|
\font\Ft=cmr10 scaled 200
|
||||||
|
\font\Fu=cmr10 scaled 5000
|
||||||
|
\font\Fv=cmsl10 scaled 49
|
||||||
|
\font\Fw=cmsl10 scaled 10000
|
||||||
|
|
||||||
|
\leftline{\Fr CMR5 at mag 500 does not exist.}
|
||||||
|
\leftline{\Fb These characters are from CMR5 at mag 1000.}
|
||||||
|
\leftline{\Fs CMR5 at mag 3000 does not exist.}
|
||||||
|
\leftline{\Ft CMR10 at mag 200 does not exist.}
|
||||||
|
\leftline{\tenrm These characters are from CMR10 at mag 1000.}
|
||||||
|
\leftline{\Fu CMR10 at mag 5000 does not exist.}
|
||||||
|
\leftline{\Fv CMSL10 at mag 49 does not exist.}
|
||||||
|
\leftline{\Fj These characters are from CMSL10 at mag 1000.}
|
||||||
|
\leftline{\Fw CMSL10 at mag 10000 does not exist.}
|
||||||
|
\vfil\eject
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 14
|
||||||
|
% This page has a paragraph illustrating most of the characters from the
|
||||||
|
% standard roman TeX text font.
|
||||||
|
|
||||||
|
\message{Standard paragraph.}
|
||||||
|
\rm
|
||||||
|
Our task is to create a paragraph illustrating what a typical piece of text
|
||||||
|
looks like in the standard \TeX\ font. It should be stressed that not all
|
||||||
|
\TeX\ fonts can be used for typesetting text. We need to show most of the
|
||||||
|
characters in this font---for instance, something like ``the quick brown fox
|
||||||
|
jumps over a lazy dog'' would use all the lower-case letters. Hmmm \dots\
|
||||||
|
how about ``THE QUICK BROWN FOX JUMPS OVER 9876543210 LAZY DOGS'' to make
|
||||||
|
sure we show all the upper-case letters and digits? Such a paragraph would
|
||||||
|
hardly be typical! Then there's ligatures (try and fit in words like
|
||||||
|
fluffy, waffle, firefly, difficult) and examples of kerning (boxer, cooked,
|
||||||
|
vowel). Not to mention the various accents and other special letters:
|
||||||
|
prot\'eg\'e, r\^ole, na\"\i ve, \AE sop's \OE vres en fran\c cais.
|
||||||
|
But how do we put all this stuff into a paragraph that makes sense!?
|
||||||
|
\vfil\eject
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 15
|
||||||
|
|
||||||
|
\message{Page in bottom half of A4 paper.}
|
||||||
|
\null\vfil
|
||||||
|
\centerline{Page in bottom half of A4 paper.}
|
||||||
|
\eject
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 16
|
||||||
|
|
||||||
|
\message{Page completely above left of A4 paper.}
|
||||||
|
\voffset -3in
|
||||||
|
\hoffset -9in
|
||||||
|
\leftline{Page completely above left of A4 paper.}
|
||||||
|
\vfil\eject
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 17
|
||||||
|
|
||||||
|
\message{Page completely below right of A4 paper.}
|
||||||
|
\voffset 3in
|
||||||
|
\hoffset 9in
|
||||||
|
\null\vfil
|
||||||
|
\rightline{Page completely below right of A4 paper.}
|
||||||
|
\eject
|
||||||
|
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
% DVI page 18
|
||||||
|
|
||||||
|
\message{Page beyond all edges of A4 paper.}
|
||||||
|
\voffset -3in
|
||||||
|
\hoffset -3in
|
||||||
|
\vsize 15in
|
||||||
|
\hsize 15in
|
||||||
|
\line{Page beyond all edges of A4 paper.\hfil
|
||||||
|
Page beyond all edges of A4 paper.}
|
||||||
|
\vfil
|
||||||
|
\line{Page beyond all edges of A4 paper.\hfil
|
||||||
|
Page beyond all edges of A4 paper.}
|
||||||
|
\eject
|
||||||
|
\voffset 0in \hoffset 0in % offsets back to normal
|
||||||
|
|
||||||
|
\bye
|
Loading…
Reference in New Issue
Block a user