Commit | Line | Data |
---|---|---|
42d6e430 BJ |
1 | /* ti.c: classify line intersections */ |
2 | # include "t..c" | |
3 | /* determine local environment for intersections */ | |
4 | interv(i,c) | |
5 | { | |
6 | int ku, kl; | |
7 | if (c>=ncol || c == 0) | |
8 | { | |
9 | if (dboxflg) | |
10 | { | |
11 | if (i==0) return(BOT); | |
12 | if (i>=nlin) return(TOP); | |
13 | return(THRU); | |
14 | } | |
15 | if (c>=ncol) | |
16 | return(0); | |
17 | } | |
18 | ku = i>0 ? lefdata(i-1,c) : 0; | |
19 | if (i+1 >= nlin) | |
20 | kl=0; | |
21 | else | |
22 | kl = lefdata(allh(i) ? i+1 : i, c); | |
23 | if (ku==2 && kl==2) return(THRU); | |
24 | if (ku ==2) return(TOP); | |
25 | if (kl==BOT) return(2); | |
26 | return(0); | |
27 | } | |
28 | interh(i,c) | |
29 | { | |
30 | int kl, kr; | |
31 | if (fullbot[i]== '=' || (dboxflg && (i==0 || i>= nlin-1))) | |
32 | { | |
33 | if (c==ncol) | |
34 | return(LEFT); | |
35 | if (c==0) | |
36 | return(RIGHT); | |
37 | return(THRU); | |
38 | } | |
39 | if (i>=nlin) return(0); | |
40 | kl = c>0 ? thish (i,c-1) : 0; | |
41 | if (kl<=1 && i>0 && allh(up1(i))) | |
42 | kl = c>0 ? thish(up1(i),c-1) : 0; | |
43 | kr = thish(i,c); | |
44 | if (kr<=1 && i>0 && allh(up1(i))) | |
45 | kr = c>0 ? thish(up1(i), c) : 0; | |
46 | if (kl== '=' && kr == '=') return(THRU); | |
47 | if (kl== '=') return(LEFT); | |
48 | if (kr== '=') return(RIGHT); | |
49 | return(0); | |
50 | } | |
51 | up1(i) | |
52 | { | |
53 | i--; | |
54 | while (instead[i] && i>0) i--; | |
55 | return(i); | |
56 | } |