1*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 2*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 3*7c478bd9Sstevel@tonic-gate 4*7c478bd9Sstevel@tonic-gate 5*7c478bd9Sstevel@tonic-gate /* 6*7c478bd9Sstevel@tonic-gate * Copyright (c) 1980 Regents of the University of California. 7*7c478bd9Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement 8*7c478bd9Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 9*7c478bd9Sstevel@tonic-gate */ 10*7c478bd9Sstevel@tonic-gate 11*7c478bd9Sstevel@tonic-gate /* 12*7c478bd9Sstevel@tonic-gate * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc. 13*7c478bd9Sstevel@tonic-gate * All Rights Reserved. 14*7c478bd9Sstevel@tonic-gate */ 15*7c478bd9Sstevel@tonic-gate 16*7c478bd9Sstevel@tonic-gate #ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ 17*7c478bd9Sstevel@tonic-gate 18*7c478bd9Sstevel@tonic-gate /* tt.c: subroutines for drawing horizontal lines */ 19*7c478bd9Sstevel@tonic-gate # include "t..c" 20*7c478bd9Sstevel@tonic-gate ctype(il, ic) 21*7c478bd9Sstevel@tonic-gate { 22*7c478bd9Sstevel@tonic-gate if (instead[il]) 23*7c478bd9Sstevel@tonic-gate return(0); 24*7c478bd9Sstevel@tonic-gate if (fullbot[il]) 25*7c478bd9Sstevel@tonic-gate return(0); 26*7c478bd9Sstevel@tonic-gate il = stynum[il]; 27*7c478bd9Sstevel@tonic-gate return(style[il][ic]); 28*7c478bd9Sstevel@tonic-gate } 29*7c478bd9Sstevel@tonic-gate min(a,b) 30*7c478bd9Sstevel@tonic-gate { 31*7c478bd9Sstevel@tonic-gate return(a<b ? a : b); 32*7c478bd9Sstevel@tonic-gate } 33*7c478bd9Sstevel@tonic-gate fspan(i,c) 34*7c478bd9Sstevel@tonic-gate { 35*7c478bd9Sstevel@tonic-gate c++; 36*7c478bd9Sstevel@tonic-gate return(c<ncol && ctype(i,c)=='s'); 37*7c478bd9Sstevel@tonic-gate } 38*7c478bd9Sstevel@tonic-gate lspan(i,c) 39*7c478bd9Sstevel@tonic-gate { 40*7c478bd9Sstevel@tonic-gate int k; 41*7c478bd9Sstevel@tonic-gate if (ctype(i,c) != 's') return(0); 42*7c478bd9Sstevel@tonic-gate c++; 43*7c478bd9Sstevel@tonic-gate if (c < ncol && ctype(i,c)== 's') 44*7c478bd9Sstevel@tonic-gate return(0); 45*7c478bd9Sstevel@tonic-gate for(k=0; ctype(i,--c) == 's'; k++); 46*7c478bd9Sstevel@tonic-gate return(k); 47*7c478bd9Sstevel@tonic-gate } 48*7c478bd9Sstevel@tonic-gate ctspan(i,c) 49*7c478bd9Sstevel@tonic-gate { 50*7c478bd9Sstevel@tonic-gate int k; 51*7c478bd9Sstevel@tonic-gate c++; 52*7c478bd9Sstevel@tonic-gate for(k=1; c<ncol && ctype(i,c)=='s'; k++) 53*7c478bd9Sstevel@tonic-gate c++; 54*7c478bd9Sstevel@tonic-gate return(k); 55*7c478bd9Sstevel@tonic-gate } 56*7c478bd9Sstevel@tonic-gate tohcol(ic) 57*7c478bd9Sstevel@tonic-gate { 58*7c478bd9Sstevel@tonic-gate if (ic==0) 59*7c478bd9Sstevel@tonic-gate fprintf(tabout, "\\h'|0'"); 60*7c478bd9Sstevel@tonic-gate else 61*7c478bd9Sstevel@tonic-gate fprintf(tabout, "\\h'(|\\n(%du+|\\n(%du)/2u'", ic+CLEFT, ic+CRIGHT-1); 62*7c478bd9Sstevel@tonic-gate } 63*7c478bd9Sstevel@tonic-gate allh(i) 64*7c478bd9Sstevel@tonic-gate { 65*7c478bd9Sstevel@tonic-gate /* return true if every element in line i is horizontal */ 66*7c478bd9Sstevel@tonic-gate /* also at least one must be horizontl */ 67*7c478bd9Sstevel@tonic-gate int c, one, k; 68*7c478bd9Sstevel@tonic-gate if (fullbot[i]) return(1); 69*7c478bd9Sstevel@tonic-gate for(one=c=0; c<ncol; c++) 70*7c478bd9Sstevel@tonic-gate { 71*7c478bd9Sstevel@tonic-gate k = thish(i,c); 72*7c478bd9Sstevel@tonic-gate if (k==0) return(0); 73*7c478bd9Sstevel@tonic-gate if (k==1) continue; 74*7c478bd9Sstevel@tonic-gate one=1; 75*7c478bd9Sstevel@tonic-gate } 76*7c478bd9Sstevel@tonic-gate return(one); 77*7c478bd9Sstevel@tonic-gate } 78*7c478bd9Sstevel@tonic-gate thish(i,c) 79*7c478bd9Sstevel@tonic-gate { 80*7c478bd9Sstevel@tonic-gate int t; 81*7c478bd9Sstevel@tonic-gate char *s; 82*7c478bd9Sstevel@tonic-gate struct colstr *pc; 83*7c478bd9Sstevel@tonic-gate if (c<0)return(0); 84*7c478bd9Sstevel@tonic-gate if (i<0) return(0); 85*7c478bd9Sstevel@tonic-gate t = ctype(i,c); 86*7c478bd9Sstevel@tonic-gate if (t=='_' || t == '-') 87*7c478bd9Sstevel@tonic-gate return('-'); 88*7c478bd9Sstevel@tonic-gate if (t=='=')return('='); 89*7c478bd9Sstevel@tonic-gate if (t=='^') return(1); 90*7c478bd9Sstevel@tonic-gate if (fullbot[i] ) 91*7c478bd9Sstevel@tonic-gate return(fullbot[i]); 92*7c478bd9Sstevel@tonic-gate if (t=='s') return(thish(i,c-1)); 93*7c478bd9Sstevel@tonic-gate if (t==0) return(1); 94*7c478bd9Sstevel@tonic-gate pc = &table[i][c]; 95*7c478bd9Sstevel@tonic-gate s = (t=='a' ? pc->rcol : pc->col); 96*7c478bd9Sstevel@tonic-gate if (s==0 || (point(s) && *s==0)) 97*7c478bd9Sstevel@tonic-gate return(1); 98*7c478bd9Sstevel@tonic-gate if (vspen(s)) return(1); 99*7c478bd9Sstevel@tonic-gate if (t=barent( s)) 100*7c478bd9Sstevel@tonic-gate return(t); 101*7c478bd9Sstevel@tonic-gate return(0); 102*7c478bd9Sstevel@tonic-gate } 103