1 /*- 2 * %sccs.include.proprietary.c% 3 */ 4 5 #ifndef lint 6 static char sccsid[] = "@(#)tt.c 4.3 (Berkeley) 04/18/91"; 7 #endif /* not lint */ 8 9 /* tt.c: subroutines for drawing horizontal lines */ 10 # include "t..c" 11 ctype(il, ic) 12 { 13 if (instead[il]) 14 return(0); 15 if (fullbot[il]) 16 return(0); 17 il = stynum[il]; 18 return(style[il][ic]); 19 } 20 min(a,b) 21 { 22 return(a<b ? a : b); 23 } 24 fspan(i,c) 25 { 26 c++; 27 return(c<ncol && ctype(i,c)=='s'); 28 } 29 lspan(i,c) 30 { 31 int k; 32 if (ctype(i,c) != 's') return(0); 33 c++; 34 if (c < ncol && ctype(i,c)== 's') 35 return(0); 36 for(k=0; ctype(i,--c) == 's'; k++); 37 return(k); 38 } 39 ctspan(i,c) 40 { 41 int k; 42 c++; 43 for(k=1; c<ncol && ctype(i,c)=='s'; k++) 44 c++; 45 return(k); 46 } 47 tohcol(ic) 48 { 49 if (ic==0) 50 fprintf(tabout, "\\h'|0'"); 51 else 52 fprintf(tabout, "\\h'(|\\n(%du+|\\n(%du)/2u'", ic+CLEFT, ic+CRIGHT-1); 53 } 54 allh(i) 55 { 56 /* return true if every element in line i is horizontal */ 57 /* also at least one must be horizontl */ 58 int c, one, k; 59 if (fullbot[i]) return(1); 60 for(one=c=0; c<ncol; c++) 61 { 62 k = thish(i,c); 63 if (k==0) return(0); 64 if (k==1) continue; 65 one=1; 66 } 67 return(one); 68 } 69 thish(i,c) 70 { 71 int t; 72 char *s; 73 struct colstr *pc; 74 if (c<0)return(0); 75 if (i<0) return(0); 76 t = ctype(i,c); 77 if (t=='_' || t == '-') 78 return('-'); 79 if (t=='=')return('='); 80 if (t=='^') return(1); 81 if (fullbot[i] ) 82 return(fullbot[i]); 83 if (t=='s') return(thish(i,c-1)); 84 if (t==0) return(1); 85 pc = &table[i][c]; 86 s = (t=='a' ? pc->rcol : pc->col); 87 if (s==0 || (point(s) && *s==0)) 88 return(1); 89 if (vspen(s)) return(1); 90 if (t=barent( s)) 91 return(t); 92 return(0); 93 } 94