/* Version of package. */
#undef VERSION
+/* Define if the compiler understands prototypes. */
+#undef PROTOTYPES
+
@BOTTOM@
+#if defined(PROTOTYPES) || defined(__cplusplus)
+# define PARAMS(p) p
+#else
+# define PARAMS(p) ()
+#endif
+
#endif /* CONFIG_H */
dnl Process this file with autoconf to produce a configure script.
AC_INIT(reduce.c)
-AM_INIT_AUTOMAKE(bison,1.25.90)
+AM_INIT_AUTOMAKE(bison,1.26)
AM_CONFIG_HEADER(config.h:config.hin)
dnl Checks for programs.
AC_PROG_CC
+AC_MINIX
+AC_ISC_POSIX
+AM_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_RANLIB
-AC_MINIX
-AC_ISC_POSIX
+dnl Checks for libraries.
dnl Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS(string.h stdlib.h memory.h)
+AC_CHECK_HEADERS(ctype.h locale.h memory.h stdlib.h string.h unistd.h)
+
+dnl Checks for typedefs.
+
+dnl Checks for structures.
-dnl Checks for typedefs, structures, and compiler characteristics.
+dnl Checks for compiler characteristics.
AC_C_CONST
+AM_C_PROTOTYPES
dnl Checks for library functions.
AC_FUNC_ALLOCA
+AC_CHECK_FUNCS(setlocale)
AC_OUTPUT(Makefile)
shifts *first_shift;
reductions *first_reduction;
-int get_state();
-core *new_state();
-
-void new_itemsets();
-void append_states();
-void initialize_states();
-void save_shifts();
-void save_reductions();
-void augment_automaton();
-void insert_start_shift();
-extern void initialize_closure();
-extern void closure();
-extern void finalize_closure();
-extern void toomany();
+int get_state PARAMS((int));
+core *new_state PARAMS((int));
+
+void allocate_itemsets PARAMS((void));
+void allocate_storage PARAMS((void));
+void free_storage PARAMS((void));
+void generate_states PARAMS((void));
+void new_itemsets PARAMS((void));
+void append_states PARAMS((void));
+void initialize_states PARAMS((void));
+void save_shifts PARAMS((void));
+void save_reductions PARAMS((void));
+void augment_automaton PARAMS((void));
+void insert_start_shift PARAMS((void));
+extern void initialize_closure PARAMS((int));
+extern void closure PARAMS((short *, int));
+extern void finalize_closure PARAMS((void));
+extern void toomany PARAMS((char *));
static core *this_state;
static core *last_state;
void
-allocate_itemsets()
+allocate_itemsets (void)
{
register short *itemp;
register int symbol;
void
-allocate_storage()
+allocate_storage (void)
{
allocate_itemsets();
void
-free_storage()
+free_storage (void)
{
FREE(shift_symbol);
FREE(redset);
/* compute the nondeterministic finite state machine (see state.h for details)
from the grammar. */
void
-generate_states()
+generate_states (void)
{
allocate_storage();
initialize_closure(nitems);
a vector of item numbers activated if that symbol is shifted,
and kernel_end[symbol] points after the end of that vector. */
void
-new_itemsets()
+new_itemsets (void)
{
register int i;
register int shiftcount;
shiftset is set up as a vector of state numbers of those states. */
void
-append_states()
+append_states (void)
{
register int i;
register int j;
Used by append_states */
int
-get_state(symbol)
-int symbol;
+get_state (int symbol)
{
register int key;
register short *isp1;
/* subroutine of get_state. create a new state for those items, if necessary. */
core *
-new_state(symbol)
-int symbol;
+new_state (int symbol)
{
register int n;
register core *p;
void
-initialize_states()
+initialize_states (void)
{
register core *p;
/* register unsigned *rp1; JF unused */
void
-save_shifts()
+save_shifts (void)
{
register shifts *p;
register short *sp1;
register short *send;
p = (shifts *) xmalloc((unsigned) (sizeof(shifts) +
- (nshifts - 1) * sizeof(short)));
+ (nshifts - 1) * sizeof(short)));
p->number = this_state->number;
p->nshifts = nshifts;
/* find which rules can be used for reduction transitions from the current state
and make a reductions structure for the state to record their rule numbers. */
void
-save_reductions()
+save_reductions (void)
{
register short *isp;
register short *rp1;
if (count)
{
p = (reductions *) xmalloc((unsigned) (sizeof(reductions) +
- (count - 1) * sizeof(short)));
+ (count - 1) * sizeof(short)));
p->number = this_state->number;
p->nreds = count;
to the termination state.
Create such states and shifts if they don't happen to exist already. */
void
-augment_automaton()
+augment_automaton (void)
{
register int i;
register int k;
if (sp && sp->number == k)
{
sp2 = (shifts *) xmalloc((unsigned) (sizeof(shifts)
- + sp->nshifts * sizeof(short)));
+ + sp->nshifts * sizeof(short)));
sp2->number = k;
sp2->nshifts = sp->nshifts + 1;
sp2->shifts[0] = nstates;
Create the next-to-final state, to which a shift has already been made in
the initial state. */
void
-insert_start_shift()
+insert_start_shift (void)
{
register core *statep;
register shifts *sp;
#define FREE(x) ((x) != 0 && (free ((char *) (x)), 0))
#endif
-extern char *xmalloc();
-extern char *xrealloc();
+extern char *xmalloc PARAMS((register unsigned));
+extern char *xrealloc PARAMS((register char *, register unsigned));
extern char *realloc ();
#endif
-extern void done ();
+char *xmalloc PARAMS((register unsigned));
+char *xrealloc PARAMS((register char *, register unsigned));
+
+extern void done PARAMS((int));
extern char *program_name;
char *
-xmalloc (n)
- register unsigned n;
+xmalloc (register unsigned n)
{
register char *block;
}
char *
-xrealloc (block, n)
- register char *block;
- register unsigned n;
+xrealloc (register char *block, register unsigned n)
{
/* Avoid uncertainty about what an arg of 0 will do. */
if (n == 0)
extern short **derives;
extern char **tags;
-void set_fderives();
-void set_firsts();
+void initialize_closure PARAMS((int));
+void set_fderives PARAMS((void));
+void set_firsts PARAMS((void));
+void closure PARAMS((short *, int));
+void finalize_closure PARAMS((void));
-extern void RTC();
+extern void RTC PARAMS((unsigned *, int));
short *itemset;
short *itemsetend;
void
-initialize_closure(n)
-int n;
+initialize_closure (int n)
{
itemset = NEW2(n, short);
the sequence of symbols 8 3 20, and one of the rules for deriving
symbol 8 is rule 4, then the [5 - ntokens, 4] bit in fderives is set. */
void
-set_fderives()
+set_fderives (void)
{
register unsigned *rrow;
register unsigned *vrow;
the symbol 8 can be the beginning of the data for symbol 5,
so the bit [8 - ntokens, 5 - ntokens] in firsts is set. */
void
-set_firsts()
+set_firsts (void)
{
register unsigned *row;
/* register int done; JF unused */
void
-closure(core, n)
-short *core;
-int n;
+closure (short *core, int n)
{
register int ruleno;
register unsigned word;
void
-finalize_closure()
+finalize_closure (void)
{
FREE(itemset);
FREE(ruleset);
}
-
-print_firsts()
+void
+print_firsts (void)
{
register int i;
register int j;
}
-
-print_fderives()
+void
+print_fderives (void)
{
register int i;
register int j;
extern short *LAruleno;
extern short *lookaheads;
extern int verboseflag;
-
-void set_conflicts();
-void resolve_sr_conflict();
-void flush_shift();
-void log_resolution();
-void total_conflicts();
-void count_sr_conflicts();
-void count_rr_conflicts();
+extern int fixed_outfiles;
+
+void initialize_conflicts PARAMS((void));
+void set_conflicts PARAMS((int));
+void resolve_sr_conflict PARAMS((int, int));
+void flush_shift PARAMS((int, int));
+void log_resolution PARAMS((int, int, int, char *));
+void conflict_log PARAMS((void));
+void verbose_conflict_log PARAMS((void));
+void total_conflicts PARAMS((void));
+void count_sr_conflicts PARAMS((int));
+void count_rr_conflicts PARAMS((int));
+void print_reductions PARAMS((int));
+void finalize_conflicts PARAMS((void));
char any_conflicts;
char *conflicts;
void
-initialize_conflicts()
+initialize_conflicts (void)
{
register int i;
/* register errs *sp; JF unused */
void
-set_conflicts(state)
-int state;
+set_conflicts (int state)
{
register int i;
register int k;
so that there is no longer a conflict. */
void
-resolve_sr_conflict(state, lookaheadnum)
-int state;
-int lookaheadnum;
+resolve_sr_conflict (int state, int lookaheadnum)
{
register int i;
register int mask;
Used when we resolve a shift-reduce conflict in favor of the reduction. */
void
-flush_shift(state, token)
-int state;
-int token;
+flush_shift (int state, int token)
{
register shifts *shiftp;
register int k, i;
void
-log_resolution(state, LAno, token, resolution)
-int state, LAno, token;
-char *resolution;
+log_resolution (int state, int LAno, int token, char *resolution)
{
fprintf(foutput,
_("Conflict in state %d between rule %d and token %s resolved as %s.\n"),
void
-conflict_log()
+conflict_log (void)
{
register int i;
void
-verbose_conflict_log()
+verbose_conflict_log (void)
{
register int i;
void
-total_conflicts()
+total_conflicts (void)
{
- extern int fixed_outfiles;
-
if (src_total == expected_conflicts && rrc_total == 0)
return;
void
-count_sr_conflicts(state)
-int state;
+count_sr_conflicts (int state)
{
register int i;
register int k;
void
-count_rr_conflicts(state)
-int state;
+count_rr_conflicts (int state)
{
register int i;
register int j;
void
-print_reductions(state)
-int state;
+print_reductions (int state)
{
register int i;
register int j;
void
-finalize_conflicts()
+finalize_conflicts (void)
{
FREE(conflicts);
FREE(shiftset);
#include "types.h"
#include "gram.h"
+void set_derives PARAMS((void));
+void free_derives PARAMS((void));
short **derives;
void
-set_derives()
+set_derives (void)
{
register int i;
register int lhs;
}
void
-free_derives()
+free_derives (void)
{
FREE(derives[ntokens]);
FREE(derives + ntokens);
#ifdef DEBUG
-print_derives()
+void
+print_derives (void)
{
register int i;
register short *sp;
}
#endif
-
char *spec_file_prefix; /* for -b. */
extern int fixed_outfiles;/* for -y */
+void usage PARAMS((FILE *));
+void getargs PARAMS((int, char *[]));
+
extern char *program_name;
extern char *version_string;
-extern void warns(); /* main.c */
+extern void warns PARAMS((char *, char *)); /* main.c */
struct option longopts[] =
{
};
void
-usage (stream)
- FILE *stream;
+usage (FILE *stream)
{
fprintf (stream, _("\
Usage: %s [-dhklntvyV] [-b file-prefix] [-o outfile] [-p name-prefix]\n\
}
void
-getargs(argc, argv)
- int argc;
- char *argv[];
+getargs (int argc, char *argv[])
{
register int c;
/* This is to avoid linker problems which occur on VMS when using GCC,
when the file in question contains data definitions only. */
-void
-dummy()
+static void
+dummy (void)
{
}
short *from_state;
short *to_state;
-short **transpose();
-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 add_lookback_edge();
-void compute_FOLLOWS();
-void compute_lookaheads();
-void digraph();
-void traverse();
-
-extern void toomany();
-extern void berror();
+void lalr PARAMS((void));
+short **transpose PARAMS((short **, int));
+void set_state_table PARAMS((void));
+void set_accessing_symbol PARAMS((void));
+void set_shift_table PARAMS((void));
+void set_reduction_table PARAMS((void));
+void set_maxrhs PARAMS((void));
+void initialize_LA PARAMS((void));
+void set_goto_map PARAMS((void));
+int map_goto PARAMS((int, int));
+void initialize_F PARAMS((void));
+void build_relations PARAMS((void));
+void add_lookback_edge PARAMS((int, int, int));
+void compute_FOLLOWS PARAMS((void));
+void compute_lookaheads PARAMS((void));
+void digraph PARAMS((short **));
+void traverse PARAMS((register int));
+
+extern void toomany PARAMS((char *));
+extern void berror PARAMS((char *));
static int infinity;
static int maxrhs;
void
-lalr()
+lalr (void)
{
tokensetsize = WORDSIZE(ntokens);
void
-set_state_table()
+set_state_table (void)
{
register core *sp;
void
-set_accessing_symbol()
+set_accessing_symbol (void)
{
register core *sp;
void
-set_shift_table()
+set_shift_table (void)
{
register shifts *sp;
void
-set_reduction_table()
+set_reduction_table (void)
{
register reductions *rp;
void
-set_maxrhs()
+set_maxrhs (void)
{
register short *itemp;
register int length;
void
-initialize_LA()
+initialize_LA (void)
{
register int i;
register int j;
{
if (!consistent[i])
{
- if (rp = reduction_table[i])
+ if ((rp = reduction_table[i]))
for (j = 0; j < rp->nreds; j++)
*np++ = rp->rules[j];
}
void
-set_goto_map()
+set_goto_map (void)
{
register shifts *sp;
register int i;
/* 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;
void
-initialize_F()
+initialize_F (void)
{
register int i;
register int j;
void
-build_relations()
+build_relations (void)
{
register int i;
register int j;
void
-add_lookback_edge(stateno, ruleno, gotono)
-int stateno;
-int ruleno;
-int gotono;
+add_lookback_edge (int stateno, int ruleno, int gotono)
{
register int i;
register int k;
short **
-transpose(R_arg, n)
-short **R_arg;
-int n;
+transpose (short **R_arg, int n)
{
register short **new_R;
register short **temp_R;
void
-compute_FOLLOWS()
+compute_FOLLOWS (void)
{
register int i;
void
-compute_lookaheads()
+compute_lookaheads (void)
{
register int i;
register int n;
void
-digraph(relation)
-short **relation;
+digraph (short **relation)
{
register int i;
void
-traverse(i)
-register int i;
+traverse (register int i)
{
register unsigned *fp1;
register unsigned *fp2;
symval is set to a pointer to the entry found. */
#include <stdio.h>
-#include <ctype.h>
#include "system.h"
#include "files.h"
#include "getopt.h" /* for optarg */
extern int lineno;
extern int translations;
-int parse_percent_token();
+void init_lex PARAMS((void));
+char *grow_token_buffer PARAMS((char *));
+int skip_white_space PARAMS((void));
+int safegetc PARAMS((FILE *));
+int literalchar PARAMS((char **, int *, char));
+void unlex PARAMS((int));
+int lex PARAMS((void));
+int parse_percent_token PARAMS((void));
/* functions from main.c */
-extern char *printable_version();
-extern void fatal();
-extern void warni();
-extern void warn();
+extern char *printable_version PARAMS((int));
+extern void fatal PARAMS((char *));
+extern void warn PARAMS((char *));
+extern void warni PARAMS((char *, int));
+extern void warns PARAMS((char *, char *));
/* Buffer for storing the current token. */
char *token_buffer;
/* Allocated size of token_buffer, not including space for terminator. */
-static int maxtoken;
+int maxtoken;
bucket *symval;
int numval;
void
-init_lex()
+init_lex (void)
{
maxtoken = 100;
token_buffer = NEW2 (maxtoken + 1, char);
}
-static char *
-grow_token_buffer (p)
- char *p;
+char *
+grow_token_buffer (char *p)
{
int offset = p - token_buffer;
maxtoken *= 2;
int
-skip_white_space()
+skip_white_space (void)
{
register int c;
register int inside;
/* do a getc, but give error message if EOF encountered */
int
-safegetc(f)
- FILE *f;
+safegetc (FILE *f)
{
register int c = getc(f);
if (c == EOF)
report error for \n
*/
int
-literalchar(pp, pcode, term)
- char **pp;
- int *pcode;
- char term;
+literalchar (char **pp, int *pcode, char term)
{
register int c;
register char *p;
else if (c == 'r') code = '\r';
else if (c == 'f') code = '\f';
else if (c == 'b') code = '\b';
- else if (c == 'v') code = 013;
+ else if (c == 'v') code = '\013';
else if (c == '\\') code = '\\';
else if (c == '\'') code = '\'';
else if (c == '\"') code = '\"';
void
-unlex(token)
- int token;
+unlex (int token)
{
unlexed = token;
unlexed_symval = symval;
int
-lex()
+lex (void)
{
register int c;
char *p;
/* These would be acceptable, but they do not affect processing */
{"verbose", &verboseflag, NOOP}, /* -v */
{"debug", &debugflag, NOOP}, /* -t */
- /* {"help", <print usage stmt>, NOOP}, /* -h */
- /* {"version", <print version number> , NOOP}, /* -V */
+ /* {"help", <print usage stmt>, NOOP},*/ /* -h */
+ /* {"version", <print version number> , NOOP},*/ /* -V */
#endif
{NULL, NULL, ILLEGAL}
Assumes the % has already been read and discarded. */
int
-parse_percent_token ()
+parse_percent_token (void)
{
register int c;
register char *p;
extern int lineno;
extern int verboseflag;
+extern char *infile;
/* Nonzero means failure has been detected; don't write a parser file. */
int failure;
/* The name this program was run with, for messages. */
char *program_name;
-extern void getargs(), openfiles(), reader(), reduce_grammar();
-extern void set_derives(), set_nullable(), generate_states();
-extern void lalr(), initialize_conflicts(), verbose(), terse();
-extern void output(), done();
+char *printable_version PARAMS((int));
+char *int_to_string PARAMS((int));
+void fatal PARAMS((char *));
+void fatals PARAMS((char *, char *));
+void warn PARAMS((char *));
+void warni PARAMS((char *, int));
+void warns PARAMS((char *, char *));
+void warnss PARAMS((char *, char *, char *));
+void warnsss PARAMS((char *, char *, char *, char *));
+void toomany PARAMS((char *));
+void berror PARAMS((char *));
+
+extern void getargs PARAMS((int, char *[]));
+extern void openfiles PARAMS((void));
+extern void reader PARAMS((void));
+extern void reduce_grammar PARAMS((void));
+extern void set_derives PARAMS((void));
+extern void set_nullable PARAMS((void));
+extern void generate_states PARAMS((void));
+extern void lalr PARAMS((void));
+extern void initialize_conflicts PARAMS((void));
+extern void verbose PARAMS((void));
+extern void terse PARAMS((void));
+extern void output PARAMS((void));
+extern void done PARAMS((int));
/* VMS complained about using `int'. */
int
-main(argc, argv)
- int argc;
- char *argv[];
+main (int argc, char *argv[])
{
program_name = argv[0];
setlocale (LC_ALL, "");
either C itself, or the corresponding \DDD code. */
char *
-printable_version(c)
- int c;
+printable_version (int c)
{
static char buf[10];
if (c < ' ' || c >= '\177')
Return a ptr to internal memory containing the string. */
char *
-int_to_string(i)
- int i;
+int_to_string (int i)
{
static char buf[20];
sprintf(buf, "%d", i);
/* Print the message S for a fatal error. */
void
-fatal(s)
- char *s;
+fatal (char *s)
{
- extern char *infile;
-
if (infile == 0)
fprintf(stderr, _("%s: fatal error: %s\n"), program_name, s);
else
and incorporate string X1. */
void
-fatals(fmt, x1)
- char *fmt, *x1;
+fatals (char *fmt, char *x1)
{
char buffer[200];
sprintf(buffer, fmt, x1);
/* Print a warning message S. */
void
-warn(s)
- char *s;
+warn (char *s)
{
- extern char *infile;
-
if (infile == 0)
fprintf(stderr, _("%s: %s\n"), program_name, s);
else
The message is given by the format FMT. */
void
-warni(fmt, x1)
- char *fmt;
- int x1;
+warni (char *fmt, int x1)
{
char buffer[200];
sprintf(buffer, fmt, x1);
The message is given by the format FMT. */
void
-warns(fmt, x1)
- char *fmt, *x1;
+warns (char *fmt, char *x1)
{
char buffer[200];
sprintf(buffer, fmt, x1);
The message is given by the format FMT. */
void
-warnss(fmt, x1, x2)
- char *fmt, *x1, *x2;
+warnss (char *fmt, char *x1, char *x2)
{
char buffer[200];
sprintf(buffer, fmt, x1, x2);
The message is given by the format FMT. */
void
-warnsss(fmt, x1, x2, x3)
- char *fmt, *x1, *x2, *x3;
+warnsss (char *fmt, char *x1, char *x2, char *x3)
{
char buffer[200];
sprintf(buffer, fmt, x1, x2, x3);
instances of whatever is denoted by the string S. */
void
-toomany(s)
- char *s;
+toomany (char *s)
{
char buffer[200];
sprintf(buffer, _("too many %s (max %d)"), s, MAXSHORT);
/* Abort for an internal error denoted by string S. */
void
-berror(s)
- char *s;
+berror (char *s)
{
fprintf(stderr, _("%s: internal error: %s\n"), program_name, s);
abort();
char *nullable;
+void free_nullable PARAMS((void));
+void set_nullable PARAMS((void));
void
-set_nullable()
+set_nullable (void)
{
register short *r;
register short *s1;
void
-free_nullable()
+free_nullable (void)
{
FREE(nullable + ntokens);
}
extern short *goto_map;
extern short *from_state;
extern short *to_state;
-
-void output_token_translations();
-void output_gram();
-void output_stos();
-void output_rule_data();
-void output_defines();
-void output_actions();
-void token_actions();
-void save_row();
-void goto_actions();
-void save_column();
-void sort_actions();
-void pack_table();
-void output_base();
-void output_table();
-void output_check();
-void output_parser();
-void output_program();
-void free_itemset();
-void free_shifts();
-void free_reductions();
-void free_itemsets();
-int action_row();
-int default_goto();
-int matching_state();
-int pack_vector();
-
-extern void berror();
-extern void fatals();
-extern char *int_to_string();
-extern void reader_output_yylsp();
+extern int lineno;
+
+void output_headers PARAMS((void));
+void output_trailers PARAMS((void));
+void output PARAMS((void));
+void output_token_translations PARAMS((void));
+void output_gram PARAMS((void));
+void output_stos PARAMS((void));
+void output_rule_data PARAMS((void));
+void output_defines PARAMS((void));
+void output_actions PARAMS((void));
+void token_actions PARAMS((void));
+void save_row PARAMS((int));
+void goto_actions PARAMS((void));
+void save_column PARAMS((int, int));
+void sort_actions PARAMS((void));
+void pack_table PARAMS((void));
+void output_base PARAMS((void));
+void output_table PARAMS((void));
+void output_check PARAMS((void));
+void output_parser PARAMS((void));
+void output_program PARAMS((void));
+void free_shifts PARAMS((void));
+void free_reductions PARAMS((void));
+void free_itemsets PARAMS((void));
+int action_row PARAMS((int));
+int default_goto PARAMS((int));
+int matching_state PARAMS((int));
+int pack_vector PARAMS((int));
+
+extern void berror PARAMS((char *));
+extern void fatals PARAMS((char *, char *));
+extern char *int_to_string PARAMS((int));
+extern void reader_output_yylsp PARAMS((FILE *));
static int nvectors;
static int nentries;
void
-output_headers()
+output_headers (void)
{
if (semantic_parser)
fprintf(fguard, GUARDSTR, attrsfile);
void
-output_trailers()
+output_trailers (void)
{
if (semantic_parser)
fprintf(fguard, "\n }\n}\n");
void
-output()
+output (void)
{
int c;
void
-output_token_translations()
+output_token_translations (void)
{
register int i, j;
/* register short *sp; JF unused */
void
-output_gram()
+output_gram (void)
{
register int i;
register int j;
void
-output_stos()
+output_stos (void)
{
register int i;
register int j;
void
-output_rule_data()
+output_rule_data (void)
{
register int i;
register int j;
void
-output_defines()
+output_defines (void)
{
fprintf(ftable, "\n\n#define\tYYFINAL\t\t%d\n", final_state);
fprintf(ftable, "#define\tYYFLAG\t\t%d\n", MINSHORT);
/* compute and output yydefact, yydefgoto, yypact, yypgoto, yytable and yycheck. */
void
-output_actions()
+output_actions (void)
{
nvectors = nstates + nvars;
is saved for putting into yytable later. */
void
-token_actions()
+token_actions (void)
{
register int i;
register int j;
a token gets to handle it. */
int
-action_row(state)
-int state;
+action_row (int state)
{
register int i;
register int j;
void
-save_row(state)
-int state;
+save_row (int state)
{
register int i;
register int count;
is saved for putting into yytable later. */
void
-goto_actions()
+goto_actions (void)
{
register int i;
register int j;
int
-default_goto(symbol)
-int symbol;
+default_goto (int symbol)
{
register int i;
register int m;
void
-save_column(symbol, default_state)
-int symbol;
-int default_state;
+save_column (int symbol, int default_state)
{
register int i;
register int m;
the actions and gotos information into yytable. */
void
-sort_actions()
+sort_actions (void)
{
register int i;
register int j;
void
-pack_table()
+pack_table (void)
{
register int i;
register int place;
int
-matching_state(vector)
-int vector;
+matching_state (int vector)
{
register int i;
register int j;
int
-pack_vector(vector)
-int vector;
+pack_vector (int vector)
{
register int i;
register int j;
and the vectors whose elements index the portion starts */
void
-output_base()
+output_base (void)
{
register int i;
register int j;
void
-output_table()
+output_table (void)
{
register int i;
register int j;
void
-output_check()
+output_check (void)
{
register int i;
register int j;
/* copy the parser code into the ftable file at the end. */
void
-output_parser()
+output_parser (void)
{
register int c;
#ifdef DONTDEF
/* now write out the line... */
for (; c != '\n' && c != EOF; c = getc(fpars))
- if (write_line)
+ if (write_line) {
if (c == '$')
{
/* `$' in the parser file indicates where to put the actions.
}
else
putc(c, ftable);
+ }
if (c == EOF)
break;
putc(c, ftable);
}
void
-output_program()
+output_program (void)
{
register int c;
- extern int lineno;
if (!nolinesflag)
fprintf(ftable, "#line %d \"%s\"\n", lineno, infile);
void
-free_itemsets()
+free_itemsets (void)
{
register core *cp,*cptmp;
void
-free_shifts()
+free_shifts (void)
{
register shifts *sp,*sptmp;/* JF derefrenced freed ptr */
void
-free_reductions()
+free_reductions (void)
{
register reductions *rp,*rptmp;/* JF fixed freed ptr */
extern char *conflicts;
extern int final_state;
-extern void conflict_log();
-extern void verbose_conflict_log();
-extern void print_reductions();
-
-void print_token();
-void print_state();
-void print_core();
-void print_actions();
-void print_grammar();
+extern void conflict_log PARAMS((void));
+extern void verbose_conflict_log PARAMS((void));
+extern void print_reductions PARAMS((int));
+
+void terse PARAMS((void));
+void verbose PARAMS((void));
+void print_token PARAMS((int, int));
+void print_state PARAMS((int));
+void print_core PARAMS((int));
+void print_actions PARAMS((int));
+void print_grammar PARAMS((void));
void
-terse()
+terse (void)
{
if (any_conflicts)
{
void
-verbose()
+verbose (void)
{
register int i;
void
-print_token(extnum, token)
-int extnum, token;
+print_token (int extnum, int token)
{
fprintf(foutput, _(" type %d is %s\n"), extnum, tags[token]);
}
void
-print_state(state)
-int state;
+print_state (int state)
{
fprintf(foutput, _("\n\nstate %d\n\n"), state);
print_core(state);
void
-print_core(state)
-int state;
+print_core (int state)
{
register int i;
register int k;
void
-print_actions(state)
-int state;
+print_actions (int state)
{
register int i;
register int k;
else
void
-print_grammar()
+print_grammar (void)
{
int i, j;
short* rule;
extern char **tags; /* reader.c */
extern int verboseflag; /* getargs.c */
static int statisticsflag; /* XXXXXXX */
+extern int fixed_outfiles;
#ifndef TRUE
#define TRUE (1)
nuseful_nonterminals, nuseless_nonterminals;
-static void useless_nonterminals();
-static void inaccessable_symbols();
-static void reduce_grammar_tables();
-static void print_results();
-static void print_notices();
-void dump_grammar();
+bool bits_equal PARAMS((BSet, BSet, int));
+int nbits PARAMS((unsigned));
+int bits_size PARAMS((BSet, int));
+void reduce_grammar PARAMS((void));
+static void useless_nonterminals PARAMS((void));
+static void inaccessable_symbols PARAMS((void));
+static void reduce_grammar_tables PARAMS((void));
+static void print_results PARAMS((void));
+static void print_notices PARAMS((void));
+void dump_grammar PARAMS((void));
-extern void fatals ();
+extern void fatals PARAMS((char *, char *));
\f
bool
-bits_equal (L, R, n)
-BSet L;
-BSet R;
-int n;
+bits_equal (BSet L, BSet R, int n)
{
int i;
int
-nbits (i)
-unsigned i;
+nbits (unsigned i)
{
int count = 0;
int
-bits_size (S, n)
-BSet S;
-int n;
+bits_size (BSet S, int n)
{
int i, count = 0;
}
\f
void
-reduce_grammar ()
+reduce_grammar (void)
{
bool reduced;
\f
/*
* Another way to do this would be with a set for each production and then do
- * subset tests against N, but even for the C grammar the whole reducing
+ * subset tests against N0, but even for the C grammar the whole reducing
* process takes only 2 seconds on my 8Mhz AT.
*/
static bool
-useful_production (i, N)
-int i;
-BSet N;
+useful_production (int i, BSet N0)
{
rule r;
short n;
for (r = &ritem[rrhs[i]]; *r > 0; r++)
if (ISVAR(n = *r))
- if (!BITISSET(N, n - ntokens))
+ if (!BITISSET(N0, n - ntokens))
return FALSE;
return TRUE;
}
/* Remember that rules are 1-origin, symbols are 0-origin. */
static void
-useless_nonterminals ()
+useless_nonterminals (void)
{
BSet Np, Ns;
int i, n;
}
\f
static void
-inaccessable_symbols ()
+inaccessable_symbols (void)
{
BSet Vp, Vs, Pp;
int i, n;
}
\f
static void
-reduce_grammar_tables ()
+reduce_grammar_tables (void)
{
/* This is turned off because we would need to change the numbers
in the case statements in the actions file. */
}
\f
static void
-print_results ()
+print_results (void)
{
int i;
/* short j; JF unused */
}
\f
void
-dump_grammar ()
+dump_grammar (void)
{
int i;
rule r;
static void
-print_notices ()
+print_notices (void)
{
- extern int fixed_outfiles;
-
if (fixed_outfiles && nuseless_productions)
fprintf(stderr, _("%d rules never reduced\n"), nuseless_productions);
bucket *firstsymbol;
bucket *lastsymbol;
+void tabinit PARAMS((void));
+void free_symtab PARAMS((void));
-int
-hash(key)
-char *key;
+static int
+hash (char *key)
{
register char *cp;
register int k;
-char *
-copys(s)
-char *s;
+static char *
+copys (char *s)
{
register int i;
register char *cp;
void
-tabinit()
+tabinit (void)
{
/* register int i; JF unused */
bucket *
-getsym(key)
-char *key;
+getsym (char *key)
{
register int hashval;
register bucket *bp;
void
-free_symtab()
+free_symtab (void)
{
register int i;
register bucket *bp,*bptmp;/* JF don't use ptr after free */
extern bucket **symtab;
extern bucket *firstsymbol;
-extern bucket *getsym();
+extern bucket *getsym PARAMS((char *));
#include "system.h"
#include "machine.h"
+void RTC PARAMS((unsigned *, int));
+
/* given n by n matrix of bits R, modify its contents
to be the transive closure of what was given. */
-void
-TC(R, n)
-unsigned *R;
-int n;
+static void
+TC (unsigned *R, int n)
{
register int rowsize;
register unsigned mask;
and then set all the bits on the diagonal of R. */
void
-RTC(R, n)
-unsigned *R;
-int n;
+RTC (unsigned *R, int n)
{
register int rowsize;
register unsigned mask;