1: # include "e.h"
   2: #include "e.def"
   3: 
   4: bshiftb(p1, dir, p2) int p1, dir, p2; {
   5:     int shval, diffps, effps, effps2, d1, h1, b1, h2, b2;
   6:     char *sh1, *sh2;
   7: 
   8:     yyval = p1;
   9:     h1 = eht[p1];
  10:     b1 = ebase[p1];
  11:     h2 = eht[p2];
  12:     b2 = ebase[p2];
  13:     effps = EFFPS(ps);
  14:     effps2 = EFFPS(ps+deltaps);
  15:     diffps = deltaps;
  16:     sh1 = sh2 = "";
  17:     if( dir == SUB ) {
  18:         /* top 1/2m above bottom of main box */
  19:         d1 = VERT( (effps2*6)/2 );
  20:         shval = - d1 + h2 - b2;
  21:         if( d1+b1 > h2 ) /* move little sub down */
  22:             shval = b1-b2;
  23:         ebase[yyval] = b1 + max(0, h2-b1-d1);
  24:         eht[yyval] = h1 + max(0, h2-b1-d1);
  25:         if (rfont[p1] == ITAL && lfont[p2] == ROM)
  26:             sh1 = "\\|";
  27:         if (rfont[p2] == ITAL)
  28:             sh2 = "\\|";
  29:     } else {    /* superscript */
  30:         /* 4/10 up main box */
  31:         d1 = VERT( (effps*6*2)/10 );
  32:         ebase[yyval] = b1;
  33:         shval = -VERT( (4 * (h1-b1)) / 10 ) - b2;
  34:         if( VERT(4*(h1-b1)/10) + h2 < h1-b1 )   /* raise little super */
  35:             shval = -(h1-b1) + h2-b2 - d1;
  36:         eht[yyval] = h1 + max(0, h2-VERT((6*(h1-b1))/10));
  37:         if (rfont[p1] == ITAL)
  38:             sh1 = "\\|";
  39:         if (rfont[p2] == ITAL)
  40:             sh2 = "\\|";
  41:     }
  42:     if(dbg)printf(".\tb:b shift b: S%d <- S%d vert %d S%d vert %d; b=%d, h=%d\n",
  43:         yyval, p1, shval, p2, -shval, ebase[yyval], eht[yyval]);
  44:     printf(".as %d \\v'%du'\\s-%d%s\\*(%d\\s+%d%s\\v'%du'\n",
  45:         yyval, shval, diffps, sh1, p2, diffps, sh2, -shval);
  46:     ps += deltaps;
  47:     if (rfont[p2] == ITAL)
  48:         rfont[p1] = 0;
  49:     else
  50:         rfont[p1] = rfont[p2];
  51:     ofree(p2);
  52: }
  53: 
  54: shift(p1) int p1; {
  55:     ps -= deltaps;
  56:     yyval = p1;
  57:     if(dbg)printf(".\tshift: %d;ps=%d\n", yyval, ps);
  58: }
  59: 
  60: shift2(p1, p2, p3) int p1, p2, p3; {
  61:     int effps, effps2, h1, h2, h3, b1, b2, b3, subsh, d1, d2, supsh;
  62:     int treg;
  63:     treg = oalloc();
  64:     yyval = p1;
  65:     if(dbg)printf(".\tshift2 s%d <- %d %d %d\n", yyval, p1, p2, p3);
  66:     effps = EFFPS(ps+deltaps);
  67:     eht[p3] = h3 = VERT( (eht[p3] * effps) / EFFPS(ps) );
  68:     ps += deltaps;
  69:     effps2 = EFFPS(ps+deltaps);
  70:     h1 = eht[p1]; b1 = ebase[p1];
  71:     h2 = eht[p2]; b2 = ebase[p2];
  72:     b3 = ebase[p3];
  73:     d1 = VERT( (effps2*6)/2 );
  74:     subsh = -d1+h2-b2;
  75:     if( d1+b1 > h2 ) /* move little sub down */
  76:         subsh = b1-b2;
  77:     supsh = -VERT( (4*(h1-b1))/10 ) - b3;
  78:     d2 = VERT( (effps*6*2)/10 );
  79:     if( VERT(4*(h1-b1)/10)+h3 < h1-b1 )
  80:         supsh = -(h1-b1) + (h3-b3) - d2;
  81:     eht[yyval] = h1 + max(0, h3-VERT( (6*(h1-b1))/10 )) + max(0, h2-b1-d1);
  82:     ebase[yyval] = b1+max(0, h2-b1-d1);
  83:     if (rfont[p1] == ITAL && lfont[p2] == ROM)
  84:         printf(".ds %d \\|\\*(%d\n", p2, p2);
  85:     if (rfont[p2] == ITAL)
  86:         printf(".as %d \\|\n", p2);
  87:     nrwid(p2, effps, p2);
  88:     if (rfont[p1] == ITAL && lfont[p3] == ROM)
  89:         printf(".ds %d \\|\\|\\*(%d\n", p3, p3);
  90:     else
  91:         printf(".ds %d \\|\\*(%d\n", p3, p3);
  92:     nrwid(p3, effps, p3);
  93:     printf(".nr %d \\n(%d\n", treg, p3);
  94:     printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n", p2, treg, treg, p2);
  95:     printf(".as %d \\v'%du'\\s%d\\*(%d\\h'-\\n(%du'\\v'%du'\\\n",
  96:         p1, subsh, effps, p2, p2, -subsh+supsh);
  97:     printf("\\s%d\\*(%d\\h'-\\n(%du+\\n(%du'\\s%d\\v'%du'\n",
  98:         effps, p3, p3, treg, effps2, -supsh);
  99:     ps += deltaps;
 100:     if (rfont[p2] == ITAL)
 101:         rfont[yyval] = 0;   /* lie */
 102:     ofree(p2); ofree(p3); ofree(treg);
 103: }

Defined functions

bshiftb defined in line 4; used 4 times
shift defined in line 54; used 2 times
shift2 defined in line 60; used 2 times
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 804
Valid CSS Valid XHTML 1.0 Strict