New experimental feature: if --verbose --trace output all the

items of a state, not only its kernel.
* src/print.c (print_core): If `trace_flag', then invoke closure
before outputting the items of the state (print_core is no longer
a correct name them).
(print_results): Invoke new_closure/free_closure if needed.
This commit is contained in:
Akim Demaille
2001-12-05 09:24:06 +00:00
parent b6a70d99a6
commit 84b6f48351
2 changed files with 56 additions and 28 deletions

View File

@@ -1,3 +1,13 @@
2001-12-05 Akim Demaille <akim@epita.fr>
New experimental feature: if --verbose --trace output all the
items of a state, not only its kernel.
* src/print.c (print_core): If `trace_flag', then invoke closure
before outputting the items of the state (print_core is no longer
a correct name them).
(print_results): Invoke new_closure/free_closure if needed.
2001-12-05 Akim Demaille <akim@epita.fr>
* src/LR0.c (new_itemsets): Use nshifts only, not shiftcount.

View File

@@ -30,6 +30,7 @@
#include "reader.h"
#include "print.h"
#include "reduce.h"
#include "closure.h"
#if 0
static void
@@ -48,18 +49,27 @@ static void
print_core (FILE *out, int state)
{
int i;
core *statep = state_table[state].state;
short *sitems = state_table[state].state->items;
int snitems = state_table[state].state->nitems;
if (!statep->nitems)
return;
/* New experimental feature: if TRACE_FLAGS output all the items of
a state, not only its kernel. */
if (trace_flag)
{
closure (sitems, snitems);
sitems = itemset;
snitems = nitemset;
}
for (i = 0; i < statep->nitems; i++)
if (snitems)
{
for (i = 0; i < snitems; i++)
{
short *sp;
short *sp1;
int rule;
sp1 = sp = ritem + statep->items[i];
sp1 = sp = ritem + sitems[i];
while (*sp > 0)
sp++;
@@ -80,6 +90,7 @@ print_core (FILE *out, int state)
}
fputc ('\n', out);
}
}
static void
@@ -321,8 +332,15 @@ print_results (void)
print_grammar (out);
/* New experimental feature: output all the items of a state,
not only its kernel. Requires to run closure, which need
memory allocation/deallocation. */
if (trace_flag)
new_closure (nitems);
for (i = 0; i < nstates; i++)
print_state (out, i);
if (trace_flag)
free_closure ();
xfclose (out);
}