1*23962Sjaap #ifndef lint
2*23962Sjaap static char sccsid[] = "@(#)frame.c 1.1 (CWI) 85/07/19";
3*23962Sjaap #endif lint
4*23962Sjaap #include <stdio.h>
5*23962Sjaap #include "grap.h"
6*23962Sjaap #include "y.tab.h"
7*23962Sjaap
8*23962Sjaap double frame_ht; /* default frame height */
9*23962Sjaap double frame_wid; /* and width */
10*23962Sjaap
11*23962Sjaap int nsides = 0; /* how many sides given on this frame */
12*23962Sjaap char *sides[] = {
13*23962Sjaap "\tline from Frame.nw to Frame.ne",
14*23962Sjaap "\tline from Frame.sw to Frame.se",
15*23962Sjaap "\tline from Frame.sw to Frame.nw",
16*23962Sjaap "\tline from Frame.se to Frame.ne"
17*23962Sjaap };
18*23962Sjaap char *newsides[4] = { 0, 0, 0, 0 }; /* filled in later */
19*23962Sjaap
frame()20*23962Sjaap frame() /* pump out frame definition, reset for next */
21*23962Sjaap {
22*23962Sjaap int i;
23*23962Sjaap
24*23962Sjaap fprintf(tfd, "\tframeht = %g\n", frame_ht);
25*23962Sjaap fprintf(tfd, "\tframewid = %g\n", frame_wid);
26*23962Sjaap fprintf(tfd, "Frame:\tbox ht frameht wid framewid with .sw at 0,0 ");
27*23962Sjaap if (nsides == 0)
28*23962Sjaap fprintf(tfd, "\n");
29*23962Sjaap else {
30*23962Sjaap fprintf(tfd, "invis\n");
31*23962Sjaap for (i = 0; i < 4; i++) {
32*23962Sjaap if (newsides[i]) {
33*23962Sjaap fprintf(tfd, "%s\n", newsides[i]);
34*23962Sjaap free(newsides[i]);
35*23962Sjaap newsides[i] = 0;
36*23962Sjaap } else
37*23962Sjaap fprintf(tfd, "%s\n", sides[i]);
38*23962Sjaap }
39*23962Sjaap nsides = 0;
40*23962Sjaap }
41*23962Sjaap }
42*23962Sjaap
frameht(f)43*23962Sjaap frameht(f) /* set height of frame */
44*23962Sjaap double f;
45*23962Sjaap {
46*23962Sjaap frame_ht = f;
47*23962Sjaap }
48*23962Sjaap
framewid(f)49*23962Sjaap framewid(f) /* set width of frame */
50*23962Sjaap double f;
51*23962Sjaap {
52*23962Sjaap frame_wid = f;
53*23962Sjaap }
54*23962Sjaap
frameside(type,desc)55*23962Sjaap frameside(type, desc) /* create and remember sides */
56*23962Sjaap int type;
57*23962Sjaap Attr *desc;
58*23962Sjaap {
59*23962Sjaap int n;
60*23962Sjaap char buf[100];
61*23962Sjaap
62*23962Sjaap nsides++;
63*23962Sjaap switch (type) {
64*23962Sjaap case 0: /* no side specified; kludge up all */
65*23962Sjaap frameside(TOP, desc);
66*23962Sjaap frameside(BOT, desc);
67*23962Sjaap frameside(LEFT, desc);
68*23962Sjaap frameside(RIGHT, desc);
69*23962Sjaap return;
70*23962Sjaap case TOP: n = 0; break;
71*23962Sjaap case BOT: n = 1; break;
72*23962Sjaap case LEFT: n = 2; break;
73*23962Sjaap case RIGHT: n = 3; break;
74*23962Sjaap }
75*23962Sjaap sprintf(buf, "%s %s", sides[n], desc_str(desc));
76*23962Sjaap newsides[n] = tostring(buf);
77*23962Sjaap }
78