WARNS=2 and s/register//.
Set NO_WERROR=true because there are some flex(1) issues that need to be dealt with.
This commit is contained in:
parent
ec0f8380d3
commit
f906e265a6
@ -4,6 +4,8 @@
|
||||
PROG= yacc
|
||||
SRCS= closure.c error.c lalr.c lr0.c main.c mkpar.c output.c reader.c \
|
||||
skeleton.c symtab.c verbose.c warshall.c
|
||||
WARNS?= 2
|
||||
NO_WERROR=true # XXXX Temporary
|
||||
SCRIPTS=yyfix.sh
|
||||
MAN= yacc.1 yyfix.1
|
||||
LINKS= ${BINDIR}/yacc ${BINDIR}/byacc
|
||||
|
@ -61,12 +61,12 @@ static unsigned *EFF;
|
||||
static void
|
||||
set_EFF()
|
||||
{
|
||||
register unsigned *row;
|
||||
register int symbol;
|
||||
register short *sp;
|
||||
register int rowsize;
|
||||
register int i;
|
||||
register int rule;
|
||||
unsigned *row;
|
||||
int symbol;
|
||||
short *sp;
|
||||
int rowsize;
|
||||
int i;
|
||||
int rule;
|
||||
|
||||
rowsize = WORDSIZE(nvars);
|
||||
EFF = NEW2(nvars * rowsize, unsigned);
|
||||
@ -98,12 +98,12 @@ set_EFF()
|
||||
void
|
||||
set_first_derives()
|
||||
{
|
||||
register unsigned *rrow;
|
||||
register unsigned *vrow;
|
||||
register int j;
|
||||
register unsigned k;
|
||||
register unsigned cword = 0;
|
||||
register short *rp;
|
||||
unsigned *rrow;
|
||||
unsigned *vrow;
|
||||
int j;
|
||||
unsigned k;
|
||||
unsigned cword = 0;
|
||||
short *rp;
|
||||
|
||||
int rule;
|
||||
int i;
|
||||
@ -156,13 +156,13 @@ closure(nucleus, n)
|
||||
short *nucleus;
|
||||
int n;
|
||||
{
|
||||
register int ruleno;
|
||||
register unsigned word;
|
||||
register unsigned i;
|
||||
register short *csp;
|
||||
register unsigned *dsp;
|
||||
register unsigned *rsp;
|
||||
register int rulesetsize;
|
||||
int ruleno;
|
||||
unsigned word;
|
||||
unsigned i;
|
||||
short *csp;
|
||||
unsigned *dsp;
|
||||
unsigned *rsp;
|
||||
int rulesetsize;
|
||||
|
||||
short *csend;
|
||||
unsigned *rsend;
|
||||
@ -237,7 +237,7 @@ static void
|
||||
print_closure(n)
|
||||
int n;
|
||||
{
|
||||
register short *isp;
|
||||
short *isp;
|
||||
|
||||
printf("\n\nn = %d\n\n", n);
|
||||
for (isp = itemset; isp < itemsetend; isp++)
|
||||
@ -248,10 +248,10 @@ int n;
|
||||
static void
|
||||
print_EFF()
|
||||
{
|
||||
register int i, j;
|
||||
register unsigned *rowp;
|
||||
register unsigned word;
|
||||
register unsigned k;
|
||||
int i, j;
|
||||
unsigned *rowp;
|
||||
unsigned word;
|
||||
unsigned k;
|
||||
|
||||
printf("\n\nEpsilon Free Firsts\n");
|
||||
|
||||
@ -280,11 +280,11 @@ print_EFF()
|
||||
static void
|
||||
print_first_derives()
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
register unsigned *rp;
|
||||
register unsigned cword;
|
||||
register unsigned k;
|
||||
int i;
|
||||
int j;
|
||||
unsigned *rp;
|
||||
unsigned cword;
|
||||
unsigned k;
|
||||
|
||||
printf("\n\n\nFirst Derives\n");
|
||||
|
||||
|
@ -225,7 +225,7 @@ extern char lflag;
|
||||
extern char rflag;
|
||||
extern char tflag;
|
||||
extern char vflag;
|
||||
extern char *symbol_prefix;
|
||||
extern const char *symbol_prefix;
|
||||
|
||||
extern char *myname;
|
||||
extern char *cptr;
|
||||
@ -233,16 +233,16 @@ extern char *line;
|
||||
extern int lineno;
|
||||
extern int outline;
|
||||
|
||||
extern char *banner[];
|
||||
extern char *tables[];
|
||||
extern char *header[];
|
||||
extern char *body[];
|
||||
extern char *trailer[];
|
||||
extern const char *banner[];
|
||||
extern const char *tables[];
|
||||
extern const char *header[];
|
||||
extern const char *body[];
|
||||
extern const char *trailer[];
|
||||
|
||||
extern char *action_file_name;
|
||||
extern char *code_file_name;
|
||||
extern char *defines_file_name;
|
||||
extern char *input_file_name;
|
||||
extern const char *input_file_name;
|
||||
extern char *output_file_name;
|
||||
extern char *text_file_name;
|
||||
extern char *union_file_name;
|
||||
@ -319,7 +319,7 @@ void default_action_warning __P((void));
|
||||
void dollar_error __P((int, char *, char *));
|
||||
void dollar_warning __P((int, int));
|
||||
void done __P((int));
|
||||
void fatal __P((char *msg));
|
||||
void fatal __P((const char *msg));
|
||||
void finalize_closure __P((void));
|
||||
void free_parser __P((void));
|
||||
void free_symbols __P((void));
|
||||
@ -329,11 +329,11 @@ void illegal_tag __P((int, char *, char *));
|
||||
void lalr __P((void));
|
||||
bucket *lookup __P((char *));
|
||||
void lr0 __P((void));
|
||||
bucket *make_bucket __P((char *));
|
||||
bucket *make_bucket __P((const char *));
|
||||
void make_parser __P((void));
|
||||
void no_grammar __P((void));
|
||||
void no_space __P((void));
|
||||
void open_error __P((char *));
|
||||
void open_error __P((const char *));
|
||||
void output __P((void));
|
||||
void over_unionized __P((char *));
|
||||
void prec_redeclared __P((void));
|
||||
@ -361,4 +361,4 @@ void untyped_lhs __P((void));
|
||||
void untyped_rhs __P((int, char *));
|
||||
void used_reserved __P((char *));
|
||||
void verbose __P((void));
|
||||
void write_section __P((char **));
|
||||
void write_section __P((const char **));
|
||||
|
@ -50,7 +50,7 @@ static void print_pos __P((char *, char *));
|
||||
|
||||
void
|
||||
fatal(msg)
|
||||
char *msg;
|
||||
const char *msg;
|
||||
{
|
||||
warnx("f - %s", msg);
|
||||
done(2);
|
||||
@ -67,7 +67,7 @@ no_space()
|
||||
|
||||
void
|
||||
open_error(filename)
|
||||
char *filename;
|
||||
const char *filename;
|
||||
{
|
||||
warnx("f - cannot open \"%s\"", filename);
|
||||
done(2);
|
||||
@ -88,7 +88,7 @@ print_pos(st_line, st_cptr)
|
||||
char *st_line;
|
||||
char *st_cptr;
|
||||
{
|
||||
register char *s;
|
||||
char *s;
|
||||
|
||||
if (st_line == 0) return;
|
||||
for (s = st_line; *s != '\n'; ++s)
|
||||
|
@ -78,7 +78,7 @@ static void set_reduction_table __P((void));
|
||||
static void set_shift_table __P((void));
|
||||
static void set_state_table __P((void));
|
||||
static short **transpose __P((short **, int));
|
||||
static void traverse __P((register int));
|
||||
static void traverse __P((int));
|
||||
|
||||
static int infinity;
|
||||
static int maxrhs;
|
||||
@ -115,7 +115,7 @@ lalr()
|
||||
static void
|
||||
set_state_table()
|
||||
{
|
||||
register core *sp;
|
||||
core *sp;
|
||||
|
||||
state_table = NEW2(nstates, core *);
|
||||
for (sp = first_state; sp; sp = sp->next)
|
||||
@ -127,7 +127,7 @@ set_state_table()
|
||||
static void
|
||||
set_accessing_symbol()
|
||||
{
|
||||
register core *sp;
|
||||
core *sp;
|
||||
|
||||
accessing_symbol = NEW2(nstates, short);
|
||||
for (sp = first_state; sp; sp = sp->next)
|
||||
@ -139,7 +139,7 @@ set_accessing_symbol()
|
||||
static void
|
||||
set_shift_table()
|
||||
{
|
||||
register shifts *sp;
|
||||
shifts *sp;
|
||||
|
||||
shift_table = NEW2(nstates, shifts *);
|
||||
for (sp = first_shift; sp; sp = sp->next)
|
||||
@ -151,7 +151,7 @@ set_shift_table()
|
||||
static void
|
||||
set_reduction_table()
|
||||
{
|
||||
register reductions *rp;
|
||||
reductions *rp;
|
||||
|
||||
reduction_table = NEW2(nstates, reductions *);
|
||||
for (rp = first_reduction; rp; rp = rp->next)
|
||||
@ -163,10 +163,10 @@ set_reduction_table()
|
||||
static void
|
||||
set_maxrhs()
|
||||
{
|
||||
register short *itemp;
|
||||
register short *item_end;
|
||||
register int length;
|
||||
register int max;
|
||||
short *itemp;
|
||||
short *item_end;
|
||||
int length;
|
||||
int max;
|
||||
|
||||
length = 0;
|
||||
max = 0;
|
||||
@ -192,8 +192,8 @@ set_maxrhs()
|
||||
static void
|
||||
initialize_LA()
|
||||
{
|
||||
register int i, j, k;
|
||||
register reductions *rp;
|
||||
int i, j, k;
|
||||
reductions *rp;
|
||||
|
||||
lookaheads = NEW2(nstates + 1, short);
|
||||
|
||||
@ -230,13 +230,13 @@ initialize_LA()
|
||||
static void
|
||||
set_goto_map()
|
||||
{
|
||||
register shifts *sp;
|
||||
register int i;
|
||||
register int symbol;
|
||||
register int k;
|
||||
register short *temp_map;
|
||||
register int state2;
|
||||
register int state1;
|
||||
shifts *sp;
|
||||
int i;
|
||||
int symbol;
|
||||
int k;
|
||||
short *temp_map;
|
||||
int state2;
|
||||
int state1;
|
||||
|
||||
goto_map = NEW2(nvars + 1, short) - ntokens;
|
||||
temp_map = NEW2(nvars + 1, short) - ntokens;
|
||||
@ -302,10 +302,10 @@ map_goto(state, symbol)
|
||||
int state;
|
||||
int symbol;
|
||||
{
|
||||
register int high;
|
||||
register int low;
|
||||
register int middle;
|
||||
register int s;
|
||||
int high;
|
||||
int low;
|
||||
int middle;
|
||||
int s;
|
||||
|
||||
low = goto_map[symbol];
|
||||
high = goto_map[symbol + 1];
|
||||
@ -329,18 +329,18 @@ int symbol;
|
||||
static void
|
||||
initialize_F()
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
register int k;
|
||||
register shifts *sp;
|
||||
register short *edge;
|
||||
register unsigned *rowp;
|
||||
register short *rp;
|
||||
register short **reads;
|
||||
register int nedges;
|
||||
register int stateno;
|
||||
register int symbol;
|
||||
register int nwords;
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
shifts *sp;
|
||||
short *edge;
|
||||
unsigned *rowp;
|
||||
short *rp;
|
||||
short **reads;
|
||||
int nedges;
|
||||
int stateno;
|
||||
int symbol;
|
||||
int nwords;
|
||||
|
||||
nwords = ngotos * tokensetsize;
|
||||
F = NEW2(nwords, unsigned);
|
||||
@ -407,23 +407,23 @@ initialize_F()
|
||||
static void
|
||||
build_relations()
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
register int k;
|
||||
register short *rulep;
|
||||
register short *rp;
|
||||
register shifts *sp;
|
||||
register int length;
|
||||
register int nedges;
|
||||
register int done;
|
||||
register int state1;
|
||||
register int stateno;
|
||||
register int symbol1;
|
||||
register int symbol2;
|
||||
register short *shortp;
|
||||
register short *edge;
|
||||
register short *states;
|
||||
register short **new_includes;
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
short *rulep;
|
||||
short *rp;
|
||||
shifts *sp;
|
||||
int length;
|
||||
int nedges;
|
||||
int done1;
|
||||
int state1;
|
||||
int stateno;
|
||||
int symbol1;
|
||||
int symbol2;
|
||||
short *shortp;
|
||||
short *edge;
|
||||
short *states;
|
||||
short **new_includes;
|
||||
|
||||
includes = NEW2(ngotos, short *);
|
||||
edge = NEW2(ngotos + 1, short);
|
||||
@ -459,16 +459,16 @@ build_relations()
|
||||
add_lookback_edge(stateno, *rulep, i);
|
||||
|
||||
length--;
|
||||
done = 0;
|
||||
while (!done)
|
||||
done1 = 0;
|
||||
while (!done1)
|
||||
{
|
||||
done = 1;
|
||||
done1 = 1;
|
||||
rp--;
|
||||
if (ISVAR(*rp))
|
||||
{
|
||||
stateno = states[--length];
|
||||
edge[nedges++] = map_goto(stateno, *rp);
|
||||
if (nullable[*rp] && length > 0) done = 0;
|
||||
if (nullable[*rp] && length > 0) done1 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -501,9 +501,9 @@ static void
|
||||
add_lookback_edge(stateno, ruleno, gotono)
|
||||
int stateno, ruleno, gotono;
|
||||
{
|
||||
register int i, k;
|
||||
register int found;
|
||||
register shorts *sp;
|
||||
int i, k;
|
||||
int found;
|
||||
shorts *sp;
|
||||
|
||||
i = lookaheads[stateno];
|
||||
k = lookaheads[stateno + 1];
|
||||
@ -526,22 +526,22 @@ int stateno, ruleno, gotono;
|
||||
|
||||
|
||||
static short **
|
||||
transpose(R, n)
|
||||
short **R;
|
||||
transpose(r, n)
|
||||
short **r;
|
||||
int n;
|
||||
{
|
||||
register short **new_R;
|
||||
register short **temp_R;
|
||||
register short *nedges;
|
||||
register short *sp;
|
||||
register int i;
|
||||
register int k;
|
||||
short **new_r;
|
||||
short **temp_r;
|
||||
short *nedges;
|
||||
short *sp;
|
||||
int i;
|
||||
int k;
|
||||
|
||||
nedges = NEW2(n, short);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
sp = R[i];
|
||||
sp = r[i];
|
||||
if (sp)
|
||||
{
|
||||
while (*sp >= 0)
|
||||
@ -549,8 +549,8 @@ int n;
|
||||
}
|
||||
}
|
||||
|
||||
new_R = NEW2(n, short *);
|
||||
temp_R = NEW2(n, short *);
|
||||
new_r = NEW2(n, short *);
|
||||
temp_r = NEW2(n, short *);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
@ -558,8 +558,8 @@ int n;
|
||||
if (k > 0)
|
||||
{
|
||||
sp = NEW2(k + 1, short);
|
||||
new_R[i] = sp;
|
||||
temp_R[i] = sp;
|
||||
new_r[i] = sp;
|
||||
temp_r[i] = sp;
|
||||
sp[k] = -1;
|
||||
}
|
||||
}
|
||||
@ -568,17 +568,17 @@ int n;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
sp = R[i];
|
||||
sp = r[i];
|
||||
if (sp)
|
||||
{
|
||||
while (*sp >= 0)
|
||||
*temp_R[*sp++]++ = i;
|
||||
*temp_r[*sp++]++ = i;
|
||||
}
|
||||
}
|
||||
|
||||
FREE(temp_R);
|
||||
FREE(temp_r);
|
||||
|
||||
return (new_R);
|
||||
return (new_r);
|
||||
}
|
||||
|
||||
|
||||
@ -593,10 +593,10 @@ compute_FOLLOWS()
|
||||
static void
|
||||
compute_lookaheads()
|
||||
{
|
||||
register int i, n;
|
||||
register unsigned *fp1, *fp2, *fp3;
|
||||
register shorts *sp, *next;
|
||||
register unsigned *rowp;
|
||||
int i, n;
|
||||
unsigned *fp1, *fp2, *fp3;
|
||||
shorts *sp, *next;
|
||||
unsigned *rowp;
|
||||
|
||||
rowp = LA;
|
||||
n = lookaheads[nstates];
|
||||
@ -629,7 +629,7 @@ static void
|
||||
digraph(relation)
|
||||
short **relation;
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
infinity = ngotos + 2;
|
||||
INDEX = NEW2(ngotos + 1, short);
|
||||
@ -655,13 +655,13 @@ short **relation;
|
||||
|
||||
static void
|
||||
traverse(i)
|
||||
register int i;
|
||||
int i;
|
||||
{
|
||||
register unsigned *fp1;
|
||||
register unsigned *fp2;
|
||||
register unsigned *fp3;
|
||||
register int j;
|
||||
register short *rp;
|
||||
unsigned *fp1;
|
||||
unsigned *fp2;
|
||||
unsigned *fp3;
|
||||
int j;
|
||||
short *rp;
|
||||
|
||||
int height;
|
||||
unsigned *base;
|
||||
|
@ -89,13 +89,13 @@ static short *kernel_items;
|
||||
static void
|
||||
allocate_itemsets()
|
||||
{
|
||||
register short *itemp;
|
||||
register short *item_end;
|
||||
register int symbol;
|
||||
register int i;
|
||||
register int count;
|
||||
register int max;
|
||||
register short *symbol_count;
|
||||
short *itemp;
|
||||
short *item_end;
|
||||
int symbol;
|
||||
int i;
|
||||
int count;
|
||||
int max;
|
||||
short *symbol_count;
|
||||
|
||||
count = 0;
|
||||
symbol_count = NEW2(nsyms, short);
|
||||
@ -142,9 +142,9 @@ allocate_storage()
|
||||
static void
|
||||
append_states()
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
register int symbol;
|
||||
int i;
|
||||
int j;
|
||||
int symbol;
|
||||
|
||||
#ifdef TRACE
|
||||
fprintf(stderr, "Entering append_states()\n");
|
||||
@ -215,13 +215,13 @@ static int
|
||||
get_state(symbol)
|
||||
int symbol;
|
||||
{
|
||||
register int key;
|
||||
register short *isp1;
|
||||
register short *isp2;
|
||||
register short *iend;
|
||||
register core *sp;
|
||||
register int found;
|
||||
register int n;
|
||||
int key;
|
||||
short *isp1;
|
||||
short *isp2;
|
||||
short *iend;
|
||||
core *sp;
|
||||
int found;
|
||||
int n;
|
||||
|
||||
#ifdef TRACE
|
||||
fprintf(stderr, "Entering get_state(%d)\n", symbol);
|
||||
@ -279,9 +279,9 @@ int symbol;
|
||||
static void
|
||||
initialize_states()
|
||||
{
|
||||
register int i;
|
||||
register short *start_derives;
|
||||
register core *p;
|
||||
int i;
|
||||
short *start_derives;
|
||||
core *p;
|
||||
|
||||
start_derives = derives[start_symbol];
|
||||
for (i = 0; start_derives[i] >= 0; ++i)
|
||||
@ -307,11 +307,11 @@ initialize_states()
|
||||
static void
|
||||
new_itemsets()
|
||||
{
|
||||
register int i;
|
||||
register int shiftcount;
|
||||
register short *isp;
|
||||
register short *ksp;
|
||||
register int symbol;
|
||||
int i;
|
||||
int shiftcount;
|
||||
short *isp;
|
||||
short *ksp;
|
||||
int symbol;
|
||||
|
||||
for (i = 0; i < nsyms; i++)
|
||||
kernel_end[i] = 0;
|
||||
@ -345,11 +345,11 @@ static core *
|
||||
new_state(symbol)
|
||||
int symbol;
|
||||
{
|
||||
register int n;
|
||||
register core *p;
|
||||
register short *isp1;
|
||||
register short *isp2;
|
||||
register short *iend;
|
||||
int n;
|
||||
core *p;
|
||||
short *isp1;
|
||||
short *isp2;
|
||||
short *iend;
|
||||
|
||||
#ifdef TRACE
|
||||
fprintf(stderr, "Entering new_state(%d)\n", symbol);
|
||||
@ -461,10 +461,10 @@ show_shifts()
|
||||
static void
|
||||
save_shifts()
|
||||
{
|
||||
register shifts *p;
|
||||
register short *sp1;
|
||||
register short *sp2;
|
||||
register short *send;
|
||||
shifts *p;
|
||||
short *sp1;
|
||||
short *sp2;
|
||||
short *send;
|
||||
|
||||
p = (shifts *) allocate((unsigned) (sizeof(shifts) +
|
||||
(nshifts - 1) * sizeof(short)));
|
||||
@ -496,13 +496,13 @@ save_shifts()
|
||||
static void
|
||||
save_reductions()
|
||||
{
|
||||
register short *isp;
|
||||
register short *rp1;
|
||||
register short *rp2;
|
||||
register int item;
|
||||
register int count;
|
||||
register reductions *p;
|
||||
register short *rend;
|
||||
short *isp;
|
||||
short *rp1;
|
||||
short *rp2;
|
||||
int item;
|
||||
int count;
|
||||
reductions *p;
|
||||
short *rend;
|
||||
|
||||
count = 0;
|
||||
for (isp = itemset; isp < itemsetend; isp++)
|
||||
@ -546,9 +546,9 @@ save_reductions()
|
||||
static void
|
||||
set_derives()
|
||||
{
|
||||
register int i, k;
|
||||
register int lhs;
|
||||
register short *rules;
|
||||
int i, k;
|
||||
int lhs;
|
||||
short *rules;
|
||||
|
||||
derives = NEW2(nsyms, short *);
|
||||
rules = NEW2(nvars + nrules, short);
|
||||
@ -586,8 +586,8 @@ free_derives()
|
||||
static void
|
||||
print_derives()
|
||||
{
|
||||
register int i;
|
||||
register short *sp;
|
||||
int i;
|
||||
short *sp;
|
||||
|
||||
printf("\nDERIVES\n\n");
|
||||
|
||||
@ -609,9 +609,9 @@ print_derives()
|
||||
static void
|
||||
set_nullable()
|
||||
{
|
||||
register int i, j;
|
||||
register int empty;
|
||||
int done;
|
||||
int i, j;
|
||||
int empty;
|
||||
int done1;
|
||||
|
||||
nullable = MALLOC(nsyms);
|
||||
if (nullable == 0) no_space();
|
||||
@ -619,10 +619,10 @@ set_nullable()
|
||||
for (i = 0; i < nsyms; ++i)
|
||||
nullable[i] = 0;
|
||||
|
||||
done = 0;
|
||||
while (!done)
|
||||
done1 = 0;
|
||||
while (!done1)
|
||||
{
|
||||
done = 1;
|
||||
done1 = 1;
|
||||
for (i = 1; i < nitems; i++)
|
||||
{
|
||||
empty = 1;
|
||||
@ -638,7 +638,7 @@ set_nullable()
|
||||
if (!nullable[j])
|
||||
{
|
||||
nullable[j] = 1;
|
||||
done = 0;
|
||||
done1 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,9 +60,9 @@ char rflag;
|
||||
char tflag;
|
||||
char vflag;
|
||||
|
||||
char *symbol_prefix;
|
||||
char *file_prefix = "y";
|
||||
char *temp_form = "yacc.XXXXXXXXXXX";
|
||||
const char *symbol_prefix;
|
||||
const char *file_prefix = "y";
|
||||
char temp_form[] = "yacc.XXXXXXXXXXX";
|
||||
|
||||
int lineno;
|
||||
int outline;
|
||||
@ -70,7 +70,7 @@ int outline;
|
||||
char *action_file_name;
|
||||
char *code_file_name;
|
||||
char *defines_file_name;
|
||||
char *input_file_name = "";
|
||||
const char *input_file_name = "";
|
||||
char *output_file_name;
|
||||
char *text_file_name;
|
||||
char *union_file_name;
|
||||
@ -130,7 +130,7 @@ int k;
|
||||
|
||||
static void
|
||||
onintr(signo)
|
||||
int signo;
|
||||
int signo __unused;
|
||||
{
|
||||
done(1);
|
||||
}
|
||||
@ -169,8 +169,8 @@ getargs(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
register int i;
|
||||
register char *s;
|
||||
int i;
|
||||
char *s;
|
||||
|
||||
for (i = 1; i < argc; ++i)
|
||||
{
|
||||
@ -282,7 +282,7 @@ char *
|
||||
allocate(n)
|
||||
unsigned n;
|
||||
{
|
||||
register char *p;
|
||||
char *p;
|
||||
|
||||
p = NULL;
|
||||
if (n)
|
||||
@ -298,7 +298,7 @@ static void
|
||||
create_file_names()
|
||||
{
|
||||
int i, len;
|
||||
char *tmpdir;
|
||||
const char *tmpdir;
|
||||
|
||||
tmpdir = getenv("TMPDIR");
|
||||
if (tmpdir == 0) tmpdir = "/tmp";
|
||||
|
@ -75,7 +75,7 @@ static void unused_rules __P((void));
|
||||
void
|
||||
make_parser()
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
parser = NEW2(nstates, action *);
|
||||
for (i = 0; i < nstates; i++)
|
||||
@ -91,9 +91,9 @@ make_parser()
|
||||
|
||||
static action *
|
||||
parse_actions(stateno)
|
||||
register int stateno;
|
||||
int stateno;
|
||||
{
|
||||
register action *actions;
|
||||
action *actions;
|
||||
|
||||
actions = get_shifts(stateno);
|
||||
actions = add_reductions(stateno, actions);
|
||||
@ -105,20 +105,20 @@ static action *
|
||||
get_shifts(stateno)
|
||||
int stateno;
|
||||
{
|
||||
register action *actions, *temp;
|
||||
register shifts *sp;
|
||||
register short *to_state;
|
||||
register int i, k;
|
||||
register int symbol;
|
||||
action *actions, *temp;
|
||||
shifts *sp;
|
||||
short *tostate;
|
||||
int i, k;
|
||||
int symbol;
|
||||
|
||||
actions = 0;
|
||||
sp = shift_table[stateno];
|
||||
if (sp)
|
||||
{
|
||||
to_state = sp->shift;
|
||||
tostate = sp->shift;
|
||||
for (i = sp->nshifts - 1; i >= 0; i--)
|
||||
{
|
||||
k = to_state[i];
|
||||
k = tostate[i];
|
||||
symbol = accessing_symbol[k];
|
||||
if (ISTOKEN(symbol))
|
||||
{
|
||||
@ -139,11 +139,11 @@ int stateno;
|
||||
static action *
|
||||
add_reductions(stateno, actions)
|
||||
int stateno;
|
||||
register action *actions;
|
||||
action *actions;
|
||||
{
|
||||
register int i, j, m, n;
|
||||
register int ruleno, tokensetsize;
|
||||
register unsigned *rowp;
|
||||
int i, j, m, n;
|
||||
int ruleno, tokensetsize;
|
||||
unsigned *rowp;
|
||||
|
||||
tokensetsize = WORDSIZE(ntokens);
|
||||
m = lookaheads[stateno];
|
||||
@ -164,10 +164,10 @@ register action *actions;
|
||||
|
||||
static action *
|
||||
add_reduce(actions, ruleno, symbol)
|
||||
register action *actions;
|
||||
register int ruleno, symbol;
|
||||
action *actions;
|
||||
int ruleno, symbol;
|
||||
{
|
||||
register action *temp, *prev, *next;
|
||||
action *temp, *prev, *next;
|
||||
|
||||
prev = 0;
|
||||
for (next = actions; next && next->symbol < symbol; next = next->next)
|
||||
@ -206,16 +206,16 @@ register int ruleno, symbol;
|
||||
static void
|
||||
find_final_state()
|
||||
{
|
||||
register int goal, i;
|
||||
register short *to_state;
|
||||
register shifts *p;
|
||||
int goal, i;
|
||||
short *tostate;
|
||||
shifts *p;
|
||||
|
||||
p = shift_table[0];
|
||||
to_state = p->shift;
|
||||
tostate = p->shift;
|
||||
goal = ritem[1];
|
||||
for (i = p->nshifts - 1; i >= 0; --i)
|
||||
{
|
||||
final_state = to_state[i];
|
||||
final_state = tostate[i];
|
||||
if (accessing_symbol[final_state] == goal) break;
|
||||
}
|
||||
}
|
||||
@ -224,8 +224,8 @@ find_final_state()
|
||||
static void
|
||||
unused_rules()
|
||||
{
|
||||
register int i;
|
||||
register action *p;
|
||||
int i;
|
||||
action *p;
|
||||
|
||||
rules_used = (short *) MALLOC(nrules*sizeof(short));
|
||||
if (rules_used == 0) no_space();
|
||||
@ -258,9 +258,9 @@ unused_rules()
|
||||
static void
|
||||
remove_conflicts()
|
||||
{
|
||||
register int i;
|
||||
register int symbol;
|
||||
register action *p, *pref = NULL;
|
||||
int i;
|
||||
int symbol;
|
||||
action *p, *pref = NULL;
|
||||
|
||||
SRtotal = 0;
|
||||
RRtotal = 0;
|
||||
@ -354,8 +354,8 @@ static int
|
||||
sole_reduction(stateno)
|
||||
int stateno;
|
||||
{
|
||||
register int count, ruleno;
|
||||
register action *p;
|
||||
int count, ruleno;
|
||||
action *p;
|
||||
|
||||
count = 0;
|
||||
ruleno = 0;
|
||||
@ -382,7 +382,7 @@ int stateno;
|
||||
static void
|
||||
defreds()
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
defred = NEW2(nstates, short);
|
||||
for (i = 0; i < nstates; i++)
|
||||
@ -391,9 +391,9 @@ defreds()
|
||||
|
||||
static void
|
||||
free_action_row(p)
|
||||
register action *p;
|
||||
action *p;
|
||||
{
|
||||
register action *q;
|
||||
action *q;
|
||||
|
||||
while (p)
|
||||
{
|
||||
@ -406,7 +406,7 @@ register action *p;
|
||||
void
|
||||
free_parser()
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nstates; i++)
|
||||
free_action_row(parser[i]);
|
||||
|
@ -181,8 +181,8 @@ output_prefix()
|
||||
static void
|
||||
output_rule_data()
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
|
||||
fprintf(output_file, "const short %slhs[] = {%42d,", symbol_prefix,
|
||||
@ -229,7 +229,7 @@ output_rule_data()
|
||||
static void
|
||||
output_yydefred()
|
||||
{
|
||||
register int i, j;
|
||||
int i, j;
|
||||
|
||||
fprintf(output_file, "const short %sdefred[] = {%39d,", symbol_prefix,
|
||||
(defred[0] ? defred[0] - 2 : 0));
|
||||
@ -286,11 +286,11 @@ output_actions()
|
||||
static void
|
||||
token_actions()
|
||||
{
|
||||
register int i, j;
|
||||
register int shiftcount, reducecount;
|
||||
register int max, min;
|
||||
register short *actionrow, *r, *s;
|
||||
register action *p;
|
||||
int i, j;
|
||||
int shiftcount, reducecount;
|
||||
int max, min;
|
||||
short *actionrow, *r, *s;
|
||||
action *p;
|
||||
|
||||
actionrow = NEW2(2*ntokens, short);
|
||||
for (i = 0; i < nstates; ++i)
|
||||
@ -371,7 +371,7 @@ token_actions()
|
||||
static void
|
||||
goto_actions()
|
||||
{
|
||||
register int i, j, k;
|
||||
int i, j, k;
|
||||
|
||||
state_count = NEW2(nstates, short);
|
||||
|
||||
@ -405,11 +405,11 @@ static int
|
||||
default_goto(symbol)
|
||||
int symbol;
|
||||
{
|
||||
register int i;
|
||||
register int m;
|
||||
register int n;
|
||||
register int default_state;
|
||||
register int max;
|
||||
int i;
|
||||
int m;
|
||||
int n;
|
||||
int default_state;
|
||||
int max;
|
||||
|
||||
m = goto_map[symbol];
|
||||
n = goto_map[symbol + 1];
|
||||
@ -443,14 +443,14 @@ save_column(symbol, default_state)
|
||||
int symbol;
|
||||
int default_state;
|
||||
{
|
||||
register int i;
|
||||
register int m;
|
||||
register int n;
|
||||
register short *sp;
|
||||
register short *sp1;
|
||||
register short *sp2;
|
||||
register int count;
|
||||
register int symno;
|
||||
int i;
|
||||
int m;
|
||||
int n;
|
||||
short *sp;
|
||||
short *sp1;
|
||||
short *sp2;
|
||||
int count;
|
||||
int symno;
|
||||
|
||||
m = goto_map[symbol];
|
||||
n = goto_map[symbol + 1];
|
||||
@ -484,11 +484,11 @@ int default_state;
|
||||
static void
|
||||
sort_actions()
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
register int k;
|
||||
register int t;
|
||||
register int w;
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
int t;
|
||||
int w;
|
||||
|
||||
order = NEW2(nvectors, short);
|
||||
nentries = 0;
|
||||
@ -520,9 +520,9 @@ sort_actions()
|
||||
static void
|
||||
pack_table()
|
||||
{
|
||||
register int i;
|
||||
register int place;
|
||||
register int state;
|
||||
int i;
|
||||
int place;
|
||||
int state;
|
||||
|
||||
base = NEW2(nvectors, short);
|
||||
pos = NEW2(nentries, short);
|
||||
@ -584,13 +584,13 @@ static int
|
||||
matching_vector(vector)
|
||||
int vector;
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
register int k;
|
||||
register int t;
|
||||
register int w;
|
||||
register int match;
|
||||
register int prev;
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
int t;
|
||||
int w;
|
||||
int match;
|
||||
int prev;
|
||||
|
||||
i = order[vector];
|
||||
if (i >= 2*nstates)
|
||||
@ -625,12 +625,12 @@ static int
|
||||
pack_vector(vector)
|
||||
int vector;
|
||||
{
|
||||
register int i, j, k, l;
|
||||
register int t;
|
||||
register int loc;
|
||||
register int ok;
|
||||
register short *from;
|
||||
register short *to;
|
||||
int i, j, k, l;
|
||||
int t;
|
||||
int loc;
|
||||
int ok;
|
||||
short *from;
|
||||
short *to;
|
||||
|
||||
i = order[vector];
|
||||
t = tally[i];
|
||||
@ -701,7 +701,7 @@ int vector;
|
||||
static void
|
||||
output_base()
|
||||
{
|
||||
register int i, j;
|
||||
int i, j;
|
||||
|
||||
fprintf(output_file, "const short %ssindex[] = {%39d,", symbol_prefix,
|
||||
base[0]);
|
||||
@ -769,8 +769,8 @@ output_base()
|
||||
static void
|
||||
output_table()
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
++outline;
|
||||
fprintf(code_file, "#define YYTABLESIZE %d\n", high);
|
||||
@ -802,8 +802,8 @@ output_table()
|
||||
static void
|
||||
output_check()
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
fprintf(output_file, "const short %scheck[] = {%40d,", symbol_prefix,
|
||||
check[0]);
|
||||
@ -833,8 +833,8 @@ static int
|
||||
is_C_identifier(name)
|
||||
char *name;
|
||||
{
|
||||
register char *s;
|
||||
register int c;
|
||||
char *s;
|
||||
int c;
|
||||
|
||||
s = name;
|
||||
c = *s;
|
||||
@ -865,8 +865,8 @@ char *name;
|
||||
static void
|
||||
output_defines()
|
||||
{
|
||||
register int c, i;
|
||||
register char *s;
|
||||
int c, i;
|
||||
char *s;
|
||||
|
||||
++outline;
|
||||
fprintf(code_file, "#define YYERRCODE %d\n", symbol_value[1]);
|
||||
@ -924,8 +924,8 @@ output_defines()
|
||||
static void
|
||||
output_stored_text()
|
||||
{
|
||||
register int c;
|
||||
register FILE *in, *out;
|
||||
int c;
|
||||
FILE *in, *out;
|
||||
|
||||
fclose(text_file);
|
||||
text_file = fopen(text_file_name, "r");
|
||||
@ -952,8 +952,9 @@ output_stored_text()
|
||||
static void
|
||||
output_debug()
|
||||
{
|
||||
register int i, j, k, max;
|
||||
int i, j, k, max;
|
||||
char **symnam, *s;
|
||||
static char eof[] = "end-of-file";
|
||||
|
||||
++outline;
|
||||
fprintf(code_file, "#define YYFINAL %d\n", final_state);
|
||||
@ -980,7 +981,7 @@ output_debug()
|
||||
symnam[i] = 0;
|
||||
for (i = ntokens - 1; i >= 2; --i)
|
||||
symnam[symbol_value[i]] = symbol_name[i];
|
||||
symnam[0] = "end-of-file";
|
||||
symnam[0] = eof;
|
||||
|
||||
if (!rflag) ++outline;
|
||||
fprintf(output_file, "#if YYDEBUG\n");
|
||||
@ -1179,8 +1180,8 @@ output_stype()
|
||||
static void
|
||||
output_trailing_text()
|
||||
{
|
||||
register int c, last;
|
||||
register FILE *in, *out;
|
||||
int c, last;
|
||||
FILE *in, *out;
|
||||
|
||||
if (line == 0)
|
||||
return;
|
||||
@ -1237,8 +1238,8 @@ output_trailing_text()
|
||||
static void
|
||||
output_semantic_actions()
|
||||
{
|
||||
register int c, last;
|
||||
register FILE *out;
|
||||
int c, last;
|
||||
FILE *out;
|
||||
|
||||
fclose(action_file);
|
||||
action_file = fopen(action_file_name, "r");
|
||||
@ -1275,7 +1276,7 @@ output_semantic_actions()
|
||||
static void
|
||||
free_itemsets()
|
||||
{
|
||||
register core *cp, *next;
|
||||
core *cp, *next;
|
||||
|
||||
FREE(state_table);
|
||||
for (cp = first_state; cp; cp = next)
|
||||
@ -1289,7 +1290,7 @@ free_itemsets()
|
||||
static void
|
||||
free_shifts()
|
||||
{
|
||||
register shifts *sp, *next;
|
||||
shifts *sp, *next;
|
||||
|
||||
FREE(shift_table);
|
||||
for (sp = first_shift; sp; sp = next)
|
||||
@ -1304,7 +1305,7 @@ free_shifts()
|
||||
static void
|
||||
free_reductions()
|
||||
{
|
||||
register reductions *rp, *next;
|
||||
reductions *rp, *next;
|
||||
|
||||
FREE(reduction_table);
|
||||
for (rp = first_reduction; rp; rp = next)
|
||||
|
@ -85,6 +85,7 @@ static void copy_action __P((void));
|
||||
static void copy_ident __P((void));
|
||||
static void copy_text __P((void));
|
||||
static void copy_union __P((void));
|
||||
static void declare_expect __P((int));
|
||||
static void declare_start __P((void));
|
||||
static void declare_tokens __P((int));
|
||||
static void declare_types __P((void));
|
||||
@ -133,9 +134,9 @@ int c;
|
||||
static void
|
||||
get_line()
|
||||
{
|
||||
register FILE *f = input_file;
|
||||
register int c;
|
||||
register int i;
|
||||
FILE *f = input_file;
|
||||
int c;
|
||||
int i;
|
||||
|
||||
if (saw_eof || (c = getc(f)) == EOF)
|
||||
{
|
||||
@ -180,7 +181,7 @@ get_line()
|
||||
static char *
|
||||
dup_line()
|
||||
{
|
||||
register char *p, *s, *t;
|
||||
char *p, *s, *t;
|
||||
|
||||
if (line == 0) return (0);
|
||||
s = line;
|
||||
@ -198,7 +199,7 @@ dup_line()
|
||||
static void
|
||||
skip_comment()
|
||||
{
|
||||
register char *s;
|
||||
char *s;
|
||||
|
||||
int st_lineno = lineno;
|
||||
char *st_line = dup_line();
|
||||
@ -229,7 +230,7 @@ skip_comment()
|
||||
static int
|
||||
nextc()
|
||||
{
|
||||
register char *s;
|
||||
char *s;
|
||||
|
||||
if (line == 0)
|
||||
{
|
||||
@ -291,7 +292,7 @@ nextc()
|
||||
static int
|
||||
keyword()
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
char *t_cptr = cptr;
|
||||
|
||||
c = *++cptr;
|
||||
@ -357,8 +358,8 @@ keyword()
|
||||
static void
|
||||
copy_ident()
|
||||
{
|
||||
register int c;
|
||||
register FILE *f = output_file;
|
||||
int c;
|
||||
FILE *f = output_file;
|
||||
|
||||
c = nextc();
|
||||
if (c == EOF) unexpected_EOF();
|
||||
@ -387,9 +388,9 @@ copy_ident()
|
||||
static void
|
||||
copy_text()
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
int quote;
|
||||
register FILE *f = text_file;
|
||||
FILE *f = text_file;
|
||||
int need_newline = 0;
|
||||
int t_lineno = lineno;
|
||||
char *t_line = dup_line();
|
||||
@ -519,7 +520,7 @@ copy_text()
|
||||
static void
|
||||
copy_union()
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
int quote;
|
||||
int depth;
|
||||
int u_lineno = lineno;
|
||||
@ -674,11 +675,11 @@ int c;
|
||||
static bucket *
|
||||
get_literal()
|
||||
{
|
||||
register int c, quote;
|
||||
register int i;
|
||||
register int n;
|
||||
register char *s;
|
||||
register bucket *bp;
|
||||
int c, quote;
|
||||
int i;
|
||||
int n;
|
||||
char *s;
|
||||
bucket *bp;
|
||||
int s_lineno = lineno;
|
||||
char *s_line = dup_line();
|
||||
char *s_cptr = s_line + (cptr - line);
|
||||
@ -835,7 +836,7 @@ char *name;
|
||||
static bucket *
|
||||
get_name()
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
|
||||
cinc = 0;
|
||||
for (c = *cptr; IS_IDENT(c); c = *++cptr)
|
||||
@ -851,8 +852,8 @@ get_name()
|
||||
static int
|
||||
get_number()
|
||||
{
|
||||
register int c;
|
||||
register int n;
|
||||
int c;
|
||||
int n;
|
||||
|
||||
n = 0;
|
||||
for (c = *cptr; isdigit(c); c = *++cptr)
|
||||
@ -865,9 +866,9 @@ get_number()
|
||||
static char *
|
||||
get_tag()
|
||||
{
|
||||
register int c;
|
||||
register int i;
|
||||
register char *s;
|
||||
int c;
|
||||
int i;
|
||||
char *s;
|
||||
int t_lineno = lineno;
|
||||
char *t_line = dup_line();
|
||||
char *t_cptr = t_line + (cptr - line);
|
||||
@ -917,8 +918,8 @@ static void
|
||||
declare_tokens(assoc)
|
||||
int assoc;
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
int c;
|
||||
bucket *bp;
|
||||
int value;
|
||||
char *tag = 0;
|
||||
|
||||
@ -985,7 +986,7 @@ static void
|
||||
declare_expect(assoc)
|
||||
int assoc;
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
|
||||
if (assoc != EXPECT) ++prec;
|
||||
|
||||
@ -1024,8 +1025,8 @@ int assoc;
|
||||
static void
|
||||
declare_types()
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
int c;
|
||||
bucket *bp;
|
||||
char *tag;
|
||||
|
||||
c = nextc();
|
||||
@ -1053,8 +1054,8 @@ declare_types()
|
||||
static void
|
||||
declare_start()
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
int c;
|
||||
bucket *bp;
|
||||
|
||||
c = nextc();
|
||||
if (c == EOF) unexpected_EOF();
|
||||
@ -1072,7 +1073,7 @@ declare_start()
|
||||
static void
|
||||
read_declarations()
|
||||
{
|
||||
register int c, k;
|
||||
int c, k;
|
||||
|
||||
cache_size = 256;
|
||||
cache = MALLOC(cache_size);
|
||||
@ -1180,8 +1181,8 @@ expand_rules()
|
||||
static void
|
||||
advance_to_start()
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
int c;
|
||||
bucket *bp;
|
||||
char *s_cptr;
|
||||
int s_lineno;
|
||||
|
||||
@ -1230,7 +1231,7 @@ advance_to_start()
|
||||
|
||||
static void
|
||||
start_rule(bp, s_lineno)
|
||||
register bucket *bp;
|
||||
bucket *bp;
|
||||
int s_lineno;
|
||||
{
|
||||
if (bp->class == TERM)
|
||||
@ -1247,7 +1248,7 @@ int s_lineno;
|
||||
static void
|
||||
end_rule()
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (!last_was_action && plhs[nrules]->tag)
|
||||
{
|
||||
@ -1267,7 +1268,7 @@ end_rule()
|
||||
static void
|
||||
insert_empty_rule()
|
||||
{
|
||||
register bucket *bp, **bpp;
|
||||
bucket *bp, **bpp;
|
||||
|
||||
assert(cache);
|
||||
sprintf(cache, "$$%d", ++gensym);
|
||||
@ -1297,8 +1298,8 @@ insert_empty_rule()
|
||||
static void
|
||||
add_symbol()
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
int c;
|
||||
bucket *bp;
|
||||
int s_lineno = lineno;
|
||||
|
||||
c = *cptr;
|
||||
@ -1329,12 +1330,12 @@ add_symbol()
|
||||
static void
|
||||
copy_action()
|
||||
{
|
||||
register int c;
|
||||
register int i, n;
|
||||
int c;
|
||||
int i, n;
|
||||
int depth;
|
||||
int quote;
|
||||
char *tag;
|
||||
register FILE *f = action_file;
|
||||
FILE *f = action_file;
|
||||
int a_lineno = lineno;
|
||||
char *a_line = dup_line();
|
||||
char *a_cptr = a_line + (cptr - line);
|
||||
@ -1553,8 +1554,8 @@ copy_action()
|
||||
static int
|
||||
mark_symbol()
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp = NULL;
|
||||
int c;
|
||||
bucket *bp = NULL;
|
||||
|
||||
c = cptr[1];
|
||||
if (c == '%' || c == '\\')
|
||||
@ -1597,7 +1598,7 @@ mark_symbol()
|
||||
static void
|
||||
read_grammar()
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
|
||||
initialize_grammar();
|
||||
advance_to_start();
|
||||
@ -1631,7 +1632,7 @@ read_grammar()
|
||||
static void
|
||||
free_tags()
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (tag_table == 0) return;
|
||||
|
||||
@ -1647,8 +1648,8 @@ free_tags()
|
||||
static void
|
||||
pack_names()
|
||||
{
|
||||
register bucket *bp;
|
||||
register char *p, *s, *t;
|
||||
bucket *bp;
|
||||
char *p, *s, *t;
|
||||
|
||||
name_pool_size = 13; /* 13 == sizeof("$end") + sizeof("$accept") */
|
||||
for (bp = first_symbol; bp; bp = bp->next)
|
||||
@ -1673,7 +1674,7 @@ pack_names()
|
||||
static void
|
||||
check_symbols()
|
||||
{
|
||||
register bucket *bp;
|
||||
bucket *bp;
|
||||
|
||||
if (goal->class == UNKNOWN)
|
||||
undefined_goal(goal->name);
|
||||
@ -1692,9 +1693,9 @@ check_symbols()
|
||||
static void
|
||||
pack_symbols()
|
||||
{
|
||||
register bucket *bp;
|
||||
register bucket **v;
|
||||
register int i, j, k, n;
|
||||
bucket *bp;
|
||||
bucket **v;
|
||||
int i, j, k, n;
|
||||
|
||||
nsyms = 2;
|
||||
ntokens = 1;
|
||||
@ -1817,8 +1818,8 @@ pack_symbols()
|
||||
static void
|
||||
pack_grammar()
|
||||
{
|
||||
register int i, j;
|
||||
int assoc, prec;
|
||||
int i, j;
|
||||
int assoc, preced;
|
||||
|
||||
ritem = (short *) MALLOC(nitems*sizeof(short));
|
||||
if (ritem == 0) no_space();
|
||||
@ -1848,13 +1849,13 @@ pack_grammar()
|
||||
rlhs[i] = plhs[i]->index;
|
||||
rrhs[i] = j;
|
||||
assoc = TOKEN;
|
||||
prec = 0;
|
||||
preced = 0;
|
||||
while (pitem[j])
|
||||
{
|
||||
ritem[j] = pitem[j]->index;
|
||||
if (pitem[j]->class == TERM)
|
||||
{
|
||||
prec = pitem[j]->prec;
|
||||
preced = pitem[j]->prec;
|
||||
assoc = pitem[j]->assoc;
|
||||
}
|
||||
++j;
|
||||
@ -1863,7 +1864,7 @@ pack_grammar()
|
||||
++j;
|
||||
if (rprec[i] == UNDEFINED)
|
||||
{
|
||||
rprec[i] = prec;
|
||||
rprec[i] = preced;
|
||||
rassoc[i] = assoc;
|
||||
}
|
||||
}
|
||||
@ -1877,9 +1878,9 @@ pack_grammar()
|
||||
static void
|
||||
print_grammar()
|
||||
{
|
||||
register int i, j, k;
|
||||
int i, j, k;
|
||||
int spacing = 0;
|
||||
register FILE *f = verbose_file;
|
||||
FILE *f = verbose_file;
|
||||
|
||||
if (!vflag) return;
|
||||
|
||||
|
@ -52,7 +52,7 @@ static char const sccsid[] = "@(#)skeleton.c 5.8 (Berkeley) 4/29/95";
|
||||
/* the body either are not useful outside of semantic actions or */
|
||||
/* are conditional. */
|
||||
|
||||
char *banner[] =
|
||||
const char *banner[] =
|
||||
{
|
||||
"#ifndef lint",
|
||||
"static char const ",
|
||||
@ -76,7 +76,7 @@ char *banner[] =
|
||||
};
|
||||
|
||||
|
||||
char *tables[] =
|
||||
const char *tables[] =
|
||||
{
|
||||
"extern const short yylhs[];",
|
||||
"extern const short yylen[];",
|
||||
@ -95,7 +95,7 @@ char *tables[] =
|
||||
};
|
||||
|
||||
|
||||
char *header[] =
|
||||
const char *header[] =
|
||||
{
|
||||
"#if YYDEBUG",
|
||||
"#include <stdio.h>",
|
||||
@ -128,7 +128,7 @@ char *header[] =
|
||||
};
|
||||
|
||||
|
||||
char *body[] =
|
||||
const char *body[] =
|
||||
{
|
||||
"/* allocate initial stack or double stack size, up to YYMAXDEPTH */",
|
||||
"static int yygrowstack()",
|
||||
@ -191,9 +191,9 @@ char *body[] =
|
||||
"yyparse (YYPARSE_PARAM_ARG)",
|
||||
" YYPARSE_PARAM_DECL",
|
||||
"{",
|
||||
" register int yym, yyn, yystate;",
|
||||
" int yym, yyn, yystate;",
|
||||
"#if YYDEBUG",
|
||||
" register const char *yys;",
|
||||
" const char *yys;",
|
||||
"",
|
||||
" if ((yys = getenv(\"YYDEBUG\")))",
|
||||
" {",
|
||||
@ -330,7 +330,7 @@ char *body[] =
|
||||
};
|
||||
|
||||
|
||||
char *trailer[] =
|
||||
const char *trailer[] =
|
||||
{
|
||||
" }",
|
||||
" yyssp -= yym;",
|
||||
@ -394,12 +394,12 @@ char *trailer[] =
|
||||
|
||||
void
|
||||
write_section(section)
|
||||
char *section[];
|
||||
const char *section[];
|
||||
{
|
||||
register int c;
|
||||
register int i;
|
||||
register char *s;
|
||||
register FILE *f;
|
||||
int c;
|
||||
int i;
|
||||
const char *s;
|
||||
FILE *f;
|
||||
|
||||
f = code_file;
|
||||
for (i = 0; (s = section[i]); ++i)
|
||||
|
@ -49,7 +49,7 @@ static char const sccsid[] = "@(#)symtab.c 5.3 (Berkeley) 6/1/90";
|
||||
|
||||
#define TABLE_SIZE 1024
|
||||
|
||||
static int hash __P((char *));
|
||||
static int hash __P((const char *));
|
||||
|
||||
bucket **symbol_table;
|
||||
bucket *first_symbol;
|
||||
@ -58,10 +58,10 @@ bucket *last_symbol;
|
||||
|
||||
static int
|
||||
hash(name)
|
||||
char *name;
|
||||
const char *name;
|
||||
{
|
||||
register char *s;
|
||||
register int c, k;
|
||||
const char *s;
|
||||
int c, k;
|
||||
|
||||
assert(name && *name);
|
||||
s = name;
|
||||
@ -75,9 +75,9 @@ char *name;
|
||||
|
||||
bucket *
|
||||
make_bucket(name)
|
||||
char *name;
|
||||
const char *name;
|
||||
{
|
||||
register bucket *bp;
|
||||
bucket *bp;
|
||||
|
||||
assert(name);
|
||||
bp = (bucket *) MALLOC(sizeof(bucket));
|
||||
@ -104,7 +104,7 @@ bucket *
|
||||
lookup(name)
|
||||
char *name;
|
||||
{
|
||||
register bucket *bp, **bpp;
|
||||
bucket *bp, **bpp;
|
||||
|
||||
bpp = symbol_table + hash(name);
|
||||
bp = *bpp;
|
||||
@ -127,8 +127,8 @@ char *name;
|
||||
void
|
||||
create_symbol_table()
|
||||
{
|
||||
register int i;
|
||||
register bucket *bp;
|
||||
int i;
|
||||
bucket *bp;
|
||||
|
||||
symbol_table = (bucket **) MALLOC(TABLE_SIZE*sizeof(bucket *));
|
||||
if (symbol_table == 0) no_space();
|
||||
@ -156,7 +156,7 @@ free_symbol_table()
|
||||
void
|
||||
free_symbols()
|
||||
{
|
||||
register bucket *p, *q;
|
||||
bucket *p, *q;
|
||||
|
||||
for (p = first_symbol; p; p = q)
|
||||
{
|
||||
|
@ -50,8 +50,8 @@ static void print_conflicts __P((int));
|
||||
static void print_core __P((int));
|
||||
static void print_gotos __P((int));
|
||||
static void print_nulls __P((int));
|
||||
static void print_reductions __P((register action *, register int));
|
||||
static void print_shifts __P((register action *));
|
||||
static void print_reductions __P((action *, register int));
|
||||
static void print_shifts __P((action *));
|
||||
static void print_state __P((int));
|
||||
|
||||
static short *null_rules;
|
||||
@ -59,7 +59,7 @@ static short *null_rules;
|
||||
void
|
||||
verbose()
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (!vflag) return;
|
||||
|
||||
@ -84,8 +84,8 @@ verbose()
|
||||
static void
|
||||
log_unused()
|
||||
{
|
||||
register int i;
|
||||
register short *p;
|
||||
int i;
|
||||
short *p;
|
||||
|
||||
fprintf(verbose_file, "\n\nRules never reduced:\n");
|
||||
for (i = 3; i < nrules; ++i)
|
||||
@ -104,7 +104,7 @@ log_unused()
|
||||
static void
|
||||
log_conflicts()
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
fprintf(verbose_file, "\n\n");
|
||||
for (i = 0; i < nstates; i++)
|
||||
@ -149,8 +149,8 @@ static void
|
||||
print_conflicts(state)
|
||||
int state;
|
||||
{
|
||||
register int symbol, act = 0, number = 0;
|
||||
register action *p;
|
||||
int symbol, act = 0, number = 0;
|
||||
action *p;
|
||||
|
||||
symbol = -1;
|
||||
for (p = parser[state]; p; p = p->next)
|
||||
@ -198,12 +198,12 @@ static void
|
||||
print_core(state)
|
||||
int state;
|
||||
{
|
||||
register int i;
|
||||
register int k;
|
||||
register int rule;
|
||||
register core *statep;
|
||||
register short *sp;
|
||||
register short *sp1;
|
||||
int i;
|
||||
int k;
|
||||
int rule;
|
||||
core *statep;
|
||||
short *sp;
|
||||
short *sp1;
|
||||
|
||||
statep = state_table[state];
|
||||
k = statep->nitems;
|
||||
@ -235,8 +235,8 @@ static void
|
||||
print_nulls(state)
|
||||
int state;
|
||||
{
|
||||
register action *p;
|
||||
register int i, j, k, nnulls;
|
||||
action *p;
|
||||
int i, j, k, nnulls;
|
||||
|
||||
nnulls = 0;
|
||||
for (p = parser[state]; p; p = p->next)
|
||||
@ -280,9 +280,9 @@ static void
|
||||
print_actions(stateno)
|
||||
int stateno;
|
||||
{
|
||||
register action *p;
|
||||
register shifts *sp;
|
||||
register int as;
|
||||
action *p;
|
||||
shifts *sp;
|
||||
int as;
|
||||
|
||||
if (stateno == final_state)
|
||||
fprintf(verbose_file, "\t$end accept\n");
|
||||
@ -306,10 +306,10 @@ int stateno;
|
||||
|
||||
static void
|
||||
print_shifts(p)
|
||||
register action *p;
|
||||
action *p;
|
||||
{
|
||||
register int count;
|
||||
register action *q;
|
||||
int count;
|
||||
action *q;
|
||||
|
||||
count = 0;
|
||||
for (q = p; q; q = q->next)
|
||||
@ -331,12 +331,12 @@ register action *p;
|
||||
|
||||
|
||||
static void
|
||||
print_reductions(p, defred)
|
||||
register action *p;
|
||||
register int defred;
|
||||
print_reductions(p, defreduct)
|
||||
action *p;
|
||||
int defreduct;
|
||||
{
|
||||
register int k, anyreds;
|
||||
register action *q;
|
||||
int k, anyreds;
|
||||
action *q;
|
||||
|
||||
anyreds = 0;
|
||||
for (q = p; q ; q = q->next)
|
||||
@ -354,7 +354,7 @@ register int defred;
|
||||
{
|
||||
for (; p; p = p->next)
|
||||
{
|
||||
if (p->action_code == REDUCE && p->number != defred)
|
||||
if (p->action_code == REDUCE && p->number != defreduct)
|
||||
{
|
||||
k = p->number - 2;
|
||||
if (p->suppressed == 0)
|
||||
@ -363,8 +363,8 @@ register int defred;
|
||||
}
|
||||
}
|
||||
|
||||
if (defred > 0)
|
||||
fprintf(verbose_file, "\t. reduce %d\n", defred - 2);
|
||||
if (defreduct > 0)
|
||||
fprintf(verbose_file, "\t. reduce %d\n", defreduct - 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -373,17 +373,17 @@ static void
|
||||
print_gotos(stateno)
|
||||
int stateno;
|
||||
{
|
||||
register int i, k;
|
||||
register int as;
|
||||
register short *to_state;
|
||||
register shifts *sp;
|
||||
int i, k;
|
||||
int as;
|
||||
short *tostate;
|
||||
shifts *sp;
|
||||
|
||||
putc('\n', verbose_file);
|
||||
sp = shift_table[stateno];
|
||||
to_state = sp->shift;
|
||||
tostate = sp->shift;
|
||||
for (i = 0; i < sp->nshifts; ++i)
|
||||
{
|
||||
k = to_state[i];
|
||||
k = tostate[i];
|
||||
as = accessing_symbol[k];
|
||||
if (ISVAR(as))
|
||||
fprintf(verbose_file, "\t%s goto %d\n", symbol_name[as], k);
|
||||
|
@ -49,15 +49,15 @@ transitive_closure(R, n)
|
||||
unsigned *R;
|
||||
int n;
|
||||
{
|
||||
register int rowsize;
|
||||
register unsigned i;
|
||||
register unsigned *rowj;
|
||||
register unsigned *rp;
|
||||
register unsigned *rend;
|
||||
register unsigned *ccol;
|
||||
register unsigned *relend;
|
||||
register unsigned *cword;
|
||||
register unsigned *rowi;
|
||||
int rowsize;
|
||||
unsigned i;
|
||||
unsigned *rowj;
|
||||
unsigned *rp;
|
||||
unsigned *rend;
|
||||
unsigned *ccol;
|
||||
unsigned *relend;
|
||||
unsigned *cword;
|
||||
unsigned *rowi;
|
||||
|
||||
rowsize = WORDSIZE(n);
|
||||
relend = R + n*rowsize;
|
||||
@ -102,10 +102,10 @@ reflexive_transitive_closure(R, n)
|
||||
unsigned *R;
|
||||
int n;
|
||||
{
|
||||
register int rowsize;
|
||||
register unsigned i;
|
||||
register unsigned *rp;
|
||||
register unsigned *relend;
|
||||
int rowsize;
|
||||
unsigned i;
|
||||
unsigned *rp;
|
||||
unsigned *relend;
|
||||
|
||||
transitive_closure(R, n);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user