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