d608e20df337ddc2b3c1981e44bf134476fbedfa
static char sccsid
[] = "@(#)print.c 1.1 (CWI) 85/07/19";
float x0
, y0
, x1
, y1
, ox
, oy
, dx
, dy
, ndx
, ndy
;
for (i
= 0; i
< nobj
; i
++) {
troff(text
[p
->o_nt1
].t_val
);
dotext(p
); /* if there are any text strings */
if (p
->o_attr
& INVIS
|| p
->o_type
== BLOCK
)
else if (p
->o_dotdash
== 0)
dotbox(x0
, y0
, x1
, y1
, p
->o_dotdash
, p
->o_ddval
);
move(isright(m
) ? x1
: x0
, oy
); /* right side */
move(ox
, isdown(m
) ? y0
: y1
); /* bottom */
move(isright(m
) ? x1
: x0
, oy
); /* right side */
move(ox
, isdown(m
) ? y0
: y1
); /* bottom */
if ((p
->o_attr
& INVIS
) == 0)
move(ox
+ isright(m
) ? x1
: -x1
, oy
);
move(ox
, oy
+ isup(m
) ? x1
: -x1
);
if ((p
->o_attr
& INVIS
) == 0)
move(ox
+ isright(m
) ? x1
: -x1
, oy
);
move(ox
, oy
- isdown(m
) ? y1
: -y1
);
arrow(x1
- (y1
- oy
), y1
+ (x1
- ox
),
x1
, y1
, p
->o_val
[4], p
->o_val
[5]);
/* probably wrong when it's cw */
arc(ox
, oy
, x1
, y1
, p
->o_val
[2], p
->o_val
[3], p
->o_val
[6]
arrow(p
->o_val
[2] + p
->o_val
[3] - oy
, p
->o_val
[3] - (p
->o_val
[2] - ox
),
p
->o_val
[2], p
->o_val
[3], p
->o_val
[4], p
->o_val
[5]);
move(x1
, y1
); /* because drawn backwards */
move((ox
+ x1
)/2, (oy
+ y1
)/2); /* center */
arrow(ox
+ p
->o_val
[5], oy
+ p
->o_val
[6], ox
, oy
, p
->o_val
[2], p
->o_val
[3]);
else if (p
->o_type
== SPLINE
)
spline(ox
, oy
, p
->o_val
[4], &p
->o_val
[5]);
for (i
=0, j
=5; i
< p
->o_val
[4]; i
++, j
+= 2) {
ndy
= dy
+ p
->o_val
[j
+1];
dotline(dx
, dy
, ndx
, ndy
, p
->o_dotdash
, p
->o_ddval
);
for (i
= 0, j
= 5; i
< p
->o_val
[4] - 1; i
++, j
+= 2) {
arrow(dx
, dy
, x1
, y1
, p
->o_val
[2], p
->o_val
[3]);
label((char *)p
->o_attr
, p
->o_dotdash
, 0); /* string in funny place */
dotline(x0
, y0
, x1
, y1
, ddtype
, ddval
) /* dotted line */
static float prevval
= 0.05; /* 20 per inch by default */
double a
, b
, sqrt(), dx
, dy
;
/* don't save dot/dash value */
numdots
= sqrt(dx
*dx
+ dy
*dy
) / prevval
+ 0.5;
for (i
= 0; i
<= numdots
; i
++) {
a
= (float) i
/ (float) numdots
;
move(x0
+ (a
* dx
), y0
+ (a
* dy
));
} else if (ddtype
== DASH
) {
double d
, dashsize
, spacesize
;
numdots
= d
/ (2 * prevval
) + 1; /* ceiling */
spacesize
= (d
- numdots
* dashsize
) / (numdots
- 1);
for (i
= 0; i
< numdots
-1; i
++) {
a
= i
* (dashsize
+ spacesize
) / d
;
line(x0
+ (a
*dx
), y0
+ (a
*dy
), x0
+ (b
*dx
), y0
+ (b
*dy
));
move(x0
+ (a
*dx
), y0
+ (a
*dy
));
line(x0
+ (b
* dx
), y0
+ (b
* dy
), x1
, y1
);
dotbox(x0
, y0
, x1
, y1
, ddtype
, ddval
) /* dotted or dashed box */
dotline(x0
, y0
, x1
, y0
, ddtype
, ddval
);
dotline(x1
, y0
, x1
, y1
, ddtype
, ddval
);
dotline(x1
, y1
, x0
, y1
, ddtype
, ddval
);
dotline(x0
, y1
, x0
, y0
, ddtype
, ddval
);
dotext(p
) /* print text strings of p in proper vertical spacing */
nhalf
= p
->o_nt2
- p
->o_nt1
- 1;
for (i
= p
->o_nt1
; i
< p
->o_nt2
; i
++) {
label(text
[i
].t_val
, text
[i
].t_type
, nhalf
);