1 /* tu.c: draws horizontal lines */
6 makeline(int i
, int c
, int lintype
)
13 shortl
= (table
[i
][c
].col
[0] == '\\');
14 if (c
> 0 && !shortl
&& thish(i
, c
- 1) == type
)
17 for (cr
= c
; cr
< ncol
&& (ctype(i
, cr
) == 's' || type
== thish(i
, cr
)); cr
++)
20 for (cr
= c
+ 1; cr
< ncol
&& ctype(i
, cr
) == 's'; cr
++)
22 drawline(i
, c
, cr
- 1, lintype
, 0, shortl
);
27 fullwide(int i
, int lintype
)
32 fprintf(tabout
, ".nr %d \\n(.v\n.vs \\n(.vu-\\n(.sp\n", SVS
);
36 while (i
> 0 && vspand(prev(i
), cl
, 1))
38 for (cr
= cl
; cr
< ncol
; cr
++)
39 if (i
> 0 && vspand(prev(i
), cr
, 1))
42 drawline(i
, cl
, (cr
< ncol
? cr
- 1 : cr
), lintype
, 1, 0);
44 fprintf(tabout
, "\n");
46 fprintf(tabout
, ".vs \\n(%du\n", SVS
);
51 drawline(int i
, int cl
, int cr
, int lintype
, int noheight
, int shortl
)
53 char *exhr
, *exhl
, *lnch
;
54 int lcount
, ln
, linpos
, oldpos
, nodata
;
63 lcount
= pr1403
? 1 : 2;
71 nodata
= cr
- cl
>= ncol
|| noheight
|| allh(i
);
73 fprintf(tabout
, "\\v'-.5m'");
74 for (ln
= oldpos
= 0; ln
< lcount
; ln
++) {
75 linpos
= 2 * ln
- lcount
+ 1;
77 fprintf(tabout
, "\\v'%dp'", linpos
- oldpos
);
82 switch (interv(i
, cl
)) {
84 exhl
= ln
== 0 ? "1p" : "-1p";
87 exhl
= ln
== 1 ? "1p" : "-1p";
94 fprintf(tabout
, "\\h'%s'", exhl
);
95 } else if (lcount
== 1) {
96 switch (interv(i
, cl
)) {
106 fprintf(tabout
, "\\h'%s'", exhl
);
109 switch (interv(i
, cr
+ 1)) {
111 exhr
= ln
== 0 ? "-1p" : "+1p";
114 exhr
= ln
== 1 ? "-1p" : "+1p";
120 } else if (lcount
== 1) {
121 switch (interv(i
, cr
+ 1)) {
132 fprintf(tabout
, "\\h'|\\n(%2su'", reg(cl
, CLEFT
));
133 fprintf(tabout
, "\\s\\n(%d", LSIZE
);
135 fprintf(tabout
, "\\v'-\\n(%dp/6u'", LSIZE
);
137 fprintf(tabout
, "\\l'|\\n(%2su'", reg(cr
, CRIGHT
));
142 lnch
= lintype
== 2 ? "=" : "\\(ru";
144 fprintf(tabout
, "\\l'|\\n(TWu%s%s'", exhr
, lnch
);
146 fprintf(tabout
, "\\l'(|\\n(%2su+|\\n(%2su)/2u%s%s'", reg(cr
, CRIGHT
),
147 reg(cr
+ 1, CLEFT
), exhr
, lnch
);
150 fprintf(tabout
, "\\v'\\n(%dp/6u'", LSIZE
);
151 fprintf(tabout
, "\\s0");
154 fprintf(tabout
, "\\v'%dp'", -oldpos
);
156 fprintf(tabout
, "\\v'+.5m'");
163 int i
, c
, k
, junk
, stopp
;
166 for (i
= 0; i
< MAXLIN
; i
++)
168 for (i
= 0; i
< nlin
; i
++)
169 for (c
= 0; c
< ncol
; c
++) {
170 k
= left(i
, c
, &junk
);
171 if (k
>= 0 && linestop
[k
] == 0)
172 linestop
[k
] = ++stopp
;
174 if (boxflg
|| allflg
|| dboxflg
)
180 left(int i
, int c
, int *lwidp
)
183 /* returns -1 if no line to left */
184 /* returns number of line where it starts */
185 /* stores into lwid the kind of line */
189 kind
= lefdata(i
, c
);
193 if (lefdata(next(i
), c
) == kind
)
196 while (i
>= 0 && lefdata(i
, c
) == kind
)
201 for (lj
= i
+ 1; lj
< li
; lj
++)
202 if (instead
[lj
] && strcmp(instead
[lj
], ".TH") == 0)
204 for (i
= i
+ 1; i
< li
; i
++)
212 lefdata(int i
, int c
)
218 if (ctype(i
, c
) == 's') {
219 for (ck
= c
; ctype(i
, ck
) == 's'; ck
--)
221 if (thish(i
, ck
) == 0)
228 if (dboxflg
&& c
== 0)
232 if (boxflg
&& c
== 0)
241 while (i
+ 1 < nlin
) {
243 if (!fullbot
[i
] && !instead
[i
])
253 while (--i
>= 0 && (fullbot
[i
] || instead
[i
]))