1: # include "e.h"
   2: 
   3: lpile(type, p1, p2) int type, p1, p2; {
   4:     int bi, hi, i, gap, h, b, nlist, nlist2, mid;
   5:     yyval = oalloc();
   6:     gap = VERT(1);
   7:     if( type=='-' ) gap = 0;
   8:     nlist = p2 - p1;
   9:     nlist2 = (nlist+1)/2;
  10:     mid = p1 + nlist2 -1;
  11:     h = 0;
  12:     for( i=p1; i<p2; i++ )
  13:         h += eht[lp[i]];
  14:     eht[yyval] = h + (nlist-1)*gap;
  15:     b = 0;
  16:     for( i=p2-1; i>mid; i-- )
  17:         b += eht[lp[i]] + gap;
  18:     ebase[yyval] = (nlist%2) ? b + ebase[lp[mid]]
  19:             : b - VERT(1) - gap;
  20:     if(dbg) {
  21:         printf(".\tS%d <- %c pile of:", yyval, type);
  22:         for( i=p1; i<p2; i++)
  23:             printf(" S%d", lp[i]);
  24:         printf(";h=%d b=%d\n", eht[yyval], ebase[yyval]);
  25:     }
  26:     nrwid(lp[p1], ps, lp[p1]);
  27:     printf(".nr %d \\n(%d\n", yyval, lp[p1]);
  28:     for( i = p1+1; i<p2; i++ ) {
  29:         nrwid(lp[i], ps, lp[i]);
  30:         printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n",
  31:             lp[i], yyval, yyval, lp[i]);
  32:     }
  33:     printf(".ds %d \\v'%du'\\h'%du*\\n(%du'\\\n", yyval, ebase[yyval],
  34:         type=='R' ? 1 : 0, yyval);
  35:     for(i = p2-1; i >=p1; i--) {
  36:         hi = eht[lp[i]];
  37:         bi = ebase[lp[i]];
  38:     switch(type) {
  39: 
  40:     case 'L':
  41:         printf("\\v'%du'\\*(%d\\h'-\\n(%du'\\v'0-%du'\\\n",
  42:             -bi, lp[i], lp[i], hi-bi+gap);
  43:         continue;
  44:     case 'R':
  45:         printf("\\v'%du'\\h'-\\n(%du'\\*(%d\\v'0-%du'\\\n",
  46:             -bi, lp[i], lp[i], hi-bi+gap);
  47:         continue;
  48:     case 'C':
  49:     case '-':
  50:         printf("\\v'%du'\\h'\\n(%du-\\n(%du/2u'\\*(%d",
  51:             -bi, yyval, lp[i], lp[i]);
  52:         printf("\\h'-\\n(%du-\\n(%du/2u'\\v'0-%du'\\\n",
  53:             yyval, lp[i], hi-bi+gap);
  54:         continue;
  55:         }
  56:     }
  57:     printf("\\v'%du'\\h'%du*\\n(%du'\n", eht[yyval]-ebase[yyval]+gap,
  58:         type!='R' ? 1 : 0, yyval);
  59:     for( i=p1; i<p2; i++ )
  60:         ofree(lp[i]);
  61:     lfont[yyval] = rfont[yyval] = 0;
  62: }

Defined functions

lpile defined in line 3; used 9 times
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 741
Valid CSS Valid XHTML 1.0 Strict