* src/closure.c, src/closure.h (itemsetsize): Rename as...
(nitemset): for consistency with the rest of the project.
+2001-12-05 Akim Demaille <akim@epita.fr>
+
+ * src/LR0.c (new_itemsets): Use nshifts only, not shiftcount.
+ * src/closure.c, src/closure.h (itemsetsize): Rename as...
+ (nitemset): for consistency with the rest of the project.
+
+
2001-12-05 Akim Demaille <akim@epita.fr>
* src/closure.c (print_closure): Improve.
2001-12-05 Akim Demaille <akim@epita.fr>
* src/closure.c (print_closure): Improve.
new_itemsets (void)
{
int i;
new_itemsets (void)
{
int i;
if (trace_flag)
fprintf (stderr, "Entering new_itemsets, state = %d\n",
if (trace_flag)
fprintf (stderr, "Entering new_itemsets, state = %d\n",
kernel_size[i] = 0;
shift_symbol = XCALLOC (short, nsyms);
kernel_size[i] = 0;
shift_symbol = XCALLOC (short, nsyms);
- for (i = 0; i < itemsetsize; ++i)
+ for (i = 0; i < nitemset; ++i)
{
int symbol = ritem[itemset[i]];
if (symbol > 0)
{
if (!kernel_size[symbol])
{
{
int symbol = ritem[itemset[i]];
if (symbol > 0)
{
if (!kernel_size[symbol])
{
- shift_symbol[shiftcount] = symbol;
- shiftcount++;
+ shift_symbol[nshifts] = symbol;
+ nshifts++;
}
kernel_base[symbol][kernel_size[symbol]] = itemset[i] + 1;
kernel_size[symbol]++;
}
}
}
kernel_base[symbol][kernel_size[symbol]] = itemset[i] + 1;
kernel_size[symbol]++;
}
}
-
- nshifts = shiftcount;
/* Find and count the active items that represent ends of rules. */
count = 0;
/* Find and count the active items that represent ends of rules. */
count = 0;
- for (i = 0; i < itemsetsize; ++i)
+ for (i = 0; i < nitemset; ++i)
{
int item = ritem[itemset[i]];
if (item < 0)
{
int item = ritem[itemset[i]];
if (item < 0)
#include "derives.h"
#include "warshall.h"
#include "derives.h"
#include "warshall.h"
-/* ITEMSETSIZE is the size of the array ITEMSET. */
+/* NITEMSET is the size of the array ITEMSET. */
static unsigned *ruleset;
static unsigned *ruleset;
ruleset[r] |= FDERIVES (ritem[core[c]])[r];
}
ruleset[r] |= FDERIVES (ritem[core[c]])[r];
}
c = 0;
for (ruleno = 0; ruleno < rulesetsize * BITS_PER_WORD; ++ruleno)
if (BITISSET (ruleset, ruleno))
c = 0;
for (ruleno = 0; ruleno < rulesetsize * BITS_PER_WORD; ++ruleno)
if (BITISSET (ruleset, ruleno))
int itemno = rule_table[ruleno].rhs;
while (c < n && core[c] < itemno)
{
int itemno = rule_table[ruleno].rhs;
while (c < n && core[c] < itemno)
{
- itemset[itemsetsize] = core[c];
- itemsetsize++;
+ itemset[nitemset] = core[c];
+ nitemset++;
- itemset[itemsetsize] = itemno;
- itemsetsize++;
+ itemset[nitemset] = itemno;
+ nitemset++;
- itemset[itemsetsize] = core[c];
- itemsetsize++;
+ itemset[nitemset] = core[c];
+ nitemset++;
- print_closure ("output", itemset, itemsetsize);
+ print_closure ("output", itemset, nitemset);
void new_closure PARAMS ((int n));
void new_closure PARAMS ((int n));
-/* Given a vector of item numbers ITEMS, of length N, set up ruleset
- and itemset to indicate what rules could be run and which items
- could be accepted when those items are the active ones.
+/* Given the kernel (aka core) of a state (a vector of item numbers
+ ITEMS, of length N), set up ruleset and itemset to indicate what
+ rules could be run and which items could be accepted when those
+ items are the active ones.
ruleset contains a bit for each rule. closure sets the bits for
all rules which could potentially describe the next input to be
read.
ruleset contains a bit for each rule. closure sets the bits for
all rules which could potentially describe the next input to be
read.
- itemset is a vector of item numbers; itemsetend points to just
- beyond the end of the part of it that is significant. closure
- places there the indices of all items which represent units of
- input that could arrive next. */
+ ITEMSET is a vector of item numbers; NITEMSET is its size
+ 9actually, points to just beyond the end of the part of it that is
+ significant). closure places there the indices of all items which
+ represent units of input that could arrive next. */
void closure PARAMS ((short *items, int n));
void closure PARAMS ((short *items, int n));
void free_closure PARAMS ((void));
extern short *itemset;
void free_closure PARAMS ((void));
extern short *itemset;