#include "externs.h"

void F250_buildpage ()
/**************/
{
#ifdef M_XENIX
  T37_memoryword huge *memptr, huge *memptr1, huge *memptr3;
#else
  register T37_memoryword *memptr,*memptr1,*memptr3;
#endif
  register long int   b;
  register long int   c;
  register long int   delta;
  register long int   h;
  register long int   n;
  register int /* was T32_halfword */ p;
  register long int   pi;
  register int /* was T32_halfword */ q;
  register int /* was T32_halfword */ r;
  register long int   w;

  if ((m29999->_TAG._TAG3.hh.rh == ((int)(-32768))) || outputactive)
    return;
  do
  {
_22: 
    p = m29999->_TAG._TAG3.hh.rh;
    if (lastglue != 32767)
      F108_deleteglueref (lastglue);
    lastpenalty = 0;
    lastkern = 0;
    memptr = &mem[p - C2_memmin];
    if (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 == 10)
    {
      lastglue = (memptr+1)->_TAG._TAG3.hh._TAG._TAG1.lh;
      mem[lastglue - C2_memmin]._TAG._TAG3.hh.rh++;
    }
    else
    {
      lastglue = 32767;
      if (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 == 12)
      {
	lastpenalty = (memptr+1)->_TAG._TAG1._int;
      }
      else
	if (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 == 11)
	  lastkern = (memptr+1)->_TAG._TAG1._int;
    }
    switch (memptr->_TAG._TAG3.hh._TAG._TAG2.b0)
    {
      case 0: 
      case 1: 
      case 2: 
	if (pagecontents < 2)
	{
	  if (pagecontents == 0)
	    F271_freezepagespecs (2);
	  else
	    pagecontents = 2;
	  q = F88_newskipparam (9);
	  memptr1 = &mem[q - C2_memmin];
	  memptr3 = &mem[tempptr + 1 - C2_memmin];
	  memptr1->_TAG._TAG3.hh.rh = p;
	  if (memptr3->_TAG._TAG1._int > (memptr+3)->_TAG._TAG1._int)
	    memptr3->_TAG._TAG1._int -= (memptr+3)->_TAG._TAG1._int;
	  else
	    memptr3->_TAG._TAG1._int = 0;
	  memptr1->_TAG._TAG3.hh.rh = p;
	  m29999->_TAG._TAG3.hh.rh = q;
	  goto _22;
	}
	else
	{
	  pagesofar[1] += pagesofar[7] + (memptr+3)->_TAG._TAG1._int;
	  pagesofar[7] = (memptr+2)->_TAG._TAG1._int;
	  goto _80;
	}
	break;
      case 8: 
	goto _80;
	break;
      case 10: 
	if (pagecontents < 2)
	  goto _31;
	else
	  if (mem[pagetail - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 < 9)
	    pi = 0;
	  else
	    goto _90;
	break;
      case 11: 
	if (pagecontents < 2)
	  goto _31;
	else
	  if (memptr->_TAG._TAG3.hh.rh == ((int)(-32768)))
	    return;
	  else
	    if (mem[memptr->_TAG._TAG3.hh.rh - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 == 10)
	      pi = 0;
	    else
	      goto _90;
	break;
      case 12: 
	if (pagecontents < 2)
	  goto _31;
	else
	  pi = (memptr+1)->_TAG._TAG1._int;
	break;
      case 4: 
	goto _80;
	break;
      case 3: 
	{
	  if (pagecontents == 0)
	    F271_freezepagespecs (1);
	  n = memptr->_TAG._TAG3.hh._TAG._TAG2.b1;
#ifdef TRIPTEX
	  r = 3000;
#else
	  r = 30000;
#endif
	  {
	    register int shelp;
	    while (n >= mem[(shelp=mem[r - C2_memmin]._TAG._TAG3.hh.rh) - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b1)
	      r = shelp;
	  }
	  n += 128;
	  memptr1 = &mem[r - C2_memmin];
	  if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b1 != (n - 128))
	  {
	    q = F77_getnode (4L);
	    memptr3 = &mem[q - C2_memmin];
	    memptr3->_TAG._TAG3.hh.rh = memptr1->_TAG._TAG3.hh.rh;
	    memptr1->_TAG._TAG3.hh.rh = q;
	    r = q;
	    memptr1 = &mem[r - C2_memmin];
	    memptr1->_TAG._TAG3.hh._TAG._TAG2.b1 = n - 128;
	    memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 = 0;
	    F273_ensurevbox ((T22_eightbits)n);
	    if (eqtb[4322 + n]._TAG._TAG3.hh.rh == ((int)(-32768)))
	      (memptr1+3)->_TAG._TAG1._int = 0;
	    else
	    {
	      memptr3 = &mem[eqtb[4322 + n]._TAG._TAG3.hh.rh + 2 - C2_memmin];
	      (memptr1+3)->_TAG._TAG1._int = (memptr3+1)->_TAG._TAG1._int + memptr3->_TAG._TAG1._int;
	    }
	    (memptr1+2)->_TAG._TAG3.hh._TAG._TAG1.lh = (int)(-32768);
	    q = eqtb[3544 + n]._TAG._TAG3.hh.rh;
	    if (eqtb[5317 + n]._TAG._TAG1._int == 1000)
	      h = (memptr1+3)->_TAG._TAG1._int;
	    else
	      h = ((memptr1+3)->_TAG._TAG1._int / 1000) * eqtb[5317 + n]._TAG._TAG1._int;
	    memptr3 = &mem[q - C2_memmin];
	    pagesofar[0] -= h + (memptr3+1)->_TAG._TAG1._int;
	    pagesofar[2 + memptr3->_TAG._TAG3.hh._TAG._TAG2.b0] += (memptr3+2)->_TAG._TAG1._int;
	    pagesofar[6] += (memptr3+3)->_TAG._TAG1._int;
	    if ((memptr3->_TAG._TAG3.hh._TAG._TAG2.b1 != 0) && ((memptr3+3)->_TAG._TAG1._int != 0))
	    {
	      F19_printnl (134);
	      F17_print (846);
	      F20_printesc (261);
	      F22_printint ((long)n);
	      helpptr = 3;
	      helpline[2] = 847;
	      helpline[1] = 848;
	      helpline[0] = 776;
	      F39_error ();
	    }
	  }
	  if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 == 1)
	    insertpenalties += (memptr+1)->_TAG._TAG1._int;
	  else
	  {
	    (memptr1+2)->_TAG._TAG3.hh.rh = p;
	    delta = pagesofar[0] - pagesofar[1] - pagesofar[7] + pagesofar[6];
	    if (eqtb[5317 + n]._TAG._TAG1._int == 1000)
	      h = (memptr+3)->_TAG._TAG1._int;
	    else
	      h = ((memptr+3)->_TAG._TAG1._int / 1000) * eqtb[5317 + n]._TAG._TAG1._int;
	    if (((h <= 0) || (h <= delta)) && (((memptr+3)->_TAG._TAG1._int + (memptr1+3)->_TAG._TAG1._int) <= eqtb[5721 + n]._TAG._TAG1._int))
	    {
	      pagesofar[0] -= h;
	      (memptr1+3)->_TAG._TAG1._int += (memptr+3)->_TAG._TAG1._int;
	    }
	    else
	    {
	      if (eqtb[5317 + n]._TAG._TAG1._int <= 0)
		w = 1073741823;
	      else
	      {
		w = (pagesofar[0] - pagesofar[1]) - pagesofar[7];
		if (eqtb[5317 + n]._TAG._TAG1._int != 1000L)
		  w = (w / eqtb[5317 + n]._TAG._TAG1._int) * 1000;
	      }
	      if (w > (eqtb[5721 + n]._TAG._TAG1._int - (memptr1+3)->_TAG._TAG1._int))
		w = eqtb[5721 + n]._TAG._TAG1._int - (memptr1+3)->_TAG._TAG1._int;
	      q = F269_vertbreak ((memptr+4)->_TAG._TAG3.hh._TAG._TAG1.lh, w, (memptr+2)->_TAG._TAG1._int);
	      (memptr1+3)->_TAG._TAG1._int += bestheightplusdepth;
#if defined(INITEX) || defined(TRIPTEX)
	      if (eqtb[5300]._TAG._TAG1._int > 0L)
	      {
		F118_begindiagnostic ();
		F19_printnl (849);
		F22_printint ((long)n);
		F17_print (850);
		F67_printscaled ((long)w);
		F16_printchar ((char)44);
		F67_printscaled (bestheightplusdepth);
		F17_print (785);
		if (q == ((int)(-32768)))
		  F22_printint (-10000L);
		else
		  if (mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 == 12)
		    F22_printint (mem[q + 1 - C2_memmin]._TAG._TAG1._int);
		  else
		    F16_printchar ((char)48);
		F119_enddiagnostic (FALSE);
	      }
# endif
	      if (eqtb[5317 + n]._TAG._TAG1._int != 1000L)
		bestheightplusdepth = (bestheightplusdepth / 1000) * eqtb[5317 + n]._TAG._TAG1._int;
	      pagesofar[0] -= bestheightplusdepth;
	      memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 = 1;
	      (memptr1+1)->_TAG._TAG3.hh.rh = q;
	      (memptr1+1)->_TAG._TAG3.hh._TAG._TAG1.lh = p;
	      if (q == ((int)(-32768)))
		insertpenalties -= 10000;
	      else
		if (mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 == 12)
		  insertpenalties += mem[q + 1 - C2_memmin]._TAG._TAG1._int;
	    }
	  }
	  goto _80;
	}
	break;
      default: 
	F42_confusion (841);
	break;
    }
    if (pi < 10000)
    {
      if (pagesofar[1] < pagesofar[0])
	if (((pagesofar[3] != 0) || (pagesofar[4] != 0)) || (pagesofar[5] != 0))
	  b = 0;
	else
	{
	  b = F71_badness (pagesofar[0] - pagesofar[1], pagesofar[2]);
	}
      else
	if ((pagesofar[1] - pagesofar[0]) > pagesofar[6])
	  b = 1073741823;
	else
	  b = F71_badness (pagesofar[1] - pagesofar[0], pagesofar[6]);
      if (b < 1073741823)
	if (pi <= (-10000L))
	  c = pi;
	else
	  if (b < 10000L)
	    c = (b + pi) + insertpenalties;
	  else
	    c = 100000;
      else
	c = b;
      if (insertpenalties >= 10000L)
	c = 1073741823;
#if defined(INITEX) || defined(TRIPTEX)
      if (eqtb[5300]._TAG._TAG1._int > 0L)
      {
	F118_begindiagnostic ();
	F19_printnl (37);
	F17_print (781);
	F114_printtotals ();
	F17_print (844);
	F67_printscaled (pagesofar[0]);
	F17_print (784);
	if (b == 1073741823)
	  F16_printchar ((char)42);
	else
	  F22_printint ((long)b);
	F17_print (785);
	F22_printint ((long)pi);
	F17_print (845);
	if (c == 1073741823)
	  F16_printchar ((char)42);
	else
	  F22_printint ((long)c);
	if (c <= leastpagecost)
	  F16_printchar ((char)35);
	F119_enddiagnostic (FALSE);
      }
# endif
      if (c <= leastpagecost)
      {
	bestpagebreak = p;
	bestsize = pagesofar[0];
	leastpagecost = c;
#ifdef TRIPTEX
	r = m30000->_TAG._TAG3.hh.rh;
	while (r != 3000)
#else
	r = m30000->_TAG._TAG3.hh.rh;
	while (r != 30000)
#endif
	{
	  memptr1 = &mem[r - C2_memmin];
	  (memptr1+2)->_TAG._TAG3.hh._TAG._TAG1.lh = (memptr1+2)->_TAG._TAG3.hh.rh;
	  r = memptr1->_TAG._TAG3.hh.rh;
	}
      }
      if ((c == 1073741823) || (pi <= (-10000)))
      {
	F274_fireup (p);
	if (outputactive)
	  return;
	goto _30;
      }
    }
    if ((memptr->_TAG._TAG3.hh._TAG._TAG2.b0 < 10) || (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 > 11))
      goto _80;
_90: 
    if (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 == 11)
      q = p;
    else
    {
      q = (memptr+1)->_TAG._TAG3.hh._TAG._TAG1.lh;
      memptr1 = &mem[q - C2_memmin];
      pagesofar[2 + memptr1->_TAG._TAG3.hh._TAG._TAG2.b0] += (memptr1+2)->_TAG._TAG1._int;
      pagesofar[6] += (memptr1+3)->_TAG._TAG1._int;
      if ((memptr1->_TAG._TAG3.hh._TAG._TAG2.b1 != 0) && ((memptr1+3)->_TAG._TAG1._int != 0))
      {
	F19_printnl (134);
	F17_print (842);
	helpptr = 4;
	helpline[3] = 843;
	helpline[2] = 811;
	helpline[1] = 812;
	helpline[0] = 776;
	F39_error ();
	r = F85_newspec (q);
	mem[r - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b1 = 0;
	F108_deleteglueref (q);
	(memptr+1)->_TAG._TAG3.hh._TAG._TAG1.lh = r;
      }
    }
    pagesofar[1] += pagesofar[7] + mem[q + 1 - C2_memmin]._TAG._TAG1._int;
    pagesofar[7] = 0;
_80: 
    if (pagesofar[7] > pagemaxdepth)
    {
      pagesofar[1] += pagesofar[7] - pagemaxdepth;
      pagesofar[7] = pagemaxdepth;
    }
    mem[pagetail - C2_memmin]._TAG._TAG3.hh.rh = p;
    pagetail = p;
    m29999->_TAG._TAG3.hh.rh = memptr->_TAG._TAG3.hh.rh;
    memptr->_TAG._TAG3.hh.rh = (int)(-32768);
    goto _30;
_31: 
    m29999->_TAG._TAG3.hh.rh = memptr->_TAG._TAG3.hh.rh;
    memptr->_TAG._TAG3.hh.rh = (int)(-32768);
    F109_flushnodelist (p);
_30: 
    ;
  }
#ifdef TRIPTEX
  while (m29999->_TAG._TAG3.hh.rh != ((int)(-32768)));
  if (nestptr == 0)
    curlist.tailfield = 2999;
  else
    nest[0].tailfield = 2999;
#else
  while (m29999->_TAG._TAG3.hh.rh != ((int)(-32768)));
  if (nestptr == 0)
    curlist.tailfield = 29999;
  else
    nest[0].tailfield = 29999;
#endif
}

void F275_appspace ()
/*************/
{
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  register T37_memoryword *memptr;
#endif
#ifdef VAX
register int f;
#else
  register T43_internalfontnumber f;
#endif
  register long int   k;
  register int /* was T32_halfword */ p;
  register int /* was T32_halfword */ q;

#ifdef TRIPTEX
  if ((curlist.auxfield >= 2000) && (eqtb[3539]._TAG._TAG3.hh.rh != 1))
#else
  if ((curlist.auxfield >= 2000) && (eqtb[3539]._TAG._TAG3.hh.rh != (-30000)))
#endif
    q = F86_newparamglue (13);
  else
  {
#ifdef TRIPTEX
    if (eqtb[3538]._TAG._TAG3.hh.rh != 1)
#else
    if (eqtb[3538]._TAG._TAG3.hh.rh != (-30000))
#endif
      p = eqtb[3538]._TAG._TAG3.hh.rh;
    else
    {
      p = fontglue[eqtb[4578]._TAG._TAG3.hh.rh];
      if (p == ((int)(-32768)))
      {
	f = eqtb[4578]._TAG._TAG3.hh.rh;
#ifdef TRIPTEX
	p = F85_newspec(1);
#else
	p = F85_newspec (-30000);
#endif
	k = parambase[f] + 2;
	memptr = &mem[p + 1 - C2_memmin];
	memptr->_TAG._TAG1._int = fontinfo[k]._TAG._TAG1._int;
	(memptr+1)->_TAG._TAG1._int = fontinfo[k + 1]._TAG._TAG1._int;
	(memptr+2)->_TAG._TAG1._int = fontinfo[k + 2]._TAG._TAG1._int;
	fontglue[f] = p;
      }
    }
    p = F85_newspec (p);
    memptr = &mem[p - C2_memmin];
    if (curlist.auxfield >= 2000)
      (memptr+1)->_TAG._TAG1._int += fontinfo[7 + parambase[eqtb[4578]._TAG._TAG3.hh.rh]]._TAG._TAG1._int;
    (memptr+2)->_TAG._TAG1._int = F70_xnoverd ((memptr+2)->_TAG._TAG1._int, (long)curlist.auxfield, 1000L);
    (memptr+3)->_TAG._TAG1._int = F70_xnoverd ((memptr+3)->_TAG._TAG1._int, 1000L, (long)curlist.auxfield);
    q = F87_newglue (p);
    memptr->_TAG._TAG3.hh.rh = (int)(-32768);
  }
  mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = q;
  curlist.tailfield = q;
}

void F276_insertdollarsign ()
/*********************/
{
  F134_backinput ();
  curtok = 804;
  F19_printnl (134);
  F17_print (865);
  helpptr = 2;
  helpline[1] = 866;
  helpline[0] = 867;
  F143_inserror ();
}

void F277_youcant ()
/************/
{
  F19_printnl (134);
  F17_print (541);
  F121_printcmdchr (curcmd, curchr);
  F17_print (868);
  F111_printmode (curlist.modefield);
}

void F278_reportillegalcase ()
/**********************/
{
  F277_youcant ();
  helpptr = 4;
  helpline[3] = 869;
  helpline[2] = 870;
  helpline[1] = 871;
  helpline[0] = 872;
  F39_error ();
}

BOOLEAN F279_privileged ()
/***********************/
{
  if (curlist.modefield > 0)
    return(TRUE);
  else
  {
    F278_reportillegalcase ();
    return(FALSE);
  }
}

BOOLEAN F280_itsallover ()
/***********************/
{
  if (F279_privileged ())
  {
#ifdef TRIPTEX
    if (((2998 == pagetail) && (curlist.headfield == curlist.tailfield)) && (deadcycles == 0))
#else
    if (((29998 == pagetail) && (curlist.headfield == curlist.tailfield)) && (deadcycles == 0))
#endif
      return(TRUE);
    F134_backinput ();
    curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F80_newnullbox ();
    mem[curlist.tailfield + 1 - C2_memmin]._TAG._TAG1._int = eqtb[5704]._TAG._TAG1._int;
#ifdef TRIPTEX
    curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F87_newglue(9);
#else
    curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F87_newglue (-29992);
#endif
    curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F90_newpenalty (-1073741824);
    F250_buildpage ();
  }
  return(FALSE);
}

void F281_appendglue ()
/***************/
{
#ifdef VAX
register int s;
#else
  register T29_smallnumber s;
#endif

  s = curchr;
  switch (s)
  {
    case 0: 
#ifdef TRIPTEX
      curval = 5;
      break;
    case 1: 
      curval = 9;
      break;
    case 2: 
      curval = 13;
      break;
    case 3: 
      curval = 17;
#else
      curval = -29996;
      break;
    case 1: 
      curval = -29992;
      break;
    case 2: 
      curval = -29988;
      break;
    case 3: 
      curval = -29984;
#endif
      break;
    case 4: 
      F173_scanglue (2);
      break;
    case 5: 
      F173_scanglue (3);
      break;
  }
  curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F87_newglue ((int)curval);
  if (s >= 4)
  {
    mem[curval - C2_memmin]._TAG._TAG3.hh.rh--;
    if (s > 4)
      mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b1 = 99;
  }
}

void F282_appendkern ()
/***************/
{
#ifdef VAX
register int s;
#else
  register T31_quarterword s;
#endif

  s = curchr;
  F172_scandimen (s == 99, FALSE, FALSE);
  curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F89_newkern (curval);
  mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b1 = s;
}

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

  if (curgroup == 0)
  {
    F19_printnl (134);
    F17_print (633);
    F121_printcmdchr (curcmd, curchr);
    helpptr = 1;
    helpline[0] = 891;
    F39_error ();
  }
  else
  {
    F134_backinput ();
    p = F75_getavail ();
    m29997->_TAG._TAG3.hh.rh = p;
    F19_printnl (134);
    F17_print (483);
    switch (curgroup)
    {
      case 14: 
	mem[p - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = 7356;
	F20_printesc (376);
	break;
      case 15: 
	mem[p - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = 804;
	F16_printchar ((char)36);
	break;
      case 16: 
	memptr = &mem[p - C2_memmin];
	memptr->_TAG._TAG3.hh._TAG._TAG1.lh = 7357;
	memptr->_TAG._TAG3.hh.rh = F75_getavail ();
	p = memptr->_TAG._TAG3.hh.rh;
	mem[p - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = 3118;
	F20_printesc (890);
	break;
      default: 
	mem[p - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = 637;
	F16_printchar ((char)125);
	break;
    }
    F17_print (484);
    F140_begintokenlist (m29997->_TAG._TAG3.hh.rh, (char)4);
    helpptr = 5;
    helpline[4] = 885;
    helpline[3] = 886;
    helpline[2] = 887;
    helpline[1] = 888;
    helpline[0] = 889;
    F39_error ();
  }
}

void F284_extrarightbrace ()
/********************/
{
  F19_printnl (134);
  F17_print (896);
  switch (curgroup)
  {
    case 14: 
      F20_printesc (376);
      break;
    case 15: 
      F16_printchar ((char)36);
      break;
    case 16: 
      F20_printesc (730);
      break;
  }
  helpptr = 5;
  helpline[4] = 897;
  helpline[3] = 898;
  helpline[2] = 899;
  helpline[1] = 900;
  helpline[0] = 901;
  F39_error ();
  alignstate++;
}

void F241_normalparagraph ()
/********************/
{
  if (eqtb[5286]._TAG._TAG1._int != 0L)
    F129_eqworddefine (5286, 0L);
  if (eqtb[5718]._TAG._TAG1._int != 0L)
    F129_eqworddefine (5718, 0L);
  if (eqtb[5308]._TAG._TAG1._int != 1L)
    F129_eqworddefine (5308, 1L);
  if (eqtb[4056]._TAG._TAG3.hh.rh != ((int)(-32768)))
    F128_eqdefine (4056, (char)117, (int)(-32768));
}

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

  if (savestack[saveptr]._TAG._TAG1._int < 1073741824)
  {
    if (curbox != ((int)(-32768)))
    {
      mem[curbox + 4 - C2_memmin]._TAG._TAG1._int = savestack[saveptr]._TAG._TAG1._int;
      if ((curlist.modefield == 1)||(curlist.modefield == -1))
      {
	F210_appendtovlist (curbox);
	if (adjusttail != ((int)(-32768)))
	{
#ifdef TRIPTEX
	  if (2995 != adjusttail)
	  {
	    mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = m29995->_TAG._TAG3.hh.rh;
#else
	  if (29995 != adjusttail)
	  {
	    mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = m29995->_TAG._TAG3.hh.rh;
#endif
	    curlist.tailfield = adjusttail;
	  }
	  adjusttail = (int)(-32768);
	}
	if (curlist.modefield > 0)
	  F250_buildpage ();
      }
      else
      {
	if ((curlist.modefield == 101)||(curlist.modefield == -101))
	  curlist.auxfield = 1000;
	else
	{
	  p = F211_newnoad ();
	  memhelp._TAG._TAG3.hh.rh = 2;
	  memhelp._TAG._TAG3.hh._TAG._TAG1.lh = curbox;
	  mem[p + 1 - C2_memmin] = memhelp;
	  curbox = p;
	}
	curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = curbox;
      }
    }
  }
  else
  {
#ifdef VAX
    register int help;
#else
    register long help;
#endif
    if ((help=savestack[saveptr]._TAG._TAG1._int) < 1073742336)
      if (help < 1073742080)
	F128_eqdefine ((int)((-1073737502) + help), (char)118, curbox);
      else
	F130_geqdefine ((int)((-1073737758) + help), (char)118, curbox);
    else
      if (curbox != ((int)(-32768)))
	if (help > 1073742336)
	{
	  do
	    F153_getxtoken (null)
	  while ((curcmd == 10) || (curcmd == 0));
	  if ((((curcmd == 26) && ((curlist.modefield != 1)&&(curlist.modefield != -1)))
	    || ((curcmd == 27) && ((curlist.modefield == 1)||(curlist.modefield == -1))))
	    || ((curcmd == 28) && ((curlist.modefield == 201)||(curlist.modefield == -201))))
	  {
	    F281_appendglue ();
	    memptr = &mem[curlist.tailfield - C2_memmin];
	    memptr->_TAG._TAG3.hh._TAG._TAG2.b1 = help - 1073742237;
	    (memptr+1)->_TAG._TAG3.hh.rh = curbox;
	  }
	  else
	  {
	    F19_printnl (134);
	    F17_print (914);
	    helpptr = 3;
	    helpline[2] = 915;
	    helpline[1] = 916;
	    helpline[0] = 917;
	    F142_backerror ();
	    F109_flushnodelist (curbox);
	  }
	}
	else
	{
	  F206_shipout (curbox);
	}
  }
}

void F286_beginbox ()
/*************/
{
  register int /* was T32_halfword */ k;
#ifdef VAX
register int m;
#else
  register T31_quarterword m;
#endif
#ifdef VAX
register int n;
#else
  register T22_eightbits n;
#endif
  register int /* was T32_halfword */ p;
  register int /* was T32_halfword */ q;

  switch (curchr)
  {
    case 0: 
      F164_scaneightbitint ();
      curbox = eqtb[4322 + curval]._TAG._TAG3.hh.rh;
      eqtb[4322 + curval]._TAG._TAG3.hh.rh = (int)(-32768);
      break;
    case 1: 
      F164_scaneightbitint ();
      curbox = F110_copynodelist (eqtb[4322 + curval]._TAG._TAG3.hh.rh);
      break;
    case 2: 
      curbox = (int)(-32768);
      if ((curlist.modefield == 201)||(curlist.modefield == -201))
      {
	F277_youcant ();
	helpptr = 1;
	helpline[0] = 918;
	F39_error ();
      }
      else
	if ((curlist.modefield == 1) && (curlist.headfield == curlist.tailfield))
	{
	  F277_youcant ();
	  helpptr = 2;
	  helpline[1] = 919;
	  helpline[0] = 920;
	  F39_error ();
	}
	else
	{
	  if (curlist.tailfield < himemmin)
	  {
	    register int shelp;
	    if (((shelp=mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0) == 0) || (shelp == 1))
	    {
	      q = curlist.headfield;
	      do
	      {
		p = q;
		if (q < himemmin)
		  if (mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 == 7)
		  {
		    shelp = mem[q -C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b1;
		    for (m = 1; m <= shelp; m++)
		      p = mem[p - C2_memmin]._TAG._TAG3.hh.rh;
		    if (p == curlist.tailfield)
		      goto _30;
		  }
		q = mem[p - C2_memmin]._TAG._TAG3.hh.rh;
	      }
	      while (q != curlist.tailfield);
	      curbox = curlist.tailfield;
	      mem[curbox + 4 - C2_memmin]._TAG._TAG1._int = 0;
	      curlist.tailfield = p;
	      mem[p - C2_memmin]._TAG._TAG3.hh.rh = (int)(-32768);
	  _30: 
	      ;
	    }
	  }
	}
      break;
    case 3: 
      F164_scaneightbitint ();
      n = curval;
      if (!F160_scankeyword (695))
      {
	F19_printnl (134);
	F17_print (921);
	helpptr = 2;
	helpline[1] = 922;
	helpline[0] = 923;
	F39_error ();
      }
      F172_scandimen (FALSE, FALSE, FALSE);
      curbox = F270_vsplit (n, curval);
      break;
    default: 
      k = curchr - 4;
      saveptr++;
      F207_scanspec ();
      if (k == 101)
	if ((savestack[saveptr - 3]._TAG._TAG1._int < 1073741824) && ((curlist.modefield == 1)||(curlist.modefield == -1)))
	  F125_newsavelevel (3);
	else
	  F125_newsavelevel (2);
      else
      {
	if (k == 1)
	  F125_newsavelevel (4);
	else
	{
	  F125_newsavelevel (5);
	  k = 1;
	}
	F241_normalparagraph ();
      }
      F112_pushnest ();
      curlist.modefield = -k;
      if (k == 1)
      {
	curlist.auxfield = -65536000;
	if (eqtb[4062]._TAG._TAG3.hh.rh != ((int)(-32768)))
	  F140_begintokenlist (eqtb[4062]._TAG._TAG3.hh.rh, (char)11);
      }
      else
      {
	curlist.auxfield = 1000;
	if (eqtb[4061]._TAG._TAG3.hh.rh != ((int)(-32768)))
	  F140_begintokenlist (eqtb[4061]._TAG._TAG3.hh.rh, (char)10);
      }
      return;
    break;
  }
  F285_boxend ();
}

void F287_scanbox ()
/************/
{
  do
    F153_getxtoken (null)
  while ((curcmd == 10) || (curcmd == 0));
  if (curcmd == 20)
    F286_beginbox ();
  else
    if ((savestack[saveptr]._TAG._TAG1._int >= 1073742337) && ((curcmd == 36) || (curcmd == 35)))
    {
      curbox = F174_scanrulespec ();
      F285_boxend ();
    }
    else
    {
      F19_printnl (134);
      F17_print (924);
      helpptr = 3;
      helpline[2] = 925;
      helpline[1] = 926;
      helpline[0] = 927;
      F142_backerror ();
    }
}

void F288_package (c)
/*************/
T29_smallnumber c;
{
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  register T37_memoryword *memptr;
#endif
  register long int   d;
  register long int   h;
  register int /* was T32_halfword */ p;

  d = eqtb[5708]._TAG._TAG1._int;
  F135_unsave ();
  saveptr -= 3;
  if (curlist.modefield == (-101))
  {
    curbox = F208_hpack (mem[curlist.headfield - C2_memmin]._TAG._TAG3.hh.rh, savestack[saveptr + 2]._TAG._TAG1._int, (int)savestack[saveptr + 1]._TAG._TAG1._int);
  }
  else
  {
    curbox = F209_vpackage (mem[curlist.headfield - C2_memmin]._TAG._TAG3.hh.rh, savestack[saveptr + 2]._TAG._TAG1._int, (int)savestack[saveptr + 1]._TAG._TAG1._int, d);
    if (c == 4)
    {
      h = 0;
      memptr = &mem[curbox + 2 - C2_memmin];
      p = (memptr+3)->_TAG._TAG3.hh.rh;
      if (p != ((int)(-32768)))
	if (mem[p - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 <= 2)
	  h = mem[p + 3 - C2_memmin]._TAG._TAG1._int;
      memptr->_TAG._TAG1._int += (memptr+1)->_TAG._TAG1._int - h;
      (memptr+1)->_TAG._TAG1._int = h;
    }
  }
  F113_popnest ();
  F285_boxend ();
}

void F289_newgraf (indented)
/********************/
BOOLEAN indented;
{
  curlist.pgfield = 0;
  if ((curlist.modefield == 1) || (curlist.headfield != curlist.tailfield))
  {
    curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F86_newparamglue (2);
  }
  F112_pushnest ();
  curlist.modefield = 101;
  curlist.auxfield = 1000;
  if (indented)
  {
    mem[curlist.headfield - C2_memmin]._TAG._TAG3.hh.rh = curlist.tailfield = F80_newnullbox ();
    mem[curlist.tailfield + 1 - C2_memmin]._TAG._TAG1._int = eqtb[5701]._TAG._TAG1._int;
  }
  if (eqtb[4058]._TAG._TAG3.hh.rh != ((int)(-32768)))
    F140_begintokenlist (eqtb[4058]._TAG._TAG3.hh.rh, (char)7);
  if (nestptr == 1)
    F250_buildpage ();
}

void F290_indentinhmode ()
/******************/
{
  register int /* was T32_halfword */ p;
  register int /* was T32_halfword */ q;
  register T37_memoryword memhelp;

  if (curchr > 0)
  {
    p = F80_newnullbox ();
    mem[p + 1 - C2_memmin]._TAG._TAG1._int = eqtb[5701]._TAG._TAG1._int;
    if ((curlist.modefield == 101)||(curlist.modefield == -101))
      curlist.auxfield = 1000;
    else
    {
      q = F211_newnoad ();
      memhelp._TAG._TAG3.hh.rh = 2;
      memhelp._TAG._TAG3.hh._TAG._TAG1.lh = p;
      mem[q + 1 - C2_memmin] = memhelp;
      p = q;
    }
    curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = p;
  }
}

void F291_headforvmode ()
/*****************/
{
  if (curlist.modefield < 0)
    if (curcmd != 36)
      F283_offsave ();
    else
    {
      F19_printnl (134);
      F17_print (541);
      F20_printesc (381);
      F17_print (930);
      helpptr = 2;
      helpline[1] = 931;
      helpline[0] = 932;
      F39_error ();
    }
  else
  {
    F134_backinput ();
    curtok = partoken;
    F134_backinput ();
    curinput.indexfield = 4;
  }
}

void F292_endgraf ()
/************/
{
  if (curlist.modefield == 101)
  {
    if (curlist.headfield == curlist.tailfield)
      F113_popnest ();
    else
      F257_linebreak (eqtb[5273]._TAG._TAG1._int);
    F241_normalparagraph ();
    errorcount = 0;
  }
}

void F293_begininsertoradjust ()
/************************/
{
  if (curcmd == 38)
    curval = 255;
  else
  {
    F164_scaneightbitint ();
    if (curval == 255)
    {
      F19_printnl (134);
      F17_print (933);
      F20_printesc (199);
      F22_printint (255L);
      helpptr = 1;
      helpline[0] = 934;
      F39_error ();
      curval = 0;
    }
  }
  savestack[saveptr++]._TAG._TAG1._int = curval;
  F125_newsavelevel (11);
  F158_scanleftbrace ();
  F241_normalparagraph ();
  F112_pushnest ();
  curlist.modefield = -1;
  curlist.auxfield = -65536000;
}

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

  F177_scantoks (FALSE, TRUE);
  p = F77_getnode (2L);
  memptr = &mem[p - C2_memmin];
  memptr->_TAG._TAG3.hh._TAG._TAG2.b0 = 4;
  memptr->_TAG._TAG3.hh._TAG._TAG2.b1 = 0;
  (memptr+1)->_TAG._TAG1._int = defref;
  mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = p;
  curlist.tailfield = p;
}

void F295_appendpenalty ()
/******************/
{
  F162_scanint ();
  curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F90_newpenalty (curval);
  if (curlist.modefield == 1)
    F250_buildpage ();
}

void F296_deletelast ()
/***************/
{
#ifdef VAX
register int m;
#else
  register T31_quarterword m;
#endif
  register int /* was T32_halfword */ p;
  register int /* was T32_halfword */ q;

  if ((curlist.modefield == 1) && (curlist.tailfield == curlist.headfield))
  {
    if ((curchr != 10) || (lastglue != 32767))
    {
      F277_youcant ();
      helpptr = 2;
      helpline[1] = 919;
      helpline[0] = 935;
      if (curchr == 11)
	helpline[0] = 936;
      else
	if (curchr != 10)
	  helpline[0] = 937;
      F39_error ();
    }
  }
  else
  {
    if (curlist.tailfield < himemmin)
      if (mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 == curchr)
      {
	q = curlist.headfield;
	do
	{
	  p = q;
	  if (q < himemmin)
	    if (mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 == 7)
	    {
	      register int help;
	      help = mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b1;
	      for (m = 1; m <= help; m++)
		p = mem[p - C2_memmin]._TAG._TAG3.hh.rh;
	      if (p == curlist.tailfield)
		return;
	    }
	  q = mem[p - C2_memmin]._TAG._TAG3.hh.rh;
	}
	while (q != curlist.tailfield);
	mem[p - C2_memmin]._TAG._TAG3.hh.rh = (int)(-32768);
	F109_flushnodelist (curlist.tailfield);
	curlist.tailfield = p;
      }
  }
}

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

  c = curchr;
  F164_scaneightbitint ();
  p = eqtb[4322 + curval]._TAG._TAG3.hh.rh;
  if (p == ((int)(-32768)))
    return;
  memptr = &mem[p - C2_memmin];
  if (((curlist.modefield == 201) || (curlist.modefield == -201)) ||
     (((curlist.modefield == 1)||(curlist.modefield == -1)) && (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 != 1))
     || (((curlist.modefield == 101)||(curlist.modefield == -101)) && (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 != 0)))
  {
    F19_printnl (134);
    F17_print (945);
    helpptr = 3;
    helpline[2] = 946;
    helpline[1] = 947;
    helpline[0] = 948;
    F39_error ();
    return;
  }
  if (c == 1)
    mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F110_copynodelist ((memptr+5)->_TAG._TAG3.hh.rh);
  else
  {
#ifdef M_XENIX
    register int shelp;
    shelp = (memptr+5)->_TAG._TAG3.hh.rh;
    mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = shelp;
#else
    mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = (memptr+5)->_TAG._TAG3.hh.rh;
#endif
    eqtb[4322 + curval]._TAG._TAG3.hh.rh = (int)(-32768);
    F78_freenode (p, 7);
  }
  {
    register int shelp;
    while ((shelp=mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh) != ((int)(-32768)))
      curlist.tailfield = shelp;
  }
}

void F298_appenditaliccorrecti ()
/*************************/
{
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  register T37_memoryword *memptr;
#endif
#ifdef VAX
register int f;
#else
  register T43_internalfontnumber f;
#endif
  register int /* was T32_halfword */ p;

  if (curlist.tailfield != curlist.headfield)
  {
    if (curlist.tailfield >= himemmin)
      p = curlist.tailfield;
    else
      if (mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 == 6)
	p = curlist.tailfield + 1;
      else
	return;
    memptr = &mem[p - C2_memmin];
    f = memptr->_TAG._TAG3.hh._TAG._TAG2.b0;
    curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F89_newkern (fontinfo[italicbase[f] + ((fontinfo[charbase[f] + memptr->_TAG._TAG3.hh._TAG._TAG2.b1]._TAG._TAG4.qqqq.b2 + 128) >> 2)]._TAG._TAG1._int);
    mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b1 = 1;
  }
}

void F299_appenddiscretionary ()
/************************/
{
  register int   c;

  curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F83_newdisc ();
  if (curchr == 1)
  {
    c = hyphenchar[eqtb[4578]._TAG._TAG3.hh.rh];
    if (c >= 0)
      if (c < 256)
	mem[curlist.tailfield + 1 - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = F194_newcharacter (eqtb[4578]._TAG._TAG3.hh.rh, (T22_eightbits)c);
  }
  else
  {
    savestack[saveptr++]._TAG._TAG1._int = 0;
    F158_scanleftbrace ();
    F125_newsavelevel (10);
    F112_pushnest ();
    curlist.modefield = -101;
    curlist.auxfield = 1000;
  }
}

void F300_builddiscretionary ()
/***********************/
{
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  register T37_memoryword *memptr;
#endif
  register int   n;
  register int /* was T32_halfword */ p;
  register int /* was T32_halfword */ q;

  F135_unsave ();
  q = curlist.headfield;
  p = mem[q - C2_memmin]._TAG._TAG3.hh.rh;
  n = 0;
  while (p != ((int)(-32768)))
  {
    register int shelp;
    if (p < himemmin)
      if ((shelp=mem[p - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0) > 2)
	if (shelp != 11)
	  if (shelp != 6)
	  {
	    F19_printnl (134);
	    F17_print (955);
	    helpptr = 1;
	    helpline[0] = 956;
	    F39_error ();
	    F118_begindiagnostic ();
	    F19_printnl (957);
	    F106_showbox (p);
	    F119_enddiagnostic (TRUE);
	    F109_flushnodelist (p);
	    mem[q - C2_memmin]._TAG._TAG3.hh.rh = (int)(-32768);
	    goto _30;
	  }
    q = p;
    p = mem[q - C2_memmin]._TAG._TAG3.hh.rh;
    n++;
  }
_30: 
  p = mem[curlist.headfield - C2_memmin]._TAG._TAG3.hh.rh;
  F113_popnest ();
  switch (savestack[saveptr - 1]._TAG._TAG1._int)
  {
    case 0: 
      mem[curlist.tailfield + 1 - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = p;
      break;
    case 1: 
      mem[curlist.tailfield + 1 - C2_memmin]._TAG._TAG3.hh.rh = p;
      break;
    case 2: 
      {
	memptr = &mem[curlist.tailfield - C2_memmin];
	if ((n > 0) && ((curlist.modefield == 201)||(curlist.modefield == -201)))
	{
	  F19_printnl (134);
	  F17_print (949);
	  F20_printesc (218);
	  helpptr = 2;
	  helpline[1] = 950;
	  helpline[0] = 951;
	  F109_flushnodelist (p);
	  n = 0;
	  F39_error ();
	}
	else
	  memptr->_TAG._TAG3.hh.rh = p;
	if (n <= 127)
	  memptr->_TAG._TAG3.hh._TAG._TAG2.b1 = n;
	else
	{
	  F19_printnl (134);
	  F17_print (952);
	  helpptr = 2;
	  helpline[1] = 953;
	  helpline[0] = 954;
	  F39_error ();
	}
	if (n > 0)
	  curlist.tailfield = q;
	saveptr--;
	return;
      }
      break;
  }
  savestack[saveptr - 1]._TAG._TAG1._int++;
  F158_scanleftbrace ();
  F125_newsavelevel (10);
  F112_pushnest ();
  curlist.modefield = -101;
  curlist.auxfield = 1000;
}

void F301_makeaccent ()
/***************/
{
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  register T37_memoryword *memptr;
#endif
  register long int   a;
  register long int   delta;
#ifdef VAX
register int f;
#else
  register T43_internalfontnumber f;
#endif
  register long int   h;
  register T36_fourquarters i;
  register int /* was T32_halfword */ p;
  register int /* was T32_halfword */ q;
  register int /* was T32_halfword */ r;
  register float   s;
  register float   t;
  register long int   w;
  register long int   x;

  F166_scancharnum ();
  f = eqtb[4578]._TAG._TAG3.hh.rh;
  p = F194_newcharacter (f, (T22_eightbits)curval);
  if (p != ((int)(-32768)))
  {
    x = fontinfo[5 + parambase[f]]._TAG._TAG1._int;
    s = (float)fontinfo[1 + parambase[f]]._TAG._TAG1._int / 65536.0;
    a = fontinfo[widthbase[f] + fontinfo[charbase[f] + mem[p - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b1]._TAG._TAG4.qqqq.b0]._TAG._TAG1._int;
    F248_doassignments ();
    q = (int)(-32768);
    f = eqtb[4578]._TAG._TAG3.hh.rh;
    if (((curcmd == 11) || (curcmd == 12)) || (curcmd == 67))
      q = F194_newcharacter (f, (T22_eightbits)curchr);
    else
      if (curcmd == 16)
      {
	F166_scancharnum ();
	q = F194_newcharacter (f, (T22_eightbits)curval);
      }
      else
	F134_backinput ();
    if (q != ((int)(-32768)))
    {
      t = (float)fontinfo[1 + parambase[f]]._TAG._TAG1._int / 65536.0;
      i=fontinfo[charbase[f] + mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b1]._TAG._TAG4.qqqq;
      w = fontinfo[widthbase[f] + i.b0]._TAG._TAG1._int;
      h = fontinfo[heightbase[f] + ((i.b1 + 128) >> 4)]._TAG._TAG1._int;
      if (h != x)
      {
	p = F208_hpack (p, 0L, 1);
	mem[p + 4 - C2_memmin]._TAG._TAG1._int = x - h;
      }
      delta = ROUND ((((double)(w - a) / 2.0) + (h * t)) - (x * s));
      r = F89_newkern (delta);
      memptr = &mem[r - C2_memmin];
      memptr->_TAG._TAG3.hh._TAG._TAG2.b1 = 2;
      mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = r;
      memptr->_TAG._TAG3.hh.rh = p;
      curlist.tailfield = F89_newkern ((-a) - delta);
      mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b1 = 2;
      mem[p - C2_memmin]._TAG._TAG3.hh.rh = curlist.tailfield;
      p = q;
    }
    curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = p;
    curlist.auxfield = 1000;
  }
}

void F302_alignerror ()
/***************/
{
  if ((alignstate > 2)||(alignstate< -2))
  {
    F19_printnl (134);
    F17_print (962);
    F121_printcmdchr (curcmd, curchr);
    if (curtok == 1062)
    {
      helpptr = 6;
      helpline[5] = 963;
      helpline[4] = 964;
      helpline[3] = 965;
      helpline[2] = 966;
      helpline[1] = 967;
      helpline[0] = 968;
    }
    else
    {
      helpptr = 5;
      helpline[4] = 963;
      helpline[3] = 969;
      helpline[2] = 966;
      helpline[1] = 967;
      helpline[0] = 968;
    }
    F39_error ();
  }
  else
  {
    F134_backinput ();
    if (alignstate < 0)
    {
      F19_printnl (134);
      F17_print (515);
      alignstate++;
      curtok = 379;
    }
    else
    {
      F19_printnl (134);
      F17_print (958);
      alignstate--;
      curtok = 637;
    }
    helpptr = 3;
    helpline[2] = 959;
    helpline[1] = 960;
    helpline[0] = 961;
    F143_inserror ();
  }
}

void F303_noalignerror ()
/*****************/
{
  F19_printnl (134);
  F17_print (962);
  F20_printesc (387);
  helpptr = 2;
  helpline[1] = 970;
  helpline[0] = 971;
  F39_error ();
}

void F304_omiterror ()
/**************/
{
  F19_printnl (134);
  F17_print (962);
  F20_printesc (389);
  helpptr = 2;
  helpline[1] = 972;
  helpline[0] = 971;
  F39_error ();
}

void F305_doendv ()
/***********/
{
  if (curgroup == 6)
  {
    F292_endgraf ();
    if (F246_fincol ())
      F247_finrow ();
  }
  else
    F283_offsave ();
}

void F306_cserror ()
/************/
{
  F19_printnl (134);
  F17_print (633);
  F20_printesc (365);
  helpptr = 1;
  helpline[0] = 974;
  F39_error ();
}

void F307_pushmath (c)
/**************/
T41_groupcode c;
{
  F112_pushnest ();
  curlist.modefield = -201;
  curlist.auxfield = (int)(-32768);
  F125_newsavelevel (c);
}

void F308_initmath ()
/*************/
{
#ifdef M_XENIX
  T37_memoryword huge *memptr, huge *memptr1, huge *memptr2;
#else
  register T37_memoryword *memptr,*memptr1,*memptr2;
#endif
  register long int   d;
#ifdef VAX
register int f;
#else
  register T43_internalfontnumber f;
#endif
  register long int   l;
  register long int   n;
  register int /* was T32_halfword */ p;
  register int /* was T32_halfword */ q;
  register long int   s;
  register long int   v;
  register long int   w;

  F29_gettoken (null);
  if ((curcmd == 3) && (curlist.modefield > 0))
  {
    if (curlist.headfield == curlist.tailfield)
    {
      F113_popnest ();
      w = -1073741823;
    }
    else
    {
      F257_linebreak (eqtb[5274]._TAG._TAG1._int);
      memptr = &mem[justbox + 5 - C2_memmin];
#ifdef NOSHIFT
      v = (memptr-1)->_TAG._TAG1._int + (fontinfo[6 + parambase[eqtb[4578]._TAG._TAG3.hh.rh]]._TAG._TAG1._int * 2);
#else
      v = (memptr-1)->_TAG._TAG1._int + (fontinfo[6 + parambase[eqtb[4578]._TAG._TAG3.hh.rh]]._TAG._TAG1._int << 1);
#endif
      w = -1073741823;
      p = memptr->_TAG._TAG3.hh.rh;
      while (p != ((int)(-32768)))
      {
    _21: 
	memptr1 = &mem[p - C2_memmin];
	if (p >= himemmin)
	{
	  f = memptr1->_TAG._TAG3.hh._TAG._TAG2.b0;
	  d = fontinfo[widthbase[f] + fontinfo[charbase[f] + memptr1->_TAG._TAG3.hh._TAG._TAG2.b1]._TAG._TAG4.qqqq.b0]._TAG._TAG1._int;
	  goto _40;
	}
	switch (memptr1->_TAG._TAG3.hh._TAG._TAG2.b0)
	{
	  case 0: 
	  case 1: 
	  case 2: 
	    d = (memptr1+1)->_TAG._TAG1._int;
	    goto _40;
	    break;
	  case 6: 
	    m29988->_TAG._TAG3.hh._TAG._TAG1.lh = (memptr1+1)->_TAG._TAG3.hh._TAG._TAG1.lh ;
	    m29988->_TAG._TAG3.hh.rh = memptr1->_TAG._TAG3.hh.rh;
#ifdef TRIPTEX
	    p = 2988;
#else
	    p = 29988;
#endif
	    goto _21;
	    break;
	  case 11: 
	  case 9: 
	    d = (memptr1+1)->_TAG._TAG1._int;
	    break;
	  case 10: 
	    q = (memptr1+1)->_TAG._TAG3.hh._TAG._TAG1.lh;
	    memptr2 = &mem[q - C2_memmin];
	    d = (memptr2+1)->_TAG._TAG1._int;
	    if (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 == 1)
	    {
	      if ((memptr->_TAG._TAG3.hh._TAG._TAG2.b1 == memptr2->_TAG._TAG3.hh._TAG._TAG2.b0) && ((memptr2+2)->_TAG._TAG1._int != 0))
		v = 1073741823;
	    }
	    else
	      if (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 == 2)
	      {
		if ((memptr->_TAG._TAG3.hh._TAG._TAG2.b1 == memptr2->_TAG._TAG3.hh._TAG._TAG2.b1) && ((memptr2+3)->_TAG._TAG1._int != 0))
		  v = 1073741823;
	      }
	    if (memptr1->_TAG._TAG3.hh._TAG._TAG2.b1 >= 100)
	      goto _40;
	    break;
	  case 8: 
	    d = 0;
	    break;
	  default: 
	    d = 0;
	    break;
	}
	if (v < 1073741823)
	  v += d;
	goto _45;
    _40: 
	if (v < 1073741823)
	{
	  v += d;
	  w = v;
	}
	else
	{
	  w = 1073741823;
	  goto _30;
	}
    _45: 
	p = memptr1->_TAG._TAG3.hh.rh;
      }
  _30: 
      ;
    }
    if (eqtb[4056]._TAG._TAG3.hh.rh == ((int)(-32768)))
      if ((eqtb[5718]._TAG._TAG1._int != 0L) && (((eqtb[5308]._TAG._TAG1._int >= 0L) && ((curlist.pgfield + 2) > eqtb[5308]._TAG._TAG1._int)) || ((curlist.pgfield + 1) < (-eqtb[5308]._TAG._TAG1._int))))
      {
	if (eqtb[5718]._TAG._TAG1._int > 0L)
	{
	  l = eqtb[5704]._TAG._TAG1._int - eqtb[5718]._TAG._TAG1._int;
	  s = eqtb[5718]._TAG._TAG1._int;
	}
	else
	{
	  l = eqtb[5704]._TAG._TAG1._int + eqtb[5718]._TAG._TAG1._int;
	  s = 0;
	}
      }
      else
      {
	l = eqtb[5704]._TAG._TAG1._int;
	s = 0;
      }
    else
    {
      n = mem[eqtb[4056]._TAG._TAG3.hh.rh - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh;
      if ((curlist.pgfield + 2) >= n)
	p = eqtb[4056]._TAG._TAG3.hh.rh + (n + n);
      else
#ifdef NOSHIFT
	p = eqtb[4056]._TAG._TAG3.hh.rh + ((curlist.pgfield + 2) * 2);
#else
	p = eqtb[4056]._TAG._TAG3.hh.rh + ((curlist.pgfield + 2) << 1);
#endif
      memptr = &mem[p - C2_memmin];
      s = (memptr-1)->_TAG._TAG1._int;
      l = memptr->_TAG._TAG1._int;
    }
    F307_pushmath (15);
    curlist.modefield = 201;
    F129_eqworddefine (5311, -1L);
    F129_eqworddefine (5714, w);
    F129_eqworddefine (5715, l);
    F129_eqworddefine (5716, s);
    if (eqtb[4060]._TAG._TAG3.hh.rh != ((int)(-32768)))
      F140_begintokenlist (eqtb[4060]._TAG._TAG3.hh.rh, (char)9);
    if (nestptr == 1)
      F250_buildpage ();
  }
  else
  {
    F134_backinput ();
    F307_pushmath (15);
    F129_eqworddefine (5311, -1L);
    if (eqtb[4059]._TAG._TAG3.hh.rh != ((int)(-32768)))
      F140_begintokenlist (eqtb[4059]._TAG._TAG3.hh.rh, (char)8);
  }
}

void F309_starteqno ()
/**************/
{
  savestack[saveptr++]._TAG._TAG1._int = curchr;
  F307_pushmath (15);
  F129_eqworddefine (5311, -1L);
  if (eqtb[4059]._TAG._TAG3.hh.rh != ((int)(-32768)))
    F140_begintokenlist (eqtb[4059]._TAG._TAG3.hh.rh, (char)8);
}
