style: rename closure_* functions as closure_*

This is more consistent with the other files.

* closure.h, closure.c (new_closure, free_closure): Rename as...
(closure_new, closure_free): this.
Adjust dependencies.
This commit is contained in:
Akim Demaille
2019-01-27 20:14:11 +01:00
parent e585377e68
commit 7355a35e4b
6 changed files with 15 additions and 15 deletions

View File

@@ -51,7 +51,7 @@ static bitsetv firsts = NULL;
`-----------------*/ `-----------------*/
static void static void
print_closure (char const *title, item_number const *array, size_t size) closure_print (char const *title, item_number const *array, size_t size)
{ {
fprintf (stderr, "Closure: %s\n", title); fprintf (stderr, "Closure: %s\n", title);
for (size_t i = 0; i < size; ++i) for (size_t i = 0; i < size; ++i)
@@ -167,7 +167,7 @@ set_fderives (void)
void void
new_closure (unsigned n) closure_new (unsigned n)
{ {
itemset = xnmalloc (n, sizeof *itemset); itemset = xnmalloc (n, sizeof *itemset);
@@ -182,7 +182,7 @@ void
closure (item_number const *core, size_t n) closure (item_number const *core, size_t n)
{ {
if (trace_flag & trace_sets) if (trace_flag & trace_sets)
print_closure ("input", core, n); closure_print ("input", core, n);
bitset_zero (ruleset); bitset_zero (ruleset);
@@ -219,12 +219,12 @@ closure (item_number const *core, size_t n)
} }
if (trace_flag & trace_sets) if (trace_flag & trace_sets)
print_closure ("output", itemset, nitemset); closure_print ("output", itemset, nitemset);
} }
void void
free_closure (void) closure_free (void)
{ {
free (itemset); free (itemset);
bitset_free (ruleset); bitset_free (ruleset);

View File

@@ -27,7 +27,7 @@
data so that closure can be called. n is the number of elements to data so that closure can be called. n is the number of elements to
allocate for itemset. */ allocate for itemset. */
void new_closure (unsigned n); void closure_new (unsigned n);
/* Given the kernel (aka core) of a state (a sorted vector of item numbers /* Given the kernel (aka core) of a state (a sorted vector of item numbers
@@ -49,7 +49,7 @@ void closure (item_number const *items, size_t n);
/* Frees ITEMSET, RULESET and internal data. */ /* Frees ITEMSET, RULESET and internal data. */
void free_closure (void); void closure_free (void);
extern item_number *itemset; extern item_number *itemset;
extern size_t nitemset; extern size_t nitemset;

View File

@@ -314,7 +314,7 @@ void
generate_states (void) generate_states (void)
{ {
allocate_storage (); allocate_storage ();
new_closure (nritems); closure_new (nritems);
/* Create the initial state. The 0 at the lhs is the index of the /* Create the initial state. The 0 at the lhs is the index of the
item of this initial rule. */ item of this initial rule. */
@@ -345,7 +345,7 @@ generate_states (void)
} }
/* discard various storage */ /* discard various storage */
free_closure (); closure_free ();
free_storage (); free_storage ();
/* Set up STATES. */ /* Set up STATES. */

View File

@@ -184,10 +184,10 @@ print_graph (void)
start_graph (fgraph); start_graph (fgraph);
/* Output nodes and edges. */ /* Output nodes and edges. */
new_closure (nritems); closure_new (nritems);
for (int i = 0; i < nstates; i++) for (int i = 0; i < nstates; i++)
print_state (states[i], fgraph); print_state (states[i], fgraph);
free_closure (); closure_free ();
finish_graph (fgraph); finish_graph (fgraph);
xfclose (fgraph); xfclose (fgraph);

View File

@@ -517,7 +517,7 @@ print_xml (void)
/* print grammar */ /* print grammar */
print_grammar (out, level + 1); print_grammar (out, level + 1);
new_closure (nritems); closure_new (nritems);
no_reduce_set = bitset_create (ntokens, BITSET_FIXED); no_reduce_set = bitset_create (ntokens, BITSET_FIXED);
/* print automaton */ /* print automaton */
@@ -531,7 +531,7 @@ print_xml (void)
xml_puts (out, level + 1, "</automaton>"); xml_puts (out, level + 1, "</automaton>");
bitset_free (no_reduce_set); bitset_free (no_reduce_set);
free_closure (); closure_free ();
xml_puts (out, 0, "</bison-xml-report>"); xml_puts (out, 0, "</bison-xml-report>");

View File

@@ -510,14 +510,14 @@ print_results (void)
/* If the whole state item sets, not only the kernels, are wanted, /* If the whole state item sets, not only the kernels, are wanted,
'closure' will be run, which needs memory allocation/deallocation. */ 'closure' will be run, which needs memory allocation/deallocation. */
if (report_flag & report_itemsets) if (report_flag & report_itemsets)
new_closure (nritems); closure_new (nritems);
/* Storage for print_reductions. */ /* Storage for print_reductions. */
no_reduce_set = bitset_create (ntokens, BITSET_FIXED); no_reduce_set = bitset_create (ntokens, BITSET_FIXED);
for (state_number i = 0; i < nstates; i++) for (state_number i = 0; i < nstates; i++)
print_state (out, states[i]); print_state (out, states[i]);
bitset_free (no_reduce_set); bitset_free (no_reduce_set);
if (report_flag & report_itemsets) if (report_flag & report_itemsets)
free_closure (); closure_free ();
xfclose (out); xfclose (out);
} }