converted man page
[unix-history] / usr / src / old / tbl / ti.c
CommitLineData
476fcd16
SL
1#ifndef lint
2static char sccsid[] = "@(#)ti.c 4.2 %G%";
3#endif
7e959822
BS
4
5 /* ti.c: classify line intersections */
6# include "t..c"
7/* determine local environment for intersections */
8interv(i,c)
9{
10int ku, kl;
11if (c>=ncol || c == 0)
12 {
13 if (dboxflg)
14 {
15 if (i==0) return(BOT);
16 if (i>=nlin) return(TOP);
17 return(THRU);
18 }
19 if (c>=ncol)
20 return(0);
21 }
22ku = i>0 ? lefdata(i-1,c) : 0;
23if (i+1 >= nlin)
24 kl=0;
25else
26kl = lefdata(allh(i) ? i+1 : i, c);
27if (ku==2 && kl==2) return(THRU);
28if (ku ==2) return(TOP);
29if (kl==BOT) return(2);
30return(0);
31}
32interh(i,c)
33{
34int kl, kr;
35if (fullbot[i]== '=' || (dboxflg && (i==0 || i>= nlin-1)))
36 {
37 if (c==ncol)
38 return(LEFT);
39 if (c==0)
40 return(RIGHT);
41 return(THRU);
42 }
43if (i>=nlin) return(0);
44kl = c>0 ? thish (i,c-1) : 0;
45if (kl<=1 && i>0 && allh(up1(i)))
46 kl = c>0 ? thish(up1(i),c-1) : 0;
47kr = thish(i,c);
48if (kr<=1 && i>0 && allh(up1(i)))
49 kr = c>0 ? thish(up1(i), c) : 0;
50if (kl== '=' && kr == '=') return(THRU);
51if (kl== '=') return(LEFT);
52if (kr== '=') return(RIGHT);
53return(0);
54}
55up1(i)
56{
57i--;
58while (instead[i] && i>0) i--;
59return(i);
60}