One structure for states is enough, even though theoretically

there are LR(0) states and LALR(1) states.
* src/lalr.h (state_t): Remove.
(state_table): Be state_t **, not state_t *.
* src/state.h (core, CORE_ALLOC): Rename as...
(state_t, STATE_ALLOC): this.
Add the LALR(1) members: shifts, reductions, errs.
* src/LR0.c (state_table): Rename as...
(state_hash): this, to avoid name clashes with the global
`state_table'.
* src/print_graph.c, src/LR0.c, src/LR0.h, src/conflicts.c
* src/lalr.c, src/lalr.h, src/output.c, src/print.c: Adjust.
This commit is contained in:
Akim Demaille
2001-12-10 08:45:22 +00:00
parent 74ffbcb6bf
commit f693ad146e
10 changed files with 149 additions and 141 deletions

View File

@@ -1,3 +1,20 @@
2001-12-10 Akim Demaille <akim@epita.fr>
One structure for states is enough, even though theoretically
there are LR(0) states and LALR(1) states.
* src/lalr.h (state_t): Remove.
(state_table): Be state_t **, not state_t *.
* src/state.h (core, CORE_ALLOC): Rename as...
(state_t, STATE_ALLOC): this.
Add the LALR(1) members: shifts, reductions, errs.
* src/LR0.c (state_table): Rename as...
(state_hash): this, to avoid name clashes with the global
`state_table'.
* src/print_graph.c, src/LR0.c, src/LR0.h, src/conflicts.c
* src/lalr.c, src/lalr.h, src/output.c, src/print.c: Adjust.
2001-12-10 Akim Demaille <akim@epita.fr>
Bison dumps core on bash.y.

View File

@@ -34,12 +34,12 @@
int nstates;
int final_state;
core *first_state = NULL;
state_t *first_state = NULL;
shifts *first_shift = NULL;
reductions *first_reduction = NULL;
static core *this_state = NULL;
static core *last_state = NULL;
static state_t *this_state = NULL;
static state_t *last_state = NULL;
static shifts *last_shift = NULL;
static reductions *last_reduction = NULL;
@@ -55,8 +55,8 @@ static short *kernel_items = NULL;
/* hash table for states, to recognize equivalent ones. */
#define STATE_TABLE_SIZE 1009
static core **state_table = NULL;
#define STATE_HASH_SIZE 1009
static state_t **state_hash = NULL;
static void
@@ -107,7 +107,7 @@ allocate_storage (void)
shiftset = XCALLOC (short, nsyms);
redset = XCALLOC (short, nrules + 1);
state_table = XCALLOC (core *, STATE_TABLE_SIZE);
state_hash = XCALLOC (state_t *, STATE_HASH_SIZE);
}
@@ -120,7 +120,7 @@ free_storage (void)
free (kernel_base);
free (kernel_size);
XFREE (kernel_items);
free (state_table);
free (state_hash);
}
@@ -176,10 +176,10 @@ new_itemsets (void)
| necessary. |
`-----------------------------------------------------------------*/
static core *
static state_t *
new_state (int symbol)
{
core *p;
state_t *p;
if (trace_flag)
fprintf (stderr, "Entering new_state, state = %d, symbol = %d (%s)\n",
@@ -188,7 +188,7 @@ new_state (int symbol)
if (nstates >= MAXSHORT)
fatal (_("too many states (max %d)"), MAXSHORT);
p = CORE_ALLOC (kernel_size[symbol]);
p = STATE_ALLOC (kernel_size[symbol]);
p->accessing_symbol = symbol;
p->number = nstates;
p->nitems = kernel_size[symbol];
@@ -214,7 +214,7 @@ get_state (int symbol)
{
int key;
int i;
core *sp;
state_t *sp;
if (trace_flag)
fprintf (stderr, "Entering get_state, state = %d, symbol = %d (%s)\n",
@@ -225,8 +225,8 @@ get_state (int symbol)
key = 0;
for (i = 0; i < kernel_size[symbol]; ++i)
key += kernel_base[symbol][i];
key = key % STATE_TABLE_SIZE;
sp = state_table[key];
key = key % STATE_HASH_SIZE;
sp = state_hash[key];
if (sp)
{
@@ -257,7 +257,7 @@ get_state (int symbol)
}
else /* bucket is empty */
{
state_table[key] = sp = new_state (symbol);
state_hash[key] = sp = new_state (symbol);
}
if (trace_flag)
@@ -306,7 +306,7 @@ append_states (void)
static void
new_states (void)
{
first_state = last_state = this_state = CORE_ALLOC (0);
first_state = last_state = this_state = STATE_ALLOC (0);
nstates = 1;
}
@@ -340,10 +340,10 @@ save_shifts (void)
static void
insert_start_shift (void)
{
core *statep;
state_t *statep;
shifts *sp;
statep = CORE_ALLOC (0);
statep = STATE_ALLOC (0);
statep->number = nstates;
statep->accessing_symbol = start_symbol;
@@ -371,7 +371,7 @@ insert_start_shift (void)
static void
augment_automaton (void)
{
core *statep;
state_t *statep;
shifts *sp;
shifts *sp1 = NULL;
@@ -500,7 +500,7 @@ augment_automaton (void)
/* Make the final state--the one that follows a shift from the
next-to-final state.
The symbol for that shift is 0 (end-of-file). */
statep = CORE_ALLOC (0);
statep = STATE_ALLOC (0);
statep->number = nstates;
last_state->next = statep;
last_state = statep;
@@ -517,7 +517,7 @@ augment_automaton (void)
final_state = nstates;
/* Make the termination state. */
statep = CORE_ALLOC (0);
statep = STATE_ALLOC (0);
statep->number = nstates++;
last_state->next = statep;
last_state = statep;

View File

@@ -27,7 +27,7 @@ void generate_states PARAMS ((void));
extern int nstates;
extern int final_state;
extern core *first_state;
extern state_t *first_state;
extern shifts *first_shift;
extern reductions *first_reduction;

View File

@@ -56,7 +56,7 @@ Conflict in state %d between rule %d and token %s resolved as %s.\n"),
static void
flush_shift (int state, int token)
{
shifts *shiftp = state_table[state].shifts;
shifts *shiftp = state_table[state]->shifts;
int i;
for (i = 0; i < shiftp->nshifts; i++)
@@ -147,8 +147,8 @@ resolve_sr_conflict (int state, int lookaheadnum)
/* Some tokens have been explicitly made errors. Allocate a
permanent errs structure for this state, to record them. */
i = (char *) errtokens - (char *) errp;
state_table[state].errs = ERRS_ALLOC (i + 1);
memcpy (state_table[state].errs, errp, i);
state_table[state]->errs = ERRS_ALLOC (i + 1);
memcpy (state_table[state]->errs, errp, i);
free (errp);
}
@@ -159,13 +159,13 @@ set_conflicts (int state)
int i, j;
shifts *shiftp;
if (state_table[state].consistent)
if (state_table[state]->consistent)
return;
for (i = 0; i < tokensetsize; i++)
lookaheadset[i] = 0;
shiftp = state_table[state].shifts;
shiftp = state_table[state]->shifts;
for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
if (!SHIFT_IS_DISABLED (shiftp, i))
SETBIT (lookaheadset, SHIFT_SYMBOL (shiftp, i));
@@ -173,8 +173,8 @@ set_conflicts (int state)
/* Loop over all rules which require lookahead in this state. First
check for shift-reduce conflict, and try to resolve using
precedence */
for (i = state_table[state].lookaheads;
i < state_table[state + 1].lookaheads;
for (i = state_table[state]->lookaheads;
i < state_table[state + 1]->lookaheads;
++i)
if (rule_table[LAruleno[i]].prec)
for (j = 0; j < tokensetsize; ++j)
@@ -187,8 +187,8 @@ set_conflicts (int state)
/* Loop over all rules which require lookahead in this state. Check
for conflicts not resolved above. */
for (i = state_table[state].lookaheads;
i < state_table[state + 1].lookaheads;
for (i = state_table[state]->lookaheads;
i < state_table[state + 1]->lookaheads;
++i)
{
for (j = 0; j < tokensetsize; ++j)
@@ -223,7 +223,7 @@ count_sr_conflicts (int state)
{
int i, k;
int src_count = 0;
shifts *shiftp = state_table[state].shifts;
shifts *shiftp = state_table[state]->shifts;
if (!shiftp)
return 0;
@@ -238,8 +238,8 @@ count_sr_conflicts (int state)
if (!SHIFT_IS_DISABLED (shiftp, i))
SETBIT (shiftset, SHIFT_SYMBOL (shiftp, i));
for (i = state_table[state].lookaheads;
i < state_table[state + 1].lookaheads;
for (i = state_table[state]->lookaheads;
i < state_table[state + 1]->lookaheads;
++i)
for (k = 0; k < tokensetsize; ++k)
lookaheadset[k] |= LA (i)[k];
@@ -265,8 +265,8 @@ count_rr_conflicts (int state)
int i;
int rrc_count = 0;
int m = state_table[state].lookaheads;
int n = state_table[state + 1].lookaheads;
int m = state_table[state]->lookaheads;
int n = state_table[state + 1]->lookaheads;
if (n - m < 2)
return 0;
@@ -424,7 +424,7 @@ print_reductions (FILE *out, int state)
for (i = 0; i < tokensetsize; i++)
shiftset[i] = 0;
shiftp = state_table[state].shifts;
shiftp = state_table[state]->shifts;
for (i = 0; i < shiftp->nshifts && SHIFT_IS_SHIFT (shiftp, i); i++)
if (!SHIFT_IS_DISABLED (shiftp, i))
{
@@ -435,14 +435,14 @@ print_reductions (FILE *out, int state)
SETBIT (shiftset, SHIFT_SYMBOL (shiftp, i));
}
errp = state_table[state].errs;
errp = state_table[state]->errs;
if (errp)
for (i = 0; i < errp->nerrs; i++)
if (errp->errs[i])
SETBIT (shiftset, errp->errs[i]);
m = state_table[state].lookaheads;
n = state_table[state + 1].lookaheads;
m = state_table[state]->lookaheads;
n = state_table[state + 1]->lookaheads;
if (n - m == 1 && !nodefault)
{

View File

@@ -36,7 +36,7 @@
/* All the decorated states, indexed by the state number. Warning:
there is a state_TABLE in LR0.c, but it is different and static.
*/
state_t *state_table = NULL;
state_t **state_table = NULL;
int tokensetsize;
short *LAruleno;
@@ -142,36 +142,33 @@ set_state_table (void)
/* NSTATES + 1 because lookahead for the pseudo state number NSTATES
might be used (see conflicts.c). It is too opaque for me to
provide a probably less hacky implementation. --akim */
state_table = XCALLOC (state_t, nstates + 1);
state_table = XCALLOC (state_t *, nstates + 1);
{
core *sp;
state_t *sp;
for (sp = first_state; sp; sp = sp->next)
{
state_table[sp->number].state = sp;
state_table[sp->number].accessing_symbol = sp->accessing_symbol;
}
state_table[sp->number] = sp;
}
{
shifts *sp;
for (sp = first_shift; sp; sp = sp->next)
state_table[sp->number].shifts = sp;
state_table[sp->number]->shifts = sp;
}
{
reductions *rp;
for (rp = first_reduction; rp; rp = rp->next)
state_table[rp->number].reductions = rp;
state_table[rp->number]->reductions = rp;
}
/* Pessimization, but simplification of the code: make sense all the
/* Pessimization, but simplification of the code: make sure all the
states have a shifts, even if reduced to 0 shifts. */
{
int i;
for (i = 0; i < nstates; i++)
if (!state_table[i].shifts)
state_table[i].shifts = shifts_new (0);
if (!state_table[i]->shifts)
state_table[i]->shifts = shifts_new (0);
}
/* Initializing the lookaheads members. Please note that it must be
@@ -183,25 +180,28 @@ set_state_table (void)
for (i = 0; i < nstates; i++)
{
int k;
reductions *rp = state_table[i].reductions;
shifts *sp = state_table[i].shifts;
reductions *rp = state_table[i]->reductions;
shifts *sp = state_table[i]->shifts;
state_table[i].lookaheads = count;
state_table[i]->lookaheads = count;
if (rp
&& (rp->nreds > 1 || (sp->nshifts && SHIFT_IS_SHIFT (sp, 0))))
count += rp->nreds;
else
state_table[i].consistent = 1;
state_table[i]->consistent = 1;
for (k = 0; k < sp->nshifts; k++)
if (SHIFT_IS_ERROR (sp, k))
{
state_table[i].consistent = 0;
state_table[i]->consistent = 0;
break;
}
}
state_table[nstates].lookaheads = count;
/* Seems to be needed by conflicts.c. */
state_table[nstates] = STATE_ALLOC (0);
state_table[nstates]->lookaheads = count;
}
}
@@ -214,7 +214,7 @@ initialize_LA (void)
short *np;
reductions *rp;
size_t nLA = state_table[nstates].lookaheads;
size_t nLA = state_table[nstates]->lookaheads;
if (!nLA)
nLA = 1;
@@ -224,8 +224,8 @@ initialize_LA (void)
np = LAruleno;
for (i = 0; i < nstates; i++)
if (!state_table[i].consistent)
if ((rp = state_table[i].reductions))
if (!state_table[i]->consistent)
if ((rp = state_table[i]->reductions))
for (j = 0; j < rp->nreds; j++)
*np++ = rp->rules[j];
}
@@ -249,7 +249,7 @@ set_goto_map (void)
for (sp = first_shift; sp; sp = sp->next)
for (i = sp->nshifts - 1; i >= 0 && SHIFT_IS_GOTO (sp, i); --i)
{
symbol = state_table[sp->shifts[i]].accessing_symbol;
symbol = state_table[sp->shifts[i]]->accessing_symbol;
if (ngotos == MAXSHORT)
fatal (_("too many gotos (max %d)"), MAXSHORT);
@@ -280,7 +280,7 @@ set_goto_map (void)
for (i = sp->nshifts - 1; i >= 0 && SHIFT_IS_GOTO (sp, i); --i)
{
state2 = sp->shifts[i];
symbol = state_table[state2].accessing_symbol;
symbol = state_table[state2]->accessing_symbol;
k = temp_map[symbol]++;
from_state[k] = state1;
@@ -340,18 +340,18 @@ initialize_F (void)
for (i = 0; i < ngotos; i++)
{
int stateno = to_state[i];
shifts *sp = state_table[stateno].shifts;
shifts *sp = state_table[stateno]->shifts;
int j;
for (j = 0; j < sp->nshifts && SHIFT_IS_SHIFT (sp, j); j++)
{
int symbol = state_table[sp->shifts[j]].accessing_symbol;
int symbol = state_table[sp->shifts[j]]->accessing_symbol;
SETBIT (F (i), symbol);
}
for (; j < sp->nshifts; j++)
{
int symbol = state_table[sp->shifts[j]].accessing_symbol;
int symbol = state_table[sp->shifts[j]]->accessing_symbol;
if (nullable[symbol])
edge[nedges++] = map_goto (stateno, symbol);
}
@@ -383,8 +383,8 @@ add_lookback_edge (int stateno, int ruleno, int gotono)
int found;
shorts *sp;
i = state_table[stateno].lookaheads;
k = state_table[stateno + 1].lookaheads;
i = state_table[stateno]->lookaheads;
k = state_table[stateno + 1]->lookaheads;
found = 0;
while (!found && i < k)
{
@@ -502,7 +502,7 @@ build_relations (void)
{
int nedges = 0;
int state1 = from_state[i];
int symbol1 = state_table[to_state[i]].accessing_symbol;
int symbol1 = state_table[to_state[i]]->accessing_symbol;
short *rulep;
for (rulep = derives[symbol1]; *rulep > 0; rulep++)
@@ -515,19 +515,19 @@ build_relations (void)
for (rp = ritem + rule_table[*rulep].rhs; *rp > 0; rp++)
{
shifts *sp = state_table[stateno].shifts;
shifts *sp = state_table[stateno]->shifts;
int j;
for (j = 0; j < sp->nshifts; j++)
{
stateno = sp->shifts[j];
if (state_table[stateno].accessing_symbol == *rp)
if (state_table[stateno]->accessing_symbol == *rp)
break;
}
states[length++] = stateno;
}
if (!state_table[stateno].consistent)
if (!state_table[stateno]->consistent)
add_lookback_edge (stateno, *rulep, i);
length--;
@@ -585,7 +585,7 @@ compute_lookaheads (void)
int i;
shorts *sp;
for (i = 0; i < state_table[nstates].lookaheads; i++)
for (i = 0; i < state_table[nstates]->lookaheads; i++)
for (sp = lookback[i]; sp; sp = sp->next)
{
int size = LA (i + 1) - LA (i);
@@ -595,7 +595,7 @@ compute_lookaheads (void)
}
/* Free LOOKBACK. */
for (i = 0; i < state_table[nstates].lookaheads; i++)
for (i = 0; i < state_table[nstates]->lookaheads; i++)
LIST_FREE (shorts, lookback[i]);
XFREE (lookback);

View File

@@ -69,30 +69,8 @@ extern unsigned *LA;
#define LA(Rule) (LA + (Rule) * tokensetsize)
/* A structure decorating a state, with additional information. */
typedef struct state_s
{
/* A state. */
core *state;
/* Its accessing symbol. */
short accessing_symbol;
shifts *shifts;
reductions *reductions;
errs *errs;
/* Nonzero if no lookahead is needed to decide what to do in state
S. */
char consistent;
short lookaheads;
} state_t;
/* All the decorated states, indexed by the state number. Warning:
there is a state_TABLE in LR0.c, but it is different and static.
*/
extern state_t *state_table;
/* All the states, indexed by the state number. */
extern state_t **state_table;
extern int tokensetsize;

View File

@@ -212,7 +212,7 @@ output_stos (void)
int i;
short *values = (short *) alloca (sizeof (short) * nstates);
for (i = 0; i < nstates; ++i)
values[i] = state_table[i].accessing_symbol;
values[i] = state_table[i]->accessing_symbol;
output_table_data (&output_obstack, values,
0, 1, nstates);
muscle_insert ("stos", obstack_finish (&output_obstack));
@@ -355,7 +355,7 @@ action_row (int state)
default_rule = 0;
nreds = 0;
redp = state_table[state].reductions;
redp = state_table[state]->reductions;
if (redp)
{
@@ -365,8 +365,8 @@ action_row (int state)
{
/* loop over all the rules available here which require
lookahead */
m = state_table[state].lookaheads;
n = state_table[state + 1].lookaheads;
m = state_table[state]->lookaheads;
n = state_table[state + 1]->lookaheads;
for (i = n - 1; i >= m; i--)
/* and find each token which the rule finds acceptable
@@ -382,14 +382,14 @@ action_row (int state)
/* Now see which tokens are allowed for shifts in this state. For
them, record the shift as the thing to do. So shift is preferred
to reduce. */
shiftp = state_table[state].shifts;
shiftp = state_table[state]->shifts;
for (i = 0; i < shiftp->nshifts; i++)
{
shift_state = shiftp->shifts[i];
if (!shift_state)
continue;
symbol = state_table[shift_state].accessing_symbol;
symbol = state_table[shift_state]->accessing_symbol;
if (ISVAR (symbol))
break;
@@ -404,7 +404,7 @@ action_row (int state)
/* See which tokens are an explicit error in this state (due to
%nonassoc). For them, record MINSHORT as the action. */
errp = state_table[state].errs;
errp = state_table[state]->errs;
if (errp)
{
@@ -422,7 +422,7 @@ action_row (int state)
if (nreds >= 1 && !nodefault)
{
if (state_table[state].consistent)
if (state_table[state]->consistent)
default_rule = redp->rules[0];
else
{
@@ -910,6 +910,7 @@ output_actions (void)
output_table ();
output_check ();
LIST_FREE (state_t, first_state);
XFREE (state_table);
}
@@ -1051,8 +1052,6 @@ output (void)
{
obstack_init (&output_obstack);
LIST_FREE (core, first_state);
output_token_translations ();
output_gram ();

View File

@@ -49,8 +49,8 @@ static void
print_core (FILE *out, int state)
{
int i;
short *sitems = state_table[state].state->items;
int snitems = state_table[state].state->nitems;
short *sitems = state_table[state]->items;
int snitems = state_table[state]->nitems;
/* New experimental feature: if TRACE_FLAGS output all the items of
a state, not only its kernel. */
@@ -98,9 +98,9 @@ print_actions (FILE *out, int state)
{
int i;
shifts *shiftp = state_table[state].shifts;
reductions *redp = state_table[state].reductions;
errs *errp = state_table[state].errs;
shifts *shiftp = state_table[state]->shifts;
reductions *redp = state_table[state]->reductions;
errs *errp = state_table[state]->errs;
if (!shiftp->nshifts && !redp)
{
@@ -115,7 +115,7 @@ print_actions (FILE *out, int state)
if (!SHIFT_IS_DISABLED (shiftp, i))
{
int state1 = shiftp->shifts[i];
int symbol = state_table[state1].accessing_symbol;
int symbol = state_table[state1]->accessing_symbol;
/* The following line used to be turned off. */
if (ISVAR (symbol))
break;
@@ -147,7 +147,7 @@ print_actions (FILE *out, int state)
fputc ('\n', out);
}
if (state_table[state].consistent && redp)
if (state_table[state]->consistent && redp)
{
int rule = redp->rules[0];
int symbol = rule_table[rule].lhs;
@@ -165,7 +165,7 @@ print_actions (FILE *out, int state)
if (!SHIFT_IS_DISABLED (shiftp, i))
{
int state1 = shiftp->shifts[i];
int symbol = state_table[state1].accessing_symbol;
int symbol = state_table[state1]->accessing_symbol;
fprintf (out, _(" %-4s\tgo to state %d\n"),
tags[symbol], state1);
}

View File

@@ -40,7 +40,7 @@ static void
print_core (int state, struct obstack *node_obstack)
{
int i;
core *statep = state_table[state].state;
state_t *statep = state_table[state];
if (!statep->nitems)
return;
@@ -85,10 +85,10 @@ print_actions (int state, const char *node_name)
{
int i;
shifts *shiftp = state_table[state].shifts;
reductions *redp = state_table[state].reductions;
shifts *shiftp = state_table[state]->shifts;
reductions *redp = state_table[state]->reductions;
#if 0
errs *errp = err_table[state];
errs *errp = state_table[state]->errs;
#endif
static char buff[10];
@@ -109,7 +109,7 @@ print_actions (int state, const char *node_name)
if (!SHIFT_IS_DISABLED (shiftp, i))
{
int state1 = shiftp->shifts[i];
int symbol = state_table[state1].accessing_symbol;
int symbol = state_table[state1]->accessing_symbol;
new_edge (&edge);
@@ -150,7 +150,7 @@ print_actions (int state, const char *node_name)
obstack_1grow (node_obstack, '\n');
}
if (state_table[state].consistent && redp)
if (state_table[state]->consistent && redp)
{
rule = redp->rules[0];
symbol = rule_table[rule].lhs;
@@ -168,7 +168,7 @@ print_actions (int state, const char *node_name)
if (!SHIFT_IS_DISABLED (shiftp, i))
{
int state1 = shiftp->shifts[i];
int symbol = state_table[state1].accessing_symbol;
int symbol = state_table[state1]->accessing_symbol;
new_edge (&edge);
open_edge (&edge, fgraph);

View File

@@ -89,24 +89,6 @@
# define STATE_H_
/*-------.
| Core. |
`-------*/
typedef struct core
{
struct core *next;
struct core *link;
short number;
short accessing_symbol;
short nitems;
short items[1];
} core;
#define CORE_ALLOC(Nitems) \
(core *) xcalloc ((unsigned) (sizeof (core) \
+ (Nitems - 1) * sizeof (short)), 1)
/*---------.
| Shifts. |
`---------*/
@@ -132,7 +114,7 @@ shifts * shifts_new PARAMS ((int n));
case of gotos. */
#define SHIFT_SYMBOL(Shifts, Shift) \
(state_table[Shifts->shifts[Shift]].accessing_symbol)
(state_table[Shifts->shifts[Shift]]->accessing_symbol)
/* Is the SHIFTS->shifts[Shift] a real shift? (as opposed to gotos.) */
@@ -190,4 +172,36 @@ typedef struct reductions
(reductions *) xcalloc ((unsigned) (sizeof (reductions) \
+ (Nreductions - 1) * sizeof (short)), 1)
/*----------.
| State_t. |
`----------*/
typedef struct state_s
{
struct state_s *next;
struct state_s *link;
short number;
short accessing_symbol;
shifts *shifts;
reductions *reductions;
errs *errs;
/* Nonzero if no lookahead is needed to decide what to do in state S. */
char consistent;
/* Used in LALR, not LR(0). */
short lookaheads;
/* Its items. */
short nitems;
short items[1];
} state_t;
#define STATE_ALLOC(Nitems) \
(state_t *) xcalloc ((unsigned) (sizeof (state_t) \
+ (Nitems - 1) * sizeof (short)), 1)
#endif /* !STATE_H_ */