#include "externs.h"

int /* was T32_halfword */ F177_scantoks (macrodef, xpand)
/****************************************/
#ifdef VAX
register int macrodef;
#else
register BOOLEAN macrodef;
#endif
BOOLEAN xpand;
{
  register int /* was T32_halfword */ q;
  register int /* was T32_halfword */ p;
  register int /* was T32_halfword */ hashbrace;
  register int /* was T32_halfword */ s;
  register int /* was T32_halfword */ t;
  register int /* was T32_halfword */ unbalance;

  if (macrodef)
    scannerstatus = 2;
  else
    scannerstatus = 5;
  warningindex = curcs;
  p = defref = F75_getavail ();
  mem[defref - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = (int)(-32768);
  hashbrace = 0;
  t = 3120;
  if (macrodef)
  {
    while (TRUE)
    {
      F29_gettoken (null);
      if (curtok < 768)
	goto _31;
      if (curcmd == 6)
      {
	s = 3328 + curchr;
	F29_gettoken (null);
	if (curcmd == 1)
	{
	  hashbrace = curtok;
	  mem[p - C2_memmin]._TAG._TAG3.hh.rh = q = F75_getavail ();
	  mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = curtok;
	  p = q;
	  mem[p - C2_memmin]._TAG._TAG3.hh.rh = q = F75_getavail ();
	  mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = 3584;
	  p = q;
	  goto _30;
	}
	if (t == 3129)
	{
	  F19_printnl (134);
	  F17_print (601);
	  helpptr = 1;
	  helpline[0] = 602;
	  F39_error ();
	}
	else
	{
	  if (curtok != ++t)
	  {
	    F19_printnl (134);
	    F17_print (603);
	    helpptr = 2;
	    helpline[1] = 604;
	    helpline[0] = 605;
	    F142_backerror ();
	  }
	  curtok = s;
	}
      }
      mem[p - C2_memmin]._TAG._TAG3.hh.rh = q = F75_getavail ();
      mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = curtok;
      p = q;
    }
_31: 
    mem[p - C2_memmin]._TAG._TAG3.hh.rh = q = F75_getavail ();
    mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = 3584;
    p = q;
    if (curcmd == 2)
    {
      F19_printnl (134);
      F17_print (515);
      alignstate++;
      helpptr = 2;
      helpline[1] = 599;
      helpline[0] = 600;
      F39_error ();
      goto _40;
    }
_30: 
    ;
  }
  else
    F158_scanleftbrace ();
  unbalance = 1;
  while (TRUE)
  {
    if (xpand)
    {
      while (TRUE)
      {
	F147_getnext ();
	if (curcmd <= 99)
	  goto _32;
	if (curcmd != 108)
	  F156_expand ();
	else
	{
	  q = F176_thetoks ();
          {
	    register int shelp;
	    if ((shelp = m29997->_TAG._TAG3.hh.rh) != ((int)(-32768)))
	    {
	      mem[p - C2_memmin]._TAG._TAG3.hh.rh = shelp;
	      p = q;
	    }
	  }
	}
      }
  _32: 
      F157_xtoken (null);
    }
    else
      F29_gettoken (null);
    if (curtok < 768)
      if (curcmd < 2)
	unbalance++;
      else
      {
	unbalance--;
	if (unbalance == 0)
	  goto _40;
      }
    else
      if (curcmd == 6)
	if (macrodef)
	{
	  s = curtok;
	  if (xpand)
	    F153_getxtoken (null)
	  else
	    F29_gettoken (null);
	  if (curcmd != 6)
	    if ((curtok <= 3120) || (curtok > t))
	    {
	      F19_printnl (134);
	      F17_print (606);
	      F24_sprintcs ((int)warningindex);
	      helpptr = 3;
	      helpline[2] = 607;
	      helpline[1] = 608;
	      helpline[0] = 609;
	      F142_backerror ();
	      curtok = s;
	    }
	    else
	      curtok = 1232 + curchr;
	}
    mem[p - C2_memmin]._TAG._TAG3.hh.rh = q = F75_getavail ();
    mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = curtok;
    p = q;
  }
_40: 
  scannerstatus = 0;
  if (hashbrace != 0)
  {
    mem[p - C2_memmin]._TAG._TAG3.hh.rh = q = F75_getavail ();
    mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = hashbrace;
    p = q;
  }
  return(p);
}

void F178_readtoks (n, r)
/****************/
register long int   n;
int /* was T32_halfword */ r;
{
#ifdef VAX
register int m;
#else
  register T29_smallnumber m;
#endif
  register int /* was T32_halfword */ p;
  register int /* was T32_halfword */ q;
  register long int   s;

  scannerstatus = 2;
  warningindex = r;
  p = defref = F75_getavail ();
  mem[defref - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = (int)(-32768);
  mem[p - C2_memmin]._TAG._TAG3.hh.rh = q = F75_getavail ();
  mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = 3584;
  p = q;
  if (n & 0xFFFFFFF0)
    m = 16;
  else
    m = n;
  s = alignstate;
  alignstate = 1000000;
  do
  {
    F32_beginfilereading ();
    curinput.namefield = m + 1;
    if (readopen[m] == 2)
      if (interaction > 1)
	if (n < 0)
	{
	  F17_print (207);
	  F30_terminput ();
	}
	else
	{
	  F15_println ();
	  F24_sprintcs ((int)r);
	  F17_print (61);
	  F30_terminput ();
	  n = -1;
	}
      else
	F40_fatalerror (610);
    else
      if (readopen[m] == 1)
	if (F52_inputln (readfile[m].fp))
	  readopen[m] = 0;
	else
	{
	  CLOSE_2(readfile[m]);
	  readopen[m] = 2;
	}
      else
      {
	if (!F52_inputln (readfile[m].fp))
	{
	  CLOSE_2(readfile[m]);
	  readopen[m] = 2;
	  if (alignstate != 1000000)
	  {
	    F74_runaway ();
	    F19_printnl (134);
	    F17_print (611);
	    F20_printesc (393);
	    helpptr = 1;
	    helpline[0] = 612;
	    alignstate = 1000000;
	    F39_error ();
	  }
	}
      }
    curinput.limitfield = last;
    if (eqtb[5315]._TAG._TAG1._int &0xFFFFFF80)
      curinput.limitfield--;
    else
      buffer[curinput.limitfield] = eqtb[5315]._TAG._TAG1._int;
    first = curinput.limitfield + 1;
    curinput.locfield = curinput.startfield;
    curinput.statefield = 33;
    while (TRUE)
    {
      F29_gettoken (null);
      if (curtok == 0)
	goto _30;
      mem[p - C2_memmin]._TAG._TAG3.hh.rh = q = F75_getavail ();
      mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh = curtok;
      p = q;
    }
_30: 
    F144_endfilereading ();
  }
  while (alignstate != 1000000);
  curval = defref;
  scannerstatus = 0;
  alignstate = s;
}

void F150_passtext ()
/*************/
{
  register int   l;
#ifdef VAX
register int savescannerstatus;
#else
  register T29_smallnumber savescannerstatus;
#endif

  savescannerstatus = scannerstatus;
  scannerstatus = 1;
  l = 0;
  skipline = line;
  while (TRUE)
  {
    F147_getnext ();
    if (curcmd == 105)
    {
      if (l == 0)
	goto _30;
      if (curchr == 2)
	l--;
    }
    else
      if (curcmd == 104)
	l++;
  }
_30: 
  scannerstatus = savescannerstatus;
}

void F179_changeiflimit (l, p)
/*********************/
T29_smallnumber l;
int /* was T32_halfword */ p;
{
  register int /* was T32_halfword */ q;

  if (p == condptr)
    iflimit = l;
  else
  {
    q = condptr;
    while (TRUE)
    {
      if (q == ((int)(-32768)))
	F42_confusion (613);
      {
	register int shelp;
	if ((shelp = mem[q - C2_memmin]._TAG._TAG3.hh.rh) == p)
	{
	  mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 = l;
	  return;
	}
	q = shelp;
      }
    }
  }
}

void F152_conditional ()
/****************/
{
#ifdef M_XENIX
  T37_memoryword huge *memptr;
#else
  register T37_memoryword *memptr;
#endif
  register int /* was T32_halfword */ p;
#ifdef VAX
register int b;
#else
  register BOOLEAN b;
#endif
  register int   m;
  register long int   n;
  register int /* was T32_halfword */ q;
  register int   r;
  register int /* was T32_halfword */ savecondptr;
  register T29_smallnumber savescannerstatus;
  register T29_smallnumber thisif;
  register T37_memoryword memhelp;

  p = F77_getnode (2L);
  memptr = &mem[p - C2_memmin];
  memptr->_TAG._TAG3.hh.rh = condptr;
  memptr->_TAG._TAG3.hh._TAG._TAG2.b0 = iflimit;
  memptr->_TAG._TAG3.hh._TAG._TAG2.b1 = curif;
  (memptr+1)->_TAG._TAG1._int = ifline;
  condptr = p;
  curif = curchr;
  iflimit = 1;
  ifline = line;
  savecondptr = condptr;
  thisif = curchr;
  switch (thisif)
  {
    case 0: 
    case 1: 
      F153_getxtoken (null);
      if (curcmd == 0)
	if (curchr == 257)
	{
	  curcmd = 13;
	  curchr = curtok - 4097;
	}
      if ((curcmd > 13) || (curchr > 127))
      {
	m = 0;
	n = 256;
      }
      else
      {
	m = curcmd;
	n = curchr;
      }
      F153_twogetxtoken (null);
      if (curcmd == 0)
	if (curchr == 257)
	{
	  curcmd = 13;
	  curchr = curtok - 4097;
	}
      if ((curcmd > 13) || (curchr > 127))
      {
	curcmd = 0;
	curchr = 256;
      }
      if (thisif == 0)
	b = (n == (long)curchr);
      else
	b = m == curcmd;
      break;
    case 2: 
    case 3: 
      if (thisif == 2)
	F162_scanint ();
      else
	F172_scandimen (FALSE, FALSE, FALSE);
      n = curval;
      do
	F153_threegetxtoken (null)
      while (curcmd == 10);
      if ((curtok >= 3132) && (curtok <= 3134))
	r = curtok - 3072;
      else
      {
	F19_printnl (134);
	F17_print (637);
	F121_printcmdchr ((char)104, thisif);
	helpptr = 1;
	helpline[0] = 638;
	F142_backerror ();
	r = 61;
      }
      if (thisif == 2)
	F162_scanint ();
      else
	F172_scandimen (FALSE, FALSE, FALSE);
      switch (r)
      {
	case 60: 
	  b = (n < curval);
	    break;
	case 61: 
	  b = (n == curval);
	  break;
	case 62: 
	  b = (n > curval);
	  break;
      }
      break;
    case 4: 
      F162_scanint ();
      b = ODD(curval);
      break;
    case 5: 
      b = (curlist.modefield == 1) || (curlist.modefield == -1);
      break;
    case 6: 
      b = (curlist.modefield == 101) || (curlist.modefield == -101);
      break;
    case 7: 
      b = (curlist.modefield == 201) || (curlist.modefield == -201);
      break;
    case 8: 
      b = curlist.modefield < 0;
      break;
    case 9: 
    case 10: 
    case 11: 
      F164_scaneightbitint ();
      p = eqtb[4322 + curval]._TAG._TAG3.hh.rh;
      if (thisif == 9)
	b = p == ((int)(-32768));
      else
	if (p == ((int)(-32768)))
	  b = FALSE;
	else
	  if (thisif == 10)
	    b = mem[p - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 == 0;
	  else
	    b = mem[p - C2_memmin]._TAG._TAG3.hh._TAG._TAG2.b0 == 1;
      break;
    case 12: 
      savescannerstatus = scannerstatus;
      scannerstatus = 0;
      F147_getnext ();
      n = curcs;
      p = curcmd;
      q = curchr;
      F147_getnext ();

      if (curcmd != p)
	b = FALSE;
      else
	if (curcmd < 110)
	  b = curchr == q;
	else
	{
	  p = mem[curchr - C2_memmin]._TAG._TAG3.hh.rh;
	  q = mem[eqtb[n]._TAG._TAG3.hh.rh - C2_memmin]._TAG._TAG3.hh.rh;
	  while ((p != ((int)(-32768))) && (q != ((int)(-32768))))
	  {
	    if (mem[p - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh != mem[q - C2_memmin]._TAG._TAG3.hh._TAG._TAG1.lh)
	      p = (int)(-32768);
	    else
	    {
	      p = mem[p - C2_memmin]._TAG._TAG3.hh.rh;
	      q = mem[q - C2_memmin]._TAG._TAG3.hh.rh;
	    }
	  }
	  b = (p == ((int)(-32768))) && (q == ((int)(-32768)));
	}
      scannerstatus = savescannerstatus;
      break;
    case 13: 
      F165_scanfourbitint ();
      b = readopen[curval] == 2;
      break;
    case 14: 
      b = TRUE;
      break;
    case 15: 
      b = FALSE;
      break;
    case 16: 
      F162_scanint ();
      n = curval;
      if (eqtb[5303]._TAG._TAG1._int > 1)
      {
	F118_begindiagnostic ();
	F17_print (639);
	F22_printint (n);
	F16_printchar ((char)125);
	F119_enddiagnostic (FALSE);
      }
      while (n != 0L)
      {
	F150_passtext ();
	if (condptr == savecondptr)
	  if (curchr == 4)
	    n--;
	  else
	    goto _50;
	else
	  if (curchr == 2)
	  {
	    p = condptr;
	    memptr = &mem[p - C2_memmin];
	    ifline = (memptr+1)->_TAG._TAG1._int;
	    curif = memptr->_TAG._TAG3.hh._TAG._TAG2.b1;
	    iflimit = memptr->_TAG._TAG3.hh._TAG._TAG2.b0;
	    condptr = memptr->_TAG._TAG3.hh.rh;
	    F78_freenode (p, 2);
	  }
      }
      F179_changeiflimit (4, savecondptr);
      return;
      break;
  }
  if (eqtb[5303]._TAG._TAG1._int > 1L)
  {
    F118_begindiagnostic ();
    if (b)
      F17_print (635);
    else
      F17_print (636);
    F119_enddiagnostic (FALSE);
  }
  if (b)
  {
    F179_changeiflimit (3, savecondptr);
    return;
  }
  while (TRUE)
  {
    F150_passtext ();
    if (condptr == savecondptr)
    {
      if (curchr != 4)
	goto _50;
      F19_printnl (134);
      F17_print (633);
      F20_printesc (631);
      helpptr = 1;
      helpline[0] = 634;
      F39_error ();
    }
    else
      if (curchr == 2)
      {
	p = condptr;
	memptr = &mem[p - C2_memmin];
	ifline = (memptr+1)->_TAG._TAG1._int;
	curif = memptr->_TAG._TAG3.hh._TAG._TAG2.b1;
	iflimit = memptr->_TAG._TAG3.hh._TAG._TAG2.b0;
	condptr = memptr->_TAG._TAG3.hh.rh;
	F78_freenode (p, 2);
      }
  }
_50: 
  if (curchr == 2)
  {
    p = condptr;
    memptr = &mem[p - C2_memmin];
    ifline = (memptr+1)->_TAG._TAG1._int;
    curif = memptr->_TAG._TAG3.hh._TAG._TAG2.b1;
    iflimit = memptr->_TAG._TAG3.hh._TAG._TAG2.b0;
    condptr = memptr->_TAG._TAG3.hh.rh;
    F78_freenode (p, 2);
  }
  else
    iflimit = 2;
}

BOOLEAN F181_morename (c)
/**********************/
T21_asciicode c;
{
  if (c == 32)
    return(FALSE);
  else
  {
    if (c == 47)
    {
      areadelimiter = poolptr;
      extdelimiter = 0;
    }
    else
      if ((c == 46) && (extdelimiter == 0))
	extdelimiter = poolptr;
    if (poolptr >= C15_poolsize)
      F41_overflow (129, (long)C15_poolsize - initpoolptr);
    strpool[poolptr++] = c;
    return(TRUE);
  }
}

void F182_endname ()
/************/
{
  if ((strptr + 3) > C13_maxstrings)
    F41_overflow (130, (long)C13_maxstrings - initstrptr);
  if (areadelimiter == 0)
    curarea = 207;
  else
  {
    curarea = strptr++;
    strstart[strptr] = areadelimiter + 1;
  }
  if (extdelimiter == 0)
  {
    curext = 207;
    curname = F54_makestring ();
  }
  else
  {
    curname = strptr++;
    strstart[strptr] = extdelimiter;
    curext = F54_makestring ();
  }
}

void F183_packfilename (n, a, e)
/**********************/
T26_strnumber n;
T26_strnumber a;
T26_strnumber e;
{
#ifdef VAX
register int c;
#else
  register T21_asciicode c;
#endif
#ifdef VAX
  register int j;
#else
  register T25_poolpointer j;
#endif
  register int   k;
#ifdef VAX
  register int help;
#else
  register T25_poolpointer help;
#endif

  k = 0;
  help=strstart[a+1];
  for (j = strstart[a]; j < help; j++)
  {
    c = strpool[j];
    if (k < C19_filenamesize)
      nameoffile[k] =c;
    k++;
  }
  help=strstart[n+1];
  for (j = strstart[n]; j < help; j++)
  {
    c = strpool[j];
    if (k < C19_filenamesize)
      nameoffile[k] =c;
    k++;
  }
  help=strstart[e+1];
  for (j = strstart[e]; j < help; j++)
  {
    c = strpool[j];
    if (k < C19_filenamesize)
      nameoffile[k] =c;
    k++;
  }
  if (k <= C19_filenamesize)
    namelength = k;
  else
    namelength = C19_filenamesize;
  nameoffile[namelength]='\0';
}

void F184_packbufferedname (n, a, b)
/**************************/
#ifdef VAX
register int n;
#else
register T29_smallnumber n;
#endif
register int   a;
register int   b;
{
#ifdef VAX
register int c;
#else
  register T21_asciicode c;
#endif
  register int   j;
  register int   k;

  if (n + b - a + 5 > C19_filenamesize)
    b = a - n - 5 + C19_filenamesize;
  k = 0;
  for (j = 0; j < n; j++)
  {
    c = texformatdefault[j];
    if (k < C19_filenamesize)
      nameoffile[k] = c;
    k++;
  }
  for (j = a; j <= b; j++)
  {
    c = buffer[j];
    if (k < C19_filenamesize)
      nameoffile[k] = c;
    k++;
  }
  for (j = 5; j <= 8; j++)
  {
    c = texformatdefault[j];
    if (k < C19_filenamesize)
      nameoffile[k] = c;
    k++;
  }
  if (k <= C19_filenamesize)
    namelength = k;
  else
    namelength = C19_filenamesize;
  nameoffile[namelength]='\0';
}

T26_strnumber F185_makenamestring ()
/*********************************/
{
  register int   k;
  register int   kstart;

  k=strlen(realnameoffile);
  if (k<C19_filenamesize)
    namelength = k;
  else
    namelength = C19_filenamesize;
  if (((poolptr + namelength) > C15_poolsize) || (strptr == C13_maxstrings))
    return(63);
  else
  {
    if ((realnameoffile[0] == 46) && (realnameoffile[1] == 47))
      kstart = 2;
    else
      kstart = 0;
    for (k = kstart; k < namelength; k++)
      strpool[poolptr++] = realnameoffile[k];
    return(F54_makestring ());
  }
}

void F189_scanfilename ()
/*****************/
{
  nameinprogress = TRUE;
  areadelimiter = 0;
  extdelimiter = 0;
  do
    F153_getxtoken (null)
  while (curcmd == 10);
  while (TRUE)
  {
    if ((curcmd > 12) || (curchr > 127))
    {
      F134_backinput ();
      goto _30;
    }
    if (!F181_morename ((char)curchr))
      goto _30;
    F153_twogetxtoken (null);
  }
_30: 
  F182_endname ();
  nameinprogress = FALSE;
}

void F190_packjobname (s)
/*****************/
T26_strnumber s;
{
  curarea = 207;
  curext = s;
  curname = jobname;
  F183_packfilename (curname, curarea, curext);
}

void F191_promptfilename (s, e)
/**********************/
#ifdef VAX
register int s,e;
#else
register T26_strnumber s;
register T26_strnumber e;
#endif
{
  int   k;

  if (s == 640)
  {
    F19_printnl (134);
    F17_print (641);
  }
  else
  {
    F19_printnl (134);
    F17_print (642);
  }
  F25_printfilename (curname, curarea, curext);
  F17_print (643);
  if (e == 644)
    F31_showcontext ();
  F19_printnl (645);
  F17_print (s);
  if (interaction < 2)
    F40_fatalerror (646);
  F17_print (427);
  F30_terminput ();
  areadelimiter = 0;
  extdelimiter = 0;
  k = first;
  /* skip blanks before end of buffer */
  while ((buffer[k] == 32) && (k < last))
    k++;
  while (TRUE)
  {
    if (k == last)
      goto _30;
    if (!F181_morename (buffer[k]))
      goto _30;
    k++;
  }
_30: 
  F182_endname ();
  if (curext == 207)
    curext = e;
  F183_packfilename (curname, curarea, curext);
}

void F33_openlogfile ()
/***************/
{
  register long int   k;
  register int   l;
  char  months[37];
  register int   oldsetting;
  register long int help;

  oldsetting = selector;
  if (jobname == 0)
    jobname = 649;
  F190_packjobname (650);
  while (!F44_aopenout (&logfile))
  {
    if (interaction < 2)
    {
      F19_printnl (134);
      F17_print (642);
      F25_printfilename (curname, curarea, curext);
      F17_print (643);
      jobname = 0;
      history = 3;
      F38_jumpout ();
    }
    F191_promptfilename (652, 650);
  }
  logname = F185_makenamestring ();
  selector = 18;
#ifdef sel
  fprintf (logfile.fp, "This is TeX, Version 2.0 for UTX/32");
#else
#ifdef M_XENIX
  fprintf (logfile.fp, "This is TeX, Version 2.0 for Xenix-V");
#else
  fprintf (logfile.fp, "This is TeX, Version 2.0 for Unix");
#endif
#endif
  F17_print (formatident);
  F17_print (653);
  F22_printint (eqtb[5288]._TAG._TAG1._int);
  F16_printchar ((char)32);
  strcpy (months, "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC");
  help=3*eqtb[5289]._TAG._TAG1._int;
  for (k = (3 * eqtb[5289]._TAG._TAG1._int) - 3; k < help; k++)
    fprintf (logfile.fp, "%c", months[k]);
  F16_printchar ((char)32);
  F22_printint (eqtb[5290]._TAG._TAG1._int);
  F16_printchar ((char)32);
  F58_printtwo (eqtb[5287]._TAG._TAG1._int / 60);
  F16_printchar ((char)58);
  F58_printtwo (eqtb[5287]._TAG._TAG1._int % 60);
  inputstack[inputptr]=curinput;
  F19_printnl (651);
  l = inputstack[0].limitfield;
  if (buffer[l] == eqtb[5315]._TAG._TAG1._int)
    l--;
  for (k = 1L; k <= (long)l; k++)
    F17_print ((int)buffer[k]);
  F15_println ();
  selector = oldsetting + 2;
}

void F151_startinput ()
/***************/
{
  F189_scanfilename ();
  if (curext == 207)
    curext = 644;
  F183_packfilename (curname, curarea, curext);
  while (TRUE)
  {
    F32_beginfilereading ();
    if (F43_aopenin (&inputfile[curinput.indexfield], 1))
      goto _30;
    F144_endfilereading ();
    F191_promptfilename (640, 644);
  }
_30: 
  curinput.namefield = F185_makenamestring ();
  if (jobname == 0)
  {
    jobname = curname;
    F33_openlogfile ();
  }
  if ((termoffset + (strstart[curinput.namefield + 1] - strstart[curinput.namefield])) > (C6_maxprintline - 2))
    F15_println ();
  else
    if ((termoffset > 0) || (fileoffset > 0))
      F16_printchar ((char)32);
  F16_printchar ((char)40);
  F17_print (curinput.namefield);
  fflush(stdout);
  curinput.statefield = 33;
  F52_inputln (inputfile[curinput.indexfield].fp);
  F146_firmuptheline ();
  if (eqtb[5315]._TAG._TAG1._int & 0xFFFFFF80)
    curinput.limitfield--;
  else
    buffer[curinput.limitfield] = eqtb[5315]._TAG._TAG1._int;
  first = curinput.limitfield + 1;
  curinput.locfield = curinput.startfield;
  line = 1;
}

T43_internalfontnumber F192_readfontinfo (u, nom, aire, s)
/****************************************************/
register int /* was T32_halfword */ u;
#ifdef VAX
register int nom,aire;
#else
T26_strnumber nom;
T26_strnumber aire;
#endif
register long int   s;
{
#ifdef VAX
register int a;
#else
  register T22_eightbits a;
#endif
  register long int   alpha;
#ifdef VAX
register int b;
#else
  register T22_eightbits b;
#endif
  register int /* was T32_halfword */ bc;
  register long int   beta;
#ifdef VAX
register int c,d;
#else
  register T22_eightbits c;
  register T22_eightbits d;
#endif
  register int /* was T32_halfword */ ec;
  register T43_internalfontnumber f;
  register BOOLEAN fileopened;
  register T43_internalfontnumber g;
  register int   k;
  register int /* was T32_halfword */ lf;
  register int /* was T32_halfword */ lh;
  register int /* was T32_halfword */ nd;
  register int /* was T32_halfword */ ne;
  register int /* was T32_halfword */ nh;
  register int /* was T32_halfword */ ni;
  register int /* was T32_halfword */ nk;
  register int /* was T32_halfword */ nl;
  register int /* was T32_halfword */ np;
  register int /* was T32_halfword */ nw;
  register T36_fourquarters qw;
  register long int   sw;
  register long int   z;
  register int shelp;

  g = 0;
  fileopened = FALSE;
  F183_packfilename (nom, aire, 664);
  if (!F45_bopenin (&tfmfile))
    goto _11;
  fileopened = TRUE;
  lf = tfmfile.buffer;
  if (lf > 127)
    goto _11;
  GET_2 (tfmfile);
  lf = (lf << 8) + tfmfile.buffer;
  GET_2 (tfmfile);
  lh = tfmfile.buffer;
  if (lh > 127)
    goto _11;
  GET_2 (tfmfile);
  lh = (lh << 8) + tfmfile.buffer;
  GET_2 (tfmfile);
  bc = tfmfile.buffer;
  if (bc > 127)
    goto _11;
  GET_2 (tfmfile);
  bc = (bc << 8) + tfmfile.buffer;
  GET_2 (tfmfile);
  ec = tfmfile.buffer;
  if (ec > 127)
    goto _11;
  GET_2 (tfmfile);
  ec = (ec << 8) + tfmfile.buffer;
  if ((bc > (ec + 1)) || (ec > 255))
    goto _11;
  GET_2 (tfmfile);
  nw = tfmfile.buffer;
  if (nw > 127)
    goto _11;
  GET_2 (tfmfile);
  nw = (nw << 8) + tfmfile.buffer;
  GET_2 (tfmfile);
  nh = tfmfile.buffer;
  if (nh > 127)
    goto _11;
  GET_2 (tfmfile);
  nh = (nh << 8) + tfmfile.buffer;
  GET_2 (tfmfile);
  nd = tfmfile.buffer;
  if (nd > 127)
    goto _11;
  GET_2 (tfmfile);
  nd = (nd << 8) + tfmfile.buffer;
  GET_2 (tfmfile);
  ni = tfmfile.buffer;
  if (ni > 127)
    goto _11;
  GET_2 (tfmfile);
  ni = (ni << 8) + tfmfile.buffer;
  GET_2 (tfmfile);
  nl = tfmfile.buffer;
  if (nl > 127)
    goto _11;
  GET_2 (tfmfile);
  nl = (nl << 8) + tfmfile.buffer;
  GET_2 (tfmfile);
  nk = tfmfile.buffer;
  if (nk > 127)
    goto _11;
  GET_2 (tfmfile);
  nk = (nk << 8) + tfmfile.buffer;
  GET_2 (tfmfile);
  ne = tfmfile.buffer;
  if (ne > 127)
    goto _11;
  GET_2 (tfmfile);
  ne = (ne << 8) + tfmfile.buffer;
  GET_2 (tfmfile);
  np = tfmfile.buffer;
  if (np > 127)
    goto _11;
  GET_2 (tfmfile);
  np = (np << 8) + tfmfile.buffer;
  if (lf != 6 + lh + ec - bc + 1 + nw + nh + nd + ni + nl + nk + ne + np)
    goto _11;
  lf = (lf - 6) - lh;
  if (np < 7)
    lf = (lf + 7) - np;
  if ((fontptr == C9_fontmax) || ((fmemptr + lf) > C10_fontmemsize))
  {
    F19_printnl (134);
    F17_print (655);
    F24_sprintcs ((int)u);
    F16_printchar ((char)61);
    F25_printfilename (nom, aire, 207);
    if (s >= 0L)
    {
      F17_print (598);
      F67_printscaled ((long)s);
      F17_print (263);
    }
    else
      if (s != (-1000L))
      {
	F17_print (656);
	F22_printint ((long)(-s));
      }
    F17_print (665);
    helpptr = 4;
    helpline[3] = 666;
    helpline[2] = 667;
    helpline[1] = 668;
    helpline[0] = 669;
    F39_error ();
    goto _30;
  }
  f = fontptr + 1;
  charbase[f] = fmemptr - bc;
  widthbase[f] = charbase[f] + ec + 1;
  heightbase[f] = widthbase[f] + nw;
  depthbase[f] = heightbase[f] + nh;
  italicbase[f] = depthbase[f] + nd;
  ligkernbase[f] = italicbase[f] + ni;
  kernbase[f] = ligkernbase[f] + nl;
  extenbase[f] = kernbase[f] + nk;
  parambase[f] = extenbase[f] + ne;
  if (lh < 2)
    goto _11;
  GET_2 (tfmfile);
  a = tfmfile.buffer;
  qw.b0 = a - 128;
  GET_2 (tfmfile);
  b = tfmfile.buffer;
  qw.b1 = b - 128;
  GET_2 (tfmfile);
  c = tfmfile.buffer;
  qw.b2 = c - 128;
  GET_2 (tfmfile);
  d = tfmfile.buffer;
  qw.b3 = d - 128;
  fontcheck[f]=qw;
  GET_2 (tfmfile);
  z = tfmfile.buffer;
  if (z > 127)
    goto _11;
  GET_2 (tfmfile);
  z = (z << 8) + tfmfile.buffer;
  GET_2 (tfmfile);
  z = (z << 8) + tfmfile.buffer;
  GET_2 (tfmfile);
  z = (z << 4) + (tfmfile.buffer >> 4);
  if (z < 65536L)
    goto _11;
  while (lh > 2)
  {
    GET_2 (tfmfile);
    GET_2 (tfmfile);
    GET_2 (tfmfile);
    GET_2 (tfmfile);
    lh--;
  }
  fontdsize[f] = z;
  if (s != (-1000L))
    if (s >= 0L)
      z = s;
    else
      z = F70_xnoverd (z, -s, 1000L);
  fontsize[f] = z;
  shelp = widthbase[f];
  for (k = fmemptr; k < shelp; k++)
  {
    GET_2 (tfmfile);
    a = tfmfile.buffer;
    qw.b0 = a - 128;
    GET_2 (tfmfile);
    b = tfmfile.buffer;
    qw.b1 = b - 128;
    GET_2 (tfmfile);
    c = tfmfile.buffer;
    qw.b2 = c - 128;
    GET_2 (tfmfile);
    d = tfmfile.buffer;
    qw.b3 = d - 128;
    fontinfo[k]._TAG._TAG4.qqqq=qw;
    if ((((a >= nw) || ((b >> 4) >= nh)) || ((b & 15) >= nd)) || ((c >> 2) >= ni))
      goto _11;
    switch (((int)c) & 3)
    {
      case 1: 
	if (d >= nl)
	  goto _11;
	break;
      case 3: 
	if (d >= ne)
	  goto _11;
	break;
      case 2: 
	if ((d < bc) || (d > ec))
	  goto _11;
	while (d < ((k + bc) - fmemptr))
	{
	  qw=fontinfo[charbase[f] + d]._TAG._TAG4.qqqq;
	  if (((int)(qw.b2 + 128) & 3) != 2)
	    goto _45;
	  d = qw.b3 + 128;
	}
	if (d == ((k + bc) - fmemptr))
	  goto _11;
    _45: 
	;
	break;
      default: 
	break;
    }
  }
  alpha = z << 4;
  beta = 16;
  while (z >= 8388608)
  {
    z >>= 1;
    beta >>= 1;
  }
  shelp = ligkernbase[f];
  for (k = widthbase[f]; k < shelp; k++)
  {
    GET_2 (tfmfile);
    a = tfmfile.buffer;
    GET_2 (tfmfile);
    b = tfmfile.buffer;
    GET_2 (tfmfile);
    c = tfmfile.buffer;
    GET_2 (tfmfile);
    d = tfmfile.buffer;
    sw = (((((d * z) >> 8) + (c * z)) >> 8) + (b * z)) / beta;
    if (a == 0)
      fontinfo[k]._TAG._TAG1._int = sw;
    else
      if (a == 255)
	fontinfo[k]._TAG._TAG1._int = sw - alpha;
      else
	goto _11;
  }
  if (fontinfo[widthbase[f]]._TAG._TAG1._int != 0L)
    goto _11;
  if (fontinfo[heightbase[f]]._TAG._TAG1._int != 0L)
    goto _11;
  if (fontinfo[depthbase[f]]._TAG._TAG1._int != 0L)
    goto _11;
  if (fontinfo[italicbase[f]]._TAG._TAG1._int != 0L)
    goto _11;
  shelp = kernbase[f];
  for (k = ligkernbase[f]; k < shelp; k++)
  {
    GET_2 (tfmfile);
    a = tfmfile.buffer;
    qw.b0 = a - 128;
    GET_2 (tfmfile);
    b = tfmfile.buffer;
    qw.b1 = b - 128;
    GET_2 (tfmfile);
    c = tfmfile.buffer;
    qw.b2 = c - 128;
    GET_2 (tfmfile);
    d = tfmfile.buffer;
    qw.b3 = d - 128;
    fontinfo[k]._TAG._TAG4.qqqq=qw;
    if ((b < bc) || (b > ec))
      goto _11;
    if (c < 128)
    {
      if ((d < bc) || (d > ec))
	goto _11;
    }
    else
      if (d >= nk)
	goto _11;
  }
  if ((nl > 0) && (a < 128))
    goto _11;
  shelp = extenbase[f];
  for (k = kernbase[f]; k < shelp; k++)
  {
    GET_2 (tfmfile);
    a = tfmfile.buffer;
    GET_2 (tfmfile);
    b = tfmfile.buffer;
    GET_2 (tfmfile);
    c = tfmfile.buffer;
    GET_2 (tfmfile);
    d = tfmfile.buffer;
    sw = (((((d * z) >> 8) + (c * z)) >> 8) + (b * z)) / beta;
    if (a == 0)
      fontinfo[k]._TAG._TAG1._int = sw;
    else
      if (a == 255)
	fontinfo[k]._TAG._TAG1._int = sw - alpha;
      else
	goto _11;
  }
  shelp = parambase[f];
  for (k = extenbase[f]; k < shelp; k++)
  {
    GET_2 (tfmfile);
    a = tfmfile.buffer;
    qw.b0 = a - 128;
    GET_2 (tfmfile);
    b = tfmfile.buffer;
    qw.b1 = b - 128;
    GET_2 (tfmfile);
    c = tfmfile.buffer;
    qw.b2 = c - 128;
    GET_2 (tfmfile);
    d = tfmfile.buffer;
    qw.b3 = d - 128;
    fontinfo[k]._TAG._TAG4.qqqq=qw;
    if (a != 0)
      if ((a < bc) || (a > ec))
	goto _11;
    if (b != 0)
      if ((b < bc) || (b > ec))
	goto _11;
    if (c != 0)
      if ((c < bc) || (c > ec))
	goto _11;
      if ((d < bc) || (d > ec))
	goto _11;
  }
  for (k = 1; k <= np; k++)
    if (k == 1)
    {
      GET_2 (tfmfile);
      sw = tfmfile.buffer;
      if (sw > 127)
	sw -= 256;
      GET_2 (tfmfile);
      sw = (sw << 8) + tfmfile.buffer;
      GET_2 (tfmfile);
      sw = (sw << 8) + tfmfile.buffer;
      GET_2 (tfmfile);
      fontinfo[parambase[f]]._TAG._TAG1._int = (sw << 4) + (tfmfile.buffer >> 4);
    }
    else
    {
      GET_2 (tfmfile);
      a = tfmfile.buffer;
      GET_2 (tfmfile);
      b = tfmfile.buffer;
      GET_2 (tfmfile);
      c = tfmfile.buffer;
      GET_2 (tfmfile);
      d = tfmfile.buffer;
      sw = (((((d * z) >> 8) + (c * z)) >> 8) + (b * z)) / beta;
      if (a == 0)
	fontinfo[(parambase[f] + k) - 1]._TAG._TAG1._int = sw;
      else
	if (a == 255)
	  fontinfo[(parambase[f] + k) - 1]._TAG._TAG1._int = sw - alpha;
	else
	  goto _11;
    }
  if (EOF_ (tfmfile))
    goto _11;
  for (k = np + 1; k <= 7; k++)
    fontinfo[(parambase[f] + k) - 1]._TAG._TAG1._int = 0;
  if (np >= 7)
    fontparams[f] = np;
  else
    fontparams[f] = 7;
  hyphenchar[f] = eqtb[5313]._TAG._TAG1._int;
  skewchar[f] = eqtb[5314]._TAG._TAG1._int;
  fontname[f] = nom;
  fontarea[f] = aire;
  fontbc[f] = bc;
  fontec[f] = ec;
  fontglue[f] = (int)(-32768);
  charbase[f] += 128;
  widthbase[f] += 128;
  ligkernbase[f] += 128;
  kernbase[f] += 128;
  extenbase[f] += 128;
  parambase[f]--;
  fmemptr += lf;
  fontptr = f;
  g = f;
  goto _30;
_11: 
  F19_printnl (134);
  F17_print (655);
  F24_sprintcs ((int)u);
  F16_printchar ((char)61);
  F25_printfilename (nom, aire, 207);
  if (s >= 0)
  {
    F17_print (598);
    F67_printscaled ((long)s);
    F17_print (263);
  }
  else
    if (s != (-1000))
    {
      F17_print (656);
      F22_printint ((long)(-s));
    }
  if (fileopened)
    F17_print (657);
  else
    F17_print (658);
  helpptr = 5;
  helpline[4] = 659;
  helpline[3] = 660;
  helpline[2] = 661;
  helpline[1] = 662;
  helpline[0] = 663;
  F39_error ();
_30: 
  if (tfmfile.fp!=NULL)
  {
    CLOSE_2(tfmfile);
  }
  return(g);
}
