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