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