Commit | Line | Data |
---|---|---|
476fcd16 SL |
1 | #ifndef lint |
2 | static 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 */ | |
8 | interv(i,c) | |
9 | { | |
10 | int ku, kl; | |
11 | if (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 | } | |
22 | ku = i>0 ? lefdata(i-1,c) : 0; | |
23 | if (i+1 >= nlin) | |
24 | kl=0; | |
25 | else | |
26 | kl = lefdata(allh(i) ? i+1 : i, c); | |
27 | if (ku==2 && kl==2) return(THRU); | |
28 | if (ku ==2) return(TOP); | |
29 | if (kl==BOT) return(2); | |
30 | return(0); | |
31 | } | |
32 | interh(i,c) | |
33 | { | |
34 | int kl, kr; | |
35 | if (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 | } | |
43 | if (i>=nlin) return(0); | |
44 | kl = c>0 ? thish (i,c-1) : 0; | |
45 | if (kl<=1 && i>0 && allh(up1(i))) | |
46 | kl = c>0 ? thish(up1(i),c-1) : 0; | |
47 | kr = thish(i,c); | |
48 | if (kr<=1 && i>0 && allh(up1(i))) | |
49 | kr = c>0 ? thish(up1(i), c) : 0; | |
50 | if (kl== '=' && kr == '=') return(THRU); | |
51 | if (kl== '=') return(LEFT); | |
52 | if (kr== '=') return(RIGHT); | |
53 | return(0); | |
54 | } | |
55 | up1(i) | |
56 | { | |
57 | i--; | |
58 | while (instead[i] && i>0) i--; | |
59 | return(i); | |
60 | } |