6047 SPARC boot should support feature@embedded_data
[unleashed.git] / usr / src / cmd / tbl / ti.c
blob5f852162eb53571565b554731e29ec149e38d6bd
1 /*
2 * Copyright 1990 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
6 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
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.
15 #pragma ident "%Z%%M% %I% %E% SMI"
17 /* ti.c: classify line intersections */
18 # include "t..c"
19 /* determine local environment for intersections */
21 int
22 interv(int i, int c)
24 int ku, kl;
25 if (c>=ncol || c == 0)
27 if (dboxflg)
29 if (i==0) return(BOT);
30 if (i>=nlin) return(TOP);
31 return(THRU);
33 if (c>=ncol)
34 return(0);
36 ku = i>0 ? lefdata(i-1,c) : 0;
37 if (i+1 >= nlin)
38 kl=0;
39 else
40 kl = lefdata(allh(i) ? i+1 : i, c);
41 if (ku==2 && kl==2) return(THRU);
42 if (ku ==2) return(TOP);
43 if (kl==BOT) return(2);
44 return(0);
47 int
48 interh(int i, int c)
50 int kl, kr;
51 if (fullbot[i]== '=' || (dboxflg && (i==0 || i>= nlin-1)))
53 if (c==ncol)
54 return(LEFT);
55 if (c==0)
56 return(RIGHT);
57 return(THRU);
59 if (i>=nlin) return(0);
60 kl = c>0 ? thish (i,c-1) : 0;
61 if (kl<=1 && i>0 && allh(up1(i)))
62 kl = c>0 ? thish(up1(i),c-1) : 0;
63 kr = thish(i,c);
64 if (kr<=1 && i>0 && allh(up1(i)))
65 kr = c>0 ? thish(up1(i), c) : 0;
66 if (kl== '=' && kr == '=') return(THRU);
67 if (kl== '=') return(LEFT);
68 if (kr== '=') return(RIGHT);
69 return(0);
72 int
73 up1(int i)
75 i--;
76 while (instead[i] && i>0) i--;
77 return(i);