#include "alloc.h"
#include "gram.h"
#include "state.h"
+#include "complain.h"
extern char *nullable;
shifts *first_shift;
reductions *first_reduction;
-int get_state PARAMS((int));
-core *new_state PARAMS((int));
-
-void allocate_itemsets PARAMS((void));
-void allocate_storage PARAMS((void));
-void free_storage PARAMS((void));
-void generate_states PARAMS((void));
-void new_itemsets PARAMS((void));
-void append_states PARAMS((void));
-void initialize_states PARAMS((void));
-void save_shifts PARAMS((void));
-void save_reductions PARAMS((void));
-void augment_automaton PARAMS((void));
-void insert_start_shift PARAMS((void));
+extern void generate_states PARAMS((void));
+
+static int get_state PARAMS((int));
+static core *new_state PARAMS((int));
+static void allocate_itemsets PARAMS((void));
+static void allocate_storage PARAMS((void));
+static void free_storage PARAMS((void));
+static void new_itemsets PARAMS((void));
+static void append_states PARAMS((void));
+static void initialize_states PARAMS((void));
+static void save_shifts PARAMS((void));
+static void save_reductions PARAMS((void));
+static void augment_automaton PARAMS((void));
+static void insert_start_shift PARAMS((void));
extern void initialize_closure PARAMS((int));
extern void closure PARAMS((short *, int));
extern void finalize_closure PARAMS((void));
-extern void toomany PARAMS((char *));
static core *this_state;
static core *last_state;
-void
+static void
allocate_itemsets (void)
{
register short *itemp;
}
-void
+static void
allocate_storage (void)
{
allocate_itemsets();
}
-void
+static void
free_storage (void)
{
FREE(shift_symbol);
For each symbol in the grammar, kernel_base[symbol] points to
a vector of item numbers activated if that symbol is shifted,
and kernel_end[symbol] points after the end of that vector. */
-void
+static void
new_itemsets (void)
{
register int i;
reached by each shift transition from the current state.
shiftset is set up as a vector of state numbers of those states. */
-void
+static void
append_states (void)
{
register int i;
Create a new state if no equivalent one exists already.
Used by append_states */
-int
+static int
get_state (int symbol)
{
register int key;
state_table[key] = sp = new_state(symbol);
}
- return (sp->number);
+ return sp->number;
}
/* subroutine of get_state. create a new state for those items, if necessary. */
-core *
+static core *
new_state (int symbol)
{
register int n;
#endif
if (nstates >= MAXSHORT)
- toomany("states");
+ fatal (_("too many states (max %d)"), MAXSHORT);
isp1 = kernel_base[symbol];
iend = kernel_end[symbol];
nstates++;
- return (p);
+ return p;
}
-void
+static void
initialize_states (void)
{
register core *p;
}
-void
+static void
save_shifts (void)
{
register shifts *p;
/* find which rules can be used for reduction transitions from the current state
and make a reductions structure for the state to record their rule numbers. */
-void
+static void
save_reductions (void)
{
register short *isp;
which has a shift going to the final state, which has a shift
to the termination state.
Create such states and shifts if they don't happen to exist already. */
-void
+static void
augment_automaton (void)
{
register int i;
/* subroutine of augment_automaton.
Create the next-to-final state, to which a shift has already been made in
the initial state. */
-void
+static void
insert_start_shift (void)
{
register core *statep;