#include "externs.h"

void F335_issuemessage ()
/*****************/
{
  register int   c;
  register int   oldsetting;
#ifdef VAX
register int s;
#else
  register T26_strnumber s;
#endif

  c = curchr;
  m29988->_TAG._TAG3.hh.rh = F177_scantoks (FALSE, TRUE);
  oldsetting = selector;
  selector = 21;
  if (defref != ((int)(-32768)))
    F73_showtokenlist (mem[defref - C2_memmin]._TAG._TAG3.hh.rh, (int)(-32768), 1000L);
  selector = oldsetting;
  F76_flushlist (defref);
  if (poolptr >= C15_poolsize)
    F41_overflow (129, (long)C15_poolsize - initpoolptr);
  s = F54_makestring ();
  if (c == 0)
  {
    if ((termoffset + (strstart[s + 1] - strstart[s])) > (C6_maxprintline - 2))
      F15_println ();
    else
      if ((termoffset > 0) || (fileoffset > 0))
	F16_printchar ((char)32);
    F17_print (s);
    fflush(stdout);
  }
  else
  {
    F19_printnl (134);
    F17_print (s);
    if (eqtb[4065]._TAG._TAG3.hh.rh != ((int)(-32768)))
      useerrhelp = TRUE;
    else
      if (longhelpseen)
      {
	helpptr = 1;
	helpline[0] = 1078;
      }
      else
      {
	if (interaction < 3)
	  longhelpseen = TRUE;
	helpptr = 4;
	helpline[3] = 1079;
	helpline[2] = 1080;
	helpline[1] = 1081;
	helpline[0] = 1082;
      }
    F39_error ();
    useerrhelp = FALSE;
  }
  poolptr = strstart[--strptr];
}

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

  b = curchr;
  p = F177_scantoks (FALSE, FALSE);
  p = mem[defref - C2_memmin]._TAG._TAG3.hh.rh;
  while (p != ((int)(-32768)))
  {
    memptr = &mem[p - C2_memmin];
    t = memptr->_TAG._TAG3.hh._TAG._TAG1.lh;
    if (t < 4225)
    {
      if (t >= 4096)
	t--;
      c = t & 255;
      if (c < 128)
	if (eqtb[b + c]._TAG._TAG3.hh.rh != 0)
	  t = (t & 0xFF00) + eqtb[b + c]._TAG._TAG3.hh.rh;
      if (t >= 4096)
	memptr->_TAG._TAG3.hh._TAG._TAG1.lh = t + 1;
      else
	memptr->_TAG._TAG3.hh._TAG._TAG1.lh = t;
    }
    p = memptr->_TAG._TAG3.hh.rh;
  }
  F140_begintokenlist (mem[defref - C2_memmin]._TAG._TAG3.hh.rh, (char)3);
  mem[defref - C2_memmin]._TAG._TAG3.hh.rh = avail;
  avail = defref;
#if defined(INITEX) || defined(TRIPTEX)
  dynused--;
# endif
}

void F337_showwhatever ()
/*****************/
{
  switch (curchr)
  {
    case 3: 
      F118_begindiagnostic ();
      F115_showactivities ();
      break;
    case 1: 
      F164_scaneightbitint ();
      F118_begindiagnostic ();
      F19_printnl (1100);
      F22_printint ((long)curval);
      F16_printchar ((char)61);
      if (eqtb[4322 + curval]._TAG._TAG3.hh.rh == ((int)(-32768)))
	F17_print (276);
      else
	F106_showbox (eqtb[4322 + curval]._TAG._TAG3.hh.rh);
      break;
    case 0: 
      F29_gettoken (null);
      F19_printnl (1094);
      if (curcs != 0)
      {
	F24_sprintcs (curcs);
	F16_printchar ((char)61);
      }
      F138_printmeaning ();
      goto _50;
      break;
    default: 
      F176_thetoks ();
      F19_printnl (1094);
      {
	register int shelp;
	shelp = m29997->_TAG._TAG3.hh.rh;
	F73_showtokenlist (shelp, (int)(-32768), 1000L);
	F76_flushlist (shelp);
      }
      goto _50;
      break;
  }
  F119_enddiagnostic (TRUE);
  F19_printnl (134);
  F17_print (1101);
  if (selector == 19)
    if (eqtb[5296]._TAG._TAG1._int <= 0)
    {
      selector = 17;
      F17_print (1102);
      selector = 19;
    }
_50: 
  if (interaction < 3)
  {
    helpptr = 0;
    errorcount--;
  }
  else
    if (eqtb[5296]._TAG._TAG1._int > 0L)
    {
      helpptr = 3;
      helpline[2] = 1089;
      helpline[1] = 1090;
      helpline[0] = 1091;
    }
    else
    {
      helpptr = 5;
      helpline[4] = 1089;
      helpline[3] = 1090;
      helpline[2] = 1091;
      helpline[1] = 1092;
      helpline[0] = 1093;
    }
  F39_error ();
}

#if defined(INITEX) || defined(TRIPTEX)
void F338_storefmtfile ()
/*****************/
{
#ifdef VAX
  register int j,k;
#else
  register long j;
  register long k;
#endif
  long l;
  int /* was T32_halfword */ p;
  int /* was T32_halfword */ q;
  T36_fourquarters w;
  long x;

  if (saveptr != 0)
  {
    F19_printnl (134);
    F17_print (1104);
    helpptr = 1;
    helpline[0] = 1105;
    if (interaction == 3)
      interaction = 2;
    F39_error ();
    if (interaction > 0)
      F37_debughelp ();
    history = 3;
    F38_jumpout ();
  }
  selector = 21;
  F17_print (1116);
  F17_print (jobname);
  F16_printchar ((char)32);
  F22_printint (eqtb[5290]._TAG._TAG1._int % 100);
  F16_printchar ((char)46);
  F22_printint (eqtb[5289]._TAG._TAG1._int);
  F16_printchar ((char)46);
  F22_printint (eqtb[5288]._TAG._TAG1._int);
  F16_printchar ((char)41);
  if (interaction == 0)
    selector = 18;
  else
    selector = 19;
  if (poolptr >= C15_poolsize)
    F41_overflow (129, (long)C15_poolsize - initpoolptr);
  formatident = F54_makestring ();
  F190_packjobname (1117);
  while (!F48_wopenout (&fmtfile))
    F191_promptfilename (1118, 1117);
  F19_printnl (1119);
  F17_print (F185_makenamestring ());
  poolptr = strstart[--strptr];
  F19_printnl (formatident);
  fmtfile.buffer._TAG._TAG1._int = 315565539;
  PUT_2 (fmtfile);
#ifdef TRIPTEX
  fmtfile.buffer._TAG._TAG1._int = 1;
#else
  fmtfile.buffer._TAG._TAG1._int = -30000L;
#endif
  PUT_2 (fmtfile);
#ifdef TRIPTEX
  fmtfile.buffer._TAG._TAG1._int = 3000;
#else
  fmtfile.buffer._TAG._TAG1._int = 30000L;
#endif
  PUT_2 (fmtfile);
  fmtfile.buffer._TAG._TAG1._int = 5976;
  PUT_2 (fmtfile);
  fmtfile.buffer._TAG._TAG1._int = 2551;
  PUT_2 (fmtfile);
  fmtfile.buffer._TAG._TAG1._int = 307;
  PUT_2 (fmtfile);
  fmtfile.buffer._TAG._TAG1._int = poolptr;
  PUT_2 (fmtfile);
  fmtfile.buffer._TAG._TAG1._int = strptr;
  PUT_2 (fmtfile);
  for (k = 0; k <= strptr; k++)
  {
    fmtfile.buffer._TAG._TAG1._int = strstart[k];
    PUT_2 (fmtfile);
  }
  k = 0;
  while ((k + 4) < poolptr)
  {
    w.b0 = strpool[k];
    w.b1 = strpool[k + 1];
    w.b2 = strpool[k + 2];
    w.b3 = strpool[k + 3];
    fmtfile.buffer._TAG._TAG4.qqqq=w;
    PUT_2 (fmtfile);
    k += 4;
  }
  k = poolptr - 4;
  w.b0 = strpool[k];
  w.b1 = strpool[k + 1];
  w.b2 = strpool[k + 2];
  w.b3 = strpool[k + 3];
  fmtfile.buffer._TAG._TAG4.qqqq=w;
  PUT_2 (fmtfile);
  F15_println ();
  F22_printint ((long)strptr);
  F17_print (1106);
  F22_printint ((long)poolptr);
  F79_sortavail ();
  varused = 0;
  fmtfile.buffer._TAG._TAG1._int = lomemmax;
  PUT_2 (fmtfile);
  fmtfile.buffer._TAG._TAG1._int = rover;
  PUT_2 (fmtfile);
#ifdef TRIPTEX
  p = 1;
#else
  p = -30000;
#endif
  q = rover;
  x = 0;
  do
  {
    for (k = p-1; k <= q; k++)
    {
      fmtfile.buffer=mem[k+1 - C2_memmin];
      PUT_2 (fmtfile);
    }
    x += q + 2 - p;
    varused += q - p;
    p = q + mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh;
    q = mem[q + 1 - C2_memmin]._TAG._TAG3.hh.rh;
  }
  while (q != rover);
  varused += lomemmax - p;
  dynused = (memend + 1) - himemmin;
  for (k = p; k <= lomemmax; k++)
  {
    fmtfile.buffer=mem[k - C2_memmin];
    PUT_2 (fmtfile);
  }
  x += lomemmax + 1 - p;
  fmtfile.buffer._TAG._TAG1._int = himemmin;
  PUT_2 (fmtfile);
  fmtfile.buffer._TAG._TAG1._int = avail;
  PUT_2 (fmtfile);
  for (k = himemmin; k <= memend; k++)
  {
    fmtfile.buffer=mem[k - C2_memmin];
    PUT_2 (fmtfile);
  }
  x += memend + 1 - himemmin;
  p = avail;
  while (p != ((int)(-32768)))
  {
    dynused--;
    p = mem[p - C2_memmin]._TAG._TAG3.hh.rh;
  }
  fmtfile.buffer._TAG._TAG1._int = varused;
  PUT_2 (fmtfile);
  fmtfile.buffer._TAG._TAG1._int = dynused;
  PUT_2 (fmtfile);
  F15_println ();
  F22_printint (x);
  F17_print (1107);
  F22_printint ((long)varused);
  F16_printchar ((char)38);
  F22_printint ((long)dynused);
  k = 1;
  do
  {
    j = k;
    while (j < 5266)
    {
      if (((eqtb[j]._TAG._TAG3.hh.rh == eqtb[j + 1]._TAG._TAG3.hh.rh) && (eqtb[j]._TAG._TAG3.hh._TAG._TAG2.b0 == eqtb[j + 1]._TAG._TAG3.hh._TAG._TAG2.b0)) && (eqtb[j]._TAG._TAG3.hh._TAG._TAG2.b1 == eqtb[j + 1]._TAG._TAG3.hh._TAG._TAG2.b1))
	goto _41;
      j++;
    }
    l = 5267;
    goto _31;
_41: 
    j++;
    l = j;
    while (j < 5266)
    {
      if (((eqtb[j]._TAG._TAG3.hh.rh != eqtb[j + 1]._TAG._TAG3.hh.rh) || (eqtb[j]._TAG._TAG3.hh._TAG._TAG2.b0 != eqtb[j + 1]._TAG._TAG3.hh._TAG._TAG2.b0)) || (eqtb[j]._TAG._TAG3.hh._TAG._TAG2.b1 != eqtb[j + 1]._TAG._TAG3.hh._TAG._TAG2.b1))
	goto _31;
      j++;
    }
_31: 
    fmtfile.buffer._TAG._TAG1._int = l - k;
    PUT_2 (fmtfile);
    while (k < l)
    {
      fmtfile.buffer=eqtb[k];
      PUT_2 (fmtfile);
      k++;
    }
    k = j + 1;
    fmtfile.buffer._TAG._TAG1._int = k - l;
    PUT_2 (fmtfile);
  }
  while (k != 5267);
  do
  {
    j = k;
    while (j < 5976)
    {
      if (eqtb[j]._TAG._TAG1._int == eqtb[j + 1]._TAG._TAG1._int)
	goto _42;
      j++;
    }
    l = 5977;
    goto _32;
_42: 
    j++;
    l = j;
    while (j < 5976)
    {
      if (eqtb[j]._TAG._TAG1._int != eqtb[j + 1]._TAG._TAG1._int)
	goto _32;
      j++;
    }
_32: 
    fmtfile.buffer._TAG._TAG1._int = l - k;
    PUT_2 (fmtfile);
    while (k < l)
    {
      fmtfile.buffer=eqtb[k];
      PUT_2 (fmtfile);
      k++;
    }
    k = j + 1;
    fmtfile.buffer._TAG._TAG1._int = k - l;
    PUT_2 (fmtfile);
  }
  while (k <= 5976);
  fmtfile.buffer._TAG._TAG1._int = parloc;
  PUT_2 (fmtfile);
  fmtfile.buffer._TAG._TAG1._int = writeloc;
  PUT_2 (fmtfile);
  fmtfile.buffer._TAG._TAG1._int = hashused;
  PUT_2 (fmtfile);
  cscount = 3257 - hashused;
  for (p = 258; p <= hashused; p++)
    if (hash[p - 258].rh != 0)
    {
      fmtfile.buffer._TAG._TAG1._int = p;
      PUT_2 (fmtfile);
      fmtfile.buffer._TAG._TAG3.hh=hash[p - 258];
      PUT_2 (fmtfile);
      cscount++;
    }
  for (p = hashused + 1; p <= 3524; p++)
  {
    fmtfile.buffer._TAG._TAG3.hh=hash[p - 258];
    PUT_2 (fmtfile);
  }
  fmtfile.buffer._TAG._TAG1._int = cscount;
  PUT_2 (fmtfile);
  F15_println ();
  F22_printint ((long)cscount);
  F17_print (1108);
  fmtfile.buffer._TAG._TAG1._int = fmemptr;
  PUT_2 (fmtfile);
  for (k = 0; k < fmemptr; k++)
  {
    fmtfile.buffer=fontinfo[k];
    PUT_2 (fmtfile);
  }
  fmtfile.buffer._TAG._TAG1._int = fontptr;
  PUT_2 (fmtfile);
  for (k = 0; k <= fontptr; k++)
  {
    fmtfile.buffer._TAG._TAG4.qqqq=fontcheck[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = fontsize[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = fontdsize[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = fontparams[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = hyphenchar[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = skewchar[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = fontname[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = fontarea[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = fontbc[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = fontec[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = charbase[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = widthbase[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = heightbase[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = depthbase[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = italicbase[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = ligkernbase[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = kernbase[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = extenbase[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = parambase[k];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = fontglue[k];
    PUT_2 (fmtfile);
    F19_printnl (1111);
    F20_printesc (hash[3010 + k].rh);
    F16_printchar ((char)61);
    F25_printfilename (fontname[k], fontarea[k], 207);
    if (fontsize[k] != fontdsize[k])
    {
      F17_print (598);
      F67_printscaled (fontsize[k]);
      F17_print (263);
    }
  }
  F15_println ();
  F22_printint ((long)fmemptr - 7);
  F17_print (1109);
  F22_printint ((long)fontptr);
  F17_print (1110);
  if (fontptr != 1)
    F16_printchar ((char)115);
  fmtfile.buffer._TAG._TAG1._int = hyphcount;
  PUT_2 (fmtfile);
  for (k = 0; k <= 307; k++)
    if (hyphword[k] != 0)
    {
      fmtfile.buffer._TAG._TAG1._int = k;
      PUT_2 (fmtfile);
      fmtfile.buffer._TAG._TAG1._int = hyphword[k];
      PUT_2 (fmtfile);
      fmtfile.buffer._TAG._TAG1._int = hyphlist[k];
      PUT_2 (fmtfile);
    }
  fmtfile.buffer._TAG._TAG1._int = triemax;
  PUT_2 (fmtfile);
  for (k = 0; k <= triemax; k++)
  {
    fmtfile.buffer._TAG._TAG3.hh=trie[k];
    PUT_2 (fmtfile);
  }
  fmtfile.buffer._TAG._TAG1._int = trieopptr;
  PUT_2 (fmtfile);
  for (k = -127; k <= trieopptr; k++)
  {
    fmtfile.buffer._TAG._TAG1._int = hyfdistance[k + 128];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = hyfnum[k + 128];
    PUT_2 (fmtfile);
    fmtfile.buffer._TAG._TAG1._int = hyfnext[k + 128];
    PUT_2 (fmtfile);
  }
  F15_println ();
  F22_printint ((long)hyphcount);
  F17_print (1112);
  if (hyphcount != 1)
    F16_printchar ((char)115);
  F19_printnl (1113);
  F22_printint ((long)triemax);
  F17_print (1114);
  F22_printint ((long)trieopptr + 128);
  F17_print (1115);
  if (trieopptr != (-127))
    F16_printchar ((char)115);
  fmtfile.buffer._TAG._TAG1._int = interaction;
  PUT_2 (fmtfile);
  fmtfile.buffer._TAG._TAG1._int = formatident;
  PUT_2 (fmtfile);
  fmtfile.buffer._TAG._TAG1._int = 69069L;
  PUT_2 (fmtfile);
  eqtb[5298]._TAG._TAG1._int = 0L;
  CLOSE_2(fmtfile);
}
# endif

void F339_newwhatsit (s, w)
/******************/
T29_smallnumber s;
T29_smallnumber w;
{
  register int /* was T32_halfword */ p;
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  register T37_memoryword *memptr;
#endif

  p = F77_getnode ((long)w);
  memptr = &mem[p - C2_memmin];
  memptr->_TAG._TAG3.hh._TAG._TAG2.b0 = 8;
  memptr->_TAG._TAG3.hh._TAG._TAG2.b1 = s;
  curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = p;
}

void F340_newwritewhatsit (w)
/*********************/
T29_smallnumber w;
{
  F339_newwhatsit (curchr, w);
  if (w != 2)
    F165_scanfourbitint ();
  else
  {
    F162_scanint ();
    if (curval < 0L)
      curval = 17;
    else
      if (curval > 15L)
	curval = 16;
  }
  mem[curlist.tailfield + 1 - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = (int)curval;
}

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

  switch (curchr)
  {
    case 0: 
      F340_newwritewhatsit (3);
      F159_scanoptionalequals ();
      F189_scanfilename ();
      memptr = &mem[curlist.tailfield + 1 - C2_memmin];
      memptr->_TAG._TAG3.hh.rh = curname;
      (memptr+1)->_TAG._TAG3.hh._TAG._TAG1.lh = curarea;
      (memptr+1)->_TAG._TAG3.hh.rh = curext;
      break;
    case 1: 
      k = curcs;
      F340_newwritewhatsit (2);
      curcs = k;
      F177_scantoks (FALSE, FALSE);
      mem[curlist.tailfield + 1 - C2_memmin]._TAG._TAG3.hh.rh = defref;
      break;
    case 2: 
      F340_newwritewhatsit (2);
      mem[curlist.tailfield + 1 - C2_memmin]._TAG._TAG3.hh.rh = (int)(-32768);
      break;
    case 3: 
      F339_newwhatsit (3, 2);
      mem[curlist.tailfield + 1 - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = (int)(-32768);
      F177_scantoks (FALSE, TRUE);
      mem[curlist.tailfield + 1 - C2_memmin]._TAG._TAG3.hh.rh = defref;
      break;
    case 4: 
      F153_getxtoken (null);
      if ((curcmd == 59) && (curchr <= 2))
      {
	p = curlist.tailfield;
	F341_doextension ();
	F204_outwhat (curlist.tailfield);
	F109_flushnodelist (curlist.tailfield);
	curlist.tailfield = p;
	mem[p - C2_memmin]._TAG._TAG3.hh.rh = (int)(-32768);
      }
      else
	F134_backinput ();
      break;
    default: 
      F42_confusion (1134);
      break;
  }
}

void F342_handlerightbrace ()
/*********************/
{
#ifdef M_XENIX
  T37_memoryword huge *memptr, huge *memptr1;
#else
  register T37_memoryword *memptr,*memptr1;
#endif
  register long int   d;
  register long int   f;
  register int /* was T32_halfword */ p;
  register int /* was T32_halfword */ q;

  switch (curgroup)
  {
    case 1: 
      F135_unsave ();
      break;
    case 0: 
      F19_printnl (134);
      F17_print (892);
      helpptr = 2;
      helpline[1] = 893;
      helpline[0] = 894;
      F39_error ();
      break;
    case 14: 
    case 15: 
    case 16: 
      F284_extrarightbrace ();
      break;
    case 2: 
      F288_package (0);
      break;
    case 3: 
#ifdef TRIPTEX
      adjusttail = 2995;
#else
      adjusttail = 29995;
#endif
      F288_package (0);
      break;
    case 4: 
      F292_endgraf ();
      F288_package (0);
      break;
    case 5: 
      F292_endgraf ();
      F288_package (4);
      break;
    case 11: 
      F292_endgraf ();
      q = eqtb[3536]._TAG._TAG3.hh.rh;
      mem[q - C2_memmin]._TAG._TAG3.hh.rh++;
      d = eqtb[5707]._TAG._TAG1._int;
      f = eqtb[5309]._TAG._TAG1._int;
      F135_unsave ();
      saveptr--;
      p = F209_vpackage (mem[curlist.headfield - C2_memmin]._TAG._TAG3.hh.rh, 0L, 1, 1073741823);
      F113_popnest ();
      if (savestack[saveptr]._TAG._TAG1._int < 255)
      {
	curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F77_getnode (5L);
	memptr = &mem[p - C2_memmin];
	memptr1 = &mem[curlist.tailfield - C2_memmin];
	memptr1->_TAG._TAG3.hh._TAG._TAG2.b0 = 3;
	memptr1->_TAG._TAG3.hh._TAG._TAG2.b1 = savestack[saveptr]._TAG._TAG1._int - 128;
	(memptr1+3)->_TAG._TAG1._int = (memptr+3)->_TAG._TAG1._int + (memptr+2)->_TAG._TAG1._int;
	(memptr1+4)->_TAG._TAG3.hh._TAG._TAG1.lh = (memptr+5)->_TAG._TAG3.hh.rh;
	(memptr1+4)->_TAG._TAG3.hh.rh = q;
	(memptr1+2)->_TAG._TAG1._int = d;
	(memptr1+1)->_TAG._TAG1._int = f;
      }
      else
      {
	curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F77_getnode (2L);
	memptr = &mem[curlist.tailfield - C2_memmin];
	memptr->_TAG._TAG3.hh._TAG._TAG2.b0 = 5;
	memptr->_TAG._TAG3.hh._TAG._TAG2.b1 = 0;
	(memptr+1)->_TAG._TAG1._int = mem[p + 5 - C2_memmin]._TAG._TAG3.hh.rh;
	F108_deleteglueref (q);
      }
      F78_freenode (p, 7);
      if (nestptr == 0)
	F250_buildpage ();
      break;
    case 8: 
      if (curinput.locfield != ((int)(-32768)))
      {
	F19_printnl (134);
	F17_print (858);
	helpptr = 2;
	helpline[1] = 859;
	helpline[0] = 860;
	F39_error ();
	do
	  F29_gettoken (null)
	while (curinput.locfield != ((int)(-32768)));
      }
      F141_endtokenlist ();
      F292_endgraf ();
      F135_unsave ();
      outputactive = FALSE;
      insertpenalties = 0;
      if (eqtb[4577]._TAG._TAG3.hh.rh != ((int)(-32768)))
      {
	F19_printnl (134);
	F17_print (861);
	F20_printesc (275);
	F22_printint (255L);
	helpptr = 3;
	helpline[2] = 862;
	helpline[1] = 863;
	helpline[0] = 864;
	F272_boxerror ((T22_eightbits)255);
      }
      if (curlist.tailfield != curlist.headfield)
      {
	mem[pagetail - C2_memmin]._TAG._TAG3.hh.rh = mem[curlist.headfield - C2_memmin]._TAG._TAG3.hh.rh;
	pagetail = curlist.tailfield;
      }
#ifdef TRIPTEX
      if (m29998->_TAG._TAG3.hh.rh != ((int)(-32768)))
      {
	if (m29999->_TAG._TAG3.hh.rh == ((int)(-32768)))
	  nest[0].tailfield = pagetail;
	mem[pagetail - C2_memmin]._TAG._TAG3.hh.rh = m29999->_TAG._TAG3.hh.rh;
	m29999->_TAG._TAG3.hh.rh = m29998->_TAG._TAG3.hh.rh;
	m29998->_TAG._TAG3.hh.rh = (int)(-32768);
	pagetail = 2998;
#else
      if (m29998->_TAG._TAG3.hh.rh != ((int)(-32768)))
      {
	if (m29999->_TAG._TAG3.hh.rh == ((int)(-32768)))
	  nest[0].tailfield = pagetail;
	mem[pagetail - C2_memmin]._TAG._TAG3.hh.rh = m29999->_TAG._TAG3.hh.rh;
	m29999->_TAG._TAG3.hh.rh = m29998->_TAG._TAG3.hh.rh;
	m29998->_TAG._TAG3.hh.rh = (int)(-32768);
	pagetail = 29998;
#endif
      }
      F113_popnest ();
      F250_buildpage ();
      break;
    case 10: 
      F300_builddiscretionary ();
      break;
    case 6: 
      F134_backinput ();
      curtok = 7355;
      F19_printnl (134);
      F17_print (483);
      F20_printesc (752);
      F17_print (484);
      helpptr = 1;
      helpline[0] = 973;
      F143_inserror ();
      break;
    case 7: 
      F292_endgraf ();
      F135_unsave ();
      F240_alignpeek ();
      break;
    case 12: 
      F292_endgraf ();
      F135_unsave ();
      saveptr -= 2;
      p = F209_vpackage (mem[curlist.headfield - C2_memmin]._TAG._TAG3.hh.rh, savestack[saveptr + 1]._TAG._TAG1._int, (int)savestack[saveptr]._TAG._TAG1._int, 1073741823);
      F113_popnest ();
      curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F211_newnoad ();
      memptr = &mem[curlist.tailfield - C2_memmin];
      memptr->_TAG._TAG3.hh._TAG._TAG2.b0 = 29;
      (memptr+1)->_TAG._TAG3.hh.rh = 2;
      (memptr+1)->_TAG._TAG3.hh._TAG._TAG1.lh = p;
      break;
    case 13: 
      F318_buildchoices ();
      break;
    case 9: 
      F135_unsave ();
      mem[savestack[--saveptr]._TAG._TAG1._int - C2_memmin]._TAG._TAG3.hh.rh = 3;
      p = F317_finmlist ((int)(-32768));
      mem[savestack[saveptr]._TAG._TAG1._int - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = p;
      if (p != ((int)(-32768)))
      {
	memptr = &mem[p - C2_memmin];
	if (memptr->_TAG._TAG3.hh.rh == ((int)(-32768)))
	  if (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 == 16)
	  {
	    if ((memptr+3)->_TAG._TAG3.hh.rh == 0)
	      if ((memptr+2)->_TAG._TAG3.hh.rh == 0)
	      {
		mem[savestack[saveptr]._TAG._TAG1._int - C2_memmin]._TAG._TAG3.hh=(memptr+1)->_TAG._TAG3.hh;
		F78_freenode (p, 4);
	      }
	  }
	  else
	    if (memptr->_TAG._TAG3.hh._TAG._TAG2.b0 == 28)
	      if (savestack[saveptr]._TAG._TAG1._int == (curlist.tailfield + 1))
		if (mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 == 16)
		{
		  register int shelp;
		  q = curlist.headfield;
		  while ((shelp=mem[q - C2_memmin]._TAG._TAG3.hh.rh) != curlist.tailfield)
		    q = shelp;
		  mem[q - C2_memmin]._TAG._TAG3.hh.rh = p;
		  F78_freenode (curlist.tailfield, 4);
		  curlist.tailfield = p;
		}
      }
      break;
    default: 
      F42_confusion (895);
      break;
  }
}

void F343_maincontrol ()
/****************/
{
  register int help;
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  register T37_memoryword *memptr;
#endif
  register T22_eightbits c;
  register T43_internalfontnumber f;
  register T36_fourquarters i;
  register T36_fourquarters j;
  register long int   k;
  register T31_quarterword l;
  register BOOLEAN ligaturepresent;
  register int /* was T32_halfword */ p;
  register int /* was T32_halfword */ q;
  register int /* was T32_halfword */ r;
  register int   s;
  register int   t;

  if (eqtb[4063]._TAG._TAG3.hh.rh != -32768)
    F140_begintokenlist (eqtb[4063]._TAG._TAG3.hh.rh, (char)12);
_60: 
  F153_getxtoken (null);
_21: 
  if (interrupt != 0)
    if (oktointerrupt)
    {
      F134_backinput ();
      if (interrupt != 0)
	F64_pauseforinstructions ();
      goto _60;
    }
#if defined(INITEX) || defined(TRIPTEX)
  if (panicking)
    F91_checkmem (FALSE);
# endif
  if (eqtb[5303]._TAG._TAG1._int > 0L)
    F139_showcurcmdchr ();
  help = curlist.modefield;
  if (help<0)
    help = -help;
  switch (help + curcmd)
  {
    case 112: 
    case 113: 
    case 168: 
      goto _70;
      break;
    case 117: 
      F166_scancharnum ();
      curchr = curval;
      goto _70;
      break;
    case 111: 
      if (curlist.auxfield == 1000)
	goto _74;
      else
	F275_appspace ();
      break;
    case 165: 
    case 265: 
      goto _74;
      break;
    case 1: 
    case 101: 
    case 201: 
    case 11: 
    case 211: 
      break;
    case 40: 
    case 140: 
    case 240: 
      do
	F153_twogetxtoken (null)
      while (curcmd == 10);
      goto _21;
      break;
    case 15: 
      if (F280_itsallover ())
	return;
      break;
    case 23: 
    case 122: 
    case 222: 
    case 70: 
    case 170: 
    case 270: 
    case 39: 
    case 45: 
    case 49: 
    case 149: 
    case 7: 
    case 107: 
    case 207: 
      F278_reportillegalcase ();
      break;
    case 8: 
    case 108: 
    case 9: 
    case 109: 
    case 18: 
    case 118: 
    case 69: 
    case 169: 
    case 51: 
    case 151: 
    case 16: 
    case 116: 
    case 50: 
    case 150: 
    case 53: 
    case 153: 
    case 66: 
    case 166: 
    case 54: 
    case 154: 
    case 55: 
    case 155: 
    case 57: 
    case 157: 
    case 56: 
    case 156: 
    case 31: 
    case 131: 
    case 52: 
    case 152: 
    case 29: 
    case 129: 
    case 47: 
    case 147: 
    case 210: 
    case 214: 
    case 215: 
    case 228: 
    case 225: 
    case 234: 
    case 237: 
      F276_insertdollarsign ();
      break;
    case 37: 
    case 136: 
    case 236: 
      curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F174_scanrulespec ();
      if ((curlist.modefield== 1)||(curlist.modefield== -1))
	curlist.auxfield = -65536000;
      else
	if ((curlist.modefield == 101)||(curlist.modefield== -101))
	  curlist.auxfield = 1000;
      break;
    case 28: 
    case 127: 
    case 227: 
    case 229: 
      F281_appendglue ();
      break;
    case 30: 
    case 130: 
    case 230: 
    case 231: 
      F282_appendkern ();
      break;
    case 2: 
    case 102: 
      F125_newsavelevel (1);
      break;
    case 62: 
    case 162: 
    case 262: 
      F125_newsavelevel (14);
      break;
    case 63: 
    case 163: 
    case 263: 
      if (curgroup == 14)
	F135_unsave ();
      else
	F283_offsave ();
      break;
    case 3: 
    case 103: 
    case 203: 
      F342_handlerightbrace ();
      break;
    case 22: 
    case 123: 
    case 223: 
      t = curchr;
      F172_scandimen (FALSE, FALSE, FALSE);
      if (t == 0)
	savestack[saveptr]._TAG._TAG1._int = curval;
      else
	savestack[saveptr]._TAG._TAG1._int = -curval;
      F287_scanbox ();
      break;
    case 32: 
    case 132: 
    case 232: 
      savestack[saveptr]._TAG._TAG1._int = 1073742237 + curchr;
      F287_scanbox ();
      break;
    case 21: 
    case 121: 
    case 221: 
      savestack[saveptr]._TAG._TAG1._int = 0L;
      F286_beginbox ();
      break;
    case 44: 
      F289_newgraf (curchr > 0);
      break;
    case 12: 
    case 13: 
    case 17: 
    case 68: 
    case 4: 
    case 24: 
    case 36: 
    case 46: 
    case 48: 
    case 27: 
    case 34: 
    case 65: 
      F134_backinput ();
      F289_newgraf (TRUE);
      break;
    case 144: 
    case 244: 
      F290_indentinhmode ();
      break;
    case 14: 
      F241_normalparagraph ();
      if (curlist.modefield > 0)
	F250_buildpage ();
      break;
    case 114: 
      if (alignstate < 0)
	F283_offsave ();
      F292_endgraf ();
      if (curlist.modefield == 1)
	F250_buildpage ();
      break;
    case 115: 
    case 128: 
    case 137: 
    case 125: 
    case 133: 
      F291_headforvmode ();
      break;
    case 38: 
    case 138: 
    case 238: 
    case 139: 
    case 239: 
      F293_begininsertoradjust ();
      break;
    case 19: 
    case 119: 
    case 219: 
      F294_makemark ();
      break;
    case 43: 
    case 143: 
    case 243: 
      F295_appendpenalty ();
      break;
    case 26: 
    case 126: 
    case 226: 
      F296_deletelast ();
      break;
    case 25: 
    case 124: 
    case 224: 
      F297_unpackage ();
      break;
    case 145: 
      F298_appenditaliccorrecti ();
      break;
    case 245: 
      curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F89_newkern (0L);
      break;
    case 148: 
    case 248: 
      F299_appenddiscretionary ();
      break;
    case 146: 
      F301_makeaccent ();
      break;
    case 6: 
    case 106: 
    case 206: 
    case 5: 
    case 105: 
    case 205: 
      F302_alignerror ();
      break;
    case 35: 
    case 135: 
    case 235: 
      F303_noalignerror ();
      break;
    case 64: 
    case 164: 
    case 264: 
      F304_omiterror ();
      break;
    case 33: 
    case 134: 
      F242_initalign ();
      break;
    case 233: 
      if (F279_privileged ())
	F242_initalign ();
      break;
    case 10: 
    case 110: 
      F305_doendv ();
      break;
    case 67: 
    case 167: 
    case 267: 
      F306_cserror ();
      break;
    case 104: 
      F308_initmath ();
      break;
    case 249: 
      if (F279_privileged ())
	F309_starteqno ();
      break;
    case 202: 
      curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F211_newnoad ();
      F134_backinput ();
      F310_scanmath (curlist.tailfield + 1);
      break;
    case 212: 
    case 213: 
    case 268: 
      if (curchr < 128)
	F311_setmathchar ((long)eqtb[5139 + curchr]._TAG._TAG3.hh.rh + 32768L);
      else
	F311_setmathchar ((long)curchr);
      break;
    case 217: 
      F166_scancharnum ();
      curchr = curval;
      if (curchr < 128)
	F311_setmathchar ((long)eqtb[5139 + curchr]._TAG._TAG3.hh.rh + 32768L);
      else
	F311_setmathchar ((long)curchr);
      break;
    case 218: 
      F167_scanfifteenbitint ();
      F311_setmathchar (curval);
      break;
    case 269: 
      F311_setmathchar ((long)curchr);
      break;
    case 216: 
      F168_scantwentysevenbitin ();
#ifdef NOSHIFT
      F311_setmathchar (curval / 4096);
#else
      F311_setmathchar (curval >> 12);
#endif
      break;
    case 251: 
      curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F211_newnoad ();
      mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 = curchr;
      F310_scanmath (curlist.tailfield + 1);
      break;
    case 252: 
      F312_mathlimitswitch ();
      break;
    case 266: 
      F314_mathradical ();
      break;
    case 246: 
    case 247: 
      F315_mathac ();
      break;
    case 257: 
      F207_scanspec ();
      F125_newsavelevel (12);
      F241_normalparagraph ();
      F112_pushnest ();
      curlist.modefield = -1;
      curlist.auxfield = -65536000;
      if (eqtb[4062]._TAG._TAG3.hh.rh != -32768)
	F140_begintokenlist (eqtb[4062]._TAG._TAG3.hh.rh, (char)11);
      break;
    case 254: 
      curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F212_newstyle (curchr);
      break;
    case 256: 
#ifdef TRIPTEX
      curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F87_newglue(1);
#else
      curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F87_newglue (-30000);
#endif
      mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b1 = 98;
      break;
    case 255: 
      F316_appendchoices ();
      break;
    case 209: 
    case 208: 
      F319_subsup ();
      break;
    case 253: 
      F320_mathfraction ();
      break;
    case 250: 
      F321_mathleftright ();
      break;
    case 204: 
      if (curgroup == 15)
	F322_aftermath ();
      else
	F283_offsave ();
      break;
    case 71: 
    case 171: 
    case 271: 
    case 72: 
    case 172: 
    case 272: 
    case 73: 
    case 173: 
    case 273: 
    case 74: 
    case 174: 
    case 274: 
    case 75: 
    case 175: 
    case 275: 
    case 76: 
    case 176: 
    case 276: 
    case 77: 
    case 177: 
    case 277: 
    case 78: 
    case 178: 
    case 278: 
    case 79: 
    case 179: 
    case 279: 
    case 80: 
    case 180: 
    case 280: 
    case 81: 
    case 181: 
    case 281: 
    case 82: 
    case 182: 
    case 282: 
    case 83: 
    case 183: 
    case 283: 
    case 84: 
    case 184: 
    case 284: 
    case 85: 
    case 185: 
    case 285: 
    case 86: 
    case 186: 
    case 286: 
    case 87: 
    case 187: 
    case 287: 
    case 88: 
    case 188: 
    case 288: 
    case 89: 
    case 189: 
    case 289: 
    case 90: 
    case 190: 
    case 290: 
    case 91: 
    case 191: 
    case 291: 
    case 92: 
    case 192: 
    case 292: 
    case 93: 
    case 193: 
    case 293: 
    case 94: 
    case 194: 
    case 294: 
    case 95: 
    case 195: 
    case 295: 
    case 96: 
    case 196: 
    case 296: 
    case 97: 
    case 197: 
    case 297: 
    case 98: 
    case 198: 
    case 298: 
    case 99: 
    case 199: 
    case 299: 
    case 100: 
    case 200: 
    case 300: 
      F333_prefixedcommand ();
      break;
    case 41: 
    case 141: 
    case 241: 
      F29_gettoken (null);
      aftertoken = curtok;
      break;
    case 42: 
    case 142: 
    case 242: 
      F29_gettoken (null);
      F132_saveforafter (curtok);
      break;
    case 61: 
    case 161: 
    case 261: 
      F334_openorclosein ();
      break;
    case 59: 
    case 159: 
    case 259: 
      F335_issuemessage ();
      break;
    case 58: 
    case 158: 
    case 258: 
      F336_shiftcase ();
      break;
    case 20: 
    case 120: 
    case 220: 
      F337_showwhatever ();
      break;
    case 60: 
    case 160: 
    case 260: 
      F341_doextension ();
      break;
  }
  goto _60;
_70: 
  f = eqtb[4578]._TAG._TAG3.hh.rh;
  c = curchr;
_71: 
  if ((c < fontbc[f]) || (c > fontec[f]))
  {
    F193_charwarning (f, (T22_eightbits)c);
    goto _60;
  }
_72: 
  q = curlist.tailfield;
  ligaturepresent = FALSE;
  l = c - 128;
_73: 
  if (c < 128)
  {
    s = eqtb[5011 + c]._TAG._TAG3.hh.rh;
    if (s == 1000)
      curlist.auxfield = 1000;
    else
      if (s < 1000)
      {
	if (s > 0)
	  curlist.auxfield = s;
      }
      else
	if (curlist.auxfield < 1000)
	  curlist.auxfield = 1000;
	else
	  curlist.auxfield = s;
  }
  else
    curlist.auxfield = 1000;
  i=fontinfo[charbase[f] + l]._TAG._TAG4.qqqq;
  if (i.b0 > (-128))
  {
    p = avail;
    if (p == -32768)
      p = F75_getavail ();
    else
    {
      memptr = &mem[p - C2_memmin];
      avail = memptr->_TAG._TAG3.hh.rh;
      memptr->_TAG._TAG3.hh.rh = -32768;
#if defined(INITEX) || defined(TRIPTEX)
      dynused++;
# endif
    }
    memptr = &mem[p - C2_memmin];
    memptr->_TAG._TAG3.hh._TAG._TAG2.b0 = f;
    memptr->_TAG._TAG3.hh._TAG._TAG2.b1 = c - 128;
    curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = p;
  }
  else
    F193_charwarning (f, (T22_eightbits)(l + 128));
  F147_getnext ();
  if ((curcmd == 11)||(curcmd ==12)||(curcmd == 67))
    r = curchr - 128;
  else
  {
    F157_xtoken (null);
    if (((curcmd == 11) || (curcmd == 12)) || (curcmd == 67))
      r = curchr - 128;
    else
      if (curcmd == 16)
      {
	F166_scancharnum ();
	r = curval - 128;
      }
      else
	r = 128;
  }
  if (((i.b2 + 128) & 3) == 1)
    if (r != 128)
    {
      k = ligkernbase[f] + i.b3;
      do
      {
	j=fontinfo[k]._TAG._TAG4.qqqq;
	if (j.b1 == r)
	  if (j.b2 < 0)
	  {
	    ligaturepresent = TRUE;
	    l = j.b3;
	    c = r + 128;
	    goto _73;
	  }
	  else
	  {
	    if (ligaturepresent)
	    {
	      p = F82_newligature ((T31_quarterword)f, l, mem[q - C2_memmin]._TAG._TAG3.hh.rh);
	      mem[q - C2_memmin]._TAG._TAG3.hh.rh = p;
	      curlist.tailfield = p;
	    }
	    if (c == hyphenchar[f])
	      if (curlist.modefield == 101)
	      {
		curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F83_newdisc ();
	      }
	    curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F89_newkern (fontinfo[kernbase[f] + j.b3]._TAG._TAG1._int);
	    c = r + 128;
	    goto _72;
	  }
	k++;
      }
      while (j.b0 < 0);
    }
  if (ligaturepresent)
  {
    memptr = &mem[q - C2_memmin];
    p = F82_newligature ((T31_quarterword)f, l, memptr->_TAG._TAG3.hh.rh);
    curlist.tailfield = memptr->_TAG._TAG3.hh.rh = p;
  }
  if (c == hyphenchar[f])
    if (curlist.modefield == 101)
    {
      curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = F83_newdisc ();
    }
  if (r == 128)
    goto _21;
  c = r + 128;
  goto _71;
_74: 
#ifdef TRIPTEX
  if (eqtb[3538]._TAG._TAG3.hh.rh == 1)
#else
  if (eqtb[3538]._TAG._TAG3.hh.rh == (-30000))
#endif
  {
    if ((p = fontglue[eqtb[4578]._TAG._TAG3.hh.rh]) == -32768)
    {
      f = eqtb[4578]._TAG._TAG3.hh.rh;
#ifdef TRIPTEX
      p = F85_newspec (1);
#else
      p = F85_newspec (-30000);
#endif
      k = parambase[f] + 2;
      mem[p + 1 - C2_memmin]._TAG._TAG1._int = fontinfo[k]._TAG._TAG1._int;
      mem[p + 2 - C2_memmin]._TAG._TAG1._int = fontinfo[k + 1]._TAG._TAG1._int;
      mem[p + 3 - C2_memmin]._TAG._TAG1._int = fontinfo[k + 2]._TAG._TAG1._int;
      fontglue[f] = p;
    }
    q = F87_newglue (p);
  }
  else
    q = F86_newparamglue (12);
  curlist.tailfield = mem[curlist.tailfield - C2_memmin]._TAG._TAG3.hh.rh = q;
  goto _60;
}
