LEFT | RIGHT |
(no file at all) | |
1 #include <stdio.h> | 1 #include <stdio.h> |
2 #include "pic.h" | 2 #include "pic.h" |
3 #include "y.tab.h" | 3 #include "y.tab.h" |
4 | 4 |
5 obj* | 5 obj* |
6 textgen(void) | 6 textgen(void) |
7 { | 7 { |
8 int i, sub, nstr, at, with, hset; | 8 int i, sub, nstr, at, with, hset; |
9 double xwith, ywith, h, w, x0, y0, x1, y1; | 9 double xwith, ywith, h, w, x0, y0, x1, y1; |
10 obj *p, *ppos; | 10 obj *p, *ppos; |
11 static double prevh = 0; | |
12 static double prevw = 0; | |
13 Attr *ap; | 11 Attr *ap; |
14 | 12 |
15 at = with = nstr = hset = 0; | 13 at = with = nstr = hset = 0; |
16 h = getfval("textht"); | 14 h = getfval("textht"); |
17 w = getfval("textwid"); | 15 w = getfval("textwid"); |
18 for (i = 0; i < nattr; i++) { | 16 for (i = 0; i < nattr; i++) { |
19 ap = &attr[i]; | 17 ap = &attr[i]; |
20 switch (ap->a_type) { | 18 switch (ap->a_type) { |
21 case HEIGHT: | 19 case HEIGHT: |
22 h = ap->a_val.f; | 20 h = ap->a_val.f; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 p->o_val[0] = w; | 81 p->o_val[0] = w; |
84 p->o_val[1] = h; | 82 p->o_val[1] = h; |
85 if (isright(hvmode)) | 83 if (isright(hvmode)) |
86 curx = x1; | 84 curx = x1; |
87 else if (isleft(hvmode)) | 85 else if (isleft(hvmode)) |
88 curx = x0; | 86 curx = x0; |
89 else if (isup(hvmode)) | 87 else if (isup(hvmode)) |
90 cury = y1; | 88 cury = y1; |
91 else | 89 else |
92 cury = y0; | 90 cury = y0; |
93 prevh = h; | |
94 prevw = w; | |
95 return(p); | 91 return(p); |
96 } | 92 } |
97 | 93 |
98 obj* | 94 obj* |
99 troffgen(char *s) /* save away a string of troff commands */ | 95 troffgen(char *s) /* save away a string of troff commands */ |
100 { | 96 { |
101 savetext(CENTER, s); /* use the existing text mechanism */ | 97 savetext(CENTER, s); /* use the existing text mechanism */ |
102 return makenode(TROFF, 0); | 98 return makenode(TROFF, 0); |
103 } | 99 } |
104 | 100 |
105 void | 101 void |
106 savetext(int t, char *s) /* record text elements for current object */ | 102 savetext(int t, char *s) /* record text elements for current object */ |
107 { | 103 { |
108 if (ntext >= ntextlist) | 104 if (ntext >= ntextlist) |
109 text = (Text *) grow((char *) text, "text", ntextlist += 200, si
zeof(Text)); | 105 text = (Text *) grow((char *) text, "text", ntextlist += 200, si
zeof(Text)); |
110 text[ntext].t_type = t; | 106 text[ntext].t_type = t; |
111 text[ntext].t_val = s; | 107 text[ntext].t_val = s; |
112 dprintf("saving %d text %s at %d\n", t, s, ntext); | 108 dprintf("saving %d text %s at %d\n", t, s, ntext); |
113 ntext++; | 109 ntext++; |
114 } | 110 } |
LEFT | RIGHT |