home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / alde_c / misc / comm / yaccunx / ynxti.4c < prev    next >
Encoding:
Text File  |  1983-12-24  |  470 b   |  26 lines

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