dpost.ps: increase linewidth to match groff
[troff.git] / tbl / tt.c
blob08cb59edc29ab54e95fb97da13f71ba5f2451f6e
1 /* tt.c: subroutines for drawing horizontal lines */
2 # include "t.h"
4 int
5 ctype(int il, int ic)
7 if (instead[il])
8 return(0);
9 if (fullbot[il])
10 return(0);
11 il = stynum[il];
12 return(style[ic][il]);
16 int
17 min(int a, int b)
19 return(a < b ? a : b);
23 int
24 fspan(int i, int c)
26 c++;
27 return(c < ncol && ctype(i, c) == 's');
31 int
32 lspan(int i, int c)
34 int k;
36 if (ctype(i, c) != 's')
37 return(0);
38 c++;
39 if (c < ncol && ctype(i, c) == 's')
40 return(0);
41 for (k = 0; ctype(i, --c) == 's'; k++)
43 return(k);
47 int
48 ctspan(int i, int c)
50 int k;
51 c++;
52 for (k = 1; c < ncol && ctype(i, c) == 's'; k++)
53 c++;
54 return(k);
58 void
59 tohcol(int ic)
61 if (ic == 0)
62 fprintf(tabout, "\\h'|0'");
63 else
64 fprintf(tabout, "\\h'(|\\n(%2su+|\\n(%2su)/2u'", reg(ic, CLEFT),
65 reg(ic - 1, CRIGHT));
69 int
70 allh(int i)
72 /* return true if every element in line i is horizontal */
73 /* also at least one must be horizontl */
74 int c, one, k;
76 if (fullbot[i])
77 return(1);
78 if (i >= nlin)
79 return(dboxflg || boxflg);
80 for (one = c = 0; c < ncol; c++) {
81 k = thish(i, c);
82 if (k == 0)
83 return(0);
84 if (k == 1)
85 continue;
86 one = 1;
88 return(one);
92 int
93 thish(int i, int c)
95 int t;
96 char *s;
97 struct colstr *pc;
99 if (c < 0)
100 return(0);
101 if (i < 0)
102 return(0);
103 t = ctype(i, c);
104 if (t == '_' || t == '-')
105 return('-');
106 if (t == '=')
107 return('=');
108 if (t == '^')
109 return(1);
110 if (fullbot[i] )
111 return(fullbot[i]);
112 if (t == 's')
113 return(thish(i, c - 1));
114 if (t == 0)
115 return(1);
116 pc = &table[i][c];
117 s = (t == 'a' ? pc->rcol : pc->col);
118 if (s == 0 || (point(s) && *s == 0))
119 return(1);
120 if (vspen(s))
121 return(1);
122 if (t = barent( s))
123 return(t);
124 return(0);