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

Defined functions

drawline defined in line 39; used 3 times
fullwide defined in line 17; used 3 times
getstop defined in line 130; used 1 times
lefdata defined in line 170; used 5 times
left defined in line 146; used 5 times
makeline defined in line 3; used 2 times
next defined in line 188; used 3 times
prev defined in line 197; used 18 times
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 858
Valid CSS Valid XHTML 1.0 Strict