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