1: #ifndef lint
   2: static char sccsid[] = "@(#)tu.c	4.2 8/11/83";
   3: #endif
   4: 
   5:  /* tu.c: draws horizontal lines */
   6: # include "t..c"
   7: makeline(i,c,lintype)
   8: {
   9: int cr, type, shortl;
  10: type = thish(i,c);
  11: if (type==0) return;
  12: cr=c;
  13: shortl = (table[i][c].col[0]=='\\');
  14: if (c>0 && !shortl && thish(i,c-1) == type)return;
  15: if (shortl==0)
  16:     for(cr=c; cr < ncol && (ctype(i,cr)=='s'||type==thish(i,cr)); cr++);
  17: else
  18:     for(cr=c+1; cr<ncol && ctype(i,cr)=='s'; cr++);
  19: drawline(i, c, cr-1, lintype, 0, shortl);
  20: }
  21: fullwide(i, lintype)
  22: {
  23: int cr, cl;
  24: if (!pr1403)
  25:     fprintf(tabout, ".nr %d \\n(.v\n.vs \\n(.vu-\\n(.sp\n", SVS);
  26: cr= 0;
  27: while (cr<ncol)
  28:     {
  29:     cl=cr;
  30:     while (i>0 && vspand(prev(i),cl,1))
  31:         cl++;
  32:     for(cr=cl; cr<ncol; cr++)
  33:         if (i>0 && vspand(prev(i),cr,1))
  34:             break;
  35:     if (cl<ncol)
  36:     drawline(i,cl,(cr<ncol?cr-1:cr),lintype,1,0);
  37:     }
  38: fprintf(tabout, "\n");
  39: if (!pr1403)
  40:     fprintf(tabout, ".vs \\n(%du\n", SVS);
  41: }
  42: 
  43: drawline(i, cl, cr, lintype, noheight, shortl)
  44: {
  45:     char *exhr, *exhl;
  46:     int lcount, ln, linpos, oldpos, nodata, lnch;
  47: lcount=0;
  48: exhr=exhl= "";
  49: switch(lintype)
  50:     {
  51:     case '-': lcount=1;break;
  52:     case '=': lcount = pr1403? 1 : 2; break;
  53:     case SHORTLINE: lcount=1; break;
  54:     }
  55: if (lcount<=0) return;
  56: nodata = cr-cl>=ncol || noheight || allh(i);
  57:     if (!nodata)
  58:         fprintf(tabout, "\\v'-.5m'");
  59: for(ln=oldpos=0; ln<lcount; ln++)
  60:     {
  61:     linpos = 2*ln - lcount +1;
  62:     if (linpos != oldpos)
  63:         fprintf(tabout, "\\v'%dp'", linpos-oldpos);
  64:     oldpos=linpos;
  65:     if (shortl==0)
  66:     {
  67:     tohcol(cl);
  68:     if (lcount>1)
  69:         {
  70:         switch(interv(i,cl))
  71:             {
  72:             case TOP: exhl = ln==0 ? "1p" : "-1p"; break;
  73:             case BOT: exhl = ln==1 ? "1p" : "-1p"; break;
  74:             case THRU: exhl = "1p"; break;
  75:             }
  76:         if (exhl[0])
  77:         fprintf(tabout, "\\h'%s'", exhl);
  78:         }
  79:     else if (lcount==1)
  80:         {
  81:         switch(interv(i,cl))
  82:             {
  83:             case TOP: case BOT: exhl = "-1p"; break;
  84:             case THRU: exhl = "1p"; break;
  85:             }
  86:         if (exhl[0])
  87:         fprintf(tabout, "\\h'%s'", exhl);
  88:         }
  89:     if (lcount>1)
  90:         {
  91:         switch(interv(i,cr+1))
  92:             {
  93:             case TOP: exhr = ln==0 ? "-1p" : "+1p"; break;
  94:             case BOT: exhr = ln==1 ? "-1p" : "+1p"; break;
  95:             case THRU: exhr = "-1p"; break;
  96:             }
  97:         }
  98:     else if (lcount==1)
  99:         {
 100:         switch(interv(i,cr+1))
 101:             {
 102:             case TOP: case BOT: exhr = "+1p"; break;
 103:             case THRU: exhr = "-1p"; break;
 104:             }
 105:         }
 106:     }
 107:     else
 108:         fprintf(tabout, "\\h'|\\n(%du'", cl+CLEFT);
 109:     fprintf(tabout, "\\s\\n(%d",LSIZE);
 110:     if (linsize)
 111:         fprintf(tabout, "\\v'-\\n(%dp/6u'", LSIZE);
 112:     if (shortl)
 113:         fprintf(tabout, "\\l'|\\n(%du'", cr+CRIGHT);
 114:     else
 115:     {
 116:     lnch = "\\(ul";
 117:     if (pr1403)
 118:         lnch = lintype==2 ? "=" : "\\(ru";
 119:     if (cr+1>=ncol)
 120:         fprintf(tabout, "\\l'|\\n(TWu%s%s'", exhr,lnch);
 121:     else
 122:         fprintf(tabout, "\\l'(|\\n(%du+|\\n(%du)/2u%s%s'", cr+CRIGHT,
 123:             cr+1+CLEFT, exhr, lnch);
 124:     }
 125:     if (linsize)
 126:         fprintf(tabout, "\\v'\\n(%dp/6u'", LSIZE);
 127:     fprintf(tabout, "\\s0");
 128:     }
 129: if (oldpos!=0)
 130:     fprintf(tabout, "\\v'%dp'", -oldpos);
 131: if (!nodata)
 132:     fprintf(tabout, "\\v'+.5m'");
 133: }
 134: getstop()
 135: {
 136: int i,c,k,junk, stopp;
 137: stopp=1;
 138: for(i=0; i<MAXLIN; i++)
 139:     linestop[i]=0;
 140: for(i=0; i<nlin; i++)
 141:     for(c=0; c<ncol; c++)
 142:         {
 143:         k = left(i,c,&junk);
 144:         if (k>=0 && linestop[k]==0)
 145:             linestop[k]= ++stopp;
 146:         }
 147: if (boxflg || allflg || dboxflg)
 148:     linestop[0]=1;
 149: }
 150: left(i,c, lwidp)
 151:     int *lwidp;
 152: {
 153: int kind, li, lj;
 154:     /* returns -1 if no line to left */
 155:     /* returns number of line where it starts */
 156:     /* stores into lwid the kind of line */
 157: *lwidp=0;
 158: kind = lefdata(i,c);
 159: if (kind==0) return(-1);
 160: if (i+1<nlin)
 161: if (lefdata(next(i),c)== kind) return(-1);
 162: while (i>=0 && lefdata(i,c)==kind)
 163:     i=prev(li=i);
 164: if (prev(li)== -1) li=0;
 165: *lwidp=kind;
 166: for(lj= i+1; lj<li; lj++)
 167:     if (instead[lj] && strcmp(instead[lj], ".TH")==0)
 168:         return(li);
 169: for(i= i+1; i<li; i++)
 170:     if (fullbot[i])
 171:         li=i;
 172: return(li);
 173: }
 174: lefdata(i,c)
 175: {
 176: int ck;
 177: if (i>=nlin) i=nlin-1;
 178: if (ctype(i,c) == 's')
 179:     {
 180:     for(ck=c; ctype(i,ck)=='s'; ck--);
 181:     if (thish(i,ck)==0)
 182:         return(0);
 183:     }
 184: i =stynum[i];
 185: i = lefline[i][c];
 186: if (i>0) return(i);
 187: if (dboxflg && c==0) return(2);
 188: if (allflg)return(1);
 189: if (boxflg && c==0) return(1);
 190: return(0);
 191: }
 192: next(i)
 193: {
 194: while (i+1 <nlin)
 195:     {
 196:     i++;
 197:     if (!fullbot[i] && !instead[i]) break;
 198:     }
 199: return(i);
 200: }
 201: prev(i)
 202: {
 203: while (--i >=0  && (fullbot[i] || instead[i]))
 204:     ;
 205: return(i);
 206: }

Defined functions

drawline defined in line 43; used 3 times
fullwide defined in line 21; used 3 times
getstop defined in line 134; used 1 times
lefdata defined in line 174; used 5 times
left defined in line 150; used 5 times
makeline defined in line 7; used 2 times
next defined in line 192; used 3 times
prev defined in line 201; used 18 times

Defined variables

sccsid defined in line 2; never used
Last modified: 1983-08-12
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1376
Valid CSS Valid XHTML 1.0 Strict