diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 1997-09-02 12:55:01 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 1997-09-02 12:55:01 +0000 |
commit | 1517cea772058b0fcbe778d05b8b99c7e6f3b25f (patch) | |
tree | a2d817fe623f81b7729ed3cd2e128cad91eca02b /yacc | |
parent | d75918f7e459b507ac6b4b95f14df0a1eedd4937 (diff) | |
download | ocaml-1517cea772058b0fcbe778d05b8b99c7e6f3b25f.tar.gz |
Sources C convertis en ANSI C
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1696 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'yacc')
-rw-r--r-- | yacc/closure.c | 17 | ||||
-rw-r--r-- | yacc/defs.h | 73 | ||||
-rw-r--r-- | yacc/error.c | 115 | ||||
-rw-r--r-- | yacc/lalr.c | 73 | ||||
-rw-r--r-- | yacc/lr0.c | 58 | ||||
-rw-r--r-- | yacc/main.c | 29 | ||||
-rw-r--r-- | yacc/mkpar.c | 45 | ||||
-rw-r--r-- | yacc/output.c | 113 | ||||
-rw-r--r-- | yacc/reader.c | 86 | ||||
-rw-r--r-- | yacc/skeleton.c | 3 | ||||
-rw-r--r-- | yacc/symtab.c | 15 | ||||
-rw-r--r-- | yacc/verbose.c | 53 | ||||
-rw-r--r-- | yacc/warshall.c | 8 |
13 files changed, 303 insertions, 385 deletions
diff --git a/yacc/closure.c b/yacc/closure.c index c47df93a43..46aea248eb 100644 --- a/yacc/closure.c +++ b/yacc/closure.c @@ -28,7 +28,7 @@ void print_EFF (); void print_first_derives (); void print_closure (); -void set_EFF() +void set_EFF(void) { register unsigned *row; register int symbol; @@ -64,7 +64,7 @@ void set_EFF() } -void set_first_derives() +void set_first_derives(void) { register unsigned *rrow; register unsigned *vrow; @@ -121,9 +121,7 @@ void set_first_derives() } -void closure(nucleus, n) - short int *nucleus; - int n; +void closure(short int *nucleus, int n) { register int ruleno; register unsigned word; @@ -196,7 +194,7 @@ void closure(nucleus, n) -void finalize_closure() +void finalize_closure(void) { FREE(itemset); FREE(ruleset); @@ -206,8 +204,7 @@ void finalize_closure() #ifdef DEBUG -void print_closure(n) - int n; +void print_closure(int n) { register short *isp; @@ -217,7 +214,7 @@ void print_closure(n) } -void print_EFF() +void print_EFF(void) { register int i, j, k; register unsigned *rowp; @@ -249,7 +246,7 @@ void print_EFF() } -void print_first_derives() +void print_first_derives(void) { register int i; register int j; diff --git a/yacc/defs.h b/yacc/defs.h index e8543efaa3..d209b71a1b 100644 --- a/yacc/defs.h +++ b/yacc/defs.h @@ -326,27 +326,54 @@ extern short final_state; #define Noreturn #endif -extern char *allocate(); -extern bucket *lookup(); -extern bucket *make_bucket(); -extern action *parse_actions(); -extern action *get_shifts(); -extern action *add_reductions(); -extern action *add_reduce(); -extern void closure (), create_symbol_table (), default_action_error (); -extern void done () Noreturn, entry_without_type (); -extern void fatal (), finalize_closure (); -extern void free_parser (), free_symbol_table (), free_symbols (); -extern void illegal_character (), illegal_token_ref (), lalr (), lr0 (); -extern void make_parser (), no_grammar (), no_space (), open_error (); -extern void output (), over_unionized (), prec_redeclared (), reader (); -extern void reflexive_transitive_closure (), reprec_warning (); -extern void retyped_warning (), revalued_warning (), set_first_derives (); -extern void syntax_error () Noreturn, terminal_lhs (), terminal_start (); -extern void tokenized_start (), too_many_entries (), undefined_goal (); -extern void undefined_symbol_warning (), unexpected_EOF (), unknown_rhs (); -extern void unterminated_action (), unterminated_comment (); -extern void unterminated_string (), unterminated_text (); -extern void unterminated_union (), used_reserved (); -extern void verbose (), write_section (); +extern char *allocate(unsigned int n); +extern bucket *lookup(char *name); +extern bucket *make_bucket(char *name); +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); +extern void closure (short int *nucleus, int n); +extern void create_symbol_table (void); +extern void default_action_error (void); +extern void done (int k) Noreturn; +extern void entry_without_type (char *s); +extern void fatal (char *msg); +extern void finalize_closure (void); +extern void free_parser (void); +extern void free_symbol_table (void); +extern void free_symbols (void); +extern void illegal_character (char *c_cptr); +extern void illegal_token_ref (int i, char *name); +extern void lalr (void); +extern void lr0 (void); +extern void make_parser (void); +extern void no_grammar (void); +extern void no_space (void); +extern void open_error (char *filename); +extern void output (void); +extern void over_unionized (char *u_cptr); +extern void prec_redeclared (void); +extern void reader (void); +extern void reflexive_transitive_closure (unsigned int *R, int n); +extern void reprec_warning (char *s); +extern void retyped_warning (char *s); +extern void revalued_warning (char *s); +extern void set_first_derives (void); +extern void syntax_error (int st_lineno, char *st_line, char *st_cptr) Noreturn, terminal_lhs (int s_lineno); +extern void terminal_start (char *s); +extern void tokenized_start (char *s); +extern void too_many_entries (void); +extern void undefined_goal (char *s); +extern void undefined_symbol_warning (char *s); +extern void unexpected_EOF (void); +extern void unknown_rhs (int i); +extern void unterminated_action (int a_lineno, char *a_line, char *a_cptr); +extern void unterminated_comment (int c_lineno, char *c_line, char *c_cptr); +extern void unterminated_string (int s_lineno, char *s_line, char *s_cptr); +extern void unterminated_text (int t_lineno, char *t_line, char *t_cptr); +extern void unterminated_union (int u_lineno, char *u_line, char *u_cptr); +extern void used_reserved (char *s); +extern void verbose (void); +extern void write_section (char **section); diff --git a/yacc/error.c b/yacc/error.c index f41f861fa4..6a76170f73 100644 --- a/yacc/error.c +++ b/yacc/error.c @@ -17,30 +17,28 @@ #include "defs.h" -void fatal(msg) - char *msg; +void fatal(char *msg) { fprintf(stderr, "%s: f - %s\n", myname, msg); done(2); } -void no_space() +void no_space(void) { fprintf(stderr, "%s: f - out of space\n", myname); done(2); } -void open_error(filename) - char *filename; +void open_error(char *filename) { fprintf(stderr, "%s: f - cannot open \"%s\"\n", myname, filename); done(2); } -void unexpected_EOF() +void unexpected_EOF(void) { fprintf(stderr, "%s: e - line %d of \"%s\", unexpected end-of-file\n", myname, lineno, input_file_name); @@ -48,9 +46,7 @@ void unexpected_EOF() } -void print_pos(st_line, st_cptr) - char *st_line; - char *st_cptr; +void print_pos(char *st_line, char *st_cptr) { register char *s; @@ -75,10 +71,7 @@ void print_pos(st_line, st_cptr) } -void syntax_error(st_lineno, st_line, st_cptr) - int st_lineno; - char *st_line; - char *st_cptr; +void 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); @@ -87,10 +80,7 @@ void syntax_error(st_lineno, st_line, st_cptr) } -void unterminated_comment(c_lineno, c_line, c_cptr) - int c_lineno; - char *c_line; - char *c_cptr; +void 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); @@ -99,10 +89,7 @@ void unterminated_comment(c_lineno, c_line, c_cptr) } -void unterminated_string(s_lineno, s_line, s_cptr) - int s_lineno; - char *s_line; - char *s_cptr; +void 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); @@ -111,10 +98,7 @@ void unterminated_string(s_lineno, s_line, s_cptr) } -void unterminated_text(t_lineno, t_line, t_cptr) - int t_lineno; - char *t_line; - char *t_cptr; +void 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); @@ -123,10 +107,7 @@ void unterminated_text(t_lineno, t_line, t_cptr) } -void unterminated_union(u_lineno, u_line, u_cptr) - int u_lineno; - char *u_line; - char *u_cptr; +void 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); @@ -135,8 +116,7 @@ declaration\n", myname, u_lineno, input_file_name); } -void over_unionized(u_cptr) - char *u_cptr; +void over_unionized(char *u_cptr) { fprintf(stderr, "%s: e - line %d of \"%s\", too many %%union \ declarations\n", myname, lineno, input_file_name); @@ -145,10 +125,7 @@ declarations\n", myname, lineno, input_file_name); } -void illegal_tag(t_lineno, t_line, t_cptr) - int t_lineno; - char *t_line; - char *t_cptr; +void 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); @@ -157,8 +134,7 @@ void illegal_tag(t_lineno, t_line, t_cptr) } -void illegal_character(c_cptr) - char *c_cptr; +void illegal_character(char *c_cptr) { fprintf(stderr, "%s: e - line %d of \"%s\", illegal character\n", myname, lineno, input_file_name); @@ -167,8 +143,7 @@ void illegal_character(c_cptr) } -void used_reserved(s) - char *s; +void 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); @@ -176,8 +151,7 @@ void used_reserved(s) } -void tokenized_start(s) - char *s; +void 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); @@ -185,39 +159,35 @@ declared to be a token\n", myname, lineno, input_file_name, s); } -void retyped_warning(s) - char *s; +void 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); } -void reprec_warning(s) - char *s; +void 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); } -void revalued_warning(s) - char *s; +void 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); } -void terminal_start(s) - char *s; +void terminal_start(char *s) { fprintf(stderr, "%s: e - line %d of \"%s\", the entry point %s is a \ token\n", myname, lineno, input_file_name, s); done(1); } -void too_many_entries() +void too_many_entries(void) { fprintf(stderr, "%s: e - line %d of \"%s\", more than 256 entry points\n", myname, lineno, input_file_name); @@ -225,7 +195,7 @@ void too_many_entries() } -void no_grammar() +void no_grammar(void) { fprintf(stderr, "%s: e - line %d of \"%s\", no grammar has been \ specified\n", myname, lineno, input_file_name); @@ -233,8 +203,7 @@ specified\n", myname, lineno, input_file_name); } -void terminal_lhs(s_lineno) - int s_lineno; +void 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); @@ -242,17 +211,14 @@ of a production\n", myname, s_lineno, input_file_name); } -void prec_redeclared() +void prec_redeclared(void) { fprintf(stderr, "%s: w - line %d of \"%s\", conflicting %%prec \ specifiers\n", myname, lineno, input_file_name); } -void unterminated_action(a_lineno, a_line, a_cptr) - int a_lineno; - char *a_line; - char *a_cptr; +void 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); @@ -261,19 +227,14 @@ void unterminated_action(a_lineno, a_line, a_cptr) } -void dollar_warning(a_lineno, i) - int a_lineno; - int i; +void 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); } -void dollar_error(a_lineno, a_line, a_cptr) - int a_lineno; - char *a_line; - char *a_cptr; +void 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); @@ -282,7 +243,7 @@ void dollar_error(a_lineno, a_line, a_cptr) } -void untyped_lhs() +void untyped_lhs(void) { fprintf(stderr, "%s: e - line %d of \"%s\", $$ is untyped\n", myname, lineno, input_file_name); @@ -290,9 +251,7 @@ void untyped_lhs() } -void untyped_rhs(i, s) - int i; - char *s; +void 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); @@ -300,24 +259,21 @@ void untyped_rhs(i, s) } -void unknown_rhs(i) - int i; +void unknown_rhs(int i) { fprintf(stderr, "%s: e - line %d of \"%s\", $%d is unbound\n", myname, lineno, input_file_name, i); done(1); } -void illegal_token_ref(i, name) - int i; - char *name; +void illegal_token_ref(int i, char *name) { fprintf(stderr, "%s: e - line %d of \"%s\", $%d refers to terminal `%s', which has no argument\n", myname, lineno, input_file_name, i, name); done(1); } -void default_action_error() +void default_action_error(void) { fprintf(stderr, "%s: e - line %d of \"%s\", no action specified for this production\n", myname, lineno, input_file_name); @@ -325,23 +281,20 @@ void default_action_error() } -void undefined_goal(s) - char *s; +void undefined_goal(char *s) { fprintf(stderr, "%s: e - the start symbol %s is undefined\n", myname, s); done(1); } -void undefined_symbol_warning(s) - char *s; +void undefined_symbol_warning(char *s) { fprintf(stderr, "%s: w - the symbol %s is undefined\n", myname, s); } -void entry_without_type(s) - char *s; +void entry_without_type(char *s) { fprintf(stderr, "%s: e - no type has been declared for the start symbol %s\n", diff --git a/yacc/lalr.c b/yacc/lalr.c index b971f11ad9..4349382bf7 100644 --- a/yacc/lalr.c +++ b/yacc/lalr.c @@ -35,7 +35,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; @@ -50,22 +50,22 @@ static int top; -void set_state_table (); -void set_accessing_symbol (); -void set_shift_table (); -void set_reduction_table (); -void set_maxrhs (); -void initialize_LA (); -void set_goto_map (); -void initialize_F (); -void build_relations (); -void compute_FOLLOWS (); -void compute_lookaheads (); -void digraph (); -void add_lookback_edge (); -void traverse (); +void set_state_table (void); +void set_accessing_symbol (void); +void set_shift_table (void); +void set_reduction_table (void); +void set_maxrhs (void); +void initialize_LA (void); +void set_goto_map (void); +void initialize_F (void); +void build_relations (void); +void compute_FOLLOWS (void); +void compute_lookaheads (void); +void digraph (short int **relation); +void add_lookback_edge (int stateno, int ruleno, int gotono); +void traverse (register int i); -void lalr() +void lalr(void) { tokensetsize = WORDSIZE(ntokens); @@ -84,7 +84,7 @@ void lalr() -void set_state_table() +void set_state_table(void) { register core *sp; @@ -95,7 +95,7 @@ void set_state_table() -void set_accessing_symbol() +void set_accessing_symbol(void) { register core *sp; @@ -106,7 +106,7 @@ void set_accessing_symbol() -void set_shift_table() +void set_shift_table(void) { register shifts *sp; @@ -117,7 +117,7 @@ void set_shift_table() -void set_reduction_table() +void set_reduction_table(void) { register reductions *rp; @@ -128,7 +128,7 @@ void set_reduction_table() -void set_maxrhs() +void set_maxrhs(void) { register short *itemp; register short *item_end; @@ -156,7 +156,7 @@ void set_maxrhs() -void initialize_LA() +void initialize_LA(void) { register int i, j, k; register reductions *rp; @@ -193,7 +193,7 @@ void initialize_LA() } -void set_goto_map() +void set_goto_map(void) { register shifts *sp; register int i; @@ -263,9 +263,7 @@ void 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; @@ -291,7 +289,7 @@ map_goto(state, symbol) -void initialize_F() +void initialize_F(void) { register int i; register int j; @@ -368,7 +366,7 @@ void initialize_F() -void build_relations() +void build_relations(void) { register int i; register int j; @@ -460,10 +458,7 @@ void build_relations() } -void add_lookback_edge(stateno, ruleno, gotono) - int stateno; - int ruleno; - int gotono; +void add_lookback_edge(int stateno, int ruleno, int gotono) { register int i, k; register int found; @@ -490,9 +485,7 @@ void add_lookback_edge(stateno, ruleno, gotono) short ** -transpose(R, n) - short int **R; - int n; +transpose(short int **R, int n) { register short **new_R; register short **temp_R; @@ -547,13 +540,13 @@ transpose(R, n) -void compute_FOLLOWS() +void compute_FOLLOWS(void) { digraph(includes); } -void compute_lookaheads() +void compute_lookaheads(void) { register int i, n; register unsigned *fp1, *fp2, *fp3; @@ -587,8 +580,7 @@ void compute_lookaheads() } -void digraph(relation) - short int **relation; +void digraph(short int **relation) { register int i; @@ -614,8 +606,7 @@ void digraph(relation) -void traverse(i) - register int i; +void traverse(register int i) { register unsigned *fp1; register unsigned *fp2; diff --git a/yacc/lr0.c b/yacc/lr0.c index cadf5871c3..4ab245f6cc 100644 --- a/yacc/lr0.c +++ b/yacc/lr0.c @@ -25,8 +25,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; @@ -46,14 +46,14 @@ static short *kernel_items; -void initialize_states (); -void save_reductions (); -void new_itemsets (); -void save_shifts (); +void initialize_states (void); +void save_reductions (void); +void new_itemsets (void); +void save_shifts (void); void print_derives (); -void show_cores (), show_ritems (), show_rrhs (), show_shifts (); +void show_cores (void), show_ritems (void), show_rrhs (void), show_shifts (void); -void allocate_itemsets() +void allocate_itemsets(void) { register short *itemp; register short *item_end; @@ -95,7 +95,7 @@ void allocate_itemsets() } -void allocate_storage() +void allocate_storage(void) { allocate_itemsets(); shiftset = NEW2(nsyms, short); @@ -104,7 +104,7 @@ void allocate_storage() } -void append_states() +void append_states(void) { register int i; register int j; @@ -133,7 +133,7 @@ void append_states() } -void free_storage() +void free_storage(void) { FREE(shift_symbol); FREE(redset); @@ -146,7 +146,7 @@ void free_storage() -void generate_states() +void generate_states(void) { allocate_storage(); itemset = NEW2(nitems, short); @@ -174,8 +174,7 @@ void generate_states() int -get_state(symbol) - int symbol; +get_state(int symbol) { register int key; register short *isp1; @@ -238,7 +237,7 @@ get_state(symbol) -void initialize_states() +void initialize_states(void) { register int i; register short *start_derives; @@ -265,7 +264,7 @@ void initialize_states() } -void new_itemsets() +void new_itemsets(void) { register int i; register int shiftcount; @@ -302,8 +301,7 @@ void new_itemsets() core * -new_state(symbol) - int symbol; +new_state(int symbol) { register int n; register core *p; @@ -342,7 +340,7 @@ new_state(symbol) /* show_cores is used for debugging */ -void show_cores() +void show_cores(void) { core *p; int i, j, k, n; @@ -377,7 +375,7 @@ void show_cores() /* show_ritems is used for debugging */ -void show_ritems() +void show_ritems(void) { int i; @@ -388,7 +386,7 @@ void show_ritems() /* show_rrhs is used for debugging */ -void show_rrhs() +void show_rrhs(void) { int i; @@ -399,7 +397,7 @@ void show_rrhs() /* show_shifts is used for debugging */ -void show_shifts() +void show_shifts(void) { shifts *p; int i, j, k; @@ -417,7 +415,7 @@ void show_shifts() } -void save_shifts() +void save_shifts(void) { register shifts *p; register short *sp1; @@ -451,7 +449,7 @@ void save_shifts() -void save_reductions() +void save_reductions(void) { register short *isp; register short *rp1; @@ -500,7 +498,7 @@ void save_reductions() } -void set_derives() +void set_derives(void) { register int i, k; register int lhs; @@ -530,14 +528,14 @@ void set_derives() #endif } -void free_derives() +void free_derives(void) { FREE(derives[start_symbol]); FREE(derives); } #ifdef DEBUG -void print_derives() +void print_derives(void) { register int i; register short *sp; @@ -559,7 +557,7 @@ void print_derives() #endif -void set_nullable() +void set_nullable(void) { register int i, j; register int empty; @@ -608,13 +606,13 @@ void set_nullable() } -void free_nullable() +void free_nullable(void) { FREE(nullable); } -void lr0() +void lr0(void) { set_derives(); set_nullable(); diff --git a/yacc/main.c b/yacc/main.c index 373f16f33a..f75670611e 100644 --- a/yacc/main.c +++ b/yacc/main.c @@ -88,12 +88,11 @@ char *rassoc; short **derives; char *nullable; -extern char *mktemp(); -extern char *getenv(); +extern char *mktemp(char *); +extern char *getenv(const char *); -void done(k) - int k; +void done(int k) { if (action_file) { fclose(action_file); unlink(action_file_name); } if (entry_file) { fclose(entry_file); unlink(entry_file_name); } @@ -109,14 +108,13 @@ void done(k) } -void onintr(dummy) - int dummy; +void onintr(int dummy) { done(1); } -void set_signals() +void set_signals(void) { #ifdef SIGINT if (signal(SIGINT, SIG_IGN) != SIG_IGN) @@ -133,16 +131,14 @@ void set_signals() } -void usage() +void usage(void) { fprintf(stderr, "usage: %s [-v] [-b file_prefix] filename\n", myname); exit(1); } -void getargs(argc, argv) - int argc; - char **argv; +void getargs(int argc, char **argv) { register int i; register char *s; @@ -219,8 +215,7 @@ no_more_options:; char * -allocate(n) - unsigned int n; +allocate(unsigned int n) { register char *p; @@ -234,7 +229,7 @@ allocate(n) } -void create_file_names() +void create_file_names(void) { int i, len; char *tmpdir; @@ -321,7 +316,7 @@ void create_file_names() } -void open_files() +void open_files(void) { create_file_names(); @@ -384,9 +379,7 @@ void open_files() int volatile have_to_interact; #endif -void main(argc, argv) - int argc; - char **argv; +void main(int argc, char **argv) { #if macintosh rotatecursor_init (&have_to_interact, NULL); diff --git a/yacc/mkpar.c b/yacc/mkpar.c index 4182a8e741..b95ff6579d 100644 --- a/yacc/mkpar.c +++ b/yacc/mkpar.c @@ -29,13 +29,13 @@ short final_state; static int SRcount; static int RRcount; -void find_final_state (); -void remove_conflicts (); -void unused_rules (); -void total_conflicts (); -void defreds (); +void find_final_state (void); +void remove_conflicts (void); +void unused_rules (void); +void total_conflicts (void); +void defreds (void); -void make_parser() +void make_parser(void) { register int i; @@ -52,8 +52,7 @@ void make_parser() action * -parse_actions(stateno) - register int stateno; +parse_actions(register int stateno) { register action *actions; @@ -64,8 +63,7 @@ parse_actions(stateno) action * -get_shifts(stateno) - int stateno; +get_shifts(int stateno) { register action *actions, *temp; register shifts *sp; @@ -99,9 +97,7 @@ get_shifts(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; @@ -125,10 +121,7 @@ add_reductions(stateno, actions) action * -add_reduce(actions, ruleno, symbol) - register action *actions; - register int ruleno; - register int symbol; +add_reduce(register action *actions, register int ruleno, register int symbol) { register action *temp, *prev, *next; @@ -166,7 +159,7 @@ add_reduce(actions, ruleno, symbol) } -void find_final_state() +void find_final_state(void) { register int goal, i; register short *to_state; @@ -183,7 +176,7 @@ void find_final_state() } -void unused_rules() +void unused_rules(void) { register int i; register action *p; @@ -215,7 +208,7 @@ void unused_rules() } -void remove_conflicts() +void remove_conflicts(void) { register int i; register int symbol; @@ -291,7 +284,7 @@ void remove_conflicts() } -void total_conflicts() +void total_conflicts(void) { if (SRtotal == 1) fprintf(stderr, "1 shift/reduce conflict"); @@ -311,8 +304,7 @@ void total_conflicts() int -sole_reduction(stateno) - int stateno; +sole_reduction(int stateno) { register int count, ruleno; register action *p; @@ -339,7 +331,7 @@ sole_reduction(stateno) } -void defreds() +void defreds(void) { register int i; @@ -348,8 +340,7 @@ void defreds() defred[i] = sole_reduction(i); } -void free_action_row(p) - register action *p; +void free_action_row(register action *p) { register action *q; @@ -361,7 +352,7 @@ void free_action_row(p) } } -void free_parser() +void free_parser(void) { register int i; diff --git a/yacc/output.c b/yacc/output.c index a4b2366777..e3ee420a32 100644 --- a/yacc/output.c +++ b/yacc/output.c @@ -32,32 +32,32 @@ static int lowzero; static int high; -void free_itemsets (); -void free_shifts (); -void free_reductions (); -void output_stored_text (); -void output_transl (); -void output_rule_data (); -void output_yydefred (); -void output_actions (); -void output_debug (); -void output_trailing_text (); -void output_semantic_actions (); -void output_entries (); -void token_actions (); -void goto_actions (); -void sort_actions (); -void pack_table (); -void output_base (); -void output_table (); -void output_check (); -int default_goto (); -void save_column (); -int matching_vector (); -int pack_vector (); - - -void output() +void free_itemsets (void); +void free_shifts (void); +void free_reductions (void); +void output_stored_text (void); +void output_transl (void); +void output_rule_data (void); +void output_yydefred (void); +void output_actions (void); +void output_debug (void); +void output_trailing_text (void); +void output_semantic_actions (void); +void output_entries (void); +void token_actions (void); +void goto_actions (void); +void sort_actions (void); +void pack_table (void); +void output_base (void); +void output_table (void); +void output_check (void); +int default_goto (int symbol); +void save_column (int symbol, int default_state); +int matching_vector (int vector); +int pack_vector (int vector); + + +void output(void) { extern char *header[], *define_tables[]; @@ -88,8 +88,7 @@ void output() } -static void output_char(n) - unsigned int n; +static void output_char(unsigned int n) { n = n & 0xFF; putc('\\', output_file); @@ -98,14 +97,13 @@ static void output_char(n) putc('0' + n % 10, output_file); } -static void output_short(n) - int n; +static void output_short(int n) { output_char(n); output_char(n >> 8); } -void output_rule_data() +void output_rule_data(void) { register int i; register int j; @@ -153,7 +151,7 @@ void output_rule_data() } -void output_yydefred() +void output_yydefred(void) { register int i, j; @@ -180,7 +178,7 @@ void output_yydefred() } -void output_actions() +void output_actions(void) { nvectors = 2*nstates + nvars; @@ -208,7 +206,7 @@ void output_actions() } -void token_actions() +void token_actions(void) { register int i, j; register int shiftcount, reducecount; @@ -292,7 +290,7 @@ void token_actions() FREE(actionrow); } -void goto_actions() +void goto_actions(void) { register int i, j, k; @@ -327,8 +325,7 @@ void goto_actions() } int -default_goto(symbol) - int symbol; +default_goto(int symbol) { register int i; register int m; @@ -363,9 +360,7 @@ default_goto(symbol) -void save_column(symbol, default_state) - int symbol; - int default_state; +void save_column(int symbol, int default_state) { register int i; register int m; @@ -405,7 +400,7 @@ void save_column(symbol, default_state) width[symno] = sp1[-1] - sp[0] + 1; } -void sort_actions() +void sort_actions(void) { register int i; register int j; @@ -440,7 +435,7 @@ void sort_actions() } -void pack_table() +void pack_table(void) { register int i; register int place; @@ -503,8 +498,7 @@ void pack_table() /* order. */ int -matching_vector(vector) - int vector; +matching_vector(int vector) { register int i; register int j; @@ -544,8 +538,7 @@ matching_vector(vector) int -pack_vector(vector) - int vector; +pack_vector(int vector) { register int i, j, k, l; register int t; @@ -621,7 +614,7 @@ pack_vector(vector) -void output_base() +void output_base(void) { register int i, j; @@ -692,7 +685,7 @@ void output_base() -void output_table() +void output_table(void) { register int i; register int j; @@ -724,7 +717,7 @@ void output_table() -void output_check() +void output_check(void) { register int i; register int j; @@ -753,7 +746,7 @@ void output_check() } -void output_transl() +void output_transl(void) { int i; @@ -773,7 +766,7 @@ void output_transl() fprintf(code_file, " 0|]\n\n"); } -void output_stored_text() +void output_stored_text(void) { register int c; register FILE *in, *out; @@ -800,11 +793,11 @@ void output_stored_text() } -void output_debug() +void output_debug(void) { } -void output_trailing_text() +void output_trailing_text(void) { register int c, last; register FILE *in, *out; @@ -861,9 +854,7 @@ void output_trailing_text() } -void copy_file(file, file_name) - FILE **file; - char *file_name; +void copy_file(FILE **file, char *file_name) { register int c, last; register FILE *out; @@ -897,17 +888,17 @@ void copy_file(file, file_name) } -void output_semantic_actions() +void output_semantic_actions(void) { copy_file (&action_file, action_file_name); } -void output_entries() +void output_entries(void) { copy_file (&entry_file, entry_file_name); } -void free_itemsets() +void free_itemsets(void) { register core *cp, *next; @@ -920,7 +911,7 @@ void free_itemsets() } -void free_shifts() +void free_shifts(void) { register shifts *sp, *next; @@ -934,7 +925,7 @@ void free_shifts() -void free_reductions() +void free_reductions(void) { register reductions *rp, *next; diff --git a/yacc/reader.c b/yacc/reader.c index 9b7bd6a211..f1c21202c6 100644 --- a/yacc/reader.c +++ b/yacc/reader.c @@ -51,10 +51,9 @@ char line_format[] = "(* Line %d, file %s *)\n"; -void start_rule (); +void start_rule (register bucket *bp, int s_lineno); -void cachec(c) - int c; +void cachec(int c) { assert(cinc >= 0); if (cinc >= cache_size) @@ -68,7 +67,7 @@ void cachec(c) } -void get_line() +void get_line(void) { register FILE *f = input_file; register int c; @@ -109,7 +108,7 @@ void get_line() char * -dup_line() +dup_line(void) { register char *p, *s, *t; @@ -126,7 +125,7 @@ dup_line() } -void skip_comment() +void skip_comment(void) { register char *s; @@ -157,7 +156,7 @@ void skip_comment() int -nextc() +nextc(void) { register char *s; @@ -219,7 +218,7 @@ nextc() int -keyword() +keyword(void) { register int c; char *t_cptr = cptr; @@ -282,7 +281,7 @@ keyword() } -void copy_ident() +void copy_ident(void) { register int c; register FILE *f = output_file; @@ -311,7 +310,7 @@ void copy_ident() } -void copy_text() +void copy_text(void) { register int c; int quote; @@ -443,7 +442,7 @@ loop: } -void copy_union() +void copy_union(void) { register int c; int quote; @@ -564,8 +563,7 @@ loop: int -hexval(c) - int c; +hexval(int c) { if (c >= '0' && c <= '9') return (c - '0'); @@ -578,7 +576,7 @@ hexval(c) bucket * -get_literal() +get_literal(void) { register int c, quote; register int i; @@ -717,8 +715,7 @@ get_literal() int -is_reserved(name) - char *name; +is_reserved(char *name) { char *s; @@ -739,7 +736,7 @@ is_reserved(name) bucket * -get_name() +get_name(void) { register int c; @@ -755,7 +752,7 @@ get_name() int -get_number() +get_number(void) { register int c; register int n; @@ -769,7 +766,7 @@ get_number() char * -get_tag() +get_tag(void) { register int c; register int i; @@ -811,8 +808,7 @@ get_tag() } -void declare_tokens(assoc) - int assoc; +void declare_tokens(int assoc) { register int c; register bucket *bp; @@ -878,7 +874,7 @@ void declare_tokens(assoc) } -void declare_types() +void declare_types(void) { register int c; register bucket *bp; @@ -906,7 +902,7 @@ void declare_types() } -void declare_start() +void declare_start(void) { register int c; register bucket *bp; @@ -926,7 +922,7 @@ void declare_start() } -void read_declarations() +void read_declarations(void) { register int c, k; @@ -974,7 +970,7 @@ void read_declarations() } } -void output_token_type() +void output_token_type(void) { bucket * bp; int n; @@ -1001,7 +997,7 @@ void output_token_type() fprintf(output_file, "\n"); } -void initialize_grammar() +void initialize_grammar(void) { nitems = 4; maxitems = 300; @@ -1032,7 +1028,7 @@ void initialize_grammar() } -void expand_items() +void expand_items(void) { maxitems += 300; pitem = (bucket **) REALLOC(pitem, maxitems*sizeof(bucket *)); @@ -1040,7 +1036,7 @@ void expand_items() } -void expand_rules() +void expand_rules(void) { maxrules += 100; plhs = (bucket **) REALLOC(plhs, maxrules*sizeof(bucket *)); @@ -1052,7 +1048,7 @@ void expand_rules() } -void advance_to_start() +void advance_to_start(void) { register int c; register bucket *bp; @@ -1104,9 +1100,7 @@ void advance_to_start() int at_first; -void start_rule(bp, s_lineno) - register bucket *bp; - int s_lineno; +void start_rule(register bucket *bp, int s_lineno) { if (bp->class == TERM) terminal_lhs(s_lineno); @@ -1120,7 +1114,7 @@ void start_rule(bp, s_lineno) } -void end_rule() +void end_rule(void) { if (!last_was_action) default_action_error(); @@ -1132,7 +1126,7 @@ void end_rule() } -void insert_empty_rule() +void insert_empty_rule(void) { register bucket *bp, **bpp; @@ -1161,7 +1155,7 @@ void insert_empty_rule() } -void add_symbol() +void add_symbol(void) { register int c; register bucket *bp; @@ -1192,7 +1186,7 @@ void add_symbol() } -void copy_action() +void copy_action(void) { register int c; register int i, n; @@ -1378,7 +1372,7 @@ loop: int -mark_symbol() +mark_symbol(void) { register int c; register bucket *bp; @@ -1421,7 +1415,7 @@ mark_symbol() } -void read_grammar() +void read_grammar(void) { register int c; @@ -1459,7 +1453,7 @@ void read_grammar() } -void free_tags() +void free_tags(void) { register int i; @@ -1474,7 +1468,7 @@ void free_tags() } -void pack_names() +void pack_names(void) { register bucket *bp; register char *p, *s, *t; @@ -1499,7 +1493,7 @@ void pack_names() } -void check_symbols() +void check_symbols(void) { register bucket *bp; @@ -1517,7 +1511,7 @@ void check_symbols() } -void pack_symbols() +void pack_symbols(void) { register bucket *bp; register bucket **v; @@ -1653,7 +1647,7 @@ void pack_symbols() } -void make_goal() +void make_goal(void) { static char name[7] = "'\\xxx'"; bucket * bp; @@ -1699,7 +1693,7 @@ void make_goal() } } -void pack_grammar() +void pack_grammar(void) { register int i, j; int assoc, prec; @@ -1758,7 +1752,7 @@ void pack_grammar() } -void print_grammar() +void print_grammar(void) { register int i, j, k; int spacing = 0; @@ -1794,7 +1788,7 @@ void print_grammar() } -void reader() +void reader(void) { create_symbol_table(); read_declarations(); diff --git a/yacc/skeleton.c b/yacc/skeleton.c index 72b039ad88..a819edf172 100644 --- a/yacc/skeleton.c +++ b/yacc/skeleton.c @@ -41,8 +41,7 @@ char *define_tables[] = 0 }; -void write_section(section) - char **section; +void write_section(char **section) { register int i; register FILE *fp; diff --git a/yacc/symtab.c b/yacc/symtab.c index 4cf7e6beea..0847f83093 100644 --- a/yacc/symtab.c +++ b/yacc/symtab.c @@ -23,8 +23,7 @@ bucket *last_symbol; int -hash(name) - char *name; +hash(char *name) { register char *s; register int c, k; @@ -40,8 +39,7 @@ hash(name) bucket * -make_bucket(name) - char *name; +make_bucket(char *name) { register bucket *bp; @@ -69,8 +67,7 @@ make_bucket(name) bucket * -lookup(name) - char *name; +lookup(char *name) { register bucket *bp, **bpp; @@ -92,7 +89,7 @@ lookup(name) } -void create_symbol_table() +void create_symbol_table(void) { register int i; register bucket *bp; @@ -112,14 +109,14 @@ void create_symbol_table() } -void free_symbol_table() +void free_symbol_table(void) { FREE(symbol_table); symbol_table = 0; } -void free_symbols() +void free_symbols(void) { register bucket *p, *q; diff --git a/yacc/verbose.c b/yacc/verbose.c index c7a2f895fe..7da35f1bcc 100644 --- a/yacc/verbose.c +++ b/yacc/verbose.c @@ -20,18 +20,18 @@ static short *null_rules; -void print_state (); -void log_unused (); -void log_conflicts (); -void print_conflicts (); -void print_core (); -void print_nulls (); -void print_actions (); -void print_shifts (); -void print_reductions (); -void print_gotos (); - -void verbose() +void print_state (int state); +void log_unused (void); +void log_conflicts (void); +void print_conflicts (int state); +void print_core (int state); +void print_nulls (int state); +void print_actions (int stateno); +void print_shifts (register action *p); +void print_reductions (register action *p, register int defred); +void print_gotos (int stateno); + +void verbose(void) { register int i; @@ -55,7 +55,7 @@ void verbose() } -void log_unused() +void log_unused(void) { register int i; register short *p; @@ -74,7 +74,7 @@ void log_unused() } -void log_conflicts() +void log_conflicts(void) { register int i; @@ -102,8 +102,7 @@ void log_conflicts() } -void print_state(state) - int state; +void print_state(int state) { if (state) fprintf(verbose_file, "\n\n"); @@ -116,8 +115,7 @@ void print_state(state) } -void print_conflicts(state) - int state; +void print_conflicts(int state) { register int symbol, act, number; register action *p; @@ -166,8 +164,7 @@ void print_conflicts(state) } -void print_core(state) - int state; +void print_core(int state) { register int i; register int k; @@ -202,8 +199,7 @@ void print_core(state) } -void print_nulls(state) - int state; +void print_nulls(int state) { register action *p; register int i, j, k, nnulls; @@ -246,8 +242,7 @@ void print_nulls(state) } -void print_actions(stateno) - int stateno; +void print_actions(int stateno) { register action *p; register shifts *sp; @@ -273,8 +268,7 @@ void print_actions(stateno) } -void print_shifts(p) - register action *p; +void print_shifts(register action *p) { register int count; register action *q; @@ -298,9 +292,7 @@ void print_shifts(p) } -void print_reductions(p, defred) - register action *p; - register int defred; +void print_reductions(register action *p, register int defred) { register int k, anyreds; register action *q; @@ -336,8 +328,7 @@ void print_reductions(p, defred) } -void print_gotos(stateno) - int stateno; +void print_gotos(int stateno) { register int i, k; register int as; diff --git a/yacc/warshall.c b/yacc/warshall.c index e9be403ca2..ce321bc0c6 100644 --- a/yacc/warshall.c +++ b/yacc/warshall.c @@ -15,9 +15,7 @@ #include "defs.h" -void transitive_closure(R, n) - unsigned int *R; - int n; +void transitive_closure(unsigned int *R, int n) { register int rowsize; register unsigned mask; @@ -68,9 +66,7 @@ void transitive_closure(R, n) } } -void reflexive_transitive_closure(R, n) - unsigned int *R; - int n; +void reflexive_transitive_closure(unsigned int *R, int n) { register int rowsize; register unsigned mask; |