2 static char rcsid[] =
"$Id: dvirle2.c,v 3.0.1.1 1992/01/21 19:26:59 spencer Exp $";
54 void ReadFonts(), FormFeed(), ReadInput(), VWriteChar(), VWriteRule();
55 void DumpTopOfBand(), MoveDown(), WriteBuf(), WriteBlanks();
93 "Note=Created from DVI file at 300 dots/inch",
104 #define RowsBetween(f, n) ((n) >= (f) ? (n) - (f) : (n) - (f) + ROWS)
112 register char **argv;
116 int dpi, usermag, num, denom, dvimag;
120 while ((c = getopt(argc, argv,
"dstDx:y:")) != EOF) {
133 error(0, 0,
"tape option not yet implemented");
149 fprintf(stderr,
"Usage: %s [-d] [-s] [-t] [file]\n",
155 if (freopen(argv[
optind],
"r", stdin) == NULL)
156 error(1, 0,
"can't open %s", argv[
optind]);
160 error(1, 0,
"input file is not version %d",
VERSION);
162 RasterOrientation = HFlag ? ROT_RIGHT : ROT_NORM;
169 (
void) GetByte(stdin);
172 dpi = GetLong(stdin);
173 usermag = GetLong(stdin);
174 num = GetLong(stdin);
175 denom = GetLong(stdin);
176 dvimag = GetLong(stdin);
177 SetConversion(dpi, usermag, num, denom, dvimag);
189 (
void) fprintf(stderr,
"Output will be discarded\n");
190 (
void) fflush(stderr);
212 (
void) putc(
'\n', stderr);
226 register struct font *f, **fp;
230 register struct glyph *g;
237 (
void) fprintf(stderr,
"[fonts:\n");
239 while (GetByte(stdin) == 1) {
240 (
void) GetLong(stdin);
241 mag = GetLong(stdin);
242 dsize = GetLong(stdin);
248 (
void) GetByte(stdin);
250 f = GetFont(nm, mag, dsize,
"RLE", &fname);
252 GripeCannotGetFont(nm, mag, dsize,
"RLE", fname);
257 (
void) fprintf(stderr,
"[%s -> %s]\n",
258 Font_TeXName(f), fname);
259 (
void) fflush(stderr);
262 register char *t = fname;
266 if (*s++ ==
'/' && *s)
268 (
void) fprintf(stderr,
" %s\n", t);
271 for (c = 0; c < 128; c++) {
274 (
void) RASTER(g, f, RasterOrientation);
280 (
void) fprintf(stderr,
"]\n");
290 register int yx, fcp, height;
298 fGetLong(stdin, fcp);
300 fprintf( stderr,
"yx:%lx, fcp:%lx\n", yx, fcp );
309 register struct glyph *g;
310 register struct font *f;
316 if ((height = yx >> 16) != 0)
330 "Col:%d, Height:%d, fnum:%d, yx:%d, fcp:%d\n",
331 CurCol, height, fnum, yx, fcp );
338 height = g->g_height;
343 part code not implemented; skipping char %d in %s",
345 else if (HASRASTER(g)) {
348 VWriteChar(g->g_raster, height, g->g_width);
350 VWriteChar(RASTER(g, f, RasterOrientation),
364 fGetLong(stdin, fcp);
365 fGetLong(stdin, fcp);
368 fprintf( stderr,
"End of Page\n" );
378 (
void) fprintf(stderr,
".");
390 height = (fcp & 0xff00) >> 8;
409 VWriteChar(rastp, height, width)
410 unsigned char *rastp;
413 register unsigned char *bp;
414 register unsigned char *rp;
424 if ((rp = rastp) == NULL)
427 row =
CurRow + height - 1;
432 w = (width + 7) >> 3;
435 #if defined(lint) || !defined(vax)
439 rshift = -(CurCol & 7);
444 #define avoiding_shifts_is_faster
467 #if defined(lint) || !defined(vax)
468 *bp++ |= (*rp & 255) >> rshift;
469 *bp |= (*rp++ & 255) << lshift;
476 asm(
" movzbl (r10)+,r1 # *rp++ & 255");
477 asm(
" ashl r9,r1,r0 # >> rshift");
478 asm(
" bisb2 r0,(r11)+ # *bp++ |=");
479 asm(
" ashl r8,r1,r0 # << lshift");
480 asm(
" bisb2 r0,(r11) # *bp |=");
533 register unsigned char *bp;
546 CurCol = (i & 0x7fff0000) >> 16;
547 height = ((i & 0xff00) >> 8);
550 fprintf( stderr,
"Rule: Row: %d, Col:%d, height:%d, width:%d\n",
567 full = (width - i - (8 - j)) >> 3;
577 for (j = full; --j >= 0;)
657 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
658 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
659 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
660 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
661 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
662 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
663 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
664 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
665 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
666 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
667 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
668 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
669 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
670 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
671 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
672 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
683 WriteBuf(buf, first, last, cl)
685 register int first, last;
688 static unsigned char bytebuf[
COLUMNS*8];
689 static int filtrow = 0, sawbit = 0;
691 unsigned char * scans[2];
693 register int bit, col;
694 register unsigned char * cp, * bufp;
697 fprintf( stderr,
"Writebuf( %lx, %d, %d, %d )\n",
698 buf, first, last, cl );
707 scans[0] = scans[1] = bytebuf;
711 if ( filtrow > 0 && filtrow + last - first + 1 >=
filth )
713 for ( col = 0; col <
outwidth; col++ )
720 for ( col = 0; col <
outwidth; col++ )
723 NLines += last - first + 1;
724 if ( last - first - filtrow + 1 >=
filth )
726 (last - first - filtrow + 1) /
filth );
727 filtrow = (filtrow + last - first + 1) %
filth;
732 WriteBuf(buf, first,
ROWS - 1, cl);
737 mask = (0xff << (8 -
filtw)) & 0xff;
738 for ( row = first, bufp = buf; row <= last; row++, bufp +=
COLUMNS )
740 for ( cp = bufp, col = 0, bit = 0; col <
outwidth;
741 col++, bit +=
filtw, bit >= 8 ? cp++ : cp, bit %= 8 )
742 if ( (bytebuf[col] +=
743 nbits[(*cp & (mask >> bit))] +
744 nbits[((*(cp+1) & (mask << (8 - bit)))) & 0xff]) != 0 )
747 filtrow = (filtrow + 1) %
filth;
753 for ( col = 0; col <
outwidth; col++ )
759 for ( col = 0; col <
outwidth; col++ )
769 bzero(buf, (
unsigned) (
COLUMNS * (last - first + 1)));
770 NLines += last - first + 1;
780 WriteBuf((
unsigned char *)0, 0, n - 1, 0);
796 bcopy( from, to, len )
798 return memcpy( to, from, len );
803 memset( to, 0, len );
#define RLE_SET_BIT(glob, bit)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
static unsigned char nbits[256]
char * cmd_name(char **argv)
unsigned char VBuffer[600][319]
void main(int argc, char **argv)
void rle_puteof(rle_hdr *the_hdr)
void rle_putrow(rows, int rowlen, rle_hdr *the_hdr)
const char * pic_comments[]
void rle_skiprow(rle_hdr *the_hdr, int nrow)
void rle_put_setup(rle_hdr *the_hdr)
#define RowsBetween(f, n)
#define avoiding_shifts_is_faster
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)