- ansi prototypes

- sprinkle static
No functional change (just smaller binary because of unused functions)
This commit is contained in:
christos 2006-05-24 18:01:43 +00:00
parent 42df83a697
commit 8d1d34adc0
13 changed files with 559 additions and 640 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: closure.c,v 1.7 2003/08/07 11:17:52 agc Exp $ */
/* $NetBSD: closure.c,v 1.8 2006/05/24 18:01:43 christos Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)closure.c 5.3 (Berkeley) 5/24/93";
#else
__RCSID("$NetBSD: closure.c,v 1.7 2003/08/07 11:17:52 agc Exp $");
__RCSID("$NetBSD: closure.c,v 1.8 2006/05/24 18:01:43 christos Exp $");
#endif
#endif /* not lint */
@ -50,10 +50,10 @@ unsigned *ruleset;
static unsigned *first_derives;
static unsigned *EFF;
void set_EFF __P((void));
static void set_EFF(void);
void
set_EFF()
static void
set_EFF(void)
{
unsigned *row;
int symbol;
@ -90,7 +90,7 @@ set_EFF()
void
set_first_derives()
set_first_derives(void)
{
unsigned *rrow;
unsigned *vrow;
@ -148,9 +148,7 @@ set_first_derives()
void
closure(nucleus, n)
short *nucleus;
int n;
closure(short *nucleus, int n)
{
int ruleno;
unsigned word;
@ -218,7 +216,7 @@ int n;
void
finalize_closure()
finalize_closure(void)
{
FREE(itemset);
FREE(ruleset);
@ -228,8 +226,8 @@ finalize_closure()
#ifdef DEBUG
print_closure(n)
int n;
void
print_closure(int n)
{
short *isp;
@ -239,7 +237,8 @@ int n;
}
print_EFF()
void
print_EFF(void)
{
int i, j;
unsigned *rowp;
@ -270,7 +269,8 @@ print_EFF()
}
print_first_derives()
void
print_first_derives(void)
{
int i;
int j;

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.14 2006/05/03 18:08:24 christos Exp $ */
/* $NetBSD: defs.h,v 1.15 2006/05/24 18:01:43 christos Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -65,8 +65,8 @@
#define MINSHORT -32768
#define MAXTABLE 32500
#define BITS_PER_WORD 32
#define WORDSIZE(n) (((n)+(BITS_PER_WORD-1))/BITS_PER_WORD)
#define BIT(r, n) ((((r)[(n)>>5])>>((n)&31))&1)
#define WORDSIZE(n) (((n)+(BITS_PER_WORD-1)/BITS_PER_WORD))
#define BIT(r, n) ((((r)[(n)>>5])>>((n)&31)&1))
#define SETBIT(r, n) ((r)[(n)>>5]|=((unsigned)1<<((n)&31)))
@ -312,61 +312,68 @@ extern short final_state;
/* global functions */
extern char *allocate __P((unsigned));
extern bucket *lookup __P((char *));
extern bucket *make_bucket __P((char *));
extern char *allocate(unsigned);
extern bucket *lookup(char *);
extern bucket *make_bucket(char *);
extern void set_first_derives __P((void));
extern void closure __P((short *, int));
extern void finalize_closure __P((void));
extern void set_first_derives(void);
extern void closure(short *, int);
extern void finalize_closure(void);
extern __dead void fatal __P((char *));
extern __dead void fatal(char *) __attribute__((__noreturn__));
extern void reflexive_transitive_closure __P((unsigned *, int));
extern __dead void done __P((int));
extern void reflexive_transitive_closure(unsigned *, int);
extern __dead void done(int) __attribute__((__noreturn__));
extern __dead void no_space __P((void));
extern __dead void open_error(char *);
extern __dead void unexpected_EOF __P((void));
extern void print_pos __P((char *, char *));
extern __dead void syntax_error __P((int, char *, char *));
extern __dead void unterminated_comment __P((int, char *, char *));
extern __dead void unterminated_string __P((int, char *, char *));
extern __dead void unterminated_text __P((int, char *, char *));
extern __dead void unterminated_union __P((int, char *, char *));
extern __dead void over_unionized __P((char *));
extern void illegal_tag __P((int, char *, char *));
extern void illegal_character __P((char *));
extern void used_reserved __P((char *));
extern void tokenized_start __P((char *));
extern void retyped_warning __P((char *));
extern void reprec_warning __P((char *));
extern void revalued_warning __P((char *));
extern __dead void terminal_start __P((char *));
extern void restarted_warning __P((void));
extern __dead void no_grammar __P((void));
extern __dead void terminal_lhs __P((int));
extern void prec_redeclared __P((void));
extern __dead void unterminated_action __P((int, char *, char *));
extern void dollar_warning __P((int, int));
extern __dead void dollar_error __P((int, char *, char *));
extern __dead void untyped_lhs __P((void));
extern __dead void untyped_rhs __P((int, char *));
extern __dead void unknown_rhs __P((int));
extern void default_action_warning __P((void));
extern __dead void undefined_goal __P((char *));
extern void undefined_symbol_warning __P((char *));
extern __dead void no_space(void) __attribute__((__noreturn__));
extern __dead void open_error(char *) __attribute__((__noreturn__));
extern __dead void unexpected_EOF(void) __attribute__((__noreturn__));
extern void print_pos(char *, char *);
extern __dead void syntax_error(int, char *, char *)
__attribute__((__noreturn__));
extern __dead void unterminated_comment(int, char *, char *)
__attribute__((__noreturn__));
extern __dead void unterminated_string(int, char *, char *)
__attribute__((__noreturn__));
extern __dead void unterminated_text(int, char *, char *)
__attribute__((__noreturn__));
extern __dead void unterminated_union(int, char *, char *)
__attribute__((__noreturn__));
extern __dead void over_unionized(char *) __attribute__((__noreturn__));
extern void illegal_tag(int, char *, char *);
extern void illegal_character(char *);
extern void used_reserved(char *);
extern void tokenized_start(char *);
extern void retyped_warning(char *);
extern void reprec_warning(char *);
extern void revalued_warning(char *);
extern __dead void terminal_start(char *) __attribute__((__noreturn__));
extern void restarted_warning(void);
extern __dead void no_grammar(void) __attribute__((__noreturn__));
extern __dead void terminal_lhs(int) __attribute__((__noreturn__));
extern void prec_redeclared(void);
extern __dead void unterminated_action(int, char *, char *)
__attribute__((__noreturn__));
extern void dollar_warning(int, int);
extern __dead void dollar_error(int, char *, char *)
__attribute__((__noreturn__));
extern __dead void untyped_lhs(void) __attribute__((__noreturn__));
extern __dead void untyped_rhs(int, char *) __attribute__((__noreturn__));
extern __dead void unknown_rhs(int) __attribute__((__noreturn__));
extern void default_action_warning(void);
extern __dead void undefined_goal(char *) __attribute__((__noreturn__));
extern void undefined_symbol_warning(char *);
extern void lalr __P((void));
extern void lalr(void);
extern void reader __P((void));
extern void lr0 __P((void));
extern void make_parser __P((void));
extern void verbose __P((void));
extern void output __P((void));
extern void free_parser __P((void));
extern void write_section __P((const char * const []));
extern void reader(void);
extern void lr0(void);
extern void make_parser(void);
extern void verbose(void);
extern void output(void);
extern void free_parser(void);
extern void write_section(const char * const []);
extern void create_symbol_table __P((void));
extern void free_symbol_table __P((void));
extern void free_symbols __P((void));
extern void create_symbol_table(void);
extern void free_symbol_table(void);
extern void free_symbols(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: error.c,v 1.9 2006/05/03 18:08:24 christos Exp $ */
/* $NetBSD: error.c,v 1.10 2006/05/24 18:01:43 christos Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)error.c 5.3 (Berkeley) 6/1/90";
#else
__RCSID("$NetBSD: error.c,v 1.9 2006/05/03 18:08:24 christos Exp $");
__RCSID("$NetBSD: error.c,v 1.10 2006/05/24 18:01:43 christos Exp $");
#endif
#endif /* not lint */
@ -46,8 +46,7 @@ __RCSID("$NetBSD: error.c,v 1.9 2006/05/03 18:08:24 christos Exp $");
#include "defs.h"
__dead void
fatal(msg)
char *msg;
fatal(char *msg)
{
fprintf(stderr, "%s: f - %s\n", myname, msg);
done(2);
@ -55,22 +54,21 @@ char *msg;
__dead void
no_space()
no_space(void)
{
fprintf(stderr, "%s: f - out of space\n", myname);
done(2);
}
__dead void
open_error(filename)
char *filename;
open_error(char *filename)
{
fprintf(stderr, "%s: f - cannot open \"%s\"\n", myname, filename);
done(2);
}
__dead void
unexpected_EOF()
unexpected_EOF(void)
{
fprintf(stderr, "%s: e - line %d of \"%s\", unexpected end-of-file\n",
myname, lineno, input_file_name);
@ -78,9 +76,7 @@ unexpected_EOF()
}
void
print_pos(st_line, st_cptr)
char *st_line;
char *st_cptr;
print_pos(char *st_line, char *st_cptr)
{
char *s;
@ -105,10 +101,7 @@ char *st_cptr;
}
__dead void
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);
@ -117,10 +110,7 @@ char *st_cptr;
}
__dead void
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);
@ -129,10 +119,7 @@ char *c_cptr;
}
__dead void
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);
@ -141,10 +128,7 @@ char *s_cptr;
}
__dead void
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);
@ -153,10 +137,7 @@ char *t_cptr;
}
__dead void
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);
@ -165,8 +146,7 @@ declaration\n", myname, u_lineno, input_file_name);
}
__dead void
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);
@ -175,10 +155,7 @@ declarations\n", myname, lineno, input_file_name);
}
__dead void
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);
@ -187,8 +164,7 @@ char *t_cptr;
}
__dead void
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);
@ -197,8 +173,7 @@ char *c_cptr;
}
__dead void
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);
@ -206,8 +181,7 @@ char *s;
}
__dead void
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);
@ -215,32 +189,28 @@ declared to be a token\n", myname, lineno, input_file_name, s);
}
void
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);
}
void
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);
}
void
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);
}
__dead void
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);
@ -248,14 +218,14 @@ token\n", myname, lineno, input_file_name, s);
}
void
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);
}
__dead void
no_grammar()
no_grammar(void)
{
fprintf(stderr, "%s: e - line %d of \"%s\", no grammar has been \
specified\n", myname, lineno, input_file_name);
@ -263,8 +233,7 @@ specified\n", myname, lineno, input_file_name);
}
__dead void
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);
@ -272,17 +241,14 @@ of a production\n", myname, s_lineno, input_file_name);
}
void
prec_redeclared()
prec_redeclared(void)
{
fprintf(stderr, "%s: w - line %d of \"%s\", conflicting %%prec \
specifiers\n", myname, lineno, input_file_name);
}
__dead void
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);
@ -291,19 +257,14 @@ char *a_cptr;
}
void
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);
}
__dead void
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);
@ -312,7 +273,7 @@ char *a_cptr;
}
__dead void
untyped_lhs()
untyped_lhs(void)
{
fprintf(stderr, "%s: e - line %d of \"%s\", $$ is untyped\n",
myname, lineno, input_file_name);
@ -320,9 +281,7 @@ untyped_lhs()
}
__dead void
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);
@ -330,8 +289,7 @@ char *s;
}
__dead void
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);
@ -339,23 +297,21 @@ int i;
}
void
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);
}
__dead void
undefined_goal(s)
char *s;
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;
undefined_symbol_warning(char *s)
{
fprintf(stderr, "%s: w - the symbol %s is undefined\n", myname, s);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lalr.c,v 1.8 2003/08/07 11:17:53 agc Exp $ */
/* $NetBSD: lalr.c,v 1.9 2006/05/24 18:01:43 christos Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)lalr.c 5.3 (Berkeley) 6/1/90";
#else
__RCSID("$NetBSD: lalr.c,v 1.8 2003/08/07 11:17:53 agc Exp $");
__RCSID("$NetBSD: lalr.c,v 1.9 2006/05/24 18:01:43 christos Exp $");
#endif
#endif /* not lint */
@ -63,23 +63,23 @@ short *goto_map;
short *from_state;
short *to_state;
short **transpose(short **, int);
void set_state_table __P((void));
void set_accessing_symbol __P((void));
void set_shift_table __P((void));
void set_reduction_table __P((void));
void set_maxrhs __P((void));
void initialize_LA __P((void));
void set_goto_map __P((void));
void initialize_F __P((void));
void build_relations __P((void));
void compute_FOLLOWS __P((void));
void compute_lookaheads __P((void));
static short **transpose(short **, int);
static void set_state_table(void);
static void set_accessing_symbol(void);
static void set_shift_table(void);
static void set_reduction_table(void);
static void set_maxrhs(void);
static void initialize_LA(void);
static void set_goto_map(void);
static void initialize_F(void);
static void build_relations(void);
static void compute_FOLLOWS(void);
static void compute_lookaheads(void);
int map_goto __P((int, int));
void digraph __P((short **));
void add_lookback_edge __P((int, int, int));
void traverse __P((int));
static int map_goto(int, int);
static void digraph(short **);
static void add_lookback_edge(int, int, int);
static void traverse(int);
static int infinity;
@ -94,7 +94,7 @@ static short *VERTICES;
static int top;
void
lalr()
lalr(void)
{
tokensetsize = WORDSIZE(ntokens);
@ -112,8 +112,8 @@ lalr()
}
void
set_state_table()
static void
set_state_table(void)
{
core *sp;
@ -123,8 +123,8 @@ set_state_table()
}
void
set_accessing_symbol()
static void
set_accessing_symbol(void)
{
core *sp;
@ -134,8 +134,8 @@ set_accessing_symbol()
}
void
set_shift_table()
static void
set_shift_table(void)
{
shifts *sp;
@ -145,8 +145,8 @@ set_shift_table()
}
void
set_reduction_table()
static void
set_reduction_table(void)
{
reductions *rp;
@ -156,8 +156,8 @@ set_reduction_table()
}
void
set_maxrhs()
static void
set_maxrhs(void)
{
short *itemp;
short *item_end;
@ -184,8 +184,8 @@ set_maxrhs()
}
void
initialize_LA()
static void
initialize_LA(void)
{
int i, j, k;
reductions *rp;
@ -222,8 +222,8 @@ initialize_LA()
}
void
set_goto_map()
static void
set_goto_map(void)
{
shifts *sp;
int i;
@ -292,10 +292,8 @@ set_goto_map()
/* Map_goto maps a state/symbol pair into its numeric representation. */
int
map_goto(state, symbol)
int state;
int symbol;
static int
map_goto(int state, int symbol)
{
int high;
int low;
@ -320,8 +318,8 @@ int symbol;
}
void
initialize_F()
static void
initialize_F(void)
{
int i;
int j;
@ -398,7 +396,7 @@ initialize_F()
void
build_relations()
build_relations(void)
{
int i;
int j;
@ -490,9 +488,8 @@ build_relations()
}
void
add_lookback_edge(stateno, ruleno, gotono)
int stateno, ruleno, gotono;
static void
add_lookback_edge(int stateno, int ruleno, int gotono)
{
int i, k;
int found;
@ -518,10 +515,8 @@ int stateno, ruleno, gotono;
short **
transpose(R, n)
short **R;
int n;
static short **
transpose(short **R, int n)
{
short **new_R;
short **temp_R;
@ -575,15 +570,15 @@ int n;
}
void
compute_FOLLOWS()
static void
compute_FOLLOWS(void)
{
digraph(includes);
}
void
compute_lookaheads()
static void
compute_lookaheads(void)
{
int i, n;
unsigned *fp1, *fp2, *fp3;
@ -617,9 +612,8 @@ compute_lookaheads()
}
void
digraph(relation)
short **relation;
static void
digraph(short **relation)
{
int i;
@ -644,9 +638,8 @@ short **relation;
}
void
traverse(i)
int i;
static void
traverse(int i)
{
unsigned *fp1;
unsigned *fp2;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lr0.c,v 1.8 2006/04/22 18:16:13 christos Exp $ */
/* $NetBSD: lr0.c,v 1.9 2006/05/24 18:01:43 christos Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)lr0.c 5.3 (Berkeley) 1/20/91";
#else
__RCSID("$NetBSD: lr0.c,v 1.8 2006/04/22 18:16:13 christos Exp $");
__RCSID("$NetBSD: lr0.c,v 1.9 2006/05/24 18:01:43 christos Exp $");
#endif
#endif /* not lint */
@ -52,27 +52,31 @@ core *first_state;
shifts *first_shift;
reductions *first_reduction;
int get_state __P((int));
core *new_state __P((int));
static int get_state(int);
static core *new_state(int);
void allocate_itemsets __P((void));
void allocate_storage __P((void));
void append_states __P((void));
void free_storage __P((void));
void generate_states __P((void));
void initialize_states __P((void));
void new_itemsets __P((void));
void show_cores __P((void));
void show_ritems __P((void));
void show_rrhs __P((void));
void show_shifts __P((void));
void save_shifts __P((void));
void save_reductions __P((void));
void set_derives __P((void));
void print_derives __P((void));
void set_nullable __P((void));
void free_derives __P((void));
void free_nullable __P((void));
static void allocate_itemsets(void);
static void allocate_storage(void);
static void append_states(void);
static void free_storage(void);
static void generate_states(void);
static void initialize_states(void);
static void new_itemsets(void);
#ifdef DEBUG
static void show_cores(void);
static void show_ritems(void);
static void show_rrhs(void);
static void show_shifts(void);
#endif
static void save_shifts(void);
static void save_reductions(void);
static void set_derives(void);
static void set_nullable(void);
#ifdef DEBUG
static void print_derives(void);
static void free_derives(void);
static void free_nullable(void);
#endif
static core **state_set;
static core *this_state;
@ -90,8 +94,8 @@ static short **kernel_base;
static short **kernel_end;
static short *kernel_items;
void
allocate_itemsets()
static void
allocate_itemsets(void)
{
short *itemp;
short *item_end;
@ -132,8 +136,8 @@ allocate_itemsets()
kernel_end = NEW2(nsyms, short *);
}
void
allocate_storage()
static void
allocate_storage(void)
{
allocate_itemsets();
shiftset = NEW2(nsyms, short);
@ -141,8 +145,8 @@ allocate_storage()
state_set = NEW2(nitems, core *);
}
void
append_states()
static void
append_states(void)
{
int i;
int j;
@ -170,8 +174,8 @@ append_states()
}
}
void
free_storage()
static void
free_storage(void)
{
FREE(shift_symbol);
FREE(redset);
@ -183,8 +187,8 @@ free_storage()
}
void
generate_states()
static void
generate_states(void)
{
allocate_storage();
itemset = NEW2(nitems, short);
@ -211,9 +215,8 @@ generate_states()
int
get_state(symbol)
int symbol;
static int
get_state(int symbol)
{
int key;
short *isp1;
@ -275,8 +278,8 @@ int symbol;
}
void
initialize_states()
static void
initialize_states(void)
{
int i;
short *start_derives;
@ -303,8 +306,8 @@ initialize_states()
}
void
new_itemsets()
static void
new_itemsets(void)
{
int i;
int shiftcount;
@ -340,9 +343,8 @@ new_itemsets()
core *
new_state(symbol)
int symbol;
static core *
new_state(int symbol)
{
int n;
core *p;
@ -378,10 +380,10 @@ int symbol;
return (p);
}
#ifdef DEBUG
/* show_cores is used for debugging */
void
show_cores()
static void
show_cores(void)
{
core *p;
int i, j, k, n;
@ -415,8 +417,8 @@ show_cores()
/* show_ritems is used for debugging */
void
show_ritems()
static void
show_ritems(void)
{
int i;
@ -426,8 +428,8 @@ show_ritems()
/* show_rrhs is used for debugging */
void
show_rrhs()
static void
show_rrhs(void)
{
int i;
@ -437,8 +439,8 @@ show_rrhs()
/* show_shifts is used for debugging */
void
show_shifts()
static void
show_shifts(void)
{
shifts *p;
int i, j, k;
@ -454,10 +456,11 @@ show_shifts()
printf("\t%d\n", p->shift[i]);
}
}
#endif
void
save_shifts()
static void
save_shifts(void)
{
shifts *p;
short *sp1;
@ -490,8 +493,8 @@ save_shifts()
}
void
save_reductions()
static void
save_reductions(void)
{
short *isp;
short *rp1;
@ -540,8 +543,8 @@ save_reductions()
}
void
set_derives()
static void
set_derives(void)
{
int i, k;
int lhs;
@ -574,16 +577,18 @@ set_derives()
#endif
}
void
free_derives()
#ifdef DEBUG
static void
free_derives(void)
{
FREE(derives[start_symbol]);
FREE(derives);
}
#endif
#ifdef DEBUG
void
print_derives()
static void
print_derives(void)
{
int i;
short *sp;
@ -605,8 +610,8 @@ print_derives()
#endif
void
set_nullable()
static void
set_nullable(void)
{
int i, j;
int empty;
@ -655,15 +660,17 @@ set_nullable()
}
void
free_nullable()
#ifdef DEBUG
static void
free_nullable(void)
{
FREE(nullable);
}
#endif
void
lr0()
lr0(void)
{
set_derives();
set_nullable();

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.15 2004/06/20 22:20:17 jmc Exp $ */
/* $NetBSD: main.c,v 1.16 2006/05/24 18:01:43 christos Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989 The Regents of the University of California
#if 0
static char sccsid[] = "@(#)main.c 5.5 (Berkeley) 5/24/93";
#else
__RCSID("$NetBSD: main.c,v 1.15 2004/06/20 22:20:17 jmc Exp $");
__RCSID("$NetBSD: main.c,v 1.16 2006/05/24 18:01:43 christos Exp $");
#endif
#endif /* not lint */
@ -62,14 +62,14 @@ char tflag;
char vflag;
char *symbol_prefix;
char *file_prefix = "y";
static char *file_prefix = "y";
char *myname = "yacc";
char *temp_form = "yacc.XXXXXXX";
static char *temp_form = "yacc.XXXXXXX";
int lineno;
int outline;
int explicit_file_name;
static int explicit_file_name;
char *action_file_name;
char *code_file_name;
@ -113,18 +113,15 @@ char *rassoc;
short **derives;
char *nullable;
int main __P((int, char *[]));
void onintr __P((int));
void set_signals __P((void));
void usage __P((void));
void getargs __P((int, char *[]));
void create_file_names __P((void));
void open_files __P((void));
static __dead void onintr(int) __attribute__((__noreturn__));
static void set_signals(void);
static __dead void usage(void) __attribute__((__noreturn__));
static void getargs(int, char *[]);
static void create_file_names(void);
static void open_files(void);
__dead void
done(k)
int k;
done(int k)
{
if (action_file) { fclose(action_file); unlink(action_file_name); }
if (text_file) { fclose(text_file); unlink(text_file_name); }
@ -133,15 +130,14 @@ int k;
}
void
onintr(signo)
int signo;
static void
onintr(int signo)
{
done(1);
}
void
static void
set_signals()
{
#ifdef SIGINT
@ -159,8 +155,8 @@ set_signals()
}
void
usage()
static void
usage(void)
{
fprintf(stderr, "usage: %s [-dlrtv] [-b file_prefix] [-o outputfile] "
"[-p symbol_prefix] filename\n", myname);
@ -168,10 +164,8 @@ usage()
}
void
getargs(argc, argv)
int argc;
char *argv[];
static void
getargs(int argc, char *argv[])
{
int i;
char *s;
@ -285,8 +279,7 @@ no_more_options:;
char *
allocate(n)
unsigned n;
allocate(unsigned n)
{
char *p;
@ -300,8 +293,8 @@ unsigned n;
}
void
create_file_names()
static void
create_file_names(void)
{
int i, len;
char *tmpdir;
@ -406,8 +399,8 @@ create_file_names()
}
void
open_files()
static void
open_files(void)
{
int fd;
@ -461,9 +454,7 @@ open_files()
int
main(argc, argv)
int argc;
char *argv[];
main(int argc, char *argv[])
{
set_signals();
getargs(argc, argv);
@ -476,5 +467,5 @@ char *argv[];
output();
done(0);
/*NOTREACHED*/
exit(0);
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkpar.c,v 1.10 2006/04/22 18:08:13 christos Exp $ */
/* $NetBSD: mkpar.c,v 1.11 2006/05/24 18:01:43 christos Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)mkpar.c 5.3 (Berkeley) 1/20/91";
#else
__RCSID("$NetBSD: mkpar.c,v 1.10 2006/04/22 18:08:13 christos Exp $");
__RCSID("$NetBSD: mkpar.c,v 1.11 2006/05/24 18:01:43 christos Exp $");
#endif
#endif /* not lint */
@ -56,23 +56,23 @@ short final_state;
static int SRcount;
static int RRcount;
action *parse_actions __P((int));
action *get_shifts __P((int));
action *add_reductions __P((int, action *));
action *add_reduce __P((action *, int, int));
static action *parse_actions(int);
static action *get_shifts(int);
static action *add_reductions(int, action *);
static action *add_reduce(action *, int, int);
int sole_reduction __P((int));
void free_action_row __P((action *));
static int sole_reduction(int);
static void free_action_row(action *);
void find_final_state __P((void));
void unused_rules __P((void));
void remove_conflicts __P((void));
void total_conflicts __P((void));
void defreds __P((void));
static void find_final_state(void);
static void unused_rules(void);
static void remove_conflicts(void);
static void total_conflicts(void);
static void defreds(void);
void
make_parser()
make_parser(void)
{
int i;
@ -88,9 +88,8 @@ make_parser()
}
action *
parse_actions(stateno)
int stateno;
static action *
parse_actions(int stateno)
{
action *actions;
@ -100,9 +99,8 @@ int stateno;
}
action *
get_shifts(stateno)
int stateno;
static action *
get_shifts(int stateno)
{
action *actions, *temp;
shifts *sp;
@ -135,10 +133,8 @@ int stateno;
return (actions);
}
action *
add_reductions(stateno, actions)
int stateno;
action *actions;
static action *
add_reductions(int stateno, action *actions)
{
int i, j, m, n;
int ruleno, tokensetsize;
@ -161,10 +157,8 @@ action *actions;
}
action *
add_reduce(actions, ruleno, symbol)
action *actions;
int ruleno, symbol;
static action *
add_reduce(action *actions, int ruleno, int symbol)
{
action *temp, *prev, *next;
@ -202,8 +196,8 @@ int ruleno, symbol;
}
void
find_final_state()
static void
find_final_state(void)
{
int goal, i;
short *to_state;
@ -220,8 +214,8 @@ find_final_state()
}
void
unused_rules()
static void
unused_rules(void)
{
int i;
action *p;
@ -254,8 +248,8 @@ unused_rules()
}
void
remove_conflicts()
static void
remove_conflicts(void)
{
int i;
int symbol;
@ -335,8 +329,8 @@ remove_conflicts()
}
void
total_conflicts()
static void
total_conflicts(void)
{
fprintf(stderr, "%s: ", myname);
if (SRtotal == 1)
@ -356,9 +350,8 @@ total_conflicts()
}
int
sole_reduction(stateno)
int stateno;
static int
sole_reduction(int stateno)
{
int count, ruleno;
action *p;
@ -385,8 +378,8 @@ int stateno;
}
void
defreds()
static void
defreds(void)
{
int i;
@ -395,9 +388,8 @@ defreds()
defred[i] = sole_reduction(i);
}
void
free_action_row(p)
action *p;
static void
free_action_row(action *p)
{
action *q;
@ -410,7 +402,7 @@ action *p;
}
void
free_parser()
free_parser(void)
{
int i;

View File

@ -1,4 +1,4 @@
/* $NetBSD: output.c,v 1.13 2005/04/17 17:16:37 christos Exp $ */
/* $NetBSD: output.c,v 1.14 2006/05/24 18:01:43 christos Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)output.c 5.7 (Berkeley) 5/24/93";
#else
__RCSID("$NetBSD: output.c,v 1.13 2005/04/17 17:16:37 christos Exp $");
__RCSID("$NetBSD: output.c,v 1.14 2006/05/24 18:01:43 christos Exp $");
#endif
#endif /* not lint */
@ -59,36 +59,36 @@ static short *check;
static int lowzero;
static int high;
void output_prefix __P((void));
void output_rule_data __P((void));
void output_yydefred __P((void));
void output_actions __P((void));
void token_actions __P((void));
void goto_actions __P((void));
int default_goto __P((int));
void save_column __P((int, int));
void sort_actions __P((void));
void pack_table __P((void));
int matching_vector __P((int));
int pack_vector __P((int));
void output_base __P((void));
void output_table __P((void));
void output_check __P((void));
int is_C_identifier __P((char *));
void output_defines __P((void));
void output_stored_text __P((void));
void output_debug __P((void));
void output_stype __P((void));
void output_trailing_text __P((void));
void output_semantic_actions __P((void));
void free_itemsets __P((void));
void free_shifts __P((void));
void free_reductions __P((void));
static void output_prefix(void);
static void output_rule_data(void);
static void output_yydefred(void);
static void output_actions(void);
static void token_actions(void);
static void goto_actions(void);
static int default_goto(int);
static void save_column(int, int);
static void sort_actions(void);
static void pack_table(void);
static int matching_vector(int);
static int pack_vector(int);
static void output_base(void);
static void output_table(void);
static void output_check(void);
static int is_C_identifier(char *);
static void output_defines(void);
static void output_stored_text(void);
static void output_debug(void);
static void output_stype(void);
static void output_trailing_text(void);
static void output_semantic_actions(void);
static void free_itemsets(void);
static void free_shifts(void);
static void free_reductions(void);
static const char line_format[] = "#line %d \"%s\"\n";
void
output()
output(void)
{
free_itemsets();
free_shifts();
@ -110,8 +110,8 @@ output()
write_section(trailer);
}
void
output_prefix()
static void
output_prefix(void)
{
if (symbol_prefix == NULL)
symbol_prefix = "yy";
@ -174,8 +174,8 @@ output_prefix()
fprintf(code_file, "#define YYPREFIX \"%s\"\n", symbol_prefix);
}
void
output_rule_data()
static void
output_rule_data(void)
{
int i;
int j;
@ -221,8 +221,8 @@ output_rule_data()
fprintf(output_file, "\n};\n");
}
void
output_yydefred()
static void
output_yydefred(void)
{
int i, j;
@ -248,8 +248,8 @@ output_yydefred()
fprintf(output_file, "\n};\n");
}
void
output_actions()
static void
output_actions(void)
{
nvectors = 2*nstates + nvars;
@ -276,8 +276,8 @@ output_actions()
output_check();
}
void
token_actions()
static void
token_actions(void)
{
int i, j;
int shiftcount, reducecount;
@ -361,8 +361,8 @@ token_actions()
FREE(actionrow);
}
void
goto_actions()
static void
goto_actions(void)
{
int i, j, k;
@ -394,9 +394,8 @@ goto_actions()
FREE(state_count);
}
int
default_goto(symbol)
int symbol;
static int
default_goto(int symbol)
{
int i;
int m;
@ -430,10 +429,8 @@ int symbol;
}
void
save_column(symbol, default_state)
int symbol;
int default_state;
static void
save_column(int symbol, int default_state)
{
int i;
int m;
@ -473,8 +470,8 @@ int default_state;
width[symno] = sp1[-1] - sp[0] + 1;
}
void
sort_actions()
static void
sort_actions(void)
{
int i;
int j;
@ -509,8 +506,8 @@ sort_actions()
}
void
pack_table()
static void
pack_table(void)
{
int i;
int place;
@ -572,9 +569,8 @@ pack_table()
/* faster. Also, it depends on the vectors being in a specific */
/* order. */
int
matching_vector(vector)
int vector;
static int
matching_vector(int vector)
{
int i;
int j;
@ -613,9 +609,8 @@ int vector;
int
pack_vector(vector)
int vector;
static int
pack_vector(int vector)
{
int i, j, k, l;
int t;
@ -690,8 +685,8 @@ int vector;
}
void
output_base()
static void
output_base(void)
{
int i, j;
@ -757,8 +752,8 @@ output_base()
}
void
output_table()
static void
output_table(void)
{
int i;
int j;
@ -789,8 +784,8 @@ output_table()
}
void
output_check()
static void
output_check(void)
{
int i;
int j;
@ -819,9 +814,8 @@ output_check()
}
int
is_C_identifier(name)
char *name;
static int
is_C_identifier(char *name)
{
char *s;
unsigned char c;
@ -852,8 +846,8 @@ char *name;
}
void
output_defines()
static void
output_defines(void)
{
int c, i;
char *s;
@ -905,8 +899,8 @@ output_defines()
}
void
output_stored_text()
static void
output_stored_text(void)
{
int c;
FILE *in, *out;
@ -933,8 +927,8 @@ output_stored_text()
}
void
output_debug()
static void
output_debug(void)
{
int i, j, k, max;
char **symnam, *s;
@ -1149,8 +1143,8 @@ output_debug()
}
void
output_stype()
static void
output_stype(void)
{
if (!unionized && ntags == 0)
{
@ -1160,8 +1154,8 @@ output_stype()
}
void
output_trailing_text()
static void
output_trailing_text(void)
{
int c, last;
FILE *in, *out;
@ -1218,8 +1212,8 @@ output_trailing_text()
}
void
output_semantic_actions()
static void
output_semantic_actions(void)
{
int c, last;
FILE *out;
@ -1256,8 +1250,8 @@ output_semantic_actions()
}
void
free_itemsets()
static void
free_itemsets(void)
{
core *cp, *next;
@ -1270,8 +1264,8 @@ free_itemsets()
}
void
free_shifts()
static void
free_shifts(void)
{
shifts *sp, *next;
@ -1284,8 +1278,8 @@ free_shifts()
}
void
free_reductions()
static void
free_reductions(void)
{
reductions *rp, *next;

View File

@ -1,4 +1,4 @@
/* $NetBSD: reader.c,v 1.14 2005/04/17 17:16:37 christos Exp $ */
/* $NetBSD: reader.c,v 1.15 2006/05/24 18:01:43 christos Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)reader.c 5.7 (Berkeley) 1/20/91";
#else
__RCSID("$NetBSD: reader.c,v 1.14 2005/04/17 17:16:37 christos Exp $");
__RCSID("$NetBSD: reader.c,v 1.15 2006/05/24 18:01:43 christos Exp $");
#endif
#endif /* not lint */
@ -50,74 +50,75 @@ __RCSID("$NetBSD: reader.c,v 1.14 2005/04/17 17:16:37 christos Exp $");
#define LINESIZE 100
char *cache;
int cinc, cache_size;
static char *cache;
static int cinc, cache_size;
int ntags, tagmax;
char **tag_table;
int ntags;
static int tagmax;
static char **tag_table;
char saw_eof, unionized;
static char saw_eof;
char unionized;
char *cptr, *line;
int linesize;
static int linesize;
bucket *goal;
int prec;
int gensym;
char last_was_action;
static bucket *goal;
static int prec;
static int gensym;
static char last_was_action;
int maxitems;
bucket **pitem;
static int maxitems;
static bucket **pitem;
int maxrules;
bucket **plhs;
static int maxrules;
static bucket **plhs;
int name_pool_size;
char *name_pool;
static int name_pool_size;
static char *name_pool;
void cachec __P((int));
void get_line __P((void));
char * dup_line __P((void));
void skip_comment __P((void));
int nextc __P((void));
int keyword __P((void));
void copy_ident __P((void));
void copy_text __P((void));
void copy_union __P((void));
int hexval __P((int));
bucket * get_literal __P((void));
int is_reserved __P((char *));
bucket * get_name __P((void));
int get_number __P((void));
char * get_tag __P((void));
void declare_tokens __P((int));
void declare_types __P((void));
void declare_start __P((void));
void handle_expect __P((void));
void read_declarations __P((void));
void initialize_grammar __P((void));
void expand_items __P((void));
void expand_rules __P((void));
void advance_to_start __P((void));
void start_rule __P((bucket *, int));
void end_rule __P((void));
void insert_empty_rule __P((void));
void add_symbol __P((void));
void copy_action __P((void));
int mark_symbol __P((void));
void read_grammar __P((void));
void free_tags __P((void));
void pack_names __P((void));
void check_symbols __P((void));
void pack_symbols __P((void));
void pack_grammar __P((void));
void print_grammar __P((void));
static void cachec(int);
static void get_line(void);
static char * dup_line(void);
static void skip_comment(void);
static int nextc(void);
static int keyword(void);
static void copy_ident(void);
static void copy_text(void);
static void copy_union(void);
static int hexval(int);
static bucket * get_literal(void);
static int is_reserved(char *);
static bucket * get_name(void);
static int get_number(void);
static char * get_tag(void);
static void declare_tokens(int);
static void declare_types(void);
static void declare_start(void);
static void handle_expect(void);
static void read_declarations(void);
static void initialize_grammar(void);
static void expand_items(void);
static void expand_rules(void);
static void advance_to_start(void);
static void start_rule(bucket *, int);
static void end_rule(void);
static void insert_empty_rule(void);
static void add_symbol(void);
static void copy_action(void);
static int mark_symbol(void);
static void read_grammar(void);
static void free_tags(void);
static void pack_names(void);
static void check_symbols(void);
static void pack_symbols(void);
static void pack_grammar(void);
static void print_grammar(void);
static const char line_format[] = "#line %d \"%s\"\n";
void
cachec(c)
int c;
static void
cachec(int c)
{
assert(cinc >= 0);
if (cinc >= cache_size)
@ -130,8 +131,8 @@ int c;
++cinc;
}
void
get_line()
static void
get_line(void)
{
FILE *f = input_file;
int c;
@ -177,8 +178,8 @@ get_line()
}
char *
dup_line()
static char *
dup_line(void)
{
char *p, *s, *t;
@ -195,8 +196,8 @@ dup_line()
}
void
skip_comment()
static void
skip_comment(void)
{
char *s;
@ -226,8 +227,8 @@ skip_comment()
}
int
nextc()
static int
nextc(void)
{
char *s;
@ -288,8 +289,8 @@ nextc()
}
int
keyword()
static int
keyword(void)
{
unsigned char c;
char *t_cptr = cptr;
@ -354,8 +355,8 @@ keyword()
}
void
copy_ident()
static void
copy_ident(void)
{
int c;
FILE *f = output_file;
@ -384,8 +385,8 @@ copy_ident()
}
void
copy_text()
static void
copy_text(void)
{
int c;
int quote;
@ -516,8 +517,8 @@ loop:
}
void
copy_union()
static void
copy_union(void)
{
int c;
int quote;
@ -657,9 +658,8 @@ loop:
}
int
hexval(c)
int c;
static int
hexval(int c)
{
if (c >= '0' && c <= '9')
return (c - '0');
@ -671,8 +671,8 @@ int c;
}
bucket *
get_literal()
static bucket *
get_literal(void)
{
int c, quote;
int i;
@ -810,9 +810,8 @@ get_literal()
}
int
is_reserved(name)
char *name;
static int
is_reserved(char *name)
{
char *s;
@ -832,8 +831,8 @@ char *name;
}
bucket *
get_name()
static bucket *
get_name(void)
{
int c;
@ -848,8 +847,8 @@ get_name()
}
int
get_number()
static int
get_number(void)
{
int c;
int n;
@ -862,8 +861,8 @@ get_number()
}
char *
get_tag()
static char *
get_tag(void)
{
int c;
int i;
@ -913,9 +912,8 @@ get_tag()
}
void
declare_tokens(assoc)
int assoc;
static void
declare_tokens(int assoc)
{
int c;
bucket *bp;
@ -976,8 +974,8 @@ int assoc;
}
void
declare_types()
static void
declare_types(void)
{
int c;
bucket *bp;
@ -1005,8 +1003,8 @@ declare_types()
}
void
declare_start()
static void
declare_start(void)
{
int c;
bucket *bp;
@ -1024,8 +1022,8 @@ declare_start()
}
void
handle_expect()
static void
handle_expect(void)
{
int c;
int num;
@ -1042,8 +1040,8 @@ handle_expect()
}
void
read_declarations()
static void
read_declarations(void)
{
int c, k;
@ -1096,8 +1094,8 @@ read_declarations()
}
void
initialize_grammar()
static void
initialize_grammar(void)
{
nitems = 4;
maxitems = 300;
@ -1128,8 +1126,8 @@ initialize_grammar()
}
void
expand_items()
static void
expand_items(void)
{
maxitems += 300;
pitem = (bucket **) REALLOC(pitem, maxitems*sizeof(bucket *));
@ -1137,8 +1135,8 @@ expand_items()
}
void
expand_rules()
static void
expand_rules(void)
{
maxrules += 100;
plhs = (bucket **) REALLOC(plhs, maxrules*sizeof(bucket *));
@ -1150,8 +1148,8 @@ expand_rules()
}
void
advance_to_start()
static void
advance_to_start(void)
{
int c;
bucket *bp;
@ -1201,10 +1199,8 @@ advance_to_start()
}
void
start_rule(bp, s_lineno)
bucket *bp;
int s_lineno;
static void
start_rule(bucket *bp, int s_lineno)
{
if (bp->class == TERM)
terminal_lhs(s_lineno);
@ -1217,8 +1213,8 @@ int s_lineno;
}
void
end_rule()
static void
end_rule(void)
{
int i;
@ -1237,8 +1233,8 @@ end_rule()
}
void
insert_empty_rule()
static void
insert_empty_rule(void)
{
bucket *bp, **bpp;
@ -1267,8 +1263,8 @@ insert_empty_rule()
}
void
add_symbol()
static void
add_symbol(void)
{
int c;
bucket *bp;
@ -1299,8 +1295,8 @@ add_symbol()
}
void
copy_action()
static void
copy_action(void)
{
int c;
int i, n;
@ -1525,8 +1521,8 @@ loop:
}
int
mark_symbol()
static int
mark_symbol(void)
{
int c;
bucket *bp;
@ -1571,8 +1567,8 @@ mark_symbol()
}
void
read_grammar()
static void
read_grammar(void)
{
int c;
@ -1605,8 +1601,8 @@ read_grammar()
}
void
free_tags()
static void
free_tags(void)
{
int i;
@ -1621,8 +1617,8 @@ free_tags()
}
void
pack_names()
static void
pack_names(void)
{
bucket *bp;
char *p, *s, *t;
@ -1647,8 +1643,8 @@ pack_names()
}
void
check_symbols()
static void
check_symbols(void)
{
bucket *bp;
@ -1666,8 +1662,8 @@ check_symbols()
}
void
pack_symbols()
static void
pack_symbols(void)
{
bucket *bp;
bucket **v;
@ -1791,8 +1787,8 @@ pack_symbols()
}
void
pack_grammar()
static void
pack_grammar(void)
{
int i, j;
int assoc, prec;
@ -1851,8 +1847,8 @@ pack_grammar()
}
void
print_grammar()
static void
print_grammar(void)
{
int i, j, k;
int spacing;
@ -1891,7 +1887,7 @@ print_grammar()
void
reader()
reader(void)
{
write_section(banner);
create_symbol_table();

View File

@ -1,4 +1,4 @@
/* $NetBSD: skeleton.c,v 1.25 2003/08/07 11:17:54 agc Exp $ */
/* $NetBSD: skeleton.c,v 1.26 2006/05/24 18:01:43 christos Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)skeleton.c 5.8 (Berkeley) 4/29/95";
#else
__RCSID("$NetBSD: skeleton.c,v 1.25 2003/08/07 11:17:54 agc Exp $");
__RCSID("$NetBSD: skeleton.c,v 1.26 2006/05/24 18:01:43 christos Exp $");
#endif /* 0 */
#endif /* not lint */
@ -63,7 +63,7 @@ const char * const banner[] =
"static char yysccsid[] = \"@(#)yaccpar 1.9 (Berkeley) 02/21/93\";",
"#else",
"#if defined(__NetBSD__) && defined(__IDSTRING)",
"__IDSTRING(yyrcsid, \"$NetBSD: skeleton.c,v 1.25 2003/08/07 11:17:54 agc Exp $\");",
"__IDSTRING(yyrcsid, \"$NetBSD: skeleton.c,v 1.26 2006/05/24 18:01:43 christos Exp $\");",
"#endif /* __NetBSD__ && __IDSTRING */",
"#endif /* 0 */",
"#endif /* lint */",
@ -364,8 +364,7 @@ const char * const trailer[] =
void
write_section(section)
const char * const section[];
write_section(const char * const section[])
{
int c;
int i;

View File

@ -1,4 +1,4 @@
/* $NetBSD: symtab.c,v 1.9 2003/08/07 11:17:54 agc Exp $ */
/* $NetBSD: symtab.c,v 1.10 2006/05/24 18:01:43 christos Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)symtab.c 5.3 (Berkeley) 6/1/90";
#else
__RCSID("$NetBSD: symtab.c,v 1.9 2003/08/07 11:17:54 agc Exp $");
__RCSID("$NetBSD: symtab.c,v 1.10 2006/05/24 18:01:43 christos Exp $");
#endif
#endif /* not lint */
@ -49,16 +49,15 @@ __RCSID("$NetBSD: symtab.c,v 1.9 2003/08/07 11:17:54 agc Exp $");
#define TABLE_SIZE 1024
bucket **symbol_table;
static bucket **symbol_table;
bucket *first_symbol;
bucket *last_symbol;
int hash __P((char *));
static int hash(char *);
int
hash(name)
char *name;
static int
hash(char *name)
{
char *s;
int c, k;
@ -74,8 +73,7 @@ char *name;
bucket *
make_bucket(name)
char *name;
make_bucket(char *name)
{
bucket *bp;
@ -98,8 +96,7 @@ char *name;
bucket *
lookup(name)
char *name;
lookup(char *name)
{
bucket *bp, **bpp;
@ -122,7 +119,7 @@ char *name;
void
create_symbol_table()
create_symbol_table(void)
{
int i;
bucket *bp;
@ -143,7 +140,7 @@ create_symbol_table()
void
free_symbol_table()
free_symbol_table(void)
{
FREE(symbol_table);
symbol_table = 0;
@ -151,7 +148,7 @@ free_symbol_table()
void
free_symbols()
free_symbols(void)
{
bucket *p, *q;

View File

@ -1,4 +1,4 @@
/* $NetBSD: verbose.c,v 1.8 2003/08/07 11:17:55 agc Exp $ */
/* $NetBSD: verbose.c,v 1.9 2006/05/24 18:01:43 christos Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)verbose.c 5.3 (Berkeley) 1/20/91";
#else
__RCSID("$NetBSD: verbose.c,v 1.8 2003/08/07 11:17:55 agc Exp $");
__RCSID("$NetBSD: verbose.c,v 1.9 2006/05/24 18:01:43 christos Exp $");
#endif
#endif /* not lint */
@ -45,19 +45,19 @@ __RCSID("$NetBSD: verbose.c,v 1.8 2003/08/07 11:17:55 agc Exp $");
static short *null_rules;
void log_unused __P((void));
void log_conflicts __P((void));
void print_state __P((int));
void print_conflicts __P((int));
void print_core __P((int));
void print_nulls __P((int));
void print_actions __P((int));
void print_shifts __P((action *));
void print_reductions __P((action *, int));
void print_gotos __P((int));
static void log_unused(void);
static void log_conflicts(void);
static void print_state(int);
static void print_conflicts(int);
static void print_core(int);
static void print_nulls(int);
static void print_actions(int);
static void print_shifts(action *);
static void print_reductions(action *, int);
static void print_gotos(int);
void
verbose()
verbose(void)
{
int i;
@ -81,8 +81,8 @@ verbose()
}
void
log_unused()
static void
log_unused(void)
{
int i;
short *p;
@ -101,8 +101,8 @@ log_unused()
}
void
log_conflicts()
static void
log_conflicts(void)
{
int i;
@ -130,9 +130,8 @@ log_conflicts()
}
void
print_state(state)
int state;
static void
print_state(int state)
{
if (state)
fprintf(verbose_file, "\n\n");
@ -145,9 +144,8 @@ int state;
}
void
print_conflicts(state)
int state;
static void
print_conflicts(int state)
{
int symbol, act, number;
action *p;
@ -197,9 +195,8 @@ int state;
}
void
print_core(state)
int state;
static void
print_core(int state)
{
int i;
int k;
@ -234,9 +231,8 @@ int state;
}
void
print_nulls(state)
int state;
static void
print_nulls(int state)
{
action *p;
int i, j, k, nnulls;
@ -279,9 +275,8 @@ int state;
}
void
print_actions(stateno)
int stateno;
static void
print_actions(int stateno)
{
action *p;
shifts *sp;
@ -307,9 +302,8 @@ int stateno;
}
void
print_shifts(p)
action *p;
static void
print_shifts(action *p)
{
int count;
action *q;
@ -333,10 +327,8 @@ action *p;
}
void
print_reductions(p, defred)
action *p;
int defred;
static void
print_reductions(action *p, int defred)
{
int k, anyreds;
action *q;
@ -372,9 +364,8 @@ int defred;
}
void
print_gotos(stateno)
int stateno;
static void
print_gotos(int stateno)
{
int i, k;
int as;

View File

@ -1,4 +1,4 @@
/* $NetBSD: warshall.c,v 1.7 2003/08/07 11:17:55 agc Exp $ */
/* $NetBSD: warshall.c,v 1.8 2006/05/24 18:01:43 christos Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -37,18 +37,16 @@
#if 0
static char sccsid[] = "@(#)warshall.c 5.4 (Berkeley) 5/24/93";
#else
__RCSID("$NetBSD: warshall.c,v 1.7 2003/08/07 11:17:55 agc Exp $");
__RCSID("$NetBSD: warshall.c,v 1.8 2006/05/24 18:01:43 christos Exp $");
#endif
#endif /* not lint */
#include "defs.h"
void transitive_closure __P((unsigned *, int));
static void transitive_closure(unsigned *, int);
void
transitive_closure(R, n)
unsigned *R;
int n;
static void
transitive_closure(unsigned *R, int n)
{
int rowsize;
unsigned i;
@ -99,9 +97,7 @@ int n;
}
void
reflexive_transitive_closure(R, n)
unsigned *R;
int n;
reflexive_transitive_closure(unsigned *R, int n)
{
int rowsize;
unsigned i;