/* * Copyright 1990 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ /* * Copyright (c) 1980 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ /* tu.c: draws horizontal lines */ # include "t..c" void drawline(int, int, int, int, int, int); void makeline(int i, int c, int lintype) { int cr, type, shortl; type = thish(i,c); if (type==0) return; cr=c; shortl = (table[i][c].col[0]=='\\'); if (c>0 && !shortl && thish(i,c-1) == type)return; if (shortl==0) for(cr=c; cr < ncol && (ctype(i,cr)=='s'||type==thish(i,cr)); cr++); else for(cr=c+1; cr0 && vspand(prev(i),cl,1)) cl++; for(cr=cl; cr0 && vspand(prev(i),cr,1)) break; if (cl1) { switch(interv(i,cl)) { case TOP: exhl = ln==0 ? "1p" : "-1p"; break; case BOT: exhl = ln==1 ? "1p" : "-1p"; break; case THRU: exhl = "1p"; break; } if (exhl[0]) fprintf(tabout, "\\h'%s'", exhl); } else if (lcount==1) { switch(interv(i,cl)) { case TOP: case BOT: exhl = "-1p"; break; case THRU: exhl = "1p"; break; } if (exhl[0]) fprintf(tabout, "\\h'%s'", exhl); } if (lcount>1) { switch(interv(i,cr+1)) { case TOP: exhr = ln==0 ? "-1p" : "+1p"; break; case BOT: exhr = ln==1 ? "-1p" : "+1p"; break; case THRU: exhr = "-1p"; break; } } else if (lcount==1) { switch(interv(i,cr+1)) { case TOP: case BOT: exhr = "+1p"; break; case THRU: exhr = "-1p"; break; } } } else fprintf(tabout, "\\h'|\\n(%du'", cl+CLEFT); fprintf(tabout, "\\s\\n(%d",LSIZE); if (linsize) fprintf(tabout, "\\v'-\\n(%dp/6u'", LSIZE); if (shortl) fprintf(tabout, "\\l'|\\n(%du'", cr+CRIGHT); else { lnch = "\\(ul"; if (pr1403) lnch = lintype==2 ? "=" : "\\(ru"; if (cr+1>=ncol) fprintf(tabout, "\\l'|\\n(TWu%s%s'", exhr,lnch); else fprintf(tabout, "\\l'(|\\n(%du+|\\n(%du)/2u%s%s'", cr+CRIGHT, cr+1+CLEFT, exhr, lnch); } if (linsize) fprintf(tabout, "\\v'\\n(%dp/6u'", LSIZE); fprintf(tabout, "\\s0"); } if (oldpos!=0) fprintf(tabout, "\\v'%dp'", -oldpos); if (!nodata) fprintf(tabout, "\\v'+.5m'"); } void getstop(void) { int i,c,k,junk, stopp; stopp=1; for(i=0; i=0 && linestop[k]==0) linestop[k]= ++stopp; } if (boxflg || allflg || dboxflg) linestop[0]=1; } int left(int i, int c, int *lwidp) { int kind, li, lj; /* returns -1 if no line to left */ /* returns number of line where it starts */ /* stores into lwid the kind of line */ *lwidp=0; kind = lefdata(i,c); if (kind==0) return(-1); if (i+1=0 && lefdata(i,c)==kind) i=prev(li=i); if (prev(li)== -1) li=0; *lwidp=kind; for(lj= i+1; lj=nlin) i=nlin-1; if (ctype(i,c) == 's') { for(ck=c; ctype(i,ck)=='s'; ck--); if (thish(i,ck)==0) return(0); } i =stynum[i]; i = lefline[i][c]; if (i>0) return(i); if (dboxflg && c==0) return(2); if (allflg)return(1); if (boxflg && c==0) return(1); return(0); } int next(int i) { while (i+1 =0 && (fullbot[i] || instead[i])) ; return(i); }