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