#define EXTERN extern
#include "mpd.h"

void dospecial ( ) 
{getxnext () ; 
  scanexpression () ; 
  if ( curtype != 4 ) 
  {
    disperr ( 0 , 1148 ) ; 
    {
      helpptr = 1 ; 
      helpline [ 0 ] = 1149 ; 
    } 
    putgeterror () ; 
  } 
  else {
      
    mem [ lastpending ] .hhfield .v.RH = stashcurexp () ; 
    lastpending = mem [ lastpending ] .hhfield .v.RH ; 
    mem [ lastpending ] .hhfield .v.RH = 0 ; 
  } 
} 
void dostatement ( ) 
{curtype = 1 ; 
  getxnext () ; 
  if ( curcmd > 45 ) 
  {
    if ( curcmd < 82 ) 
    {
      {
	if ( interaction == 3 ) 
	; 
	printnl ( 263 ) ; 
	print ( 917 ) ; 
      } 
      printcmdmod ( curcmd , curmod ) ; 
      printchar ( 39 ) ; 
      {
	helpptr = 5 ; 
	helpline [ 4 ] = 918 ; 
	helpline [ 3 ] = 919 ; 
	helpline [ 2 ] = 920 ; 
	helpline [ 1 ] = 921 ; 
	helpline [ 0 ] = 922 ; 
      } 
      backerror () ; 
      getxnext () ; 
    } 
  } 
  else if ( curcmd > 32 ) 
  {
    varflag = 76 ; 
    scanexpression () ; 
    if ( curcmd < 83 ) 
    {
      if ( curcmd == 53 ) 
      doequation () ; 
      else if ( curcmd == 76 ) 
      doassignment () ; 
      else if ( curtype == 4 ) 
      {
	if ( internal [ 1 ] > 0 ) 
	{
	  printnl ( 285 ) ; 
	  slowprint ( curexp ) ; 
	  flush ( termout ) ; 
	} 
      } 
      else if ( curtype != 1 ) 
      {
	disperr ( 0 , 927 ) ; 
	{
	  helpptr = 3 ; 
	  helpline [ 2 ] = 928 ; 
	  helpline [ 1 ] = 929 ; 
	  helpline [ 0 ] = 930 ; 
	} 
	putgeterror () ; 
      } 
      flushcurexp ( 0 ) ; 
      curtype = 1 ; 
    } 
  } 
  else {
      
    if ( internal [ 6 ] > 0 ) 
    showcmdmod ( curcmd , curmod ) ; 
    switch ( curcmd ) 
    {case 32 : 
      dotypedeclaration () ; 
      break ; 
    case 18 : 
      if ( curmod > 2 ) 
      makeopdef () ; 
      else if ( curmod > 0 ) 
      scandef () ; 
      break ; 
    case 26 : 
      dorandomseed () ; 
      break ; 
    case 25 : 
      {
	println () ; 
	interaction = curmod ; 
	if ( interaction == 0 ) 
	selector = 4 ; 
	else selector = 5 ; 
	if ( logopened ) 
	selector = selector + 2 ; 
	getxnext () ; 
      } 
      break ; 
    case 23 : 
      doprotection () ; 
      break ; 
    case 29 : 
      defdelims () ; 
      break ; 
    case 14 : 
      do {
	  getsymbol () ; 
	savevariable ( cursym ) ; 
	getxnext () ; 
      } while ( ! ( curcmd != 81 ) ) ; 
      break ; 
    case 15 : 
      dointerim () ; 
      break ; 
    case 16 : 
      dolet () ; 
      break ; 
    case 17 : 
      donewinternal () ; 
      break ; 
    case 24 : 
      doshowwhatever () ; 
      break ; 
    case 20 : 
      doaddto () ; 
      break ; 
    case 21 : 
      dobounds () ; 
      break ; 
    case 19 : 
      doshipout () ; 
      break ; 
    case 28 : 
      {
	getsymbol () ; 
	startsym = cursym ; 
	getxnext () ; 
      } 
      break ; 
    case 27 : 
      domessage () ; 
      break ; 
    case 31 : 
      dowrite () ; 
      break ; 
    case 22 : 
      dotfmcommand () ; 
      break ; 
    case 30 : 
      dospecial () ; 
      break ; 
    } 
    curtype = 1 ; 
  } 
  if ( curcmd < 82 ) 
  {
    {
      if ( interaction == 3 ) 
      ; 
      printnl ( 263 ) ; 
      print ( 923 ) ; 
    } 
    {
      helpptr = 6 ; 
      helpline [ 5 ] = 924 ; 
      helpline [ 4 ] = 925 ; 
      helpline [ 3 ] = 926 ; 
      helpline [ 2 ] = 920 ; 
      helpline [ 1 ] = 921 ; 
      helpline [ 0 ] = 922 ; 
    } 
    backerror () ; 
    scannerstatus = 2 ; 
    do {
	{ 
	getnext () ; 
	if ( curcmd <= 3 ) 
	tnext () ; 
      } 
      if ( curcmd == 41 ) 
      {
	if ( strref [ curmod ] < 127 ) 
	if ( strref [ curmod ] > 1 ) 
	decr ( strref [ curmod ] ) ; 
	else flushstring ( curmod ) ; 
      } 
    } while ( ! ( curcmd > 81 ) ) ; 
    scannerstatus = 0 ; 
  } 
  errorcount = 0 ; 
} 
void maincontrol ( ) 
{do {
    dostatement () ; 
    if ( curcmd == 83 ) 
    {
      {
	if ( interaction == 3 ) 
	; 
	printnl ( 263 ) ; 
	print ( 958 ) ; 
      } 
      {
	helpptr = 2 ; 
	helpline [ 1 ] = 959 ; 
	helpline [ 0 ] = 731 ; 
      } 
      flusherror ( 0 ) ; 
    } 
  } while ( ! ( curcmd == 84 ) ) ; 
} 
halfword zsortin ( v ) 
scaled v ; 
{/* 40 */ register halfword Result; halfword p, q, r  ; 
  p = memtop - 1 ; 
  while ( true ) {
      
    q = mem [ p ] .hhfield .v.RH ; 
    if ( v <= mem [ q + 1 ] .cint ) 
    goto lab40 ; 
    p = q ; 
  } 
  lab40: if ( v < mem [ q + 1 ] .cint ) 
  {
    r = getnode ( 2 ) ; 
    mem [ r + 1 ] .cint = v ; 
    mem [ r ] .hhfield .v.RH = q ; 
    mem [ p ] .hhfield .v.RH = r ; 
  } 
  Result = mem [ p ] .hhfield .v.RH ; 
  return(Result) ; 
} 
integer zmincover ( d ) 
scaled d ; 
{register integer Result; halfword p  ; 
  scaled l  ; 
  integer m  ; 
  m = 0 ; 
  p = mem [ memtop - 1 ] .hhfield .v.RH ; 
  perturbation = 2147483647L ; 
  while ( p != 11 ) {
      
    incr ( m ) ; 
    l = mem [ p + 1 ] .cint ; 
    do {
	p = mem [ p ] .hhfield .v.RH ; 
    } while ( ! ( mem [ p + 1 ] .cint > l + d ) ) ; 
    if ( mem [ p + 1 ] .cint - l < perturbation ) 
    perturbation = mem [ p + 1 ] .cint - l ; 
  } 
  Result = m ; 
  return(Result) ; 
} 
scaled zcomputethreshold ( m ) 
integer m ; 
{register scaled Result; scaled d  ; 
  excess = mincover ( 0 ) - m ; 
  if ( excess <= 0 ) 
  Result = 0 ; 
  else {
      
    do {
	d = perturbation ; 
    } while ( ! ( mincover ( d + d ) <= m ) ) ; 
    while ( mincover ( d ) > m ) d = perturbation ; 
    Result = d ; 
  } 
  return(Result) ; 
} 
integer zskimp ( m ) 
integer m ; 
{register integer Result; scaled d  ; 
  halfword p, q, r  ; 
  scaled l  ; 
  scaled v  ; 
  d = computethreshold ( m ) ; 
  perturbation = 0 ; 
  q = memtop - 1 ; 
  m = 0 ; 
  p = mem [ memtop - 1 ] .hhfield .v.RH ; 
  while ( p != 11 ) {
      
    incr ( m ) ; 
    l = mem [ p + 1 ] .cint ; 
    mem [ p ] .hhfield .lhfield = m ; 
    if ( mem [ mem [ p ] .hhfield .v.RH + 1 ] .cint <= l + d ) 
    {
      do {
	  p = mem [ p ] .hhfield .v.RH ; 
	mem [ p ] .hhfield .lhfield = m ; 
	decr ( excess ) ; 
	if ( excess == 0 ) 
	d = 0 ; 
      } while ( ! ( mem [ mem [ p ] .hhfield .v.RH + 1 ] .cint > l + d ) ) ; 
      v = l + halfp ( mem [ p + 1 ] .cint - l ) ; 
      if ( mem [ p + 1 ] .cint - v > perturbation ) 
      perturbation = mem [ p + 1 ] .cint - v ; 
      r = q ; 
      do {
	  r = mem [ r ] .hhfield .v.RH ; 
	mem [ r + 1 ] .cint = v ; 
      } while ( ! ( r == p ) ) ; 
      mem [ q ] .hhfield .v.RH = p ; 
    } 
    q = p ; 
    p = mem [ p ] .hhfield .v.RH ; 
  } 
  Result = m ; 
  return(Result) ; 
} 
void ztfmwarning ( m ) 
smallnumber m ; 
{printnl ( 1088 ) ; 
  print ( intname [ m ] ) ; 
  print ( 1089 ) ; 
  printscaled ( perturbation ) ; 
  print ( 1090 ) ; 
} 
void fixdesignsize ( ) 
{scaled d  ; 
  d = internal [ 23 ] ; 
  if ( ( d < 65536L ) || ( d >= 134217728L ) ) 
  {
    if ( d != 0 ) 
    printnl ( 1091 ) ; 
    d = 8388608L ; 
    internal [ 23 ] = d ; 
  } 
  if ( headerbyte [ 5 ] < 0 ) 
  if ( headerbyte [ 6 ] < 0 ) 
  if ( headerbyte [ 7 ] < 0 ) 
  if ( headerbyte [ 8 ] < 0 ) 
  {
    headerbyte [ 5 ] = d / 1048576L ; 
    headerbyte [ 6 ] = ( d / 4096 ) % 256 ; 
    headerbyte [ 7 ] = ( d / 16 ) % 256 ; 
    headerbyte [ 8 ] = ( d % 16 ) * 16 ; 
  } 
  maxtfmdimen = 16 * internal [ 23 ] - internal [ 23 ] / 2097152L ; 
  if ( maxtfmdimen >= 134217728L ) 
  maxtfmdimen = 134217727L ; 
} 
integer zdimenout ( x ) 
scaled x ; 
{register integer Result; if ( abs ( x ) > maxtfmdimen ) 
  {
    incr ( tfmchanged ) ; 
    if ( x > 0 ) 
    x = 16777215L ; 
    else x = -16777215L ; 
  } 
  else x = makescaled ( x * 16 , internal [ 23 ] ) ; 
  Result = x ; 
  return(Result) ; 
} 
void fixchecksum ( ) 
{/* 10 */ eightbits k  ; 
  eightbits lb1, b2, b3, b4  ; 
  integer x  ; 
  if ( headerbyte [ 1 ] < 0 ) 
  if ( headerbyte [ 2 ] < 0 ) 
  if ( headerbyte [ 3 ] < 0 ) 
  if ( headerbyte [ 4 ] < 0 ) 
  {
    lb1 = bc ; 
    b2 = ec ; 
    b3 = bc ; 
    b4 = ec ; 
    tfmchanged = 0 ; 
    {register integer for_end; k = bc ; for_end = ec ; if ( k <= for_end) do 
      if ( charexists [ k ] ) 
      {
	x = dimenout ( mem [ tfmwidth [ k ] + 1 ] .cint ) + ( k + 4 ) * 
	4194304L ; 
	lb1 = ( lb1 + lb1 + x ) % 255 ; 
	b2 = ( b2 + b2 + x ) % 253 ; 
	b3 = ( b3 + b3 + x ) % 251 ; 
	b4 = ( b4 + b4 + x ) % 247 ; 
      } 
    while ( k++ < for_end ) ; } 
    headerbyte [ 1 ] = lb1 ; 
    headerbyte [ 2 ] = b2 ; 
    headerbyte [ 3 ] = b3 ; 
    headerbyte [ 4 ] = b4 ; 
    goto lab10 ; 
  } 
  {register integer for_end; k = 1 ; for_end = 4 ; if ( k <= for_end) do 
    if ( headerbyte [ k ] < 0 ) 
    headerbyte [ k ] = 0 ; 
  while ( k++ < for_end ) ; } 
  lab10: ; 
} 
void ztfmqqqq ( x ) 
fourquarters x ; 
{bwritebyte ( tfmfile , x .b0 ) ; 
  bwritebyte ( tfmfile , x .b1 ) ; 
  bwritebyte ( tfmfile , x .b2 ) ; 
  bwritebyte ( tfmfile , x .b3 ) ; 
} 
boolean openmemfile ( ) 
{/* 40 10 */ register boolean Result; integer j  ; 
  j = curinput .locfield ; 
  if ( buffer [ curinput .locfield ] == 38 ) 
  {
    incr ( curinput .locfield ) ; 
    j = curinput .locfield ; 
    buffer [ last ] = 32 ; 
    while ( buffer [ j ] != 32 ) incr ( j ) ; 
    packbufferedname ( 0 , curinput .locfield , j - 1 ) ; 
    if ( wopenin ( memfile ) ) 
    goto lab40 ; 
    fprintf( termout , "%s%s\n",  "Sorry, I can't find that mem file;" ,     " will try PLAIN." ) ; 
    flush ( termout ) ; 
  } 
  packbufferedname ( 5 , 1 , 0 ) ; 
  if ( ! wopenin ( memfile ) ) 
  {
    ; 
    fprintf( termout , "%s\n",  "I can't find the PLAIN mem file!" ) ; 
    Result = false ; 
    goto lab10 ; 
  } 
  lab40: curinput .locfield = j ; 
  Result = true ; 
  lab10: ; 
  return(Result) ; 
} 
boolean loadmemfile ( ) 
{/* 30 6666 10 */ register boolean Result; integer k  ; 
  halfword p, q  ; 
  integer x  ; 
  strnumber s  ; 
  fourquarters w  ; 
  undumpint ( x ) ; 
  if ( x != 473641430L ) 
  goto lab6666 ; 
  undumpint ( x ) ; 
  if ( x != 0 ) 
  goto lab6666 ; 
  undumpint ( x ) ; 
  if ( x != memtop ) 
  goto lab6666 ; 
  undumpint ( x ) ; 
  if ( x != 2100 ) 
  goto lab6666 ; 
  undumpint ( x ) ; 
  if ( x != 1777 ) 
  goto lab6666 ; 
  undumpint ( x ) ; 
  if ( x != 15 ) 
  goto lab6666 ; 
  {
    undumpint ( x ) ; 
    if ( x < 0 ) 
    goto lab6666 ; 
    if ( x > poolsize ) 
    {
      ; 
      fprintf( termout , "%s%s\n",  "---! Must increase the " , "string pool size" ) ; 
      goto lab6666 ; 
    } 
    else poolptr = x ; 
  } 
  {
    undumpint ( x ) ; 
    if ( x < 0 ) 
    goto lab6666 ; 
    if ( x > maxstrings - 1 ) 
    {
      ; 
      fprintf( termout , "%s%s\n",  "---! Must increase the " , "max strings" ) ; 
      goto lab6666 ; 
    } 
    else maxstrptr = x ; 
  } 
  {
    undumpint ( x ) ; 
    if ( ( x < 0 ) || ( x > maxstrptr ) ) 
    goto lab6666 ; 
    else strptr = x ; 
  } 
  {
    undumpint ( x ) ; 
    if ( ( x < 0 ) || ( x > maxstrptr + 1 ) ) 
    goto lab6666 ; 
    else s = x ; 
  } 
  {register integer for_end; k = 0 ; for_end = s - 1 ; if ( k <= for_end) do 
    nextstr [ k ] = k + 1 ; 
  while ( k++ < for_end ) ; } 
  {register integer for_end; k = s ; for_end = maxstrptr ; if ( k <= for_end) 
  do 
    {
      undumpint ( x ) ; 
      if ( ( x < s + 1 ) || ( x > maxstrptr + 1 ) ) 
      goto lab6666 ; 
      else nextstr [ k ] = x ; 
    } 
  while ( k++ < for_end ) ; } 
  fixedstruse = 0 ; 
  k = 0 ; 
  while ( true ) {
      
    {
      undumpint ( x ) ; 
      if ( ( x < 0 ) || ( x > poolptr ) ) 
      goto lab6666 ; 
      else strstart [ k ] = x ; 
    } 
    if ( k == strptr ) 
    goto lab30 ; 
    strref [ k ] = 127 ; 
    incr ( fixedstruse ) ; 
    lastfixedstr = k ; 
    k = nextstr [ k ] ; 
  } 
  lab30: k = 0 ; 
  while ( k + 4 < poolptr ) {
      
    undumpqqqq ( w ) ; 
    strpool [ k ] = w .b0 ; 
    strpool [ k + 1 ] = w .b1 ; 
    strpool [ k + 2 ] = w .b2 ; 
    strpool [ k + 3 ] = w .b3 ; 
    k = k + 4 ; 
  } 
  k = poolptr - 4 ; 
  undumpqqqq ( w ) ; 
  strpool [ k ] = w .b0 ; 
  strpool [ k + 1 ] = w .b1 ; 
  strpool [ k + 2 ] = w .b2 ; 
  strpool [ k + 3 ] = w .b3 ; 
  initstruse = fixedstruse ; 
  initpoolptr = poolptr ; 
  maxpoolptr = poolptr ; 
  strsusedup = fixedstruse ; 
	;
#ifdef STAT
  poolinuse = strstart [ strptr ] ; 
  strsinuse = fixedstruse ; 
  maxplused = poolinuse ; 
  maxstrsused = strsinuse ; 
  pactcount = 0 ; 
  pactchars = 0 ; 
  pactstrs = 0 ; 
#endif /* STAT */
  {
    undumpint ( x ) ; 
    if ( ( x < 1023 ) || ( x > memtop - 4 ) ) 
    goto lab6666 ; 
    else lomemmax = x ; 
  } 
  {
    undumpint ( x ) ; 
    if ( ( x < 24 ) || ( x > lomemmax ) ) 
    goto lab6666 ; 
    else rover = x ; 
  } 
  p = 0 ; 
  q = rover ; 
  do {
      { register integer for_end; k = p ; for_end = q + 1 ; if ( k <= 
    for_end) do 
      undumpwd ( mem [ k ] ) ; 
    while ( k++ < for_end ) ; } 
    p = q + mem [ q ] .hhfield .lhfield ; 
    if ( ( p > lomemmax ) || ( ( q >= mem [ q + 1 ] .hhfield .v.RH ) && ( mem 
    [ q + 1 ] .hhfield .v.RH != rover ) ) ) 
    goto lab6666 ; 
    q = mem [ q + 1 ] .hhfield .v.RH ; 
  } while ( ! ( q == rover ) ) ; 
  {register integer for_end; k = p ; for_end = lomemmax ; if ( k <= for_end) 
  do 
    undumpwd ( mem [ k ] ) ; 
  while ( k++ < for_end ) ; } 
  {
    undumpint ( x ) ; 
    if ( ( x < lomemmax + 1 ) || ( x > memtop - 3 ) ) 
    goto lab6666 ; 
    else himemmin = x ; 
  } 
  {
    undumpint ( x ) ; 
    if ( ( x < 0 ) || ( x > memtop ) ) 
    goto lab6666 ; 
    else avail = x ; 
  } 
  memend = memtop ; 
  {register integer for_end; k = himemmin ; for_end = memend ; if ( k <= 
  for_end) do 
    undumpwd ( mem [ k ] ) ; 
  while ( k++ < for_end ) ; } 
  undumpint ( varused ) ; 
  undumpint ( dynused ) ; 
  {
    undumpint ( x ) ; 
    if ( ( x < 1 ) || ( x > 2357 ) ) 
    goto lab6666 ; 
    else hashused = x ; 
  } 
  p = 0 ; 
  do {
      { 
      undumpint ( x ) ; 
      if ( ( x < p + 1 ) || ( x > hashused ) ) 
      goto lab6666 ; 
      else p = x ; 
    } 
    undumphh ( hash [ p ] ) ; 
    undumphh ( eqtb [ p ] ) ; 
  } while ( ! ( p == hashused ) ) ; 
  {register integer for_end; p = hashused + 1 ; for_end = 2371 ; if ( p <= 
  for_end) do 
    {
      undumphh ( hash [ p ] ) ; 
      undumphh ( eqtb [ p ] ) ; 
    } 
  while ( p++ < for_end ) ; } 
  undumpint ( stcount ) ; 
  {
    undumpint ( x ) ; 
    if ( ( x < 33 ) || ( x > maxinternal ) ) 
    goto lab6666 ; 
    else intptr = x ; 
  } 
  {register integer for_end; k = 1 ; for_end = intptr ; if ( k <= for_end) do 
    {
      undumpint ( internal [ k ] ) ; 
      {
	undumpint ( x ) ; 
	if ( ( x < 0 ) || ( x > strptr ) ) 
	goto lab6666 ; 
	else intname [ k ] = x ; 
      } 
    } 
  while ( k++ < for_end ) ; } 
  {
    undumpint ( x ) ; 
    if ( ( x < 0 ) || ( x > 2357 ) ) 
    goto lab6666 ; 
    else startsym = x ; 
  } 
  {
    undumpint ( x ) ; 
    if ( ( x < 0 ) || ( x > 3 ) ) 
    goto lab6666 ; 
    else interaction = x ; 
  } 
  {
    undumpint ( x ) ; 
    if ( ( x < 0 ) || ( x > strptr ) ) 
    goto lab6666 ; 
    else memident = x ; 
  } 
  {
    undumpint ( x ) ; 
    if ( ( x < 1 ) || ( x > 2371 ) ) 
    goto lab6666 ; 
    else bgloc = x ; 
  } 
  {
    undumpint ( x ) ; 
    if ( ( x < 1 ) || ( x > 2371 ) ) 
    goto lab6666 ; 
    else egloc = x ; 
  } 
  undumpint ( serialno ) ; 
  undumpint ( x ) ; 
  if ( ( x != 69073L ) || feof ( memfile ) ) 
  goto lab6666 ; 
  Result = true ; 
  goto lab10 ; 
  lab6666: ; 
  fprintf( termout , "%s\n",  "(Fatal mem file error; I'm stymied)" ) ; 
  Result = false ; 
  lab10: ; 
  return(Result) ; 
} 
void scanprimary ( ) 
{/* 20 30 31 32 */ halfword p, q, r  ; 
  quarterword c  ; 
  char myvarflag  ; 
  halfword ldelim, rdelim  ; 
  integer groupline  ; 
  scaled num, denom  ; 
  halfword prehead, posthead, tail  ; 
  smallnumber tt  ; 
  halfword t  ; 
  halfword macroref  ; 
  myvarflag = varflag ; 
  varflag = 0 ; 
  lab20: {
      
    if ( aritherror ) 
    cleararith () ; 
  } 
	;
#ifdef DEBUG
  if ( panicking ) 
  checkmem ( false ) ; 
#endif /* DEBUG */
  if ( interrupt != 0 ) 
  if ( OKtointerrupt ) 
  {
    backinput () ; 
    {
      if ( interrupt != 0 ) 
      pauseforinstructions () ; 
    } 
    getxnext () ; 
  } 
  switch ( curcmd ) 
  {case 33 : 
    {
      ldelim = cursym ; 
      rdelim = curmod ; 
      getxnext () ; 
      scanexpression () ; 
      if ( ( curcmd == 81 ) && ( curtype >= 16 ) ) 
      {
	p = stashcurexp () ; 
	getxnext () ; 
	scanexpression () ; 
	if ( curtype < 16 ) 
	{
	  disperr ( 0 , 824 ) ; 
	  {
	    helpptr = 4 ; 
	    helpline [ 3 ] = 825 ; 
	    helpline [ 2 ] = 826 ; 
	    helpline [ 1 ] = 827 ; 
	    helpline [ 0 ] = 828 ; 
	  } 
	  putgetflusherror ( 0 ) ; 
	} 
	q = getnode ( 2 ) ; 
	mem [ q ] .hhfield .b1 = 14 ; 
	if ( curcmd == 81 ) 
	mem [ q ] .hhfield .b0 = 13 ; 
	else mem [ q ] .hhfield .b0 = 14 ; 
	initbignode ( q ) ; 
	r = mem [ q + 1 ] .cint ; 
	stashin ( r + 2 ) ; 
	unstashcurexp ( p ) ; 
	stashin ( r ) ; 
	if ( curcmd == 81 ) 
	{
	  getxnext () ; 
	  scanexpression () ; 
	  if ( curtype < 16 ) 
	  {
	    disperr ( 0 , 829 ) ; 
	    {
	      helpptr = 3 ; 
	      helpline [ 2 ] = 830 ; 
	      helpline [ 1 ] = 827 ; 
	      helpline [ 0 ] = 828 ; 
	    } 
	    putgetflusherror ( 0 ) ; 
	  } 
	  stashin ( r + 4 ) ; 
	} 
	checkdelimiter ( ldelim , rdelim ) ; 
	curtype = mem [ q ] .hhfield .b0 ; 
	curexp = q ; 
      } 
      else checkdelimiter ( ldelim , rdelim ) ; 
    } 
    break ; 
  case 34 : 
    {
      groupline = trueline () ; 
      if ( internal [ 6 ] > 0 ) 
      showcmdmod ( curcmd , curmod ) ; 
      {
	p = getavail () ; 
	mem [ p ] .hhfield .lhfield = 0 ; 
	mem [ p ] .hhfield .v.RH = saveptr ; 
	saveptr = p ; 
      } 
      do {
	  dostatement () ; 
      } while ( ! ( curcmd != 82 ) ) ; 
      if ( curcmd != 83 ) 
      {
	{
	  if ( interaction == 3 ) 
	  ; 
	  printnl ( 263 ) ; 
	  print ( 831 ) ; 
	} 
	printint ( groupline ) ; 
	print ( 832 ) ; 
	{
	  helpptr = 2 ; 
	  helpline [ 1 ] = 833 ; 
	  helpline [ 0 ] = 834 ; 
	} 
	backerror () ; 
	curcmd = 83 ; 
      } 
      unsave () ; 
      if ( internal [ 6 ] > 0 ) 
      showcmdmod ( curcmd , curmod ) ; 
    } 
    break ; 
  case 41 : 
    {
      curtype = 4 ; 
      curexp = curmod ; 
    } 
    break ; 
  case 44 : 
    {
      curexp = curmod ; 
      curtype = 16 ; 
      getxnext () ; 
      if ( curcmd != 56 ) 
      {
	num = 0 ; 
	denom = 0 ; 
      } 
      else {
	  
	getxnext () ; 
	if ( curcmd != 44 ) 
	{
	  backinput () ; 
	  curcmd = 56 ; 
	  curmod = 91 ; 
	  cursym = 2361 ; 
	  goto lab30 ; 
	} 
	num = curexp ; 
	denom = curmod ; 
	if ( denom == 0 ) 
	{
	  {
	    if ( interaction == 3 ) 
	    ; 
	    printnl ( 263 ) ; 
	    print ( 835 ) ; 
	  } 
	  {
	    helpptr = 1 ; 
	    helpline [ 0 ] = 836 ; 
	  } 
	  error () ; 
	} 
	else curexp = makescaled ( num , denom ) ; 
	{
	  if ( aritherror ) 
	  cleararith () ; 
	} 
	getxnext () ; 
      } 
      if ( curcmd >= 32 ) 
      if ( curcmd < 44 ) 
      {
	p = stashcurexp () ; 
	scanprimary () ; 
	if ( ( abs ( num ) >= abs ( denom ) ) || ( curtype < 13 ) ) 
	dobinary ( p , 90 ) ; 
	else {
	    
	  fracmult ( num , denom ) ; 
	  freenode ( p , 2 ) ; 
	} 
      } 
      goto lab30 ; 
    } 
    break ; 
  case 35 : 
    donullary ( curmod ) ; 
    break ; 
  case 36 : 
  case 32 : 
  case 38 : 
  case 45 : 
    {
      c = curmod ; 
      getxnext () ; 
      scanprimary () ; 
      dounary ( c ) ; 
      goto lab30 ; 
    } 
    break ; 
  case 39 : 
    {
      c = curmod ; 
      getxnext () ; 
      scanexpression () ; 
      if ( curcmd != 70 ) 
      {
	missingerr ( 489 ) ; 
	print ( 757 ) ; 
	printcmdmod ( 39 , c ) ; 
	{
	  helpptr = 1 ; 
	  helpline [ 0 ] = 758 ; 
	} 
	backerror () ; 
      } 
      p = stashcurexp () ; 
      getxnext () ; 
      scanprimary () ; 
      dobinary ( p , c ) ; 
      goto lab30 ; 
    } 
    break ; 
  case 37 : 
    {
      getxnext () ; 
      scansuffix () ; 
      oldsetting = selector ; 
      selector = 10 ; 
      showtokenlist ( curexp , 0 , 100000L , 0 ) ; 
      flushtokenlist ( curexp ) ; 
      curexp = makestring () ; 
      selector = oldsetting ; 
      curtype = 4 ; 
      goto lab30 ; 
    } 
    break ; 
  case 42 : 
    {
      q = curmod ; 
      if ( myvarflag == 76 ) 
      {
	getxnext () ; 
	if ( curcmd == 76 ) 
	{
	  curexp = getavail () ; 
	  mem [ curexp ] .hhfield .lhfield = q + 2371 ; 
	  curtype = 20 ; 
	  goto lab30 ; 
	} 
	backinput () ; 
      } 
      curtype = 16 ; 
      curexp = internal [ q ] ; 
    } 
    break ; 
  case 40 : 
    makeexpcopy ( curmod ) ; 
    break ; 
  case 43 : 
    {
      {
	prehead = avail ; 
	if ( prehead == 0 ) 
	prehead = getavail () ; 
	else {
	    
	  avail = mem [ prehead ] .hhfield .v.RH ; 
	  mem [ prehead ] .hhfield .v.RH = 0 ; 
	;
#ifdef STAT
	  incr ( dynused ) ; 
#endif /* STAT */
	} 
      } 
      tail = prehead ; 
      posthead = 0 ; 
      tt = 1 ; 
      while ( true ) {
	  
	t = curtok () ; 
	mem [ tail ] .hhfield .v.RH = t ; 
	if ( tt != 0 ) 
	{
	  {
	    p = mem [ prehead ] .hhfield .v.RH ; 
	    q = mem [ p ] .hhfield .lhfield ; 
	    tt = 0 ; 
	    if ( eqtb [ q ] .lhfield % 85 == 43 ) 
	    {
	      q = eqtb [ q ] .v.RH ; 
	      if ( q == 0 ) 
	      goto lab32 ; 
	      while ( true ) {
		  
		p = mem [ p ] .hhfield .v.RH ; 
		if ( p == 0 ) 
		{
		  tt = mem [ q ] .hhfield .b0 ; 
		  goto lab32 ; 
		} 
		if ( mem [ q ] .hhfield .b0 != 21 ) 
		goto lab32 ; 
		q = mem [ mem [ q + 1 ] .hhfield .lhfield ] .hhfield .v.RH ; 
		if ( p >= himemmin ) 
		{
		  do {
		      q = mem [ q ] .hhfield .v.RH ; 
		  } while ( ! ( mem [ q + 2 ] .hhfield .lhfield >= mem [ p ] .hhfield .lhfield ) ) ; 
		  if ( mem [ q + 2 ] .hhfield .lhfield > mem [ p ] .hhfield .lhfield ) 
		  goto lab32 ; 
		} 
	      } 
	    } 
	    lab32: ; 
	  } 
	  if ( tt >= 22 ) 
	  {
	    mem [ tail ] .hhfield .v.RH = 0 ; 
	    if ( tt > 22 ) 
	    {
	      posthead = getavail () ; 
	      tail = posthead ; 
	      mem [ tail ] .hhfield .v.RH = t ; 
	      tt = 0 ; 
	      macroref = mem [ q + 1 ] .cint ; 
	      incr ( mem [ macroref ] .hhfield .lhfield ) ; 
	    } 
	    else {
		
	      p = getavail () ; 
	      mem [ prehead ] .hhfield .lhfield = mem [ prehead ] .hhfield .v.RH ; 
	      mem [ prehead ] .hhfield .v.RH = p ; 
	      mem [ p ] .hhfield .lhfield = t ; 
	      macrocall ( mem [ q + 1 ] .cint , prehead , 0 ) ; 
	      getxnext () ; 
	      goto lab20 ; 
	    } 
	  } 
	} 
	getxnext () ; 
	tail = t ; 
	if ( curcmd == 65 ) 
	{
	  getxnext () ; 
	  scanexpression () ; 
	  if ( curcmd != 66 ) 
	  {
	    backinput () ; 
	    backexpr () ; 
	    curcmd = 65 ; 
	    curmod = 0 ; 
	    cursym = 2360 ; 
	  } 
	  else {
	      
	    if ( curtype != 16 ) 
	    badsubscript () ; 
	    curcmd = 44 ; 
	    curmod = curexp ; 
	    cursym = 0 ; 
	  } 
	} 
	if ( curcmd > 44 ) 
	goto lab31 ; 
	if ( curcmd < 42 ) 
	goto lab31 ; 
      } 
      lab31: if ( posthead != 0 ) 
      {
	backinput () ; 
	p = getavail () ; 
	q = mem [ posthead ] .hhfield .v.RH ; 
	mem [ prehead ] .hhfield .lhfield = mem [ prehead ] .hhfield .v.RH ; 
	mem [ prehead ] .hhfield .v.RH = posthead ; 
	mem [ posthead ] .hhfield .lhfield = q ; 
	mem [ posthead ] .hhfield .v.RH = p ; 
	mem [ p ] .hhfield .lhfield = mem [ q ] .hhfield .v.RH ; 
	mem [ q ] .hhfield .v.RH = 0 ; 
	macrocall ( macroref , prehead , 0 ) ; 
	decr ( mem [ macroref ] .hhfield .lhfield ) ; 
	getxnext () ; 
	goto lab20 ; 
      } 
      q = mem [ prehead ] .hhfield .v.RH ; 
      {
	mem [ prehead ] .hhfield .v.RH = avail ; 
	avail = prehead ; 
	;
#ifdef STAT
	decr ( dynused ) ; 
#endif /* STAT */
      } 
      if ( curcmd == myvarflag ) 
      {
	curtype = 20 ; 
	curexp = q ; 
	goto lab30 ; 
      } 
      p = findvariable ( q ) ; 
      if ( p != 0 ) 
      makeexpcopy ( p ) ; 
      else {
	  
	obliterated ( q ) ; 
	helpline [ 2 ] = 848 ; 
	helpline [ 1 ] = 849 ; 
	helpline [ 0 ] = 850 ; 
	putgetflusherror ( 0 ) ; 
      } 
      flushnodelist ( q ) ; 
      goto lab30 ; 
    } 
    break ; 
    default: 
    {
      badexp ( 818 ) ; 
      goto lab20 ; 
    } 
    break ; 
  } 
  getxnext () ; 
  lab30: if ( curcmd == 65 ) 
  if ( curtype >= 16 ) 
  {
    p = stashcurexp () ; 
    getxnext () ; 
    scanexpression () ; 
    if ( curcmd != 81 ) 
    {
      {
	backinput () ; 
	backexpr () ; 
	curcmd = 65 ; 
	curmod = 0 ; 
	cursym = 2360 ; 
      } 
      unstashcurexp ( p ) ; 
    } 
    else {
	
      q = stashcurexp () ; 
      getxnext () ; 
      scanexpression () ; 
      if ( curcmd != 66 ) 
      {
	missingerr ( 93 ) ; 
	{
	  helpptr = 3 ; 
	  helpline [ 2 ] = 852 ; 
	  helpline [ 1 ] = 853 ; 
	  helpline [ 0 ] = 739 ; 
	} 
	backerror () ; 
      } 
      r = stashcurexp () ; 
      makeexpcopy ( q ) ; 
      dobinary ( r , 89 ) ; 
      dobinary ( p , 90 ) ; 
      dobinary ( q , 88 ) ; 
      getxnext () ; 
    } 
  } 
} 
void scansuffix ( ) 
{/* 30 */ halfword h, t  ; 
  halfword p  ; 
  h = getavail () ; 
  t = h ; 
  while ( true ) {
      
    if ( curcmd == 65 ) 
    {
      getxnext () ; 
      scanexpression () ; 
      if ( curtype != 16 ) 
      badsubscript () ; 
      if ( curcmd != 66 ) 
      {
	missingerr ( 93 ) ; 
	{
	  helpptr = 3 ; 
	  helpline [ 2 ] = 854 ; 
	  helpline [ 1 ] = 853 ; 
	  helpline [ 0 ] = 739 ; 
	} 
	backerror () ; 
      } 
      curcmd = 44 ; 
      curmod = curexp ; 
    } 
    if ( curcmd == 44 ) 
    p = newnumtok ( curmod ) ; 
    else if ( ( curcmd == 43 ) || ( curcmd == 42 ) ) 
    {
      p = getavail () ; 
      mem [ p ] .hhfield .lhfield = cursym ; 
    } 
    else goto lab30 ; 
    mem [ t ] .hhfield .v.RH = p ; 
    t = p ; 
    getxnext () ; 
  } 
  lab30: curexp = mem [ h ] .hhfield .v.RH ; 
  {
    mem [ h ] .hhfield .v.RH = avail ; 
    avail = h ; 
	;
#ifdef STAT
    decr ( dynused ) ; 
#endif /* STAT */
  } 
  curtype = 20 ; 
} 
void scansecondary ( ) 
{/* 20 22 */ halfword p  ; 
  halfword c, d  ; 
  halfword macname  ; 
  lab20: if ( ( curcmd < 32 ) || ( curcmd > 45 ) ) 
  badexp ( 855 ) ; 
  scanprimary () ; 
  lab22: if ( curcmd <= 57 ) 
  if ( curcmd >= 54 ) 
  {
    p = stashcurexp () ; 
    c = curmod ; 
    d = curcmd ; 
    if ( d == 55 ) 
    {
      macname = cursym ; 
      incr ( mem [ c ] .hhfield .lhfield ) ; 
    } 
    getxnext () ; 
    scanprimary () ; 
    if ( d != 55 ) 
    dobinary ( p , c ) ; 
    else {
	
      backinput () ; 
      binarymac ( p , c , macname ) ; 
      decr ( mem [ c ] .hhfield .lhfield ) ; 
      getxnext () ; 
      goto lab20 ; 
    } 
    goto lab22 ; 
  } 
} 
void scantertiary ( ) 
{/* 20 22 */ halfword p  ; 
  halfword c, d  ; 
  halfword macname  ; 
  lab20: if ( ( curcmd < 32 ) || ( curcmd > 45 ) ) 
  badexp ( 856 ) ; 
  scansecondary () ; 
  lab22: if ( curcmd <= 47 ) 
  if ( curcmd >= 45 ) 
  {
    p = stashcurexp () ; 
    c = curmod ; 
    d = curcmd ; 
    if ( d == 46 ) 
    {
      macname = cursym ; 
      incr ( mem [ c ] .hhfield .lhfield ) ; 
    } 
    getxnext () ; 
    scansecondary () ; 
    if ( d != 46 ) 
    dobinary ( p , c ) ; 
    else {
	
      backinput () ; 
      binarymac ( p , c , macname ) ; 
      decr ( mem [ c ] .hhfield .lhfield ) ; 
      getxnext () ; 
      goto lab20 ; 
    } 
    goto lab22 ; 
  } 
} 
void scanexpression ( ) 
{/* 20 30 22 25 26 10 */ halfword p, q, r, pp, qq  ; 
  halfword c, d  ; 
  char myvarflag  ; 
  halfword macname  ; 
  boolean cyclehit  ; 
  scaled x, y  ; 
  char t  ; 
  myvarflag = varflag ; 
  lab20: if ( ( curcmd < 32 ) || ( curcmd > 45 ) ) 
  badexp ( 857 ) ; 
  scantertiary () ; 
  lab22: if ( curcmd <= 53 ) 
  if ( curcmd >= 48 ) 
  if ( ( curcmd != 53 ) || ( myvarflag != 76 ) ) 
  {
    p = stashcurexp () ; 
    c = curmod ; 
    d = curcmd ; 
    if ( d == 51 ) 
    {
      macname = cursym ; 
      incr ( mem [ c ] .hhfield .lhfield ) ; 
    } 
    if ( ( d < 50 ) || ( ( d == 50 ) && ( ( mem [ p ] .hhfield .b0 == 14 ) || 
    ( mem [ p ] .hhfield .b0 == 8 ) ) ) ) 
    {
      cyclehit = false ; 
      {
	unstashcurexp ( p ) ; 
	if ( curtype == 14 ) 
	p = newknot () ; 
	else if ( curtype == 8 ) 
	p = curexp ; 
	else goto lab10 ; 
	q = p ; 
	while ( mem [ q ] .hhfield .v.RH != p ) q = mem [ q ] .hhfield .v.RH ; 
	if ( mem [ p ] .hhfield .b0 != 0 ) 
	{
	  r = copyknot ( p ) ; 
	  mem [ q ] .hhfield .v.RH = r ; 
	  q = r ; 
	} 
	mem [ p ] .hhfield .b0 = 4 ; 
	mem [ q ] .hhfield .b1 = 4 ; 
      } 
      lab25: if ( curcmd == 48 ) 
      {
	t = scandirection () ; 
	if ( t != 4 ) 
	{
	  mem [ q ] .hhfield .b1 = t ; 
	  mem [ q + 5 ] .cint = curexp ; 
	  if ( mem [ q ] .hhfield .b0 == 4 ) 
	  {
	    mem [ q ] .hhfield .b0 = t ; 
	    mem [ q + 3 ] .cint = curexp ; 
	  } 
	} 
      } 
      d = curcmd ; 
      if ( d == 49 ) 
      {
	getxnext () ; 
	if ( curcmd == 60 ) 
	{
	  getxnext () ; 
	  y = curcmd ; 
	  if ( curcmd == 61 ) 
	  getxnext () ; 
	  scanprimary () ; 
	  if ( ( curtype != 16 ) || ( curexp < 49152L ) ) 
	  {
	    disperr ( 0 , 875 ) ; 
	    {
	      helpptr = 1 ; 
	      helpline [ 0 ] = 876 ; 
	    } 
	    putgetflusherror ( 65536L ) ; 
	  } 
	  if ( y == 61 ) 
	  curexp = - (integer) curexp ; 
	  mem [ q + 6 ] .cint = curexp ; 
	  if ( curcmd == 54 ) 
	  {
	    getxnext () ; 
	    y = curcmd ; 
	    if ( curcmd == 61 ) 
	    getxnext () ; 
	    scanprimary () ; 
	    if ( ( curtype != 16 ) || ( curexp < 49152L ) ) 
	    {
	      disperr ( 0 , 875 ) ; 
	      {
		helpptr = 1 ; 
		helpline [ 0 ] = 876 ; 
	      } 
	      putgetflusherror ( 65536L ) ; 
	    } 
	    if ( y == 61 ) 
	    curexp = - (integer) curexp ; 
	  } 
	  y = curexp ; 
	} 
	else if ( curcmd == 59 ) 
	{
	  mem [ q ] .hhfield .b1 = 1 ; 
	  t = 1 ; 
	  getxnext () ; 
	  scanprimary () ; 
	  knownpair () ; 
	  mem [ q + 5 ] .cint = curx ; 
	  mem [ q + 6 ] .cint = cury ; 
	  if ( curcmd != 54 ) 
	  {
	    x = mem [ q + 5 ] .cint ; 
	    y = mem [ q + 6 ] .cint ; 
	  } 
	  else {
	      
	    getxnext () ; 
	    scanprimary () ; 
	    knownpair () ; 
	    x = curx ; 
	    y = cury ; 
	  } 
	} 
	else {
	    
	  mem [ q + 6 ] .cint = 65536L ; 
	  y = 65536L ; 
	  backinput () ; 
	  goto lab30 ; 
	} 
	if ( curcmd != 49 ) 
	{
	  missingerr ( 322 ) ; 
	  {
	    helpptr = 1 ; 
	    helpline [ 0 ] = 874 ; 
	  } 
	  backerror () ; 
	} 
	lab30: ; 
      } 
      else if ( d != 50 ) 
      goto lab26 ; 
      getxnext () ; 
      if ( curcmd == 48 ) 
      {
	t = scandirection () ; 
	if ( mem [ q ] .hhfield .b1 != 1 ) 
	x = curexp ; 
	else t = 1 ; 
      } 
      else if ( mem [ q ] .hhfield .b1 != 1 ) 
      {
	t = 4 ; 
	x = 0 ; 
      } 
      if ( curcmd == 38 ) 
      {
	cyclehit = true ; 
	getxnext () ; 
	pp = p ; 
	qq = p ; 
	if ( d == 50 ) 
	if ( p == q ) 
	{
	  d = 49 ; 
	  mem [ q + 6 ] .cint = 65536L ; 
	  y = 65536L ; 
	} 
      } 
      else {
	  
	scantertiary () ; 
	{
	  if ( curtype != 8 ) 
	  pp = newknot () ; 
	  else pp = curexp ; 
	  qq = pp ; 
	  while ( mem [ qq ] .hhfield .v.RH != pp ) qq = mem [ qq ] .hhfield .v.RH ; 
	  if ( mem [ pp ] .hhfield .b0 != 0 ) 
	  {
	    r = copyknot ( pp ) ; 
	    mem [ qq ] .hhfield .v.RH = r ; 
	    qq = r ; 
	  } 
	  mem [ pp ] .hhfield .b0 = 4 ; 
	  mem [ qq ] .hhfield .b1 = 4 ; 
	} 
      } 
      {
	if ( d == 50 ) 
	if ( ( mem [ q + 1 ] .cint != mem [ pp + 1 ] .cint ) || ( mem [ q + 2 
	] .cint != mem [ pp + 2 ] .cint ) ) 
	{
	  {
	    if ( interaction == 3 ) 
	    ; 
	    printnl ( 263 ) ; 
	    print ( 877 ) ; 
	  } 
	  {
	    helpptr = 3 ; 
	    helpline [ 2 ] = 878 ; 
	    helpline [ 1 ] = 879 ; 
	    helpline [ 0 ] = 880 ; 
	  } 
	  putgeterror () ; 
	  d = 49 ; 
	  mem [ q + 6 ] .cint = 65536L ; 
	  y = 65536L ; 
	} 
	if ( mem [ pp ] .hhfield .b1 == 4 ) 
	if ( ( t == 3 ) || ( t == 2 ) ) 
	{
	  mem [ pp ] .hhfield .b1 = t ; 
	  mem [ pp + 5 ] .cint = x ; 
	} 
	if ( d == 50 ) 
	{
	  if ( mem [ q ] .hhfield .b0 == 4 ) 
	  if ( mem [ q ] .hhfield .b1 == 4 ) 
	  {
	    mem [ q ] .hhfield .b0 = 3 ; 
	    mem [ q + 3 ] .cint = 65536L ; 
	  } 
	  if ( mem [ pp ] .hhfield .b1 == 4 ) 
	  if ( t == 4 ) 
	  {
	    mem [ pp ] .hhfield .b1 = 3 ; 
	    mem [ pp + 5 ] .cint = 65536L ; 
	  } 
	  mem [ q ] .hhfield .b1 = mem [ pp ] .hhfield .b1 ; 
	  mem [ q ] .hhfield .v.RH = mem [ pp ] .hhfield .v.RH ; 
	  mem [ q + 5 ] .cint = mem [ pp + 5 ] .cint ; 
	  mem [ q + 6 ] .cint = mem [ pp + 6 ] .cint ; 
	  freenode ( pp , 7 ) ; 
	  if ( qq == pp ) 
	  qq = q ; 
	} 
	else {
	    
	  if ( mem [ q ] .hhfield .b1 == 4 ) 
	  if ( ( mem [ q ] .hhfield .b0 == 3 ) || ( mem [ q ] .hhfield .b0 == 
	  2 ) ) 
	  {
	    mem [ q ] .hhfield .b1 = mem [ q ] .hhfield .b0 ; 
	    mem [ q + 5 ] .cint = mem [ q + 3 ] .cint ; 
	  } 
	  mem [ q ] .hhfield .v.RH = pp ; 
	  mem [ pp + 4 ] .cint = y ; 
	  if ( t != 4 ) 
	  {
	    mem [ pp + 3 ] .cint = x ; 
	    mem [ pp ] .hhfield .b0 = t ; 
	  } 
	} 
	q = qq ; 
      } 
      if ( curcmd >= 48 ) 
      if ( curcmd <= 50 ) 
      if ( ! cyclehit ) 
      goto lab25 ; 
      lab26: if ( cyclehit ) 
      {
	if ( d == 50 ) 
	p = q ; 
      } 
      else {
	  
	mem [ p ] .hhfield .b0 = 0 ; 
	if ( mem [ p ] .hhfield .b1 == 4 ) 
	{
	  mem [ p ] .hhfield .b1 = 3 ; 
	  mem [ p + 5 ] .cint = 65536L ; 
	} 
	mem [ q ] .hhfield .b1 = 0 ; 
	if ( mem [ q ] .hhfield .b0 == 4 ) 
	{
	  mem [ q ] .hhfield .b0 = 3 ; 
	  mem [ q + 3 ] .cint = 65536L ; 
	} 
	mem [ q ] .hhfield .v.RH = p ; 
      } 
      makechoices ( p ) ; 
      curtype = 8 ; 
      curexp = p ; 
    } 
    else {
	
      getxnext () ; 
      scantertiary () ; 
      if ( d != 51 ) 
      dobinary ( p , c ) ; 
      else {
	  
	backinput () ; 
	binarymac ( p , c , macname ) ; 
	decr ( mem [ c ] .hhfield .lhfield ) ; 
	getxnext () ; 
	goto lab20 ; 
      } 
    } 
    goto lab22 ; 
  } 
  lab10: ; 
} 
void getboolean ( ) 
{getxnext () ; 
  scanexpression () ; 
  if ( curtype != 2 ) 
  {
    disperr ( 0 , 881 ) ; 
    {
      helpptr = 2 ; 
      helpline [ 1 ] = 882 ; 
      helpline [ 0 ] = 883 ; 
    } 
    putgetflusherror ( 31 ) ; 
    curtype = 2 ; 
  } 
} 
void printcapsule ( ) 
{printchar ( 40 ) ; 
  printexp ( gpointer , 0 ) ; 
  printchar ( 41 ) ; 
} 
void tokenrecycle ( ) 
{recyclevalue ( gpointer ) ; 
} 
void closefilesandterminate ( ) 
{integer k  ; 
  integer lh  ; 
  short lkoffset  ; 
  halfword p  ; 
  {register integer for_end; k = 0 ; for_end = readfiles - 1 ; if ( k <= 
  for_end) do 
    if ( rdfname [ k ] != 0 ) 
    aclose ( rdfile [ k ] ) ; 
  while ( k++ < for_end ) ; } 
  {register integer for_end; k = 0 ; for_end = writefiles - 1 ; if ( k <= 
  for_end) do 
    if ( wrfname [ k ] != 0 ) 
    aclose ( wrfile [ k ] ) ; 
  while ( k++ < for_end ) ; } 
	;
#ifdef STAT
  if ( internal [ 10 ] > 0 ) 
  if ( logopened ) 
  {
    fprintf( logfile , "%c\n",  ' ' ) ; 
    fprintf( logfile , "%s%s\n",  "Here is how much of MetaPost's memory" , " you used:"     ) ; 
    fprintf( logfile , "%c%ld%s",  ' ' , (long)maxstrsused - initstruse , " string" ) ; 
    if ( maxstrsused != initstruse + 1 ) 
    putc ( 's' ,  logfile );
    fprintf( logfile , "%s%ld\n",  " out of " , (long)maxstrings - 1 - initstruse ) ; 
    fprintf( logfile , "%c%ld%s%ld\n",  ' ' , (long)maxplused - initpoolptr ,     " string characters out of " , (long)poolsize - initpoolptr ) ; 
    fprintf( logfile , "%c%ld%s%ld\n",  ' ' , (long)lomemmax + 0 + memend - himemmin + 2 ,     " words of memory out of " , (long)memend + 1 ) ; 
    fprintf( logfile , "%c%ld%s%ld\n",  ' ' , (long)stcount , " symbolic tokens out of " , (long)2100 ) ; 
    fprintf( logfile , "%c%ld%s%ld%s%ld%s%ld%s%ld%s%ld%s%ld%s%ld%c\n",  ' ' , (long)maxinstack , "i," , (long)intptr , "n," ,     (long)maxparamstack , "p," , (long)maxbufstack + 1 , "b stack positions out of " ,     (long)stacksize , "i," , (long)maxinternal , "n," , (long)150 , "p," , (long)bufsize , 'b' ) ; 
    fprintf( logfile , "%c%ld%s%ld%s%ld%s\n",  ' ' , (long)pactcount , " string compactions (moved " ,     (long)pactchars , " characters, " , (long)pactstrs , " strings)" ) ; 
  } 
#endif /* STAT */
  if ( internal [ 26 ] > 0 ) 
  {
    rover = 24 ; 
    mem [ rover ] .hhfield .v.RH = 65535L ; 
    lomemmax = himemmin - 1 ; 
    if ( lomemmax - rover > 65535L ) 
    lomemmax = 65535L + rover ; 
    mem [ rover ] .hhfield .lhfield = lomemmax - rover ; 
    mem [ rover + 1 ] .hhfield .lhfield = rover ; 
    mem [ rover + 1 ] .hhfield .v.RH = rover ; 
    mem [ lomemmax ] .hhfield .v.RH = 0 ; 
    mem [ lomemmax ] .hhfield .lhfield = 0 ; 
    mem [ memtop - 1 ] .hhfield .v.RH = 11 ; 
    {register integer for_end; k = bc ; for_end = ec ; if ( k <= for_end) do 
      if ( charexists [ k ] ) 
      tfmwidth [ k ] = sortin ( tfmwidth [ k ] ) ; 
    while ( k++ < for_end ) ; } 
    nw = skimp ( 255 ) + 1 ; 
    dimenhead [ 1 ] = mem [ memtop - 1 ] .hhfield .v.RH ; 
    if ( perturbation >= 4096 ) 
    tfmwarning ( 19 ) ; 
    fixdesignsize () ; 
    fixchecksum () ; 
    mem [ memtop - 1 ] .hhfield .v.RH = 11 ; 
    {register integer for_end; k = bc ; for_end = ec ; if ( k <= for_end) do 
      if ( charexists [ k ] ) 
      if ( tfmheight [ k ] == 0 ) 
      tfmheight [ k ] = 7 ; 
      else tfmheight [ k ] = sortin ( tfmheight [ k ] ) ; 
    while ( k++ < for_end ) ; } 
    nh = skimp ( 15 ) + 1 ; 
    dimenhead [ 2 ] = mem [ memtop - 1 ] .hhfield .v.RH ; 
    if ( perturbation >= 4096 ) 
    tfmwarning ( 20 ) ; 
    mem [ memtop - 1 ] .hhfield .v.RH = 11 ; 
    {register integer for_end; k = bc ; for_end = ec ; if ( k <= for_end) do 
      if ( charexists [ k ] ) 
      if ( tfmdepth [ k ] == 0 ) 
      tfmdepth [ k ] = 7 ; 
      else tfmdepth [ k ] = sortin ( tfmdepth [ k ] ) ; 
    while ( k++ < for_end ) ; } 
    nd = skimp ( 15 ) + 1 ; 
    dimenhead [ 3 ] = mem [ memtop - 1 ] .hhfield .v.RH ; 
    if ( perturbation >= 4096 ) 
    tfmwarning ( 21 ) ; 
    mem [ memtop - 1 ] .hhfield .v.RH = 11 ; 
    {register integer for_end; k = bc ; for_end = ec ; if ( k <= for_end) do 
      if ( charexists [ k ] ) 
      if ( tfmitalcorr [ k ] == 0 ) 
      tfmitalcorr [ k ] = 7 ; 
      else tfmitalcorr [ k ] = sortin ( tfmitalcorr [ k ] ) ; 
    while ( k++ < for_end ) ; } 
    ni = skimp ( 63 ) + 1 ; 
    dimenhead [ 4 ] = mem [ memtop - 1 ] .hhfield .v.RH ; 
    if ( perturbation >= 4096 ) 
    tfmwarning ( 22 ) ; 
    internal [ 26 ] = 0 ; 
    if ( jobname == 0 ) 
    openlogfile () ; 
    packjobname ( 1092 ) ; 
    while ( ! bopenout ( tfmfile ) ) promptfilename ( 1093 , 1092 ) ; 
    metricfilename = bmakenamestring ( tfmfile ) ; 
    k = headersize ; 
    while ( headerbyte [ k ] < 0 ) decr ( k ) ; 
    lh = ( k + 3 ) / 4 ; 
    if ( bc > ec ) 
    bc = 1 ; 
    bchar = roundunscaled ( internal [ 31 ] ) ; 
    if ( ( bchar < 0 ) || ( bchar > 255 ) ) 
    {
      bchar = -1 ; 
      lkstarted = false ; 
      lkoffset = 0 ; 
    } 
    else {
	
      lkstarted = true ; 
      lkoffset = 1 ; 
    } 
    k = labelptr ; 
    if ( labelloc [ k ] + lkoffset > 255 ) 
    {
      lkoffset = 0 ; 
      lkstarted = false ; 
      do {
	  charremainder [ labelchar [ k ] ] = lkoffset ; 
	while ( labelloc [ k - 1 ] == labelloc [ k ] ) {
	    
	  decr ( k ) ; 
	  charremainder [ labelchar [ k ] ] = lkoffset ; 
	} 
	incr ( lkoffset ) ; 
	decr ( k ) ; 
      } while ( ! ( lkoffset + labelloc [ k ] < 256 ) ) ; 
    } 
    if ( lkoffset > 0 ) 
    while ( k > 0 ) {
	
      charremainder [ labelchar [ k ] ] = charremainder [ labelchar [ k ] ] + 
      lkoffset ; 
      decr ( k ) ; 
    } 
    if ( bchlabel < ligtablesize ) 
    {
      ligkern [ nl ] .b0 = 255 ; 
      ligkern [ nl ] .b1 = 0 ; 
      ligkern [ nl ] .b2 = ( ( bchlabel + lkoffset ) / 256 ) ; 
      ligkern [ nl ] .b3 = ( ( bchlabel + lkoffset ) % 256 ) ; 
      incr ( nl ) ; 
    } 
    bwrite2bytes ( tfmfile , 6 + lh + ( ec - bc + 1 ) + nw + nh + nd + ni + nl 
    + lkoffset + nk + ne + np ) ; 
    bwrite2bytes ( tfmfile , lh ) ; 
    bwrite2bytes ( tfmfile , bc ) ; 
    bwrite2bytes ( tfmfile , ec ) ; 
    bwrite2bytes ( tfmfile , nw ) ; 
    bwrite2bytes ( tfmfile , nh ) ; 
    bwrite2bytes ( tfmfile , nd ) ; 
    bwrite2bytes ( tfmfile , ni ) ; 
    bwrite2bytes ( tfmfile , nl + lkoffset ) ; 
    bwrite2bytes ( tfmfile , nk ) ; 
    bwrite2bytes ( tfmfile , ne ) ; 
    bwrite2bytes ( tfmfile , np ) ; 
    {register integer for_end; k = 1 ; for_end = 4 * lh ; if ( k <= for_end) 
    do 
      {
	if ( headerbyte [ k ] < 0 ) 
	headerbyte [ k ] = 0 ; 
	bwritebyte ( tfmfile , headerbyte [ k ] ) ; 
      } 
    while ( k++ < for_end ) ; } 
    {register integer for_end; k = bc ; for_end = ec ; if ( k <= for_end) do 
      if ( ! charexists [ k ] ) 
      bwrite4bytes ( tfmfile , 0 ) ; 
      else {
	  
	bwritebyte ( tfmfile , mem [ tfmwidth [ k ] ] .hhfield .lhfield ) ; 
	bwritebyte ( tfmfile , ( mem [ tfmheight [ k ] ] .hhfield .lhfield ) * 
	16 + mem [ tfmdepth [ k ] ] .hhfield .lhfield ) ; 
	bwritebyte ( tfmfile , ( mem [ tfmitalcorr [ k ] ] .hhfield .lhfield ) 
	* 4 + chartag [ k ] ) ; 
	bwritebyte ( tfmfile , charremainder [ k ] ) ; 
      } 
    while ( k++ < for_end ) ; } 
    tfmchanged = 0 ; 
    {register integer for_end; k = 1 ; for_end = 4 ; if ( k <= for_end) do 
      {
	bwrite4bytes ( tfmfile , 0 ) ; 
	p = dimenhead [ k ] ; 
	while ( p != 11 ) {
	    
	  bwrite4bytes ( tfmfile , dimenout ( mem [ p + 1 ] .cint ) ) ; 
	  p = mem [ p ] .hhfield .v.RH ; 
	} 
      } 
    while ( k++ < for_end ) ; } 
    {register integer for_end; k = 0 ; for_end = 255 ; if ( k <= for_end) do 
      if ( skiptable [ k ] < ligtablesize ) 
      {
	printnl ( 1095 ) ; 
	printint ( k ) ; 
	print ( 1096 ) ; 
	ll = skiptable [ k ] ; 
	do {
	    lll = ligkern [ ll ] .b0 ; 
	  ligkern [ ll ] .b0 = 128 ; 
	  ll = ll - lll ; 
	} while ( ! ( lll == 0 ) ) ; 
      } 
    while ( k++ < for_end ) ; } 
    if ( lkstarted ) 
    {
      bwritebyte ( tfmfile , 255 ) ; 
      bwritebyte ( tfmfile , bchar ) ; 
      bwrite2bytes ( tfmfile , 0 ) ; 
    } 
    else {
	register integer for_end; k = 1 ; for_end = lkoffset ; if ( k <= 
    for_end) do 
      {
	ll = labelloc [ labelptr ] ; 
	if ( bchar < 0 ) 
	{
	  bwritebyte ( tfmfile , 254 ) ; 
	  bwritebyte ( tfmfile , 0 ) ; 
	} 
	else {
	    
	  bwritebyte ( tfmfile , 255 ) ; 
	  bwritebyte ( tfmfile , bchar ) ; 
	} 
	bwrite2bytes ( tfmfile , ll + lkoffset ) ; 
	do {
	    decr ( labelptr ) ; 
	} while ( ! ( labelloc [ labelptr ] < ll ) ) ; 
      } 
    while ( k++ < for_end ) ; } 
    {register integer for_end; k = 0 ; for_end = nl - 1 ; if ( k <= for_end) 
    do 
      tfmqqqq ( ligkern [ k ] ) ; 
    while ( k++ < for_end ) ; } 
    {register integer for_end; k = 0 ; for_end = nk - 1 ; if ( k <= for_end) 
    do 
      bwrite4bytes ( tfmfile , dimenout ( kern [ k ] ) ) ; 
    while ( k++ < for_end ) ; } 
    {register integer for_end; k = 0 ; for_end = ne - 1 ; if ( k <= for_end) 
    do 
      tfmqqqq ( exten [ k ] ) ; 
    while ( k++ < for_end ) ; } 
    {register integer for_end; k = 1 ; for_end = np ; if ( k <= for_end) do 
      if ( k == 1 ) 
      if ( abs ( param [ 1 ] ) < 134217728L ) 
      bwrite4bytes ( tfmfile , param [ 1 ] * 16 ) ; 
      else {
	  
	incr ( tfmchanged ) ; 
	if ( param [ 1 ] > 0 ) 
	bwrite4bytes ( tfmfile , 2147483647L ) ; 
	else bwrite4bytes ( tfmfile , -2147483647L ) ; 
      } 
      else bwrite4bytes ( tfmfile , dimenout ( param [ k ] ) ) ; 
    while ( k++ < for_end ) ; } 
    if ( tfmchanged > 0 ) 
    {
      if ( tfmchanged == 1 ) 
      printnl ( 1097 ) ; 
      else {
	  
	printnl ( 40 ) ; 
	printint ( tfmchanged ) ; 
	print ( 1098 ) ; 
      } 
      print ( 1099 ) ; 
    } 
	;
#ifdef STAT
    if ( internal [ 10 ] > 0 ) 
    {
      fprintf( logfile , "%c\n",  ' ' ) ; 
      if ( bchlabel < ligtablesize ) 
      decr ( nl ) ; 
      fprintf( logfile , "%s%ld%s%ld%s%ld%s%ld%s%ld%s%ld%s%ld%s%ld%s\n",  "(You used " , (long)nw , "w," , (long)nh , "h," , (long)nd , "d," ,       (long)ni , "i," , (long)nl , "l," , (long)nk , "k," , (long)ne , "e," , (long)np ,       "p metric file positions" ) ; 
      fprintf( logfile , "%s%s%ld%s%ld%s%ld%s\n",  "  out of " , "256w,16h,16d,64i," , (long)ligtablesize ,       "l," , (long)maxkerns , "k,256e," , (long)maxfontdimen , "p)" ) ; 
    } 
#endif /* STAT */
    printnl ( 1094 ) ; 
    print ( metricfilename ) ; 
    printchar ( 46 ) ; 
    bclose ( tfmfile ) ; 
  } 
  if ( totalshipped > 0 ) 
  {
    printnl ( 285 ) ; 
    printint ( totalshipped ) ; 
    print ( 1116 ) ; 
    if ( totalshipped > 1 ) 
    printchar ( 115 ) ; 
    print ( 1117 ) ; 
    print ( firstfilename ) ; 
    if ( totalshipped > 1 ) 
    {
      if ( 31 + ( strstart [ nextstr [ firstfilename ] ] - strstart [ 
      firstfilename ] ) + ( strstart [ nextstr [ lastfilename ] ] - strstart [ 
      lastfilename ] ) > maxprintline ) 
      println () ; 
      print ( 548 ) ; 
      print ( lastfilename ) ; 
    } 
  } 
  if ( logopened ) 
  {
    putc ('\n',  logfile );
    aclose ( logfile ) ; 
    selector = selector - 2 ; 
    if ( selector == 5 ) 
    {
      printnl ( 1180 ) ; 
      print ( mplogname ) ; 
      printchar ( 46 ) ; 
    } 
  } 
  println () ; 
  if ( ( editnamestart != 0 ) && ( interaction > 0 ) ) 
  calledit ( strpool , editnamestart , editnamelength , editline,
	    strstart[mplogname], strstart[nextstr[mplogname]]-strstart[mplogname] ) ; 
} 
#ifdef DEBUG
integer readint ( ) 
{register integer Result; char c  ; 
  ASCIIcode k  ; 
  integer n  ; 
  boolean neg  ; 
  read ( termin , c ) ; 
  n = 0 ; 
  neg = c == xchr [ '-' ] ; 
  if ( neg ) 
  read ( termin , c ) ; 
  k = xord [ c ] ; 
  while ( ( k >= 48 ) && ( k <= 57 ) ) {
      
    n = 10 * n + k - 48 ; 
    read ( termin , c ) ; 
    k = xord [ c ] ; 
  } 
  if ( neg ) 
  Result = - (integer) n ; 
  else Result = n ; 
  return(Result) ; 
} 
void debughelp ( ) 
{/* 888 10 */ integer k, l, m, n  ; 
  while ( true ) {
      
    ; 
    printnl ( 1187 ) ; 
    flush ( termout ) ; 
    m = readint () ; 
    if ( m < 0 ) 
    goto lab10 ; 
    else if ( m == 0 ) 
    {
      goto lab888 ; 
      lab888: m = 0 ; 
    } 
    else {
	
      n = readint () ; 
      switch ( m ) 
      {case 1 : 
	printword ( mem [ n ] ) ; 
	break ; 
      case 2 : 
	printint ( mem [ n ] .hhfield .lhfield ) ; 
	break ; 
      case 3 : 
	printint ( mem [ n ] .hhfield .v.RH ) ; 
	break ; 
      case 4 : 
	{
	  printint ( eqtb [ n ] .lhfield ) ; 
	  printchar ( 58 ) ; 
	  printint ( eqtb [ n ] .v.RH ) ; 
	} 
	break ; 
      case 5 : 
	printvariablename ( n ) ; 
	break ; 
      case 6 : 
	printint ( internal [ n ] ) ; 
	break ; 
      case 7 : 
	doshowdependencies () ; 
	break ; 
      case 9 : 
	showtokenlist ( n , 0 , 100000L , 0 ) ; 
	break ; 
      case 10 : 
	print ( n ) ; 
	break ; 
      case 11 : 
	checkmem ( n > 0 ) ; 
	break ; 
      case 12 : 
	searchmem ( n ) ; 
	break ; 
      case 13 : 
	{
	  l = readint () ; 
	  printcmdmod ( n , l ) ; 
	} 
	break ; 
      case 14 : 
	{register integer for_end; k = 0 ; for_end = n ; if ( k <= for_end) 
	do 
	  print ( buffer [ k ] ) ; 
	while ( k++ < for_end ) ; } 
	break ; 
      case 15 : 
	panicking = ! panicking ; 
	break ; 
	default: 
	print ( 63 ) ; 
	break ; 
      } 
    } 
  } 
  lab10: ; 
} 
#endif /* DEBUG */