static char sccsid
[] = "@(#)t10.c 2.1 (CWI) 85/07/18";
int vpos
= 0; /* absolute vertical position on page */
int hpos
= 0; /* ditto horizontal */
/* these characters are used as various signals or values
/* in miscellaneous places.
/* values are set in specnames in t10.c
struct Font
*fontbase
[NFONT
+1];
char *setbrk(), *filebase
, *p
;
/* open table for device,
/* read in resolution, size info, font info, etc.
strcat(termtab
, devname
);
strcat(termtab
, "/DESC.out"); /* makes "..../devXXX/DESC.out" */
if ((fin
= open(termtab
, 0)) < 0) {
errprint("can't open tables for %s", termtab
);
read(fin
, (char *) &dev
, sizeof(struct dev
));
Unitwidth
= dev
.unitwidth
;
filebase
= setbrk(dev
.filesize
+ 2 * EXTRAFONT
); /* enough room for whole file */
read(fin
, filebase
, dev
.filesize
); /* all at once */
pstab
= (short *) filebase
;
chtab
= pstab
+ nsizes
+ 1;
chname
= (char *) (chtab
+ dev
.nchtab
);
p
= chname
+ dev
.lchname
;
for (i
= 1; i
<= nfonts
; i
++) {
fontbase
[i
] = (struct Font
*) p
;
nw
= *p
& BYTEMASK
; /* 1st thing is width count */
fontlab
[i
] = PAIR(fontbase
[i
]->namefont
[0], fontbase
[i
]->namefont
[1]);
/* for now, still 2 char names */
if (smnt
== 0 && fontbase
[i
]->specfont
== 1)
smnt
= i
; /* first special font */
p
+= sizeof(struct Font
); /* that's what's on the beginning */
fitab
[i
] = p
+ 3 * nw
; /* skip width, kern, code */
p
+= 3 * nw
+ dev
.nchtab
+ 128 - 32;
* skip also fcode, if there
* See remarks in dev.h and makedev.c
if(fontbase
[i
]->fonttab
== 1)
fontbase
[0] = (struct Font
*) p
; /* the last shall be first */
fontbase
[0]->nwfont
= MAXCHARS
;
fontab
[0] = p
+ sizeof (struct Font
);
/* there are a lot of things that used to be constant
/* that now require code to be executed.
tabtab
[i
] = DTAB
* (i
+ 1);
ll
= ll1
= lt
= lt1
= LL
;
specnames(); /* install names like "hyphen", etc. */
fdprintf(ptid
, "x T %s\n", devname
);
fdprintf(ptid
, "x res %d %d %d\n", Inch
, Hor
, Vert
);
fdprintf(ptid
, "x init\n"); /* do initialization for particular device */
for (i = 1; i <= nfonts; i++)
fdprintf(ptid, "x font %d %s\n", i, fontbase[i]->namefont);
fdprintf(ptid, "x xxx fonts=%d sizes=%d unit=%d\n", nfonts, nsizes, Unitwidth);
fdprintf(ptid, "x xxx nchtab=%d lchname=%d nfitab=%d\n",
dev.nchtab, dev.lchname, dev.nchtab+128-32);
fdprintf(ptid, "x xxx sizes:\nx xxx ");
for (i = 0; i < nsizes; i++)
fdprintf(ptid, " %d", pstab[i]);
fdprintf(ptid, "\nx xxx chars:\nx xxx ");
for (i = 0; i < dev.nchtab; i++)
fdprintf(ptid, " %s", &chname[chtab[i]]);
fdprintf(ptid, "\nx xxx\n");
for (i
= 0; spnames
[i
].n
; i
++)
*spnames
[i
].n
= findch(spnames
[i
].v
);
findch(s
) /* find char s in chname */
for (i
= 0; i
< nchtab
; i
++)
if (strcmp(s
, &chname
[chtab
[i
]]) == 0)
ptesc(); /* the problem is to get back to the left end of the line */
for (k
= oline
; k
< olinep
; k
++) {
if (ismot(*k
) && isvmot(*k
)) {
for (k
= oline
; k
< olinep
; )
k
+= ptout0(k
); /* now passing a pointer! */
fdprintf(ptid, "x xxx end of line: hpos=%d, vpos=%d\n", hpos, vpos);
fdprintf(ptid
, "n%d %d\n", b
, a
); /* be nice to chuck */
short z
, dx
, dy
, dx2
, dy2
, n
;
int outsize
; /* size of object being printed */
outsize
= 1; /* default */
for (j
= 1; (c
=cbits(pi
[j
])) != XOFF
; j
++)
fdprintf(ptid
, "x H %d\n", sbits(i
));
fdprintf(ptid
, "x S %d\n", sfbits(i
)-180);
if (sfbits(i
) == oldbits
) {
if (k
< 040 && k
!= DRAWFCN
)
if (widcache
[k
-32].fontpts
== (xfont
<<8) + xpts
&& !setwdf
) {
w
= widcache
[k
-32].width
;
/* put out the real character here */
case DRAWCIRCLE
: /* circle */
fdprintf(ptid
, "D%c %d\n", DRAWCIRCLE
, dx
); /* dx is diameter */
fdprintf(ptid
, "D%c %d %d\n", DRAWELLIPSE
, dx
, dy
);
case DRAWLINE
: /* line */
fdprintf(ptid
, "D%c %d %d ", DRAWLINE
, dx
, dy
);
fdprintf(ptid
, "%c\n", k
);
fdprintf(ptid
, "%s\n", &chname
[chtab
[k
- 128]]);
fdprintf(ptid
, "D%c %d %d %d %d\n", DRAWARC
,
case DRAWSPLINE
: /* spline */
default: /* something else; copy it like spline */
fdprintf(ptid
, "D%c %d %d", cbits(pi
[1]), dx
, dy
);
if (cbits(pi
[3]) == DRAWFCN
|| cbits(pi
[4]) == DRAWFCN
) {
/* it was somehow defective */
for (n
= 5; cbits(pi
[n
]) != DRAWFCN
; n
+= 2) {
fdprintf(ptid
, " %d %d", dx
, dy
);
for (n
= 3; cbits(pi
[n
]) != DRAWFCN
; n
++)
/* try to go faster and compress output */
/* by printing nnc for small positive motion followed by c */
/* kludgery; have to make sure set all the vars too */
if (esc
> 0 && esc
< 100) {
fdprintf(ptid
, "N%d\n", k
- (nchtab
+128));
fdprintf(ptid
, "C%s\n", &chname
[chtab
[k
- 128]]);
fdprintf(ptid
, "c%c\n", k
);
} else if (k
>= nchtab
+ 128) {
fdprintf(ptid
, "N%d\n", k
- (nchtab
+128));
fdprintf(ptid
, "C%s\n", &chname
[chtab
[k
- 128]]);
for (j
= 0; i
> (k
= pstab
[j
]); j
++)
fdprintf(ptid
, "s%d\n", k
); /* really should put out string rep of size */
register char *temp
= unpair(fontlab
[xfont
]);
ptfpcmd(0, temp
); /* Put the desired font in the
* fontcache of the filter */
fdprintf(ptid
, "f0\n"); /* make sure that it gets noticed */
fdprintf(ptid
, "f%d\n", xfont
);
fdprintf(ptid
, "x font %d %s\n", f
, s
);
fdprintf(ptid
, "V%d\n", vpos
);
if (esc
>=10 && esc
<100) {
fdprintf(ptid
, "%d", esc
);
fdprintf(ptid
, "H%d\n", hpos
);
newpage(n
) /* called at end of each output page (we hope) */
fdprintf(ptid
, "p%d\n", n
); /* new page */
for (i
= 0; i
<= nfonts
; i
++)
if (fontbase
[i
]->namefont
&& fontbase
[i
]->namefont
[0])
fdprintf(ptid
, "x font %d %s\n", i
, fontbase
[i
]->namefont
);
fdprintf(ptid
, "x trailer\n");
fdprintf(ptid
, "x stop\n");
/* fdprintf(ptid, "x xxx end of page\n");*/
fdprintf(ptid
, "x pause\n");
hpos
= vpos
= 0; /* probably in wrong place */