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