Remove uses of 'short int' and 'unsigned short int' in the parser generators.

* src/LR0.c (allocate_itemsets, new_itemsets, save_reductions):
Use size_t, not int or short int, to count objects.
* src/closure.c (nritemset, closure): Likewise.
* src/closure.h (nritemset, closure): Likewise.
* src/nullable.c (nullable_compute): Likewise.
* src/print.c (print_core): Likewise.
* src/print_graph.c (print_core): Likewise.
* src/state.c (state_compare, state_hash): Likewise.
* src/state.h (struct state): Likewise.
* src/tables.c (default_goto, goto_actions): Likewise.

* src/gram.h (rule_number, rule): Use int, not short int.
* src/output.c (prepare_rules): Likewise.
* src/state.h (state_number, STATE_NUMBER_MAXIMUM, transitions,
errs, reductions): Likewise.
* src/symtab.h (symbol_number, SYMBOL_NUMBER_MAXIMUM, struct symbol):
Likewise.
* src/tables.c (vector_number, tally, action_number,
ACTION_NUMBER_MINIMUM): Likewise.
* src/output.c (muscle_insert_short_int_table): Remove.
This commit is contained in:
Paul Eggert
2004-12-17 20:29:19 +00:00
parent efeed02327
commit f6fbd3da9d
13 changed files with 75 additions and 41 deletions

View File

@@ -42,7 +42,7 @@
Of course vector_number_t ought to be wide enough to contain
state_number and symbol_number. */
typedef short int vector_number;
typedef int vector_number;
static inline vector_number
state_number_to_vector_number (state_number s)
@@ -84,7 +84,7 @@ int nvectors;
static base_number **froms;
static base_number **tos;
static unsigned int **conflict_tos;
static short int *tally;
static int *tally;
static base_number *width;
@@ -94,8 +94,8 @@ static base_number *width;
If N = MIN, stands for `raise a syntax error'.
If N > 0, stands for `shift SYMBOL and go to n'.
If N < 0, stands for `reduce -N'. */
typedef short int action_number;
#define ACTION_NUMBER_MINIMUM SHRT_MIN
typedef int action_number;
#define ACTION_NUMBER_MINIMUM INT_MIN
static action_number *actrow;
@@ -516,14 +516,14 @@ save_column (symbol_number sym, state_number default_state)
`-------------------------------------------------------------*/
static state_number
default_goto (symbol_number sym, short int state_count[])
default_goto (symbol_number sym, size_t state_count[])
{
state_number s;
goto_number i;
goto_number m = goto_map[sym - ntokens];
goto_number n = goto_map[sym - ntokens + 1];
state_number default_state = -1;
int max = 0;
size_t max = 0;
if (m == n)
return -1;
@@ -558,7 +558,7 @@ static void
goto_actions (void)
{
symbol_number i;
short int *state_count = xnmalloc (nstates, sizeof *state_count);
size_t *state_count = xnmalloc (nstates, sizeof *state_count);
yydefgoto = xnmalloc (nvars, sizeof *yydefgoto);
/* For a given nterm I, STATE_COUNT[S] is the number of times there