/[bison]/bison/src/closure.c
ViewVC logotype

Diff of /bison/src/closure.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13.2.2 by akim, Mon Nov 19 09:12:25 2001 UTC revision 1.13.2.3 by akim, Mon Nov 19 09:16:24 2001 UTC
# Line 1  Line 1 
1  /* Subroutines for bison  /* Subroutines for bison
2     Copyright 1984, 1989, 2000 Free Software Foundation, Inc.     Copyright 1984, 1989, 2000, 2001 Free Software Foundation, Inc.
3    
4     This file is part of Bison, the GNU Compiler Compiler.     This file is part of Bison, the GNU Compiler Compiler.
5    
# Line 20  Line 20 
20    
21  #include "system.h"  #include "system.h"
22  #include "gram.h"  #include "gram.h"
23    #include "reader.h"
24  #include "closure.h"  #include "closure.h"
25  #include "derives.h"  #include "derives.h"
26  #include "warshall.h"  #include "warshall.h"
# Line 38  static int rulesetsize; Line 39  static int rulesetsize;
39  /* number of words required to hold a bit for each variable */  /* number of words required to hold a bit for each variable */
40  static int varsetsize;  static int varsetsize;
41    
42  #if DEBUG  #if TRACE
43    
44  /*-----------------.  /*-----------------.
45  | Debugging code.  |  | Debugging code.  |
# Line 49  print_closure (int n) Line 50  print_closure (int n)
50  {  {
51    short *isp;    short *isp;
52    
53    printf ("\n\nn = %d\n\n", n);    fprintf (stderr, "\n\nn = %d\n\n", n);
54    for (isp = itemset; isp < itemsetend; isp++)    for (isp = itemset; isp < itemsetend; isp++)
55      printf ("   %d\n", *isp);      fprintf (stderr, "   %d\n", *isp);
56  }  }
57    
58    
# Line 62  print_firsts (void) Line 63  print_firsts (void)
63    int j;    int j;
64    unsigned *rowp;    unsigned *rowp;
65    
66    printf ("\n\n\nFIRSTS\n\n");    fprintf (stderr, "\n\n\nFIRSTS\n\n");
67    
68    for (i = ntokens; i < nsyms; i++)    for (i = ntokens; i < nsyms; i++)
69      {      {
70        printf ("\n\n%s firsts\n\n", tags[i]);        fprintf (stderr, "\n\n%s firsts\n\n", tags[i]);
71    
72        rowp = firsts + ((i - ntokens) * varsetsize);        rowp = firsts + ((i - ntokens) * varsetsize);
73    
74        for (j = 0; j < nvars; j++)        for (j = 0; j < nvars; j++)
75          if (BITISSET (rowp, j))          if (BITISSET (rowp, j))
76            printf ("   %s\n", tags[j + ntokens]);            fprintf (stderr, "   %s\n", tags[j + ntokens]);
77      }      }
78  }  }
79    
# Line 84  print_fderives (void) Line 85  print_fderives (void)
85    int j;    int j;
86    unsigned *rp;    unsigned *rp;
87    
88    printf ("\n\n\nFDERIVES\n");    fprintf (stderr, "\n\n\nFDERIVES\n");
89    
90    for (i = ntokens; i < nsyms; i++)    for (i = ntokens; i < nsyms; i++)
91      {      {
92        printf ("\n\n%s derives\n\n", tags[i]);        fprintf (stderr, "\n\n%s derives\n\n", tags[i]);
93        rp = fderives + i * rulesetsize;        rp = fderives + i * rulesetsize;
94    
95        for (j = 0; j <= nrules; j++)        for (j = 0; j <= nrules; j++)
96          if (BITISSET (rp, j))          if (BITISSET (rp, j))
97            printf ("   %d\n", j);            fprintf (stderr, "   %d\n", j);
98      }      }
   
   fflush (stdout);  
99  }  }
100  #endif  #endif
101    
# Line 143  set_firsts (void) Line 142  set_firsts (void)
142    
143    RTC (firsts, nvars);    RTC (firsts, nvars);
144    
145  #ifdef  DEBUG  #ifdef TRACE
146    print_firsts ();    print_firsts ();
147  #endif  #endif
148  }  }
# Line 204  set_fderives (void) Line 203  set_fderives (void)
203        rrow += rulesetsize;        rrow += rulesetsize;
204      }      }
205    
206  #ifdef  DEBUG  #ifdef TRACE
207    print_fderives ();    print_fderives ();
208  #endif  #endif
209    
# Line 301  closure (short *core, int n) Line 300  closure (short *core, int n)
300    while (csp < csend)    while (csp < csend)
301      *itemsetend++ = *csp++;      *itemsetend++ = *csp++;
302    
303  #if DEBUG  #if TRACE
304    print_closure (n);    print_closure (n);
305  #endif  #endif
306  }  }

Legend:
Removed from v.1.13.2.2  
changed lines
  Added in v.1.13.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26