/* Match rules with nonterminals for bison,
- Copyright (C) 1984, 1989, 2000 Free Software Foundation, Inc.
+ Copyright 1984, 1989, 2000 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
*/
#include "system.h"
-#include "alloc.h"
+#include "xalloc.h"
#include "types.h"
#include "gram.h"
#include "derives.h"
+short **derives;
+
#if DEBUG
-extern char **tags;
static void
print_derives (void)
{
- register int i;
- register short *sp;
+ int i;
+ short *sp;
- printf (_("\n\n\nDERIVES\n\n"));
+ fputs ("\n\n\n", stdout);
+ printf (_("DERIVES"));
+ fputs ("\n\n", stdout);
for (i = ntokens; i < nsyms; i++)
{
#endif
-short **derives;
-
void
set_derives (void)
{
- register int i;
- register int lhs;
- register shorts *p;
- register short *q;
- register shorts **dset;
- register shorts *delts;
+ int i;
+ int lhs;
+ shorts *p;
+ short *q;
+ shorts **dset;
+ shorts *delts;
- dset = NEW2 (nvars, shorts *) - ntokens;
- delts = NEW2 (nrules + 1, shorts);
+ dset = XCALLOC (shorts *, nvars) - ntokens;
+ delts = XCALLOC (shorts, nrules + 1);
p = delts;
for (i = nrules; i > 0; i--)
}
}
- derives = NEW2 (nvars, short *) - ntokens;
- q = NEW2 (nvars + nrules, short);
+ derives = XCALLOC (short *, nvars) - ntokens;
+ q = XCALLOC (short, nvars + nrules);
for (i = ntokens; i < nsyms; i++)
{
print_derives ();
#endif
- FREE (dset + ntokens);
- FREE (delts);
+ XFREE (dset + ntokens);
+ XFREE (delts);
}
void
free_derives (void)
{
- FREE (derives[ntokens]);
- FREE (derives + ntokens);
+ XFREE (derives[ntokens]);
+ XFREE (derives + ntokens);
}