[comp.text] BibTeX in C, 4/6

rokicki@rocky.STANFORD.EDU (Tomas Rokicki) (12/30/87)

---cut here---
        else if ( ( strpool [ spptr ] == 125 ) ) 
        { bracesunbalancedcomp () ; 
          incr ( spptr ) ; 
          } 
        else 
        { 
          { if ( ( exbufptr == bufsize ) ) 
            { tputs ( cnull , "Sorry, you've exceeded BibTeX's execution buffer size " ) ;
              tputi ( cnull , bufsize  ) ;
              tputc ( cnull , 10 ) ;
              jumpout ( 1 ) ; 
              } 
            exbuf [ exbufptr ] = strpool [ spptr ] ; 
            incr ( exbufptr ) ; 
            } 
          incr ( spptr ) ; 
          } 
        if ( ( spbracelevel > 0 ) ) bracesunbalancedcomp () ; 
      exbuflength = exbufptr ; 
      addpoolbufandpush () ; 
      } 
    } 
  xinttochr () { poplit1 = poplitstk ( poptyp1 ) ; 
    if ( ( poptyp1 != 0 ) ) 
    { printwrongstklit ( poplit1 , poptyp1 , 0 ) ; 
      pushlitstk ( snull , 1 ) ; 
      } 
    else if ( ( ( poplit1 < 0 ) || ( poplit1 > 127 ) ) ) 
    { 
      { tputi ( cnull , poplit1  ) ;
        tputs ( cnull , " isn't valid ASCII" ) ;
        bstexwarnprint () ; 
        } 
      pushlitstk ( snull , 1 ) ; 
      } 
    else 
    { exbuf [ 0 ] = poplit1 ; 
      exbuflength = 1 ; 
      addpoolbufandpush () ; 
      } 
    } 
  xinttostr () { poplit1 = poplitstk ( poptyp1 ) ; 
    if ( ( poptyp1 != 0 ) ) 
    { printwrongstklit ( poplit1 , poptyp1 , 0 ) ; 
      pushlitstk ( snull , 1 ) ; 
      } 
    else 
    { exbuflength = inttoASCII ( poplit1 , exbuf , 0 ) ; 
      addpoolbufandpush () ; 
      } 
    } 
  xmissing () { poplit1 = poplitstk ( poptyp1 ) ; 
    if ( ( ! messwithentries ) ) 
    { tputs ( cnull , "you can't mess with entries here" ) ;
      bstexwarnprint () ; 
      } 
    else if ( ( ( poptyp1 != 1 ) && ( poptyp1 != 3 ) ) ) 
    { printstklit ( poplit1 , poptyp1 ) ; 
      tputs ( cnull , ", not a string or missing-field\n" ) ;
      
      { tputs ( cnull , " " ) ;
        bstexwarnprint () ; 
        } 
      pushlitstk ( 0 , 0 ) ; 
      } 
    else if ( ( poptyp1 == 3 ) ) pushlitstk ( 1 , 0 ) ; 
    else pushlitstk ( 0 , 0 ) ; 
    } 
  xnumnames () { poplit1 = poplitstk ( poptyp1 ) ; 
    if ( ( poptyp1 != 1 ) ) 
    { printwrongstklit ( poplit1 , poptyp1 , 1 ) ; 
      pushlitstk ( 0 , 0 ) ; 
      } 
    else 
    { exbuflength = 0 ; 
      addbufpool ( poplit1 ) ; 
      exbufptr = 0 ; 
      numnames = 0 ; 
      while ( ( exbufptr < exbuflength ) ) 
        { namescanforand ( poplit1 ) ; 
          incr ( numnames ) ; 
          } 
        pushlitstk ( numnames , 0 ) ; 
      } 
    } 
  xpurify () { poplit1 = poplitstk ( poptyp1 ) ; 
    if ( ( poptyp1 != 1 ) ) 
    { printwrongstklit ( poplit1 , poptyp1 , 1 ) ; 
      pushlitstk ( snull , 1 ) ; 
      } 
    else 
    { exbuflength = 0 ; 
      addbufpool ( poplit1 ) ; 
      exbufxptr = 0 ; 
      exbufptr = 0 ; 
      while ( ( exbufptr < exbuflength ) ) 
        { if ( ( lexclass [ exbuf [ exbufptr ] ] == 1 ) ) 
          { exbuf [ exbufxptr ] = 32 ; 
            incr ( exbufxptr ) ; 
            } 
          else if ( ( ( lexclass [ exbuf [ exbufptr ] ] == 2 ) || ( lexclass 
          [ exbuf [ exbufptr ] ] == 3 ) ) ) 
          { exbuf [ exbufxptr ] = exbuf [ exbufptr ] ; 
            incr ( exbufxptr ) ; 
            } 
          incr ( exbufptr ) ; 
          } 
        exbuflength = exbufxptr ; 
      addpoolbufandpush () ; 
      } 
    } 
  xquote () { exbuf [ 0 ] = 34 ; 
    exbuflength = 1 ; 
    addpoolbufandpush () ; 
    } 
  xsubstring () { poplit1 = poplitstk ( poptyp1 ) ; 
    poplit2 = poplitstk ( poptyp2 ) ; 
    poplit3 = poplitstk ( poptyp3 ) ; 
    if ( ( poptyp1 != 0 ) ) 
    { printwrongstklit ( poplit1 , poptyp1 , 0 ) ; 
      pushlitstk ( snull , 1 ) ; 
      } 
    else if ( ( poptyp2 != 0 ) ) 
    { printwrongstklit ( poplit2 , poptyp2 , 0 ) ; 
      pushlitstk ( snull , 1 ) ; 
      } 
    else if ( ( poptyp3 != 1 ) ) 
    { printwrongstklit ( poplit3 , poptyp3 , 1 ) ; 
      pushlitstk ( snull , 1 ) ; 
      } 
    else 
    { exbuflength = 0 ; 
      addbufpool ( poplit3 ) ; 
      if ( ( ( poplit1 <= 0 ) || ( poplit2 == 0 ) || ( poplit2 > exbuflength 
      ) || ( poplit2 + (int) exbuflength < 0 ) ) ) exbuflength = 0 ; 
      else if ( ( poplit2 > 0 ) ) 
      { if ( ( poplit1 > exbuflength - ( poplit2 - 1 ) ) ) poplit1 = 
        exbuflength - ( poplit2 - 1 ) ; 
        exbufptr = 0 ; 
        while ( ( exbufptr < poplit1 ) ) 
          { exbuf [ exbufptr ] = exbuf [ exbufptr + ( poplit2 - 1 ) ] ; 
            incr ( exbufptr ) ; 
            } 
          exbuflength = exbufptr ; 
        } 
      else 
      { poplit2 = - poplit2 ; 
        if ( ( poplit1 > exbuflength - ( poplit2 - 1 ) ) ) poplit1 = 
        exbuflength - ( poplit2 - 1 ) ; 
        exbufptr = 0 ; 
        while ( ( exbufptr < poplit1 ) ) 
          { exbuf [ exbufptr ] = exbuf [ exbufptr + exbuflength - ( poplit2 - 
            1 ) - poplit1 ] ; 
            incr ( exbufptr ) ; 
            } 
          exbuflength = exbufptr ; 
        } 
      addpoolbufandpush () ; 
      } 
    } 
  xswap () { poplit1 = poplitstk ( poptyp1 ) ; 
    poplit2 = poplitstk ( poptyp2 ) ; 
    if ( ( poptyp1 != 1 ) ) 
    { pushlitstk ( poplit1 , poptyp1 ) ; 
      if ( ( poptyp2 != 1 ) ) pushlitstk ( poplit2 , poptyp2 ) ; 
      else 
      { exbuflength = 0 ; 
        addbufpool ( poplit2 ) ; 
        addpoolbufandpush () ; 
        } 
      } 
    else if ( ( poptyp2 != 1 ) ) 
    { exbuflength = 0 ; 
      addbufpool ( poplit1 ) ; 
      addpoolbufandpush () ; 
      pushlitstk ( poplit2 , poptyp2 ) ; 
      } 
    else 
    { exbuflength = 0 ; 
      addbufpool ( poplit2 ) ; 
      svptr2 = exbuflength ; 
      tmpptr = 0 ; 
      while ( ( tmpptr < svptr2 ) ) 
        { svbuffer [ tmpptr ] = exbuf [ tmpptr ] ; 
          incr ( tmpptr ) ; 
          } 
        exbuflength = 0 ; 
      addbufpool ( poplit1 ) ; 
      addpoolbufandpush () ; 
      exbuflength = svptr2 ; 
      tmpptr = 0 ; 
      while ( ( tmpptr < exbuflength ) ) 
        { exbuf [ tmpptr ] = svbuffer [ tmpptr ] ; 
          incr ( tmpptr ) ; 
          } 
        addpoolbufandpush () ; 
      } 
    } 
  xtype () { if ( ( ! messwithentries ) ) 
    { tputs ( cnull , "you can't mess with entries here" ) ;
      bstexwarnprint () ; 
      } 
    else if ( ( ( typelist [ citeptr ] == 5001 ) || ( typelist [ citeptr ] == 
    0 ) ) ) pushlitstk ( snull , 1 ) ; 
    else pushlitstk ( hashtext [ typelist [ citeptr ] ] , 1 ) ; 
    } 
  xwidth () { poplit1 = poplitstk ( poptyp1 ) ; 
    if ( ( poptyp1 != 1 ) ) 
    { printwrongstklit ( poplit1 , poptyp1 , 1 ) ; 
      pushlitstk ( 0 , 0 ) ; 
      } 
    else 
    { stringwidth = 0 ; 
      spptr = strstart [ poplit1 ] ; 
      while ( ( spptr < strstart [ poplit1 + 1 ] ) ) 
        { stringwidth = stringwidth + charwidth [ strpool [ spptr ] ] ; 
          incr ( spptr ) ; 
          } 
        pushlitstk ( stringwidth , 0 ) ; 
      } 
    } 
  xwrite () { poplit1 = poplitstk ( poptyp1 ) ; 
    if ( ( poptyp1 != 1 ) ) printwrongstklit ( poplit1 , poptyp1 , 1 ) ; 
    else addoutpool ( poplit1 ) ; 
    } 
  zexecutefn ( exfnloc ) 
  hashloc exfnloc ; 
  { /* 51 */ integer rpoplt1, rpoplt2 ; 
    stktype rpoptp1, rpoptp2 ; 
    wizfnloc wizptr ; 
    
#ifdef TRACE
    tputs ( logfile , "execute_fn `" ) ;
    traceprpoolstr ( hashtext [ exfnloc ] ) ; 
    tputs ( logfile , "'\n" ) ;
    
#endif
    switch ( fntype [ exfnloc ] ) 
    { case 0 : 
      
      { 
#ifdef STAT
        incr ( executioncount [ ilkinfo [ exfnloc ] ] ) ; 
        
#endif
        switch ( ilkinfo [ exfnloc ] ) 
        { case 0 : 
          xequals () ; 
          break ; 
          case 1 : 
          xgreaterthan () ; 
          break ; 
          case 2 : 
          xlessthan () ; 
          break ; 
          case 3 : 
          xplus () ; 
          break ; 
          case 4 : 
          xminus () ; 
          break ; 
          case 5 : 
          xconcatenate () ; 
          break ; 
          case 6 : 
          xgets () ; 
          break ; 
          case 7 : 
          xaddperiod () ; 
          break ; 
          case 8 : 
          
          { if ( ( ! messwithentries ) ) 
            { tputs ( cnull , "you can't mess with entries here" ) ;
              bstexwarnprint () ; 
              } 
            else if ( ( typelist [ citeptr ] == 5001 ) ) executefn ( bdefault 
            ) ; 
            else if ( ( typelist [ citeptr ] == 0 ) ) ; 
            else executefn ( typelist [ citeptr ] ) ; 
            } 
          break ; 
          case 9 : 
          xchangecase () ; 
          break ; 
          case 10 : 
          xchrtoint () ; 
          break ; 
          case 11 : 
          xcite () ; 
          break ; 
          case 12 : 
          xduplicate () ; 
          break ; 
          case 13 : 
          xformatname () ; 
          break ; 
          case 14 : 
          
          { poplit1 = poplitstk ( poptyp1 ) ; 
            poplit2 = poplitstk ( poptyp2 ) ; 
            poplit3 = poplitstk ( poptyp3 ) ; 
            if ( ( poptyp1 != 2 ) ) printwrongstklit ( poplit1 , poptyp1 , 2 
            ) ; 
            else if ( ( poptyp2 != 2 ) ) printwrongstklit ( poplit2 , poptyp2 
            , 2 ) ; 
            else if ( ( poptyp3 != 0 ) ) printwrongstklit ( poplit3 , poptyp3 
            , 0 ) ; 
            else if ( ( poplit3 > 0 ) ) executefn ( poplit2 ) ; 
            else executefn ( poplit1 ) ; 
            } 
          break ; 
          case 15 : 
          xinttochr () ; 
          break ; 
          case 16 : 
          xinttostr () ; 
          break ; 
          case 17 : 
          xmissing () ; 
          break ; 
          case 18 : 
          
          { outputbblline () ; 
            } 
          break ; 
          case 19 : 
          xnumnames () ; 
          break ; 
          case 20 : 
          
          { poplit1 = poplitstk ( poptyp1 ) ; 
            } 
          break ; 
          case 21 : 
          xpurify () ; 
          break ; 
          case 22 : 
          xquote () ; 
          break ; 
          case 23 : 
          
          { ; 
            } 
          break ; 
          case 24 : 
          
          { popwholestack () ; 
            } 
          break ; 
          case 25 : 
          xsubstring () ; 
          break ; 
          case 26 : 
          xswap () ; 
          break ; 
          case 27 : 
          
          { poptopandprint () ; 
            } 
          break ; 
          case 28 : 
          xtype () ; 
          break ; 
          case 29 : 
          
          { rpoplt1 = poplitstk ( rpoptp1 ) ; 
            rpoplt2 = poplitstk ( rpoptp2 ) ; 
            if ( ( rpoptp1 != 2 ) ) printwrongstklit ( rpoplt1 , rpoptp1 , 2 
            ) ; 
            else if ( ( rpoptp2 != 2 ) ) printwrongstklit ( rpoplt2 , rpoptp2 
            , 2 ) ; 
            else while ( true ) 
              { executefn ( rpoplt2 ) ; 
                poplit1 = poplitstk ( poptyp1 ) ; 
                if ( ( poptyp1 != 0 ) ) 
                { printwrongstklit ( poplit1 , poptyp1 , 0 ) ; 
                  goto lab51 ; 
                  } 
                else if ( ( poplit1 > 0 ) ) executefn ( rpoplt1 ) ; 
                else goto lab51 ; 
                } 
              lab51 : ; 
            } 
          break ; 
          case 30 : 
          xwidth () ; 
          break ; 
          case 31 : 
          xwrite () ; 
          break ; 
          default : 
          tputs ( cnull , "this can't happen---unknown built-in function\n" ) ;
          break ; 
          } } 
      break ; 
      case 1 : 
      pushlitstk ( hashtext [ ilkinfo [ exfnloc ] ] , 1 ) ; 
      break ; 
      case 2 : 
      
      { wizptr = ilkinfo [ exfnloc ] ; 
        while ( ( wizfunctions [ wizptr ] != 5001 ) ) 
          { if ( ( wizfunctions [ wizptr ] != 0 ) ) executefn ( wizfunctions 
            [ wizptr ] ) ; 
            else 
            { incr ( wizptr ) ; 
              pushlitstk ( wizfunctions [ wizptr ] , 2 ) ; 
              } 
            incr ( wizptr ) ; 
            } 
          } 
      break ; 
      case 3 : 
      pushlitstk ( ilkinfo [ exfnloc ] , 0 ) ; 
      break ; 
      case 4 : 
      pushlitstk ( hashtext [ exfnloc ] , 1 ) ; 
      break ; 
      case 5 : 
      
      { if ( ( ! messwithentries ) ) 
        { tputs ( cnull , "you can't mess with entries here" ) ;
          bstexwarnprint () ; 
          } 
        else if ( ( fieldinfo [ citeptr * numfields + ilkinfo [ exfnloc ] ] 
        == 0 ) ) pushlitstk ( hashtext [ exfnloc ] , 3 ) ; 
        else pushlitstk ( hashtext [ fieldinfo [ citeptr * numfields + 
        ilkinfo [ exfnloc ] ] ] , 1 ) ; 
        } 
      break ; 
      case 6 : 
      
      { if ( ( ! messwithentries ) ) 
        { tputs ( cnull , "you can't mess with entries here" ) ;
          bstexwarnprint () ; 
          } 
        else pushlitstk ( entryints [ citeptr * numentints + ilkinfo [ 
        exfnloc ] ] , 0 ) ; 
        } 
      break ; 
      case 7 : 
      
      { if ( ( ! messwithentries ) ) 
        { tputs ( cnull , "you can't mess with entries here" ) ;
          bstexwarnprint () ; 
          } 
        else 
        { strentptr = citeptr * numentstrs + ilkinfo [ exfnloc ] ; 
          exbufptr = 0 ; 
          while ( ( entrystrs [ strentptr ] [ exbufptr ] != 127 ) ) 
            { exbuf [ exbufptr ] = entrystrs [ strentptr ] [ exbufptr ] ; 
              incr ( exbufptr ) ; 
              } 
            exbuflength = exbufptr ; 
          addpoolbufandpush () ; 
          } 
        } 
      break ; 
      case 8 : 
      pushlitstk ( ilkinfo [ exfnloc ] , 0 ) ; 
      break ; 
      case 9 : 
      
      { strglbptr = ilkinfo [ exfnloc ] ; 
        exbufptr = 0 ; 
        while ( ( globalstrs [ strglbptr ] [ exbufptr ] != 127 ) ) 
          { exbuf [ exbufptr ] = globalstrs [ strglbptr ] [ exbufptr ] ; 
            incr ( exbufptr ) ; 
            } 
          exbuflength = exbufptr ; 
        addpoolbufandpush () ; 
        } 
      break ; 
      default : 
      tputs ( cnull , "this can't happen---unknown function class\n" ) ;
      break ; 
      } } 
  auxbibdatacommand () { /* 10 */ if ( ( bibseen ) ) 
    { tputs ( cnull , "illegal, another \\bibdata command" ) ;
      auxerrprint () ; 
      goto lab10 ; 
      } 
    bibseen = true ; 
    while ( ( buffer [ bufptr2 ] != 125 ) ) 
      { incr ( bufptr2 ) ; 
        if ( ( ! scan2white ( 125 , 44 ) ) ) 
        { tputs ( cnull , "no \"}\" for \\bibdata command" ) ;
          auxerrprint () ; 
          goto lab10 ; 
          } 
        if ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) ) 
        { tputs ( cnull , "white space in argument to \\bibdata command" ) ;
          auxerrprint () ; 
          goto lab10 ; 
          } 
        if ( ( ( last > bufptr2 + 1 ) && ( buffer [ bufptr2 ] == 125 ) ) ) 
        { tputs ( cnull , "stuff after \"}\" for \\bibdata command" ) ;
          auxerrprint () ; 
          goto lab10 ; 
          } 
        if ( ( bibptr == maxbibfiles ) ) 
        { tputs ( cnull , "Sorry, you've exceeded BibTeX's number of database files " ) ;
          tputi ( cnull , maxbibfiles  ) ;
          tputc ( cnull , 10 ) ;
          jumpout ( 1 ) ; 
          } 
        lowercase ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) ) ; 
        biblist [ bibptr ] = hashtext [ strlookup ( buffer , bufptr1 , ( 
        bufptr2 - bufptr1 ) , 6 , true ) ] ; 
        if ( ( hashfound ) ) 
        { tputs ( cnull , "This database file appears more than once: " ) ;
          printbibname () ; 
          
          { tputs ( cnull , "   for \\bibstyle command" ) ;
            auxerrprint () ; 
            goto lab10 ; 
            } 
          } 
        startname ( biblist [ bibptr ] ) ; 
        addextension ( sbibextension ) ; 
        if ( ( ! aopenin ( bibfile [ bibptr ] , texbib ) ) ) 
          { tputs ( cnull , "I couldn't open database file " ) ;
            printbibname () ; 
            
            { tputs ( cnull , "   for \\bibdata command" ) ;
              auxerrprint () ; 
              goto lab10 ; 
              } 
            } 
        
#ifdef TRACE
        traceprpoolstr ( biblist [ bibptr ] ) ; 
        traceprpoolstr ( sbibextension ) ; 
        tputs ( logfile , " is a bibdata file\n" ) ;
        
#endif
        incr ( bibptr ) ; 
        } 
      lab10 : ; 
    } 
  auxbibstylecommand () { /* 10 */ if ( ( bstseen ) ) 
    { tputs ( cnull , "illegal, another \\bibstyle command" ) ;
      auxerrprint () ; 
      goto lab10 ; 
      } 
    bstseen = true ; 
    incr ( bufptr2 ) ; 
    if ( ( ! scan1white ( 125 ) ) ) 
    { tputs ( cnull , "no \"}\" for \\bibstyle command" ) ;
      auxerrprint () ; 
      goto lab10 ; 
      } 
    if ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) ) 
    { tputs ( cnull , "white space in argument to \\bibstyle command" ) ;
      auxerrprint () ; 
      goto lab10 ; 
      } 
    if ( ( last > bufptr2 + 1 ) ) 
    { tputs ( cnull , "stuff after \"}\" for \\bibstyle command" ) ;
      auxerrprint () ; 
      goto lab10 ; 
      } 
    lowercase ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) ) ; 
    bststr = hashtext [ strlookup ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) 
    , 5 , true ) ] ; 
    if ( ( hashfound ) ) 
    { tputs ( cnull , "this can't happen---already encountered style file " ) ;
      printbstname () ; 
      
      { tputs ( cnull , "   for \\bibstyle command" ) ;
        auxerrprint () ; 
        goto lab10 ; 
        } 
      } 
    startname ( bststr ) ; 
    addextension ( sbstextension ) ; 
    if ( ( ! aopenin ( bstfile , texinputs ) ) ) 
      { tputs ( cnull , "I couldn't open style file " ) ;
        printbstname () ; 
        bststr = 0 ; 
        
        { tputs ( cnull , "   for \\bibstyle command" ) ;
          auxerrprint () ; 
          goto lab10 ; 
          } 
        } 
    tputs ( cnull , "The style file: " ) ;
    printbstname () ; 
    lab10 : ; 
    } 
  auxcitationcommand () { /* 10 */ citationseen = true ; 
    while ( ( buffer [ bufptr2 ] != 125 ) ) 
      { incr ( bufptr2 ) ; 
        if ( ( ! scan2white ( 125 , 44 ) ) ) 
        { tputs ( cnull , "no \"}\" for \\citation command" ) ;
          auxerrprint () ; 
          goto lab10 ; 
          } 
        if ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) ) 
        { tputs ( cnull , "white space in argument to \\citation command" ) ;
          auxerrprint () ; 
          goto lab10 ; 
          } 
        if ( ( ( last > bufptr2 + 1 ) && ( buffer [ bufptr2 ] == 125 ) ) ) 
        { tputs ( cnull , "stuff after \"}\" for \\citation command" ) ;
          auxerrprint () ; 
          goto lab10 ; 
          } 
        
#ifdef TRACE
        traceprtoken () ; 
        tputs ( logfile , " \\cite key encountered" ) ;
        
#endif
        tmpptr = bufptr1 ; 
        while ( ( tmpptr < bufptr2 ) ) 
          { svbuffer [ tmpptr ] = buffer [ tmpptr ] ; 
            incr ( tmpptr ) ; 
            } 
          lowercase ( svbuffer , bufptr1 , ( bufptr2 - bufptr1 ) ) ; 
        lcciteloc = strlookup ( svbuffer , bufptr1 , ( bufptr2 - bufptr1 ) , 
        10 , true ) ; 
        if ( ( hashfound ) ) 
        { 
#ifdef TRACE
          tputs ( logfile , " previously\n" ) ;
          
#endif
          dummyloc = strlookup ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) , 9 
          , false ) ; 
          if ( ( ! hashfound ) ) 
          { tputs ( cnull , "case mismatch between \\cite keys " ) ;
            printtoken () ; 
            tputs ( cnull , " and " ) ;
            printpoolstr ( citelist [ ilkinfo [ lcciteloc ] ] ) ; 
            tputc ( cnull , 10 ) ;
            
            { tputs ( cnull , "   " ) ;
              auxerrprint () ; 
              goto lab10 ; 
              } 
            } 
          } 
        else 
        { 
#ifdef TRACE
          tputc ( logfile , 10 ) ;
          
#endif
          if ( ( citeptr == maxcites ) ) 
          { tputs ( cnull , "Sorry, you've exceeded BibTeX's number of \\cite keys " ) ;
            tputi ( cnull , maxcites  ) ;
            tputc ( cnull , 10 ) ;
            jumpout ( 1 ) ; 
            } 
          citeloc = strlookup ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) , 9 
          , true ) ; 
          if ( ( hashfound ) ) 
          { tputs ( cnull , "this can't happen---cite hash error" ) ;
            auxerrprint () ; 
            goto lab10 ; 
            } 
          citelist [ citeptr ] = hashtext [ citeloc ] ; 
          ilkinfo [ citeloc ] = citeptr ; 
          ilkinfo [ lcciteloc ] = citeptr ; 
          incr ( citeptr ) ; 
          } 
        } 
      lab10 : ; 
    } 
  auxinputcommand () { /* 10 */ boolean auxextensionok ; 
    incr ( bufptr2 ) ; 
    if ( ( ! scan1white ( 125 ) ) ) 
    { tputs ( cnull , "no \"}\" for \\@input command" ) ;
      auxerrprint () ; 
      goto lab10 ; 
      } 
    if ( ( lexclass [ buffer [ bufptr2 ] ] == 1 ) ) 
    { tputs ( cnull , "white_space in argument to \\@input command" ) ;
      auxerrprint () ; 
      goto lab10 ; 
      } 
    if ( ( last > bufptr2 + 1 ) ) 
    { tputs ( cnull , "stuff after \"}\" for \\@input command" ) ;
      auxerrprint () ; 
      goto lab10 ; 
      } 
    incr ( auxptr ) ; 
    if ( ( auxptr == auxstacksize ) ) 
    { tputs ( cnull , "Sorry, you've exceeded BibTeX's number of auxiliary files " ) ;
      tputi ( cnull , auxstacksize  ) ;
      tputc ( cnull , 10 ) ;
      jumpout ( 1 ) ; 
      } 
    auxextensionok = true ; 
    lowercase ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) ) ; 
    if ( ( ( bufptr2 - bufptr1 ) < ( strstart [ sauxextension + 1 ] - 
    strstart [ sauxextension ] ) ) ) auxextensionok = false ; 
    else if ( ( ! streqbuf ( sauxextension , buffer , bufptr2 - ( strstart [ 
    sauxextension + 1 ] - strstart [ sauxextension ] ) , ( strstart [ 
    sauxextension + 1 ] - strstart [ sauxextension ] ) ) ) ) auxextensionok = 
    false ; 
    if ( ( ! auxextensionok ) ) 
    { printtoken () ; 
      tputs ( cnull , " has a wrong extension\n" ) ;
      decr ( auxptr ) ; 
      
      { tputs ( cnull , "   for \\@input command" ) ;
        auxerrprint () ; 
        goto lab10 ; 
        } 
      } 
    auxlist [ auxptr ] = hashtext [ strlookup ( buffer , bufptr1 , ( bufptr2 
    - bufptr1 ) , 3 , true ) ] ; 
    if ( ( hashfound ) ) 
    { tputs ( cnull , "already encountered file " ) ;
      printauxname () ; 
      decr ( auxptr ) ; 
      
      { tputs ( cnull , "   for \\@input command" ) ;
        auxerrprint () ; 
        goto lab10 ; 
        } 
      } 
    startname ( auxlist [ auxptr ] ) ; 
    nameptr = namelength + 1 ; 
    while ( ( nameptr <= 100 ) ) 
      { nameoffile [ nameptr ] = ' ' ; 
        incr ( nameptr ) ; 
        } 
      if ( ( ! aopenin ( auxfile [ auxptr ] , "." ) ) ) 
    { tputs ( cnull , "I couldn't open auxiliary file " ) ;
      printauxname () ; 
      decr ( auxptr ) ; 
      
      { tputs ( cnull , "   for \\@input command" ) ;
        auxerrprint () ; 
        goto lab10 ; 
        } 
      } 
    { tputs ( cnull , "A level-" ) ;
      tputi ( cnull , auxptr  ) ;
      tputs ( cnull , " auxiliary file: " ) ;
      }
    printauxname () ; 
    auxlnstack [ auxptr ] = 0 ; 
    lab10 : ; 
    } 
  boolean poptheauxstack () { aclose ( auxfile [ auxptr ] ) ; 
    if ( ( auxptr == 0 ) ) 
       return ( 1 ) ;
    else decr ( auxptr ) ; 
    return ( 0 ) ;
    } 
  getauxcommandandproc () { /* 10 */ bufptr2 = 0 ; 
    if ( ( ! scan1 ( 123 ) ) ) goto lab10 ; 
    commandnum = ilkinfo [ strlookup ( buffer , bufptr1 , ( bufptr2 - bufptr1 
    ) , 2 , false ) ] ; 
    if ( ( hashfound ) ) switch ( commandnum ) 
    { case 0 : 
      auxbibdatacommand () ; 
      break ; 
      case 1 : 
      auxbibstylecommand () ; 
      break ; 
      case 2 : 
      auxcitationcommand () ; 
      break ; 
      case 3 : 
      auxinputcommand () ; 
      break ; 
      default : 
      
      { tputs ( cnull , "this can't happen---unknown auxiliary-file command" ) ;
        auxerrprint () ; 
        goto lab10 ; 
        } 
      break ; 
      } lab10 : ; 
    } 
  lastcheckforauxerror () { numcites = citeptr ; 
    numbibfiles = bibptr ; 
    if ( ( ! citationseen ) ) 
    { tputs ( cnull , "I found no \\citation commands" ) ;
      auxenderrprint () ; 
      } 
    else if ( ( numcites == 0 ) ) 
    { tputs ( cnull , "I found no \\cite keys" ) ;
      auxenderrprint () ; 
      } 
    if ( ( ! bibseen ) ) 
    { tputs ( cnull , "I found no \\bibdata command" ) ;
      auxenderrprint () ; 
      } 
    else if ( ( numbibfiles == 0 ) ) 
    { tputs ( cnull , "I found no database files" ) ;
      auxenderrprint () ; 
      } 
    if ( ( ! bibseen ) ) 
    { tputs ( cnull , "I found no \\bibstyle command" ) ;
      auxenderrprint () ; 
      } 
    else if ( ( bststr == 0 ) ) 
    { tputs ( cnull , "I found no style file" ) ;
      auxenderrprint () ; 
      } 
    } 
  bstentrycommand () { /* 10 */ if ( ( entryseen ) ) 
    { tputs ( cnull , "illegal, another entry command" ) ;
      bsterrprintandlookfo () ; 
      goto lab10 ; 
      } 
    entryseen = true ; 
    
    { if ( ( ! eatbstwhitespace () ) ) 
      { eatbstprint () ; 
        
        { tputs ( cnull , "entry" ) ;
          bsterrprintandlookfo () ; 
          goto lab10 ; 
          } 
        } 
      } 
    
    { if ( ( buffer [ bufptr2 ] != 123 ) ) 
      { bstleftbraceprint () ; 
        
        { tputs ( cnull , "entry" ) ;
          bsterrprintandlookfo () ; 
          goto lab10 ; 
          } 
        } 
      incr ( bufptr2 ) ; 
      } 
    
    { if ( ( ! eatbstwhitespace () ) ) 
      { eatbstprint () ; 
        
        { tputs ( cnull , "entry" ) ;
          bsterrprintandlookfo () ; 
          goto lab10 ; 
          } 
        } 
      } 
    while ( ( buffer [ bufptr2 ] != 125 ) ) 
      { 
        { scanidentifier ( 125 , 37 ) ; 
          if ( ( ( scanresult == 3 ) || ( scanresult == 1 ) ) ) ; 
          else 
          { bstidprint () ; 
            
            { tputs ( cnull , "entry" ) ;
              bsterrprintandlookfo () ; 
              goto lab10 ; 
              } 
            } 
          } 
        
#ifdef TRACE
        traceprtoken () ; 
        tputs ( logfile , " is a field\n" ) ;
        
#endif
        lowercase ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) ) ; 
        fnloc = strlookup ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) , 11 , 
        true ) ; 
        
        { if ( ( hashfound ) ) 
          { alreadyseenfunctionp ( fnloc ) ; 
            goto lab10 ; 
            } 
          } 
        fntype [ fnloc ] = 5 ; 
        ilkinfo [ fnloc ] = numfields ; 
        incr ( numfields ) ; 
        
        { if ( ( ! eatbstwhitespace () ) ) 
          { eatbstprint () ; 
            
            { tputs ( cnull , "entry" ) ;
              bsterrprintandlookfo () ; 
              goto lab10 ; 
              } 
            } 
          } 
        } 
      incr ( bufptr2 ) ; 
    
    { if ( ( ! eatbstwhitespace () ) ) 
      { eatbstprint () ; 
        
        { tputs ( cnull , "entry" ) ;
          bsterrprintandlookfo () ; 
          goto lab10 ; 
          } 
        } 
      } 
    if ( ( numfields == 0 ) ) 
    { tputs ( cnull , "---I didn't find any fields" ) ;
      bstwarnprint () ; 
      } 
    
    { if ( ( buffer [ bufptr2 ] != 123 ) ) 
      { bstleftbraceprint () ; 
        
        { tputs ( cnull , "entry" ) ;
          bsterrprintandlookfo () ; 
          goto lab10 ; 
          } 
        } 
      incr ( bufptr2 ) ; 
      } 
    
    { if ( ( ! eatbstwhitespace () ) ) 
      { eatbstprint () ; 
        
        { tputs ( cnull , "entry" ) ;
          bsterrprintandlookfo () ; 
          goto lab10 ; 
          } 
        } 
      } 
    while ( ( buffer [ bufptr2 ] != 125 ) ) 
      { 
        { scanidentifier ( 125 , 37 ) ; 
          if ( ( ( scanresult == 3 ) || ( scanresult == 1 ) ) ) ; 
          else 
          { bstidprint () ; 
            
            { tputs ( cnull , "entry" ) ;
              bsterrprintandlookfo () ; 
              goto lab10 ; 
              } 
            } 
          } 
        
#ifdef TRACE
        traceprtoken () ; 
        tputs ( logfile , " is an integer entry-variable\n" ) ;
        
#endif
        lowercase ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) ) ; 
        fnloc = strlookup ( buffer , bufptr1 , ( bufptr2 - bufptr1 ) , 11 , 
        true ) ; 
        
        { if ( ( hashfound ) ) 
          { alreadyseenfunctionp ( fnloc ) ; 
            goto lab10 ; 
            } 
          } 
        fntype [ fnloc ] = 6 ; 
        ilkinfo [ fnloc ] = numentints ; 
        incr ( numentints ) ; 
        
        { if ( ( ! eatbstwhitespace () ) ) 
          { eatbstprint () ; 
            
            { tputs ( cnull , "entry" ) ;
              bsterrprintandlookfo () ; 
              goto lab10 ; 
              } 
            } 
          } 
        } 
      incr ( bufptr2 ) ; 
    
    { if ( ( ! eatbstwhitespace () ) ) 
      { eatbstprint () ; 
        
        { tputs ( cnull , "entry" ) ;
          bsterrprintandlookfo () ; 
          goto lab10 ; 
          } 
        } 
      } 
    
    { if ( ( buffer [ bufptr2 ] != 123 ) ) 
      { bstleftbraceprint () ; 
        
        { tputs ( cnull , "entry" ) ;
          bsterrprintandlookfo () ; 
          goto lab10 ; 
          } 
        } 
      incr ( bufptr2 ) ; 
      } 
    
    { if ( ( ! eatbstwhitespace () ) ) 
      { eatbstprint () ; 
        
        { tputs ( cnull , "entry" ) ;
          bsterrprintandlookfo () ; 
          goto lab10 ; 
          } 
        } 
      } 
    while ( ( buffer [ bufptr2 ] != 125 ) ) 
      { 
        { scanidentifier ( 125 , 37 ) ; 
---cut here---