1 /* tu.c: draws horizontal lines */
5 makeline(int i, int c, int lintype)
12 shortl = (table[i][c].col[0] == '\\');
13 if (c > 0 && !shortl && thish(i, c - 1) == type)
16 for (cr = c; cr < ncol && (ctype(i, cr) == 's' || type == thish(i, cr)); cr++)
19 for (cr = c + 1; cr < ncol && ctype(i, cr) == 's'; cr++)
21 drawline(i, c, cr - 1, lintype, 0, shortl);
26 fullwide(int i, int lintype)
31 Bprint(&tabout, ".nr %d \\n(.v\n.vs \\n(.vu-\\n(.sp\n", SVS);
35 while (i > 0 && vspand(prev(i), cl, 1))
37 for (cr = cl; cr < ncol; cr++)
38 if (i > 0 && vspand(prev(i), cr, 1))
41 drawline(i, cl, (cr < ncol ? cr - 1 : cr), lintype, 1, 0);
43 Bprint(&tabout, "\n");
45 Bprint(&tabout, ".vs \\n(%du\n", SVS);
50 drawline(int i, int cl, int cr, int lintype, int noheight, int shortl)
52 char *exhr, *exhl, *lnch;
53 int lcount, ln, linpos, oldpos, nodata;
62 lcount = pr1403 ? 1 : 2;
70 nodata = cr - cl >= ncol || noheight || allh(i);
72 Bprint(&tabout, "\\v'-.5m'");
73 for (ln = oldpos = 0; ln < lcount; ln++) {
74 linpos = 2 * ln - lcount + 1;
76 Bprint(&tabout, "\\v'%dp'", linpos - oldpos);
81 switch (interv(i, cl)) {
83 exhl = ln == 0 ? "1p" : "-1p";
86 exhl = ln == 1 ? "1p" : "-1p";
93 Bprint(&tabout, "\\h'%s'", exhl);
94 } else if (lcount == 1) {
95 switch (interv(i, cl)) {
105 Bprint(&tabout, "\\h'%s'", exhl);
108 switch (interv(i, cr + 1)) {
110 exhr = ln == 0 ? "-1p" : "+1p";
113 exhr = ln == 1 ? "-1p" : "+1p";
119 } else if (lcount == 1) {
120 switch (interv(i, cr + 1)) {
131 Bprint(&tabout, "\\h'|\\n(%2su'", reg(cl, CLEFT));
132 Bprint(&tabout, "\\s\\n(%d", LSIZE);
134 Bprint(&tabout, "\\v'-\\n(%dp/6u'", LSIZE);
136 Bprint(&tabout, "\\l'|\\n(%2su'", reg(cr, CRIGHT));
141 lnch = lintype == 2 ? "=" : "\\(ru";
143 Bprint(&tabout, "\\l'|\\n(TWu%s%s'", exhr, lnch);
145 Bprint(&tabout, "\\l'(|\\n(%2su+|\\n(%2su)/2u%s%s'", reg(cr, CRIGHT),
146 reg(cr + 1, CLEFT), exhr, lnch);
149 Bprint(&tabout, "\\v'\\n(%dp/6u'", LSIZE);
150 Bprint(&tabout, "\\s0");
153 Bprint(&tabout, "\\v'%dp'", -oldpos);
155 Bprint(&tabout, "\\v'+.5m'");
162 int i, c, k, junk, stopp;
165 for (i = 0; i < MAXLIN; i++)
167 for (i = 0; i < nlin; i++)
168 for (c = 0; c < ncol; c++) {
169 k = left(i, c, &junk);
170 if (k >= 0 && linestop[k] == 0)
171 linestop[k] = ++stopp;
173 if (boxflg || allflg || dboxflg)
179 left(int i, int c, int *lwidp)
182 /* returns -1 if no line to left */
183 /* returns number of line where it starts */
184 /* stores into lwid the kind of line */
188 kind = lefdata(i, c);
192 if (lefdata(next(i), c) == kind)
195 while (i >= 0 && lefdata(i, c) == kind)
200 for (lj = i + 1; lj < li; lj++)
201 if (instead[lj] && strcmp(instead[lj], ".TH") == 0)
203 for (i = i + 1; i < li; i++)
211 lefdata(int i, int c)
217 if (ctype(i, c) == 's') {
218 for (ck = c; ctype(i, ck) == 's'; ck--)
220 if (thish(i, ck) == 0)
227 if (dboxflg && c == 0)
231 if (boxflg && c == 0)
240 while (i + 1 < nlin) {
242 if (!fullbot[i] && !instead[i])
252 while (--i >= 0 && (fullbot[i] || instead[i]))