tbl: use \s(NN instead of \sNN
[troff.git] / tbl / ti.c
blobef995bbb35e0237a497ced61647d691de3c7f3fd
1 /* ti.c: classify line intersections */
2 # include "t.h"
3 /* determine local environment for intersections */
5 int
6 interv(int i, int c)
8 int ku, kl;
10 if (c >= ncol || c == 0) {
11 if (dboxflg) {
12 if (i == 0)
13 return(BOT);
14 if (i >= nlin)
15 return(TOP);
16 return(THRU);
18 if (c >= ncol)
19 return(0);
21 ku = i > 0 ? lefdata(i - 1, c) : 0;
22 if (i + 1 >= nlin && allh(i))
23 kl = 0;
24 else
25 kl = lefdata(allh(i) ? i + 1 : i, c);
26 if (ku == 2 && kl == 2)
27 return(THRU);
28 if (ku == 2)
29 return(TOP);
30 if (kl == BOT)
31 return(2);
32 return(0);
36 int
37 interh(int i, int c)
39 int kl, kr;
41 if (fullbot[i] == '=' || (dboxflg && (i == 0 || i >= nlin - 1))) {
42 if (c == ncol)
43 return(LEFT);
44 if (c == 0)
45 return(RIGHT);
46 return(THRU);
48 if (i >= nlin)
49 return(0);
50 kl = c > 0 ? thish (i, c - 1) : 0;
51 if (kl <= 1 && i > 0 && allh(up1(i)))
52 kl = c > 0 ? thish(up1(i), c - 1) : 0;
53 kr = thish(i, c);
54 if (kr <= 1 && i > 0 && allh(up1(i)))
55 kr = c > 0 ? thish(up1(i), c) : 0;
56 if (kl == '=' && kr == '=')
57 return(THRU);
58 if (kl == '=')
59 return(LEFT);
60 if (kr == '=')
61 return(RIGHT);
62 return(0);
66 int
67 up1(int i)
69 i--;
70 while (instead[i] && i > 0)
71 i--;
72 return(i);