t10.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1989 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#include "tdef.h"
#include <ctype.h>
#include "ext.h"
/*
*
* typesetter interface
*/
int vpos = 0; /* absolute vertical position on page */
int hpos = 0; /* ditto horizontal */
short *chtab;
char *chname;
int Inch;
int Hor;
int Vert;
int Unitwidth;
int nfonts;
int nsizes;
int nchtab;
/* these characters are used as various signals or values
* in miscellaneous places.
* values are set in specnames in t10.c
*/
int c_hyphen;
int c_emdash;
int c_rule;
int c_minus;
int c_fi;
int c_fl;
int c_ff;
int c_ffi;
int c_ffl;
int c_acute;
int c_grave;
int c_under;
int c_rooten;
int c_boxrule;
int c_lefthand;
int c_dagger;
#include "dev.h"
ptinit()
{
/* open table for device,
* read in resolution, size info, font info, etc.
* and set params
*/
done3(1);
}
termtab);
done3(1);
}
for (i = 1; i <= nfonts; i++) {
/* for now, still 2 char names */
smnt = i; /* first special font */
p += sizeof(struct Font); /* that's what's on the beginning */
fontab[i] = p;
}
/* there are a lot of things that used to be constant
* that now require code to be executed.
*/
for (i = 0; i < 16; i++)
specnames(); /* install names like "hyphen", etc. */
if (ascii)
return;
/*
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");
*/
}
{
static struct {
int *n;
char *v;
} spnames[] = {
&c_hyphen, "hy",
&c_emdash, "em",
&c_rule, "ru",
&c_minus, "\\-",
&c_fi, "fi",
&c_fl, "fl",
&c_ff, "ff",
&c_ffi, "Fi",
&c_ffl, "Fl",
&c_acute, "aa",
&c_grave, "ga",
&c_under, "ul",
&c_rooten, "rn",
&c_boxrule, "br",
&c_lefthand, "lh",
&c_dagger, "dg",
0, 0
};
int i;
for (i = 0; spnames[i].n; i++)
}
findch(s) /* find char s in chname */
register char *s;
{
register int i;
for (i = 0; i < nchtab; i++)
return(i + 128);
return(0);
}
ptout(i)
register tchar i;
{
register dv;
register tchar *k;
int temp, a, b;
if (cbits(i) != '\n') {
*olinep++ = i;
return;
}
return;
}
esc = 0; /* ??? */
ptesc(); /* the problem is to get back to the left end of the line */
dv = 0;
if (isnmot(*k))
}
}
if (dv) {
vflag++;
vflag = 0;
}
k = ptout0(k); /* now passing a pointer! */
/*
fdprintf(ptid, "x xxx end of line: hpos=%d, vpos=%d\n", hpos, vpos);
*/
}
tchar *
{
register short j, k, w;
register tchar i;
int outsize; /* size of object being printed */
i = *pi;
k = cbits(i);
if (ismot(i)) {
j = absmot(i);
if (isnmot(i))
j = -j;
if (isvmot(i))
lead += j;
else
esc += j;
}
if (k == XON) {
ptfont();
ptps();
if (lead)
ptlead();
/*
* not guaranteed of finding a XOFF if a word overflow
* error occured, so also bound this loop by olinep
*/
pi++;
oput('\n');
pi++;
return pi;
}
;
if (k == CHARHT) {
ptps();
}
if (k == SLANT) {
}
if (k == WORDSP) {
oput('w');
}
if (k == FONTPOS) {
char temp[3];
n = i >> 16;
temp[2] = 0;
}
} else
xbits(i, 2);
if (k < 040 && k != DRAWFCN)
if (k >= 32) {
bd = 0;
cs = 0;
} else
w = getcw(k-32);
}
j = z = 0;
if (k != DRAWFCN) {
if (cs) {
if (bd)
j = (cs - w) / 2;
w = cs - j;
if (bd)
}
if (iszbit(i)) {
if (cs)
w = -j;
else
w = 0;
z = 1;
}
}
esc += j;
ptfont();
ptps();
if (lead)
ptlead();
/* put out the real character here */
if (k == DRAWFCN) {
if (esc)
ptesc();
case DRAWCIRCLE: /* circle */
w = 0;
break;
case DRAWELLIPSE:
w = 0;
break;
case DRAWLINE: /* line */
if (k < 128)
else
w = 0;
break;
case DRAWARC: /* arc */
w = 0;
break;
case DRAWSPLINE: /* spline */
default: /* something else; copy it like spline */
w = 0;
/* it was somehow defective */
break;
}
}
break;
}
;
outsize = n + 1;
} else if (k < 128) {
/* 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 */
oput(k);
esc = 0;
} else {
if (esc)
ptesc();
oput('c');
oput(k);
oput('\n');
}
} else {
if (esc)
ptesc();
if (k >= nchtab + 128)
else
}
if (bd) {
ptesc();
if (k < 128) {
} else if (k >= nchtab + 128) {
} else
if (z)
}
esc += w;
}
ptps()
{
register i, j, k;
i = xpts;
for (j = 0; i > (k = pstab[j]); j++)
if (!k) {
k = pstab[--j];
break;
}
mpts = i;
}
ptfont()
{
}
ptfpcmd(f, s)
int f;
char *s;
{
if (ascii)
return;
ptfont(); /* make sure that it gets noticed */
}
ptlead()
{
if (!ascii)
lead = 0;
}
ptesc()
{
if (esc > 0) {
oput('h');
} else
} else
esc = 0;
}
newpage(n) /* called at end of each output page (we hope) */
{
int i;
ptlead();
vpos = 0;
if (ascii)
return;
for (i = 0; i <= nfonts; i++)
ptps();
ptfont();
}
{
}
ptstop()
{
}
dostop()
{
if (ascii)
return;
ptlead();
vpos = 0;
/* fdprintf(ptid, "x xxx end of page\n");*/
if (!nofeed)
pttrailer();
ptlead();
flusho();
ptesc();
}