* src/output.c: Formatting changes.

* src/machine.h: Remove, leaving its contents in...
* src/system.h: here.
Include stdio.h.
Adjust all dependencies on stdio.h and machine.h.
* src/getargs.h: New file.
Let all `extern' declarations about getargs.c be replaced with
inclusion of `getargs.h'.
* src/Makefile.am (noinst_HEADERS): Adjust.

* tests/calc.m4 (yyin): Be initialized in main, not on the global
scope.
(yyerror): Returns void, not int.
* doc/bison.texinfo: Formatting changes.
This commit is contained in:
Akim Demaille
2000-09-19 18:10:41 +00:00
parent 05a1d24b1e
commit ceed8467b7
31 changed files with 1409 additions and 1370 deletions

View File

@@ -22,9 +22,7 @@ Boston, MA 02111-1307, USA. */
/* See comments in state.h for the data structures that represent it.
The entry point is generate_states. */
#include <stdio.h>
#include "system.h"
#include "machine.h"
#include "alloc.h"
#include "gram.h"
#include "state.h"

View File

@@ -18,7 +18,7 @@ bison_SOURCES = LR0.c allocate.c closure.c complain.c conflicts.c \
EXTRA_bison_SOURCES = vmsgetargs.c
noinst_HEADERS = alloc.h complain.h files.h gram.h lex.h machine.h \
noinst_HEADERS = alloc.h complain.h files.h getargs.h gram.h lex.h \
state.h \
symtab.h system.h types.h

View File

@@ -19,7 +19,6 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include "system.h"
#ifdef NEED_DECLARATION_CALLOC

View File

@@ -49,9 +49,7 @@ Frees itemset, ruleset and internal data.
*/
#include <stdio.h>
#include "system.h"
#include "machine.h"
#include "alloc.h"
#include "gram.h"

View File

@@ -1,26 +1,25 @@
/* Find and resolve or report look-ahead conflicts for 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. */
#include <stdio.h>
#include "system.h"
#include "machine.h"
#include "getargs.h"
#include "alloc.h"
#include "files.h"
#include "gram.h"
@@ -35,7 +34,6 @@ extern shifts **shift_table;
extern unsigned *LA;
extern short *LAruleno;
extern short *lookaheads;
extern int verboseflag;
extern int fixed_outfiles;
extern void initialize_conflicts PARAMS((void));
@@ -126,7 +124,7 @@ set_conflicts (int state)
fp1 = LA + i * tokensetsize;
fp2 = fp1;
fp3 = lookaheadset;
while (fp3 < fp4)
{
if (*fp2++ & *fp3++)
@@ -323,7 +321,7 @@ conflict_log (void)
total_conflicts();
}
void
verbose_conflict_log (void)
@@ -622,10 +620,10 @@ print_reductions (int state)
fp1 = LA + i * tokensetsize;
fp2 = shiftset;
fp3 = lookaheadset;
while (fp3 < fp4)
*fp3++ = *fp1++ & (~(*fp2++));
count = 0;
mask = 1;
fp3 = lookaheadset;
@@ -633,7 +631,7 @@ print_reductions (int state)
{
if (mask & *fp3)
count++;
mask <<= 1;
if (mask == 0)
{
@@ -641,17 +639,17 @@ print_reductions (int state)
fp3++;
}
}
if (count > cmax)
{
cmax = count;
default_LA = i;
default_rule = LAruleno[i];
}
fp2 = shiftset;
fp3 = lookaheadset;
while (fp3 < fp4)
*fp2++ |= *fp3++;
}

View File

@@ -24,7 +24,6 @@ Boston, MA 02111-1307, USA. */
derives[i - ntokens] points to a vector of rule numbers,
terminated with -1. */
#include <stdio.h>
#include "system.h"
#include "alloc.h"
#include "types.h"

View File

@@ -1,52 +1,47 @@
/* Open and close files for bison,
Copyright (C) 1984, 1986, 1989, 1992 Free Software Foundation, Inc.
Copyright (C) 1984, 1986, 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. */
#include "system.h"
#if defined (VMS) & !defined (__VMS_POSIX)
#include <ssdef.h>
#define unlink delete
#ifndef XPFILE
#define XPFILE "GNU_BISON:[000000]BISON.SIMPLE"
#endif
#ifndef XPFILE1
#define XPFILE1 "GNU_BISON:[000000]BISON.HAIRY"
#endif
# include <ssdef.h>
# define unlink delete
# ifndef XPFILE
# define XPFILE "GNU_BISON:[000000]BISON.SIMPLE"
# endif
# ifndef XPFILE1
# define XPFILE1 "GNU_BISON:[000000]BISON.HAIRY"
# endif
#endif
#if defined (_MSC_VER)
#ifndef XPFILE
#define XPFILE "c:/usr/local/lib/bison.simple"
#endif
#ifndef XPFILE1
#define XPFILE1 "c:/usr/local/lib/bison.hairy"
#endif
#endif
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
# ifndef XPFILE
# define XPFILE "c:/usr/local/lib/bison.simple"
# endif
# ifndef XPFILE1
# define XPFILE1 "c:/usr/local/lib/bison.hairy"
# endif
#endif
#include "getargs.h"
#include "files.h"
#include "alloc.h"
#include "gram.h"
@@ -76,8 +71,6 @@ static char *tmpattrsfile;
static char *tmptabfile;
static char *tmpdefsfile;
extern int noparserflag;
extern char *mktemp(); /* So the compiler won't complain */
extern char *getenv();
@@ -88,8 +81,6 @@ extern void open_extra_files PARAMS((void));
int fixed_outfiles = 0;
extern char *program_name;
extern int verboseflag;
extern int definesflag;
char *

View File

@@ -22,16 +22,19 @@
#include "getopt.h"
#include "system.h"
#include "files.h"
#include "getargs.h"
int verboseflag;
int definesflag;
int debugflag;
int nolinesflag;
int noparserflag = 0;
int toknumflag = 0;
int rawtoknumflag = 0;
char *spec_name_prefix; /* for -p. */
char *spec_file_prefix; /* for -b. */
char *spec_name_prefix; /* for -p. */
int debugflag = 0;
int definesflag = 0;
int nolinesflag = 0;
int noparserflag = 0;
int rawtoknumflag = 0;
int toknumflag = 0;
int verboseflag = 0;
extern int fixed_outfiles;/* for -y */
extern char *program_name;

34
src/getargs.h Normal file
View File

@@ -0,0 +1,34 @@
/* Parse command line arguments for bison.
Copyright (C) 1984, 1986, 1989, 1992, 2000 Free Software Foundation, Inc.
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 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. */
/* flags set by % directives */
extern char *spec_file_prefix; /* for -b */
extern char *spec_name_prefix; /* for -p */
extern int debugflag; /* for -t */
extern int definesflag; /* for -d */
extern int fixed_outfiles; /* for -y */
extern int nolinesflag; /* for -l */
extern int noparserflag; /* for -n */
extern int rawtoknumflag; /* for -r */
extern int toknumflag; /* for -k */
extern int verboseflag; /* for -v */
void getargs PARAMS ((int argc, char *argv[]));

View File

@@ -48,9 +48,7 @@ LA[l, i] is 1 if the rule LAruleno[l] is applicable in the appropriate state
If LA[l, i] and LA[l, j] are both 1 for i != j, it is a conflict.
*/
#include <stdio.h>
#include "system.h"
#include "machine.h"
#include "types.h"
#include "state.h"
#include "alloc.h"

View File

@@ -26,8 +26,8 @@
and the name is looked up in the symbol table using symtab.c;
symval is set to a pointer to the entry found. */
#include <stdio.h>
#include "system.h"
#include "getargs.h"
#include "files.h"
#include "getopt.h" /* for optarg */
#include "symtab.h"
@@ -35,17 +35,6 @@
#include "alloc.h"
#include "complain.h"
/* flags set by % directives */
extern int definesflag; /* for -d */
extern int toknumflag; /* for -k */
extern int noparserflag; /* for -n */
extern int fixed_outfiles; /* for -y */
extern int nolinesflag; /* for -l */
extern int rawtoknumflag; /* for -r */
extern int verboseflag; /* for -v */
extern int debugflag; /* for -t */
extern char *spec_name_prefix; /* for -p */
extern char *spec_file_prefix; /* for -b */
/*spec_outfile is declared in files.h, for -o */
extern int translations;

View File

@@ -1,40 +0,0 @@
/* Define machine-dependencies for bison,
Copyright (C) 1984, 1989 Free Software Foundation, Inc.
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 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. */
#ifdef eta10
#define MAXSHORT 2147483647
#define MINSHORT -2147483648
#else
#define MAXSHORT 32767
#define MINSHORT -32768
#endif
#if defined (MSDOS) && !defined (__GO32__)
#define BITS_PER_WORD 16
#define MAXTABLE 16383
#else
#define BITS_PER_WORD 32
#define MAXTABLE 32767
#endif
#define WORDSIZE(n) (((n) + BITS_PER_WORD - 1) / BITS_PER_WORD)
#define SETBIT(x, i) ((x)[(i)/BITS_PER_WORD] |= (1<<((i) % BITS_PER_WORD)))
#define RESETBIT(x, i) ((x)[(i)/BITS_PER_WORD] &= ~(1<<((i) % BITS_PER_WORD)))
#define BITISSET(x, i) (((x)[(i)/BITS_PER_WORD] & (1<<((i) % BITS_PER_WORD))) != 0)

View File

@@ -1,5 +1,6 @@
/* Top level entry point of bison,
Copyright (C) 1984, 1986, 1989, 1992, 1995, 2000 Free Software Foundation, Inc.
Copyright (C) 1984, 1986, 1989, 1992, 1995, 2000
Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
@@ -19,14 +20,11 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include "system.h"
#include "machine.h" /* for MAXSHORT */
#include "getargs.h"
#include "files.h"
#include "complain.h"
extern int verboseflag;
#if 0 /* XXX currently unused. */
/* Nonzero means failure has been detected; don't write a parser file. */
static int failure;
@@ -38,7 +36,6 @@ char *program_name;
extern char *printable_version PARAMS((int));
extern void berror PARAMS((const char *));
extern void getargs PARAMS((int, char *[]));
extern void openfiles PARAMS((void));
extern void reader PARAMS((void));
extern void reduce_grammar PARAMS((void));

View File

@@ -19,10 +19,10 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* set up nullable, a vector saying which nonterminals can expand into the null string.
nullable[i - ntokens] is nonzero if symbol i can do so. */
/* set up nullable, a vector saying which nonterminals can expand into
the null string. nullable[i - ntokens] is nonzero if symbol i can
do so. */
#include <stdio.h>
#include "system.h"
#include "types.h"
#include "gram.h"

File diff suppressed because it is too large Load Diff

View File

@@ -19,9 +19,7 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include "system.h"
#include "machine.h"
#include "alloc.h"
#include "files.h"
#include "gram.h"

View File

@@ -27,14 +27,13 @@
The entry point is reader (). */
#include <stdio.h>
#include "system.h"
#include "getargs.h"
#include "files.h"
#include "alloc.h"
#include "symtab.h"
#include "lex.h"
#include "gram.h"
#include "machine.h"
#include "complain.h"
#define LTYPESTR "\
@@ -62,10 +61,6 @@ typedef\n\
/* Number of slots allocated (but not necessarily used yet) in `rline' */
static int rline_allocated;
extern int definesflag;
extern int nolinesflag;
extern int noparserflag;
extern int rawtoknumflag;
extern bucket *symval;
extern int numval;
extern int expected_conflicts;

View File

@@ -29,17 +29,15 @@ Boston, MA 02111-1307, USA. */
* parser.
*/
#include <stdio.h>
#include "system.h"
#include "getargs.h"
#include "files.h"
#include "gram.h"
#include "machine.h"
#include "alloc.h"
#include "complain.h"
extern char **tags; /* reader.c */
extern int verboseflag; /* getargs.c */
static int statisticsflag; /* XXXXXXX */
extern int fixed_outfiles;

View File

@@ -19,7 +19,6 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include "system.h"
#include "alloc.h"
#include "symtab.h"

View File

@@ -22,6 +22,8 @@
# include <config.h>
#endif
#include <stdio.h>
#ifdef MSDOS
# include <io.h>
#endif
@@ -119,3 +121,29 @@ extern int errno;
#endif
#endif /* BISON_SYSTEM_H */
/*---------------------------------.
| Machine-dependencies for Bison. |
`---------------------------------*/
#ifdef eta10
# define MAXSHORT 2147483647
# define MINSHORT -2147483648
#else
# define MAXSHORT 32767
# define MINSHORT -32768
#endif
#if defined (MSDOS) && !defined (__GO32__)
# define BITS_PER_WORD 16
# define MAXTABLE 16383
#else
# define BITS_PER_WORD 32
# define MAXTABLE 32767
#endif
#define WORDSIZE(n) (((n) + BITS_PER_WORD - 1) / BITS_PER_WORD)
#define SETBIT(x, i) ((x)[(i)/BITS_PER_WORD] |= (1<<((i) % BITS_PER_WORD)))
#define RESETBIT(x, i) ((x)[(i)/BITS_PER_WORD] &= ~(1<<((i) % BITS_PER_WORD)))
#define BITISSET(x, i) (((x)[(i)/BITS_PER_WORD] & (1<<((i) % BITS_PER_WORD))) != 0)

View File

@@ -19,9 +19,7 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include "system.h"
#include "machine.h"
void RTC PARAMS((unsigned *, int));