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

Defined functions

lpile defined in line 7; used 5 times

Defined variables

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