Ansification (Michael Davidsaver)
This commit is contained in:
@@ -17,7 +17,7 @@ static unsigned *first_derives;
|
||||
static unsigned *EFF;
|
||||
|
||||
|
||||
set_EFF()
|
||||
set_EFF(void)
|
||||
{
|
||||
register unsigned *row;
|
||||
register int symbol;
|
||||
@@ -53,7 +53,7 @@ set_EFF()
|
||||
}
|
||||
|
||||
|
||||
set_first_derives()
|
||||
set_first_derives(void)
|
||||
{
|
||||
register unsigned *rrow;
|
||||
register unsigned *vrow;
|
||||
@@ -108,9 +108,7 @@ set_first_derives()
|
||||
}
|
||||
|
||||
|
||||
closure(nucleus, n)
|
||||
short *nucleus;
|
||||
int n;
|
||||
closure(short int *nucleus, int n)
|
||||
{
|
||||
register int ruleno;
|
||||
register unsigned word;
|
||||
@@ -178,7 +176,7 @@ int n;
|
||||
|
||||
|
||||
|
||||
finalize_closure()
|
||||
finalize_closure(void)
|
||||
{
|
||||
FREE(itemset);
|
||||
FREE(ruleset);
|
||||
|
||||
@@ -276,9 +276,9 @@ extern short final_state;
|
||||
|
||||
/* global functions */
|
||||
|
||||
extern char *allocate();
|
||||
extern bucket *lookup();
|
||||
extern bucket *make_bucket();
|
||||
extern char *allocate(unsigned int n);
|
||||
extern bucket *lookup(char *name);
|
||||
extern bucket *make_bucket(char *name);
|
||||
|
||||
|
||||
/* system variables */
|
||||
@@ -288,8 +288,8 @@ extern int errno;
|
||||
|
||||
/* system functions */
|
||||
|
||||
extern void free();
|
||||
extern char *calloc();
|
||||
extern char *malloc();
|
||||
extern char *realloc();
|
||||
extern char *strcpy();
|
||||
extern void free(void *);
|
||||
extern char *calloc(size_t, size_t);
|
||||
extern char *malloc(size_t);
|
||||
extern char *realloc(void *, size_t);
|
||||
extern char *strcpy(char *, const char *);
|
||||
|
||||
@@ -12,30 +12,28 @@
|
||||
#include "defs.h"
|
||||
|
||||
|
||||
fatal(msg)
|
||||
char *msg;
|
||||
fatal(char *msg)
|
||||
{
|
||||
fprintf(stderr, "%s: f - %s\n", myname, msg);
|
||||
done(2);
|
||||
}
|
||||
|
||||
|
||||
no_space()
|
||||
no_space(void)
|
||||
{
|
||||
fprintf(stderr, "%s: f - out of space\n", myname);
|
||||
done(2);
|
||||
}
|
||||
|
||||
|
||||
open_error(filename)
|
||||
char *filename;
|
||||
open_error(char *filename)
|
||||
{
|
||||
fprintf(stderr, "%s: f - cannot open \"%s\"\n", myname, filename);
|
||||
done(2);
|
||||
}
|
||||
|
||||
|
||||
unexpected_EOF()
|
||||
unexpected_EOF(void)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", unexpected end-of-file\n",
|
||||
myname, lineno, input_file_name);
|
||||
@@ -43,9 +41,7 @@ unexpected_EOF()
|
||||
}
|
||||
|
||||
|
||||
print_pos(st_line, st_cptr)
|
||||
char *st_line;
|
||||
char *st_cptr;
|
||||
print_pos(char *st_line, char *st_cptr)
|
||||
{
|
||||
register char *s;
|
||||
|
||||
@@ -71,10 +67,7 @@ char *st_cptr;
|
||||
}
|
||||
|
||||
|
||||
syntax_error(st_lineno, st_line, st_cptr)
|
||||
int st_lineno;
|
||||
char *st_line;
|
||||
char *st_cptr;
|
||||
syntax_error(int st_lineno, char *st_line, char *st_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", syntax error\n",
|
||||
myname, st_lineno, input_file_name);
|
||||
@@ -83,10 +76,7 @@ char *st_cptr;
|
||||
}
|
||||
|
||||
|
||||
unterminated_comment(c_lineno, c_line, c_cptr)
|
||||
int c_lineno;
|
||||
char *c_line;
|
||||
char *c_cptr;
|
||||
unterminated_comment(int c_lineno, char *c_line, char *c_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", unmatched /*\n",
|
||||
myname, c_lineno, input_file_name);
|
||||
@@ -95,10 +85,7 @@ char *c_cptr;
|
||||
}
|
||||
|
||||
|
||||
unterminated_string(s_lineno, s_line, s_cptr)
|
||||
int s_lineno;
|
||||
char *s_line;
|
||||
char *s_cptr;
|
||||
unterminated_string(int s_lineno, char *s_line, char *s_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", unterminated string\n",
|
||||
myname, s_lineno, input_file_name);
|
||||
@@ -107,10 +94,7 @@ char *s_cptr;
|
||||
}
|
||||
|
||||
|
||||
unterminated_text(t_lineno, t_line, t_cptr)
|
||||
int t_lineno;
|
||||
char *t_line;
|
||||
char *t_cptr;
|
||||
unterminated_text(int t_lineno, char *t_line, char *t_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", unmatched %%{\n",
|
||||
myname, t_lineno, input_file_name);
|
||||
@@ -119,10 +103,7 @@ char *t_cptr;
|
||||
}
|
||||
|
||||
|
||||
unterminated_union(u_lineno, u_line, u_cptr)
|
||||
int u_lineno;
|
||||
char *u_line;
|
||||
char *u_cptr;
|
||||
unterminated_union(int u_lineno, char *u_line, char *u_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", unterminated %%union \
|
||||
declaration\n", myname, u_lineno, input_file_name);
|
||||
@@ -131,8 +112,7 @@ declaration\n", myname, u_lineno, input_file_name);
|
||||
}
|
||||
|
||||
|
||||
over_unionized(u_cptr)
|
||||
char *u_cptr;
|
||||
over_unionized(char *u_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", too many %%union \
|
||||
declarations\n", myname, lineno, input_file_name);
|
||||
@@ -141,10 +121,7 @@ declarations\n", myname, lineno, input_file_name);
|
||||
}
|
||||
|
||||
|
||||
illegal_tag(t_lineno, t_line, t_cptr)
|
||||
int t_lineno;
|
||||
char *t_line;
|
||||
char *t_cptr;
|
||||
illegal_tag(int t_lineno, char *t_line, char *t_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", illegal tag\n",
|
||||
myname, t_lineno, input_file_name);
|
||||
@@ -153,8 +130,7 @@ char *t_cptr;
|
||||
}
|
||||
|
||||
|
||||
illegal_character(c_cptr)
|
||||
char *c_cptr;
|
||||
illegal_character(char *c_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", illegal character\n",
|
||||
myname, lineno, input_file_name);
|
||||
@@ -163,8 +139,7 @@ char *c_cptr;
|
||||
}
|
||||
|
||||
|
||||
used_reserved(s)
|
||||
char *s;
|
||||
used_reserved(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", illegal use of reserved symbol \
|
||||
%s\n", myname, lineno, input_file_name, s);
|
||||
@@ -172,8 +147,7 @@ char *s;
|
||||
}
|
||||
|
||||
|
||||
tokenized_start(s)
|
||||
char *s;
|
||||
tokenized_start(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s cannot be \
|
||||
declared to be a token\n", myname, lineno, input_file_name, s);
|
||||
@@ -181,32 +155,28 @@ declared to be a token\n", myname, lineno, input_file_name, s);
|
||||
}
|
||||
|
||||
|
||||
retyped_warning(s)
|
||||
char *s;
|
||||
retyped_warning(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: w - line %d of \"%s\", the type of %s has been \
|
||||
redeclared\n", myname, lineno, input_file_name, s);
|
||||
}
|
||||
|
||||
|
||||
reprec_warning(s)
|
||||
char *s;
|
||||
reprec_warning(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: w - line %d of \"%s\", the precedence of %s has been \
|
||||
redeclared\n", myname, lineno, input_file_name, s);
|
||||
}
|
||||
|
||||
|
||||
revalued_warning(s)
|
||||
char *s;
|
||||
revalued_warning(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: w - line %d of \"%s\", the value of %s has been \
|
||||
redeclared\n", myname, lineno, input_file_name, s);
|
||||
}
|
||||
|
||||
|
||||
terminal_start(s)
|
||||
char *s;
|
||||
terminal_start(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s is a \
|
||||
token\n", myname, lineno, input_file_name, s);
|
||||
@@ -214,14 +184,14 @@ token\n", myname, lineno, input_file_name, s);
|
||||
}
|
||||
|
||||
|
||||
restarted_warning()
|
||||
restarted_warning(void)
|
||||
{
|
||||
fprintf(stderr, "%s: w - line %d of \"%s\", the start symbol has been \
|
||||
redeclared\n", myname, lineno, input_file_name);
|
||||
}
|
||||
|
||||
|
||||
no_grammar()
|
||||
no_grammar(void)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", no grammar has been \
|
||||
specified\n", myname, lineno, input_file_name);
|
||||
@@ -229,8 +199,7 @@ specified\n", myname, lineno, input_file_name);
|
||||
}
|
||||
|
||||
|
||||
terminal_lhs(s_lineno)
|
||||
int s_lineno;
|
||||
terminal_lhs(int s_lineno)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", a token appears on the lhs \
|
||||
of a production\n", myname, s_lineno, input_file_name);
|
||||
@@ -238,17 +207,14 @@ of a production\n", myname, s_lineno, input_file_name);
|
||||
}
|
||||
|
||||
|
||||
prec_redeclared()
|
||||
prec_redeclared(void)
|
||||
{
|
||||
fprintf(stderr, "%s: w - line %d of \"%s\", conflicting %%prec \
|
||||
specifiers\n", myname, lineno, input_file_name);
|
||||
}
|
||||
|
||||
|
||||
unterminated_action(a_lineno, a_line, a_cptr)
|
||||
int a_lineno;
|
||||
char *a_line;
|
||||
char *a_cptr;
|
||||
unterminated_action(int a_lineno, char *a_line, char *a_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", unterminated action\n",
|
||||
myname, a_lineno, input_file_name);
|
||||
@@ -257,19 +223,14 @@ char *a_cptr;
|
||||
}
|
||||
|
||||
|
||||
dollar_warning(a_lineno, i)
|
||||
int a_lineno;
|
||||
int i;
|
||||
dollar_warning(int a_lineno, int i)
|
||||
{
|
||||
fprintf(stderr, "%s: w - line %d of \"%s\", $%d references beyond the \
|
||||
end of the current rule\n", myname, a_lineno, input_file_name, i);
|
||||
}
|
||||
|
||||
|
||||
dollar_error(a_lineno, a_line, a_cptr)
|
||||
int a_lineno;
|
||||
char *a_line;
|
||||
char *a_cptr;
|
||||
dollar_error(int a_lineno, char *a_line, char *a_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", illegal $-name\n",
|
||||
myname, a_lineno, input_file_name);
|
||||
@@ -278,7 +239,7 @@ char *a_cptr;
|
||||
}
|
||||
|
||||
|
||||
untyped_lhs()
|
||||
untyped_lhs(void)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", $$ is untyped\n",
|
||||
myname, lineno, input_file_name);
|
||||
@@ -286,9 +247,7 @@ untyped_lhs()
|
||||
}
|
||||
|
||||
|
||||
untyped_rhs(i, s)
|
||||
int i;
|
||||
char *s;
|
||||
untyped_rhs(int i, char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", $%d (%s) is untyped\n",
|
||||
myname, lineno, input_file_name, i, s);
|
||||
@@ -296,8 +255,7 @@ char *s;
|
||||
}
|
||||
|
||||
|
||||
unknown_rhs(i)
|
||||
int i;
|
||||
unknown_rhs(int i)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", $%d is untyped\n",
|
||||
myname, lineno, input_file_name, i);
|
||||
@@ -305,23 +263,21 @@ int i;
|
||||
}
|
||||
|
||||
|
||||
default_action_warning()
|
||||
default_action_warning(void)
|
||||
{
|
||||
fprintf(stderr, "%s: w - line %d of \"%s\", the default action assigns an \
|
||||
undefined value to $$\n", myname, lineno, input_file_name);
|
||||
}
|
||||
|
||||
|
||||
undefined_goal(s)
|
||||
char *s;
|
||||
undefined_goal(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: e - the start symbol %s is undefined\n", myname, s);
|
||||
done(1);
|
||||
}
|
||||
|
||||
|
||||
undefined_symbol_warning(s)
|
||||
char *s;
|
||||
undefined_symbol_warning(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: w - the symbol %s is undefined\n", myname, s);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ short *goto_map;
|
||||
short *from_state;
|
||||
short *to_state;
|
||||
|
||||
short **transpose();
|
||||
short **transpose(short int **R, int n);
|
||||
|
||||
static int infinity;
|
||||
static int maxrhs;
|
||||
@@ -43,7 +43,7 @@ static short *VERTICES;
|
||||
static int top;
|
||||
|
||||
|
||||
lalr()
|
||||
lalr(void)
|
||||
{
|
||||
tokensetsize = WORDSIZE(ntokens);
|
||||
|
||||
@@ -62,7 +62,7 @@ lalr()
|
||||
|
||||
|
||||
|
||||
set_state_table()
|
||||
set_state_table(void)
|
||||
{
|
||||
register core *sp;
|
||||
|
||||
@@ -73,7 +73,7 @@ set_state_table()
|
||||
|
||||
|
||||
|
||||
set_accessing_symbol()
|
||||
set_accessing_symbol(void)
|
||||
{
|
||||
register core *sp;
|
||||
|
||||
@@ -84,7 +84,7 @@ set_accessing_symbol()
|
||||
|
||||
|
||||
|
||||
set_shift_table()
|
||||
set_shift_table(void)
|
||||
{
|
||||
register shifts *sp;
|
||||
|
||||
@@ -95,7 +95,7 @@ set_shift_table()
|
||||
|
||||
|
||||
|
||||
set_reduction_table()
|
||||
set_reduction_table(void)
|
||||
{
|
||||
register reductions *rp;
|
||||
|
||||
@@ -106,7 +106,7 @@ set_reduction_table()
|
||||
|
||||
|
||||
|
||||
set_maxrhs()
|
||||
set_maxrhs(void)
|
||||
{
|
||||
register short *itemp;
|
||||
register short *item_end;
|
||||
@@ -134,7 +134,7 @@ set_maxrhs()
|
||||
|
||||
|
||||
|
||||
initialize_LA()
|
||||
initialize_LA(void)
|
||||
{
|
||||
register int i, j, k;
|
||||
register reductions *rp;
|
||||
@@ -171,7 +171,7 @@ initialize_LA()
|
||||
}
|
||||
|
||||
|
||||
set_goto_map()
|
||||
set_goto_map(void)
|
||||
{
|
||||
register shifts *sp;
|
||||
register int i;
|
||||
@@ -241,9 +241,7 @@ set_goto_map()
|
||||
/* Map_goto maps a state/symbol pair into its numeric representation. */
|
||||
|
||||
int
|
||||
map_goto(state, symbol)
|
||||
int state;
|
||||
int symbol;
|
||||
map_goto(int state, int symbol)
|
||||
{
|
||||
register int high;
|
||||
register int low;
|
||||
@@ -269,7 +267,7 @@ int symbol;
|
||||
|
||||
|
||||
|
||||
initialize_F()
|
||||
initialize_F(void)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
@@ -346,7 +344,7 @@ initialize_F()
|
||||
|
||||
|
||||
|
||||
build_relations()
|
||||
build_relations(void)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
@@ -438,8 +436,7 @@ build_relations()
|
||||
}
|
||||
|
||||
|
||||
add_lookback_edge(stateno, ruleno, gotono)
|
||||
int stateno, ruleno, gotono;
|
||||
add_lookback_edge(int stateno, int ruleno, int gotono)
|
||||
{
|
||||
register int i, k;
|
||||
register int found;
|
||||
@@ -466,9 +463,7 @@ int stateno, ruleno, gotono;
|
||||
|
||||
|
||||
short **
|
||||
transpose(R, n)
|
||||
short **R;
|
||||
int n;
|
||||
transpose(short int **R, int n)
|
||||
{
|
||||
register short **new_R;
|
||||
register short **temp_R;
|
||||
@@ -523,13 +518,13 @@ int n;
|
||||
|
||||
|
||||
|
||||
compute_FOLLOWS()
|
||||
compute_FOLLOWS(void)
|
||||
{
|
||||
digraph(includes);
|
||||
}
|
||||
|
||||
|
||||
compute_lookaheads()
|
||||
compute_lookaheads(void)
|
||||
{
|
||||
register int i, n;
|
||||
register unsigned *fp1, *fp2, *fp3;
|
||||
@@ -563,8 +558,7 @@ compute_lookaheads()
|
||||
}
|
||||
|
||||
|
||||
digraph(relation)
|
||||
short **relation;
|
||||
digraph(short int **relation)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -590,8 +584,7 @@ short **relation;
|
||||
|
||||
|
||||
|
||||
traverse(i)
|
||||
register int i;
|
||||
traverse(register int i)
|
||||
{
|
||||
register unsigned *fp1;
|
||||
register unsigned *fp2;
|
||||
|
||||
@@ -19,8 +19,8 @@ core *first_state;
|
||||
shifts *first_shift;
|
||||
reductions *first_reduction;
|
||||
|
||||
int get_state();
|
||||
core *new_state();
|
||||
int get_state(int symbol);
|
||||
core *new_state(int symbol);
|
||||
|
||||
static core **state_set;
|
||||
static core *this_state;
|
||||
@@ -38,8 +38,8 @@ static short **kernel_base;
|
||||
static short **kernel_end;
|
||||
static short *kernel_items;
|
||||
|
||||
|
||||
allocate_itemsets()
|
||||
void
|
||||
allocate_itemsets(void)
|
||||
{
|
||||
register short *itemp;
|
||||
register short *item_end;
|
||||
@@ -80,8 +80,8 @@ allocate_itemsets()
|
||||
kernel_end = NEW2(nsyms, short *);
|
||||
}
|
||||
|
||||
|
||||
allocate_storage()
|
||||
void
|
||||
allocate_storage(void)
|
||||
{
|
||||
allocate_itemsets();
|
||||
shiftset = NEW2(nsyms, short);
|
||||
@@ -89,8 +89,8 @@ allocate_storage()
|
||||
state_set = NEW2(nitems, core *);
|
||||
}
|
||||
|
||||
|
||||
append_states()
|
||||
void
|
||||
append_states(void)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
@@ -118,8 +118,8 @@ append_states()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
free_storage()
|
||||
void
|
||||
free_storage(void)
|
||||
{
|
||||
FREE(shift_symbol);
|
||||
FREE(redset);
|
||||
@@ -131,8 +131,8 @@ free_storage()
|
||||
}
|
||||
|
||||
|
||||
|
||||
generate_states()
|
||||
void
|
||||
generate_states(void)
|
||||
{
|
||||
allocate_storage();
|
||||
itemset = NEW2(nitems, short);
|
||||
@@ -160,8 +160,7 @@ generate_states()
|
||||
|
||||
|
||||
int
|
||||
get_state(symbol)
|
||||
int symbol;
|
||||
get_state(int symbol)
|
||||
{
|
||||
register int key;
|
||||
register short *isp1;
|
||||
@@ -223,8 +222,8 @@ int symbol;
|
||||
}
|
||||
|
||||
|
||||
|
||||
initialize_states()
|
||||
void
|
||||
initialize_states(void)
|
||||
{
|
||||
register int i;
|
||||
register short *start_derives;
|
||||
@@ -250,8 +249,8 @@ initialize_states()
|
||||
nstates = 1;
|
||||
}
|
||||
|
||||
|
||||
new_itemsets()
|
||||
void
|
||||
new_itemsets(void)
|
||||
{
|
||||
register int i;
|
||||
register int shiftcount;
|
||||
@@ -288,8 +287,7 @@ new_itemsets()
|
||||
|
||||
|
||||
core *
|
||||
new_state(symbol)
|
||||
int symbol;
|
||||
new_state(int symbol)
|
||||
{
|
||||
register int n;
|
||||
register core *p;
|
||||
@@ -327,8 +325,8 @@ int symbol;
|
||||
|
||||
|
||||
/* show_cores is used for debugging */
|
||||
|
||||
show_cores()
|
||||
void
|
||||
show_cores(void)
|
||||
{
|
||||
core *p;
|
||||
int i, j, k, n;
|
||||
@@ -362,8 +360,8 @@ show_cores()
|
||||
|
||||
|
||||
/* show_ritems is used for debugging */
|
||||
|
||||
show_ritems()
|
||||
void
|
||||
show_ritems(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -373,7 +371,8 @@ show_ritems()
|
||||
|
||||
|
||||
/* show_rrhs is used for debugging */
|
||||
show_rrhs()
|
||||
void
|
||||
show_rrhs(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -383,8 +382,8 @@ show_rrhs()
|
||||
|
||||
|
||||
/* show_shifts is used for debugging */
|
||||
|
||||
show_shifts()
|
||||
void
|
||||
show_shifts(void)
|
||||
{
|
||||
shifts *p;
|
||||
int i, j, k;
|
||||
@@ -401,8 +400,8 @@ show_shifts()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
save_shifts()
|
||||
void
|
||||
save_shifts(void)
|
||||
{
|
||||
register shifts *p;
|
||||
register short *sp1;
|
||||
@@ -435,8 +434,8 @@ save_shifts()
|
||||
}
|
||||
|
||||
|
||||
|
||||
save_reductions()
|
||||
void
|
||||
save_reductions(void)
|
||||
{
|
||||
register short *isp;
|
||||
register short *rp1;
|
||||
@@ -484,8 +483,8 @@ save_reductions()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
set_derives()
|
||||
void
|
||||
set_derives(void)
|
||||
{
|
||||
register int i, k;
|
||||
register int lhs;
|
||||
@@ -515,14 +514,16 @@ set_derives()
|
||||
#endif
|
||||
}
|
||||
|
||||
free_derives()
|
||||
void
|
||||
free_derives(void)
|
||||
{
|
||||
FREE(derives[start_symbol]);
|
||||
FREE(derives);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
print_derives()
|
||||
void
|
||||
print_derives(void)
|
||||
{
|
||||
register int i;
|
||||
register short *sp;
|
||||
@@ -543,8 +544,8 @@ print_derives()
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
set_nullable()
|
||||
void
|
||||
set_nullable(void)
|
||||
{
|
||||
register int i, j;
|
||||
register int empty;
|
||||
@@ -592,14 +593,14 @@ set_nullable()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
free_nullable()
|
||||
void
|
||||
free_nullable(void)
|
||||
{
|
||||
FREE(nullable);
|
||||
}
|
||||
|
||||
|
||||
lr0()
|
||||
void
|
||||
lr0(void)
|
||||
{
|
||||
set_derives();
|
||||
set_nullable();
|
||||
|
||||
@@ -64,12 +64,11 @@ char *rassoc;
|
||||
short **derives;
|
||||
char *nullable;
|
||||
|
||||
extern char *mktemp();
|
||||
extern char *getenv();
|
||||
extern char *mktemp(char *);
|
||||
extern char *getenv(const char *);
|
||||
|
||||
|
||||
done(k)
|
||||
int k;
|
||||
done(int k)
|
||||
{
|
||||
if (action_file) { fclose(action_file); }
|
||||
if (text_file) { fclose(text_file); }
|
||||
@@ -84,7 +83,7 @@ void onintr(int StupidInconsistantSignalTypes)
|
||||
}
|
||||
|
||||
|
||||
set_signals()
|
||||
set_signals(void)
|
||||
{
|
||||
#ifdef SIGINT
|
||||
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
|
||||
@@ -101,16 +100,14 @@ set_signals()
|
||||
}
|
||||
|
||||
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr, "usage: %s [-dlrtv] [-b file_prefix] [-p symbol_prefix] filename\n", myname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
getargs(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
getargs(int argc, char *argv[])
|
||||
{
|
||||
register int i;
|
||||
register char *s;
|
||||
@@ -216,8 +213,7 @@ no_more_options:;
|
||||
|
||||
|
||||
char *
|
||||
allocate(n)
|
||||
unsigned n;
|
||||
allocate(unsigned int n)
|
||||
{
|
||||
register char *p;
|
||||
|
||||
@@ -234,7 +230,7 @@ unsigned n;
|
||||
/*
|
||||
* joh - removed use TMPDIR variable by WIN32 here
|
||||
*/
|
||||
create_file_names()
|
||||
create_file_names(void)
|
||||
{
|
||||
int len;
|
||||
|
||||
@@ -277,7 +273,7 @@ create_file_names()
|
||||
}
|
||||
|
||||
|
||||
open_files()
|
||||
open_files(void)
|
||||
{
|
||||
create_file_names();
|
||||
|
||||
@@ -329,9 +325,7 @@ open_files()
|
||||
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
set_signals();
|
||||
getargs(argc, argv);
|
||||
|
||||
@@ -23,13 +23,13 @@ short final_state;
|
||||
static int SRcount;
|
||||
static int RRcount;
|
||||
|
||||
extern action *parse_actions();
|
||||
extern action *get_shifts();
|
||||
extern action *add_reductions();
|
||||
extern action *add_reduce();
|
||||
extern action *parse_actions(register int stateno);
|
||||
extern action *get_shifts(int stateno);
|
||||
extern action *add_reductions(int stateno, register action *actions);
|
||||
extern action *add_reduce(register action *actions, register int ruleno, register int symbol);
|
||||
|
||||
|
||||
make_parser()
|
||||
make_parser(void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -46,8 +46,7 @@ make_parser()
|
||||
|
||||
|
||||
action *
|
||||
parse_actions(stateno)
|
||||
register int stateno;
|
||||
parse_actions(register int stateno)
|
||||
{
|
||||
register action *actions;
|
||||
|
||||
@@ -58,8 +57,7 @@ register int stateno;
|
||||
|
||||
|
||||
action *
|
||||
get_shifts(stateno)
|
||||
int stateno;
|
||||
get_shifts(int stateno)
|
||||
{
|
||||
register action *actions, *temp;
|
||||
register shifts *sp;
|
||||
@@ -93,9 +91,7 @@ int stateno;
|
||||
}
|
||||
|
||||
action *
|
||||
add_reductions(stateno, actions)
|
||||
int stateno;
|
||||
register action *actions;
|
||||
add_reductions(int stateno, register action *actions)
|
||||
{
|
||||
register int i, j, m, n;
|
||||
register int ruleno, tokensetsize;
|
||||
@@ -119,9 +115,7 @@ register action *actions;
|
||||
|
||||
|
||||
action *
|
||||
add_reduce(actions, ruleno, symbol)
|
||||
register action *actions;
|
||||
register int ruleno, symbol;
|
||||
add_reduce(register action *actions, register int ruleno, register int symbol)
|
||||
{
|
||||
register action *temp, *prev, *next;
|
||||
|
||||
@@ -159,7 +153,7 @@ register int ruleno, symbol;
|
||||
}
|
||||
|
||||
|
||||
find_final_state()
|
||||
find_final_state(void)
|
||||
{
|
||||
register int goal, i;
|
||||
register short *to_state;
|
||||
@@ -176,7 +170,7 @@ find_final_state()
|
||||
}
|
||||
|
||||
|
||||
unused_rules()
|
||||
unused_rules(void)
|
||||
{
|
||||
register int i;
|
||||
register action *p;
|
||||
@@ -208,7 +202,7 @@ unused_rules()
|
||||
}
|
||||
|
||||
|
||||
remove_conflicts()
|
||||
remove_conflicts(void)
|
||||
{
|
||||
register int i;
|
||||
register int symbol;
|
||||
@@ -283,7 +277,7 @@ remove_conflicts()
|
||||
}
|
||||
|
||||
|
||||
total_conflicts()
|
||||
total_conflicts(void)
|
||||
{
|
||||
fprintf(stderr, "%s: ", myname);
|
||||
if (SRtotal == 1)
|
||||
@@ -304,8 +298,7 @@ total_conflicts()
|
||||
|
||||
|
||||
int
|
||||
sole_reduction(stateno)
|
||||
int stateno;
|
||||
sole_reduction(int stateno)
|
||||
{
|
||||
register int count, ruleno;
|
||||
register action *p;
|
||||
@@ -332,7 +325,7 @@ int stateno;
|
||||
}
|
||||
|
||||
|
||||
defreds()
|
||||
defreds(void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -341,8 +334,7 @@ defreds()
|
||||
defred[i] = sole_reduction(i);
|
||||
}
|
||||
|
||||
free_action_row(p)
|
||||
register action *p;
|
||||
free_action_row(register action *p)
|
||||
{
|
||||
register action *q;
|
||||
|
||||
@@ -354,7 +346,7 @@ register action *p;
|
||||
}
|
||||
}
|
||||
|
||||
free_parser()
|
||||
free_parser(void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ static int lowzero;
|
||||
static int high;
|
||||
|
||||
|
||||
output()
|
||||
output(void)
|
||||
{
|
||||
free_itemsets();
|
||||
free_shifts();
|
||||
@@ -49,7 +49,7 @@ output()
|
||||
}
|
||||
|
||||
|
||||
output_prefix()
|
||||
output_prefix(void)
|
||||
{
|
||||
if (symbol_prefix == NULL)
|
||||
symbol_prefix = "yy";
|
||||
@@ -109,7 +109,7 @@ output_prefix()
|
||||
}
|
||||
|
||||
|
||||
output_rule_data()
|
||||
output_rule_data(void)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
@@ -156,7 +156,7 @@ output_rule_data()
|
||||
}
|
||||
|
||||
|
||||
output_yydefred()
|
||||
output_yydefred(void)
|
||||
{
|
||||
register int i, j;
|
||||
|
||||
@@ -183,7 +183,7 @@ output_yydefred()
|
||||
}
|
||||
|
||||
|
||||
output_actions()
|
||||
output_actions(void)
|
||||
{
|
||||
nvectors = 2*nstates + nvars;
|
||||
|
||||
@@ -211,7 +211,7 @@ output_actions()
|
||||
}
|
||||
|
||||
|
||||
token_actions()
|
||||
token_actions(void)
|
||||
{
|
||||
register int i, j;
|
||||
register int shiftcount, reducecount;
|
||||
@@ -295,7 +295,7 @@ token_actions()
|
||||
FREE(actionrow);
|
||||
}
|
||||
|
||||
goto_actions()
|
||||
goto_actions(void)
|
||||
{
|
||||
register int i, j, k;
|
||||
|
||||
@@ -328,8 +328,7 @@ goto_actions()
|
||||
}
|
||||
|
||||
int
|
||||
default_goto(symbol)
|
||||
int symbol;
|
||||
default_goto(int symbol)
|
||||
{
|
||||
register int i;
|
||||
register int m;
|
||||
@@ -364,9 +363,7 @@ int symbol;
|
||||
|
||||
|
||||
|
||||
save_column(symbol, default_state)
|
||||
int symbol;
|
||||
int default_state;
|
||||
save_column(int symbol, int default_state)
|
||||
{
|
||||
register int i;
|
||||
register int m;
|
||||
@@ -407,7 +404,7 @@ int default_state;
|
||||
return(0);
|
||||
}
|
||||
|
||||
sort_actions()
|
||||
sort_actions(void)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
@@ -442,7 +439,7 @@ sort_actions()
|
||||
}
|
||||
|
||||
|
||||
pack_table()
|
||||
pack_table(void)
|
||||
{
|
||||
register int i;
|
||||
register int place;
|
||||
@@ -505,8 +502,7 @@ pack_table()
|
||||
/* order. */
|
||||
|
||||
int
|
||||
matching_vector(vector)
|
||||
int vector;
|
||||
matching_vector(int vector)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
@@ -546,8 +542,7 @@ int vector;
|
||||
|
||||
|
||||
int
|
||||
pack_vector(vector)
|
||||
int vector;
|
||||
pack_vector(int vector)
|
||||
{
|
||||
register int i, j, k, l;
|
||||
register int t;
|
||||
@@ -623,7 +618,7 @@ int vector;
|
||||
|
||||
|
||||
|
||||
output_base()
|
||||
output_base(void)
|
||||
{
|
||||
register int i, j;
|
||||
|
||||
@@ -689,7 +684,7 @@ output_base()
|
||||
|
||||
|
||||
|
||||
output_table()
|
||||
output_table(void)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
@@ -721,7 +716,7 @@ output_table()
|
||||
|
||||
|
||||
|
||||
output_check()
|
||||
output_check(void)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
@@ -751,8 +746,7 @@ output_check()
|
||||
|
||||
|
||||
int
|
||||
is_C_identifier(name)
|
||||
char *name;
|
||||
is_C_identifier(char *name)
|
||||
{
|
||||
register char *s;
|
||||
register int c;
|
||||
@@ -783,7 +777,7 @@ char *name;
|
||||
}
|
||||
|
||||
|
||||
output_defines()
|
||||
output_defines(void)
|
||||
{
|
||||
register int c, i;
|
||||
register char *s;
|
||||
@@ -833,7 +827,7 @@ output_defines()
|
||||
}
|
||||
|
||||
|
||||
output_stored_text()
|
||||
output_stored_text(void)
|
||||
{
|
||||
register int c;
|
||||
register FILE *in, *out;
|
||||
@@ -859,7 +853,7 @@ output_stored_text()
|
||||
}
|
||||
|
||||
|
||||
output_debug()
|
||||
output_debug(void)
|
||||
{
|
||||
register int i, j, k, max;
|
||||
char **symnam, *s;
|
||||
@@ -1073,7 +1067,7 @@ output_debug()
|
||||
}
|
||||
|
||||
|
||||
output_stype()
|
||||
output_stype(void)
|
||||
{
|
||||
if (!unionized && ntags == 0)
|
||||
{
|
||||
@@ -1083,7 +1077,7 @@ output_stype()
|
||||
}
|
||||
|
||||
|
||||
output_trailing_text()
|
||||
output_trailing_text(void)
|
||||
{
|
||||
register int c, last;
|
||||
register FILE *in, *out;
|
||||
@@ -1142,7 +1136,7 @@ output_trailing_text()
|
||||
}
|
||||
|
||||
|
||||
output_semantic_actions()
|
||||
output_semantic_actions(void)
|
||||
{
|
||||
register int c, last;
|
||||
register FILE *out;
|
||||
@@ -1178,7 +1172,7 @@ output_semantic_actions()
|
||||
}
|
||||
|
||||
|
||||
free_itemsets()
|
||||
free_itemsets(void)
|
||||
{
|
||||
register core *cp, *next;
|
||||
|
||||
@@ -1191,7 +1185,7 @@ free_itemsets()
|
||||
}
|
||||
|
||||
|
||||
free_shifts()
|
||||
free_shifts(void)
|
||||
{
|
||||
register shifts *sp, *next;
|
||||
|
||||
@@ -1205,7 +1199,7 @@ free_shifts()
|
||||
|
||||
|
||||
|
||||
free_reductions()
|
||||
free_reductions(void)
|
||||
{
|
||||
register reductions *rp, *next;
|
||||
|
||||
|
||||
@@ -43,8 +43,7 @@ char *name_pool;
|
||||
char line_format[] = "#line %d \"%s\"\n";
|
||||
|
||||
|
||||
cachec(c)
|
||||
int c;
|
||||
cachec(int c)
|
||||
{
|
||||
assert(cinc >= 0);
|
||||
if (cinc >= cache_size)
|
||||
@@ -58,7 +57,7 @@ int c;
|
||||
}
|
||||
|
||||
|
||||
get_line()
|
||||
get_line(void)
|
||||
{
|
||||
register FILE *f = input_file;
|
||||
register int c;
|
||||
@@ -105,7 +104,7 @@ get_line()
|
||||
|
||||
|
||||
char *
|
||||
dup_line()
|
||||
dup_line(void)
|
||||
{
|
||||
register char *p, *s, *t;
|
||||
|
||||
@@ -122,7 +121,7 @@ dup_line()
|
||||
}
|
||||
|
||||
|
||||
skip_comment()
|
||||
skip_comment(void)
|
||||
{
|
||||
register char *s;
|
||||
|
||||
@@ -153,7 +152,7 @@ skip_comment()
|
||||
|
||||
|
||||
int
|
||||
nextc()
|
||||
nextc(void)
|
||||
{
|
||||
register char *s;
|
||||
|
||||
@@ -215,7 +214,7 @@ nextc()
|
||||
|
||||
|
||||
int
|
||||
keyword()
|
||||
keyword(void)
|
||||
{
|
||||
register int c;
|
||||
char *t_cptr = cptr;
|
||||
@@ -277,7 +276,7 @@ keyword()
|
||||
}
|
||||
|
||||
|
||||
copy_ident()
|
||||
copy_ident(void)
|
||||
{
|
||||
register int c;
|
||||
register FILE *f = output_file;
|
||||
@@ -306,7 +305,7 @@ copy_ident()
|
||||
}
|
||||
|
||||
|
||||
copy_text()
|
||||
copy_text(void)
|
||||
{
|
||||
register int c;
|
||||
int quote;
|
||||
@@ -437,7 +436,7 @@ loop:
|
||||
}
|
||||
|
||||
|
||||
copy_union()
|
||||
copy_union(void)
|
||||
{
|
||||
register int c;
|
||||
int quote;
|
||||
@@ -578,8 +577,7 @@ loop:
|
||||
|
||||
|
||||
int
|
||||
hexval(c)
|
||||
int c;
|
||||
hexval(int c)
|
||||
{
|
||||
if (c >= '0' && c <= '9')
|
||||
return (c - '0');
|
||||
@@ -592,7 +590,7 @@ int c;
|
||||
|
||||
|
||||
bucket *
|
||||
get_literal()
|
||||
get_literal(void)
|
||||
{
|
||||
register int c, quote;
|
||||
register int i;
|
||||
@@ -731,8 +729,7 @@ get_literal()
|
||||
|
||||
|
||||
int
|
||||
is_reserved(name)
|
||||
char *name;
|
||||
is_reserved(char *name)
|
||||
{
|
||||
char *s;
|
||||
|
||||
@@ -753,7 +750,7 @@ char *name;
|
||||
|
||||
|
||||
bucket *
|
||||
get_name()
|
||||
get_name(void)
|
||||
{
|
||||
register int c;
|
||||
|
||||
@@ -769,7 +766,7 @@ get_name()
|
||||
|
||||
|
||||
int
|
||||
get_number()
|
||||
get_number(void)
|
||||
{
|
||||
register int c;
|
||||
register int n;
|
||||
@@ -783,7 +780,7 @@ get_number()
|
||||
|
||||
|
||||
char *
|
||||
get_tag()
|
||||
get_tag(void)
|
||||
{
|
||||
register int c;
|
||||
register int i;
|
||||
@@ -833,8 +830,7 @@ get_tag()
|
||||
}
|
||||
|
||||
|
||||
declare_tokens(assoc)
|
||||
int assoc;
|
||||
declare_tokens(int assoc)
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
@@ -895,7 +891,7 @@ int assoc;
|
||||
}
|
||||
|
||||
|
||||
declare_types()
|
||||
declare_types(void)
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
@@ -923,7 +919,7 @@ declare_types()
|
||||
}
|
||||
|
||||
|
||||
declare_start()
|
||||
declare_start(void)
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
@@ -941,7 +937,7 @@ declare_start()
|
||||
}
|
||||
|
||||
|
||||
read_declarations()
|
||||
read_declarations(void)
|
||||
{
|
||||
register int c, k;
|
||||
|
||||
@@ -990,7 +986,7 @@ read_declarations()
|
||||
}
|
||||
|
||||
|
||||
initialize_grammar()
|
||||
initialize_grammar(void)
|
||||
{
|
||||
nitems = 4;
|
||||
maxitems = 300;
|
||||
@@ -1021,7 +1017,7 @@ initialize_grammar()
|
||||
}
|
||||
|
||||
|
||||
expand_items()
|
||||
expand_items(void)
|
||||
{
|
||||
maxitems += 300;
|
||||
pitem = (bucket **) REALLOC(pitem, maxitems*sizeof(bucket *));
|
||||
@@ -1029,7 +1025,7 @@ expand_items()
|
||||
}
|
||||
|
||||
|
||||
expand_rules()
|
||||
expand_rules(void)
|
||||
{
|
||||
maxrules += 100;
|
||||
plhs = (bucket **) REALLOC(plhs, maxrules*sizeof(bucket *));
|
||||
@@ -1041,7 +1037,7 @@ expand_rules()
|
||||
}
|
||||
|
||||
|
||||
advance_to_start()
|
||||
advance_to_start(void)
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
@@ -1091,9 +1087,7 @@ advance_to_start()
|
||||
}
|
||||
|
||||
|
||||
start_rule(bp, s_lineno)
|
||||
register bucket *bp;
|
||||
int s_lineno;
|
||||
start_rule(register bucket *bp, int s_lineno)
|
||||
{
|
||||
if (bp->class == TERM)
|
||||
terminal_lhs(s_lineno);
|
||||
@@ -1106,7 +1100,7 @@ int s_lineno;
|
||||
}
|
||||
|
||||
|
||||
end_rule()
|
||||
end_rule(void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -1125,7 +1119,7 @@ end_rule()
|
||||
}
|
||||
|
||||
|
||||
insert_empty_rule()
|
||||
insert_empty_rule(void)
|
||||
{
|
||||
register bucket *bp, **bpp;
|
||||
|
||||
@@ -1154,7 +1148,7 @@ insert_empty_rule()
|
||||
}
|
||||
|
||||
|
||||
add_symbol()
|
||||
add_symbol(void)
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
@@ -1185,7 +1179,7 @@ add_symbol()
|
||||
}
|
||||
|
||||
|
||||
copy_action()
|
||||
copy_action(void)
|
||||
{
|
||||
register int c;
|
||||
register int i, n;
|
||||
@@ -1409,7 +1403,7 @@ loop:
|
||||
|
||||
|
||||
int
|
||||
mark_symbol()
|
||||
mark_symbol(void)
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
@@ -1452,7 +1446,7 @@ mark_symbol()
|
||||
}
|
||||
|
||||
|
||||
read_grammar()
|
||||
read_grammar(void)
|
||||
{
|
||||
register int c;
|
||||
|
||||
@@ -1485,7 +1479,7 @@ read_grammar()
|
||||
}
|
||||
|
||||
|
||||
free_tags()
|
||||
free_tags(void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -1501,7 +1495,7 @@ free_tags()
|
||||
}
|
||||
|
||||
|
||||
pack_names()
|
||||
pack_names(void)
|
||||
{
|
||||
register bucket *bp;
|
||||
register char *p, *s, *t;
|
||||
@@ -1526,7 +1520,7 @@ pack_names()
|
||||
}
|
||||
|
||||
|
||||
check_symbols()
|
||||
check_symbols(void)
|
||||
{
|
||||
register bucket *bp;
|
||||
|
||||
@@ -1544,7 +1538,7 @@ check_symbols()
|
||||
}
|
||||
|
||||
|
||||
pack_symbols()
|
||||
pack_symbols(void)
|
||||
{
|
||||
register bucket *bp;
|
||||
register bucket **v;
|
||||
@@ -1668,7 +1662,7 @@ pack_symbols()
|
||||
}
|
||||
|
||||
|
||||
pack_grammar()
|
||||
pack_grammar(void)
|
||||
{
|
||||
register int i, j;
|
||||
int assoc, prec;
|
||||
@@ -1727,7 +1721,7 @@ pack_grammar()
|
||||
}
|
||||
|
||||
|
||||
print_grammar()
|
||||
print_grammar(void)
|
||||
{
|
||||
register int i, j, k;
|
||||
int spacing;
|
||||
@@ -1764,7 +1758,7 @@ print_grammar()
|
||||
}
|
||||
|
||||
|
||||
reader()
|
||||
reader(void)
|
||||
{
|
||||
write_section(banner);
|
||||
create_symbol_table();
|
||||
|
||||
@@ -29,11 +29,7 @@ char *banner[] =
|
||||
"#define yyclearin (yychar=(-1))",
|
||||
"#define yyerrok (yyerrflag=0)",
|
||||
"#define YYRECOVERING (yyerrflag!=0)",
|
||||
"#ifdef __STDC__", /* JRW */
|
||||
"static int yyparse(void);",/* JRW */
|
||||
"#else", /* JRW */
|
||||
"static int yyparse();", /* JRW */
|
||||
"#endif", /* JRW */
|
||||
0
|
||||
};
|
||||
|
||||
@@ -93,13 +89,8 @@ char *body[] =
|
||||
"#define YYREJECT goto yyabort",
|
||||
"#define YYACCEPT goto yyaccept",
|
||||
"#define YYERROR goto yyerrlab",
|
||||
"#ifdef __STDC__", /* JRW */
|
||||
"static int", /* JRW */
|
||||
"yyparse(void)", /* JRW */
|
||||
"#else", /* JRW */
|
||||
"static int", /* JRW */
|
||||
"yyparse()", /* JRW */
|
||||
"#endif", /* JRW */
|
||||
"{",
|
||||
" register int yym, yyn, yystate;",
|
||||
"#if YYDEBUG",
|
||||
@@ -294,8 +285,7 @@ char *trailer[] =
|
||||
};
|
||||
|
||||
|
||||
write_section(section)
|
||||
char *section[];
|
||||
write_section(char *section[])
|
||||
{
|
||||
register int c;
|
||||
register int i;
|
||||
|
||||
@@ -22,8 +22,7 @@ bucket *last_symbol;
|
||||
|
||||
|
||||
int
|
||||
hash(name)
|
||||
char *name;
|
||||
hash(char *name)
|
||||
{
|
||||
register char *s;
|
||||
register int c, k;
|
||||
@@ -39,8 +38,7 @@ char *name;
|
||||
|
||||
|
||||
bucket *
|
||||
make_bucket(name)
|
||||
char *name;
|
||||
make_bucket(char *name)
|
||||
{
|
||||
register bucket *bp;
|
||||
|
||||
@@ -66,8 +64,7 @@ char *name;
|
||||
|
||||
|
||||
bucket *
|
||||
lookup(name)
|
||||
char *name;
|
||||
lookup(char *name)
|
||||
{
|
||||
register bucket *bp, **bpp;
|
||||
|
||||
@@ -89,7 +86,7 @@ char *name;
|
||||
}
|
||||
|
||||
|
||||
create_symbol_table()
|
||||
create_symbol_table(void)
|
||||
{
|
||||
register int i;
|
||||
register bucket *bp;
|
||||
@@ -109,14 +106,14 @@ create_symbol_table()
|
||||
}
|
||||
|
||||
|
||||
free_symbol_table()
|
||||
free_symbol_table(void)
|
||||
{
|
||||
FREE(symbol_table);
|
||||
symbol_table = 0;
|
||||
}
|
||||
|
||||
|
||||
free_symbols()
|
||||
free_symbols(void)
|
||||
{
|
||||
register bucket *p, *q;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
static short *null_rules;
|
||||
|
||||
verbose()
|
||||
verbose(void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -38,7 +38,7 @@ verbose()
|
||||
}
|
||||
|
||||
|
||||
log_unused()
|
||||
log_unused(void)
|
||||
{
|
||||
register int i;
|
||||
register short *p;
|
||||
@@ -57,7 +57,7 @@ log_unused()
|
||||
}
|
||||
|
||||
|
||||
log_conflicts()
|
||||
log_conflicts(void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -85,8 +85,7 @@ log_conflicts()
|
||||
}
|
||||
|
||||
|
||||
print_state(state)
|
||||
int state;
|
||||
print_state(int state)
|
||||
{
|
||||
if (state)
|
||||
fprintf(verbose_file, "\n\n");
|
||||
@@ -99,8 +98,7 @@ int state;
|
||||
}
|
||||
|
||||
|
||||
print_conflicts(state)
|
||||
int state;
|
||||
print_conflicts(int state)
|
||||
{
|
||||
register int symbol, act, number;
|
||||
register action *p;
|
||||
@@ -147,8 +145,7 @@ int state;
|
||||
}
|
||||
|
||||
|
||||
print_core(state)
|
||||
int state;
|
||||
print_core(int state)
|
||||
{
|
||||
register int i;
|
||||
register int k;
|
||||
@@ -183,8 +180,7 @@ int state;
|
||||
}
|
||||
|
||||
|
||||
print_nulls(state)
|
||||
int state;
|
||||
print_nulls(int state)
|
||||
{
|
||||
register action *p;
|
||||
register int i, j, k, nnulls;
|
||||
@@ -227,8 +223,7 @@ int state;
|
||||
}
|
||||
|
||||
|
||||
print_actions(stateno)
|
||||
int stateno;
|
||||
print_actions(int stateno)
|
||||
{
|
||||
register action *p;
|
||||
register shifts *sp;
|
||||
@@ -254,8 +249,7 @@ int stateno;
|
||||
}
|
||||
|
||||
|
||||
print_shifts(p)
|
||||
register action *p;
|
||||
print_shifts(register action *p)
|
||||
{
|
||||
register int count;
|
||||
register action *q;
|
||||
@@ -279,9 +273,7 @@ register action *p;
|
||||
}
|
||||
|
||||
|
||||
print_reductions(p, defred)
|
||||
register action *p;
|
||||
register int defred;
|
||||
print_reductions(register action *p, register int defred)
|
||||
{
|
||||
register int k, anyreds;
|
||||
register action *q;
|
||||
@@ -317,8 +309,7 @@ register int defred;
|
||||
}
|
||||
|
||||
|
||||
print_gotos(stateno)
|
||||
int stateno;
|
||||
print_gotos(int stateno)
|
||||
{
|
||||
register int i, k;
|
||||
register int as;
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
\*************************************************************************/
|
||||
#include "defs.h"
|
||||
|
||||
transitive_closure(R, n)
|
||||
unsigned *R;
|
||||
int n;
|
||||
transitive_closure(unsigned int *R, int n)
|
||||
{
|
||||
register int rowsize;
|
||||
register unsigned i;
|
||||
@@ -61,9 +59,7 @@ int n;
|
||||
}
|
||||
}
|
||||
|
||||
reflexive_transitive_closure(R, n)
|
||||
unsigned *R;
|
||||
int n;
|
||||
reflexive_transitive_closure(unsigned int *R, int n)
|
||||
{
|
||||
register int rowsize;
|
||||
register unsigned i;
|
||||
|
||||
@@ -50,11 +50,8 @@ static char rcsid[] =
|
||||
* ccladd( cclp, ch );
|
||||
*/
|
||||
|
||||
void ccladd( cclp, ch )
|
||||
int cclp;
|
||||
int ch;
|
||||
|
||||
{
|
||||
void ccladd(int cclp, int ch)
|
||||
{
|
||||
int ind, len, newpos, i;
|
||||
|
||||
len = ccllen[cclp];
|
||||
@@ -89,9 +86,8 @@ int ch;
|
||||
* new_ccl = cclinit();
|
||||
*/
|
||||
|
||||
int cclinit()
|
||||
|
||||
{
|
||||
int cclinit(void)
|
||||
{
|
||||
if ( ++lastccl >= current_maxccls )
|
||||
{
|
||||
current_maxccls += MAX_CCLS_INCREMENT;
|
||||
@@ -129,10 +125,8 @@ int cclinit()
|
||||
* cclnegate( ccl );
|
||||
*/
|
||||
|
||||
void cclnegate( cclp )
|
||||
int cclp;
|
||||
|
||||
{
|
||||
void cclnegate(int cclp)
|
||||
{
|
||||
cclng[cclp] = 1;
|
||||
}
|
||||
|
||||
@@ -149,11 +143,8 @@ int cclp;
|
||||
* has a non-zero value in the set array.
|
||||
*/
|
||||
|
||||
void list_character_set( file, cset )
|
||||
FILE *file;
|
||||
int cset[];
|
||||
|
||||
{
|
||||
void list_character_set(FILE *file, int cset[])
|
||||
{
|
||||
register int i;
|
||||
char *readable_form();
|
||||
|
||||
|
||||
@@ -45,10 +45,10 @@ static char rcsid[] =
|
||||
|
||||
/* declare functions that have forward references */
|
||||
|
||||
void dump_associated_rules PROTO((FILE*, int));
|
||||
void dump_transitions PROTO((FILE*, int[]));
|
||||
void sympartition PROTO((int[], int, int[], int[]));
|
||||
int symfollowset PROTO((int[], int, int, int[]));
|
||||
void dump_associated_rules (FILE*, int);
|
||||
void dump_transitions (FILE*, int[]);
|
||||
void sympartition (int[], int, int[], int[]);
|
||||
int symfollowset (int[], int, int, int[]);
|
||||
|
||||
|
||||
/* check_for_backtracking - check a DFA state for backtracking
|
||||
@@ -62,11 +62,8 @@ int symfollowset PROTO((int[], int, int, int[]));
|
||||
* associated with this state
|
||||
*/
|
||||
|
||||
void check_for_backtracking( ds, state )
|
||||
int ds;
|
||||
int state[];
|
||||
|
||||
{
|
||||
void check_for_backtracking(int ds, int state[])
|
||||
{
|
||||
if ( (reject && ! dfaacc[ds].dfaacc_set) || ! dfaacc[ds].dfaacc_state )
|
||||
{ /* state is non-accepting */
|
||||
++num_backtracking;
|
||||
@@ -109,12 +106,8 @@ int state[];
|
||||
* accset[1 .. nacc] is the list of accepting numbers for the DFA state.
|
||||
*/
|
||||
|
||||
void check_trailing_context( nfa_states, num_states, accset, nacc )
|
||||
int *nfa_states, num_states;
|
||||
int *accset;
|
||||
register int nacc;
|
||||
|
||||
{
|
||||
void check_trailing_context(int *nfa_states, int num_states, int *accset, register int nacc)
|
||||
{
|
||||
register int i, j;
|
||||
|
||||
for ( i = 1; i <= num_states; ++i )
|
||||
@@ -159,11 +152,8 @@ register int nacc;
|
||||
* and writes a report to the given file
|
||||
*/
|
||||
|
||||
void dump_associated_rules( file, ds )
|
||||
FILE *file;
|
||||
int ds;
|
||||
|
||||
{
|
||||
void dump_associated_rules(FILE *file, int ds)
|
||||
{
|
||||
register int i, j;
|
||||
register int num_associated_rules = 0;
|
||||
int rule_set[MAX_ASSOC_RULES + 1];
|
||||
@@ -214,11 +204,8 @@ int ds;
|
||||
* is done to the given file.
|
||||
*/
|
||||
|
||||
void dump_transitions( file, state )
|
||||
FILE *file;
|
||||
int state[];
|
||||
|
||||
{
|
||||
void dump_transitions(FILE *file, int state[])
|
||||
{
|
||||
register int i, ec;
|
||||
int out_char_set[CSIZE];
|
||||
|
||||
@@ -265,10 +252,8 @@ int state[];
|
||||
* hashval is the hash value for the dfa corresponding to the state set
|
||||
*/
|
||||
|
||||
int *epsclosure( t, ns_addr, accset, nacc_addr, hv_addr )
|
||||
int *t, *ns_addr, accset[], *nacc_addr, *hv_addr;
|
||||
|
||||
{
|
||||
int *epsclosure(int *t, int *ns_addr, int accset[], int *nacc_addr, int *hv_addr)
|
||||
{
|
||||
register int stkpos, ns, tsp;
|
||||
int numstates = *ns_addr, nacc, hashval, transsym, nfaccnum;
|
||||
int stkend, nstate;
|
||||
@@ -388,9 +373,8 @@ int *t, *ns_addr, accset[], *nacc_addr, *hv_addr;
|
||||
|
||||
/* increase_max_dfas - increase the maximum number of DFAs */
|
||||
|
||||
void increase_max_dfas()
|
||||
|
||||
{
|
||||
void increase_max_dfas(void)
|
||||
{
|
||||
current_max_dfas += MAX_DFAS_INCREMENT;
|
||||
|
||||
++num_reallocs;
|
||||
@@ -417,15 +401,16 @@ void increase_max_dfas()
|
||||
* dfa starts out in state #1.
|
||||
*/
|
||||
|
||||
void ntod()
|
||||
|
||||
{
|
||||
void ntod(void)
|
||||
{
|
||||
int *accset, ds, nacc, newds;
|
||||
int sym, hashval, numstates, dsize;
|
||||
int num_full_table_rows; /* used only for -f */
|
||||
int *nset, *dset;
|
||||
int targptr, totaltrans, i, comstate, comfreq, targ;
|
||||
int *epsclosure(), snstods(), symlist[CSIZE + 1];
|
||||
int *epsclosure(int *t, int *ns_addr, int *accset, int *nacc_addr, int *hv_addr);
|
||||
int snstods(int *sns, int numstates, int *accset, int nacc, int hashval, int *newds_addr);
|
||||
int symlist[CSIZE + 1];
|
||||
int num_start_states;
|
||||
int todo_head, todo_next;
|
||||
|
||||
@@ -781,10 +766,8 @@ void ntod()
|
||||
* on return, the dfa state number is in newds.
|
||||
*/
|
||||
|
||||
int snstods( sns, numstates, accset, nacc, hashval, newds_addr )
|
||||
int sns[], numstates, accset[], nacc, hashval, *newds_addr;
|
||||
|
||||
{
|
||||
int snstods(int sns[], int numstates, int accset[], int nacc, int hashval, int *newds_addr)
|
||||
{
|
||||
int didsort = 0;
|
||||
register int i, j;
|
||||
int newds, *oldsns;
|
||||
@@ -907,10 +890,8 @@ int sns[], numstates, accset[], nacc, hashval, *newds_addr;
|
||||
* numstates = symfollowset( ds, dsize, transsym, nset );
|
||||
*/
|
||||
|
||||
int symfollowset( ds, dsize, transsym, nset )
|
||||
int ds[], dsize, transsym, nset[];
|
||||
|
||||
{
|
||||
int symfollowset(int ds[], int dsize, int transsym, int nset[])
|
||||
{
|
||||
int ns, tsp, sym, i, j, lenccl, ch, numstates;
|
||||
int ccllist;
|
||||
|
||||
@@ -993,11 +974,8 @@ bottom:
|
||||
* sympartition( ds, numstates, symlist, duplist );
|
||||
*/
|
||||
|
||||
void sympartition( ds, numstates, symlist, duplist )
|
||||
int ds[], numstates, duplist[];
|
||||
int symlist[];
|
||||
|
||||
{
|
||||
void sympartition(int ds[], int numstates, int symlist[], int duplist[])
|
||||
{
|
||||
int tch, i, j, k, ns, dupfwd[CSIZE + 1], lenccl, cclp, ich;
|
||||
|
||||
/* partitioning is done by creating equivalence classes for those
|
||||
|
||||
@@ -48,9 +48,8 @@ static char rcsid[] =
|
||||
* ccl2ecl();
|
||||
*/
|
||||
|
||||
void ccl2ecl()
|
||||
|
||||
{
|
||||
void ccl2ecl(void)
|
||||
{
|
||||
int i, ich, newlen, cclp, ccls, cclmec;
|
||||
|
||||
for ( i = 1; i <= lastccl; ++i )
|
||||
@@ -119,10 +118,8 @@ void ccl2ecl()
|
||||
* Returned is the number of classes.
|
||||
*/
|
||||
|
||||
int cre8ecs( fwd, bck, num )
|
||||
int fwd[], bck[], num;
|
||||
|
||||
{
|
||||
int cre8ecs(int fwd[], int bck[], int num)
|
||||
{
|
||||
int i, j, numcl;
|
||||
|
||||
numcl = 0;
|
||||
@@ -156,10 +153,8 @@ int fwd[], bck[], num;
|
||||
* Returns the number of equivalence classes used.
|
||||
*/
|
||||
|
||||
int ecs_from_xlation( ecmap )
|
||||
int ecmap[];
|
||||
|
||||
{
|
||||
int ecs_from_xlation(int ecmap[])
|
||||
{
|
||||
int i;
|
||||
int nul_is_alone = false;
|
||||
int did_default_xlation_class = false;
|
||||
@@ -240,11 +235,8 @@ int ecmap[];
|
||||
* NUL_mapping is the value which NUL (0) should be mapped to.
|
||||
*/
|
||||
|
||||
void mkeccl( ccls, lenccl, fwd, bck, llsiz, NUL_mapping )
|
||||
Char ccls[];
|
||||
int lenccl, fwd[], bck[], llsiz, NUL_mapping;
|
||||
|
||||
{
|
||||
void mkeccl(unsigned char ccls[], int lenccl, int fwd[], int bck[], int llsiz, int NUL_mapping)
|
||||
{
|
||||
int cclp, oldec, newec;
|
||||
int cclm, i, j;
|
||||
static unsigned char cclflags[CSIZE]; /* initialized to all '\0' */
|
||||
@@ -339,10 +331,8 @@ next_pt:
|
||||
* mkechar( tch, fwd, bck );
|
||||
*/
|
||||
|
||||
void mkechar( tch, fwd, bck )
|
||||
int tch, fwd[], bck[];
|
||||
|
||||
{
|
||||
void mkechar(int tch, int fwd[], int bck[])
|
||||
{
|
||||
/* if until now the character has been a proper subset of
|
||||
* an equivalence class, break it away to create a new ec
|
||||
*/
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <osfcn.h>
|
||||
|
||||
/* use prototypes in function declarations */
|
||||
#define YY_USE_PROTOS
|
||||
|
||||
/* the "const" storage-class-modifier is valid */
|
||||
#define YY_USE_CONST
|
||||
|
||||
@@ -40,7 +37,6 @@ void free( void* );
|
||||
#include <stdlib.h>
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#define YY_USE_PROTOS
|
||||
#define YY_USE_CONST
|
||||
|
||||
#endif /* __STDC__ */
|
||||
@@ -57,20 +53,6 @@ void free( void* );
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
#define YY_PROTO(proto) proto
|
||||
#else
|
||||
#define YY_PROTO(proto) ()
|
||||
/* we can't get here if it's an ANSI C compiler, or a C++ compiler,
|
||||
* so it's got to be a K&R compiler, and therefore there's no standard
|
||||
* place from which to include these definitions
|
||||
*/
|
||||
char *malloc();
|
||||
int free();
|
||||
int read();
|
||||
#endif
|
||||
|
||||
|
||||
/* amount of stuff to slurp up with each read */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
@@ -150,7 +132,7 @@ int read();
|
||||
/* default declaration of generated scanner - a define so the user can
|
||||
* easily add parameters
|
||||
*/
|
||||
#define YY_DECL int yylex YY_PROTO(( void ))
|
||||
#define YY_DECL int yylex ( void )
|
||||
|
||||
/* code executed at the end of each rule */
|
||||
#define YY_BREAK break;
|
||||
@@ -263,23 +245,23 @@ static int yy_start = 0; /* start state number */
|
||||
*/
|
||||
static int yy_did_buffer_switch_on_eof;
|
||||
|
||||
static yy_state_type yy_get_previous_state YY_PROTO(( void ));
|
||||
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
|
||||
static int yy_get_next_buffer YY_PROTO(( void ));
|
||||
static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
|
||||
void yyrestart YY_PROTO(( FILE *input_file ));
|
||||
void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
|
||||
void yy_load_buffer_state YY_PROTO(( void ));
|
||||
YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
|
||||
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
|
||||
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
|
||||
static yy_state_type yy_get_previous_state ( void );
|
||||
static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
|
||||
static int yy_get_next_buffer ( void );
|
||||
static void yyunput ( YY_CHAR c, YY_CHAR *buf_ptr );
|
||||
void yyrestart ( FILE *input_file );
|
||||
void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
|
||||
void yy_load_buffer_state ( void );
|
||||
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
|
||||
void yy_delete_buffer ( YY_BUFFER_STATE b );
|
||||
void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
|
||||
|
||||
#define yy_new_buffer yy_create_buffer
|
||||
|
||||
#ifdef __cplusplus
|
||||
static int yyinput YY_PROTO(( void ));
|
||||
static int yyinput ( void );
|
||||
#else
|
||||
static int input YY_PROTO(( void ));
|
||||
static int input ( void );
|
||||
#endif
|
||||
|
||||
YY_DECL
|
||||
@@ -571,13 +553,7 @@ static yy_state_type yy_get_previous_state()
|
||||
* next_state = yy_try_NUL_trans( current_state );
|
||||
*/
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
|
||||
#else
|
||||
static yy_state_type yy_try_NUL_trans( yy_current_state )
|
||||
register yy_state_type yy_current_state;
|
||||
#endif
|
||||
|
||||
{
|
||||
register int yy_is_jam;
|
||||
%% code to find the next state, and perhaps do backtracking, goes here
|
||||
@@ -586,14 +562,7 @@ register yy_state_type yy_current_state;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
|
||||
#else
|
||||
static void yyunput( c, yy_bp )
|
||||
YY_CHAR c;
|
||||
register YY_CHAR *yy_bp;
|
||||
#endif
|
||||
|
||||
{
|
||||
register YY_CHAR *yy_cp = yy_c_buf_p;
|
||||
|
||||
@@ -634,7 +603,7 @@ register YY_CHAR *yy_bp;
|
||||
#ifdef __cplusplus
|
||||
static int yyinput()
|
||||
#else
|
||||
static int input()
|
||||
static int input(void)
|
||||
#endif
|
||||
|
||||
{
|
||||
@@ -699,26 +668,14 @@ static int input()
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yyrestart( FILE *input_file )
|
||||
#else
|
||||
void yyrestart( input_file )
|
||||
FILE *input_file;
|
||||
#endif
|
||||
|
||||
{
|
||||
yy_init_buffer( yy_current_buffer, input_file );
|
||||
yy_load_buffer_state();
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
|
||||
#else
|
||||
void yy_switch_to_buffer( new_buffer )
|
||||
YY_BUFFER_STATE new_buffer;
|
||||
#endif
|
||||
|
||||
{
|
||||
if ( yy_current_buffer == new_buffer )
|
||||
return;
|
||||
@@ -743,12 +700,7 @@ YY_BUFFER_STATE new_buffer;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_load_buffer_state( void )
|
||||
#else
|
||||
void yy_load_buffer_state()
|
||||
#endif
|
||||
|
||||
{
|
||||
yy_n_chars = yy_current_buffer->yy_n_chars;
|
||||
yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
|
||||
@@ -757,14 +709,7 @@ void yy_load_buffer_state()
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
|
||||
#else
|
||||
YY_BUFFER_STATE yy_create_buffer( file, size )
|
||||
FILE *file;
|
||||
int size;
|
||||
#endif
|
||||
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
|
||||
@@ -789,13 +734,7 @@ int size;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_delete_buffer( YY_BUFFER_STATE b )
|
||||
#else
|
||||
void yy_delete_buffer( b )
|
||||
YY_BUFFER_STATE b;
|
||||
#endif
|
||||
|
||||
{
|
||||
if ( b == yy_current_buffer )
|
||||
yy_current_buffer = (YY_BUFFER_STATE) 0;
|
||||
@@ -805,14 +744,7 @@ YY_BUFFER_STATE b;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
|
||||
#else
|
||||
void yy_init_buffer( b, file )
|
||||
YY_BUFFER_STATE b;
|
||||
FILE *file;
|
||||
#endif
|
||||
|
||||
{
|
||||
b->yy_input_file = file;
|
||||
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* use prototypes in function declarations */
|
||||
#define YY_USE_PROTOS
|
||||
|
||||
/* the "const" storage-class-modifier is valid */
|
||||
#define YY_USE_CONST
|
||||
|
||||
@@ -23,13 +20,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
#define YY_PROTO(proto) proto
|
||||
#else
|
||||
#define YY_PROTO(proto) ()
|
||||
#endif
|
||||
|
||||
|
||||
/* amount of stuff to slurp up with each read */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
@@ -60,7 +50,7 @@
|
||||
*/
|
||||
|
||||
/* #define yyterminate() return ( YY_NULL ) replaced by jbk */
|
||||
static int yyterminate_internal( YY_PROTO(void) );
|
||||
static int yyterminate_internal( void );
|
||||
#define yyterminate() return yyterminate_internal()
|
||||
|
||||
/* report a fatal error */
|
||||
@@ -112,7 +102,7 @@ static int yyterminate_internal( YY_PROTO(void) );
|
||||
/* default declaration of generated scanner - a define so the user can
|
||||
* easily add parameters - jbk added the static to YY_DECL
|
||||
*/
|
||||
#define YY_DECL static int yylex YY_PROTO(( void ))
|
||||
#define YY_DECL static int yylex ( void )
|
||||
|
||||
/* code executed at the end of each rule */
|
||||
#define YY_BREAK break;
|
||||
@@ -227,25 +217,25 @@ static int yy_start = 0; /* start state number */
|
||||
*/
|
||||
static int yy_did_buffer_switch_on_eof;
|
||||
|
||||
static yy_state_type yy_get_previous_state YY_PROTO(( void ));
|
||||
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
|
||||
static int yy_get_next_buffer YY_PROTO(( void ));
|
||||
static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
|
||||
static yy_state_type yy_get_previous_state ( void );
|
||||
static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
|
||||
static int yy_get_next_buffer ( void );
|
||||
static void yyunput ( YY_CHAR c, YY_CHAR *buf_ptr );
|
||||
|
||||
/* jbk added static in front all these */
|
||||
static void yyrestart YY_PROTO(( FILE *input_file ));
|
||||
static void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
|
||||
static void yy_load_buffer_state YY_PROTO(( void ));
|
||||
static YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
|
||||
static void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
|
||||
static void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
|
||||
static void yyrestart ( FILE *input_file );
|
||||
static void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
|
||||
static void yy_load_buffer_state ( void );
|
||||
static YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
|
||||
static void yy_delete_buffer ( YY_BUFFER_STATE b );
|
||||
static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
|
||||
|
||||
#define yy_new_buffer yy_create_buffer
|
||||
|
||||
#ifdef __cplusplus
|
||||
static int yyinput YY_PROTO(( void ));
|
||||
static int yyinput ( void );
|
||||
#else
|
||||
static int input YY_PROTO(( void ));
|
||||
static int input ( void );
|
||||
#endif
|
||||
|
||||
YY_DECL
|
||||
@@ -433,7 +423,7 @@ do_action: /* this label is used only to access EOF actions */
|
||||
* EOB_ACT_END_OF_FILE - end of file
|
||||
*/
|
||||
|
||||
static int yy_get_next_buffer( YY_PROTO(void) )
|
||||
static int yy_get_next_buffer( void )
|
||||
|
||||
{
|
||||
register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
|
||||
@@ -514,7 +504,7 @@ static int yy_get_next_buffer( YY_PROTO(void) )
|
||||
* yy_state_type yy_get_previous_state();
|
||||
*/
|
||||
|
||||
static yy_state_type yy_get_previous_state( YY_PROTO(void) )
|
||||
static yy_state_type yy_get_previous_state( void )
|
||||
|
||||
{
|
||||
register yy_state_type yy_current_state;
|
||||
@@ -537,13 +527,7 @@ static yy_state_type yy_get_previous_state( YY_PROTO(void) )
|
||||
* next_state = yy_try_NUL_trans( current_state );
|
||||
*/
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
|
||||
#else
|
||||
static yy_state_type yy_try_NUL_trans( yy_current_state )
|
||||
register yy_state_type yy_current_state;
|
||||
#endif
|
||||
|
||||
{
|
||||
register int yy_is_jam;
|
||||
%% code to find the next state, and perhaps do backtracking, goes here
|
||||
@@ -552,14 +536,7 @@ register yy_state_type yy_current_state;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
|
||||
#else
|
||||
static void yyunput( c, yy_bp )
|
||||
YY_CHAR c;
|
||||
register YY_CHAR *yy_bp;
|
||||
#endif
|
||||
|
||||
{
|
||||
register YY_CHAR *yy_cp = yy_c_buf_p;
|
||||
|
||||
@@ -598,9 +575,9 @@ register YY_CHAR *yy_bp;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
static int yyinput( YY_PROTO(void) )
|
||||
static int yyinput( void )
|
||||
#else
|
||||
static int input( YY_PROTO(void) )
|
||||
static int input( void )
|
||||
#endif
|
||||
|
||||
{
|
||||
@@ -666,13 +643,7 @@ static int input( YY_PROTO(void) )
|
||||
|
||||
|
||||
/* jbk added static in front of func */
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yyrestart( FILE *input_file )
|
||||
#else
|
||||
static void yyrestart( input_file )
|
||||
FILE *input_file;
|
||||
#endif
|
||||
|
||||
{
|
||||
if ( yy_current_buffer )
|
||||
yy_init_buffer( yy_current_buffer, input_file );
|
||||
@@ -684,13 +655,7 @@ FILE *input_file;
|
||||
|
||||
|
||||
/* jbk added static in front of func */
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
|
||||
#else
|
||||
static void yy_switch_to_buffer( new_buffer )
|
||||
YY_BUFFER_STATE new_buffer;
|
||||
#endif
|
||||
|
||||
{
|
||||
if ( yy_current_buffer == new_buffer )
|
||||
return;
|
||||
@@ -716,12 +681,7 @@ YY_BUFFER_STATE new_buffer;
|
||||
|
||||
|
||||
/* jbk added static in front of func */
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yy_load_buffer_state( void )
|
||||
#else
|
||||
static void yy_load_buffer_state()
|
||||
#endif
|
||||
|
||||
{
|
||||
yy_n_chars = yy_current_buffer->yy_n_chars;
|
||||
yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
|
||||
@@ -731,14 +691,7 @@ static void yy_load_buffer_state()
|
||||
|
||||
|
||||
/* jbk added static in front of func */
|
||||
#ifdef YY_USE_PROTOS
|
||||
static YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
|
||||
#else
|
||||
static YY_BUFFER_STATE yy_create_buffer( file, size )
|
||||
FILE *file;
|
||||
int size;
|
||||
#endif
|
||||
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
|
||||
@@ -764,13 +717,7 @@ int size;
|
||||
|
||||
|
||||
/* jbk added static in front of func */
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yy_delete_buffer( YY_BUFFER_STATE b )
|
||||
#else
|
||||
static void yy_delete_buffer( b )
|
||||
YY_BUFFER_STATE b;
|
||||
#endif
|
||||
|
||||
{
|
||||
if ( b == yy_current_buffer )
|
||||
yy_current_buffer = (YY_BUFFER_STATE) 0;
|
||||
@@ -781,14 +728,7 @@ YY_BUFFER_STATE b;
|
||||
|
||||
|
||||
/* jbk added static in front of func */
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
|
||||
#else
|
||||
static void yy_init_buffer( b, file )
|
||||
YY_BUFFER_STATE b;
|
||||
FILE *file;
|
||||
#endif
|
||||
|
||||
{
|
||||
b->yy_input_file = file;
|
||||
|
||||
@@ -811,7 +751,7 @@ FILE *file;
|
||||
b->yy_eof_status = EOF_NOT_SEEN;
|
||||
}
|
||||
|
||||
static int yyterminate_internal( YY_PROTO(void) )
|
||||
static int yyterminate_internal( void )
|
||||
{
|
||||
/* jbk fix - buffer created by yy_create_buffer needs to be freed */
|
||||
yy_delete_buffer(yy_current_buffer);
|
||||
|
||||
@@ -57,15 +57,6 @@
|
||||
#define DEFAULT_CSIZE 128
|
||||
#endif
|
||||
|
||||
#ifndef PROTO
|
||||
#ifdef __STDC__
|
||||
#define PROTO(proto) proto
|
||||
#else
|
||||
#define PROTO(proto) ()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USG
|
||||
#define SYS_V
|
||||
#endif
|
||||
@@ -634,7 +625,8 @@ extern int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs;
|
||||
extern int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave;
|
||||
extern int num_backtracking, bol_needed;
|
||||
|
||||
void *allocate_array(), *reallocate_array();
|
||||
void *allocate_array(int size, int element_size);
|
||||
void *reallocate_array(void *array, int size, int element_size);
|
||||
|
||||
#define allocate_integer_array(size) \
|
||||
(int *) allocate_array( size, sizeof( int ) )
|
||||
@@ -685,207 +677,207 @@ extern int yylval;
|
||||
|
||||
/* from file ccl.c */
|
||||
|
||||
extern void ccladd PROTO((int, int)); /* Add a single character to a ccl */
|
||||
extern int cclinit PROTO(()); /* make an empty ccl */
|
||||
extern void cclnegate PROTO((int)); /* negate a ccl */
|
||||
extern void ccladd (int, int); /* Add a single character to a ccl */
|
||||
extern int cclinit (void); /* make an empty ccl */
|
||||
extern void cclnegate (int); /* negate a ccl */
|
||||
|
||||
/* list the members of a set of characters in CCL form */
|
||||
extern void list_character_set PROTO((FILE*, int[]));
|
||||
extern void list_character_set (FILE*, int[]);
|
||||
|
||||
|
||||
/* from file dfa.c */
|
||||
|
||||
/* increase the maximum number of dfas */
|
||||
extern void increase_max_dfas PROTO(());
|
||||
extern void increase_max_dfas (void);
|
||||
|
||||
extern void ntod PROTO(()); /* convert a ndfa to a dfa */
|
||||
extern void ntod (void); /* convert a ndfa to a dfa */
|
||||
|
||||
|
||||
/* from file ecs.c */
|
||||
|
||||
/* convert character classes to set of equivalence classes */
|
||||
extern void ccl2ecl PROTO(());
|
||||
extern void ccl2ecl (void);
|
||||
|
||||
/* associate equivalence class numbers with class members */
|
||||
extern int cre8ecs PROTO((int[], int[], int));
|
||||
extern int cre8ecs (int[], int[], int);
|
||||
|
||||
/* associate equivalence class numbers using %t table */
|
||||
extern int ecs_from_xlation PROTO((int[]));
|
||||
extern int ecs_from_xlation (int[]);
|
||||
|
||||
/* update equivalence classes based on character class transitions */
|
||||
extern void mkeccl PROTO((Char[], int, int[], int[], int, int));
|
||||
extern void mkeccl (Char[], int, int[], int[], int, int);
|
||||
|
||||
/* create equivalence class for single character */
|
||||
extern void mkechar PROTO((int, int[], int[]));
|
||||
extern void mkechar (int, int[], int[]);
|
||||
|
||||
|
||||
/* from file gen.c */
|
||||
|
||||
extern void make_tables PROTO(()); /* generate transition tables */
|
||||
extern void make_tables (void); /* generate transition tables */
|
||||
|
||||
|
||||
/* from file main.c */
|
||||
|
||||
extern void flexend PROTO((int));
|
||||
extern void flexend (int);
|
||||
|
||||
|
||||
/* from file misc.c */
|
||||
|
||||
/* write out the actions from the temporary file to lex.yy.c */
|
||||
extern void action_out PROTO(());
|
||||
extern void action_out (void);
|
||||
|
||||
/* true if a string is all lower case */
|
||||
extern int all_lower PROTO((register Char *));
|
||||
extern int all_lower (register Char *);
|
||||
|
||||
/* true if a string is all upper case */
|
||||
extern int all_upper PROTO((register Char *));
|
||||
extern int all_upper (register Char *);
|
||||
|
||||
/* bubble sort an integer array */
|
||||
extern void bubble PROTO((int [], int));
|
||||
extern void bubble (int [], int);
|
||||
|
||||
/* shell sort a character array */
|
||||
extern void cshell PROTO((Char [], int, int));
|
||||
extern void cshell (Char [], int, int);
|
||||
|
||||
extern void dataend PROTO(()); /* finish up a block of data declarations */
|
||||
extern void dataend (void); /* finish up a block of data declarations */
|
||||
|
||||
/* report an error message and terminate */
|
||||
extern void flexerror PROTO((char[]));
|
||||
extern void flexerror (char[]);
|
||||
|
||||
/* report a fatal error message and terminate */
|
||||
extern void flexfatal PROTO((char[]));
|
||||
extern void flexfatal (char[]);
|
||||
|
||||
/* report an error message formatted with one integer argument */
|
||||
extern void lerrif PROTO((char[], int));
|
||||
extern void lerrif (char[], int);
|
||||
|
||||
/* report an error message formatted with one string argument */
|
||||
extern void lerrsf PROTO((char[], char[]));
|
||||
extern void lerrsf (char[], char[]);
|
||||
|
||||
/* spit out a "# line" statement */
|
||||
extern void line_directive_out PROTO((FILE*));
|
||||
extern void line_directive_out (FILE*);
|
||||
|
||||
/* generate a data statment for a two-dimensional array */
|
||||
extern void mk2data PROTO((int));
|
||||
extern void mk2data (int);
|
||||
|
||||
extern void mkdata PROTO((int)); /* generate a data statement */
|
||||
extern void mkdata (int); /* generate a data statement */
|
||||
|
||||
/* return the integer represented by a string of digits */
|
||||
extern int myctoi PROTO((Char []));
|
||||
extern int myctoi (Char []);
|
||||
|
||||
/* write out one section of the skeleton file */
|
||||
extern void skelout PROTO(());
|
||||
extern void skelout (void);
|
||||
|
||||
/* output a yy_trans_info structure */
|
||||
extern void transition_struct_out PROTO((int, int));
|
||||
extern void transition_struct_out (int, int);
|
||||
|
||||
|
||||
/* from file nfa.c */
|
||||
|
||||
/* add an accepting state to a machine */
|
||||
extern void add_accept PROTO((int, int));
|
||||
extern void add_accept (int, int);
|
||||
|
||||
/* make a given number of copies of a singleton machine */
|
||||
extern int copysingl PROTO((int, int));
|
||||
extern int copysingl (int, int);
|
||||
|
||||
/* debugging routine to write out an nfa */
|
||||
extern void dumpnfa PROTO((int));
|
||||
extern void dumpnfa (int);
|
||||
|
||||
/* finish up the processing for a rule */
|
||||
extern void finish_rule PROTO((int, int, int, int));
|
||||
extern void finish_rule (int, int, int, int);
|
||||
|
||||
/* connect two machines together */
|
||||
extern int link_machines PROTO((int, int));
|
||||
extern int link_machines (int, int);
|
||||
|
||||
/* mark each "beginning" state in a machine as being a "normal" (i.e.,
|
||||
* not trailing context associated) state
|
||||
*/
|
||||
extern void mark_beginning_as_normal PROTO((register int));
|
||||
extern void mark_beginning_as_normal (register int);
|
||||
|
||||
/* make a machine that branches to two machines */
|
||||
extern int mkbranch PROTO((int, int));
|
||||
extern int mkbranch (int, int);
|
||||
|
||||
extern int mkclos PROTO((int)); /* convert a machine into a closure */
|
||||
extern int mkopt PROTO((int)); /* make a machine optional */
|
||||
extern int mkclos (int); /* convert a machine into a closure */
|
||||
extern int mkopt (int); /* make a machine optional */
|
||||
|
||||
/* make a machine that matches either one of two machines */
|
||||
extern int mkor PROTO((int, int));
|
||||
extern int mkor (int, int);
|
||||
|
||||
/* convert a machine into a positive closure */
|
||||
extern int mkposcl PROTO((int));
|
||||
extern int mkposcl (int);
|
||||
|
||||
extern int mkrep PROTO((int, int, int)); /* make a replicated machine */
|
||||
extern int mkrep (int, int, int); /* make a replicated machine */
|
||||
|
||||
/* create a state with a transition on a given symbol */
|
||||
extern int mkstate PROTO((int));
|
||||
extern int mkstate (int);
|
||||
|
||||
extern void new_rule PROTO(()); /* initialize for a new rule */
|
||||
extern void new_rule (void); /* initialize for a new rule */
|
||||
|
||||
|
||||
/* from file parse.y */
|
||||
|
||||
/* write out a message formatted with one string, pinpointing its location */
|
||||
extern void format_pinpoint_message PROTO((char[], char[]));
|
||||
extern void format_pinpoint_message (char[], char[]);
|
||||
|
||||
/* write out a message, pinpointing its location */
|
||||
extern void pinpoint_message PROTO((char[]));
|
||||
extern void pinpoint_message (char[]);
|
||||
|
||||
extern void synerr PROTO((char [])); /* report a syntax error */
|
||||
/* extern int yyparse PROTO(());*/ /* the YACC parser */
|
||||
extern void synerr (char []); /* report a syntax error */
|
||||
/* extern int yyparse ();*/ /* the YACC parser */
|
||||
|
||||
|
||||
/* from file scan.l */
|
||||
|
||||
extern int flexscan PROTO(()); /* the Flex-generated scanner for flex */
|
||||
extern int flexscan (); /* the Flex-generated scanner for flex */
|
||||
|
||||
/* open the given file (if NULL, stdin) for scanning */
|
||||
extern void set_input_file PROTO((char*));
|
||||
extern void set_input_file (char*);
|
||||
|
||||
extern int yywrap PROTO(()); /* wrapup a file in the lexical analyzer */
|
||||
extern int yywrap (); /* wrapup a file in the lexical analyzer */
|
||||
|
||||
|
||||
/* from file sym.c */
|
||||
|
||||
/* save the text of a character class */
|
||||
extern void cclinstal PROTO ((Char [], int));
|
||||
extern void cclinstal (Char [], int);
|
||||
|
||||
/* lookup the number associated with character class */
|
||||
extern int ccllookup PROTO((Char []));
|
||||
extern int ccllookup (Char []);
|
||||
|
||||
extern void ndinstal PROTO((char[], Char[])); /* install a name definition */
|
||||
extern void scinstal PROTO((char[], int)); /* make a start condition */
|
||||
extern void ndinstal (char[], Char[]); /* install a name definition */
|
||||
extern void scinstal (char[], int); /* make a start condition */
|
||||
|
||||
/* lookup the number associated with a start condition */
|
||||
extern int sclookup PROTO((char[]));
|
||||
extern int sclookup (char[]);
|
||||
|
||||
|
||||
/* from file tblcmp.c */
|
||||
|
||||
/* build table entries for dfa state */
|
||||
extern void bldtbl PROTO((int[], int, int, int, int));
|
||||
extern void bldtbl (int[], int, int, int, int);
|
||||
|
||||
extern void cmptmps PROTO(()); /* compress template table entries */
|
||||
extern void inittbl PROTO(()); /* initialize transition tables */
|
||||
extern void mkdeftbl PROTO(()); /* make the default, "jam" table entries */
|
||||
extern void cmptmps (void); /* compress template table entries */
|
||||
extern void inittbl (void); /* initialize transition tables */
|
||||
extern void mkdeftbl (void); /* make the default, "jam" table entries */
|
||||
|
||||
/* create table entries for a state (or state fragment) which has
|
||||
* only one out-transition */
|
||||
extern void mk1tbl PROTO((int, int, int, int));
|
||||
extern void mk1tbl (int, int, int, int);
|
||||
|
||||
/* place a state into full speed transition table */
|
||||
extern void place_state PROTO((int*, int, int));
|
||||
extern void place_state (int*, int, int);
|
||||
|
||||
/* save states with only one out-transition to be processed later */
|
||||
extern void stack1 PROTO((int, int, int, int));
|
||||
extern void stack1 (int, int, int, int);
|
||||
|
||||
|
||||
/* from file yylex.c */
|
||||
|
||||
extern int yylex PROTO(());
|
||||
extern int yylex ();
|
||||
|
||||
|
||||
/* The Unix kernel calls used here */
|
||||
|
||||
extern int read PROTO((int, char*, int));
|
||||
extern int read (int, char*, int);
|
||||
#ifndef _WIN32
|
||||
extern int unlink PROTO((char*));
|
||||
extern int unlink (char*);
|
||||
#endif
|
||||
extern int write PROTO((int, char*, int));
|
||||
extern int write (int, char*, int);
|
||||
|
||||
@@ -45,10 +45,10 @@ static char rcsid[] =
|
||||
|
||||
/* declare functions that have forward references */
|
||||
|
||||
void gen_next_state PROTO((int));
|
||||
void genecs PROTO(());
|
||||
void indent_put2s PROTO((char [], char []));
|
||||
void indent_puts PROTO((char []));
|
||||
void gen_next_state (int);
|
||||
void genecs (void);
|
||||
void indent_put2s (char [], char []);
|
||||
void indent_puts (char []);
|
||||
|
||||
|
||||
static int indent_level = 0; /* each level is 4 spaces */
|
||||
@@ -68,9 +68,8 @@ static char C_state_decl[] =
|
||||
|
||||
/* indent to the current level */
|
||||
|
||||
void do_indent()
|
||||
|
||||
{
|
||||
void do_indent(void)
|
||||
{
|
||||
register int i = indent_level * 4;
|
||||
|
||||
while ( i >= 8 )
|
||||
@@ -89,9 +88,8 @@ void do_indent()
|
||||
|
||||
/* generate the code to keep backtracking information */
|
||||
|
||||
void gen_backtracking()
|
||||
|
||||
{
|
||||
void gen_backtracking(void)
|
||||
{
|
||||
if ( reject || num_backtracking == 0 )
|
||||
return;
|
||||
|
||||
@@ -111,9 +109,8 @@ void gen_backtracking()
|
||||
|
||||
/* generate the code to perform the backtrack */
|
||||
|
||||
void gen_bt_action()
|
||||
|
||||
{
|
||||
void gen_bt_action(void)
|
||||
{
|
||||
if ( reject || num_backtracking == 0 )
|
||||
return;
|
||||
|
||||
@@ -145,9 +142,8 @@ void gen_bt_action()
|
||||
* genctbl();
|
||||
*/
|
||||
|
||||
void genctbl()
|
||||
|
||||
{
|
||||
void genctbl(void)
|
||||
{
|
||||
register int i;
|
||||
int end_of_buffer_action = num_rules + 1;
|
||||
|
||||
@@ -230,9 +226,8 @@ void genctbl()
|
||||
|
||||
/* generate equivalence-class tables */
|
||||
|
||||
void genecs()
|
||||
|
||||
{
|
||||
void genecs(void)
|
||||
{
|
||||
register int i, j;
|
||||
static char C_char_decl[] = "static const %s %s[%d] =\n { 0,\n";
|
||||
int numrows;
|
||||
@@ -279,9 +274,8 @@ void genecs()
|
||||
|
||||
/* generate the code to find the action number */
|
||||
|
||||
void gen_find_action()
|
||||
|
||||
{
|
||||
void gen_find_action(void)
|
||||
{
|
||||
if ( fullspd )
|
||||
indent_puts( "yy_act = yy_current_state[-1].yy_nxt;" );
|
||||
|
||||
@@ -400,9 +394,8 @@ void gen_find_action()
|
||||
* genftbl();
|
||||
*/
|
||||
|
||||
void genftbl()
|
||||
|
||||
{
|
||||
void genftbl(void)
|
||||
{
|
||||
register int i;
|
||||
int end_of_buffer_action = num_rules + 1;
|
||||
|
||||
@@ -434,10 +427,8 @@ void genftbl()
|
||||
|
||||
/* generate the code to find the next compressed-table state */
|
||||
|
||||
void gen_next_compressed_state( char_map )
|
||||
char *char_map;
|
||||
|
||||
{
|
||||
void gen_next_compressed_state(char *char_map)
|
||||
{
|
||||
indent_put2s( "register YY_CHAR yy_c = %s;", char_map );
|
||||
|
||||
/* save the backtracking info \before/ computing the next state
|
||||
@@ -480,9 +471,8 @@ char *char_map;
|
||||
|
||||
/* generate the code to find the next match */
|
||||
|
||||
void gen_next_match()
|
||||
|
||||
{
|
||||
void gen_next_match(void)
|
||||
{
|
||||
/* NOTE - changes in here should be reflected in gen_next_state() and
|
||||
* gen_NUL_trans()
|
||||
*/
|
||||
@@ -576,10 +566,8 @@ void gen_next_match()
|
||||
|
||||
/* generate the code to find the next state */
|
||||
|
||||
void gen_next_state( worry_about_NULs )
|
||||
int worry_about_NULs;
|
||||
|
||||
{ /* NOTE - changes in here should be reflected in get_next_match() */
|
||||
void gen_next_state(int worry_about_NULs)
|
||||
{ /* NOTE - changes in here should be reflected in get_next_match() */
|
||||
char char_map[256];
|
||||
|
||||
if ( worry_about_NULs && ! nultrans )
|
||||
@@ -635,9 +623,8 @@ int worry_about_NULs;
|
||||
|
||||
/* generate the code to make a NUL transition */
|
||||
|
||||
void gen_NUL_trans()
|
||||
|
||||
{ /* NOTE - changes in here should be reflected in get_next_match() */
|
||||
void gen_NUL_trans(void)
|
||||
{ /* NOTE - changes in here should be reflected in get_next_match() */
|
||||
int need_backtracking = (num_backtracking > 0 && ! reject);
|
||||
|
||||
if ( need_backtracking )
|
||||
@@ -711,9 +698,8 @@ void gen_NUL_trans()
|
||||
|
||||
/* generate the code to find the start state */
|
||||
|
||||
void gen_start_state()
|
||||
|
||||
{
|
||||
void gen_start_state(void)
|
||||
{
|
||||
if ( fullspd )
|
||||
indent_put2s( "yy_current_state = yy_start_state_list[yy_start%s];",
|
||||
bol_needed ? " + (yy_bp[-1] == '\\n' ? 1 : 0)" : "" );
|
||||
@@ -746,9 +732,8 @@ void gen_start_state()
|
||||
* gentabs();
|
||||
*/
|
||||
|
||||
void gentabs()
|
||||
|
||||
{
|
||||
void gentabs(void)
|
||||
{
|
||||
int i, j, k, *accset, nacc, *acc_array, total_states;
|
||||
int end_of_buffer_action = num_rules + 1;
|
||||
|
||||
@@ -985,10 +970,8 @@ void gentabs()
|
||||
* current indentation level, adding a final newline
|
||||
*/
|
||||
|
||||
void indent_put2s( fmt, arg )
|
||||
char fmt[], arg[];
|
||||
|
||||
{
|
||||
void indent_put2s(char *fmt, char *arg)
|
||||
{
|
||||
do_indent();
|
||||
printf( fmt, arg );
|
||||
putchar( '\n' );
|
||||
@@ -999,10 +982,8 @@ char fmt[], arg[];
|
||||
* newline
|
||||
*/
|
||||
|
||||
void indent_puts( str )
|
||||
char str[];
|
||||
|
||||
{
|
||||
void indent_puts(char *str)
|
||||
{
|
||||
do_indent();
|
||||
puts( str );
|
||||
}
|
||||
@@ -1016,9 +997,8 @@ char str[];
|
||||
* Generates transition tables and finishes generating output file
|
||||
*/
|
||||
|
||||
void make_tables()
|
||||
|
||||
{
|
||||
void make_tables(void)
|
||||
{
|
||||
register int i;
|
||||
int did_eof_rule = false;
|
||||
|
||||
|
||||
@@ -57,9 +57,9 @@ static char flex_version[] = "2.3";
|
||||
|
||||
/* declare functions that have forward references */
|
||||
|
||||
void flexinit PROTO((int, char**));
|
||||
void readin PROTO(());
|
||||
void set_up_initial_allocations PROTO(());
|
||||
void flexinit (int, char**);
|
||||
void readin ();
|
||||
void set_up_initial_allocations ();
|
||||
|
||||
|
||||
/* these globals are all defined and commented in flexdef.h */
|
||||
|
||||
@@ -53,8 +53,8 @@ static char rcsid[] =
|
||||
|
||||
/* declare functions that have forward references */
|
||||
|
||||
void dataflush PROTO(());
|
||||
int otoi PROTO((Char []));
|
||||
void dataflush (void);
|
||||
int otoi (Char []);
|
||||
|
||||
|
||||
/* action_out - write the actions from the temporary file to lex.yy.c
|
||||
@@ -65,9 +65,8 @@ int otoi PROTO((Char []));
|
||||
* Copies the action file up to %% (or end-of-file) to lex.yy.c
|
||||
*/
|
||||
|
||||
void action_out()
|
||||
|
||||
{
|
||||
void action_out(void)
|
||||
{
|
||||
char buf[MAXLINE];
|
||||
|
||||
while ( fgets( buf, MAXLINE, temp_action_file ) != NULL )
|
||||
@@ -80,10 +79,8 @@ void action_out()
|
||||
|
||||
/* allocate_array - allocate memory for an integer array of the given size */
|
||||
|
||||
void *allocate_array( size, element_size )
|
||||
int size, element_size;
|
||||
|
||||
{
|
||||
void *allocate_array(int size, int element_size)
|
||||
{
|
||||
register void *mem;
|
||||
|
||||
/* on 16-bit int machines (e.g., 80286) we might be trying to
|
||||
@@ -110,10 +107,8 @@ int size, element_size;
|
||||
* true/false = all_lower( str );
|
||||
*/
|
||||
|
||||
int all_lower( str )
|
||||
register Char *str;
|
||||
|
||||
{
|
||||
int all_lower(register Char *str)
|
||||
{
|
||||
while ( *str )
|
||||
{
|
||||
if ( ! isascii( *str ) || ! islower( *str ) )
|
||||
@@ -133,10 +128,8 @@ register Char *str;
|
||||
* true/false = all_upper( str );
|
||||
*/
|
||||
|
||||
int all_upper( str )
|
||||
register Char *str;
|
||||
|
||||
{
|
||||
int all_upper(register Char *str)
|
||||
{
|
||||
while ( *str )
|
||||
{
|
||||
if ( ! isascii( *str ) || ! isupper( (char) *str ) )
|
||||
@@ -162,10 +155,8 @@ register Char *str;
|
||||
* v - the array to be sorted
|
||||
* n - the number of elements of 'v' to be sorted */
|
||||
|
||||
void bubble( v, n )
|
||||
int v[], n;
|
||||
|
||||
{
|
||||
void bubble(int v[], int n)
|
||||
{
|
||||
register int i, j, k;
|
||||
|
||||
for ( i = n; i > 1; --i )
|
||||
@@ -187,10 +178,8 @@ int v[], n;
|
||||
* c = clower( c );
|
||||
*/
|
||||
|
||||
Char clower( c )
|
||||
register int c;
|
||||
|
||||
{
|
||||
Char clower(register int c)
|
||||
{
|
||||
return ( (isascii( c ) && isupper( c )) ? tolower( c ) : c );
|
||||
}
|
||||
|
||||
@@ -202,10 +191,8 @@ register int c;
|
||||
* copy = copy_string( str );
|
||||
*/
|
||||
|
||||
char *copy_string( str )
|
||||
register char *str;
|
||||
|
||||
{
|
||||
char *copy_string(register char *str)
|
||||
{
|
||||
register char *c;
|
||||
char *copy;
|
||||
|
||||
@@ -233,10 +220,8 @@ register char *str;
|
||||
* copy = copy_unsigned_string( str );
|
||||
*/
|
||||
|
||||
Char *copy_unsigned_string( str )
|
||||
register Char *str;
|
||||
|
||||
{
|
||||
Char *copy_unsigned_string(register Char *str)
|
||||
{
|
||||
register Char *c;
|
||||
Char *copy;
|
||||
|
||||
@@ -274,11 +259,8 @@ register Char *str;
|
||||
* n - number of elements of v to be sorted
|
||||
*/
|
||||
|
||||
void cshell( v, n, special_case_0 )
|
||||
Char v[];
|
||||
int n, special_case_0;
|
||||
|
||||
{
|
||||
void cshell(Char *v, int n, int special_case_0)
|
||||
{
|
||||
int gap, i, j, jg;
|
||||
Char k;
|
||||
|
||||
@@ -313,9 +295,8 @@ int n, special_case_0;
|
||||
* dataend();
|
||||
*/
|
||||
|
||||
void dataend()
|
||||
|
||||
{
|
||||
void dataend(void)
|
||||
{
|
||||
if ( datapos > 0 )
|
||||
dataflush();
|
||||
|
||||
@@ -334,9 +315,8 @@ void dataend()
|
||||
* dataflush();
|
||||
*/
|
||||
|
||||
void dataflush()
|
||||
|
||||
{
|
||||
void dataflush(void)
|
||||
{
|
||||
putchar( '\n' );
|
||||
|
||||
if ( ++dataline >= NUMDATALINES )
|
||||
@@ -360,10 +340,8 @@ void dataflush()
|
||||
* flexerror( msg );
|
||||
*/
|
||||
|
||||
void flexerror( msg )
|
||||
char msg[];
|
||||
|
||||
{
|
||||
void flexerror(char *msg)
|
||||
{
|
||||
fprintf( stderr, "%s: %s\n", program_name, msg );
|
||||
|
||||
flexend( 1 );
|
||||
@@ -377,10 +355,8 @@ char msg[];
|
||||
* flexfatal( msg );
|
||||
*/
|
||||
|
||||
void flexfatal( msg )
|
||||
char msg[];
|
||||
|
||||
{
|
||||
void flexfatal(char *msg)
|
||||
{
|
||||
fprintf( stderr, "%s: fatal internal error, %s\n", program_name, msg );
|
||||
flexend( 1 );
|
||||
}
|
||||
@@ -412,11 +388,10 @@ char msg[];
|
||||
typedef long time_t;
|
||||
#endif
|
||||
|
||||
char *flex_gettime()
|
||||
|
||||
{
|
||||
time_t t, time();
|
||||
char *result, *ctime(), *copy_string();
|
||||
char *flex_gettime(void)
|
||||
{
|
||||
time_t t, time(time_t *);
|
||||
char *result, *ctime(const time_t *), *copy_string(register char *str);
|
||||
|
||||
t = time( (long *) 0 );
|
||||
|
||||
@@ -437,11 +412,8 @@ char *flex_gettime()
|
||||
* lerrif( msg, arg );
|
||||
*/
|
||||
|
||||
void lerrif( msg, arg )
|
||||
char msg[];
|
||||
int arg;
|
||||
|
||||
{
|
||||
void lerrif(char *msg, int arg)
|
||||
{
|
||||
char errmsg[MAXLINE];
|
||||
(void) sprintf( errmsg, msg, arg );
|
||||
flexerror( errmsg );
|
||||
@@ -455,10 +427,8 @@ int arg;
|
||||
* lerrsf( msg, arg );
|
||||
*/
|
||||
|
||||
void lerrsf( msg, arg )
|
||||
char msg[], arg[];
|
||||
|
||||
{
|
||||
void lerrsf(char *msg, char *arg)
|
||||
{
|
||||
char errmsg[MAXLINE];
|
||||
|
||||
(void) sprintf( errmsg, msg, arg );
|
||||
@@ -474,10 +444,8 @@ char msg[], arg[];
|
||||
* val = htoi( str );
|
||||
*/
|
||||
|
||||
int htoi( str )
|
||||
Char str[];
|
||||
|
||||
{
|
||||
int htoi(unsigned char *str)
|
||||
{
|
||||
int result;
|
||||
|
||||
(void) sscanf( (char *) str, "%x", &result );
|
||||
@@ -495,10 +463,8 @@ Char str[];
|
||||
* val = is_hex_digit( ch );
|
||||
*/
|
||||
|
||||
int is_hex_digit( ch )
|
||||
int ch;
|
||||
|
||||
{
|
||||
int is_hex_digit(int ch)
|
||||
{
|
||||
if ( isdigit( ch ) )
|
||||
return ( 1 );
|
||||
|
||||
@@ -520,10 +486,8 @@ int ch;
|
||||
|
||||
/* line_directive_out - spit out a "# line" statement */
|
||||
|
||||
void line_directive_out( output_file_name )
|
||||
FILE *output_file_name;
|
||||
|
||||
{
|
||||
void line_directive_out(FILE *output_file_name)
|
||||
{
|
||||
if ( infilename && gen_line_dirs )
|
||||
fprintf( output_file_name, "# line %d \"%s\"\n", linenum, infilename );
|
||||
}
|
||||
@@ -537,10 +501,8 @@ FILE *output_file_name;
|
||||
*
|
||||
* generates a data statement initializing the current 2-D array to "value"
|
||||
*/
|
||||
void mk2data( value )
|
||||
int value;
|
||||
|
||||
{
|
||||
void mk2data(int value)
|
||||
{
|
||||
if ( datapos >= NUMDATAITEMS )
|
||||
{
|
||||
putchar( ',' );
|
||||
@@ -569,10 +531,8 @@ int value;
|
||||
* generates a data statement initializing the current array element to
|
||||
* "value"
|
||||
*/
|
||||
void mkdata( value )
|
||||
int value;
|
||||
|
||||
{
|
||||
void mkdata(int value)
|
||||
{
|
||||
if ( datapos >= NUMDATAITEMS )
|
||||
{
|
||||
putchar( ',' );
|
||||
@@ -601,10 +561,8 @@ int value;
|
||||
*
|
||||
*/
|
||||
|
||||
int myctoi( array )
|
||||
Char array[];
|
||||
|
||||
{
|
||||
int myctoi(Char *array)
|
||||
{
|
||||
int val = 0;
|
||||
|
||||
(void) sscanf( (char *) array, "%d", &val );
|
||||
@@ -621,10 +579,8 @@ Char array[];
|
||||
*
|
||||
*/
|
||||
|
||||
Char myesc( array )
|
||||
Char array[];
|
||||
|
||||
{
|
||||
Char myesc(Char *array)
|
||||
{
|
||||
Char c, esc_char;
|
||||
register int sptr;
|
||||
|
||||
@@ -710,10 +666,8 @@ Char array[];
|
||||
* val = otoi( str );
|
||||
*/
|
||||
|
||||
int otoi( str )
|
||||
Char str[];
|
||||
|
||||
{
|
||||
int otoi(Char *str)
|
||||
{
|
||||
int result;
|
||||
|
||||
(void) sscanf( (char *) str, "%o", &result );
|
||||
@@ -732,10 +686,8 @@ Char str[];
|
||||
* The returned string is in static storage.
|
||||
*/
|
||||
|
||||
char *readable_form( c )
|
||||
register int c;
|
||||
|
||||
{
|
||||
char *readable_form(register int c)
|
||||
{
|
||||
static char rform[10];
|
||||
|
||||
if ( (c >= 0 && c < 32) || c >= 127 )
|
||||
@@ -769,11 +721,8 @@ register int c;
|
||||
|
||||
/* reallocate_array - increase the size of a dynamic array */
|
||||
|
||||
void *reallocate_array( array, size, element_size )
|
||||
void *array;
|
||||
int size, element_size;
|
||||
|
||||
{
|
||||
void *reallocate_array(void *array, int size, int element_size)
|
||||
{
|
||||
register void *new_array;
|
||||
|
||||
/* same worry as in allocate_array(): */
|
||||
@@ -799,9 +748,8 @@ int size, element_size;
|
||||
* Copies from skelfile to stdout until a line beginning with "%%" or
|
||||
* EOF is found.
|
||||
*/
|
||||
void skelout()
|
||||
|
||||
{
|
||||
void skelout(void)
|
||||
{
|
||||
char buf[MAXLINE];
|
||||
|
||||
while ( fgets( buf, MAXLINE, skelfile ) != NULL )
|
||||
@@ -822,10 +770,8 @@ void skelout()
|
||||
* element_n. Formats the output with spaces and carriage returns.
|
||||
*/
|
||||
|
||||
void transition_struct_out( element_v, element_n )
|
||||
int element_v, element_n;
|
||||
|
||||
{
|
||||
void transition_struct_out(int element_v, int element_n)
|
||||
{
|
||||
printf( "%7d, %5d,", element_v, element_n );
|
||||
|
||||
datapos += TRANS_STRUCT_PRINT_LENGTH;
|
||||
|
||||
@@ -45,8 +45,8 @@ static char rcsid[] =
|
||||
|
||||
/* declare functions that have forward references */
|
||||
|
||||
int dupmachine PROTO((int));
|
||||
void mkxtion PROTO((int, int));
|
||||
int dupmachine (int);
|
||||
void mkxtion (int, int);
|
||||
|
||||
|
||||
/* add_accept - add an accepting state to a machine
|
||||
@@ -58,10 +58,8 @@ void mkxtion PROTO((int, int));
|
||||
* accepting_number becomes mach's accepting number.
|
||||
*/
|
||||
|
||||
void add_accept( mach, accepting_number )
|
||||
int mach, accepting_number;
|
||||
|
||||
{
|
||||
void add_accept(int mach, int accepting_number)
|
||||
{
|
||||
/* hang the accepting number off an epsilon state. if it is associated
|
||||
* with a state that has a non-epsilon out-transition, then the state
|
||||
* will accept BEFORE it makes that transition, i.e., one character
|
||||
@@ -91,10 +89,8 @@ int mach, accepting_number;
|
||||
* num - the number of copies of singl to be present in newsng
|
||||
*/
|
||||
|
||||
int copysingl( singl, num )
|
||||
int singl, num;
|
||||
|
||||
{
|
||||
int copysingl(int singl, int num)
|
||||
{
|
||||
int copy, i;
|
||||
|
||||
copy = mkstate( SYM_EPSILON );
|
||||
@@ -113,10 +109,8 @@ int singl, num;
|
||||
* dumpnfa( state1 );
|
||||
*/
|
||||
|
||||
void dumpnfa( state1 )
|
||||
int state1;
|
||||
|
||||
{
|
||||
void dumpnfa(int state1)
|
||||
{
|
||||
int sym, tsp1, tsp2, anum, ns;
|
||||
|
||||
fprintf( stderr, "\n\n********** beginning dump of nfa with start state %d\n",
|
||||
@@ -167,10 +161,8 @@ int state1;
|
||||
* states accessible by the arrays firstst and lastst
|
||||
*/
|
||||
|
||||
int dupmachine( mach )
|
||||
int mach;
|
||||
|
||||
{
|
||||
int dupmachine(int mach)
|
||||
{
|
||||
int i, init, state_offset;
|
||||
int state = 0;
|
||||
int last = lastst[mach];
|
||||
@@ -220,10 +212,8 @@ int mach;
|
||||
* context has variable length.
|
||||
*/
|
||||
|
||||
void finish_rule( mach, variable_trail_rule, headcnt, trailcnt )
|
||||
int mach, variable_trail_rule, headcnt, trailcnt;
|
||||
|
||||
{
|
||||
void finish_rule(int mach, int variable_trail_rule, int headcnt, int trailcnt)
|
||||
{
|
||||
add_accept( mach, num_rules );
|
||||
|
||||
/* we did this in new_rule(), but it often gets the wrong
|
||||
@@ -296,10 +286,8 @@ int mach, variable_trail_rule, headcnt, trailcnt;
|
||||
* FIRST is set to new by the operation. last is unmolested.
|
||||
*/
|
||||
|
||||
int link_machines( first, last )
|
||||
int first, last;
|
||||
|
||||
{
|
||||
int link_machines(int first, int last)
|
||||
{
|
||||
if ( first == NIL )
|
||||
return ( last );
|
||||
|
||||
@@ -331,10 +319,8 @@ int first, last;
|
||||
* The "beginning" states are the epsilon closure of the first state
|
||||
*/
|
||||
|
||||
void mark_beginning_as_normal( mach )
|
||||
register int mach;
|
||||
|
||||
{
|
||||
void mark_beginning_as_normal(register int mach)
|
||||
{
|
||||
switch ( state_type[mach] )
|
||||
{
|
||||
case STATE_NORMAL:
|
||||
@@ -375,10 +361,8 @@ register int mach;
|
||||
* more mkbranch's. Compare with mkor()
|
||||
*/
|
||||
|
||||
int mkbranch( first, second )
|
||||
int first, second;
|
||||
|
||||
{
|
||||
int mkbranch(int first, int second)
|
||||
{
|
||||
int eps;
|
||||
|
||||
if ( first == NO_TRANSITION )
|
||||
@@ -404,10 +388,8 @@ int first, second;
|
||||
* new - a new state which matches the closure of "state"
|
||||
*/
|
||||
|
||||
int mkclos( state )
|
||||
int state;
|
||||
|
||||
{
|
||||
int mkclos(int state)
|
||||
{
|
||||
return ( mkopt( mkposcl( state ) ) );
|
||||
}
|
||||
|
||||
@@ -426,10 +408,8 @@ int state;
|
||||
* 2. mach is destroyed by the call
|
||||
*/
|
||||
|
||||
int mkopt( mach )
|
||||
int mach;
|
||||
|
||||
{
|
||||
int mkopt(int mach)
|
||||
{
|
||||
int eps;
|
||||
|
||||
if ( ! SUPER_FREE_EPSILON(finalst[mach]) )
|
||||
@@ -465,10 +445,8 @@ int mach;
|
||||
* the number of epsilon states needed
|
||||
*/
|
||||
|
||||
int mkor( first, second )
|
||||
int first, second;
|
||||
|
||||
{
|
||||
int mkor(int first, int second)
|
||||
{
|
||||
int eps, orend;
|
||||
|
||||
if ( first == NIL )
|
||||
@@ -526,10 +504,8 @@ int first, second;
|
||||
* new - a machine matching the positive closure of "state"
|
||||
*/
|
||||
|
||||
int mkposcl( state )
|
||||
int state;
|
||||
|
||||
{
|
||||
int mkposcl(int state)
|
||||
{
|
||||
int eps;
|
||||
|
||||
if ( SUPER_FREE_EPSILON(finalst[state]) )
|
||||
@@ -559,10 +535,8 @@ int state;
|
||||
* if "ub" is INFINITY then "new" matches "lb" or more occurrences of "mach"
|
||||
*/
|
||||
|
||||
int mkrep( mach, lb, ub )
|
||||
int mach, lb, ub;
|
||||
|
||||
{
|
||||
int mkrep(int mach, int lb, int ub)
|
||||
{
|
||||
int base_mach, tail, copy, i;
|
||||
|
||||
base_mach = copysingl( mach, lb - 1 );
|
||||
@@ -607,10 +581,8 @@ int mach, lb, ub;
|
||||
* that it admittedly is)
|
||||
*/
|
||||
|
||||
int mkstate( sym )
|
||||
int sym;
|
||||
|
||||
{
|
||||
int mkstate(int sym)
|
||||
{
|
||||
if ( ++lastnfa >= current_mns )
|
||||
{
|
||||
if ( (current_mns += MNS_INCREMENT) >= MAXIMUM_MNS )
|
||||
@@ -679,10 +651,8 @@ int sym;
|
||||
* stateto - the state to which the transition is to be made
|
||||
*/
|
||||
|
||||
void mkxtion( statefrom, stateto )
|
||||
int statefrom, stateto;
|
||||
|
||||
{
|
||||
void mkxtion(int statefrom, int stateto)
|
||||
{
|
||||
if ( trans1[statefrom] == NO_TRANSITION )
|
||||
trans1[statefrom] = stateto;
|
||||
|
||||
@@ -707,9 +677,8 @@ int statefrom, stateto;
|
||||
* arrays (such as rule_type[]) are grown as needed.
|
||||
*/
|
||||
|
||||
void new_rule()
|
||||
|
||||
{
|
||||
void new_rule(void)
|
||||
{
|
||||
if ( ++num_rules >= current_max_rules )
|
||||
{
|
||||
++num_reallocs;
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <osfcn.h>
|
||||
|
||||
/* use prototypes in function declarations */
|
||||
#define YY_USE_PROTOS
|
||||
|
||||
/* the "const" storage-class-modifier is valid */
|
||||
#define YY_USE_CONST
|
||||
|
||||
@@ -40,7 +37,6 @@ void free( void* );
|
||||
#include <stdlib.h>
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#define YY_USE_PROTOS
|
||||
#define YY_USE_CONST
|
||||
|
||||
#endif /* __STDC__ */
|
||||
@@ -57,20 +53,6 @@ void free( void* );
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
#define YY_PROTO(proto) proto
|
||||
#else
|
||||
#define YY_PROTO(proto) ()
|
||||
/* we can't get here if it's an ANSI C compiler, or a C++ compiler,
|
||||
* so it's got to be a K&R compiler, and therefore there's no standard
|
||||
* place from which to include these definitions
|
||||
*/
|
||||
char *malloc();
|
||||
int free();
|
||||
int read();
|
||||
#endif
|
||||
|
||||
|
||||
/* amount of stuff to slurp up with each read */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
@@ -150,7 +132,7 @@ int read();
|
||||
/* default declaration of generated scanner - a define so the user can
|
||||
* easily add parameters
|
||||
*/
|
||||
#define YY_DECL int yylex YY_PROTO(( void ))
|
||||
#define YY_DECL int yylex ( void )
|
||||
|
||||
/* code executed at the end of each rule */
|
||||
#define YY_BREAK break;
|
||||
@@ -985,23 +967,23 @@ static int yy_start = 0; /* start state number */
|
||||
*/
|
||||
static int yy_did_buffer_switch_on_eof;
|
||||
|
||||
static yy_state_type yy_get_previous_state YY_PROTO(( void ));
|
||||
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
|
||||
static int yy_get_next_buffer YY_PROTO(( void ));
|
||||
static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
|
||||
void yyrestart YY_PROTO(( FILE *input_file ));
|
||||
void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
|
||||
void yy_load_buffer_state YY_PROTO(( void ));
|
||||
YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
|
||||
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
|
||||
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
|
||||
static yy_state_type yy_get_previous_state ( void );
|
||||
static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
|
||||
static int yy_get_next_buffer ( void );
|
||||
static void yyunput ( YY_CHAR c, YY_CHAR *buf_ptr );
|
||||
void yyrestart ( FILE *input_file );
|
||||
void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
|
||||
void yy_load_buffer_state ( void );
|
||||
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
|
||||
void yy_delete_buffer ( YY_BUFFER_STATE b );
|
||||
void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
|
||||
|
||||
#define yy_new_buffer yy_create_buffer
|
||||
|
||||
#ifdef __cplusplus
|
||||
static int yyinput YY_PROTO(( void ));
|
||||
static int yyinput ( void );
|
||||
#else
|
||||
static int input YY_PROTO(( void ));
|
||||
static int input ( void );
|
||||
#endif
|
||||
|
||||
YY_DECL
|
||||
@@ -2103,13 +2085,7 @@ static yy_state_type yy_get_previous_state()
|
||||
* next_state = yy_try_NUL_trans( current_state );
|
||||
*/
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
|
||||
#else
|
||||
static yy_state_type yy_try_NUL_trans( yy_current_state )
|
||||
register yy_state_type yy_current_state;
|
||||
#endif
|
||||
|
||||
{
|
||||
register int yy_is_jam;
|
||||
|
||||
@@ -2128,14 +2104,7 @@ register yy_state_type yy_current_state;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
|
||||
#else
|
||||
static void yyunput( c, yy_bp )
|
||||
YY_CHAR c;
|
||||
register YY_CHAR *yy_bp;
|
||||
#endif
|
||||
|
||||
{
|
||||
register YY_CHAR *yy_cp = yy_c_buf_p;
|
||||
|
||||
@@ -2176,7 +2145,7 @@ register YY_CHAR *yy_bp;
|
||||
#ifdef __cplusplus
|
||||
static int yyinput()
|
||||
#else
|
||||
static int input()
|
||||
static int input(void)
|
||||
#endif
|
||||
|
||||
{
|
||||
@@ -2241,26 +2210,14 @@ static int input()
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yyrestart( FILE *input_file )
|
||||
#else
|
||||
void yyrestart( input_file )
|
||||
FILE *input_file;
|
||||
#endif
|
||||
|
||||
{
|
||||
yy_init_buffer( yy_current_buffer, input_file );
|
||||
yy_load_buffer_state();
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
|
||||
#else
|
||||
void yy_switch_to_buffer( new_buffer )
|
||||
YY_BUFFER_STATE new_buffer;
|
||||
#endif
|
||||
|
||||
{
|
||||
if ( yy_current_buffer == new_buffer )
|
||||
return;
|
||||
@@ -2285,12 +2242,7 @@ YY_BUFFER_STATE new_buffer;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_load_buffer_state( void )
|
||||
#else
|
||||
void yy_load_buffer_state()
|
||||
#endif
|
||||
|
||||
{
|
||||
yy_n_chars = yy_current_buffer->yy_n_chars;
|
||||
yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
|
||||
@@ -2299,14 +2251,7 @@ void yy_load_buffer_state()
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
|
||||
#else
|
||||
YY_BUFFER_STATE yy_create_buffer( file, size )
|
||||
FILE *file;
|
||||
int size;
|
||||
#endif
|
||||
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
|
||||
@@ -2331,13 +2276,7 @@ int size;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_delete_buffer( YY_BUFFER_STATE b )
|
||||
#else
|
||||
void yy_delete_buffer( b )
|
||||
YY_BUFFER_STATE b;
|
||||
#endif
|
||||
|
||||
{
|
||||
if ( b == yy_current_buffer )
|
||||
yy_current_buffer = (YY_BUFFER_STATE) 0;
|
||||
@@ -2347,14 +2286,7 @@ YY_BUFFER_STATE b;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
|
||||
#else
|
||||
void yy_init_buffer( b, file )
|
||||
YY_BUFFER_STATE b;
|
||||
FILE *file;
|
||||
#endif
|
||||
|
||||
{
|
||||
b->yy_input_file = file;
|
||||
|
||||
|
||||
@@ -45,14 +45,14 @@ static char rcsid[] =
|
||||
|
||||
/* declare functions that have forward references */
|
||||
|
||||
int hashfunct PROTO((register char[], int));
|
||||
int hashfunct (register char[], int);
|
||||
|
||||
|
||||
struct hash_entry *ndtbl[NAME_TABLE_HASH_SIZE];
|
||||
struct hash_entry *sctbl[START_COND_HASH_SIZE];
|
||||
struct hash_entry *ccltab[CCL_HASH_SIZE];
|
||||
|
||||
struct hash_entry *findsym();
|
||||
struct hash_entry *findsym(register char *sym, struct hash_entry **table, int table_size);
|
||||
|
||||
|
||||
/* addsym - add symbol and definitions to symbol table
|
||||
@@ -67,14 +67,8 @@ struct hash_entry *findsym();
|
||||
* -1 is returned if the symbol already exists, and the change not made.
|
||||
*/
|
||||
|
||||
int addsym( sym, str_def, int_def, table, table_size )
|
||||
register char sym[];
|
||||
char *str_def;
|
||||
int int_def;
|
||||
hash_table table;
|
||||
int table_size;
|
||||
|
||||
{
|
||||
int addsym(register char *sym, char *str_def, int int_def, struct hash_entry **table, int table_size)
|
||||
{
|
||||
int hash_val = hashfunct( sym, table_size );
|
||||
register struct hash_entry *sym_entry = table[hash_val];
|
||||
register struct hash_entry *new_entry;
|
||||
@@ -123,11 +117,8 @@ int table_size;
|
||||
* cclinstal( ccltxt, cclnum );
|
||||
*/
|
||||
|
||||
void cclinstal( ccltxt, cclnum )
|
||||
Char ccltxt[];
|
||||
int cclnum;
|
||||
|
||||
{
|
||||
void cclinstal(Char *ccltxt, int cclnum)
|
||||
{
|
||||
/* we don't bother checking the return status because we are not called
|
||||
* unless the symbol is new
|
||||
*/
|
||||
@@ -146,10 +137,8 @@ int cclnum;
|
||||
* cclval/0 = ccllookup( ccltxt );
|
||||
*/
|
||||
|
||||
int ccllookup( ccltxt )
|
||||
Char ccltxt[];
|
||||
|
||||
{
|
||||
int ccllookup(Char *ccltxt)
|
||||
{
|
||||
return ( findsym( (char *) ccltxt, ccltab, CCL_HASH_SIZE )->int_val );
|
||||
}
|
||||
|
||||
@@ -164,12 +153,8 @@ Char ccltxt[];
|
||||
* sym_entry = findsym( sym, table, table_size );
|
||||
*/
|
||||
|
||||
struct hash_entry *findsym( sym, table, table_size )
|
||||
register char sym[];
|
||||
hash_table table;
|
||||
int table_size;
|
||||
|
||||
{
|
||||
struct hash_entry *findsym(register char *sym, struct hash_entry **table, int table_size)
|
||||
{
|
||||
register struct hash_entry *sym_entry = table[hashfunct( sym, table_size )];
|
||||
static struct hash_entry empty_entry =
|
||||
{
|
||||
@@ -195,11 +180,8 @@ int table_size;
|
||||
* hash_val = hashfunct( str, hash_size );
|
||||
*/
|
||||
|
||||
int hashfunct( str, hash_size )
|
||||
register char str[];
|
||||
int hash_size;
|
||||
|
||||
{
|
||||
int hashfunct(register char *str, int hash_size)
|
||||
{
|
||||
register int hashval;
|
||||
register int locstr;
|
||||
|
||||
@@ -221,11 +203,8 @@ int hash_size;
|
||||
* ndinstal( nd, def );
|
||||
*/
|
||||
|
||||
void ndinstal( nd, def )
|
||||
char nd[];
|
||||
Char def[];
|
||||
|
||||
{
|
||||
void ndinstal(char *nd, Char *def)
|
||||
{
|
||||
char *copy_string();
|
||||
Char *copy_unsigned_string();
|
||||
|
||||
@@ -243,10 +222,8 @@ Char def[];
|
||||
* def/NULL = ndlookup( nd );
|
||||
*/
|
||||
|
||||
Char *ndlookup( nd )
|
||||
char nd[];
|
||||
|
||||
{
|
||||
Char *ndlookup(char *nd)
|
||||
{
|
||||
return ( (Char *) findsym( nd, ndtbl, NAME_TABLE_HASH_SIZE )->str_val );
|
||||
}
|
||||
|
||||
@@ -262,11 +239,8 @@ char nd[];
|
||||
* the start condition is Exclusive if xcluflg is true
|
||||
*/
|
||||
|
||||
void scinstal( str, xcluflg )
|
||||
char str[];
|
||||
int xcluflg;
|
||||
|
||||
{
|
||||
void scinstal(char *str, int xcluflg)
|
||||
{
|
||||
char *copy_string();
|
||||
|
||||
/* bit of a hack. We know how the default start-condition is
|
||||
@@ -316,9 +290,7 @@ int xcluflg;
|
||||
* scnum/0 = sclookup( str );
|
||||
*/
|
||||
|
||||
int sclookup( str )
|
||||
char str[];
|
||||
|
||||
{
|
||||
int sclookup(char *str)
|
||||
{
|
||||
return ( findsym( str, sctbl, START_COND_HASH_SIZE )->int_val );
|
||||
}
|
||||
|
||||
@@ -45,11 +45,11 @@ static char rcsid[] =
|
||||
|
||||
/* declarations for functions that have forward references */
|
||||
|
||||
void mkentry PROTO((register int*, int, int, int, int));
|
||||
void mkprot PROTO((int[], int, int));
|
||||
void mktemplate PROTO((int[], int, int));
|
||||
void mv2front PROTO((int));
|
||||
int tbldiff PROTO((int[], int, int[]));
|
||||
void mkentry (register int*, int, int, int, int);
|
||||
void mkprot (int[], int, int);
|
||||
void mktemplate (int[], int, int);
|
||||
void mv2front (int);
|
||||
int tbldiff (int[], int, int[]);
|
||||
|
||||
|
||||
/* bldtbl - build table entries for dfa state
|
||||
@@ -87,10 +87,8 @@ int tbldiff PROTO((int[], int, int[]));
|
||||
* cost only one difference.
|
||||
*/
|
||||
|
||||
void bldtbl( state, statenum, totaltrans, comstate, comfreq )
|
||||
int state[], statenum, totaltrans, comstate, comfreq;
|
||||
|
||||
{
|
||||
void bldtbl(int *state, int statenum, int totaltrans, int comstate, int comfreq)
|
||||
{
|
||||
int extptr, extrct[2][CSIZE + 1];
|
||||
int mindiff, minprot, i, d;
|
||||
int checkcom;
|
||||
@@ -233,9 +231,8 @@ int state[], statenum, totaltrans, comstate, comfreq;
|
||||
* table entries made for them.
|
||||
*/
|
||||
|
||||
void cmptmps()
|
||||
|
||||
{
|
||||
void cmptmps(void)
|
||||
{
|
||||
int tmpstorage[CSIZE + 1];
|
||||
register int *tmp = tmpstorage, i, j;
|
||||
int totaltrans, trans;
|
||||
@@ -305,9 +302,8 @@ void cmptmps()
|
||||
|
||||
/* expand_nxt_chk - expand the next check arrays */
|
||||
|
||||
void expand_nxt_chk()
|
||||
|
||||
{
|
||||
void expand_nxt_chk(void)
|
||||
{
|
||||
register int old_max = current_max_xpairs;
|
||||
|
||||
current_max_xpairs += MAX_XPAIRS_INCREMENT;
|
||||
@@ -341,10 +337,8 @@ void expand_nxt_chk()
|
||||
* and an action number will be added in [-1].
|
||||
*/
|
||||
|
||||
int find_table_space( state, numtrans )
|
||||
int *state, numtrans;
|
||||
|
||||
{
|
||||
int find_table_space(int *state, int numtrans)
|
||||
{
|
||||
/* firstfree is the position of the first possible occurrence of two
|
||||
* consecutive unused records in the chk and nxt arrays
|
||||
*/
|
||||
@@ -439,9 +433,8 @@ int *state, numtrans;
|
||||
* own tbase/tdef tables. They are shifted down to be contiguous
|
||||
* with the non-template entries during table generation.
|
||||
*/
|
||||
void inittbl()
|
||||
|
||||
{
|
||||
void inittbl(void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
bzero( (char *) chk, current_max_xpairs * sizeof( int ) / sizeof( char ) );
|
||||
@@ -476,9 +469,8 @@ void inittbl()
|
||||
* mkdeftbl();
|
||||
*/
|
||||
|
||||
void mkdeftbl()
|
||||
|
||||
{
|
||||
void mkdeftbl(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
jamstate = lastdfa + 1;
|
||||
@@ -527,11 +519,8 @@ void mkdeftbl()
|
||||
* state array.
|
||||
*/
|
||||
|
||||
void mkentry( state, numchars, statenum, deflink, totaltrans )
|
||||
register int *state;
|
||||
int numchars, statenum, deflink, totaltrans;
|
||||
|
||||
{
|
||||
void mkentry(register int *state, int numchars, int statenum, int deflink, int totaltrans)
|
||||
{
|
||||
register int minec, maxec, i, baseaddr;
|
||||
int tblbase, tbllast;
|
||||
|
||||
@@ -660,10 +649,8 @@ int numchars, statenum, deflink, totaltrans;
|
||||
* mk1tbl( state, sym, onenxt, onedef );
|
||||
*/
|
||||
|
||||
void mk1tbl( state, sym, onenxt, onedef )
|
||||
int state, sym, onenxt, onedef;
|
||||
|
||||
{
|
||||
void mk1tbl(int state, int sym, int onenxt, int onedef)
|
||||
{
|
||||
if ( firstfree < sym )
|
||||
firstfree = sym;
|
||||
|
||||
@@ -693,10 +680,8 @@ int state, sym, onenxt, onedef;
|
||||
* mkprot( state, statenum, comstate );
|
||||
*/
|
||||
|
||||
void mkprot( state, statenum, comstate )
|
||||
int state[], statenum, comstate;
|
||||
|
||||
{
|
||||
void mkprot(int *state, int statenum, int comstate)
|
||||
{
|
||||
int i, slot, tblbase;
|
||||
|
||||
if ( ++numprots >= MSP || numecs * numprots >= PROT_SAVE_SIZE )
|
||||
@@ -737,10 +722,8 @@ int state[], statenum, comstate;
|
||||
* mktemplate( state, statenum, comstate, totaltrans );
|
||||
*/
|
||||
|
||||
void mktemplate( state, statenum, comstate )
|
||||
int state[], statenum, comstate;
|
||||
|
||||
{
|
||||
void mktemplate(int *state, int statenum, int comstate)
|
||||
{
|
||||
int i, numdiff, tmpbase, tmp[CSIZE + 1];
|
||||
Char transset[CSIZE + 1];
|
||||
int tsptr;
|
||||
@@ -795,10 +778,8 @@ int state[], statenum, comstate;
|
||||
* mv2front( qelm );
|
||||
*/
|
||||
|
||||
void mv2front( qelm )
|
||||
int qelm;
|
||||
|
||||
{
|
||||
void mv2front(int qelm)
|
||||
{
|
||||
if ( firstprot != qelm )
|
||||
{
|
||||
if ( qelm == lastprot )
|
||||
@@ -828,10 +809,8 @@ int qelm;
|
||||
* Transnum is the number of out-transitions for the state.
|
||||
*/
|
||||
|
||||
void place_state( state, statenum, transnum )
|
||||
int *state, statenum, transnum;
|
||||
|
||||
{
|
||||
void place_state(int *state, int statenum, int transnum)
|
||||
{
|
||||
register int i;
|
||||
register int *state_ptr;
|
||||
int position = find_table_space( state, transnum );
|
||||
@@ -874,10 +853,8 @@ int *state, statenum, transnum;
|
||||
* no room, we process the sucker right now.
|
||||
*/
|
||||
|
||||
void stack1( statenum, sym, nextstate, deflink )
|
||||
int statenum, sym, nextstate, deflink;
|
||||
|
||||
{
|
||||
void stack1(int statenum, int sym, int nextstate, int deflink)
|
||||
{
|
||||
if ( onesp >= ONE_STACK_SIZE - 1 )
|
||||
mk1tbl( statenum, sym, nextstate, deflink );
|
||||
|
||||
@@ -910,10 +887,8 @@ int statenum, sym, nextstate, deflink;
|
||||
* number is "numecs" minus the number of "SAME_TRANS" entries in "ext".
|
||||
*/
|
||||
|
||||
int tbldiff( state, pr, ext )
|
||||
int state[], pr, ext[];
|
||||
|
||||
{
|
||||
int tbldiff(int *state, int pr, int *ext)
|
||||
{
|
||||
register int i, *sp = state, *ep = ext, *protp;
|
||||
register int numdiff = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user