home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / yaccsrc2 / ynxti.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-19  |  545 b   |  34 lines

  1.  
  2. # include "y4.h" 
  3.  
  4. nxti( )
  5. {
  6.   /* finds the next i */
  7.   register i,
  8.            max,
  9.            maxi;
  10.  
  11.   max = 0;
  12.  
  13.   for ( i = 1; i <= nnonter; ++i )
  14.     if ( ggreed[ i ] >= max )
  15.       {
  16.         max  = ggreed[ i ];
  17.         maxi = -i;
  18.       }
  19.  
  20.   for ( i = 0; i < nstate; ++i )
  21.     if ( greed[ i ] >= max )
  22.       {
  23.         max  = greed[ i ];
  24.         maxi = i;
  25.       }
  26.  
  27.   if ( nxdb )
  28.     fprintf( ftable, "nxti = %d, max = %d\n", maxi, max );
  29.   if ( max == 0 )
  30.     return ( NOMORE );
  31.   else
  32.     return ( maxi );
  33. }
  34.