NAME

TeX::DVI::Parse - parse TeX's DVI output file

SYNOPSIS

use TeX::DVI::Parse;
my $dvi_parse = new TeX::DVI::Parse("test.dvi");
$dvi_parse->parse();

DESCRIPTION

I have created this module on request from Mirka Misáková. She wanted to do some post-processing on the DVI file and I said that it will be better to parse the DVI file directly, instead of the output of the dvitype program.

As the result there is this module TeX::DVI::Parse that recognizes all commands from the DVI file and for each command found it calls method of appropriate name, if defined in the class.

The example above is not very reasonable because the core TeX::DVI::Parse module doesn't itself define any methods for the DVI commands. You will probably want to inherit a new class and define the functions yourself:

packages My_Parse_DVI;
use TeX::DVI::Parse;
@ISA = qw( TeX::DVI::Parse );

sub set_char
	{
	my ($self, $ord, $char) = @_;
	## print the info or something;
	}

As an example there is class TeX::DVI::Print coming in this file, so you can do

use TeX::DVI::Parse;
my $dvi_parse = new TeX::DVI::Print("test.dvi");
$dvi_parse->parse();

and get listing of DVI's content printed in (hopefully) readable form.

Methods

For creating new classes, a documentation of expected methods names and their parameters is necessary, so here is the list. The names come from the dvitype documentation and that is also the basic reference for the meaning of the parameters. Note that each method receives as the first two parameters $self and $ord, reference to the parsing object and the byte value of the command as found in the DVI file. These are mandatory so only the other parameters to each method are listed below.

set_char -- typeset character and shift right by its width

$char -- specifies the ordinal value of the character.

put_char -- as set_char but without moving

$char -- ordinal value of the character.

set_rule -- typeset black rectangle and shift to the right

$height, $width -- dimensions of the rectangle.

put_rule -- as set_rule without moving

$height, $width -- dimensions of the rectangle.

nop -- no operation

no parameter

bop -- begin of page

$number[0] .. $number[9], $prev_page -- the ten numbers that specify the page, the pointer to the start of the previous page.

eop -- end of page

no parameter

push -- push to the stack

no parameter

pop -- pop from the stack

no parameter

right -- move right

$value -- how much to move.

move_w, move_x, down, move_y, move_z -- move position

all take one parameter, $value.

fnt_def -- define font

$k, $c, $s, $d, $a, $l, $n -- number of the font, checksum, scale factor, design size, length of the directory and length of the filename, name of the font.

fnt_num -- select font

$k -- number of the font.

special -- generic DVI primitive

$k, $x -- length of the special and its data.

preamble

$i, $num, $den, $mag, $k, $x -- ID of the format, numerator and denumerator of the multiplication fraction, magnification, length of the comment and comment.

post -- postamble

$p, $num, $den, $mag, $l, $u, $s, $t -- pointer to the last page, the next three are as in preamble, maximal dimensions ($l and $u), maximal depth of the stack and the final page number.

post_post -- post postamble

$q, $i, $dummy -- pointer to the postamble, ID and the last fill.

undefined_command -- for byte that has no other meaning

no parameter

VERSION

0.02

SEE ALSO

Font::TFM(3), TeX::DVI(3), perl(1).

AUTHOR

(c) 1997--1998 Jan Pazdziora, adelton@fi.muni.cz, http://www.fi.muni.cz/~adelton/ at Faculty of Informatics, Masaryk University in Brno, Czech Republic

1 POD Error

The following errors were encountered while parsing the POD:

Around line 276:

Non-ASCII character seen before =encoding in 'Misáková.'. Assuming CP1252