* src/closure.c (print_closure): Improve.

(closure): Use it for printing input and output.
This commit is contained in:
Akim Demaille
2001-12-05 09:40:47 +00:00
parent 03ec521cc5
commit 23cbcc6c19
3 changed files with 23 additions and 13 deletions

View File

@@ -1,3 +1,9 @@
2001-12-05 Akim Demaille <akim@epita.fr>
* src/closure.c (print_closure): Improve.
(closure): Use it for printing input and output.
2001-12-05 Akim Demaille <akim@epita.fr> 2001-12-05 Akim Demaille <akim@epita.fr>
* src/closure.c (FIRSTS, FDERIVES): Adjust to reality: they are * src/closure.c (FIRSTS, FDERIVES): Adjust to reality: they are

View File

@@ -583,6 +583,9 @@ generate_states (void)
while (this_state) while (this_state)
{ {
if (trace_flag)
fprintf (stderr, "Processing state %d (reached by %s)\n",
this_state->number, tags[this_state->accessing_symbol]);
/* Set up ruleset and itemset for the transitions out of this /* Set up ruleset and itemset for the transitions out of this
state. ruleset gets a 1 bit for each rule that could reduce state. ruleset gets a 1 bit for each rule that could reduce
now. itemset gets a vector of all the items that could be now. itemset gets a vector of all the items that could be

View File

@@ -52,13 +52,19 @@ static int varsetsize;
`-----------------*/ `-----------------*/
static void static void
print_closure (int n) print_closure (const char *title, short *array, size_t size)
{ {
int i; size_t i;
fprintf (stderr, "n = %d\n", n); fprintf (stderr, "Closure: %s\n", title);
for (i = 0; i < itemsetsize; ++i) for (i = 0; i < size; ++i)
fprintf (stderr, " %d\n", itemset[i]); {
fprintf (stderr, "\n\n"); short *rp;
fprintf (stderr, " %2d: .", array[i]);
for (rp = &ritem[array[i]]; *rp > 0; ++rp)
fprintf (stderr, " %s", tags[*rp]);
fprintf (stderr, " (rule %d)\n", -*rp);
}
fputs ("\n\n", stderr);
} }
@@ -194,12 +200,7 @@ closure (short *core, int n)
int ruleno; int ruleno;
if (trace_flag) if (trace_flag)
{ print_closure ("input", core, n);
fprintf (stderr, "Entering closure (items = {");
for (c = 0; c < n; ++c)
fprintf (stderr, " %d ", core[c]);
fprintf (stderr, "})\n");
}
if (n == 0) if (n == 0)
{ {
@@ -241,7 +242,7 @@ closure (short *core, int n)
} }
if (trace_flag) if (trace_flag)
print_closure (n); print_closure ("output", itemset, itemsetsize);
} }