#include "externs.h"

void F193_charwarning (f, c)
/*******************/
T43_internalfontnumber f;
T22_eightbits c;
{
  if (eqtb[5302]._TAG._TAG1._int > 0L)
  {
    F118_begindiagnostic ();
    F19_printnl (678);
    F60_printascii ((int)c);
    F17_print (679);
    F17_print (fontname[f]);
    F16_printchar ((char)33);
    F119_enddiagnostic (FALSE);
  }
}

int /* was T32_halfword */ F194_newcharacter (f, c)
/*********************************/
#ifdef VAX
register int f;
#else
T43_internalfontnumber f;
#endif
#ifdef VAX
register int c;
#else
T22_eightbits c;
#endif
{
  register int /* was T32_halfword */ p;
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  register T37_memoryword *memptr;
#endif

  if (fontbc[f] <= c)
    if (fontec[f] >= c)
      if (fontinfo[(charbase[f] + c) - 128]._TAG._TAG4.qqqq.b0 > (-128))
      {
	p = F75_getavail ();
	memptr = &mem[p - C2_memmin];
	memptr->_TAG._TAG3.hh._TAG._TAG2.b0 = f;
	memptr->_TAG._TAG3.hh._TAG._TAG2.b1 = c - 128;
	return(p);
      }
  F193_charwarning (f, c);
  return((int)(-32768));
}

void F195_dviswap ()
/************/
{
  if (dvilimit == C18_dvibufsize)
  {
    write(dvifile,dvibuf,C18_halfbufsize);
    dvilimit = C18_halfbufsize;
    dvioffset += C18_dvibufsize;
    dviptr = 0;
  }
  else
  {
    write(dvifile,&dvibuf[C18_halfbufsize],C18_halfbufsize);
    dvilimit = C18_dvibufsize;
  }
  dvigone += C18_halfbufsize;
}

void F196_dvifour (x)
/*************/
register long int   x;
{
  if (x >= 0)
  {
    dvibuf[dviptr++] = x >> 24;
    if (dviptr == dvilimit)
      F195_dviswap ();
  }
  else
  {
    x += 1073741824;
    x += 1073741824;
    dvibuf[dviptr++] = (x >> 24) + 128;
    if (dviptr == dvilimit)
      F195_dviswap ();
  }
  x &= 16777215;
  dvibuf[dviptr++] = x >> 16;
  if (dviptr == dvilimit)
    F195_dviswap ();
  x &= 65535;
  dvibuf[dviptr++] = x >> 8;
  if (dviptr == dvilimit)
    F195_dviswap ();
  dvibuf[dviptr++] = x & 255;
  if (dviptr == dvilimit)
    F195_dviswap ();
}

void F197_dvipop (l)
/************/
long int   l;
{
  if ((l == (dvioffset + dviptr)) && (dviptr > 0))
    dviptr--;
  else
  {
    dvibuf[dviptr++] = 142;
    if (dviptr == dvilimit)
      F195_dviswap ();
  }
}

void F198_dvifontdef (f)
/****************/
#ifdef VAX
register int f;
#else
register T43_internalfontnumber f;
#endif
{
  dvibuf[dviptr++] = 243;
  if (dviptr == dvilimit)
    F195_dviswap ();
  dvibuf[dviptr++] = f - 1;
  if (dviptr == dvilimit)
    F195_dviswap ();
  dvibuf[dviptr++] = fontcheck[f].b0 + 128;
  if (dviptr == dvilimit)
    F195_dviswap ();
  dvibuf[dviptr++] = fontcheck[f].b1 + 128;
  if (dviptr == dvilimit)
    F195_dviswap ();
  dvibuf[dviptr++] = fontcheck[f].b2 + 128;
  if (dviptr == dvilimit)
    F195_dviswap ();
  dvibuf[dviptr++] = fontcheck[f].b3 + 128;
  if (dviptr == dvilimit)
    F195_dviswap ();
  F196_dvifour (fontsize[f]);
  F196_dvifour (fontdsize[f]);
  dvibuf[dviptr++] = strstart[fontarea[f] + 1] - strstart[fontarea[f]];
  if (dviptr == dvilimit)
    F195_dviswap ();
  dvibuf[dviptr++] = strstart[fontname[f] + 1] - strstart[fontname[f]];
  if (dviptr == dvilimit)
    F195_dviswap ();
  {
#ifdef VAX
    register int k,help;
#else
    register T25_poolpointer k;
    register T25_poolpointer help;
#endif

    help=strstart[fontarea[f]+1];
    for (k = strstart[fontarea[f]]; k < help; k++)
    {
      dvibuf[dviptr++] = strpool[k];
      if (dviptr == dvilimit)
	F195_dviswap ();
    }
    help=strstart[fontname[f]+1];
    for (k = strstart[fontname[f]]; k < help; k++)
    {
      dvibuf[dviptr++] = strpool[k];
      if (dviptr == dvilimit)
	F195_dviswap ();
    }
  }
}

void F199_movement (w, o)
/****************/
register long int   w;
#ifdef VAX
register int o;
#else
register T22_eightbits o;
#endif
{
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  register T37_memoryword *memptr;
#endif
  register long int   k;
#ifdef VAX
register int mstate;
#else
  register T29_smallnumber mstate;
#endif
  register int /* was T32_halfword */ p;
  register int /* was T32_halfword */ q;

  q = F77_getnode (3L);
  memptr = &mem[q - C2_memmin];
  (memptr+1)->_TAG._TAG1._int = w;
  (memptr+2)->_TAG._TAG1._int = dvioffset + dviptr;
  if (o == 157)
  {
    p = memptr->_TAG._TAG3.hh.rh = downptr;
    downptr = q;
  }
  else
  {
    p = memptr->_TAG._TAG3.hh.rh = rightptr;
    rightptr = q;
  }
  mstate = 0;
  while (p != -32768)
  {
    memptr = &mem[p - C2_memmin];
    if ((memptr+1)->_TAG._TAG1._int == w)
      switch (mstate + memptr->_TAG._TAG3.hh._TAG._TAG1.lh)
      {
	case 3: 
	case 4: 
	case 15: 
	case 16: 
	  {
#ifdef VAX
	    register int help;
#else
	    register long help;
#endif
	    if ((help = (memptr+2)->_TAG._TAG1._int) < dvigone)
	      goto _45;
	    else
	    {
	      k = help - dvioffset;
	      if (k < 0)
		k += C18_dvibufsize;
	      dvibuf[k] += 5;
	      memptr->_TAG._TAG3.hh._TAG._TAG1.lh = 1;
	      goto _40;
	    }
	  }
	  break;
	case 5: 
	case 9: 
	case 11: 
	  {
#ifdef VAX
	    register int help;
#else
	    register long help;
#endif
	    if ((help = (memptr+2)->_TAG._TAG1._int) < dvigone)
	      goto _45;
	    else
	    {
	      k = help - dvioffset;
	      if (k < 0)
		k += C18_dvibufsize;
	      dvibuf[k] += 10;
	      memptr->_TAG._TAG3.hh._TAG._TAG1.lh = 2;
	      goto _40;
	    }
	  }
	  break;
	case 1: 
	case 2: 
	case 8: 
	case 13: 
	  goto _40;
	  break;
	default: 
	  break;
      }
    else
      switch (mstate + memptr->_TAG._TAG3.hh._TAG._TAG1.lh)
      {
	case 1: 
	  mstate = 6;
	  break;
	case 2: 
	  mstate = 12;
	  break;
	case 8: 
	case 13: 
	  goto _45;
	  break;
	default: 
	  break;
      }
    p = memptr->_TAG._TAG3.hh.rh;
  }
_45: 
  mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = 3;
  if ((w >= 8388608)||(w <= -8388608))
  {
    dvibuf[dviptr++] = o + 3;
    if (dviptr == dvilimit)
      F195_dviswap ();
    F196_dvifour (w);
    return;
  }
  if ((w >= 32768L)||(w <= -32768L))
  {
    dvibuf[dviptr++] = o + 2;
    if (dviptr == dvilimit)
      F195_dviswap ();
    if (w < 0)
      w += 16777216;
    dvibuf[dviptr++] = w >> 16;
    if (dviptr == dvilimit)
      F195_dviswap ();
    w &= 65535L;
    goto _2;
  }
  if ((w >= 128L)||(w <= -128L))
  {
    dvibuf[dviptr++] = o + 1;
    if (dviptr == dvilimit)
      F195_dviswap ();
    if (w < 0L)
      w += 65536L;
    goto _2;
  }
  dvibuf[dviptr++] = o;
  if (dviptr == dvilimit)
    F195_dviswap ();
  if (w < 0L)
    w += 256;
  goto _1;
_2: 
  dvibuf[dviptr++] = w >> 8;
  if (dviptr == dvilimit)
    F195_dviswap ();
_1: 
  dvibuf[dviptr++] = w & 255;
  if (dviptr == dvilimit)
    F195_dviswap ();
  return;
 _40: 
  {
    register int shelp;
    memptr = &mem[q - C2_memmin];
    shelp = memptr->_TAG._TAG3.hh._TAG._TAG1.lh = mem[p - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh;
    if (shelp == 1)
    {
      dvibuf[dviptr++] = o + 4;
      if (dviptr == dvilimit)
	F195_dviswap ();
      while ((shelp = memptr->_TAG._TAG3.hh.rh) != p)
      {
	q = shelp;
	memptr = &mem[q - C2_memmin];
	switch (memptr->_TAG._TAG3.hh._TAG._TAG1.lh)
	{
	  case 3: 
	    memptr->_TAG._TAG3.hh._TAG._TAG1.lh = 5;
	    break;
	  case 4: 
	    memptr->_TAG._TAG3.hh._TAG._TAG1.lh = 6;
	    break;
	  default: 
	    break;
	}
      }
    }
    else
    {
      dvibuf[dviptr++] = o + 9;
      if (dviptr == dvilimit)
	F195_dviswap ();
      while ((shelp = memptr->_TAG._TAG3.hh.rh) != p)
      {
	q = shelp;
	memptr = &mem[q - C2_memmin];
	switch (memptr->_TAG._TAG3.hh._TAG._TAG1.lh)
	{
	  case 3: 
	    memptr->_TAG._TAG3.hh._TAG._TAG1.lh = 4;
	    break;
	  case 5: 
	    memptr->_TAG._TAG3.hh._TAG._TAG1.lh = 6;
	    break;
	  default: 
	    break;
	}
      }
    }
  }
}

void F200_prunemovements (l)
/********************/
long int   l;
{
  register int /* was T32_halfword */ p;
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  register T37_memoryword *memptr;
#endif

  while (downptr != ((int)(-32768)))
  {
    memptr = &mem[downptr - C2_memmin];
    if ((memptr+2)->_TAG._TAG1._int < l)
      goto _30;
    p = downptr;
    downptr = memptr->_TAG._TAG3.hh.rh;
    F78_freenode (p, 3);
  }
_30: 
  while (rightptr != ((int)(-32768)))
  {
    memptr = &mem[rightptr - C2_memmin];
    if ((memptr+2)->_TAG._TAG1._int < l)
      return;
    p = rightptr;
    rightptr = memptr->_TAG._TAG3.hh.rh;
    F78_freenode (p, 3);
  }
}

void F202_specialout (p)
/****************/
int /* was T32_halfword */ p;
{
#ifdef VAX
register int k;
#else
  register T25_poolpointer k;
#endif
  register int   oldsetting;

  if (curh != dvih)
  {
    F199_movement (curh - dvih, (T22_eightbits)143);
    dvih = curh;
  }
  if (curv != dviv)
  {
    F199_movement (curv - dviv, (T22_eightbits)157);
    dviv = curv;
  }
  oldsetting = selector;
  selector = 21;
  {
    register int shelp;
    shelp = mem[p + 1 - C2_memmin]._TAG._TAG3.hh.rh;
    F73_showtokenlist (mem[shelp - C2_memmin]._TAG._TAG3.hh.rh, (int)(-32768), (long)C15_poolsize - poolptr);
  }
  selector = oldsetting;
  if (poolptr >= C15_poolsize)
    F41_overflow (129, (long)C15_poolsize - initpoolptr);
  if ((poolptr - strstart[strptr]) < 256)
  {
    dvibuf[dviptr++] = 239;
    if (dviptr == dvilimit)
      F195_dviswap ();
    dvibuf[dviptr++] = poolptr - strstart[strptr];
    if (dviptr == dvilimit)
      F195_dviswap ();
  }
  else
  {
    dvibuf[dviptr++] = 242;
    if (dviptr == dvilimit)
      F195_dviswap ();
    F196_dvifour ((long)(poolptr - strstart[strptr]));
  }
  for (k = strstart[strptr]; k < poolptr; k++)
  {
    dvibuf[dviptr++] = strpool[k];
    if (dviptr == dvilimit)
      F195_dviswap ();
  }
  poolptr = strstart[strptr];
}

void F203_writeout (p)
/**************/
int /* was T32_halfword */ p;
{
  register int /* was T32_halfword */ q;
  register int /* was T32_halfword */ r;
#ifdef VAX
register int j;
#else
  register T29_smallnumber j;
#endif
  register int   oldmode;
  register int   oldsetting;

  q = F75_getavail ();
  mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = 637;
  r = F75_getavail ();
  mem[q - C2_memmin]._TAG._TAG3.hh.rh = r;
  mem[r - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = 7362;
  F140_begintokenlist (q, (char)4);
  F140_begintokenlist (mem[p + 1 - C2_memmin]._TAG._TAG3.hh.rh, (char)15);
  q = F75_getavail ();
  mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = 379;
  F140_begintokenlist (q, (char)4);
  oldmode = curlist.modefield;
  curlist.modefield = 0;
  curcs = writeloc;
  q = F177_scantoks (FALSE, TRUE);
  F29_gettoken (null);
  if (curtok != 7362)
  {
    F19_printnl (134);
    F17_print (1139);
    helpptr = 2;
    helpline[1] = 1140;
    helpline[0] = 860;
    F39_error ();
    do
      F29_gettoken (null)
    while (curtok != 7362);
  }
  curlist.modefield = oldmode;
  F141_endtokenlist ();
  oldsetting = selector;
  j = mem[p + 1 - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh;
  if (writeopen[j])
    selector = j;
  else
  {
    if ((j == 17) && (selector == 19))
      selector = 18;
    F19_printnl (207);
  }
  F73_showtokenlist (mem[defref - C2_memmin]._TAG._TAG3.hh.rh, (int)(-32768), 10000000);
  F15_println ();
  F76_flushlist (defref);
  selector = oldsetting;
}

void F204_outwhat (p)
/*************/
register int /* was T32_halfword */ p;
{
#ifdef VAX
register int j;
#else
  register T29_smallnumber j;
#endif
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  register T37_memoryword *memptr;
#endif

  memptr = &mem[p - C2_memmin];
  switch (memptr->_TAG._TAG3.hh._TAG._TAG2.b1)
  {
    case 0: 
    case 1: 
    case 2: 
      if (!doingleaders)
      {
	j = (memptr+1)->_TAG._TAG3.hh._TAG._TAG1.lh;
	if (memptr->_TAG._TAG3.hh._TAG._TAG2.b1 == 1)
	  F203_writeout (p);
	else
	{
	  if (writeopen[j])
	    CLOSE_2(writefile[j]);
	  if (memptr->_TAG._TAG3.hh._TAG._TAG2.b1 == 2)
	    writeopen[j] = FALSE;
	  else
	    if (j < 16)
	    {
	      curname = (memptr+1)->_TAG._TAG3.hh.rh;
	      curarea = (memptr+2)->_TAG._TAG3.hh._TAG._TAG1.lh;
	      curext = (memptr+2)->_TAG._TAG3.hh.rh;
	      if (curext == 207)
		curext = 644;
	      F183_packfilename (curname, curarea, curext);
	      while (!F44_aopenout (&writefile[j]))
		F191_promptfilename (1142, 644);
	      writeopen[j] = TRUE;
	    }
	}
      }
      break;
    case 3: 
      F202_specialout (p);
      break;
    default: 
      F42_confusion (1141);
      break;
  }
}

void F205_hlistout ()
/*************/
{
#ifdef M_XENIX
  T37_memoryword huge *memptr, huge *memptr1;
#else
  register T37_memoryword *memptr,*memptr1;
#endif
  register int /* was T32_halfword */ p;
  register long int   leaderwd;
  register long int   baseline;
  register long int   edge;
  register T39_glueord gorder;
  register long int   gsign;
  register int /* was T32_halfword */ leaderbox;
  register long int   leftedge;
  register long int   lx;
  register BOOLEAN outerdoingleaders;
  register long int   saveh;
  register long int   saveloc;
  register long int   savev;
  register int /* was T32_halfword */ thisbox;
  register T37_memoryword memhelp;

  thisbox = tempptr;
  memhelp = mem[thisbox + 5 - C2_memmin];
  gorder = memhelp._TAG._TAG3.hh._TAG._TAG2.b1;
  gsign = memhelp._TAG._TAG3.hh._TAG._TAG2.b0;
  p = memhelp._TAG._TAG3.hh.rh;
  if (++curs > 0L)
  {
    dvibuf[dviptr++] = 141;
    if (dviptr == dvilimit)
      F195_dviswap ();
  }
  if (curs > maxpush)
    maxpush = curs;
  saveloc = dvioffset + dviptr;
  baseline = curv;
  leftedge = curh;
  while (p != -32768)
_21: 
    if (p >= himemmin)
    {
      if (curh != dvih)
      {
	F199_movement (curh - dvih, (T22_eightbits)143);
	dvih = curh;
      }
      if (curv != dviv)
      {
	F199_movement (curv - dviv, (T22_eightbits)157);
	dviv = curv;
      }
      do
      {
	memhelp = mem[p - C2_memmin];
	f = memhelp._TAG._TAG3.hh._TAG._TAG2.b0;
	c = memhelp._TAG._TAG3.hh._TAG._TAG2.b1;
	if (f != dvif)
	{
	  if (!fontused[f])
	  {
	    F198_dvifontdef (f);
	    fontused[f] = TRUE;
	  }
	  if (f <= 64)
	  {
	    dvibuf[dviptr++] = f + 170;
	    if (dviptr == dvilimit)
	      F195_dviswap ();
	  }
	  else
	  {
	    dvibuf[dviptr++] = 235;
	    if (dviptr == dvilimit)
	      F195_dviswap ();
	    dvibuf[dviptr++] = f - 1;
	    if (dviptr == dvilimit)
	      F195_dviswap ();
	  }
	  dvif = f;
	}
	if (c < 0)
	{
	  dvibuf[dviptr++] = c + 128;
	  if (dviptr == dvilimit)
	    F195_dviswap ();
	}
	else
	{
	  dvibuf[dviptr++] = 128;
	  if (dviptr == dvilimit)
	    F195_dviswap ();
	  dvibuf[dviptr++] = c + 128;
	  if (dviptr == dvilimit)
	    F195_dviswap ();
	}
	curh += fontinfo[widthbase[f] + fontinfo[charbase[f] + c]._TAG._TAG4.qqqq.b0]._TAG._TAG1._int;
	p = mem[p - C2_memmin]._TAG._TAG3.hh.rh;
      }
      while (p >= himemmin);
      dvih = curh;
    }
    else
    {
      memptr = &mem[p - C2_memmin];
      switch (memptr->_TAG._TAG3.hh._TAG._TAG2.b0)
      {
	case 0: 
	case 1: 
	  if ((memptr+5)->_TAG._TAG3.hh.rh == -32768)
	    curh += (memptr+1)->_TAG._TAG1._int;
	  else
	  {
	    saveh = dvih;
	    savev = dviv;
	    curv = baseline + (memptr+4)->_TAG._TAG1._int;
	    tempptr = p;
	    edge = curh;
	    if (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 == 1)
	      F201_vlistout ();
	    else
	      F205_hlistout ();
	    dvih = saveh;
	    dviv = savev;
	    curh = edge + (memptr+1)->_TAG._TAG1._int;
	    curv = baseline;
	  }
	  break;
	case 2: 
	  ruleht = (memptr+3)->_TAG._TAG1._int;
	  ruledp = (memptr+2)->_TAG._TAG1._int;
	  rulewd = (memptr+1)->_TAG._TAG1._int;
	  goto _14;
	  break;
	case 8: 
	  F204_outwhat (p);
	  break;
	case 10: 
	  g = (memptr+1)->_TAG._TAG3.hh._TAG._TAG1.lh;
	  memptr1 = &mem[g - C2_memmin];
	  rulewd = (memptr1+1)->_TAG._TAG1._int;
	  if (gsign != 0)
	  {
	    if (gsign == 1)
	    {
	      if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 == gorder)
		rulewd += ROUND(mem[thisbox + 6 - C2_memmin]._TAG._TAG2.gr * (float)((memptr1+2)->_TAG._TAG1._int));
	    }
	    else
	    {
	      if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b1 == gorder)
		rulewd -= ROUND(mem[thisbox + 6 - C2_memmin]._TAG._TAG2.gr * (float)((memptr1+3)->_TAG._TAG1._int));
	    }
	  }
	  if (memptr->_TAG._TAG3.hh._TAG._TAG2.b1 >= 100)
	  {
	    leaderbox = (memptr+1)->_TAG._TAG3.hh.rh;
	    memptr1 = &mem[leaderbox - C2_memmin];
	    if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 == 2)
	    {
	      ruleht = (memptr1+3)->_TAG._TAG1._int;
	      ruledp = (memptr1+2)->_TAG._TAG1._int;
	      goto _14;
	    }
	    leaderwd = (memptr1+1)->_TAG._TAG1._int;
	    if ((leaderwd > 0) && (rulewd > 0))
	    {
	      edge = curh + rulewd;
	      lx = 0;
	      if (memptr->_TAG._TAG3.hh._TAG._TAG2.b1 == 100)
	      {
		saveh = curh;
		curh = leftedge + (leaderwd * ((curh - leftedge) / leaderwd));
		if (curh < saveh)
		  curh += leaderwd;
	      }
	      else
	      {
		lq = rulewd / leaderwd;
		lr = rulewd % leaderwd;
		if (memptr->_TAG._TAG3.hh._TAG._TAG2.b1 == 101)
		{
#ifdef NOSHIFT
		  curh += (lr / 2);
#else
		  curh += (lr >> 1);
#endif
		}
		else
		{
		  lx = (lr + lr + lq + 1) / (lq + lq + 2);
#ifdef NOSHIFT
		  curh += (lr - ((lq - 1) * lx)) / 2;
#else
		  curh += (lr - ((lq - 1) * lx)) >> 1;
#endif
		}
	      }
	      while ((curh + leaderwd) <= edge)
	      {
		curv = baseline + (memptr1+4)->_TAG._TAG1._int;
		if (curv != dviv)
		{
		  F199_movement (curv - dviv, (T22_eightbits)157);
		  dviv = curv;
		}
		savev = dviv;
		if (curh != dvih)
		{
		  F199_movement (curh - dvih, (T22_eightbits)143);
		  dvih = curh;
		}
		saveh = dvih;
		tempptr = leaderbox;
		outerdoingleaders = doingleaders;
		doingleaders = TRUE;
		if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 == 1)
		  F201_vlistout ();
		else
		  F205_hlistout ();
		doingleaders = outerdoingleaders;
		dviv = savev;
		dvih = saveh;
		curv = savev;
		curh = (saveh + leaderwd) + lx;
	      }
	      curh = edge;
	      goto _15;
	    }
	  }
	  goto _13;
	  break;
	case 11: 
	case 9: 
	  curh += (memptr+1)->_TAG._TAG1._int;
	  break;
	case 6: 
	  *m29988 = *(memptr+1);
	  m29988->_TAG._TAG3.hh.rh = memptr->_TAG._TAG3.hh.rh;
#ifdef TRIPTEX
	  p = 2988;
#else
	  p = 29988;
#endif
	  goto _21;
	  break;
	default: 
	  break;
      }
      goto _15;
  _14: 
      if (ruleht == (-1073741824))
	ruleht = mem[thisbox + 3 - C2_memmin]._TAG._TAG1._int;
      if (ruledp == (-1073741824))
	ruledp = mem[thisbox + 2 - C2_memmin]._TAG._TAG1._int;
      ruleht += ruledp;
      if ((ruleht > 0) && (rulewd > 0))
      {
	if (curh != dvih)
	{
	  F199_movement (curh - dvih, (T22_eightbits)143);
	  dvih = curh;
	}
	curv = baseline + ruledp;
	if (curv != dviv)
	{
	  F199_movement (curv - dviv, (T22_eightbits)157);
	  dviv = curv;
	}
	dvibuf[dviptr++] = 132;
	if (dviptr == dvilimit)
	  F195_dviswap ();
	F196_dvifour (ruleht);
	F196_dvifour (rulewd);
	curv = baseline;
	dvih += rulewd;
      }
  _13: 
      curh += rulewd;
  _15: 
      p = memptr->_TAG._TAG3.hh.rh;
    }
  F200_prunemovements (saveloc);
  if (curs > 0)
    F197_dvipop (saveloc);
  curs--;
}

void F201_vlistout ()
/*************/
{
#ifdef M_XENIX
  T37_memoryword huge *memptr, huge *memptr1;
#else
  register T37_memoryword *memptr,*memptr1;
#endif
  register long int   edge;
  register T39_glueord gorder;
  register long int   gsign;
  register int /* was T32_halfword */ leaderbox;
  register long int   leaderht;
  register long int   leftedge;
  register long int   lx;
  register BOOLEAN outerdoingleaders;
  register int /* was T32_halfword */ p;
  register long int   saveh;
  register long int   saveloc;
  register long int   savev;
  register int /* was T32_halfword */ thisbox;
  register long int   topedge;
  register T37_memoryword memhelp;

  thisbox = tempptr;
  memptr = &mem[thisbox + 5 - C2_memmin];
  gorder = memptr->_TAG._TAG3.hh._TAG._TAG2.b1;
  gsign = memptr->_TAG._TAG3.hh._TAG._TAG2.b0;
  p = memptr->_TAG._TAG3.hh.rh;
  if (++curs > 0L)
  {
    dvibuf[dviptr++] = 141;
    if (dviptr == dvilimit)
      F195_dviswap ();
  }
  if (curs > maxpush)
    maxpush = curs;
  saveloc = dvioffset + dviptr;
  leftedge = curh;
  curv -= (memptr-2)->_TAG._TAG1._int;
  topedge = curv;
  while (p != ((int)(-32768)))
  {
    memptr = &mem[p - C2_memmin];
    if (p >= himemmin)
      F42_confusion (681);
    else
    {
      switch (memptr->_TAG._TAG3.hh._TAG._TAG2.b0)
      {
	case 0: 
	case 1: 
	  if ((memptr+5)->_TAG._TAG3.hh.rh == ((int)(-32768)))
	    curv += (memptr+3)->_TAG._TAG1._int + (memptr+2)->_TAG._TAG1._int;
	  else
	  {
	    curv += (memptr+3)->_TAG._TAG1._int;
	    if (curv != dviv)
	    {
	      F199_movement (curv - dviv, (T22_eightbits)157);
	      dviv = curv;
	    }
	    saveh = dvih;
	    savev = dviv;
	    curh = leftedge + (memptr+4)->_TAG._TAG1._int;
	    tempptr = p;
	    if (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 == 1)
	      F201_vlistout ();
	    else
	      F205_hlistout ();
	    dvih = saveh;
	    dviv = savev;
	    curv = savev + (memptr+2)->_TAG._TAG1._int;
	    curh = leftedge;
	  }
	  break;
	case 2: 
	  ruleht = (memptr+3)->_TAG._TAG1._int;
	  ruledp = (memptr+2)->_TAG._TAG1._int;
	  rulewd = (memptr+1)->_TAG._TAG1._int;
	  goto _14;
	  break;
	case 8: 
	  F204_outwhat (p);
	  break;
	case 10: 
	  g = (memptr+1)->_TAG._TAG3.hh._TAG._TAG1.lh;
	  memptr1 = &mem[g - C2_memmin];
	  ruleht = (memptr1+1)->_TAG._TAG1._int;
	  if (gsign != 0)
	  {
	    if (gsign == 1)
	    {
	      if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 == gorder)
		ruleht += ROUND(mem[thisbox + 6 - C2_memmin]._TAG._TAG2.gr * (float)((memptr1+2)->_TAG._TAG1._int));
	    }
	    else
	    {
	      if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b1 == gorder)
		ruleht -= ROUND(mem[thisbox + 6 - C2_memmin]._TAG._TAG2.gr * (float)((memptr1+3)->_TAG._TAG1._int));
	    }
	  }
	  if (memptr->_TAG._TAG3.hh._TAG._TAG2.b1 >= 100)
	  {
	    leaderbox = (memptr+1)->_TAG._TAG3.hh.rh;
	    memptr1 = &mem[leaderbox - C2_memmin];
	    if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 == 2)
	    {
	      rulewd = (memptr1+1)->_TAG._TAG1._int;
	      ruledp = 0;
	      goto _14;
	    }
	    leaderht = (memptr1+3)->_TAG._TAG1._int + (memptr1+2)->_TAG._TAG1._int;
	    if ((leaderht > 0) && (ruleht > 0))
	    {
	      edge = curv + ruleht;
	      lx = 0;
	      if (memptr->_TAG._TAG3.hh._TAG._TAG2.b1 == 100)
	      {
		savev = curv;
		curv = topedge + (leaderht * ((curv - topedge) / leaderht));
		if (curv < savev)
		  curv += leaderht;
	      }
	      else
	      {
		lq = ruleht / leaderht;
		lr = ruleht % leaderht;
		if (memptr->_TAG._TAG3.hh._TAG._TAG2.b1 == 101)
#ifdef NOSHIFT
		  curv += (lr / 2);
#else
		  curv += (lr >> 1);
#endif
		else
		{
		  lx = ((lr + lr + lq) + 1) / (lq + lq + 2);
#ifdef NOSHIFT
		  curv += ((lr - ((lq - 1) * lx)) / 2);
#else
		  curv += ((lr - ((lq - 1) * lx)) >> 1);
#endif
		}
	      }
	      while ((curv + leaderht) <= edge)
	      {
		curh = leftedge + (memptr1+4)->_TAG._TAG1._int;
		if (curh != dvih)
		{
		  F199_movement (curh - dvih, (T22_eightbits)143);
		  dvih = curh;
		}
		saveh = dvih;
		curv += (memptr1+3)->_TAG._TAG1._int;
		if (curv != dviv)
		{
		  F199_movement (curv - dviv, (T22_eightbits)157);
		  dviv = curv;
		}
		savev = dviv;
		tempptr = leaderbox;
		outerdoingleaders = doingleaders;
		doingleaders = TRUE;
		if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 == 1)
		  F201_vlistout ();
		else
		  F205_hlistout ();
		doingleaders = outerdoingleaders;
		dviv = savev;
		dvih = saveh;
		curh = saveh;
		curv = ((savev - (memptr1+3)->_TAG._TAG1._int) + leaderht) + lx;
	      }
	      curv = edge;
	      goto _15;
	    }
	  }
	  goto _13;
	  break;
	case 11: 
	  curv += (memptr+1)->_TAG._TAG1._int;
	  break;
	default: 
	  break;
      }
      goto _15;
  _14: 
      if (rulewd == (-1073741824))
	rulewd = mem[thisbox + 1 - C2_memmin]._TAG._TAG1._int;
      ruleht += ruledp;
      curv += ruleht;
      if ((ruleht > 0) && (rulewd > 0))
      {
	if (curh != dvih)
	{
	  F199_movement (curh - dvih, (T22_eightbits)143);
	  dvih = curh;
	}
	if (curv != dviv)
	{
	  F199_movement (curv - dviv, (T22_eightbits)157);
	  dviv = curv;
	}
	dvibuf[dviptr++] = 137;
	if (dviptr == dvilimit)
	  F195_dviswap ();
	F196_dvifour (ruleht);
	F196_dvifour (rulewd);
      }
      goto _15;
  _13: 
      curv += ruleht;
    }
_15: 
    p = memptr->_TAG._TAG3.hh.rh;
  }
  F200_prunemovements (saveloc);
  if (curs > 0)
    F197_dvipop (saveloc);
  curs--;
}

void F206_shipout (p)
/*************/
register int /* was T32_halfword */ p;
{
  register long int help1,help2;
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  register T37_memoryword *memptr;
#endif
  register int   j;
  register int   k;
  register int   oldsetting;
  register long int   pageloc;
#ifdef VAX
register int s;
#else
  register T25_poolpointer s;
#endif

  if (eqtb[5301]._TAG._TAG1._int > 0L)
  {
    F19_printnl (207);
    F15_println ();
    F17_print (682);
  }
  if (termoffset > (C6_maxprintline - 9))
    F15_println ();
  else
    if ((termoffset > 0) || (fileoffset > 0))
      F16_printchar ((char)32);
  F16_printchar ((char)91);
  j = 9;
  while ((eqtb[5317 + j]._TAG._TAG1._int == 0) && (j > 0))
    j--;
  for (k = 0; k <= j; k++)
  {
    F22_printint (eqtb[5317 + k]._TAG._TAG1._int);
    if (k < j)
      F16_printchar ((char)46);
  }
  fflush(stdout);
  if (eqtb[5301]._TAG._TAG1._int > 0L)
  {
    F16_printchar ((char)93);
    F118_begindiagnostic ();
    F106_showbox (p);
    F119_enddiagnostic (TRUE);
  }
  help1 = mem[p + 3 - C2_memmin]._TAG._TAG1._int + mem[p + 2 - C2_memmin]._TAG._TAG1._int + eqtb[5720]._TAG._TAG1._int;
  help2 = mem[p + 1 - C2_memmin]._TAG._TAG1._int + eqtb[5719]._TAG._TAG1._int;
  if ((mem[p + 3 - C2_memmin]._TAG._TAG1._int > 1073741823) || (mem[p + 2 - C2_memmin]._TAG._TAG1._int > 1073741823)
     || (help1 > 1073741823)
     || (help2 > 1073741823))
  {
    F19_printnl (134);
    F17_print (686);
    helpptr = 2;
    helpline[1] = 687;
    helpline[0] = 688;
    F39_error ();
    if (eqtb[5301]._TAG._TAG1._int <= 0L)
    {
      F118_begindiagnostic ();
      F19_printnl (689);
      F106_showbox (p);
      F119_enddiagnostic (TRUE);
    }
    goto _30;
  }
  if (help1 > maxv)
    maxv = help1;
  if (help2 > maxh)
    maxh = help2;
  dvih = 0;
  dviv = 0;
  curh = eqtb[5719]._TAG._TAG1._int;
  dvif = 0;
  curs = -1;
  if (outputfilename == 0)
  {
    if (jobname == 0)
      F33_openlogfile ();
    F190_packjobname (647);
    while (!testaccess(2,0))
      F191_promptfilename (648, 647);
    dvifile=open(realnameoffile,0401);
    outputfilename = F185_makenamestring ();
  }
  if (totalpages == 0)
  {
    dvibuf[dviptr++] = 247;
    if (dviptr == dvilimit)
      F195_dviswap ();
    dvibuf[dviptr++] = 2;
    if (dviptr == dvilimit)
      F195_dviswap ();
    F196_dvifour (25400000);
    F196_dvifour (473628672);
    F136_preparemag ();
    F196_dvifour (eqtb[5284]._TAG._TAG1._int);
    oldsetting = selector;
    selector = 21;
    F17_print (680);
    F22_printint (eqtb[5290]._TAG._TAG1._int);
    F16_printchar ((char)46);
    F58_printtwo (eqtb[5289]._TAG._TAG1._int);
    F16_printchar ((char)46);
    F58_printtwo (eqtb[5288]._TAG._TAG1._int);
    F16_printchar ((char)58);
    F58_printtwo (eqtb[5287]._TAG._TAG1._int / 60);
    F58_printtwo (eqtb[5287]._TAG._TAG1._int % 60);
    selector = oldsetting;
    dvibuf[dviptr++] = poolptr - strstart[strptr];
    if (dviptr == dvilimit)
      F195_dviswap ();
    for (s = strstart[strptr]; s < poolptr; s++)
    {
      dvibuf[dviptr++] = strpool[s];
      if (dviptr == dvilimit)
	F195_dviswap ();
    }
    poolptr = strstart[strptr];
  }
  pageloc = dvioffset + dviptr;
  dvibuf[dviptr++] = 139;
  if (dviptr == dvilimit)
    F195_dviswap ();
  for (k = 0; k <= 9; k++)
    F196_dvifour (eqtb[5317 + k]._TAG._TAG1._int);
  F196_dvifour (lastbop);
  lastbop = pageloc;
  memptr = &mem[p - C2_memmin];
  curv = (memptr+3)->_TAG._TAG1._int + eqtb[5720]._TAG._TAG1._int;
  tempptr = p;
  if (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 == 1)
    F201_vlistout ();
  else
    F205_hlistout ();
  dvibuf[dviptr++] = 140;
  if (dviptr == dvilimit)
    F195_dviswap ();
  totalpages++;
_30: 
  if (eqtb[5301]._TAG._TAG1._int <= 0L)
    F16_printchar ((char)93);
  deadcycles = 0;
  fflush(stdout);
# if defined(INITEX) || defined(TRIPTEX)
  if (eqtb[5298]._TAG._TAG1._int > 1L)
  {
    F19_printnl (683);
    F22_printint ((long)varused);
    F16_printchar ((char)38);
    F22_printint ((long)dynused);
    F16_printchar ((char)59);
  }
# endif
  F109_flushnodelist (p);
# if defined(INITEX) || defined(TRIPTEX)
  if (eqtb[5298]._TAG._TAG1._int > 1L)
  {
    F17_print (684);
    F22_printint ((long)varused);
    F16_printchar ((char)38);
    F22_printint ((long)dynused);
    F17_print (685);
    F22_printint ((long)himemmin - (long)lomemmax - 1L);
    F15_println ();
  }
# endif
}

void F207_scanspec ()
/*************/
{
  if (F160_scankeyword (695))
    savestack[saveptr]._TAG._TAG1._int = 0;
  else
    if (F160_scankeyword (696))
      savestack[saveptr]._TAG._TAG1._int = 1;
    else
    {
      savestack[saveptr]._TAG._TAG1._int = 1;
      savestack[saveptr + 1]._TAG._TAG1._int = 0;
      goto _40;
    }
  F172_scandimen (FALSE, FALSE, FALSE);
  savestack[saveptr + 1]._TAG._TAG1._int = curval;
_40: 
  saveptr += 2;
  F158_scanleftbrace ();
}

int /* was T32_halfword */ F208_hpack (p, w, m)
/****************************/
register int /* was T32_halfword */ p;
register long int   w;
T29_smallnumber m;
{
#ifdef M_XENIX
  T37_memoryword huge *memptr, huge *memptr1;
#else
  register T37_memoryword *memptr,*memptr1;
#endif
  register long int   b;
  register long int   d;
#ifdef VAX
register int f;
#else
  register T43_internalfontnumber f;
#endif
  register int /* was T32_halfword */ g;
  register long int   h;
  register T22_eightbits hd;
  register T36_fourquarters i;
  register T39_glueord o;
  register int /* was T32_halfword */ q;
  register int /* was T32_halfword */ r;
  register long int   s;
  register long int   x;

  r = F77_getnode (7L);
  memptr = &mem[r - C2_memmin];
  memptr->_TAG._TAG3.hh._TAG._TAG2.b0 = 0;
  memptr->_TAG._TAG3.hh._TAG._TAG2.b1 = -128;
  (memptr+4)->_TAG._TAG1._int = 0;
  q = r + 5;
  (memptr+5)->_TAG._TAG3.hh.rh = p;
  h = 0;
  d = 0;
  x = 0;
  totalstretch[0] = totalstretch[1] = totalstretch[2] = totalstretch[3] = 0;
  totalshrink[0] = totalshrink[1] = totalshrink[2] = totalshrink[3] = 0;
  while (p != ((int)(-32768)))
  {
_21: 
    while (p >= himemmin)
    {
      memptr = &mem[p - C2_memmin];
      f = memptr->_TAG._TAG3.hh._TAG._TAG2.b0;
      i=fontinfo[charbase[f] + memptr->_TAG._TAG3.hh._TAG._TAG2.b1]._TAG._TAG4.qqqq;
      hd = i.b1 + 128;
      x += fontinfo[widthbase[f] + i.b0]._TAG._TAG1._int;
      s = fontinfo[heightbase[f] + (hd >> 4)]._TAG._TAG1._int;
      if (s > h)
	h = s;
      s = fontinfo[depthbase[f] + (hd & 15)]._TAG._TAG1._int;
      if (s > d)
	d = s;
      p = memptr->_TAG._TAG3.hh.rh;
    }
    if (p != ((int)(-32768)))
    {
      memptr = &mem[p - C2_memmin];
      switch (memptr->_TAG._TAG3.hh._TAG._TAG2.b0)
      {
	case 0: 
	case 1: 
	  x += (memptr+1)->_TAG._TAG1._int;
	  s = (memptr+4)->_TAG._TAG1._int;
	  if (((memptr+3)->_TAG._TAG1._int - s) > h)
	    h = (memptr+3)->_TAG._TAG1._int - s;
	  if (((memptr+2)->_TAG._TAG1._int + s) > d)
	    d = (memptr+2)->_TAG._TAG1._int + s;
	  break;
	case 2: 
	case 13: 
	  x += (memptr+1)->_TAG._TAG1._int;
	  if (((memptr+3)->_TAG._TAG1._int) > h)
	    h = (memptr+3)->_TAG._TAG1._int;
	  if (((memptr+2)->_TAG._TAG1._int) > d)
	    d = (memptr+2)->_TAG._TAG1._int;
	  break;
	case 3: 
	case 4: 
	  if (adjusttail != ((int)(-32768)))
	  {
	    register int shelp;
	    while ((shelp=mem[q - C2_memmin]._TAG._TAG3.hh.rh) != p)
	      q = shelp;
	    adjusttail = mem[adjusttail - C2_memmin]._TAG._TAG3.hh.rh = p;
	    p = memptr->_TAG._TAG3.hh.rh;
	    mem[q - C2_memmin]._TAG._TAG3.hh.rh = p;
	    p = q;
	  }
	  break;
	case 5: 
	  if (adjusttail != ((int)(-32768)))
	  {
	    register int shelp;
	    while ((shelp=mem[q - C2_memmin]._TAG._TAG3.hh.rh) != p)
	      q = shelp;
#ifdef M_XENIX
	    /* avoid compiler error */
	    shelp = (memptr+1)->_TAG._TAG1._int;
	    mem[adjusttail - C2_memmin]._TAG._TAG3.hh.rh = shelp;
#else
	    mem[adjusttail - C2_memmin]._TAG._TAG3.hh.rh = (memptr+1)->_TAG._TAG1._int;
#endif
	    while ((shelp=mem[adjusttail - C2_memmin]._TAG._TAG3.hh.rh) != ((int)(-32768)))
	      adjusttail = shelp;
	    p = memptr->_TAG._TAG3.hh.rh;
	    memptr = &mem[q - C2_memmin];
	    F78_freenode (memptr->_TAG._TAG3.hh.rh, 2);
	    memptr->_TAG._TAG3.hh.rh = p;
	    p = q;
	  }
	  break;
	case 8: 
	  break;
	case 10: 
	  g = (memptr+1)->_TAG._TAG3.hh._TAG._TAG1.lh;
	  memptr1 = &mem[g - C2_memmin];
	  x += (memptr1+1)->_TAG._TAG1._int;
	  o = memptr1->_TAG._TAG3.hh._TAG._TAG2.b0;
	  totalstretch[o] += (memptr1+2)->_TAG._TAG1._int;
	  o = memptr1->_TAG._TAG3.hh._TAG._TAG2.b1;
	  totalshrink[o] += (memptr1+3)->_TAG._TAG1._int;
	  if (memptr->_TAG._TAG3.hh._TAG._TAG2.b1 >= 100)
	  {
	    g = (memptr+1)->_TAG._TAG3.hh.rh;
	    memptr1 = &mem[g + 3 - C2_memmin];
	    if (memptr1->_TAG._TAG1._int > h)
	      h = memptr1->_TAG._TAG1._int;
	    if ((memptr1-1)->_TAG._TAG1._int > d)
	      d = (memptr1-1)->_TAG._TAG1._int;
	  }
	  break;
	case 11: 
	case 9: 
	  x += (memptr+1)->_TAG._TAG1._int;
	  break;
	case 6: 
	  *m29988= *(memptr+1);
	  m29988->_TAG._TAG3.hh.rh = memptr->_TAG._TAG3.hh.rh;
#ifdef TRIPTEX
	  p = 2988;
#else
	  p = 29988;
#endif
	  goto _21;
	  break;
	default: 
	  break;
      }
      p = mem[p - C2_memmin]._TAG._TAG3.hh.rh;
    }
  }
  if (adjusttail != ((int)(-32768)))
    mem[adjusttail - C2_memmin]._TAG._TAG3.hh.rh = (int)(-32768);
  memptr = &mem[r + 1 - C2_memmin];
  (memptr+2)->_TAG._TAG1._int = h;
  (memptr+1)->_TAG._TAG1._int = d;
  if (m == 1)
    w += x;
  memptr->_TAG._TAG1._int = w;
  x = w - x;
  if (x == 0L)
  {
    (memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b0 = 0;
    (memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b1 = 0;
#ifdef M_XENIX
    (memptr+5)->_TAG._TAG1._int = 0;
#else
    (memptr+5)->_TAG._TAG2.gr = (float)0.0;
#endif
    return(r);
  }
  else
    if (x > 0L)
    {
      if (totalstretch[3] != 0)
	o = 3;
      else
	if (totalstretch[2] != 0)
	  o = 2;
	else
	  if (totalstretch[1] != 0)
	    o = 1;
	  else
	    o = 0;
      (memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b1 = o;
      if (totalstretch[o] != 0)
      {
	(memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b0 = 1;
	(memptr+5)->_TAG._TAG2.gr = (float)x / (float)totalstretch[o];
      }
      else
      {
	(memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b0 = 0;
#ifdef M_XENIX
	(memptr+5)->_TAG._TAG1._int = 0;
#else
	(memptr+5)->_TAG._TAG2.gr = (float)0.0;
#endif
      }
      if (((eqtb[5293]._TAG._TAG1._int < 10000L) && (o == 0)) && ((memptr+4)->_TAG._TAG3.hh.rh != ((int)(-32768))))
      {
	b = F71_badness (x, totalstretch[0]);
	if (b > eqtb[5293]._TAG._TAG1._int)
	{
	  F15_println ();
	  if (b > 100)
	    F19_printnl (697);
	  else
	    F19_printnl (698);
	  F17_print (699);
	  F22_printint ((long)b);
	  goto _50;
	}
      }
      return(r);
    }
    else
    {
      if (totalshrink[3] != 0)
	o = 3;
      else
	if (totalshrink[2] != 0)
	  o = 2;
	else
	  if (totalshrink[1] != 0)
	    o = 1;
	  else
	    o = 0;
      (memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b1 = o;
      if (totalshrink[o] != 0)
      {
	(memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b0 = 2;
	(memptr+5)->_TAG._TAG2.gr = (float)(-x) / (float)totalshrink[o];
      }
      else
      {
	(memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b0 = 0;
#ifdef M_XENIX
	(memptr+5)->_TAG._TAG1._int = 0;
#else
	(memptr+5)->_TAG._TAG2.gr = (float)0.0;
#endif
      }
      if (((totalshrink[o] < (-x)) && (o == 0)) && ((memptr+4)->_TAG._TAG3.hh.rh != ((int)(-32768))))
      {
#ifdef M_XENIX
	(memptr+5)->_TAG._TAG1._int = 1065353216; /* system dependent */
#else
	(memptr+5)->_TAG._TAG2.gr = (float)1.0;
#endif
	if ((((-x) - totalshrink[0]) > eqtb[5709]._TAG._TAG1._int) || (eqtb[5293]._TAG._TAG1._int < 100L))
	{
	  if ((eqtb[5717]._TAG._TAG1._int > 0L) && (((-x) - totalshrink[0]) > eqtb[5709]._TAG._TAG1._int))
	  {
	    register int shelp;
	    while ((shelp=mem[q - C2_memmin]._TAG._TAG3.hh.rh) != ((int)(-32768)))
	      q = shelp;
	    shelp = mem[q - C2_memmin]._TAG._TAG3.hh.rh = F81_newrule ();
	    mem[shelp + 1 - C2_memmin]._TAG._TAG1._int = eqtb[5717]._TAG._TAG1._int;
	  }
	  F15_println ();
	  F19_printnl (705);
	  F67_printscaled ((long)(-x) - totalshrink[0]);
	  F17_print (706);
	  goto _50;
	}
      }
      else
	if (((eqtb[5293]._TAG._TAG1._int < 100) && (o == 0)) && ((memptr+4)->_TAG._TAG3.hh.rh != ((int)(-32768))))
	{
	  b = F71_badness (-x, totalshrink[0]);
	  if (b > eqtb[5293]._TAG._TAG1._int)
	  {
	    F15_println ();
	    F19_printnl (707);
	    F22_printint ((long)b);
	    goto _50;
	  }
	}
      return(r);
    }
_50: 
  if (outputactive)
    F17_print (700);
  else
  {
    if (packbeginline != 0)
    {
      if (packbeginline > 0)
      {
	F17_print (701);
	F22_printint(packbeginline);
      }
      else
      {
	F17_print (702);
	F22_printint(-packbeginline);
      }
      F17_print (703);
    }
    else
      F17_print (704);
    F22_printint ((long)line);
  }
  F15_println ();
  fontinshortdisplay = 0;
  F93_shortdisplay ((memptr+4)->_TAG._TAG3.hh.rh);
  F15_println ();
  F118_begindiagnostic ();
  F106_showbox (r);
  F119_enddiagnostic (TRUE);
  return (r);
}

int /* was T32_halfword */ F209_vpackage (p, h, m, l)
/*********************************/
register int /* was T32_halfword */ p;
register long int   h;
T29_smallnumber m;
register long int   l;
{
#ifdef M_XENIX
  T37_memoryword huge *memptr, huge *memptr1;
#else
  register T37_memoryword *memptr,*memptr1;
#endif
  register long int   b;
  register long int   d;
  register int /* was T32_halfword */ g;
  register T39_glueord o;
  register int /* was T32_halfword */ r;
  register long int   s;
  register long int   w;
  register long int   x;

  r = F77_getnode (7L);
  memptr = &mem[r - C2_memmin];
  memptr->_TAG._TAG3.hh._TAG._TAG2.b0 = 1;
  memptr->_TAG._TAG3.hh._TAG._TAG2.b1 = -128;
  (memptr+4)->_TAG._TAG1._int = 0;
  (memptr+5)->_TAG._TAG3.hh.rh = p;
  w = 0;
  d = 0;
  x = 0;
  totalstretch[0] = totalstretch[1] = totalstretch[2] = totalstretch[3] = 0;
  totalshrink[0] = totalshrink[1] = totalshrink[2] = totalshrink[3] = 0;
  while (p != ((int)(-32768)))
  {
    memptr = &mem[p - C2_memmin];
    if (p >= himemmin)
      F42_confusion (708);
    else
      switch (memptr->_TAG._TAG3.hh._TAG._TAG2.b0)
      {
	case 0: 
	case 1: 
	  x += d + (memptr+3)->_TAG._TAG1._int;
	  d = (memptr+2)->_TAG._TAG1._int;
	  s = (memptr+4)->_TAG._TAG1._int;
	  if (((memptr+1)->_TAG._TAG1._int + s) > w)
	    w = (memptr+1)->_TAG._TAG1._int + s;
	  break;
	case 2: 
	case 13: 
	  x += d + (memptr+3)->_TAG._TAG1._int;
	  d = (memptr+2)->_TAG._TAG1._int;
	  if (((memptr+1)->_TAG._TAG1._int) > w)
	    w = (memptr+1)->_TAG._TAG1._int;
	  break;
	case 8: 
	  break;
	case 10: 
	  x += d;
	  d = 0;
	  g = (memptr+1)->_TAG._TAG3.hh._TAG._TAG1.lh;
	  memptr1 = &mem[g - C2_memmin];
	  x += (memptr1+1)->_TAG._TAG1._int;
	  o = memptr1->_TAG._TAG3.hh._TAG._TAG2.b0;
	  totalstretch[o] += (memptr1+2)->_TAG._TAG1._int;
	  o = memptr1->_TAG._TAG3.hh._TAG._TAG2.b1;
	  totalshrink[o] += (memptr1+3)->_TAG._TAG1._int;
	  if (memptr->_TAG._TAG3.hh._TAG._TAG2.b1 >= 100)
	  {
	    g = (memptr+1)->_TAG._TAG3.hh.rh;
	    if (mem[g + 1 - C2_memmin]._TAG._TAG1._int > w)
	      w = mem[g + 1 - C2_memmin]._TAG._TAG1._int;
	  }
	  break;
	case 11: 
	  x += d + (memptr+1)->_TAG._TAG1._int;
	  d = 0;
	  break;
	default: 
	  break;
      }
    p = memptr->_TAG._TAG3.hh.rh;
  }
  memptr = &mem[r + 1 - C2_memmin];
  memptr->_TAG._TAG1._int = w;
  if (d > l)
  {
    x += d - l;
    (memptr+1)->_TAG._TAG1._int = l;
  }
  else
    (memptr+1)->_TAG._TAG1._int = d;
  if (m == 1)
    h += x;
  (memptr+2)->_TAG._TAG1._int = h;
  x = h - x;
  if (x == 0L)
  {
    (memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b0 = 0;
    (memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b1 = 0;
#ifdef M_XENIX
    (memptr+5)->_TAG._TAG1._int = 0;
#else
    (memptr+5)->_TAG._TAG2.gr = (float)0.0;
#endif
    return(r);
  }
  else
    if (x > 0L)
    {
      if (totalstretch[3] != 0)
	o = 3;
      else
	if (totalstretch[2] != 0)
	  o = 2;
	else
	  if (totalstretch[1] != 0)
	    o = 1;
	  else
	    o = 0;
      (memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b1 = o;
      if (totalstretch[o] != 0)
      {
	(memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b0 = 1;
	(memptr+5)->_TAG._TAG2.gr = ((float)x / (float) totalstretch[o]);
      }
      else
      {
	(memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b0 = 0;
#ifdef M_XENIX
	(memptr+5)->_TAG._TAG1._int = 0;
#else
	(memptr+5)->_TAG._TAG2.gr = (float)0.0;
#endif
      }
      if (((eqtb[5294]._TAG._TAG1._int < 10000L) && (o == 0)) && ((memptr+4)->_TAG._TAG3.hh.rh != ((int)(-32768))))
      {
	b = F71_badness (x, totalstretch[0]);
	if (b > eqtb[5294]._TAG._TAG1._int)
	{
	  F15_println ();
	  if (b > 100)
	    F19_printnl (697);
	  else
	    F19_printnl (698);
	  F17_print (709);
	  F22_printint ((long)b);
	  goto _50;
	}
      }
      return(r);
    }
    else
    {
      if (totalshrink[3] != 0)
	o = 3;
      else
	if (totalshrink[2] != 0)
	  o = 2;
	else
	  if (totalshrink[1] != 0)
	    o = 1;
	  else
	    o = 0;
      (memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b1 = o;
      if (totalshrink[o] != 0)
      {
	(memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b0 = 2;
	(memptr+5)->_TAG._TAG2.gr = ((float)(-x) / (float) totalshrink[o]);
      }
      else
      {
	(memptr+4)->_TAG._TAG3.hh._TAG._TAG2.b0 = 0;
#ifdef M_XENIX
	(memptr+5)->_TAG._TAG1._int = 0;
#else
	(memptr+5)->_TAG._TAG2.gr = (float)0.0;
#endif
      }
      if (((totalshrink[o] < (-x)) && (o == 0)) && ((memptr+4)->_TAG._TAG3.hh.rh != ((int)(-32768))))
      {
#ifdef M_XENIX
	(memptr+5)->_TAG._TAG1._int = 1065353216;
#else
	(memptr+5)->_TAG._TAG2.gr = (float)1.0;
#endif
	if ((((-x) - totalshrink[0]) > eqtb[5710]._TAG._TAG1._int) || (eqtb[5294]._TAG._TAG1._int < 100))
	{
	  F15_println ();
	  F19_printnl (710);
	  F67_printscaled ((long)(-x) - totalshrink[0]);
	  F17_print (711);
	  goto _50;
	}
      }
      else
	if (((eqtb[5294]._TAG._TAG1._int < 100) && (o == 0)) && ((memptr+4)->_TAG._TAG3.hh.rh != ((int)(-32768))))
	{
	  b = F71_badness (-x, totalshrink[0]);
	  if (b > eqtb[5294]._TAG._TAG1._int)
	  {
	    F15_println ();
	    F19_printnl (712);
	    F22_printint ((long)b);
	    goto _50;
	  }
	}
      return(r);
    }
_50: 
  if (outputactive)
    F17_print (700);
  else
  {
    if (packbeginline != 0)
    {
      F17_print (702);
      F22_printint ((packbeginline>0)?packbeginline:(-packbeginline));
      F17_print (703);
    }
    else
      F17_print (704);
    F22_printint ((long)line);
    F15_println ();
  }
  F118_begindiagnostic ();
  F106_showbox (r);
  F119_enddiagnostic (TRUE);
  return(r);
}

void F210_appendtovlist (b)
/*******************/
register int /* was T32_halfword */ b;
{
  register long int   d;
  register int /* was T32_halfword */ p;

  if (curlist.auxfield > (-65536000))
  {
    d = (mem[eqtb[3527]._TAG._TAG3.hh.rh + 1 - C2_memmin]._TAG._TAG1._int - curlist.auxfield) - mem[b + 3 - C2_memmin]._TAG._TAG1._int;
    if (d < eqtb[5703]._TAG._TAG1._int)
      p = F86_newparamglue (0);
    else
    {
      p = F88_newskipparam (1);
      mem[tempptr + 1 - C2_memmin]._TAG._TAG1._int = d;
    }
    curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = p;
  }
  curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = b;
  curlist.auxfield = mem[b + 2 - C2_memmin]._TAG._TAG1._int;
}
