#include "externs.h"

#ifdef M_XENIX
#define GET_3(F)	if (read((int)F.fp,&F.buffer,sizeof(F.buffer))<sizeof(F.buffer)) F.eof=TRUE;
#else
#define GET_3(F)	GET_2(F)
#endif

void F36_giveerrhelp ()
/***************/
{
  register int p;
  p = eqtb[4065]._TAG._TAG3.hh.rh;
  if (p != ((int)(-32768)))
    F73_showtokenlist (mem[p - C2_memmin]._TAG._TAG3.hh.rh, (int)(-32768), 1000L);
}

BOOLEAN F344_openfmtfile ()
/************************/
{
  register int   j;

  j = curinput.locfield;
  if (buffer[curinput.locfield] == 38)
  {
    curinput.locfield++;
    j = curinput.locfield;
    buffer[last] = ' ';
    while ((buffer[j] != ' ')&&(buffer[j] != '\0'))
      j++;
    F184_packbufferedname (0, curinput.locfield, j - 1);
    if (F47_wopenin (&fmtfile))
      goto _40;
    printf ("%s", "Sorry, I can\'t find that format;");
    printf ("%s", " will try PLAIN.");
    printf ("\n");
    fflush(stdout);
  }
  F184_packbufferedname (5, 1, 0);
  if (!F47_wopenin (&fmtfile))
  {
    printf ("%s", "I can\'t find the PLAIN format file!");
    printf ("\n");
    return(FALSE);
  }
_40: 
  curinput.locfield = j;
  return(TRUE);
}

BOOLEAN F345_loadfmtfile ()
/************************/
{
  long int   j;
  long int   k;
  int /* was T32_halfword */ p;
  int /* was T32_halfword */ q;
  T36_fourquarters w;
  long int   x;
  long int help;

  x = fmtfile.buffer._TAG._TAG1._int;
  if (x != 315565539)
    goto _6666;
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
#ifdef TRIPTEX
  if (x != 1L)
#else
  if (x != (-30000L))
#endif
    goto _6666;
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
#ifdef TRIPTEX
  if (x != 3000L)
#else
  if (x != 30000L)
#endif
    goto _6666;
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if (x != 5976L)
    goto _6666;
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if (x != 2551)
    goto _6666;
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if (x != 307)
    goto _6666;
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if (x < 0)
    goto _6666;
  if (x > C15_poolsize)
  {
    printf ("%s", "---! Must increase the ");
    printf ("%s", "string pool size");
    printf ("\n");
    goto _6666;
  }
  else
    poolptr = x;
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if (x < 0)
    goto _6666;
  if (x > C13_maxstrings)
  {
    printf ("%s", "---! Must increase the ");
    printf ("%s", "max strings");
    printf ("\n");
    goto _6666;
  }
  else
    strptr = x;
  for (k = 0; k <= strptr; k++)
  {
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x < 0) || (x > poolptr))
      goto _6666;
    else
      strstart[k] = x;
  }
  k = 0;
  while ((k + 4) < poolptr)
  {
    GET_3 (fmtfile);
    w=fmtfile.buffer._TAG._TAG4.qqqq;
    strpool[k] = w.b0;
    strpool[k + 1] = w.b1;
    strpool[k + 2] = w.b2;
    strpool[k + 3] = w.b3;
    k+=4;
  }
  k = poolptr - 4;
  GET_3 (fmtfile);
  w=fmtfile.buffer._TAG._TAG4.qqqq;
  strpool[k] = w.b0;
  strpool[k + 1] = w.b1;
  strpool[k + 2] = w.b2;
  strpool[k + 3] = w.b3;
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
#ifdef TRIPTEX
  if ((x < 1020) || (x > 2986))
#else
  if ((x < (-28981)) || (x > 29986))
#endif
    goto _6666;
  else
    lomemmax = x;
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
#ifdef TRIPTEX
  if ((x < 21) || (x > lomemmax))
#else
  if ((x < (-29980)) || (x > lomemmax))
#endif
    goto _6666;
  else
    rover = x;
#ifdef TRIPTEX
  p = 1;
#else
  p = -30000;
#endif
  q = rover;
  x = 0;
  do
  {
    for (k = p-1; k <= q; k++)
    {
      GET_3 (fmtfile);
      mem[k + 1 - C2_memmin]=fmtfile.buffer;
    }
    p = (long)q + mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh;
    if ((p > lomemmax) || ((q >= mem[q + 1 - C2_memmin]._TAG._TAG3.hh.rh) && (mem[q + 1 - C2_memmin]._TAG._TAG3.hh.rh != rover)))
      goto _6666;
    q = mem[q + 1 - C2_memmin]._TAG._TAG3.hh.rh;
  }
  while (q != rover);
  for (k = p; k <= lomemmax; k++)
  {
    GET_3 (fmtfile);
    mem[k - C2_memmin]=fmtfile.buffer;
  }
#ifdef TRIPTEX
  if (C2_memmin < (-1))
#else
  if (C2_memmin < (-30002))
#endif
  {
    p = mem[rover + 1 - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh;
    q = C2_memmin + 1;
    mem[C2_memmin - C2_memmin]._TAG._TAG3.hh.rh = (int)(-32768);
    mem[C2_memmin - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = (int)(-32768);
    mem[p + 1 - C2_memmin]._TAG._TAG3.hh.rh = q;
    mem[rover + 1 - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = q;
    mem[q + 1 - C2_memmin]._TAG._TAG3.hh.rh = rover;
    mem[q + 1 - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = p;
    mem[q - C2_memmin]._TAG._TAG3.hh.rh = 32767;
#ifdef TRIPTEX
    mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = 1 - q;
#else
    mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = (-30000) - q;
#endif
  }
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
#ifdef TRIPTEX
  if ((x <= lomemmax) || (x > 2987))
#else
  if ((x <= lomemmax) || (x > 29987))
#endif
    goto _6666;
  else
    himemmin = x;
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
#ifdef TRIPTEX
  if ((x < ((int)(-32768))) || (x > 3000))
#else
  if ((x < ((int)(-32768))) || (x > 30000))
#endif
    goto _6666;
  else
    avail = x;
#ifdef TRIPTEX
  memend = 3000;
#else
  memend = 30000;
#endif
  for (k = himemmin; k <= memend; k++)
  {
    GET_3 (fmtfile);
    mem[k - C2_memmin]=fmtfile.buffer;
  }
  GET_3 (fmtfile);
  varused = fmtfile.buffer._TAG._TAG1._int;
  GET_3 (fmtfile);
  dynused = fmtfile.buffer._TAG._TAG1._int;
  k = 1;
  do
  {
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x < 1) || ((k + x) > 5977))
      goto _6666;
    help=k+x;
    for (j = k; j < help; j++)
    {
      GET_3 (fmtfile);
      eqtb[j]=fmtfile.buffer;
    }
    k += x;
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x < 0) || ((k + x) > 5977))
      goto _6666;
    help=k+x;
    for (j = k; j < help; j++)
      eqtb[j]=eqtb[k - 1];
    k += x;
  }
  while (k <= 5976);
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if ((x < 258) || (x > 3258))
    goto _6666;
  else
    parloc = x;
  partoken = 4096 + parloc;
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if ((x < 258) || (x > 3258))
    goto _6666;
  else
    writeloc = x;
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if ((x < 258) || (x > 3258))
    goto _6666;
  else
    hashused = x;
  p = 257;
  do
  {
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x <= p) || (x > hashused))
      goto _6666;
    else
      p = x;
    GET_3 (fmtfile);
    hash[p - 258]=fmtfile.buffer._TAG._TAG3.hh;
  }
  while (p != hashused);
  for (p = hashused + 1; p <= 3524; p++)
  {
    GET_3 (fmtfile);
    hash[p - 258]=fmtfile.buffer._TAG._TAG3.hh;
  }
  GET_3 (fmtfile);
  cscount = fmtfile.buffer._TAG._TAG1._int;
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if (x < 7)
    goto _6666;
  if (x > C10_fontmemsize)
  {
    printf ("%s", "---! Must increase the ");
    printf ("%s", "font mem size");
    printf ("\n");
    goto _6666;
  }
  else
    fmemptr = x;
  for (k = 0; k < fmemptr; k++)
  {
    GET_3 (fmtfile);
    fontinfo[k]=fmtfile.buffer;
  }
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if (x < 0)
    goto _6666;
  if (x > C9_fontmax)
  {
    printf ("%s", "---! Must increase the ");
    printf ("%s", "font max");
    printf ("\n");
    goto _6666;
  }
  else
    fontptr = x;
  for (k = 0; k <= fontptr; k++)
  {
    GET_3 (fmtfile);
    fontcheck[k]=fmtfile.buffer._TAG._TAG4.qqqq;
    GET_3 (fmtfile);
    fontsize[k] = fmtfile.buffer._TAG._TAG1._int;
    GET_3 (fmtfile);
    fontdsize[k] = fmtfile.buffer._TAG._TAG1._int;
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x < ((int)(-32768))) || (x > 32767))
      goto _6666;
    else
      fontparams[k] = x;
    GET_3 (fmtfile);
    hyphenchar[k] = fmtfile.buffer._TAG._TAG1._int;
    GET_3 (fmtfile);
    skewchar[k] = fmtfile.buffer._TAG._TAG1._int;
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x < 0) || (x > strptr))
      goto _6666;
    else
      fontname[k] = x;
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x < 0) || (x > strptr))
      goto _6666;
    else
      fontarea[k] = x;
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x < 0) || (x > 255))
      goto _6666;
    else
      fontbc[k] = x;
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x < 0) || (x > 255))
      goto _6666;
    else
      fontec[k] = x;
    GET_3 (fmtfile);
    charbase[k] = fmtfile.buffer._TAG._TAG1._int;
    GET_3 (fmtfile);
    widthbase[k] = fmtfile.buffer._TAG._TAG1._int;
    GET_3 (fmtfile);
    heightbase[k] = fmtfile.buffer._TAG._TAG1._int;
    GET_3 (fmtfile);
    depthbase[k] = fmtfile.buffer._TAG._TAG1._int;
    GET_3 (fmtfile);
    italicbase[k] = fmtfile.buffer._TAG._TAG1._int;
    GET_3 (fmtfile);
    ligkernbase[k] = fmtfile.buffer._TAG._TAG1._int;
    GET_3 (fmtfile);
    kernbase[k] = fmtfile.buffer._TAG._TAG1._int;
    GET_3 (fmtfile);
    extenbase[k] = fmtfile.buffer._TAG._TAG1._int;
    GET_3 (fmtfile);
    parambase[k] = fmtfile.buffer._TAG._TAG1._int;
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x < ((int)(-32768))) || (x > lomemmax))
      goto _6666;
    else
      fontglue[k] = x;
  }
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if ((x < 0) || (x > 307))
    goto _6666;
  else
    hyphcount = x;
  for (k = 1; k <= hyphcount; k++)
  {
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x < 0) || (x > 307))
      goto _6666;
    else
      j = x;
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x < 0) || (x > strptr))
      goto _6666;
    else
      hyphword[j] = x;
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x < ((int)(-32768))) || (x > 32767))
      goto _6666;
    else
      hyphlist[j] = x;
  }
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if (x < 0)
    goto _6666;
  if (x > C17_triesize)
  {
    printf ("%s", "---! Must increase the ");
    printf ("%s", "trie size");
    printf ("\n");
    goto _6666;
  }
  else
    triemax = x;
  for (k = 0; k <= triemax; k++)
  {
    GET_3 (fmtfile);
    trie[k]=fmtfile.buffer._TAG._TAG3.hh;
  }
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if ((x < (-128)) || (x > 127))
    goto _6666;
  else
    trieopptr = x;
  for (k = -127; k <= trieopptr; k++)
  {
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x < 0) || (x > 63))
      goto _6666;
    else
      hyfdistance[k + 128] = x;
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x < 0) || (x > 63))
      goto _6666;
    else
      hyfnum[k + 128] = x;
    GET_3 (fmtfile);
    x = fmtfile.buffer._TAG._TAG1._int;
    if ((x < (-128)) || (x > 127))
      goto _6666;
    else
      hyfnext[k + 128] = x;
  }
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if ((x < 0) || (x > 3))
    goto _6666;
  else
    interaction = x;
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if ((x < 0) || (x > strptr))
    goto _6666;
  else
    formatident = x;
  GET_3 (fmtfile);
  x = fmtfile.buffer._TAG._TAG1._int;
  if ((x != 69069) || EOF_(fmtfile))
    goto _6666;
  return(TRUE);
_6666: 
  printf ("(Fatal format file error; I\'m stymied)\n");
  return(FALSE);
}

void F34_closefilesandtermina ()
/************************/
{
  register int   k;

  for (k = 0; k <= 15; k++)
    if (writeopen[k])
      CLOSE_2(writefile[k]);
#if defined(INITEX) || defined(TRIPTEX)
  if (eqtb[5298]._TAG._TAG1._int > 0)
    if (jobname > 0)
    {
      fprintf (logfile.fp, "%c", ' ');
      fprintf (logfile.fp, "\n");
      fprintf (logfile.fp, "%s", "Here is how much of TeX\'s memory");
      fprintf (logfile.fp, "%s", " you used:");
      fprintf (logfile.fp, "\n");
      fprintf (logfile.fp, "%c", ' ');
      fprintf (logfile.fp, "%1d", strptr - initstrptr);
      fprintf (logfile.fp, "%s", " string");
      if (strptr != (initstrptr + 1))
	fprintf (logfile.fp, "%c", 's');
      fprintf (logfile.fp, "%s", " out of ");
      fprintf (logfile.fp, "%1d", C13_maxstrings - initstrptr);
      fprintf (logfile.fp, "\n");
      fprintf (logfile.fp, "%c", ' ');
      fprintf (logfile.fp, "%1d", poolptr - initpoolptr);
      fprintf (logfile.fp, "%s", " string characters out of ");
      fprintf (logfile.fp, "%1d", C15_poolsize - initpoolptr);
      fprintf (logfile.fp, "\n");
      fprintf (logfile.fp, "%c", ' ');
      fprintf (logfile.fp, "%1d", (((lomemmax - C2_memmin) + memend) - himemmin) + 2);
      fprintf (logfile.fp, "%s", " words of memory out of ");
      fprintf (logfile.fp, "%1d", (memend + 1) - C2_memmin);
      fprintf (logfile.fp, "\n");
      fprintf (logfile.fp, "%c", ' ');
      fprintf (logfile.fp, "%1d", cscount);
      fprintf (logfile.fp, "%s", " multiletter control sequences out of ");
      fprintf (logfile.fp, "%1d", 3000);
      fprintf (logfile.fp, "\n");
      fprintf (logfile.fp, "%c", ' ');
      fprintf (logfile.fp, "%1d", fmemptr);
      fprintf (logfile.fp, "%s", " words of font info for ");
      fprintf (logfile.fp, "%1d", fontptr - 0);
      fprintf (logfile.fp, "%s", " font");
      if (fontptr != 1)
	fprintf (logfile.fp, "%c", 's');
      fprintf (logfile.fp, "%s", ", out of ");
      fprintf (logfile.fp, "%1d", C10_fontmemsize);
      fprintf (logfile.fp, "%s", " for ");
      fprintf (logfile.fp, "%1d", C9_fontmax - 0);
      fprintf (logfile.fp, "\n");
      fprintf (logfile.fp, "%c", ' ');
      fprintf (logfile.fp, "%1d", hyphcount);
      fprintf (logfile.fp, "%s", " hyphenation exception");
      if (hyphcount != 1)
	fprintf (logfile.fp, "%c", 's');
      fprintf (logfile.fp, "%s", " out of ");
      fprintf (logfile.fp, "%1d", 307);
      fprintf (logfile.fp, "\n");
      fprintf (logfile.fp, "%c", ' ');
      fprintf (logfile.fp, "%1d", maxinstack);
      fprintf (logfile.fp, "%s", "i,");
      fprintf (logfile.fp, "%1d", maxneststack);
      fprintf (logfile.fp, "%s", "n,");
      fprintf (logfile.fp, "%1d", maxparamstack);
      fprintf (logfile.fp, "%s", "p,");
      fprintf (logfile.fp, "%1d", maxbufstack + 1);
      fprintf (logfile.fp, "%s", "b,");
      fprintf (logfile.fp, "%1d", maxsavestack + 6);
      fprintf (logfile.fp, "%s", "s stack positions out of ");
      fprintf (logfile.fp, "%1d", C7_stacksize);
      fprintf (logfile.fp, "%s", "i,");
      fprintf (logfile.fp, "%1d", C12_nestsize);
      fprintf (logfile.fp, "%s", "n,");
      fprintf (logfile.fp, "%1d", C11_paramsize);
      fprintf (logfile.fp, "%s", "p,");
      fprintf (logfile.fp, "%1d", C3_bufsize);
      fprintf (logfile.fp, "%s", "b,");
      fprintf (logfile.fp, "%1d", C16_savesize);
      fprintf (logfile.fp, "%c", 's');
      fprintf (logfile.fp, "\n");
    }
# endif
  if (totalpages == 0)
    F19_printnl (690);
  else
  {
    dvibuf[dviptr++] = 248;
    if (dviptr == dvilimit)
      F195_dviswap ();
    F196_dvifour (lastbop);
    lastbop = (dvioffset + dviptr) - 5;
    F196_dvifour (25400000);
    F196_dvifour (473628672);
    F136_preparemag ();
    F196_dvifour (eqtb[5284]._TAG._TAG1._int);
    F196_dvifour (maxv);
    F196_dvifour (maxh);
    dvibuf[dviptr++] = maxpush >> 8;
    if (dviptr == dvilimit)
      F195_dviswap ();
    dvibuf[dviptr++] = maxpush & 255;
    if (dviptr == dvilimit)
      F195_dviswap ();
    dvibuf[dviptr++] = totalpages >> 8;
    if (dviptr == dvilimit)
      F195_dviswap ();
    dvibuf[dviptr++] = totalpages & 255;
    if (dviptr == dvilimit)
      F195_dviswap ();
    while (fontptr > 0)
    {
      if (fontused[fontptr])
	F198_dvifontdef (fontptr);
      fontptr--;
    }
    dvibuf[dviptr++] = 249;
    if (dviptr == dvilimit)
      F195_dviswap ();
    F196_dvifour (lastbop);
    dvibuf[dviptr++] = 2;
    if (dviptr == dvilimit)
      F195_dviswap ();
    k = 4 + ((C18_dvibufsize - dviptr) & 3);
    while (k > 0)
    {
      dvibuf[dviptr++] = 223;
      if (dviptr == dvilimit)
	F195_dviswap ();
      k--;
    }
    if (dvilimit == C18_halfbufsize)
      write(dvifile,&dvibuf[C18_halfbufsize],C18_halfbufsize);
    if (dviptr > 0)
      write(dvifile,dvibuf,dviptr);
    F19_printnl (691);
    F17_print (outputfilename);
    F17_print (156);
    F22_printint ((long)totalpages);
    F17_print (692);
    if (totalpages != 1)
      F16_printchar ((char)115);
    F17_print (693);
    F22_printint ((long)dvioffset + dviptr);
    F17_print (694);
    close(dvifile);
  }
  if (jobname > 0)
  {
    fprintf (logfile.fp, "\n");
    CLOSE_2(logfile);
    selector -= 2;
    if (selector == 17)
    {
      F19_printnl (1120);
      F17_print (logname);
      F16_printchar ((char)46);
    }
  }
  F15_println ();
  if ((editnamestart != 0) && (interaction > 0))
    calledit (&strpool[editnamestart], V47_editnamelength, editline);
}

void F346_finalcleanup ()
/*****************/
{
  T29_smallnumber c;
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  T37_memoryword *memptr;
#endif

  c = curchr;
  if (jobname == 0)
    F33_openlogfile ();
  if (curlevel > (-127))
  {
    F19_printnl (40);
    F20_printesc (1121);
    F17_print (1122);
    F22_printint ((long)curlevel + 127);
    F16_printchar ((char)41);
  }
  while (condptr != ((int)(-32768)))
  {
    F19_printnl (40);
    F20_printesc (1121);
    F17_print (1123);
    F121_printcmdchr ((char)104, curif);
    if (ifline != 0)
    {
      F17_print (1124);
      F22_printint ((long)ifline);
    }
    F17_print (1125);
    memptr = &mem[condptr - C2_memmin];
    ifline = (memptr+1)->_TAG._TAG1._int;
    curif = memptr->_TAG._TAG3.hh._TAG._TAG2.b1;
    condptr = memptr->_TAG._TAG3.hh.rh;
  }
  if (history != 0)
    if ((history == 1) || (interaction < 3))
      if (selector == 19)
      {
	selector = 17;
	F19_printnl (1126);
	selector = 19;
      }
  if (c == 1)
  {
#if defined(INITEX) || defined(TRIPTEX)
    F338_storefmtfile ();
#else
    F19_printnl (1127);
#endif
    return;
  }
}

#if defined(INITEX) || defined(TRIPTEX)
void F347_initprim ()
/*************/
{
  nonewcontrolsequence = FALSE;

  F124_primitive (242, (char)74, 3526);
  F124_primitive (243, (char)74, 3527);
  F124_primitive (244, (char)74, 3528);
  F124_primitive (245, (char)74, 3529);
  F124_primitive (246, (char)74, 3530);
  F124_primitive (247, (char)74, 3531);
  F124_primitive (248, (char)74, 3532);
  F124_primitive (249, (char)74, 3533);
  F124_primitive (250, (char)74, 3534);
  F124_primitive (251, (char)74, 3535);
  F124_primitive (252, (char)74, 3536);
  F124_primitive (253, (char)74, 3537);
  F124_primitive (254, (char)74, 3538);
  F124_primitive (255, (char)74, 3539);
  F124_primitive (256, (char)74, 3540);
  F124_primitive (257, (char)75, 3541);
  F124_primitive (258, (char)75, 3542);
  F124_primitive (259, (char)75, 3543);
  F124_primitive (264, (char)71, 4057);
  F124_primitive (265, (char)71, 4058);
  F124_primitive (266, (char)71, 4059);
  F124_primitive (267, (char)71, 4060);
  F124_primitive (268, (char)71, 4061);
  F124_primitive (269, (char)71, 4062);
  F124_primitive (270, (char)71, 4063);
  F124_primitive (271, (char)71, 4064);
  F124_primitive (272, (char)71, 4065);
  F124_primitive (286, (char)72, 5267);
  F124_primitive (287, (char)72, 5268);
  F124_primitive (288, (char)72, 5269);
  F124_primitive (289, (char)72, 5270);
  F124_primitive (290, (char)72, 5271);
  F124_primitive (291, (char)72, 5272);
  F124_primitive (292, (char)72, 5273);
  F124_primitive (293, (char)72, 5274);
  F124_primitive (294, (char)72, 5275);
  F124_primitive (295, (char)72, 5276);
  F124_primitive (296, (char)72, 5277);
  F124_primitive (297, (char)72, 5278);
  F124_primitive (298, (char)72, 5279);
  F124_primitive (299, (char)72, 5280);
  F124_primitive (300, (char)72, 5281);
  F124_primitive (301, (char)72, 5282);
  F124_primitive (302, (char)72, 5283);
  F124_primitive (303, (char)72, 5284);
  F124_primitive (304, (char)72, 5285);
  F124_primitive (305, (char)72, 5286);
  F124_primitive (306, (char)72, 5287);
  F124_primitive (307, (char)72, 5288);
  F124_primitive (308, (char)72, 5289);
  F124_primitive (309, (char)72, 5290);
  F124_primitive (310, (char)72, 5291);
  F124_primitive (311, (char)72, 5292);
  F124_primitive (312, (char)72, 5293);
  F124_primitive (313, (char)72, 5294);
  F124_primitive (314, (char)72, 5295);
  F124_primitive (315, (char)72, 5296);
  F124_primitive (316, (char)72, 5297);
  F124_primitive (317, (char)72, 5298);
  F124_primitive (318, (char)72, 5299);
  F124_primitive (319, (char)72, 5300);
  F124_primitive (320, (char)72, 5301);
  F124_primitive (321, (char)72, 5302);
  F124_primitive (322, (char)72, 5303);
  F124_primitive (323, (char)72, 5304);
  F124_primitive (324, (char)72, 5305);
  F124_primitive (325, (char)72, 5306);
  F124_primitive (326, (char)72, 5307);
  F124_primitive (327, (char)72, 5308);
  F124_primitive (328, (char)72, 5309);
  F124_primitive (329, (char)72, 5310);
  F124_primitive (330, (char)72, 5311);
  F124_primitive (331, (char)72, 5312);
  F124_primitive (332, (char)72, 5313);
  F124_primitive (333, (char)72, 5314);
  F124_primitive (334, (char)72, 5315);
  F124_primitive (335, (char)72, 5316);
  F124_primitive (339, (char)73, 5701);
  F124_primitive (340, (char)73, 5702);
  F124_primitive (341, (char)73, 5703);
  F124_primitive (342, (char)73, 5704);
  F124_primitive (343, (char)73, 5705);
  F124_primitive (344, (char)73, 5706);
  F124_primitive (345, (char)73, 5707);
  F124_primitive (346, (char)73, 5708);
  F124_primitive (347, (char)73, 5709);
  F124_primitive (348, (char)73, 5710);
  F124_primitive (349, (char)73, 5711);
  F124_primitive (350, (char)73, 5712);
  F124_primitive (351, (char)73, 5713);
  F124_primitive (352, (char)73, 5714);
  F124_primitive (353, (char)73, 5715);
  F124_primitive (354, (char)73, 5716);
  F124_primitive (355, (char)73, 5717);
  F124_primitive (356, (char)73, 5718);
  F124_primitive (357, (char)73, 5719);
  F124_primitive (358, (char)73, 5720);
  F124_primitive (32, (char)64, 0);
  F124_primitive (47, (char)44, 0);
  F124_primitive (368, (char)45, 0);
  F124_primitive (369, (char)89, 0);
  F124_primitive (370, (char)40, 0);
  F124_primitive (371, (char)41, 0);
  F124_primitive (372, (char)61, 0);
  F124_primitive (373, (char)16, 0);
  F124_primitive (364, (char)106, 0);
  F124_primitive (374, (char)15, 0);
  F124_primitive (375, (char)91, 0);
  F124_primitive (365, (char)66, 0);
  F124_primitive (376, (char)62, 0);
  hash[3260 - 258].rh = 376;
  eqtb[3260]=eqtb[curval];
  F124_primitive (377, (char)101, 0);
  F124_primitive (378, (char)87, 0);
  F124_primitive (379, (char)76, 0);
  F124_primitive (380, (char)32, 0);
  F124_primitive (381, (char)36, 0);
  F124_primitive (382, (char)39, 0);
  F124_primitive (199, (char)37, 0);
  F124_primitive (220, (char)18, 0);
  F124_primitive (383, (char)46, 0);
  F124_primitive (384, (char)17, 0);
  F124_primitive (385, (char)54, 0);
  F124_primitive (386, (char)90, 0);
  F124_primitive (387, (char)34, 0);
  F124_primitive (388, (char)102, 0);
  F124_primitive (204, (char)55, 0);
  F124_primitive (389, (char)63, 0);
  F124_primitive (274, (char)83, 0);
  F124_primitive (390, (char)42, 0);
  F124_primitive (391, (char)79, 0);
  F124_primitive (392, (char)65, 0);
  F124_primitive (393, (char)95, 0);
  F124_primitive (394, (char)0, 256);
  hash[3265 - 258].rh = 394;
  eqtb[3265]=eqtb[curval];
  F124_primitive (395, (char)97, 0);
  F124_primitive (396, (char)108, 0);
  F124_primitive (273, (char)70, 0);
  F124_primitive (221, (char)38, 0);
  F124_primitive (397, (char)33, 0);
  F124_primitive (398, (char)56, 0);
  F124_primitive (399, (char)35, 0);
  F124_primitive (455, (char)13, 0);
  parloc = curval;
  partoken = 4096 + parloc;
  F124_primitive (487, (char)103, 0);
  F124_primitive (488, (char)103, 1);
  F124_primitive (489, (char)109, 0);
  F124_primitive (490, (char)109, 1);
  F124_primitive (491, (char)109, 2);
  F124_primitive (492, (char)109, 3);
  F124_primitive (493, (char)109, 4);
  F124_primitive (337, (char)88, 0);
  F124_primitive (360, (char)88, 1);
  F124_primitive (261, (char)88, 2);
  F124_primitive (262, (char)88, 3);
  F124_primitive (526, (char)78, 101);
  F124_primitive (527, (char)78, 1);
  F124_primitive (528, (char)81, 0);
  F124_primitive (529, (char)81, 1);
  F124_primitive (530, (char)82, 1);
  F124_primitive (531, (char)82, 3);
  F124_primitive (532, (char)82, 2);
  F124_primitive (533, (char)69, 0);
  F124_primitive (534, (char)69, 1);
  F124_primitive (535, (char)69, 2);
  F124_primitive (592, (char)107, 0);
  F124_primitive (593, (char)107, 1);
  F124_primitive (594, (char)107, 2);
  F124_primitive (595, (char)107, 3);
  F124_primitive (596, (char)107, 4);
  F124_primitive (597, (char)107, 5);
  F124_primitive (613, (char)104, 0);
  F124_primitive (614, (char)104, 1);
  F124_primitive (615, (char)104, 2);
  F124_primitive (616, (char)104, 3);
  F124_primitive (617, (char)104, 4);
  F124_primitive (618, (char)104, 5);
  F124_primitive (619, (char)104, 6);
  F124_primitive (620, (char)104, 7);
  F124_primitive (621, (char)104, 8);
  F124_primitive (622, (char)104, 9);
  F124_primitive (623, (char)104, 10);
  F124_primitive (624, (char)104, 11);
  F124_primitive (625, (char)104, 12);
  F124_primitive (626, (char)104, 13);
  F124_primitive (627, (char)104, 14);
  F124_primitive (628, (char)104, 15);
  F124_primitive (629, (char)104, 16);
  F124_primitive (630, (char)105, 2);
  hash[3262 - 258].rh = 630;
  eqtb[3262]=eqtb[curval];
  F124_primitive (631, (char)105, 4);
  F124_primitive (632, (char)105, 3);
  F124_primitive (654, (char)86, 0);
  hash[3268 - 258].rh = 654;
  eqtb[3268]=eqtb[curval];
  F124_primitive (751, (char)4, 128);
  F124_primitive (752, (char)5, 129);
  hash[3259 - 258].rh = 752;
  eqtb[3259]=eqtb[curval];
  F124_primitive (753, (char)5, 130);
  hash[3263 - 258].rh = 754;
  hash[3264 - 258].rh = 754;
  eqtb[3264]._TAG._TAG3.hh._TAG._TAG2.b0 = 9;
#ifdef TRIPTEX
  eqtb[3264]._TAG._TAG3.hh.rh = 2989;
#else
  eqtb[3264]._TAG._TAG3.hh.rh = 29989;
#endif
  eqtb[3264]._TAG._TAG3.hh._TAG._TAG2.b1 = -127;
  eqtb[3263]=eqtb[3264];
  eqtb[3263]._TAG._TAG3.hh._TAG._TAG2.b0 = 114;
  F124_primitive (818, (char)80, 0);
  F124_primitive (819, (char)80, 1);
  F124_primitive (820, (char)80, 2);
  F124_primitive (821, (char)80, 3);
  F124_primitive (822, (char)80, 4);
  F124_primitive (823, (char)80, 5);
  F124_primitive (824, (char)80, 6);
  F124_primitive (825, (char)80, 7);
  F124_primitive (873, (char)14, 0);
  F124_primitive (874, (char)14, 1);
  F124_primitive (875, (char)26, 4);
  F124_primitive (876, (char)26, 0);
  F124_primitive (877, (char)26, 1);
  F124_primitive (878, (char)26, 2);
  F124_primitive (879, (char)26, 3);
  F124_primitive (880, (char)27, 4);
  F124_primitive (881, (char)27, 0);
  F124_primitive (882, (char)27, 1);
  F124_primitive (883, (char)27, 2);
  F124_primitive (884, (char)27, 3);
  F124_primitive (205, (char)28, 5);
  F124_primitive (209, (char)29, 1);
  F124_primitive (211, (char)30, 99);
  F124_primitive (902, (char)21, 1);
  F124_primitive (903, (char)21, 0);
  F124_primitive (904, (char)22, 1);
  F124_primitive (905, (char)22, 0);
  F124_primitive (275, (char)20, 0);
  F124_primitive (906, (char)20, 1);
  F124_primitive (907, (char)20, 2);
  F124_primitive (813, (char)20, 3);
  F124_primitive (908, (char)20, 4);
  F124_primitive (815, (char)20, 5);
  F124_primitive (909, (char)20, 105);
  F124_primitive (910, (char)31, 99);
  F124_primitive (911, (char)31, 100);
  F124_primitive (912, (char)31, 101);
  F124_primitive (913, (char)31, 102);
  F124_primitive (928, (char)43, 1);
  F124_primitive (929, (char)43, 0);
  F124_primitive (938, (char)25, 12);
  F124_primitive (939, (char)25, 11);
  F124_primitive (940, (char)25, 10);
  F124_primitive (941, (char)23, 0);
  F124_primitive (942, (char)23, 1);
  F124_primitive (943, (char)24, 0);
  F124_primitive (944, (char)24, 1);
  F124_primitive (45, (char)47, 1);
  F124_primitive (218, (char)47, 0);
  F124_primitive (975, (char)48, 0);
  F124_primitive (976, (char)48, 1);
  F124_primitive (719, (char)50, 16);
  F124_primitive (720, (char)50, 17);
  F124_primitive (721, (char)50, 18);
  F124_primitive (722, (char)50, 19);
  F124_primitive (723, (char)50, 20);
  F124_primitive (724, (char)50, 21);
  F124_primitive (725, (char)50, 22);
  F124_primitive (726, (char)50, 23);
  F124_primitive (728, (char)50, 26);
  F124_primitive (727, (char)50, 27);
  F124_primitive (977, (char)51, 0);
  F124_primitive (731, (char)51, 1);
  F124_primitive (732, (char)51, 2);
  F124_primitive (714, (char)53, 0);
  F124_primitive (715, (char)53, 2);
  F124_primitive (716, (char)53, 4);
  F124_primitive (717, (char)53, 6);
  F124_primitive (995, (char)52, 0);
  F124_primitive (996, (char)52, 1);
  F124_primitive (997, (char)52, 2);
  F124_primitive (998, (char)52, 3);
  F124_primitive (999, (char)52, 4);
  F124_primitive (1000, (char)52, 5);
  F124_primitive (729, (char)49, 30);
  F124_primitive (730, (char)49, 31);
  hash[3261 - 258].rh = 730;
  eqtb[3261]=eqtb[curval];
  F124_primitive (1019, (char)92, 1);
  F124_primitive (1020, (char)92, 2);
  F124_primitive (1021, (char)92, 4);
  F124_primitive (1022, (char)96, 0);
  F124_primitive (1023, (char)96, 1);
  F124_primitive (1024, (char)96, 2);
  F124_primitive (1025, (char)96, 3);
  F124_primitive (1039, (char)93, 0);
  F124_primitive (1040, (char)93, 1);
  F124_primitive (1041, (char)94, 0);
  F124_primitive (1042, (char)94, 1);
  F124_primitive (1043, (char)94, 2);
  F124_primitive (1044, (char)94, 3);
  F124_primitive (1045, (char)94, 4);
  F124_primitive (1046, (char)94, 5);
  F124_primitive (1047, (char)94, 6);
  F124_primitive (281, (char)84, 4627);
  F124_primitive (285, (char)84, 5139);
  F124_primitive (282, (char)84, 4755);
  F124_primitive (283, (char)84, 4883);
  F124_primitive (284, (char)84, 5011);
  F124_primitive (338, (char)84, 5573);
  F124_primitive (278, (char)85, 4579);
  F124_primitive (279, (char)85, 4595);
  F124_primitive (280, (char)85, 4611);
  F124_primitive (793, (char)98, 0);
  F124_primitive (803, (char)98, 1);
  F124_primitive (1063, (char)77, 0);
  F124_primitive (1064, (char)77, 1);
  F124_primitive (144, (char)99, 0);
  F124_primitive (145, (char)99, 1);
  F124_primitive (146, (char)99, 2);
  F124_primitive (1073, (char)99, 3);
  F124_primitive (1074, (char)60, 1);
  F124_primitive (1075, (char)60, 0);
  F124_primitive (1076, (char)58, 0);
  F124_primitive (1077, (char)58, 1);
  F124_primitive (1083, (char)57, 4755);
  F124_primitive (1084, (char)57, 4883);
  F124_primitive (1085, (char)19, 0);
  F124_primitive (1086, (char)19, 1);
  F124_primitive (1087, (char)19, 2);
  F124_primitive (1088, (char)19, 3);
  F124_primitive (1129, (char)59, 0);
  F124_primitive (453, (char)59, 1);
  writeloc = curval;
  F124_primitive (1130, (char)59, 2);
  F124_primitive (1131, (char)59, 3);
  F124_primitive (1132, (char)59, 4);
  nonewcontrolsequence = TRUE;
}
# endif

#if defined(INITEX) || defined(TRIPTEX)
void F37_debughelp ()
/*************/
{
  register int   k;
  int   l;
  int   m;
  int   n;

  while (TRUE)
  {
    F19_printnl (1128);
    fflush(stdout);
    fscanf(INPUT.fp,"%d",&m);
    if (m < 0)
      return;
    else
      if (m != 0)
      {
      /* 'BREAKPOINT' */
	fscanf(INPUT.fp,"%d",&n);
	switch (m)
	{
	  case 1: 
	    F72_printword (mem[n - C2_memmin]);
	    break;
	  case 2: 
	    F22_printint ((long)mem[n - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh);
	    break;
	  case 3: 
	    F22_printint ((long)mem[n - C2_memmin]._TAG._TAG3.hh.rh);
	    break;
	  case 4: 
	    F72_printword (eqtb[n]);
	    break;
	  case 5: 
	    F72_printword (fontinfo[n]);
	    break;
	  case 6: 
	    F72_printword (savestack[n]);
	    break;
	  case 7: 
	    F106_showbox (n);
	    break;
	  case 8: 
	    breadthmax = 10000;
	    depththreshold = (C15_poolsize - poolptr) - 10;
	    F105_shownodelist (n);
	    break;
	  case 9: 
	    F73_showtokenlist (n, (int)(-32768), 1000L);
	    break;
	  case 10: 
	    F17_print (n);
	    break;
	  case 11: 
	    F91_checkmem (n > 0);
	    break;
	  case 12: 
	    F92_searchmem (n);
	    break;
	  case 13: 
	    fscanf(INPUT,"%d",&l);
	    F121_printcmdchr ((char)n, l);
	    break;
	  case 14: 
	    for (k = 0; k <= n; k++)
	      F17_print ((int)buffer[k]);
	    break;
	  case 15: 
	    fontinshortdisplay = 0;
	    F93_shortdisplay (n);
	    break;
	  case 16: 
	    panicking = !panicking;
	    break;
	  default: 
	    F17_print (63);
	    break;
	}
      }
  }
}
# endif

main (ac,av)
int ac;
char **av;
/****/
{
  /* we start with allocating memory for global variables */
  /* this is necessary for the Gould machines, that allow only */
  /* 256 k of near global variables */
  /* must remove this code for Xenix INITEX */

  char *malloc();

  argc=ac;
  argv=av;

  selectscheduling(); /* perform system dependent startup activities,
			 like locking, selecting virtual memory, etc */

  INPUT.fp=stdin;

#ifdef gould
/* dynamic allocation for huge arrays */
# if defined(INITEX) || defined(TRIPTEX)
  if (freearr==(BOOLEAN *)0)
    freearr=(BOOLEAN *)malloc(sizeof(BOOLEAN)*(C1_memmax - C2_memmin + 1));
  if (trietaken==(BOOLEAN *)0)
    trietaken=(BOOLEAN *)malloc(sizeof(BOOLEAN)*(C17_triesize + 1));
  if (triehash==(T45_triepointer *)0)
    triehash=(T45_triepointer *)malloc(sizeof(T45_triepointer)*(C17_triesize + 1));
  if (triec==(T21_asciicode *)0)
    triec=(T21_asciicode *)malloc(sizeof(T21_asciicode)*(C17_triesize + 1));
  if (triel==(T45_triepointer *)0)
    triel=(T45_triepointer *)malloc(sizeof(T45_triepointer)*(C17_triesize + 1));
  if (trieo==(T31_quarterword *)0)
    trieo=(T31_quarterword *)malloc(sizeof(T31_quarterword)*(C17_triesize + 1));
  if (trier==(T45_triepointer *)0)
    trier=(T45_triepointer *)malloc(sizeof(T45_triepointer)*(C17_triesize + 1));
  if (wasfree==(BOOLEAN *)0)
    wasfree=(BOOLEAN *)malloc(sizeof(BOOLEAN)*(C1_memmax - C2_memmin + 1));
  if (trieophash==(T31_quarterword *)0)
    trieophash=(T31_quarterword *)malloc(sizeof(T31_quarterword)*511);
# endif
#endif
  if (setjmp (L_9998) == 1)
    goto _9998;
  history = 3;
  setpaths ();
  if (readyalready == 314159)
    goto _1;
  bad = 0;
  if ((C5_halferrorline < 30) || (C5_halferrorline > (C4_errorline - 15)))
    bad = 1;
  if (C6_maxprintline < 60)
    bad = 2;
  if ((C18_dvibufsize % 8) != 0)
    bad = 3;
#ifdef TRIPTEX
  if ((1101) > 3000)
    bad = 4;
#else
  if ((-28900) > 30000)
    bad = 4;
#endif
  if (2551 > 3000)
    bad = 5;
#ifdef INITEX
  if ((C2_memmin != (-30000)) || (C1_memmax != 30000))
    bad = 10;
#else
#ifdef TRIPTEX
  if ((C2_memmin != 1) || (C1_memmax != 3000))
    bad = 10;
#endif
#endif
#ifdef TRIPTEX
  if ((C2_memmin > 1) || (C1_memmax < 3000))
#else
  if ((C2_memmin > (-30000)) || (C1_memmax < 30000))
#endif
    bad = 10;
  if (((-128) > 0) || (127 < 127))
    bad = 11;
  if ((((int)(-32768)) > 0) || (32767 < 32767))
    bad = 12;
  if (((-128) < ((int)(-32768))) || (127 > 32767))
    bad = 13;
#ifdef TRIPTEX
  if (((C2_memmin < ((int)(-32768))) || (C1_memmax >= 32767)) || ((1 - C2_memmin) > 32768))
#else
  if (((C2_memmin < ((int)(-32768))) || (C1_memmax >= 32767)) || (((-30000) - C2_memmin) > 32768))
#endif
    bad = 14;
  if ((0 < (-128)) || (C9_fontmax > 127))
    bad = 15;
  if (C9_fontmax > 256)
    bad = 16;
  if ((C16_savesize > 32767L) || (C13_maxstrings > 32767L))
    bad = 17;
  if (C3_bufsize > 32767L)
    bad = 18;
  if (255 < 255)
    bad = 19;
  if (7621 > 32767L)
    bad = 21;
  if (9 > C19_filenamesize)
    bad = 31;
#ifdef TRIPTEX
  if ((2 * 32767L) < (3000 - C2_memmin))
#else
  if ((2 * 32767L) < (30000 - C2_memmin))
#endif
    bad = 41;
  if (bad > 0)
  {
    printf ("%s", "Ouch---my internal constants have been clobbered!");
    printf ("%s", "---case ");
    printf ("%1d", bad);
    printf ("\n");
    goto _9999;
  }
  F14_initialize ();
#if defined(INITEX) || defined(TRIPTEX)
  if (!F57_getstringsstarted ())
    goto _9999;
  F347_initprim ();
# endif
  readyalready = 314159;
_1: 
  selector = 17;
  tally = 0;
  termoffset = 0;
  fileoffset = 0;
#ifdef gould
  printf ("%s", "This is TeX, Version 2.0 for UTX/32");
#else
#ifdef M_XENIX
  printf ("%s", "This is TeX, Version 2.0 for Xenix-V");
#else
  printf ("%s", "This is TeX, Version 2.0 for Unix");
#endif
#endif
  if (formatident == 0)
  {
    printf ("%s", " (no format preloaded)");
    printf ("\n");
  }
  else
  {
    F17_print (formatident);
    F15_println ();
  }
  fflush(stdout);
  jobname = 0;
  nameinprogress = FALSE;
  outputfilename = 0;
  {
    inputptr = 0;
    maxinstack = 0;
    inopen = 0;
    maxbufstack = 0;
    paramptr = 0;
    maxparamstack = 0;
    first = C3_bufsize;
    do
      buffer[first--] = 0;
    while (first != 0);
    scannerstatus = 0;
    warningindex = (int)(-32768);
    first = 1;
    curinput.statefield = 33;
    curinput.startfield = 1;
    curinput.indexfield = 0;
    line = 0;
    curinput.namefield = 0;
    forceeof = FALSE;
    alignstate = 1000000;
    if (!F53_initterminal ())
      goto _9999;
    curinput.limitfield = last;
    first = last + 1;
    if ((formatident == 0) || (buffer[curinput.locfield] == 38))
    {
      if (formatident != 0)
	F14_initialize ();
      if (!F344_openfmtfile ())
	goto _9999;
      if (!F345_loadfmtfile ())
      {
#ifdef M_XENIX
	close((int)fmtfile.fp);
#else
	CLOSE_2(fmtfile);
#endif
	goto _9999;
      }
#ifdef M_XENIX
      close((int)fmtfile.fp);
#else
      CLOSE_2(fmtfile);
#endif
      while ((curinput.locfield < curinput.limitfield) && (buffer[curinput.locfield] == 32))
	curinput.locfield++;
    }
    if ((eqtb[5315]._TAG._TAG1._int < 0) || (eqtb[5315]._TAG._TAG1._int > 127))
      curinput.limitfield--;
    else
      buffer[curinput.limitfield] = eqtb[5315]._TAG._TAG1._int;
    dateandtime (&eqtb[5287]._TAG._TAG1._int, &eqtb[5288]._TAG._TAG1._int, &eqtb[5289]._TAG._TAG1._int, &eqtb[5290]._TAG._TAG1._int);
    initialized = 1;
    magicoffset = strstart[745] - (9 * 16);
    if (interaction == 0)
      selector = 16;
    else
      selector = 17;
    if ((curinput.locfield < curinput.limitfield) && (eqtb[4627 + buffer[curinput.locfield]]._TAG._TAG3.hh.rh != 0))
      F151_startinput ();
  }
  initstrptr = strptr;
  initpoolptr = poolptr;
  history = 0;
  F343_maincontrol ();
  F346_finalcleanup ();
_9998: 
  F34_closefilesandtermina ();
_9999: 
  readyalready = 0;
  if ((history != 0) && (history != 1))
    exit (1);
  else
    exit (0);
}
