1 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 2 /* All Rights Reserved */ 3 4 5 /* 6 * Copyright (c) 1980 Regents of the University of California. 7 * All rights reserved. The Berkeley software License Agreement 8 * specifies the terms and conditions for redistribution. 9 */ 10 11 /* 12 * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. 13 * All Rights Reserved. 14 */ 15 16 #ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ 17 18 /* ti.c: classify line intersections */ 19 # include "t..c" 20 /* determine local environment for intersections */ 21 interv(i,c) 22 { 23 int ku, kl; 24 if (c>=ncol || c == 0) 25 { 26 if (dboxflg) 27 { 28 if (i==0) return(BOT); 29 if (i>=nlin) return(TOP); 30 return(THRU); 31 } 32 if (c>=ncol) 33 return(0); 34 } 35 ku = i>0 ? lefdata(i-1,c) : 0; 36 if (i+1 >= nlin) 37 kl=0; 38 else 39 kl = lefdata(allh(i) ? i+1 : i, c); 40 if (ku==2 && kl==2) return(THRU); 41 if (ku ==2) return(TOP); 42 if (kl==BOT) return(2); 43 return(0); 44 } 45 interh(i,c) 46 { 47 int kl, kr; 48 if (fullbot[i]== '=' || (dboxflg && (i==0 || i>= nlin-1))) 49 { 50 if (c==ncol) 51 return(LEFT); 52 if (c==0) 53 return(RIGHT); 54 return(THRU); 55 } 56 if (i>=nlin) return(0); 57 kl = c>0 ? thish (i,c-1) : 0; 58 if (kl<=1 && i>0 && allh(up1(i))) 59 kl = c>0 ? thish(up1(i),c-1) : 0; 60 kr = thish(i,c); 61 if (kr<=1 && i>0 && allh(up1(i))) 62 kr = c>0 ? thish(up1(i), c) : 0; 63 if (kl== '=' && kr == '=') return(THRU); 64 if (kl== '=') return(LEFT); 65 if (kr== '=') return(RIGHT); 66 return(0); 67 } 68 up1(i) 69 { 70 i--; 71 while (instead[i] && i>0) i--; 72 return(i); 73 } 74