mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Various anti-`extern in *.c' changes.
* src/system.h: Include `assert.h'.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2000-10-02 Akim Demaille <akim@epita.fr>
|
||||
|
||||
Various anti-`extern in *.c' changes.
|
||||
|
||||
* src/system.h: Include `assert.h'.
|
||||
|
||||
|
||||
2000-10-02 Akim Demaille <akim@epita.fr>
|
||||
|
||||
* src/state.h (nstates, final_state, first_state, first_shift)
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include "closure.h"
|
||||
#include "LR0.h"
|
||||
|
||||
extern short *itemset;
|
||||
extern short *itemsetend;
|
||||
|
||||
int nstates;
|
||||
int final_state;
|
||||
|
||||
@@ -18,15 +18,11 @@
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
|
||||
#include "system.h"
|
||||
#include "alloc.h"
|
||||
#include "gram.h"
|
||||
#include "closure.h"
|
||||
|
||||
extern short **derives;
|
||||
|
||||
extern void RTC PARAMS ((unsigned *, int));
|
||||
#include "derives.h"
|
||||
|
||||
short *itemset;
|
||||
short *itemsetend;
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef CLOSURE_H_
|
||||
# define CLOSURE_H_
|
||||
|
||||
/* Subroutines of file LR0.c. */
|
||||
|
||||
@@ -47,3 +49,8 @@ void closure PARAMS ((short *items, int n));
|
||||
/* Frees itemset, ruleset and internal data. */
|
||||
|
||||
void free_closure PARAMS ((void));
|
||||
|
||||
extern short *itemset;
|
||||
extern short *itemsetend;
|
||||
|
||||
#endif /* !CLOSURE_H_ */
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#ifndef CONFLICTS_H_
|
||||
# define CONFLICTS_H_
|
||||
# include "state.h"
|
||||
|
||||
void initialize_conflicts PARAMS ((void));
|
||||
void print_conflicts PARAMS ((void));
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "gram.h"
|
||||
#include "derives.h"
|
||||
|
||||
short **derives;
|
||||
|
||||
#if DEBUG
|
||||
|
||||
static void
|
||||
@@ -55,8 +57,6 @@ print_derives (void)
|
||||
|
||||
#endif
|
||||
|
||||
short **derives;
|
||||
|
||||
void
|
||||
set_derives (void)
|
||||
{
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef DERIVES_H_
|
||||
# define DERIVES_H_
|
||||
|
||||
extern short **derives;
|
||||
|
||||
/* set_derives finds, for each variable (nonterminal), which rules can
|
||||
derive it. It sets up the value of derives so that derives[i -
|
||||
@@ -26,3 +30,5 @@
|
||||
|
||||
void set_derives PARAMS((void));
|
||||
void free_derives PARAMS((void));
|
||||
|
||||
#endif /* !DERIVES_H_ */
|
||||
|
||||
36
src/lalr.c
36
src/lalr.c
@@ -1,27 +1,27 @@
|
||||
/* Compute look-ahead criteria for bison,
|
||||
Copyright (C) 1984, 1986, 1989 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1986, 1989, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
Bison is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
Bison is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
Bison is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
Bison is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bison; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bison; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
/* Compute how to make the finite state machine deterministic; find
|
||||
which rules need lookahead in each state, and which lookahead
|
||||
tokens they accept. */
|
||||
tokens they accept. */
|
||||
|
||||
#include "system.h"
|
||||
#include "types.h"
|
||||
@@ -31,8 +31,7 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "complain.h"
|
||||
#include "lalr.h"
|
||||
#include "nullable.h"
|
||||
|
||||
extern short **derives;
|
||||
#include "derives.h"
|
||||
|
||||
int tokensetsize;
|
||||
short *lookaheads;
|
||||
@@ -481,8 +480,7 @@ add_lookback_edge (int stateno, int ruleno, int gotono)
|
||||
i++;
|
||||
}
|
||||
|
||||
if (found == 0)
|
||||
berror ("add_lookback_edge");
|
||||
assert (found);
|
||||
|
||||
sp = NEW (shorts);
|
||||
sp->next = lookback[i];
|
||||
|
||||
@@ -28,9 +28,6 @@
|
||||
#include "complain.h"
|
||||
#include "gram.h"
|
||||
|
||||
/*spec_outfile is declared in files.h, for -o */
|
||||
|
||||
|
||||
/* functions from main.c */
|
||||
extern char *printable_version PARAMS ((int));
|
||||
|
||||
|
||||
@@ -53,8 +53,13 @@
|
||||
|
||||
# define MAXTOKEN 1024
|
||||
|
||||
void init_lex PARAMS ((void));
|
||||
|
||||
/* Allocated size of token_buffer, not including space for terminator. */
|
||||
extern int maxtoken;
|
||||
extern char *token_buffer;
|
||||
char *grow_token_buffer PARAMS ((char *));
|
||||
|
||||
void init_lex PARAMS ((void));
|
||||
int skip_white_space PARAMS ((void));
|
||||
void unlex PARAMS ((int));
|
||||
|
||||
@@ -67,5 +72,7 @@ int lex PARAMS ((void));
|
||||
|
||||
int parse_percent_token PARAMS ((void));
|
||||
|
||||
extern bucket *symval;
|
||||
extern int numval;
|
||||
|
||||
#endif /* !LEX_H_ */
|
||||
|
||||
@@ -993,8 +993,7 @@ pack_vector (int vector)
|
||||
i = order[vector];
|
||||
t = tally[i];
|
||||
|
||||
if (t == 0)
|
||||
berror ("pack_vector");
|
||||
assert (t);
|
||||
|
||||
from = froms[i];
|
||||
to = tos[i];
|
||||
|
||||
@@ -30,15 +30,8 @@
|
||||
#include "complain.h"
|
||||
#include "output.h"
|
||||
#include "reader.h"
|
||||
#include "conflicts.h"
|
||||
|
||||
extern bucket *symval;
|
||||
extern int numval;
|
||||
extern int expected_conflicts;
|
||||
extern char *token_buffer;
|
||||
extern int maxtoken;
|
||||
|
||||
extern void tabinit PARAMS ((void));
|
||||
extern void free_symtab PARAMS ((void));
|
||||
extern char *printable_version PARAMS ((int));
|
||||
|
||||
#define LTYPESTR "\
|
||||
|
||||
@@ -29,10 +29,6 @@ bucket *firstsymbol;
|
||||
static bucket *lastsymbol;
|
||||
static bucket **symtab;
|
||||
|
||||
extern void tabinit PARAMS((void));
|
||||
extern void free_symtab PARAMS((void));
|
||||
|
||||
|
||||
static int
|
||||
hash (const char *key)
|
||||
{
|
||||
|
||||
83
src/symtab.h
83
src/symtab.h
@@ -1,59 +1,60 @@
|
||||
/* Definitions for symtab.c and callers, part of bison,
|
||||
Copyright (C) 1984, 1989, 1992 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989, 1992, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
Bison is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
Bison is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
Bison is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
Bison is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bison; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bison; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#ifndef SYMTAB_H_
|
||||
# define SYMTAB_H_
|
||||
|
||||
#define TABSIZE 1009
|
||||
|
||||
|
||||
/* symbol classes */
|
||||
|
||||
#define SUNKNOWN 0
|
||||
#define STOKEN 1 /* terminal symbol */
|
||||
#define SNTERM 2 /* non-terminal */
|
||||
#define STOKEN 1 /* terminal symbol */
|
||||
#define SNTERM 2 /* non-terminal */
|
||||
|
||||
#define SALIAS -9991 /* for symbol generated with an alias */
|
||||
#define SALIAS -9991 /* for symbol generated with an alias */
|
||||
|
||||
typedef
|
||||
struct bucket
|
||||
{
|
||||
struct bucket *link;
|
||||
struct bucket *next;
|
||||
char *tag;
|
||||
char *type_name;
|
||||
short value;
|
||||
short prec;
|
||||
short assoc;
|
||||
short user_token_number;
|
||||
/* special value SALIAS in the identifier
|
||||
half of the identifier-symbol pair for an alias */
|
||||
struct bucket *alias;
|
||||
/* points to the other in the identifier-symbol
|
||||
pair for an alias */
|
||||
char class;
|
||||
}
|
||||
bucket;
|
||||
typedef struct bucket
|
||||
{
|
||||
struct bucket *link;
|
||||
struct bucket *next;
|
||||
char *tag;
|
||||
char *type_name;
|
||||
short value;
|
||||
short prec;
|
||||
short assoc;
|
||||
short user_token_number;
|
||||
/* special value SALIAS in the identifier half of the
|
||||
identifier-symbol pair for an alias */
|
||||
struct bucket *alias;
|
||||
/* points to the other in the identifier-symbol pair for an alias */
|
||||
char class;
|
||||
}
|
||||
bucket;
|
||||
|
||||
|
||||
extern bucket *firstsymbol;
|
||||
|
||||
extern bucket *getsym PARAMS((const char *));
|
||||
bucket *getsym PARAMS ((const char *));
|
||||
|
||||
void tabinit PARAMS ((void));
|
||||
void free_symtab PARAMS ((void));
|
||||
|
||||
#endif /* !SYMTAB_H_ */
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef MSDOS
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user