summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Valchev <pvalchev@cvs.openbsd.org>2001-07-16 06:29:46 +0000
committerPeter Valchev <pvalchev@cvs.openbsd.org>2001-07-16 06:29:46 +0000
commit0a0ba19345d4c3688a74252a888d0f7040caf1c7 (patch)
tree2ef2e7e241110608a2a18a3415c913051fa3bc10
parente43f28fe697b759e0f67c428fb7400874b7b4ebb (diff)
-Wall cleanup; ok deraadt
-rw-r--r--usr.bin/yacc/closure.c8
-rw-r--r--usr.bin/yacc/defs.h68
-rw-r--r--usr.bin/yacc/error.c60
-rw-r--r--usr.bin/yacc/lalr.c49
-rw-r--r--usr.bin/yacc/lr0.c60
-rw-r--r--usr.bin/yacc/main.c23
-rw-r--r--usr.bin/yacc/mkpar.c22
-rw-r--r--usr.bin/yacc/output.c55
-rw-r--r--usr.bin/yacc/reader.c70
-rw-r--r--usr.bin/yacc/skeleton.c7
-rw-r--r--usr.bin/yacc/symtab.c9
-rw-r--r--usr.bin/yacc/verbose.c26
-rw-r--r--usr.bin/yacc/warshall.c8
13 files changed, 367 insertions, 98 deletions
diff --git a/usr.bin/yacc/closure.c b/usr.bin/yacc/closure.c
index 654290df1d4..2437c1da994 100644
--- a/usr.bin/yacc/closure.c
+++ b/usr.bin/yacc/closure.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: closure.c,v 1.3 1996/06/26 05:44:35 deraadt Exp $ */
+/* $OpenBSD: closure.c,v 1.4 2001/07/16 06:29:43 pvalchev Exp $ */
/* $NetBSD: closure.c,v 1.4 1996/03/19 03:21:29 jtc Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)closure.c 5.3 (Berkeley) 5/24/93";
#else
-static char rcsid[] = "$OpenBSD: closure.c,v 1.3 1996/06/26 05:44:35 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: closure.c,v 1.4 2001/07/16 06:29:43 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -55,6 +55,7 @@ static unsigned *first_derives;
static unsigned *EFF;
+void
set_EFF()
{
register unsigned *row;
@@ -91,6 +92,7 @@ set_EFF()
}
+void
set_first_derives()
{
register unsigned *rrow;
@@ -146,6 +148,7 @@ set_first_derives()
}
+void
closure(nucleus, n)
short *nucleus;
int n;
@@ -216,6 +219,7 @@ int n;
+void
finalize_closure()
{
FREE(itemset);
diff --git a/usr.bin/yacc/defs.h b/usr.bin/yacc/defs.h
index 3af2bf12291..bfd1b32a0ae 100644
--- a/usr.bin/yacc/defs.h
+++ b/usr.bin/yacc/defs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: defs.h,v 1.6 1999/08/04 18:31:25 millert Exp $ */
+/* $OpenBSD: defs.h,v 1.7 2001/07/16 06:29:44 pvalchev Exp $ */
/* $NetBSD: defs.h,v 1.6 1996/03/19 03:21:30 jtc Exp $ */
/*
@@ -43,7 +43,7 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
-
+#include <stdlib.h>
/* machine-dependent definitions */
/* the following definitions are for the Tahoe */
@@ -316,18 +316,62 @@ extern short final_state;
extern char *allocate();
extern bucket *lookup();
extern bucket *make_bucket();
+extern void set_first_derives __P((void));
+extern void closure __P((short *, int));
+extern void finalize_closure __P((void));
+
+extern void fatal __P((char *));
+
+extern void reflexive_transitive_closure __P((unsigned *, int));
+extern void done __P((int));
+
+extern void no_space __P((void));
+extern void open_error(char *);
+extern void unexpected_EOF __P((void));
+extern void print_pos __P((char *, char *));
+extern __dead void syntax_error __P((int, char *, char *));
+extern void unterminated_comment __P((int, char *, char *));
+extern void unterminated_string __P((int, char *, char *));
+extern void unterminated_text __P((int, char *, char *));
+extern void unterminated_union __P((int, char *, char *));
+extern 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 void terminal_start __P((char *));
+extern void restarted_warning __P((void));
+extern void no_grammar __P((void));
+extern void terminal_lhs __P((int));
+extern void prec_redeclared __P((void));
+extern void unterminated_action __P((int, char *, char *));
+extern void dollar_warning __P((int, int));
+extern void dollar_error __P((int, char *, char *));
+extern void untyped_lhs __P((void));
+extern void untyped_rhs __P((int, char *));
+extern void unknown_rhs __P((int));
+extern void default_action_warning __P((void));
+extern void undefined_goal __P((char *));
+extern void undefined_symbol_warning __P((char *));
+
+extern void lalr __P((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((char *[]));
+
+extern void create_symbol_table __P((void));
+extern void free_symbol_table __P((void));
+extern void free_symbols __P((void));
/* system variables */
-extern int errno;
extern char *__progname;
-
-
-/* system functions */
-
-extern void free();
-extern char *calloc();
-extern char *malloc();
-extern char *realloc();
-extern char *strcpy();
diff --git a/usr.bin/yacc/error.c b/usr.bin/yacc/error.c
index 0eefc474978..9758d6bb6dd 100644
--- a/usr.bin/yacc/error.c
+++ b/usr.bin/yacc/error.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: error.c,v 1.4 1999/08/04 18:31:26 millert Exp $ */
+/* $OpenBSD: error.c,v 1.5 2001/07/16 06:29:44 pvalchev Exp $ */
/* $NetBSD: error.c,v 1.4 1996/03/19 03:21:32 jtc Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)error.c 5.3 (Berkeley) 6/1/90";
#else
-static char rcsid[] = "$OpenBSD: error.c,v 1.4 1999/08/04 18:31:26 millert Exp $";
+static char rcsid[] = "$OpenBSD: error.c,v 1.5 2001/07/16 06:29:44 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -50,6 +50,7 @@ static char rcsid[] = "$OpenBSD: error.c,v 1.4 1999/08/04 18:31:26 millert Exp $
#include "defs.h"
+void
fatal(msg)
char *msg;
{
@@ -58,6 +59,7 @@ char *msg;
}
+void
no_space()
{
fprintf(stderr, "%s: f - out of space\n", __progname);
@@ -65,6 +67,7 @@ no_space()
}
+void
open_error(filename)
char *filename;
{
@@ -73,6 +76,7 @@ char *filename;
}
+void
unexpected_EOF()
{
fprintf(stderr, "%s: e - line %d of \"%s\", unexpected end-of-file\n",
@@ -81,6 +85,7 @@ unexpected_EOF()
}
+void
print_pos(st_line, st_cptr)
char *st_line;
char *st_cptr;
@@ -107,7 +112,7 @@ char *st_cptr;
putc('\n', stderr);
}
-
+void
syntax_error(st_lineno, st_line, st_cptr)
int st_lineno;
char *st_line;
@@ -119,7 +124,7 @@ char *st_cptr;
done(1);
}
-
+void
unterminated_comment(c_lineno, c_line, c_cptr)
int c_lineno;
char *c_line;
@@ -131,7 +136,7 @@ char *c_cptr;
done(1);
}
-
+void
unterminated_string(s_lineno, s_line, s_cptr)
int s_lineno;
char *s_line;
@@ -143,7 +148,7 @@ char *s_cptr;
done(1);
}
-
+void
unterminated_text(t_lineno, t_line, t_cptr)
int t_lineno;
char *t_line;
@@ -155,7 +160,7 @@ char *t_cptr;
done(1);
}
-
+void
unterminated_union(u_lineno, u_line, u_cptr)
int u_lineno;
char *u_line;
@@ -167,7 +172,7 @@ declaration\n", __progname, u_lineno, input_file_name);
done(1);
}
-
+void
over_unionized(u_cptr)
char *u_cptr;
{
@@ -177,7 +182,7 @@ declarations\n", __progname, lineno, input_file_name);
done(1);
}
-
+void
illegal_tag(t_lineno, t_line, t_cptr)
int t_lineno;
char *t_line;
@@ -190,6 +195,7 @@ char *t_cptr;
}
+void
illegal_character(c_cptr)
char *c_cptr;
{
@@ -200,6 +206,7 @@ char *c_cptr;
}
+void
used_reserved(s)
char *s;
{
@@ -208,7 +215,7 @@ char *s;
done(1);
}
-
+void
tokenized_start(s)
char *s;
{
@@ -217,7 +224,7 @@ declared to be a token\n", __progname, lineno, input_file_name, s);
done(1);
}
-
+void
retyped_warning(s)
char *s;
{
@@ -225,7 +232,7 @@ char *s;
redeclared\n", __progname, lineno, input_file_name, s);
}
-
+void
reprec_warning(s)
char *s;
{
@@ -233,7 +240,7 @@ char *s;
redeclared\n", __progname, lineno, input_file_name, s);
}
-
+void
revalued_warning(s)
char *s;
{
@@ -241,7 +248,7 @@ char *s;
redeclared\n", __progname, lineno, input_file_name, s);
}
-
+void
terminal_start(s)
char *s;
{
@@ -250,14 +257,14 @@ token\n", __progname, lineno, input_file_name, s);
done(1);
}
-
+void
restarted_warning()
{
fprintf(stderr, "%s: w - line %d of \"%s\", the start symbol has been \
redeclared\n", __progname, lineno, input_file_name);
}
-
+void
no_grammar()
{
fprintf(stderr, "%s: e - line %d of \"%s\", no grammar has been \
@@ -265,7 +272,7 @@ specified\n", __progname, lineno, input_file_name);
done(1);
}
-
+void
terminal_lhs(s_lineno)
int s_lineno;
{
@@ -274,14 +281,14 @@ of a production\n", __progname, s_lineno, input_file_name);
done(1);
}
-
+void
prec_redeclared()
{
fprintf(stderr, "%s: w - line %d of \"%s\", conflicting %%prec \
specifiers\n", __progname, lineno, input_file_name);
}
-
+void
unterminated_action(a_lineno, a_line, a_cptr)
int a_lineno;
char *a_line;
@@ -293,7 +300,7 @@ char *a_cptr;
done(1);
}
-
+void
dollar_warning(a_lineno, i)
int a_lineno;
int i;
@@ -302,7 +309,7 @@ int i;
end of the current rule\n", __progname, a_lineno, input_file_name, i);
}
-
+void
dollar_error(a_lineno, a_line, a_cptr)
int a_lineno;
char *a_line;
@@ -315,6 +322,7 @@ char *a_cptr;
}
+void
untyped_lhs()
{
fprintf(stderr, "%s: e - line %d of \"%s\", $$ is untyped\n",
@@ -322,7 +330,7 @@ untyped_lhs()
done(1);
}
-
+void
untyped_rhs(i, s)
int i;
char *s;
@@ -332,7 +340,7 @@ char *s;
done(1);
}
-
+void
unknown_rhs(i)
int i;
{
@@ -341,14 +349,14 @@ int i;
done(1);
}
-
+void
default_action_warning()
{
fprintf(stderr, "%s: w - line %d of \"%s\", the default action assigns an \
undefined value to $$\n", __progname, lineno, input_file_name);
}
-
+void
undefined_goal(s)
char *s;
{
@@ -356,7 +364,7 @@ char *s;
done(1);
}
-
+void
undefined_symbol_warning(s)
char *s;
{
diff --git a/usr.bin/yacc/lalr.c b/usr.bin/yacc/lalr.c
index 69a6e48e113..280e177e4d1 100644
--- a/usr.bin/yacc/lalr.c
+++ b/usr.bin/yacc/lalr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lalr.c,v 1.3 1996/06/26 05:44:37 deraadt Exp $ */
+/* $OpenBSD: lalr.c,v 1.4 2001/07/16 06:29:44 pvalchev Exp $ */
/* $NetBSD: lalr.c,v 1.4 1996/03/19 03:21:33 jtc Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)lalr.c 5.3 (Berkeley) 6/1/90";
#else
-static char rcsid[] = "$OpenBSD: lalr.c,v 1.3 1996/06/26 05:44:37 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: lalr.c,v 1.4 2001/07/16 06:29:44 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -68,6 +68,21 @@ short *from_state;
short *to_state;
short **transpose();
+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));
+int map_goto __P((int, int));
+void digraph __P((short **));
+void add_lookback_edge __P((int, int, int));
+void traverse __P((int));
static int infinity;
static int maxrhs;
@@ -80,7 +95,7 @@ static short *INDEX;
static short *VERTICES;
static int top;
-
+void
lalr()
{
tokensetsize = WORDSIZE(ntokens);
@@ -99,7 +114,7 @@ lalr()
}
-
+void
set_state_table()
{
register core *sp;
@@ -110,7 +125,7 @@ set_state_table()
}
-
+void
set_accessing_symbol()
{
register core *sp;
@@ -121,7 +136,7 @@ set_accessing_symbol()
}
-
+void
set_shift_table()
{
register shifts *sp;
@@ -132,7 +147,7 @@ set_shift_table()
}
-
+void
set_reduction_table()
{
register reductions *rp;
@@ -143,7 +158,7 @@ set_reduction_table()
}
-
+void
set_maxrhs()
{
register short *itemp;
@@ -171,7 +186,7 @@ set_maxrhs()
}
-
+void
initialize_LA()
{
register int i, j, k;
@@ -208,7 +223,7 @@ initialize_LA()
}
}
-
+void
set_goto_map()
{
register shifts *sp;
@@ -306,7 +321,7 @@ int symbol;
}
-
+void
initialize_F()
{
register int i;
@@ -383,7 +398,7 @@ initialize_F()
}
-
+void
build_relations()
{
register int i;
@@ -475,7 +490,7 @@ build_relations()
FREE(states);
}
-
+void
add_lookback_edge(stateno, ruleno, gotono)
int stateno, ruleno, gotono;
{
@@ -560,13 +575,13 @@ int n;
}
-
+void
compute_FOLLOWS()
{
digraph(includes);
}
-
+void
compute_lookaheads()
{
register int i, n;
@@ -600,7 +615,7 @@ compute_lookaheads()
FREE(F);
}
-
+void
digraph(relation)
short **relation;
{
@@ -627,7 +642,7 @@ short **relation;
}
-
+void
traverse(i)
register int i;
{
diff --git a/usr.bin/yacc/lr0.c b/usr.bin/yacc/lr0.c
index 4f1bd9577cd..73078c50535 100644
--- a/usr.bin/yacc/lr0.c
+++ b/usr.bin/yacc/lr0.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lr0.c,v 1.3 1996/06/26 05:44:37 deraadt Exp $ */
+/* $OpenBSD: lr0.c,v 1.4 2001/07/16 06:29:44 pvalchev Exp $ */
/* $NetBSD: lr0.c,v 1.4 1996/03/19 03:21:35 jtc Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)lr0.c 5.3 (Berkeley) 1/20/91";
#else
-static char rcsid[] = "$OpenBSD: lr0.c,v 1.3 1996/06/26 05:44:37 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: lr0.c,v 1.4 2001/07/16 06:29:44 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -56,8 +56,27 @@ core *first_state;
shifts *first_shift;
reductions *first_reduction;
-int get_state();
-core *new_state();
+int get_state __P((int));
+core *new_state __P((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 core **state_set;
static core *this_state;
@@ -75,7 +94,7 @@ static short **kernel_base;
static short **kernel_end;
static short *kernel_items;
-
+void
allocate_itemsets()
{
register short *itemp;
@@ -117,7 +136,7 @@ allocate_itemsets()
kernel_end = NEW2(nsyms, short *);
}
-
+void
allocate_storage()
{
allocate_itemsets();
@@ -126,7 +145,7 @@ allocate_storage()
state_set = NEW2(nitems, core *);
}
-
+void
append_states()
{
register int i;
@@ -155,7 +174,7 @@ append_states()
}
}
-
+void
free_storage()
{
FREE(shift_symbol);
@@ -168,7 +187,7 @@ free_storage()
}
-
+void
generate_states()
{
allocate_storage();
@@ -260,7 +279,7 @@ int symbol;
}
-
+void
initialize_states()
{
register int i;
@@ -287,7 +306,7 @@ initialize_states()
nstates = 1;
}
-
+void
new_itemsets()
{
register int i;
@@ -365,6 +384,7 @@ int symbol;
/* show_cores is used for debugging */
+void
show_cores()
{
core *p;
@@ -400,6 +420,7 @@ show_cores()
/* show_ritems is used for debugging */
+void
show_ritems()
{
int i;
@@ -410,6 +431,8 @@ show_ritems()
/* show_rrhs is used for debugging */
+
+void
show_rrhs()
{
int i;
@@ -421,6 +444,7 @@ show_rrhs()
/* show_shifts is used for debugging */
+void
show_shifts()
{
shifts *p;
@@ -438,7 +462,7 @@ show_shifts()
}
}
-
+void
save_shifts()
{
register shifts *p;
@@ -472,7 +496,7 @@ save_shifts()
}
-
+void
save_reductions()
{
register short *isp;
@@ -521,7 +545,7 @@ save_reductions()
}
}
-
+void
set_derives()
{
register int i, k;
@@ -552,6 +576,7 @@ set_derives()
#endif
}
+void
free_derives()
{
FREE(derives[start_symbol]);
@@ -559,6 +584,7 @@ free_derives()
}
#ifdef DEBUG
+void
print_derives()
{
register int i;
@@ -580,7 +606,7 @@ print_derives()
}
#endif
-
+void
set_nullable()
{
register int i, j;
@@ -629,13 +655,13 @@ set_nullable()
#endif
}
-
+void
free_nullable()
{
FREE(nullable);
}
-
+void
lr0()
{
set_derives();
diff --git a/usr.bin/yacc/main.c b/usr.bin/yacc/main.c
index 7e80b1ef054..e9fdb794046 100644
--- a/usr.bin/yacc/main.c
+++ b/usr.bin/yacc/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.11 2001/01/19 17:58:22 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.12 2001/07/16 06:29:44 pvalchev Exp $ */
/* $NetBSD: main.c,v 1.5 1996/03/19 03:21:38 jtc Exp $ */
/*
@@ -47,15 +47,16 @@ char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 5.5 (Berkeley) 5/24/93";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.11 2001/01/19 17:58:22 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.12 2001/07/16 06:29:44 pvalchev Exp $";
#endif
#endif /* not lint */
#include <sys/types.h>
#include <fcntl.h>
#include <paths.h>
-#include <stdlib.h>
#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
#include "defs.h"
char dflag;
@@ -115,6 +116,14 @@ char *rassoc;
short **derives;
char *nullable;
+void onintr __P((int));
+void set_signals __P((void));
+void usage __P((void));
+void getargs __P((int, register char *[]));
+void create_file_names __P((void));
+void open_files __P((void));
+
+void
done(k)
int k;
{
@@ -133,6 +142,7 @@ onintr(signo)
}
+void
set_signals()
{
#ifdef SIGINT
@@ -150,6 +160,7 @@ set_signals()
}
+void
usage()
{
fprintf(stderr, "usage: %s [-dlrtv] [-b file_prefix] [-o outputfile] [-p symbol_prefix] filename\n", __progname);
@@ -157,6 +168,7 @@ usage()
}
+void
getargs(argc, argv)
int argc;
char *argv[];
@@ -286,7 +298,7 @@ unsigned n;
return (p);
}
-
+void
create_file_names()
{
int i, len;
@@ -420,7 +432,7 @@ fsopen(name, mode)
return (fp);
}
-
+void
open_files()
{
int fd;
@@ -490,4 +502,5 @@ char *argv[];
output();
done(0);
/*NOTREACHED*/
+ return (0);
}
diff --git a/usr.bin/yacc/mkpar.c b/usr.bin/yacc/mkpar.c
index e367ed6154f..585f63b678a 100644
--- a/usr.bin/yacc/mkpar.c
+++ b/usr.bin/yacc/mkpar.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkpar.c,v 1.5 1999/08/04 18:31:26 millert Exp $ */
+/* $OpenBSD: mkpar.c,v 1.6 2001/07/16 06:29:44 pvalchev Exp $ */
/* $NetBSD: mkpar.c,v 1.4 1996/03/19 03:21:39 jtc Exp $ */
@@ -67,7 +67,17 @@ extern action *get_shifts();
extern action *add_reductions();
extern action *add_reduce();
+int sole_reduction __P((int));
+void free_action_row __P((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));
+
+
+void
make_parser()
{
register int i;
@@ -198,6 +208,7 @@ register int ruleno, symbol;
}
+void
find_final_state()
{
register int goal, i;
@@ -215,6 +226,7 @@ find_final_state()
}
+void
unused_rules()
{
register int i;
@@ -239,15 +251,17 @@ unused_rules()
for (i = 3; i < nrules; ++i)
if (!rules_used[i]) ++nunused;
- if (nunused)
+ if (nunused) {
if (nunused == 1)
fprintf(stderr, "%s: 1 rule never reduced\n", __progname);
else
fprintf(stderr, "%s: %d rules never reduced\n", __progname,
nunused);
+ }
}
+void
remove_conflicts()
{
register int i;
@@ -323,6 +337,7 @@ remove_conflicts()
}
+void
total_conflicts()
{
/* Warn if s/r != expect or if any r/r */
@@ -372,6 +387,7 @@ int stateno;
}
+void
defreds()
{
register int i;
@@ -381,6 +397,7 @@ defreds()
defred[i] = sole_reduction(i);
}
+void
free_action_row(p)
register action *p;
{
@@ -394,6 +411,7 @@ register action *p;
}
}
+void
free_parser()
{
register int i;
diff --git a/usr.bin/yacc/output.c b/usr.bin/yacc/output.c
index d6dbd629e79..3e87105f41c 100644
--- a/usr.bin/yacc/output.c
+++ b/usr.bin/yacc/output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: output.c,v 1.5 2001/02/26 00:03:32 tholo Exp $ */
+/* $OpenBSD: output.c,v 1.6 2001/07/16 06:29:45 pvalchev Exp $ */
/* $NetBSD: output.c,v 1.4 1996/03/19 03:21:41 jtc Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)output.c 5.7 (Berkeley) 5/24/93";
#else
-static char rcsid[] = "$OpenBSD: output.c,v 1.5 2001/02/26 00:03:32 tholo Exp $";
+static char rcsid[] = "$OpenBSD: output.c,v 1.6 2001/07/16 06:29:45 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -63,7 +63,33 @@ 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));
+
+void
output()
{
free_itemsets();
@@ -87,6 +113,7 @@ output()
}
+void
output_prefix()
{
if (symbol_prefix == NULL)
@@ -151,6 +178,7 @@ output_prefix()
}
+void
output_rule_data()
{
register int i;
@@ -198,6 +226,7 @@ output_rule_data()
}
+void
output_yydefred()
{
register int i, j;
@@ -225,6 +254,7 @@ output_yydefred()
}
+void
output_actions()
{
nvectors = 2*nstates + nvars;
@@ -253,6 +283,7 @@ output_actions()
}
+void
token_actions()
{
register int i, j;
@@ -337,6 +368,7 @@ token_actions()
FREE(actionrow);
}
+void
goto_actions()
{
register int i, j, k;
@@ -406,6 +438,7 @@ int symbol;
+void
save_column(symbol, default_state)
int symbol;
int default_state;
@@ -448,6 +481,7 @@ int default_state;
width[symno] = sp1[-1] - sp[0] + 1;
}
+void
sort_actions()
{
register int i;
@@ -483,6 +517,7 @@ sort_actions()
}
+void
pack_table()
{
register int i;
@@ -664,6 +699,7 @@ int vector;
+void
output_base()
{
register int i, j;
@@ -730,6 +766,7 @@ output_base()
+void
output_table()
{
register int i;
@@ -762,6 +799,7 @@ output_table()
+void
output_check()
{
register int i;
@@ -824,6 +862,7 @@ char *name;
}
+void
output_defines()
{
register int c, i;
@@ -876,6 +915,7 @@ output_defines()
}
+void
output_stored_text()
{
register int c;
@@ -903,6 +943,7 @@ output_stored_text()
}
+void
output_debug()
{
register int i, j, k, max;
@@ -940,7 +981,7 @@ output_debug()
j = 80;
for (i = 0; i <= max; ++i)
{
- if (s = symnam[i])
+ if ((s = symnam[i]) != '\0')
{
if (s[0] == '"')
{
@@ -1117,6 +1158,7 @@ output_debug()
}
+void
output_stype()
{
if (!unionized && ntags == 0)
@@ -1127,6 +1169,7 @@ output_stype()
}
+void
output_trailing_text()
{
register int c, last;
@@ -1184,6 +1227,7 @@ output_trailing_text()
}
+void
output_semantic_actions()
{
register int c, last;
@@ -1221,6 +1265,7 @@ output_semantic_actions()
}
+void
free_itemsets()
{
register core *cp, *next;
@@ -1234,6 +1279,7 @@ free_itemsets()
}
+void
free_shifts()
{
register shifts *sp, *next;
@@ -1248,6 +1294,7 @@ free_shifts()
+void
free_reductions()
{
register reductions *rp, *next;
diff --git a/usr.bin/yacc/reader.c b/usr.bin/yacc/reader.c
index ad85a9f379c..ac44ebb0f76 100644
--- a/usr.bin/yacc/reader.c
+++ b/usr.bin/yacc/reader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: reader.c,v 1.7 2001/07/12 05:17:33 deraadt Exp $ */
+/* $OpenBSD: reader.c,v 1.8 2001/07/16 06:29:45 pvalchev Exp $ */
/* $NetBSD: reader.c,v 1.5 1996/03/19 03:21:43 jtc Exp $ */
@@ -79,8 +79,45 @@ bucket **plhs;
int name_pool_size;
char *name_pool;
-char line_format[] = "#line %d \"%s\"\n";
+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));
+char line_format[] = "#line %d \"%s\"\n";
void
cachec(c)
@@ -318,6 +355,7 @@ keyword()
}
syntax_error(lineno, line, t_cptr);
/*NOTREACHED*/
+ return (0);
}
@@ -351,6 +389,7 @@ copy_ident()
}
+void
copy_text()
{
register int c;
@@ -482,6 +521,7 @@ loop:
}
+void
copy_union()
{
register int c;
@@ -878,6 +918,7 @@ get_tag()
}
+void
declare_tokens(assoc)
int assoc;
{
@@ -945,6 +986,7 @@ int assoc;
* as it really isn't part of the yacc
* grammar only a flag for yacc proper.
*/
+void
declare_expect(assoc)
int assoc;
{
@@ -984,6 +1026,7 @@ int assoc;
}
+void
declare_types()
{
register int c;
@@ -1012,6 +1055,7 @@ declare_types()
}
+void
declare_start()
{
register int c;
@@ -1030,6 +1074,7 @@ declare_start()
}
+void
read_declarations()
{
register int c, k;
@@ -1083,6 +1128,7 @@ read_declarations()
}
+void
initialize_grammar()
{
nitems = 4;
@@ -1114,6 +1160,7 @@ initialize_grammar()
}
+void
expand_items()
{
maxitems += 300;
@@ -1122,6 +1169,7 @@ expand_items()
}
+void
expand_rules()
{
maxrules += 100;
@@ -1134,6 +1182,7 @@ expand_rules()
}
+void
advance_to_start()
{
register int c;
@@ -1184,6 +1233,7 @@ advance_to_start()
}
+void
start_rule(bp, s_lineno)
register bucket *bp;
int s_lineno;
@@ -1199,6 +1249,7 @@ int s_lineno;
}
+void
end_rule()
{
register int i;
@@ -1218,6 +1269,7 @@ end_rule()
}
+void
insert_empty_rule()
{
register bucket *bp, **bpp;
@@ -1234,7 +1286,7 @@ insert_empty_rule()
expand_items();
bpp = pitem + nitems - 1;
*bpp-- = bp;
- while (bpp[0] = bpp[-1]) --bpp;
+ while ((bpp[0] = bpp[-1])) --bpp;
if (++nrules >= maxrules)
expand_rules();
@@ -1247,6 +1299,7 @@ insert_empty_rule()
}
+void
add_symbol()
{
register int c;
@@ -1278,6 +1331,7 @@ add_symbol()
}
+void
copy_action()
{
register int c;
@@ -1547,6 +1601,7 @@ mark_symbol()
}
+void
read_grammar()
{
register int c;
@@ -1580,6 +1635,7 @@ read_grammar()
}
+void
free_tags()
{
register int i;
@@ -1595,6 +1651,7 @@ free_tags()
}
+void
pack_names()
{
register bucket *bp;
@@ -1613,13 +1670,14 @@ pack_names()
{
p = t;
s = bp->name;
- while (*t++ = *s++) continue;
+ while ((*t++ = *s++)) continue;
FREE(bp->name);
bp->name = p;
}
}
+void
check_symbols()
{
register bucket *bp;
@@ -1638,6 +1696,7 @@ check_symbols()
}
+void
pack_symbols()
{
register bucket *bp;
@@ -1762,6 +1821,7 @@ pack_symbols()
}
+void
pack_grammar()
{
register int i, j;
@@ -1821,6 +1881,7 @@ pack_grammar()
}
+void
print_grammar()
{
register int i, j, k;
@@ -1857,6 +1918,7 @@ print_grammar()
}
+void
reader()
{
write_section(banner);
diff --git a/usr.bin/yacc/skeleton.c b/usr.bin/yacc/skeleton.c
index 0353a012182..ba8dfd955de 100644
--- a/usr.bin/yacc/skeleton.c
+++ b/usr.bin/yacc/skeleton.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: skeleton.c,v 1.16 2001/02/26 00:03:33 tholo Exp $ */
+/* $OpenBSD: skeleton.c,v 1.17 2001/07/16 06:29:45 pvalchev Exp $ */
/* $NetBSD: skeleton.c,v 1.10 1996/03/25 00:36:18 mrg Exp $ */
/*
@@ -67,7 +67,7 @@ char *banner[] =
"#if __GNUC__ == 2",
" __attribute__ ((unused))",
"#endif /* __GNUC__ == 2 */",
- " = \"$OpenBSD: skeleton.c,v 1.16 2001/02/26 00:03:33 tholo Exp $\";",
+ " = \"$OpenBSD: skeleton.c,v 1.17 2001/07/16 06:29:45 pvalchev Exp $\";",
"#endif",
"#include <stdlib.h>",
"#define YYBYACC 1",
@@ -398,6 +398,7 @@ char *trailer[] =
};
+void
write_section(section)
char *section[];
{
@@ -407,7 +408,7 @@ char *section[];
register FILE *f;
f = code_file;
- for (i = 0; s = section[i]; ++i)
+ for (i = 0; (s = section[i]); ++i)
{
++outline;
while (c = *s)
diff --git a/usr.bin/yacc/symtab.c b/usr.bin/yacc/symtab.c
index 9874b994eb5..472ea1dc9b0 100644
--- a/usr.bin/yacc/symtab.c
+++ b/usr.bin/yacc/symtab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: symtab.c,v 1.3 1996/06/26 05:44:39 deraadt Exp $ */
+/* $OpenBSD: symtab.c,v 1.4 2001/07/16 06:29:45 pvalchev Exp $ */
/* $NetBSD: symtab.c,v 1.4 1996/03/19 03:21:48 jtc Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)symtab.c 5.3 (Berkeley) 6/1/90";
#else
-static char rcsid[] = "$OpenBSD: symtab.c,v 1.3 1996/06/26 05:44:39 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: symtab.c,v 1.4 2001/07/16 06:29:45 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -57,6 +57,8 @@ bucket **symbol_table;
bucket *first_symbol;
bucket *last_symbol;
+int hash __P((char *));
+
int
hash(name)
@@ -126,6 +128,7 @@ char *name;
}
+void
create_symbol_table()
{
register int i;
@@ -146,6 +149,7 @@ create_symbol_table()
}
+void
free_symbol_table()
{
FREE(symbol_table);
@@ -153,6 +157,7 @@ free_symbol_table()
}
+void
free_symbols()
{
register bucket *p, *q;
diff --git a/usr.bin/yacc/verbose.c b/usr.bin/yacc/verbose.c
index a932dbe79a5..0628b3ea976 100644
--- a/usr.bin/yacc/verbose.c
+++ b/usr.bin/yacc/verbose.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: verbose.c,v 1.3 1996/06/26 05:44:40 deraadt Exp $ */
+/* $OpenBSD: verbose.c,v 1.4 2001/07/16 06:29:45 pvalchev Exp $ */
/* $NetBSD: verbose.c,v 1.4 1996/03/19 03:21:50 jtc Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)verbose.c 5.3 (Berkeley) 1/20/91";
#else
-static char rcsid[] = "$OpenBSD: verbose.c,v 1.3 1996/06/26 05:44:40 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: verbose.c,v 1.4 2001/07/16 06:29:45 pvalchev Exp $";
#endif
#endif /* not lint */
@@ -49,6 +49,18 @@ static char rcsid[] = "$OpenBSD: verbose.c,v 1.3 1996/06/26 05:44:40 deraadt 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));
+
+void
verbose()
{
register int i;
@@ -73,6 +85,7 @@ verbose()
}
+void
log_unused()
{
register int i;
@@ -92,6 +105,7 @@ log_unused()
}
+void
log_conflicts()
{
register int i;
@@ -120,6 +134,7 @@ log_conflicts()
}
+void
print_state(state)
int state;
{
@@ -134,6 +149,7 @@ int state;
}
+void
print_conflicts(state)
int state;
{
@@ -182,6 +198,7 @@ int state;
}
+void
print_core(state)
int state;
{
@@ -218,6 +235,7 @@ int state;
}
+void
print_nulls(state)
int state;
{
@@ -262,6 +280,7 @@ int state;
}
+void
print_actions(stateno)
int stateno;
{
@@ -289,6 +308,7 @@ int stateno;
}
+void
print_shifts(p)
register action *p;
{
@@ -314,6 +334,7 @@ register action *p;
}
+void
print_reductions(p, defred)
register action *p;
register int defred;
@@ -352,6 +373,7 @@ register int defred;
}
+void
print_gotos(stateno)
int stateno;
{
diff --git a/usr.bin/yacc/warshall.c b/usr.bin/yacc/warshall.c
index 0dd4b3d74cb..e2e3639b2f5 100644
--- a/usr.bin/yacc/warshall.c
+++ b/usr.bin/yacc/warshall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: warshall.c,v 1.3 1996/06/26 05:44:40 deraadt Exp $ */
+/* $OpenBSD: warshall.c,v 1.4 2001/07/16 06:29:45 pvalchev Exp $ */
/* $NetBSD: warshall.c,v 1.4 1996/03/19 03:21:51 jtc Exp $ */
/*
@@ -41,12 +41,15 @@
#if 0
static char sccsid[] = "@(#)warshall.c 5.4 (Berkeley) 5/24/93";
#else
-static char rcsid[] = "$OpenBSD: warshall.c,v 1.3 1996/06/26 05:44:40 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: warshall.c,v 1.4 2001/07/16 06:29:45 pvalchev Exp $";
#endif
#endif /* not lint */
#include "defs.h"
+void transitive_closure __P((unsigned *, int));
+
+void
transitive_closure(R, n)
unsigned *R;
int n;
@@ -99,6 +102,7 @@ int n;
}
}
+void
reflexive_transitive_closure(R, n)
unsigned *R;
int n;