Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.5 KiB

4 years ago
  1. #include "y4.h"
  2. void stin(int i)
  3. {
  4. register *r, *s, n, flag, j, *q1, *q2;
  5. greed[i] = 0;
  6. /* enter state i into the a array */
  7. q2 = mem0+yypact[i+1];
  8. q1 = mem0+yypact[i];
  9. /* find an acceptable place */
  10. for( n= -maxoff; n<ACTSIZE; ++n )
  11. {
  12. flag = 0;
  13. for( r = q1; r < q2; r += 2 )
  14. {
  15. if( (s = *r + n + a ) < a ) goto nextn;
  16. if( *s == 0 ) ++flag;
  17. else if( *s != r[1] ) goto nextn;
  18. }
  19. /* check that the position equals another only if the states are identical */
  20. for( j=0; j<nstate; ++j )
  21. {
  22. if( pa[j] == n )
  23. {
  24. if( flag ) goto nextn; /* we have some disagreement */
  25. if( yypact[j+1] + yypact[i] == yypact[j] + yypact[i+1] )
  26. {
  27. /* states are equal */
  28. pa[i] = n;
  29. if( adb>1 ) fprintf( ftable, "State %d: entry at %d equals state %d\n",
  30. i, n, j );
  31. return;
  32. }
  33. goto nextn; /* we have some disagreement */
  34. }
  35. }
  36. for( r = q1; r < q2; r += 2 )
  37. {
  38. if( (s = *r + n + a ) >= &a[ACTSIZE] ) error( "out of space in optimizer a array" );
  39. if( s > maxa ) maxa = s;
  40. if( *s != 0 && *s != r[1] ) error( "clobber of a array, pos'n %d, by %d", s-a, r[1] );
  41. *s = r[1];
  42. }
  43. pa[i] = n;
  44. if( adb>1 ) fprintf( ftable, "State %d: entry at %d\n", i, pa[i] );
  45. return;
  46. nextn:
  47. ;
  48. }
  49. error( "Error; failure to place state %d\n", i );
  50. }