Virgin import of GNU Bison 1.28

This commit is contained in:
David E. O'Brien 1999-08-14 21:39:07 +00:00
parent 9f36c7f497
commit ff077f9ca8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/bison/dist/; revision=49795
55 changed files with 6619 additions and 2501 deletions

8
contrib/bison/AUTHORS Normal file
View File

@ -0,0 +1,8 @@
Authors of GNU Bison.
Bison was written primarily by Robert Corbett.
Richard Stallman made it Yacc-compatible.
Wilfred Hansen of Carnegie Mellon University added multicharacter
string literals and other features.

View File

@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -279,7 +279,7 @@ POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -305,14 +305,15 @@ the "copyright" line and a pointer to where the full notice is found.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

File diff suppressed because it is too large Load Diff

101
contrib/bison/ChangeLog.doc Normal file
View File

@ -0,0 +1,101 @@
Tue Jun 8 19:00:57 1999 Jesse Thilo <jthilo@gnu.org>
* bison.1: Dropped mention of `+' for long-named options.
Sun May 30 13:07:48 1999 Jesse Thilo <jthilo@gnu.org>
* FAQ, Makefile.am: Added a FAQ list.
Sun Apr 18 16:29:23 1999 Jesse Thilo <jthilo@gnu.org>
* .cvsignore, Makefile.am:
Reorganized: sources in `src', documentation in `doc'.
Thu Jan 14 15:08:17 1999 Jesse Thilo <jthilo@gnu.org>
* bison.texinfo: Fix formatting glitch.
* bison.texinfo: Update FSF address.
Wed Dec 30 05:24:00 1998 Jesse Thilo <jthilo@gnu.org>
* bison.texinfo:
Delete comment "consider using @set for edition number, etc..." since
we now are doing so.
Sat Nov 28 21:44:16 1998 Jesse Thilo <jthilo@gnu.org>
* bison.texinfo: Add info dir entry.
* bison.texinfo: Let automake put version number into documentation.
Thu Nov 26 00:14:37 1998 Jesse Thilo <jthilo@gnu.org>
* bison.1: Document the BISON_HAIRY and BISON_SIMPLE variables.
Wed Nov 25 22:11:01 1998 Jesse Thilo <jthilo@gnu.org>
* bison.texinfo: Clean up some formatting.
Tue May 5 22:18:45 1998 Richard Stallman <rms@gnu.org>
* bison.texinfo: Explain better why to make a pure parser.
Wed Nov 29 01:26:22 1995 Daniel Hagerty <hag@gnu.org>
* bison.texinfo: Fixed update date
Wed Nov 29 01:22:34 1995 Richard Stallman <rms@gnu.org>
* bison.texinfo:
Describe literal string tokens, %raw, %no_lines, %token_table.
Mon Oct 16 14:12:23 1995 Richard Stallman <rms@gnu.org>
* bison.1, bison.rnh: Add new options.
Thu Jun 1 13:54:23 1995 Jim Meyering <meyering@gnu.org>
* bison.texinfo: *** empty log message ***
Wed May 3 15:13:10 1995 Richard Stallman <rms@gnu.org>
* bison.texinfo: Rewrite "Conditions for Using Bison".
Update version to 1.24.
Sun Nov 21 22:03:08 1993 Richard Stallman <rms@gnu.org>
* bison.texinfo: entered into RCS
* bison.texinfo: *** empty log message ***
Mon Oct 25 23:45:06 1993 David J. MacKenzie <djm@gnu.org>
* bison.texinfo: *** empty log message ***
Tue Sep 14 20:43:31 1993 David J. MacKenzie <djm@gnu.org>
* bison.texinfo: *** empty log message ***
Fri Sep 10 12:02:53 1993 Richard Stallman <rms@gnu.org>
* bison.1: entered into RCS
Sat Jun 26 20:09:41 1993 David J. MacKenzie <djm@gnu.org>
* bison.texinfo: *** empty log message ***
* bison.1: Initial revision
Thu Jun 3 20:24:26 1993 Richard Stallman <rms@gnu.org>
* bison.texinfo: *** empty log message ***
Wed May 19 03:41:36 1993 Richard Stallman <rms@gnu.org>
* bison.texinfo: Initial revision
Mon Jun 22 04:07:24 1992 Richard Stallman <rms@gnu.org>
* bison.rnh: entered into RCS

480
contrib/bison/ChangeLog.src Normal file
View File

@ -0,0 +1,480 @@
Mon Jun 14 22:35:15 1999 Jesse Thilo <jthilo@gnu.org>
* system.h: Squashed redefinition warning on some systems.
* Attic/version.c, Makefile.am, getargs.c, reader.c:
Have configure build version string instead of relying on ANSI string
concatentation.
Sun May 30 13:17:48 1999 Jesse Thilo <jthilo@gnu.org>
* files.c: Added <unistd.h> for unlink().
* Makefile.am, system.h: I18n fixes.
Wed May 19 11:24:34 1999 Jesse Thilo <jthilo@gnu.org>
* Attic/version.c, alloc.h, symtab.h:
Protected inclusion of "config.h" with HAVE_CONFIG_H.
Sun Apr 18 16:29:23 1999 Jesse Thilo <jthilo@gnu.org>
* .cvsignore, Makefile.am:
Reorganized: sources in `src', documentation in `doc'.
* lex.c (literalchar):
fixed the code for escaping double quotes (thanks
Jonathan Czisny.)
Tue Apr 13 19:53:41 1999 Jesse Thilo <jthilo@gnu.org>
* allocate.c: Don't declare calloc() and realloc() if not necessary.
Mon Mar 22 16:30:00 1999 Jesse Thilo <jthilo@gnu.org>
* bison.s1: Fixed #line numbers.
Fri Feb 12 15:18:12 1999 Jesse Thilo <jthilo@gnu.org>
* files.c, files.h:
Defined locations of parser files in config.h instead of Makefile.
Wed Jan 20 22:55:06 1999 Jesse Thilo <jthilo@gnu.org>
* LR0.c, conflicts.c, output.c, reader.c: Hush a few compiler warnings.
* files.c: Add tryclose(), which verifies that fclose was successful.
Hush a couple of compiler warnings.
Thu Jan 14 14:58:38 1999 Jesse Thilo <jthilo@gnu.org>
* gram.h, lalr.c, lex.c, lex.h, machine.h, main.c, nullable.c, output.c, print.c, reader.c, reduce.c, state.h, symtab.c, symtab.h, types.h, vmsgetargs.c, warshall.c, LR0.c, alloc.h, allocate.c, bison.s1, closure.c, conflicts.c, derives.c, files.c, files.h, getargs.c, gram.c:
Update FSF address.
Fri Jan 8 21:17:26 1999 Jesse Thilo <jthilo@gnu.org>
* system.h: Don't define PACKAGE here, since config.h defines it.
Wed Dec 30 06:54:16 1998 Jesse Thilo <jthilo@gnu.org>
* reader.c: Update copyright date.
* main.c:
Ditch sprintf to statically-sized buffers in fatal/warn functions in
favor of output directly to stderr (avoids buffer overruns).
* reader.c: Some checks for premature EOF.
* LR0.c, alloc.h, allocate.c, closure.c, conflicts.c, derives.c, getargs.c, gram.c, lalr.c, lex.c, main.c, nullable.c, output.c, print.c, reduce.c, symtab.c, symtab.h, warshall.c:
Use prototypes if the compiler understands them.
* files.c: Honor TMPDIR on Unix hosts.
Use prototypes if the compiler understands them.
* reader.c: Fix a couple of buffer overrun bugs.
Use prototypes if the compiler understands them.
* system.h: Include unistd.h and ctype.h.
Use #ifdef instead of #if for NLS symbols.
Tue Dec 29 21:54:26 1998 Jesse Thilo <jthilo@gnu.org>
* Attic/version.c: Use VERSION symbol from automake for version number.
Thu Nov 26 00:44:18 1998 Jesse Thilo <jthilo@gnu.org>
* bison.cld, build.com, vmshlp.mar:
Add non-RCS files from /gd/gnu/bison.
Wed Nov 25 22:21:43 1998 Jesse Thilo <jthilo@gnu.org>
* Attic/version.c: Build version.c automatically.
* reader.c: Fix token numbering (used to start at 258, not 257).
* system.h: Include config.h.
* getargs.c: Update bug report address.
* alloca.c, getopt.c, getopt.h, getopt1.c:
Get latest copies of alloca.c, getopt.c, getopt.h, getopt1.c from gnu.org.
Mon Jan 5 00:25:39 1998 Richard Stallman <rms@gnu.org>
* files.c (openfiles): [_WIN32 && !__CYGWIN32__] Use TEMP or Temp to
find a temporary directory, if possible. Do not unlink files while
they are open.
Mon Aug 25 19:40:12 1997 Richard Stallman <rms@gnu.org>
* reader.c (stack_offset;): Change some warni to warns.
* lex.c (literalchar): Use warns, not warni.
Sat Jun 28 19:41:24 1997 Richard Stallman <rms@gnu.org>
* bison.s1: Add a Bison version comment.
* main.c (fatal, warn, berror): Use program_name.
Wed Jun 18 17:09:27 1997 Richard Stallman <rms@gnu.org>
* main.c (fatal, warn, berror): Make error messages standard.
(toomany): Improve error message text.
* LR0.c, closure.c, conflicts.c, derives.c, files.c, lalr.c, lex.c, nullable.c, output.c, print.c, reader.c, reduce.c, symtab.c:
new.h renamed to alloc.h.
Sat May 24 08:04:42 1997 Richard Stallman <rms@gnu.org>
* lex.c (literalchar): Fix the code for escaping \, " and '.
(lex): Avoid trouble when there are many chars
to discard in a char literal with just several chars in it.
Sat May 17 18:44:24 1997 Richard Stallman <rms@gnu.org>
* bison.s1: Use malloc, if using alloca is troublesome.
(YYSTACK_USE_ALLOCA): New flag macro.
Define it for some systems and compilers.
(YYSTACK_ALLOC): New macro.
(yyparse): Use YYSTACK_ALLOC to allocate stack.
If it was malloc'd, free it.
Wed Apr 23 18:01:25 1997 Richard Stallman <rms@gnu.org>
* bison.s1: (alloca) [__hpux]: Always define as __builtin_alloca.
Tue Apr 22 22:23:48 1997 Richard Stallman <rms@gnu.org>
* bison.s1: [__hpux]: Include alloca.h (right for HPUX 10)
instead of declaring alloca (right for HPUX 9).
* bison.s1 (__yy_memcpy): Declare arg `count' as unsigned int.
(yyparse): Cast third arg to __yy_memcpy to unsigned int.
Fri Jan 3 01:24:27 1997 Richard Stallman <rms@gnu.org>
* allocate.c: [__STDC__ or _MSC_VER]:
Declare calloc and realloc to return void *.
Thu Jan 2 07:03:45 1997 Richard Stallman <rms@gnu.org>
* system.h: [_MSC_VER]: Include stdlib.h and process.h.
[_MSC_VER] (getpid): Define as macro--translate it to _getpid.
* main.c (main): Return FAILURE as a value.
(printable_version): Declare arg as int, not char.
Thu Dec 19 08:24:56 1996 Richard Stallman <rms@gnu.org>
* files.c:
[_MSC_VER] (XPFILE, XPFILE1): Define, if not already defined.
Wed Dec 18 02:18:10 1996 Paul Eggert <eggert@gnu.org>
* bison.s1 (yyparse): If __GNUC__ and YYPARSE_PARAM are both defined,
declare yyparse to have a void * argument.
Tue Dec 17 06:20:27 1996 Richard Stallman <rms@gnu.org>
* reduce.c (nbits): Add some casts.
Mon Aug 12 22:17:15 1996 Richard Stallman <rms@gnu.org>
* bison.s1: Test _MSDOS as well as _MSDOS_.
Wed Jul 31 19:18:57 1996 Richard Stallman <rms@gnu.org>
* bison.s1: [__sun && __i386]: Include alloca.h.
Tue Jul 30 04:37:37 1996 Richard Stallman <rms@gnu.org>
* bison.s1: Comment change.
* bison.s1: Test _MSDOS_, not MSDOS.
Sat Jun 1 22:10:15 1996 Richard Stallman <rms@gnu.org>
* reduce.c, reader.c, print.c, output.c, nullable.c, lex.c, lalr.c, getargs.c, derives.c, conflicts.c, closure.c, allocate.c:
Insert `_' macro around many string constants.
* main.c: Insert `_' macro around many string constants.
(main): Call setlocale, bindtextdomain and textdomain.
* system.h: [HAVE_LOCALE_H]: Include locale.h.
[! HAVE_LOCALE_H] (setlocale): Define as no-op.
[ENABLE_NLS]: Include libintl.h.
[ENABLE_NLS] (gettext): Define.
[! ENABLE_NLS] (bintextdomain, textdomain, _): Consolation definitions.
(N_, PACKAGE, LOCALEDIR): New macros.
Sun May 12 22:17:15 1996 Richard Stallman <rms@gnu.org>
* bison.s1:
(__yy_memcpy) [__cplusplus]: Reorder declarations of variables f and t.
Sat May 11 19:19:55 1996 Richard Stallman <rms@gnu.org>
* bison.s1 (__yy_memcpy):
Really reorder the args, as was supposedly done on Feb 14 1995.
(yyparse): Calls changed accordingly.
Sat Jan 27 08:26:26 1996 Richard Stallman <rms@gnu.org>
* output.c (output_rule_data): Test YYERROR_VERBOSE in the conditional
around the definition of ttyname.
Fri Dec 29 04:29:18 1995 Richard Stallman <rms@gnu.org>
* bison.s1: Fix line numbers in #line commands.
Wed Dec 27 12:43:49 1995 Richard Stallman <rms@gnu.org>
* bison.s1 (YYPARSE_PARAM_DECL): In C++, make it always null.
(YYPARSE_PARAM_ARG): New macro.
(yyparse): Use YYPARSE_PARAM_ARG.
Mon Oct 16 14:12:01 1995 Richard Stallman <rms@gnu.org>
* Attic/version.c: Version 1.25.
Sun Oct 15 20:22:50 1995 Richard Stallman <rms@gnu.org>
* vmsgetargs.c, getargs.c: Added -n, -k, and -raw switches.
(noparserflag, toknumflag, rawtoknumflag): New variables.
* symtab.h (SALIAS): New #define for adding aliases to %token.
(struct bucket): Added `alias' field.
* reduce.c (reduce_grammar): Revise error message.
(print_notices): Remove final `.' from error message.
* reader.c (reader_output_yylsp): New function.
(readgram): Use `#if 0' around code that accepted %command
inside grammar rules: The documentation doesn't allow it,
and it will fail since the %command processors scan for the next %.
(parse_token_decl): Extended the %token
declaration to allow a multi-character symbol as an alias.
(parse_thong_decl): New function.
(read_declarations): Added %thong declarations.
(read_declarations): Handle NOOP to deal with allowing
% declarations as another means to specify the flags.
(readgram): Allow %prec prior to semantics embedded in a rule.
(skip_to_char, read_declarations, copy_definition)
(parse_token_decl, parse_start_decl, parse_type_decl)
(parse_assoc_decl, parse_union_decl, parse_expect_decl)
(get_type_name, copy_guard, copy_action, readgram)
(get_type, packsymbols): Revised most error messages.
Changed `fatal' to `warnxxx' to avoid aborting for error.
Revised and use multiple warnxxx functions to avoid using VARARGS1.
(read_declarations): Improve the error message for
an invalid character. Do not abort.
(read_declarations, copy_guard, copy_action): Use
printable_version to avoid unprintable characters in printed output.
(parse_expect_decl): Error if argument to %expect exceeds 10 digits.
(parse_token_decl, parse_assoc_decl, parse_type_decl, get_type):
Allow the type of a non-terminal can be given
more than once, as long as all specifications give the same type.
* output.c: (output_headers, output_trailers, output, output_gram)
(output_rule_data): Implement noparserflag variable.
Implement toknumflag variable.
(output): Call reader_output_yylsp to output LTYPESTR.
* main.c (main): If reader sees an error, don't process the grammar.
(fatals): Updated to not use VARARGS1.
(printable_version, int_to_string, warn, warni, warns, warnss)
(warnsss): New error reporting functions. Avoid abort for error.
* lex.h: Added THONG and NOOP for alias processing.
Added SETOPT for the new code that allows setting options with %flags.
* lex.c: Include getopt.h. Add some extern decls.
(safegetc): New function to deal with EOF gracefully.
(literalchar); new function to deal with reading \ escapes.
(lex): Use literalchar.
(lex): Implemented "..." tokens.
(literalchar, lex, parse_percent_token): Made tokenbuffer
always contain the token. This includes growing the token
buffer while reading an integer.
(parse_percent_token): Replaced if-else statement with percent_table.
(parse_percent_token): Added % declarations as another
way to specify the flags -n, -l, and -r. Also added hooks for
-d, -k, -y, -v, -t, -p, -b, -o, but implementation requires
major changes to files.c.
(lex) Retain in the incoming stream a character following
an incorrect '/'.
(skip_white_space, lex): Revised most error messages
and changed fatal to warn to avoid aborting.
(percent_table): Added %thong declarations.
* gram.h: Comment changes.
* files.c (openfiles, open_extra_files, done): Add faction flag
and actfile file. Handle noparserflag. Both for -n switch.
* conflicts.c (resolve_sr_conflict): Remove use of alloca.
Sat May 6 05:35:44 1995 Richard Stallman <rms@gnu.org>
* bison.s1: Comment change.
Wed May 3 14:56:25 1995 Richard Stallman <rms@gnu.org>
* Attic/version.c: Version now 1.24.
* bison.s1: Change distribution terms.
* Attic/version.c: Version now 1.23.
Thu Feb 23 07:43:50 1995 Richard Stallman <rms@gnu.org>
* files.c: Test __VMS_POSIX as well as VMS.
Tue Feb 14 16:49:32 1995 Jim Meyering <meyering@gnu.org>
* bison.s1 (__yy_memcpy): Renamed from __yy_bcopy to avoid
confusion. Reverse FROM and TO arguments to be consistent with
those of memcpy.
Thu Sep 15 21:39:22 1994 Richard Stallman <rms@gnu.org>
* bison.s1: Update copyright notice and GPL version.
Tue Jul 12 20:43:44 1994 Richard Stallman <rms@gnu.org>
* reduce.c, reader.c: entered into RCS
Sat Mar 26 20:33:04 1994 Richard Stallman <rms@gnu.org>
* bison.s1: entered into RCS
Fri Mar 25 22:52:41 1994 Richard Stallman <rms@gnu.org>
* main.c: entered into RCS
Thu Mar 24 22:54:32 1994 Richard Stallman <rms@gnu.org>
* conflicts.c: entered into RCS
Sun Nov 21 10:25:13 1993 Richard Stallman <rms@gnu.org>
* bison.s1: *** empty log message ***
Tue Oct 19 03:55:14 1993 Richard Stallman <rms@gnu.org>
* bison.s1: *** empty log message ***
Thu Oct 14 16:19:10 1993 Richard Stallman <rms@gnu.org>
* bison.s1: *** empty log message ***
Fri Sep 10 13:41:02 1993 Richard Stallman <rms@gnu.org>
* conflicts.c: *** empty log message ***
* system.h: entered into RCS
Mon Sep 6 19:32:26 1993 Noah Friedman <friedman@gnu.org>
* Attic/version.c: entered into RCS
Sat Jul 24 08:00:44 1993 Richard Stallman <rms@gnu.org>
* bison.s1: *** empty log message ***
Sun Jul 4 20:07:28 1993 Richard Stallman <rms@gnu.org>
* bison.s1: *** empty log message ***
Sat Jun 26 20:06:51 1993 David J. MacKenzie <djm@gnu.org>
* getargs.c: entered into RCS
Fri Jun 25 19:11:46 1993 Richard Stallman <rms@gnu.org>
* getargs.c: Initial revision
Wed Jun 16 21:02:31 1993 Richard Stallman <rms@gnu.org>
* bison.s1: *** empty log message ***
Thu Jun 3 17:07:14 1993 Richard Stallman <rms@gnu.org>
* bison.s1: Initial revision
Wed Apr 28 19:15:14 1993 Noah Friedman <friedman@gnu.org>
* reader.c: *** empty log message ***
Fri Apr 23 16:29:13 1993 Noah Friedman <friedman@gnu.org>
* alloc.h: entered into RCS
Tue Apr 20 06:00:53 1993 David J. MacKenzie <djm@gnu.org>
* Attic/version.c: *** empty log message ***
* files.c, allocate.c: entered into RCS
* reader.c: *** empty log message ***
* lex.c: entered into RCS
* conflicts.c: Initial revision
* symtab.c: entered into RCS
* alloc.h: Initial revision
* LR0.c: entered into RCS
Sun Apr 18 05:49:49 1993 Noah Friedman <friedman@gnu.org>
* reader.c: Initial revision
* Attic/version.c: *** empty log message ***
Thu Apr 15 19:37:53 1993 Richard Stallman <rms@gnu.org>
* main.c, files.c: Initial revision
Tue Apr 13 18:52:55 1993 Richard Stallman <rms@gnu.org>
* Attic/version.c: Initial revision
Thu Mar 25 02:45:46 1993 Richard Stallman <rms@gnu.org>
* output.c: entered into RCS
Mon Jun 22 04:07:22 1992 Richard Stallman <rms@gnu.org>
* vmsgetargs.c: entered into RCS
Wed Jan 22 04:15:36 1992 Richard Stallman <rms@gnu.org>
* machine.h: entered into RCS
Sat Dec 21 00:17:44 1991 Richard Stallman <rms@gnu.org>
* lalr.c, closure.c: entered into RCS
Fri Dec 20 23:55:12 1991 Richard Stallman <rms@gnu.org>
* state.h: entered into RCS
Wed Dec 18 07:39:50 1991 Richard Stallman <rms@gnu.org>
* print.c, nullable.c, derives.c: entered into RCS
Sun Nov 3 02:39:18 1991 David J. MacKenzie <djm@gnu.org>
* warshall.c, types.h, symtab.h, lex.h, gram.c, gram.h, files.h:
entered into RCS
Fri Sep 9 01:04:17 1988 Richard Stallman <rms@gnu.org>
* bison.hairy: entered into RCS

View File

@ -167,7 +167,9 @@ operates.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made.
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
@ -178,4 +180,3 @@ operates.
script, and exit.
`configure' also accepts some other, not widely useful, options.

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* See comments in state.h for the data structures that represent it.
@ -24,7 +25,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
#include "system.h"
#include "machine.h"
#include "new.h"
#include "alloc.h"
#include "gram.h"
#include "state.h"
@ -40,20 +41,24 @@ core *first_state;
shifts *first_shift;
reductions *first_reduction;
int get_state();
core *new_state();
int get_state PARAMS((int));
core *new_state PARAMS((int));
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();
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;
@ -78,7 +83,7 @@ static core **state_table;
void
allocate_itemsets()
allocate_itemsets (void)
{
register short *itemp;
register int symbol;
@ -123,7 +128,7 @@ allocate_itemsets()
void
allocate_storage()
allocate_storage (void)
{
allocate_itemsets();
@ -134,7 +139,7 @@ allocate_storage()
void
free_storage()
free_storage (void)
{
FREE(shift_symbol);
FREE(redset);
@ -150,7 +155,7 @@ free_storage()
/* 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);
@ -196,7 +201,7 @@ generate_states()
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;
@ -244,7 +249,7 @@ new_itemsets()
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;
@ -283,8 +288,7 @@ Create a new state if no equivalent one exists already.
Used by append_states */
int
get_state(symbol)
int symbol;
get_state (int symbol)
{
register int key;
register short *isp1;
@ -357,8 +361,7 @@ int symbol;
/* 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;
@ -396,7 +399,7 @@ int symbol;
void
initialize_states()
initialize_states (void)
{
register core *p;
/* register unsigned *rp1; JF unused */
@ -410,7 +413,7 @@ initialize_states()
void
save_shifts()
save_shifts (void)
{
register shifts *p;
register short *sp1;
@ -418,7 +421,7 @@ save_shifts()
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;
@ -447,7 +450,7 @@ save_shifts()
/* 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;
@ -475,7 +478,7 @@ save_reductions()
if (count)
{
p = (reductions *) xmalloc((unsigned) (sizeof(reductions) +
(count - 1) * sizeof(short)));
(count - 1) * sizeof(short)));
p->number = this_state->number;
p->nreds = count;
@ -508,7 +511,7 @@ which has a shift going to the final state, which has a shift
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;
@ -516,7 +519,7 @@ augment_automaton()
register core *statep;
register shifts *sp;
register shifts *sp2;
register shifts *sp1;
register shifts *sp1 = NULL;
sp = first_shift;
@ -548,7 +551,7 @@ augment_automaton()
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;
@ -681,7 +684,7 @@ augment_automaton()
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;

27
contrib/bison/Makefile.am Normal file
View File

@ -0,0 +1,27 @@
## Process this file with automake to produce Makefile.in -*-Makefile-*-
AUTOMAKE_OPTIONS = 1.4 ansi2knr
bin_PROGRAMS = bison
bison_SOURCES = LR0.c allocate.c closure.c conflicts.c derives.c \
files.c getargs.c gram.c lalr.c lex.c main.c nullable.c output.c \
print.c reader.c reduce.c symtab.c warshall.c getopt.c getopt1.c
EXTRA_bison_SOURCES = vmsgetargs.c
bison_LDADD = @INTLLIBS@ @ALLOCA@
INCLUDES = -I../intl -I$(top_srcdir)/intl
noinst_HEADERS = alloc.h files.h gram.h lex.h machine.h state.h \
symtab.h system.h types.h getopt.h
data_DATA = bison.simple bison.hairy
EXTRA_DIST = bison.s1 bison.hairy build.com bison.cld vmshlp.mar
bison.simple: bison.s1 Makefile
-rm -f $@
sed -e "/^#line/ s|bison|$(datadir)/bison|" -e "s/@bison_version@/$(VERSION)/" < $(srcdir)/bison.s1 > $@-tmp
mv $@-tmp $@
DISTCLEANFILES = bison.simple

View File

@ -1,191 +1,451 @@
# Makefile for bison
# Copyright (C) 1988, 1989, 1991, 1993 Bob Corbett and 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, 675 Mass Ave, Cambridge, MA 02139, USA.
# Makefile.in generated automatically by automake 1.4 from Makefile.am
#### Start of system configuration section. ####
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
CC = @CC@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
MAKEINFO = makeinfo
# Things you might add to DEFS:
# -DSTDC_HEADERS If you have ANSI C headers and libraries.
# -DHAVE_STRING_H If you don't have ANSI C headers but have string.h.
# -DHAVE_MEMORY_H If you don't have ANSI C headers and have memory.h.
# -DHAVE_STRERROR If you have strerror function.
DEFS = @DEFS@
CFLAGS = -g
LDFLAGS =
LIBS = @LIBS@
# Some System V machines do not come with libPW. If this is true, use
# the GNU alloca.o here.
ALLOCA = @ALLOCA@
prefix = @prefix@
exec_prefix = @exec_prefix@
# where the installed binary goes
bindir = $(exec_prefix)/bin
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
# where the parsers go
datadir = $(prefix)/share
DESTDIR =
# where the info files go
infodir = $(prefix)/info
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
# where manual pages go and what their extensions should be
mandir = $(prefix)/man/man$(manext)
manext = 1
top_builddir = ..
#### End of system configuration section. ####
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
DISTFILES = COPYING ChangeLog Makefile.in configure configure.in \
REFERENCES bison.1 bison.rnh configure.bat \
bison.simple bison.hairy \
LR0.c allocate.c closure.c conflicts.c derives.c \
files.c getargs.c gram.c lalr.c lex.c main.c nullable.c \
output.c print.c reader.c reduce.c symtab.c version.c \
warshall.c files.h gram.h lex.h machine.h new.h state.h \
symtab.h system.h types.h bison.cld build.com vmsgetargs.c \
vmshlp.mar README INSTALL NEWS bison.texinfo bison.info* texinfo.tex \
getopt.c getopt.h getopt1.c alloca.c mkinstalldirs install-sh
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CPP = @CPP@
DATADIRNAME = @DATADIRNAME@
GENCAT = @GENCAT@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GT_NO = @GT_NO@
GT_YES = @GT_YES@
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
PACKAGE = @PACKAGE@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
U = @U@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
l = @l@
AUTOMAKE_OPTIONS = 1.4 ansi2knr
bin_PROGRAMS = bison
bison_SOURCES = LR0.c allocate.c closure.c conflicts.c derives.c files.c getargs.c gram.c lalr.c lex.c main.c nullable.c output.c print.c reader.c reduce.c symtab.c warshall.c getopt.c getopt1.c
SHELL = /bin/sh
EXTRA_bison_SOURCES = vmsgetargs.c
# This rule allows us to supply the necessary -D options
# in addition to whatever the user asks for.
.c.o:
$(CC) -c $(DEFS) -I$(srcdir)/../include $(CPPFLAGS) $(CFLAGS) $<
bison_LDADD = @INTLLIBS@ @ALLOCA@
INCLUDES = -I../intl -I$(top_srcdir)/intl
# names of parser files
PFILE = bison.simple
PFILE1 = bison.hairy
noinst_HEADERS = alloc.h files.h gram.h lex.h machine.h state.h symtab.h system.h types.h getopt.h
PFILES = -DXPFILE=\"$(datadir)/$(PFILE)\" \
-DXPFILE1=\"$(datadir)/$(PFILE1)\"
OBJECTS = LR0.o allocate.o closure.o conflicts.o derives.o files.o \
getargs.o gram.o lalr.o lex.o \
main.o nullable.o output.o print.o reader.o reduce.o symtab.o \
warshall.o version.o \
getopt.o getopt1.o $(ALLOCA)
data_DATA = bison.simple bison.hairy
all: bison bison.info bison.s1
EXTRA_DIST = bison.s1 bison.hairy build.com bison.cld vmshlp.mar
Makefile: Makefile.in config.status
./config.status
DISTCLEANFILES = bison.simple
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
PROGRAMS = $(bin_PROGRAMS)
config.status: configure
./config.status --recheck
configure: configure.in
cd $(srcdir); autoconf
DEFS = @DEFS@ -I. -I$(srcdir) -I..
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
ANSI2KNR = @ANSI2KNR@
bison_OBJECTS = LR0$U.o allocate$U.o closure$U.o conflicts$U.o \
derives$U.o files$U.o getargs$U.o gram$U.o lalr$U.o lex$U.o main$U.o \
nullable$U.o output$U.o print$U.o reader$U.o reduce$U.o symtab$U.o \
warshall$U.o getopt$U.o getopt1$U.o
bison_DEPENDENCIES = @ALLOCA@
bison_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DATA = $(data_DATA)
# Copy bison.simple, inserting directory name into the #line commands.
bison.s1: bison.simple
-rm -f bison.s1
sed -e "/^#line/ s|bison|$(datadir)/bison|" < $(srcdir)/$(PFILE) > bison.s1
HEADERS = $(noinst_HEADERS)
clean:
rm -f *.o core bison bison.s1
DIST_COMMON = ChangeLog Makefile.am Makefile.in alloca.c ansi2knr.1 \
ansi2knr.c
mostlyclean: clean
distclean: clean
rm -f Makefile config.status
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
realclean: distclean
rm -f TAGS *.info*
TAR = tar
GZIP_ENV = --best
SOURCES = $(bison_SOURCES) $(EXTRA_bison_SOURCES)
OBJECTS = $(bison_OBJECTS)
# Most of these deps are in case using RCS.
install: all bison.1 $(srcdir)/$(PFILE) $(srcdir)/$(PFILE1) installdirs uninstall
$(INSTALL_PROGRAM) bison $(bindir)/bison
$(INSTALL_DATA) bison.s1 $(datadir)/$(PFILE)
$(INSTALL_DATA) $(srcdir)/$(PFILE1) $(datadir)/$(PFILE1)
cd $(srcdir); for f in bison.info*; \
do $(INSTALL_DATA) $$f $(infodir)/$$f; done
-$(INSTALL_DATA) $(srcdir)/bison.1 $(mandir)/bison.$(manext)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/Makefile
# Make sure all installation directories, e.g. $(bindir) actually exist by
# making them if necessary.
installdirs:
-sh $(srcdir)/mkinstalldirs $(bindir) $(datadir) $(libdir) $(infodir) $(mandir)
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
uninstall:
rm -f $(bindir)/bison
-cd $(datadir); rm -f $(PFILE) $(PFILE1)
rm -f $(mandir)/bison.$(manext) $(infodir)/bison.info*
check:
@echo "No checks implemented (yet)."
mostlyclean-binPROGRAMS:
bison: $(OBJECTS)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJECTS) $(LIBS)
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
# We don't use $(srcdir) in this rule
# because it is normally used in the master source dir
# in which configure has not been run.
dist: bison.info
echo bison-`sed -e '/version_string/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q version.c` > .fname
-rm -rf `cat .fname`
mkdir `cat .fname`
dst=`cat .fname`; for f in $(DISTFILES); do \
ln $$f $$dst/$$f || { echo copying $$f; cp -p $$f $$dst/$$f ; } \
distclean-binPROGRAMS:
maintainer-clean-binPROGRAMS:
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
else :; fi; \
done
tar --gzip -chf `cat .fname`.tar.gz `cat .fname`
-rm -rf `cat .fname` .fname
bison.info: bison.texinfo
$(MAKEINFO) $(srcdir)/bison.texinfo
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
done
TAGS: *.c *.h
etags *.c *.h
.c.o:
$(COMPILE) -c $<
# This file is different to pass the parser file names to the compiler.
files.o: files.c
$(CC) -c $(PFILES) $(DEFS) $(CPPFLAGS) $(CFLAGS) \
$(srcdir)/files.c $(OUTPUT_OPTION)
.s.o:
$(COMPILE) -c $<
LR0.o: system.h machine.h new.h gram.h state.h
closure.o: system.h machine.h new.h gram.h
conflicts.o: system.h machine.h new.h files.h gram.h state.h
derives.o: system.h new.h types.h gram.h
files.o: system.h files.h new.h gram.h
getargs.o: system.h files.h
lalr.o: system.h machine.h types.h state.h new.h gram.h
lex.o: system.h files.h symtab.h lex.h
main.o: system.h machine.h
nullable.o: system.h types.h gram.h new.h
output.o: system.h machine.h new.h files.h gram.h state.h
print.o: system.h machine.h new.h files.h gram.h state.h
reader.o: system.h files.h new.h symtab.h lex.h gram.h
reduce.o: system.h machine.h files.h new.h gram.h
symtab.o: system.h new.h symtab.h gram.h
warshall.o: system.h machine.h
.S.o:
$(COMPILE) -c $<
# Prevent GNU make v3 from overflowing arg limit on SysV.
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
mostlyclean-krextra:
clean-krextra:
-rm -f ansi2knr
distclean-krextra:
maintainer-clean-krextra:
ansi2knr: ansi2knr.o
$(LINK) ansi2knr.o $(LIBS)
ansi2knr.o: $(CONFIG_HEADER)
mostlyclean-kr:
-rm -f *_.c
clean-kr:
distclean-kr:
maintainer-clean-kr:
bison: $(bison_OBJECTS) $(bison_DEPENDENCIES)
@rm -f bison
$(LINK) $(bison_LDFLAGS) $(bison_OBJECTS) $(bison_LDADD) $(LIBS)
LR0_.c: LR0.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/LR0.c; then echo $(srcdir)/LR0.c; else echo LR0.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > LR0_.c
alloca_.c: alloca.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/alloca.c; then echo $(srcdir)/alloca.c; else echo alloca.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > alloca_.c
allocate_.c: allocate.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/allocate.c; then echo $(srcdir)/allocate.c; else echo allocate.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > allocate_.c
closure_.c: closure.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/closure.c; then echo $(srcdir)/closure.c; else echo closure.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > closure_.c
conflicts_.c: conflicts.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/conflicts.c; then echo $(srcdir)/conflicts.c; else echo conflicts.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > conflicts_.c
derives_.c: derives.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/derives.c; then echo $(srcdir)/derives.c; else echo derives.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > derives_.c
files_.c: files.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/files.c; then echo $(srcdir)/files.c; else echo files.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > files_.c
getargs_.c: getargs.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getargs.c; then echo $(srcdir)/getargs.c; else echo getargs.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getargs_.c
getopt_.c: getopt.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt.c; then echo $(srcdir)/getopt.c; else echo getopt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt_.c
getopt1_.c: getopt1.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt1.c; then echo $(srcdir)/getopt1.c; else echo getopt1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt1_.c
gram_.c: gram.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gram.c; then echo $(srcdir)/gram.c; else echo gram.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gram_.c
lalr_.c: lalr.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lalr.c; then echo $(srcdir)/lalr.c; else echo lalr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > lalr_.c
lex_.c: lex.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lex.c; then echo $(srcdir)/lex.c; else echo lex.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > lex_.c
main_.c: main.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/main.c; then echo $(srcdir)/main.c; else echo main.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > main_.c
nullable_.c: nullable.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/nullable.c; then echo $(srcdir)/nullable.c; else echo nullable.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > nullable_.c
output_.c: output.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/output.c; then echo $(srcdir)/output.c; else echo output.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > output_.c
print_.c: print.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/print.c; then echo $(srcdir)/print.c; else echo print.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > print_.c
reader_.c: reader.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/reader.c; then echo $(srcdir)/reader.c; else echo reader.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > reader_.c
reduce_.c: reduce.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/reduce.c; then echo $(srcdir)/reduce.c; else echo reduce.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > reduce_.c
symtab_.c: symtab.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/symtab.c; then echo $(srcdir)/symtab.c; else echo symtab.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > symtab_.c
vmsgetargs_.c: vmsgetargs.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vmsgetargs.c; then echo $(srcdir)/vmsgetargs.c; else echo vmsgetargs.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > vmsgetargs_.c
warshall_.c: warshall.c $(ANSI2KNR)
$(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/warshall.c; then echo $(srcdir)/warshall.c; else echo warshall.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > warshall_.c
LR0_.o alloca_.o allocate_.o closure_.o conflicts_.o derives_.o \
files_.o getargs_.o getopt_.o getopt1_.o gram_.o lalr_.o lex_.o main_.o \
nullable_.o output_.o print_.o reader_.o reduce_.o symtab_.o \
vmsgetargs_.o warshall_.o : $(ANSI2KNR)
install-dataDATA: $(data_DATA)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(datadir)
@list='$(data_DATA)'; for p in $$list; do \
if test -f $(srcdir)/$$p; then \
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(datadir)/$$p"; \
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(datadir)/$$p; \
else if test -f $$p; then \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(datadir)/$$p"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(datadir)/$$p; \
fi; fi; \
done
uninstall-dataDATA:
@$(NORMAL_UNINSTALL)
list='$(data_DATA)'; for p in $$list; do \
rm -f $(DESTDIR)$(datadir)/$$p; \
done
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = src
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
LR0.o: LR0.c system.h ../config.h getopt.h machine.h alloc.h gram.h \
state.h
allocate.o: allocate.c system.h ../config.h getopt.h
closure.o: closure.c system.h ../config.h getopt.h machine.h alloc.h \
gram.h
conflicts.o: conflicts.c system.h ../config.h getopt.h machine.h alloc.h \
files.h gram.h state.h
derives.o: derives.c system.h ../config.h getopt.h alloc.h types.h \
gram.h
files.o: files.c system.h ../config.h getopt.h files.h alloc.h gram.h
getargs.o: getargs.c getopt.h system.h ../config.h files.h
getopt.o: getopt.c ../config.h
getopt1.o: getopt1.c ../config.h getopt.h
gram.o: gram.c
lalr.o: lalr.c system.h ../config.h getopt.h machine.h types.h state.h \
alloc.h gram.h
lex.o: lex.c system.h ../config.h getopt.h files.h symtab.h lex.h \
alloc.h
main.o: main.c system.h ../config.h getopt.h machine.h
nullable.o: nullable.c system.h ../config.h getopt.h types.h gram.h \
alloc.h
output.o: output.c system.h ../config.h getopt.h machine.h alloc.h \
files.h gram.h state.h
print.o: print.c system.h ../config.h getopt.h machine.h alloc.h files.h \
gram.h state.h
reader.o: reader.c system.h ../config.h getopt.h files.h alloc.h \
symtab.h lex.h gram.h machine.h
reduce.o: reduce.c system.h ../config.h getopt.h files.h gram.h \
machine.h alloc.h
symtab.o: symtab.c system.h ../config.h getopt.h alloc.h symtab.h gram.h
warshall.o: warshall.c system.h ../config.h getopt.h machine.h
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-binPROGRAMS
install-exec: install-exec-am
install-data-am: install-dataDATA
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-binPROGRAMS uninstall-dataDATA
uninstall: uninstall-am
all-am: Makefile $(ANSI2KNR) $(PROGRAMS) $(DATA) $(HEADERS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(datadir)
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
mostlyclean-krextra mostlyclean-kr mostlyclean-tags \
mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-binPROGRAMS clean-compile clean-krextra clean-kr \
clean-tags clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-binPROGRAMS distclean-compile distclean-krextra \
distclean-kr distclean-tags distclean-generic clean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-binPROGRAMS \
maintainer-clean-compile maintainer-clean-krextra \
maintainer-clean-kr maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-krextra distclean-krextra \
clean-krextra maintainer-clean-krextra mostlyclean-kr distclean-kr \
clean-kr maintainer-clean-kr uninstall-dataDATA install-dataDATA tags \
mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
distdir info-am info dvi-am dvi check check-am installcheck-am \
installcheck install-exec-am install-exec install-data-am install-data \
install-am install uninstall-am uninstall all-redirect all-am all \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
bison.simple: bison.s1 Makefile
-rm -f $@
sed -e "/^#line/ s|bison|$(datadir)/bison|" -e "s/@bison_version@/$(VERSION)/" < $(srcdir)/bison.s1 > $@-tmp
mv $@-tmp $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,7 +1,39 @@
Bison News
----------
Change in version 1.25:
Changes in version 1.28:
* Should compile better now with K&R compilers.
* Added NLS.
* Fixed a problem with escaping the double quote character.
* There is now a FAQ.
Changes in version 1.27:
* The make rule which prevented bison.simple from being created on
some systems has been fixed.
Changes in version 1.26:
* Bison now uses automake.
* New mailing lists: <bug-bison@gnu.org> and <help-bison@gnu.org>.
* Token numbers now start at 257 as previously documented, not 258.
* Bison honors the TMPDIR environment variable.
* A couple of buffer overruns have been fixed.
* Problems when closing files should now be reported.
* Generated parsers should now work even on operating systems which do
not provide alloca().
Changes in version 1.25:
* Errors in the input grammar are not fatal; Bison keeps reading
the grammar file, and reports all the errors found in it.

View File

@ -1,6 +1,7 @@
This directory contains the Bison parser generator.
See the file INSTALL for compilation and installation instructions.
See the file doc/FAQ for frequently asked questions.
It was once true that, when installing Bison on Sequent (or Pyramid?)
systems, you had to be in the Berkeley universe. This may no longer
@ -10,6 +11,13 @@ On VMS, you will probably have to create Makefile from Makefile.in by
hand. Remember to do `SET COMMAND BISON' to install the data in
`BISON.CLD'.
Send bug reports to bug-gnu-utils@prep.ai.mit.edu. Please include the
version number from `bison --version', and a complete, self-contained
test case in each bug report.
VMS and MS-DOS builds are probably broken right now. If you are able
to build Bison on either platform and you need to make changes to do
so, please submit those changes as a bug report.
Send bug reports to bug-bison@gnu.org. Please include the version
number from `bison --version', and a complete, self-contained test
case in each bug report.
If you have questions about using Bison which the documentation does
not answer, send mail to help-bison@gnu.org.

56
contrib/bison/acconfig.h Normal file
View File

@ -0,0 +1,56 @@
#ifndef CONFIG_H
#define CONFIG_H
@TOP@
/* Name of package. */
#undef PACKAGE
/* Version of package. */
#undef VERSION
/* Version string. */
#undef VERSION_STRING
/* Define if the compiler understands prototypes. */
#undef PROTOTYPES
/* Define to 1 if NLS is requested. */
#undef ENABLE_NLS
/* Define as 1 if you have catgets and don't want to use GNU gettext. */
#undef HAVE_CATGETS
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
#undef HAVE_GETTEXT
/* Define if your locale.h file contains LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
/* Define to 1 if you have the stpcpy function. */
#undef HAVE_STPCPY
/* The location of the simple parser (bison.simple). */
#undef XPFILE
/* The location of the semantic parser (bison.hairy). */
#undef XPFILE1
/* The location of the local directory. */
#undef LOCALEDIR
/* Define as 1 if realloc must be declared even if <stdlib.h> is
included. */
#undef NEED_DECLARATION_REALLOC
/* Define as 1 if calloc must be declared even if <stdlib.h> is
included. */
#undef NEED_DECLARATION_CALLOC
@BOTTOM@
#if defined(PROTOTYPES) || defined(__cplusplus)
# define PARAMS(p) p
#else
# define PARAMS(p) ()
#endif
#endif /* CONFIG_H */

View File

@ -0,0 +1,60 @@
dnl BISON_DEFINE_FILE(VARNAME, FILE)
dnl Defines (with AC_DEFINE) VARNAME to the expansion of the FILE
dnl variable, expanding ${prefix} and such.
dnl Example: BISON_DEFINE_FILE(DATADIR, datadir)
dnl By Alexandre Oliva <oliva@dcc.unicamp.br>
AC_DEFUN(BISON_DEFINE_FILE, [
ac_expanded=`(
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
eval echo \""[$]$2"\"
)`
AC_DEFINE_UNQUOTED($1, "$ac_expanded")
])
dnl See whether we need a declaration for a function.
dnl BISON_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
AC_DEFUN(BISON_NEED_DECLARATION,
[AC_MSG_CHECKING([whether $1 must be declared])
AC_CACHE_VAL(bison_cv_decl_needed_$1,
[AC_TRY_COMPILE([
#include <stdio.h>
#ifdef HAVE_STRING_H
#include <string.h>
#else
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifndef HAVE_RINDEX
#define rindex strrchr
#endif
#ifndef HAVE_INDEX
#define index strchr
#endif
$2],
[char *(*pfn) = (char *(*)) $1],
eval "bison_cv_decl_needed_$1=no", eval "bison_cv_decl_needed_$1=yes")])
if eval "test \"`echo '$bison_cv_decl_needed_'$1`\" = yes"; then
AC_MSG_RESULT(yes)
bison_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
AC_DEFINE_UNQUOTED($bison_tr_decl)
else
AC_MSG_RESULT(no)
fi
])dnl
dnl Check multiple functions to see whether each needs a declaration.
dnl BISON_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
AC_DEFUN(BISON_NEED_DECLARATIONS,
[for ac_func in $1
do
BISON_NEED_DECLARATION($ac_func, $2)
done
])

682
contrib/bison/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,682 @@
dnl aclocal.m4 generated automatically by aclocal 1.4
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
dnl BISON_DEFINE_FILE(VARNAME, FILE)
dnl Defines (with AC_DEFINE) VARNAME to the expansion of the FILE
dnl variable, expanding ${prefix} and such.
dnl Example: BISON_DEFINE_FILE(DATADIR, datadir)
dnl By Alexandre Oliva <oliva@dcc.unicamp.br>
AC_DEFUN(BISON_DEFINE_FILE, [
ac_expanded=`(
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
eval echo \""[$]$2"\"
)`
AC_DEFINE_UNQUOTED($1, "$ac_expanded")
])
dnl See whether we need a declaration for a function.
dnl BISON_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
AC_DEFUN(BISON_NEED_DECLARATION,
[AC_MSG_CHECKING([whether $1 must be declared])
AC_CACHE_VAL(bison_cv_decl_needed_$1,
[AC_TRY_COMPILE([
#include <stdio.h>
#ifdef HAVE_STRING_H
#include <string.h>
#else
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifndef HAVE_RINDEX
#define rindex strrchr
#endif
#ifndef HAVE_INDEX
#define index strchr
#endif
$2],
[char *(*pfn) = (char *(*)) $1],
eval "bison_cv_decl_needed_$1=no", eval "bison_cv_decl_needed_$1=yes")])
if eval "test \"`echo '$bison_cv_decl_needed_'$1`\" = yes"; then
AC_MSG_RESULT(yes)
bison_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
AC_DEFINE_UNQUOTED($bison_tr_decl)
else
AC_MSG_RESULT(no)
fi
])dnl
dnl Check multiple functions to see whether each needs a declaration.
dnl BISON_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
AC_DEFUN(BISON_NEED_DECLARATIONS,
[for ac_func in $1
do
BISON_NEED_DECLARATION($ac_func, $2)
done
])
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN(AM_INIT_AUTOMAKE,
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
AC_SUBST(VERSION)
dnl test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
ifelse([$3],,
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
#
# Check to make sure that the build environment is sane.
#
AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
if test "[$]*" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftestfile`
fi
if test "[$]*" != "X $srcdir/configure conftestfile" \
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "[$]2" = conftestfile
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN(AM_MISSING_PROG,
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
if ($2 --version) < /dev/null > /dev/null 2>&1; then
$1=$2
AC_MSG_RESULT(found)
else
$1="$3/missing $2"
AC_MSG_RESULT(missing)
fi
AC_SUBST($1)])
# Like AC_CONFIG_HEADER, but automatically create stamp file.
AC_DEFUN(AM_CONFIG_HEADER,
[AC_PREREQ([2.12])
AC_CONFIG_HEADER([$1])
dnl When config.status generates a header, we must update the stamp-h file.
dnl This file resides in the same directory as the config header
dnl that is generated. We must strip everything past the first ":",
dnl and everything past the last "/".
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
<<am_indx=1
for am_file in <<$1>>; do
case " <<$>>CONFIG_HEADERS " in
*" <<$>>am_file "*<<)>>
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
;;
esac
am_indx=`expr "<<$>>am_indx" + 1`
done<<>>dnl>>)
changequote([,]))])
# serial 1
# @defmac AC_PROG_CC_STDC
# @maindex PROG_CC_STDC
# @ovindex CC
# If the C compiler in not in ANSI C mode by default, try to add an option
# to output variable @code{CC} to make it so. This macro tries various
# options that select ANSI C on some system or another. It considers the
# compiler to be in ANSI C mode if it handles function prototypes correctly.
#
# If you use this macro, you should check after calling it whether the C
# compiler has been set to accept ANSI C; if not, the shell variable
# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
# code in ANSI C, you can make an un-ANSIfied copy of it by using the
# program @code{ansi2knr}, which comes with Ghostscript.
# @end defmac
AC_DEFUN(AM_PROG_CC_STDC,
[AC_REQUIRE([AC_PROG_CC])
AC_BEFORE([$0], [AC_C_INLINE])
AC_BEFORE([$0], [AC_C_CONST])
dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
dnl a magic option to avoid problems with ANSI preprocessor commands
dnl like #elif.
dnl FIXME: can't do this because then AC_AIX won't work due to a
dnl circular dependency.
dnl AC_BEFORE([$0], [AC_PROG_CPP])
AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
AC_CACHE_VAL(am_cv_prog_cc_stdc,
[am_cv_prog_cc_stdc=no
ac_save_CC="$CC"
# Don't try gcc -ansi; that turns off useful extensions and
# breaks some systems' header files.
# AIX -qlanglvl=ansi
# Ultrix and OSF/1 -std1
# HP-UX -Aa -D_HPUX_SOURCE
# SVR4 -Xc -D__EXTENSIONS__
for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
AC_TRY_COMPILE(
[#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
], [
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
],
[am_cv_prog_cc_stdc="$ac_arg"; break])
done
CC="$ac_save_CC"
])
if test -z "$am_cv_prog_cc_stdc"; then
AC_MSG_RESULT([none needed])
else
AC_MSG_RESULT($am_cv_prog_cc_stdc)
fi
case "x$am_cv_prog_cc_stdc" in
x|xno) ;;
*) CC="$CC $am_cv_prog_cc_stdc" ;;
esac
])
# serial 1
AC_DEFUN(AM_C_PROTOTYPES,
[AC_REQUIRE([AM_PROG_CC_STDC])
AC_REQUIRE([AC_PROG_CPP])
AC_MSG_CHECKING([for function prototypes])
if test "$am_cv_prog_cc_stdc" != no; then
AC_MSG_RESULT(yes)
AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
U= ANSI2KNR=
else
AC_MSG_RESULT(no)
U=_ ANSI2KNR=./ansi2knr
# Ensure some checks needed by ansi2knr itself.
AC_HEADER_STDC
AC_CHECK_HEADERS(string.h)
fi
AC_SUBST(U)dnl
AC_SUBST(ANSI2KNR)dnl
])
# Macro to add for using GNU gettext.
# Ulrich Drepper <drepper@cygnus.com>, 1995.
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
# serial 5
AC_DEFUN(AM_WITH_NLS,
[AC_MSG_CHECKING([whether NLS is requested])
dnl Default is enabled NLS
AC_ARG_ENABLE(nls,
[ --disable-nls do not use Native Language Support],
USE_NLS=$enableval, USE_NLS=yes)
AC_MSG_RESULT($USE_NLS)
AC_SUBST(USE_NLS)
USE_INCLUDED_LIBINTL=no
dnl If we use NLS figure out what method
if test "$USE_NLS" = "yes"; then
AC_DEFINE(ENABLE_NLS)
AC_MSG_CHECKING([whether included gettext is requested])
AC_ARG_WITH(included-gettext,
[ --with-included-gettext use the GNU gettext library included here],
nls_cv_force_use_gnu_gettext=$withval,
nls_cv_force_use_gnu_gettext=no)
AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
dnl User does not insist on using GNU NLS library. Figure out what
dnl to use. If gettext or catgets are available (in this order) we
dnl use this. Else we have to fall back to GNU NLS library.
dnl catgets is only used if permitted by option --with-catgets.
nls_cv_header_intl=
nls_cv_header_libgt=
CATOBJEXT=NONE
AC_CHECK_HEADER(libintl.h,
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
[AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
if test "$gt_cv_func_gettext_libc" != "yes"; then
AC_CHECK_LIB(intl, bindtextdomain,
[AC_CACHE_CHECK([for gettext in libintl],
gt_cv_func_gettext_libintl,
[AC_CHECK_LIB(intl, gettext,
gt_cv_func_gettext_libintl=yes,
gt_cv_func_gettext_libintl=no)],
gt_cv_func_gettext_libintl=no)])
fi
if test "$gt_cv_func_gettext_libc" = "yes" \
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
AC_DEFINE(HAVE_GETTEXT)
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
if test "$MSGFMT" != "no"; then
AC_CHECK_FUNCS(dcgettext)
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
return _nl_msg_cat_cntr],
[CATOBJEXT=.gmo
DATADIRNAME=share],
[CATOBJEXT=.mo
DATADIRNAME=lib])
INSTOBJEXT=.mo
fi
fi
])
if test "$CATOBJEXT" = "NONE"; then
AC_MSG_CHECKING([whether catgets can be used])
AC_ARG_WITH(catgets,
[ --with-catgets use catgets functions if available],
nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
AC_MSG_RESULT($nls_cv_use_catgets)
if test "$nls_cv_use_catgets" = "yes"; then
dnl No gettext in C library. Try catgets next.
AC_CHECK_LIB(i, main)
AC_CHECK_FUNC(catgets,
[AC_DEFINE(HAVE_CATGETS)
INTLOBJS="\$(CATOBJS)"
AC_PATH_PROG(GENCAT, gencat, no)dnl
if test "$GENCAT" != "no"; then
AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
if test "$GMSGFMT" = "no"; then
AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
fi
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
USE_INCLUDED_LIBINTL=yes
CATOBJEXT=.cat
INSTOBJEXT=.cat
DATADIRNAME=lib
INTLDEPS='$(top_builddir)/intl/libintl.a'
INTLLIBS=$INTLDEPS
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
nls_cv_header_intl=intl/libintl.h
nls_cv_header_libgt=intl/libgettext.h
fi])
fi
fi
if test "$CATOBJEXT" = "NONE"; then
dnl Neither gettext nor catgets in included in the C library.
dnl Fall back on GNU gettext library.
nls_cv_use_gnu_gettext=yes
fi
fi
if test "$nls_cv_use_gnu_gettext" = "yes"; then
dnl Mark actions used to generate GNU NLS library.
INTLOBJS="\$(GETTOBJS)"
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
AC_SUBST(MSGFMT)
USE_INCLUDED_LIBINTL=yes
CATOBJEXT=.gmo
INSTOBJEXT=.mo
DATADIRNAME=share
INTLDEPS='$(top_builddir)/intl/libintl.a'
INTLLIBS=$INTLDEPS
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
nls_cv_header_intl=intl/libintl.h
nls_cv_header_libgt=intl/libgettext.h
fi
dnl Test whether we really found GNU xgettext.
if test "$XGETTEXT" != ":"; then
dnl If it is no GNU xgettext we define it as : so that the
dnl Makefiles still can work.
if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
: ;
else
AC_MSG_RESULT(
[found xgettext program is not GNU xgettext; ignore it])
XGETTEXT=":"
fi
fi
# We need to process the po/ directory.
POSUB=po
else
DATADIRNAME=share
nls_cv_header_intl=intl/libintl.h
nls_cv_header_libgt=intl/libgettext.h
fi
AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
AC_OUTPUT_COMMANDS(
[case "$CONFIG_FILES" in *po/Makefile.in*)
sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
esac])
# If this is used in GNU gettext we have to set USE_NLS to `yes'
# because some of the sources are only built for this goal.
if test "$PACKAGE" = gettext; then
USE_NLS=yes
USE_INCLUDED_LIBINTL=yes
fi
dnl These rules are solely for the distribution goal. While doing this
dnl we only have to keep exactly one list of the available catalogs
dnl in configure.in.
for lang in $ALL_LINGUAS; do
GMOFILES="$GMOFILES $lang.gmo"
POFILES="$POFILES $lang.po"
done
dnl Make all variables we use known to autoconf.
AC_SUBST(USE_INCLUDED_LIBINTL)
AC_SUBST(CATALOGS)
AC_SUBST(CATOBJEXT)
AC_SUBST(DATADIRNAME)
AC_SUBST(GMOFILES)
AC_SUBST(INSTOBJEXT)
AC_SUBST(INTLDEPS)
AC_SUBST(INTLLIBS)
AC_SUBST(INTLOBJS)
AC_SUBST(POFILES)
AC_SUBST(POSUB)
])
AC_DEFUN(AM_GNU_GETTEXT,
[AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_RANLIB])dnl
AC_REQUIRE([AC_ISC_POSIX])dnl
AC_REQUIRE([AC_HEADER_STDC])dnl
AC_REQUIRE([AC_C_CONST])dnl
AC_REQUIRE([AC_C_INLINE])dnl
AC_REQUIRE([AC_TYPE_OFF_T])dnl
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
AC_REQUIRE([AC_FUNC_MMAP])dnl
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
unistd.h sys/param.h])
AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
strdup __argz_count __argz_stringify __argz_next])
if test "${ac_cv_func_stpcpy+set}" != "set"; then
AC_CHECK_FUNCS(stpcpy)
fi
if test "${ac_cv_func_stpcpy}" = "yes"; then
AC_DEFINE(HAVE_STPCPY)
fi
AM_LC_MESSAGES
AM_WITH_NLS
if test "x$CATOBJEXT" != "x"; then
if test "x$ALL_LINGUAS" = "x"; then
LINGUAS=
else
AC_MSG_CHECKING(for catalogs to be installed)
NEW_LINGUAS=
for lang in ${LINGUAS=$ALL_LINGUAS}; do
case "$ALL_LINGUAS" in
*$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
esac
done
LINGUAS=$NEW_LINGUAS
AC_MSG_RESULT($LINGUAS)
fi
dnl Construct list of names of catalog files to be constructed.
if test -n "$LINGUAS"; then
for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
fi
fi
dnl The reference to <locale.h> in the installed <libintl.h> file
dnl must be resolved because we cannot expect the users of this
dnl to define HAVE_LOCALE_H.
if test $ac_cv_header_locale_h = yes; then
INCLUDE_LOCALE_H="#include <locale.h>"
else
INCLUDE_LOCALE_H="\
/* The system does not provide the header <locale.h>. Take care yourself. */"
fi
AC_SUBST(INCLUDE_LOCALE_H)
dnl Determine which catalog format we have (if any is needed)
dnl For now we know about two different formats:
dnl Linux libc-5 and the normal X/Open format
test -d intl || mkdir intl
if test "$CATOBJEXT" = ".cat"; then
AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
dnl Transform the SED scripts while copying because some dumb SEDs
dnl cannot handle comments.
sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
fi
dnl po2tbl.sed is always needed.
sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
$srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
dnl In the intl/Makefile.in we have a special dependency which makes
dnl only sense for gettext. We comment this out for non-gettext
dnl packages.
if test "$PACKAGE" = "gettext"; then
GT_NO="#NO#"
GT_YES=
else
GT_NO=
GT_YES="#YES#"
fi
AC_SUBST(GT_NO)
AC_SUBST(GT_YES)
dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
dnl Try to locate is.
MKINSTALLDIRS=
if test -n "$ac_aux_dir"; then
MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
fi
if test -z "$MKINSTALLDIRS"; then
MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
fi
AC_SUBST(MKINSTALLDIRS)
dnl *** For now the libtool support in intl/Makefile is not for real.
l=
AC_SUBST(l)
dnl Generate list of files to be processed by xgettext which will
dnl be included in po/Makefile.
test -d po || mkdir po
if test "x$srcdir" != "x."; then
if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
posrcprefix="$srcdir/"
else
posrcprefix="../$srcdir/"
fi
else
posrcprefix="../"
fi
rm -f po/POTFILES
sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
< $srcdir/po/POTFILES.in > po/POTFILES
])
# Search path for a program which passes the given test.
# Ulrich Drepper <drepper@cygnus.com>, 1996.
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
# serial 1
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
[# Extract the first word of "$2", so it can be a program name with args.
set dummy $2; ac_word=[$]2
AC_MSG_CHECKING([for $ac_word])
AC_CACHE_VAL(ac_cv_path_$1,
[case "[$]$1" in
/*)
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
;;
*)
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in ifelse([$5], , $PATH, [$5]); do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
if [$3]; then
ac_cv_path_$1="$ac_dir/$ac_word"
break
fi
fi
done
IFS="$ac_save_ifs"
dnl If no 4th arg is given, leave the cache variable unset,
dnl so AC_PATH_PROGS will keep looking.
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
])dnl
;;
esac])dnl
$1="$ac_cv_path_$1"
if test -n "[$]$1"; then
AC_MSG_RESULT([$]$1)
else
AC_MSG_RESULT(no)
fi
AC_SUBST($1)dnl
])
# Check whether LC_MESSAGES is available in <locale.h>.
# Ulrich Drepper <drepper@cygnus.com>, 1995.
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
# serial 1
AC_DEFUN(AM_LC_MESSAGES,
[if test $ac_cv_header_locale_h = yes; then
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
if test $am_cv_val_LC_MESSAGES = yes; then
AC_DEFINE(HAVE_LC_MESSAGES)
fi
fi])

36
contrib/bison/alloc.h Normal file
View File

@ -0,0 +1,36 @@
/* Storage allocation interface 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 HAVE_CONFIG_H
#include "config.h"
#endif
#define NEW(t) ((t *) xmalloc((unsigned) sizeof(t)))
#define NEW2(n, t) ((t *) xmalloc((unsigned) ((n) * sizeof(t))))
#ifdef __STDC__
#define FREE(x) (x ? (void) free((char *) (x)) : (void)0)
#else
#define FREE(x) ((x) != 0 && (free ((char *) (x)), 0))
#endif
extern char *xmalloc PARAMS((register unsigned));
extern char *xrealloc PARAMS((register char *, register unsigned));

View File

@ -180,7 +180,7 @@ alloca (size)
#endif
/* Reclaim garbage, defined as all alloca'd storage that
was allocated from deeper in the stack than currently. */
was allocated from deeper in the stack than currently. */
{
register header *hp; /* Traverses linked list. */
@ -350,7 +350,7 @@ struct stk_trailer
#ifdef CRAY2
/* Determine a "stack measure" for an arbitrary ADDRESS.
I doubt that "lint" will like this much. */
I doubt that "lint" will like this much. */
static long
i00afunc (long *address)

View File

@ -15,20 +15,38 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
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
#if defined (__STDC__) || defined (_MSC_VER)
extern void *calloc ();
#else
extern char *calloc ();
#endif
#endif /* NEED_DECLARATION_CALLOC */
#ifdef NEED_DECLARATION_REALLOC
#if defined (__STDC__) || defined (_MSC_VER)
extern void *realloc ();
#else
extern char *realloc ();
extern void done ();
#endif
#endif /* NEED_DECLARATION_REALLOC */
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;
@ -38,7 +56,7 @@ xmalloc (n)
block = calloc (n, 1);
if (block == NULL)
{
fprintf (stderr, "%s: memory exhausted\n", program_name);
fprintf (stderr, _("%s: memory exhausted\n"), program_name);
done (1);
}
@ -46,9 +64,7 @@ xmalloc (n)
}
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)
@ -56,7 +72,7 @@ xrealloc (block, n)
block = realloc (block, n);
if (block == NULL)
{
fprintf (stderr, "%s: memory exhausted\n", program_name);
fprintf (stderr, _("%s: memory exhausted\n"), program_name);
done (1);
}

View File

@ -320,14 +320,21 @@ bison \-y $*
.ft R
.sp
.RE
.PP
The long-named options can be introduced with `+' as well as `\-\-',
for compatibility with previous releases. Eventually support for `+'
will be removed, because it is incompatible with the POSIX.2 standard.
.SH FILES
/usr/local/lib/bison.simple simple parser
.br
/usr/local/lib/bison.hairy complicated parser
.SH "ENVIRONMENT VARIABLES"
.TP
.SM BISON_SIMPLE
If this is set, it specifies the location in which the
.B bison.simple
parser can be found.
.TP
.SM BISON_HAIRY
If this is set, it specifies the location in which the
.B bison.hairy
parser can be found.
.SH SEE ALSO
.IR yacc (1)
.br

View File

@ -1,5 +1,6 @@
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "bison.simple"
/* This file comes from bison-@bison_version@. */
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@ -16,47 +17,67 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C. */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
#include <alloca.h>
#else /* not sparc */
#if defined (MSDOS) && !defined (__TURBOC__)
#include <malloc.h>
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>
#pragma alloca
#else /* not MSDOS, __TURBOC__, or _AIX */
#ifdef __hpux
#ifdef __cplusplus
extern "C" {
void *alloca (unsigned int);
};
#else /* not __cplusplus */
void *alloca ();
#endif /* not __cplusplus */
#endif /* __hpux */
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc. */
#endif /* not GNU C. */
#endif /* alloca not defined. */
/* This is the parser code that is written into each bison parser
when the %semantic_parser declaration is not specified in the grammar.
It was written by Richard Stallman by simplifying the hairy parser
used when %semantic_parser is specified. */
#ifndef YYSTACK_USE_ALLOCA
#ifdef alloca
#define YYSTACK_USE_ALLOCA
#else /* alloca not defined */
#ifdef __GNUC__
#define YYSTACK_USE_ALLOCA
#define alloca __builtin_alloca
#else /* not GNU C. */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
#define YYSTACK_USE_ALLOCA
#include <alloca.h>
#else /* not sparc */
/* We think this test detects Watcom and Microsoft C. */
/* This used to test MSDOS, but that is a bad idea
since that symbol is in the user namespace. */
#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
#if 0 /* No need for malloc.h, which pollutes the namespace;
instead, just don't use alloca. */
#include <malloc.h>
#endif
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
/* I don't know what this was needed for, but it pollutes the namespace.
So I turned it off. rms, 2 May 1997. */
/* #include <malloc.h> */
#pragma alloca
#define YYSTACK_USE_ALLOCA
#else /* not MSDOS, or __TURBOC__, or _AIX */
#if 0
#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
and on HPUX 10. Eventually we can turn this on. */
#define YYSTACK_USE_ALLOCA
#define alloca __builtin_alloca
#endif /* __hpux */
#endif
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc */
#endif /* not GNU C */
#endif /* alloca not defined */
#endif /* YYSTACK_USE_ALLOCA not defined */
#ifdef YYSTACK_USE_ALLOCA
#define YYSTACK_ALLOC alloca
#else
#define YYSTACK_ALLOC malloc
#endif
/* Note: there must be only one dollar sign in this file.
It is replaced by the list of actions, each action
as one case of the switch. */
@ -65,8 +86,8 @@ void *alloca ();
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY -2
#define YYEOF 0
#define YYACCEPT return(0)
#define YYABORT return(1)
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror.
This remains here temporarily to ease the
@ -147,12 +168,12 @@ int yydebug; /* nonzero means print parse trace */
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif
/* Prevent warning if -Wstrict-prototypes. */
#ifdef __GNUC__
int yyparse (void);
#endif
/* Define __yy_memcpy. Note that the size argument
should be passed with type unsigned int, because that is what the non-GCC
definitions require. With GCC, __builtin_memcpy takes an arg
of type size_t, but it can handle unsigned int. */
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
#else /* not GNU C or C++ */
@ -164,7 +185,7 @@ static void
__yy_memcpy (to, from, count)
char *to;
char *from;
int count;
unsigned int count;
{
register char *f = from;
register char *t = to;
@ -179,10 +200,10 @@ __yy_memcpy (to, from, count)
/* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */
static void
__yy_memcpy (char *to, char *from, int count)
__yy_memcpy (char *to, char *from, unsigned int count)
{
register char *f = from;
register char *t = to;
register char *f = from;
register int i = count;
while (i-- > 0)
@ -192,7 +213,7 @@ __yy_memcpy (char *to, char *from, int count)
#endif
#endif
#line 196 "bison.simple"
#line 217 "bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *.
@ -213,6 +234,15 @@ __yy_memcpy (char *to, char *from, int count)
#define YYPARSE_PARAM_DECL
#endif /* not YYPARSE_PARAM */
/* Prevent warning if -Wstrict-prototypes. */
#ifdef __GNUC__
#ifdef YYPARSE_PARAM
int yyparse (void *);
#else
int yyparse (void);
#endif
#endif
int
yyparse(YYPARSE_PARAM_ARG)
YYPARSE_PARAM_DECL
@ -241,6 +271,7 @@ yyparse(YYPARSE_PARAM_ARG)
#endif
int yystacksize = YYINITDEPTH;
int yyfree_stacks = 0;
#ifdef YYPURE
int yychar;
@ -325,18 +356,32 @@ yynewstate:
if (yystacksize >= YYMAXDEPTH)
{
yyerror("parser stack overflow");
if (yyfree_stacks)
{
free (yyss);
free (yyvs);
#ifdef YYLSP_NEEDED
free (yyls);
#endif
}
return 2;
}
yystacksize *= 2;
if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH;
yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
__yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
__yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
#ifndef YYSTACK_USE_ALLOCA
yyfree_stacks = 1;
#endif
yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
__yy_memcpy ((char *)yyss, (char *)yyss1,
size * (unsigned int) sizeof (*yyssp));
yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
__yy_memcpy ((char *)yyvs, (char *)yyvs1,
size * (unsigned int) sizeof (*yyvsp));
#ifdef YYLSP_NEEDED
yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
__yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
__yy_memcpy ((char *)yyls, (char *)yyls1,
size * (unsigned int) sizeof (*yylsp));
#endif
#endif /* no yyoverflow */
@ -494,7 +539,7 @@ yyreduce:
#endif
$ /* the action file gets copied in in place of this dollarsign */
#line 498 "bison.simple"
#line 543 "bison.simple"
yyvsp -= yylen;
yyssp -= yylen;
@ -689,4 +734,28 @@ yyerrhandle:
yystate = yyn;
goto yynewstate;
yyacceptlab:
/* YYACCEPT comes here. */
if (yyfree_stacks)
{
free (yyss);
free (yyvs);
#ifdef YYLSP_NEEDED
free (yyls);
#endif
}
return 0;
yyabortlab:
/* YYABORT comes here. */
if (yyfree_stacks)
{
free (yyss);
free (yyvs);
#ifdef YYLSP_NEEDED
free (yyls);
#endif
}
return 1;
}

View File

@ -1,7 +1,8 @@
\input texinfo @c -*-texinfo-*-
@comment %**start of header
@setfilename bison.info
@settitle Bison 1.25
@include version.texi
@settitle Bison @value{VERSION}
@setchapternewpage odd
@iftex
@ -13,8 +14,6 @@
@c the smallbook format.
@c @smallbook
@c next time, consider using @set for edition number, etc...
@c Set following if you have the new `shorttitlepage' command
@c @clear shorttitlepage-enabled
@c @set shorttitlepage-enabled
@ -36,10 +35,18 @@
@end ifinfo
@comment %**end of header
@ifinfo
@format
START-INFO-DIR-ENTRY
* bison: (bison). GNU Project parser generator (yacc replacement).
END-INFO-DIR-ENTRY
@end format
@end ifinfo
@ifinfo
This file documents the Bison parser generator.
Copyright (C) 1988, 89, 90, 91, 92, 93, 1995 Free Software Foundation, Inc.
Copyright (C) 1988, 89, 90, 91, 92, 93, 95, 98, 1999 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@ -73,13 +80,13 @@ instead of in the original English.
@titlepage
@title Bison
@subtitle The YACC-compatible Parser Generator
@subtitle November 1995, Bison Version 1.25
@subtitle @value{UPDATED}, Bison Version @value{VERSION}
@author by Charles Donnelly and Richard Stallman
@page
@vskip 0pt plus 1filll
Copyright @copyright{} 1988, 89, 90, 91, 92, 93, 1995 Free Software
Copyright @copyright{} 1988, 89, 90, 91, 92, 93, 95, 98, 1999 Free Software
Foundation
@sp 2
@ -121,7 +128,7 @@ Cover art by Etienne Suvasa.
@node Top, Introduction, (dir), (dir)
@ifinfo
This manual documents version 1.25 of Bison.
This manual documents version @value{VERSION} of Bison.
@end ifinfo
@menu
@ -310,7 +317,7 @@ Bison was written primarily by Robert Corbett; Richard Stallman made it
Yacc-compatible. Wilfred Hansen of Carnegie Mellon University added
multicharacter string literals and other features.
This edition corresponds to version 1.25 of Bison.
This edition corresponds to version @value{VERSION} of Bison.
@node Conditions, Copying, Introduction, Top
@unnumbered Conditions for Using Bison
@ -346,7 +353,7 @@ using the other GNU tools.
@display
Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -692,7 +699,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
@end smallexample
Also add information on how to contact you by electronic and paper mail.
@ -3098,24 +3106,32 @@ for example, a nonreentrant program may not be safe to call from a signal
handler. In systems with multiple threads of control, a nonreentrant
program must be called only within interlocks.
The Bison parser is not normally a reentrant program, because it uses
statically allocated variables for communication with @code{yylex}. These
variables include @code{yylval} and @code{yylloc}.
Normally, Bison generates a parser which is not reentrant. This is
suitable for most uses, and it permits compatibility with YACC. (The
standard YACC interfaces are inherently nonreentrant, because they use
statically allocated variables for communication with @code{yylex},
including @code{yylval} and @code{yylloc}.)
The Bison declaration @code{%pure_parser} says that you want the parser
to be reentrant. It looks like this:
Alternatively, you can generate a pure, reentrant parser. The Bison
declaration @code{%pure_parser} says that you want the parser to be
reentrant. It looks like this:
@example
%pure_parser
@end example
The effect is that the two communication variables become local
variables in @code{yyparse}, and a different calling convention is used
for the lexical analyzer function @code{yylex}. @xref{Pure Calling,
,Calling Conventions for Pure Parsers}, for the details of this. The
variable @code{yynerrs} also becomes local in @code{yyparse}
(@pxref{Error Reporting, ,The Error Reporting Function @code{yyerror}}).
The convention for calling @code{yyparse} itself is unchanged.
The result is that the communication variables @code{yylval} and
@code{yylloc} become local variables in @code{yyparse}, and a different
calling convention is used for the lexical analyzer function
@code{yylex}. @xref{Pure Calling, ,Calling Conventions for Pure
Parsers}, for the details of this. The variable @code{yynerrs} also
becomes local in @code{yyparse} (@pxref{Error Reporting, ,The Error
Reporting Function @code{yyerror}}). The convention for calling
@code{yyparse} itself is unchanged.
Whether the parser is pure has nothing to do with the grammar rules.
You can generate either a pure parser or a nonreentrant parser from any
valid grammar.
@node Decl Summary, , Pure Decl, Declarations
@subsection Bison Declaration Summary
@ -3383,7 +3399,8 @@ for (i = 0; i < YYNTOKENS; i++)
@{
if (yytname[i] != 0
&& yytname[i][0] == '"'
&& strncmp (yytname[i] + 1, token_buffer, strlen (token_buffer))
&& strncmp (yytname[i] + 1, token_buffer,
strlen (token_buffer))
&& yytname[i][strlen (token_buffer) + 1] == '"'
&& yytname[i][strlen (token_buffer) + 2] == 0)
break;
@ -3718,8 +3735,8 @@ struct @{
@};
@end example
Thus, to get the starting line number of the third component, use
@samp{@@3.first_line}.
Thus, to get the starting line number of the third component, you would
use @samp{@@3.first_line}.
In order for the members of this structure to contain valid information,
you must make @code{yylex} supply this information about each token.

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* subroutines of file LR0.c.
@ -51,17 +52,20 @@ Frees itemset, ruleset and internal data.
#include <stdio.h>
#include "system.h"
#include "machine.h"
#include "new.h"
#include "alloc.h"
#include "gram.h"
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;
@ -79,8 +83,7 @@ static int varsetsize;
void
initialize_closure(n)
int n;
initialize_closure (int n)
{
itemset = NEW2(n, short);
@ -98,7 +101,7 @@ int n;
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;
@ -158,7 +161,7 @@ set_fderives()
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 */
@ -198,9 +201,7 @@ set_firsts()
void
closure(core, n)
short *core;
int n;
closure (short *core, int n)
{
register int ruleno;
register unsigned word;
@ -282,7 +283,7 @@ int n;
void
finalize_closure()
finalize_closure (void)
{
FREE(itemset);
FREE(ruleset);
@ -304,18 +305,18 @@ int n;
}
print_firsts()
void
print_firsts (void)
{
register int i;
register int j;
register unsigned *rowp;
printf("\n\n\nFIRSTS\n\n");
printf(_("\n\n\nFIRSTS\n\n"));
for (i = ntokens; i < nsyms; i++)
{
printf("\n\n%s firsts\n\n", tags[i]);
printf(_("\n\n%s firsts\n\n"), tags[i]);
rowp = firsts + ((i - ntokens) * varsetsize);
@ -326,18 +327,18 @@ print_firsts()
}
print_fderives()
void
print_fderives (void)
{
register int i;
register int j;
register unsigned *rp;
printf("\n\n\nFDERIVES\n");
printf(_("\n\n\nFDERIVES\n"));
for (i = ntokens; i < nsyms; i++)
{
printf("\n\n%s derives\n\n", tags[i]);
printf(_("\n\n%s derives\n\n"), tags[i]);
rp = fderives + i * rulesetsize;
for (j = 0; j <= nrules; j++)

179
contrib/bison/config.hin Normal file
View File

@ -0,0 +1,179 @@
/* config.hin. Generated automatically from configure.in by autoheader. */
#ifndef CONFIG_H
#define CONFIG_H
/* Define if using alloca.c. */
#undef C_ALLOCA
/* Define to empty if the keyword does not work. */
#undef const
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
#undef CRAY_STACKSEG_END
/* Define if you have alloca, as a function or macro. */
#undef HAVE_ALLOCA
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define as __inline if that's what the C compiler calls it. */
#undef inline
/* Define if on MINIX. */
#undef _MINIX
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define if the system does not provide POSIX.1 features except
with this defined. */
#undef _POSIX_1_SOURCE
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#undef STACK_DIRECTION
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version string. */
#undef VERSION_STRING
/* Define to 1 if NLS is requested. */
#undef ENABLE_NLS
/* Define as 1 if you have catgets and don't want to use GNU gettext. */
#undef HAVE_CATGETS
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
#undef HAVE_GETTEXT
/* Define if your locale.h file contains LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
/* Define to 1 if you have the stpcpy function. */
#undef HAVE_STPCPY
/* The location of the simple parser (bison.simple). */
#undef XPFILE
/* The location of the semantic parser (bison.hairy). */
#undef XPFILE1
/* The location of the local directory. */
#undef LOCALEDIR
/* Define if you have the __argz_count function. */
#undef HAVE___ARGZ_COUNT
/* Define if you have the __argz_next function. */
#undef HAVE___ARGZ_NEXT
/* Define if you have the __argz_stringify function. */
#undef HAVE___ARGZ_STRINGIFY
/* Define if you have the dcgettext function. */
#undef HAVE_DCGETTEXT
/* Define if you have the getcwd function. */
#undef HAVE_GETCWD
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the mkstemp function. */
#undef HAVE_MKSTEMP
/* Define if you have the munmap function. */
#undef HAVE_MUNMAP
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the setenv function. */
#undef HAVE_SETENV
/* Define if you have the setlocale function. */
#undef HAVE_SETLOCALE
/* Define if you have the stpcpy function. */
#undef HAVE_STPCPY
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
/* Define if you have the strchr function. */
#undef HAVE_STRCHR
/* Define if you have the strdup function. */
#undef HAVE_STRDUP
/* Define if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
/* Define if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the <nl_types.h> header file. */
#undef HAVE_NL_TYPES_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the i library (-li). */
#undef HAVE_LIBI
/* Name of package */
#undef PACKAGE
/* Version number of package */
#undef VERSION
/* Define if compiler has function prototypes */
#undef PROTOTYPES
#if defined(PROTOTYPES) || defined(__cplusplus)
# define PARAMS(p) p
#else
# define PARAMS(p) ()
#endif
#endif /* CONFIG_H */

2957
contrib/bison/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,22 +1,50 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(reduce.c)
AC_INIT(src/reduce.c)
AM_INIT_AUTOMAKE(bison,1.28)
AM_CONFIG_HEADER(config.h:config.hin)
AC_PREREQ(2.13)
ALL_LINGUAS="de es fr nl"
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_MINIX
AC_ISC_POSIX
AM_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_RANLIB
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, structures, and compiler characteristics.
dnl Checks for typedefs.
dnl Checks for structures.
dnl Checks for compiler characteristics.
AC_C_CONST
AM_C_PROTOTYPES
dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(strerror)
AC_CHECK_FUNCS(mkstemp setlocale)
BISON_NEED_DECLARATIONS(calloc realloc)
AC_OUTPUT(Makefile)
AM_GNU_GETTEXT
# This is necessary so that .o files in LIBOBJS are also built via
# the ANSI2KNR-filtering rules.
LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`
AC_DEFINE_UNQUOTED(VERSION_STRING, "GNU Bison version ${VERSION}")
XPFILE="${datadir}/bison.simple"
BISON_DEFINE_FILE(XPFILE, XPFILE)
XPFILE1="${datadir}/bison.hairy"
BISON_DEFINE_FILE(XPFILE1, XPFILE1)
LOCALEDIR="${datadir}/locale"
BISON_DEFINE_FILE(LOCALEDIR, LOCALEDIR)
AC_OUTPUT(Makefile intl/Makefile po/Makefile.in src/Makefile doc/Makefile)

View File

@ -15,12 +15,13 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
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 "new.h"
#include "alloc.h"
#include "files.h"
#include "gram.h"
#include "state.h"
@ -35,14 +36,20 @@ extern unsigned *LA;
extern short *LAruleno;
extern short *lookaheads;
extern int verboseflag;
extern int fixed_outfiles;
void set_conflicts();
void resolve_sr_conflict();
void flush_shift();
void log_resolution();
void total_conflicts();
void count_sr_conflicts();
void count_rr_conflicts();
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;
@ -59,7 +66,7 @@ static int rrc_count;
void
initialize_conflicts()
initialize_conflicts (void)
{
register int i;
/* register errs *sp; JF unused */
@ -78,8 +85,7 @@ initialize_conflicts()
void
set_conflicts(state)
int state;
set_conflicts (int state)
{
register int i;
register int k;
@ -165,9 +171,7 @@ A conflict is resolved by modifying the shift or reduce tables
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;
@ -192,13 +196,13 @@ int lookaheadnum;
{
if (sprec[i] < redprec)
{
if (verboseflag) log_resolution(state, lookaheadnum, i, "reduce");
if (verboseflag) log_resolution(state, lookaheadnum, i, _("reduce"));
*fp2 &= ~mask; /* flush the shift for this token */
flush_shift(state, i);
}
else if (sprec[i] > redprec)
{
if (verboseflag) log_resolution(state, lookaheadnum, i, "shift");
if (verboseflag) log_resolution(state, lookaheadnum, i, _("shift"));
*fp1 &= ~mask; /* flush the reduce for this token */
}
else
@ -212,15 +216,15 @@ int lookaheadnum;
{
case RIGHT_ASSOC:
if (verboseflag) log_resolution(state, lookaheadnum, i, "shift");
if (verboseflag) log_resolution(state, lookaheadnum, i, _("shift"));
break;
case LEFT_ASSOC:
if (verboseflag) log_resolution(state, lookaheadnum, i, "reduce");
if (verboseflag) log_resolution(state, lookaheadnum, i, _("reduce"));
break;
case NON_ASSOC:
if (verboseflag) log_resolution(state, lookaheadnum, i, "an error");
if (verboseflag) log_resolution(state, lookaheadnum, i, _("an error"));
break;
}
@ -268,9 +272,7 @@ int lookaheadnum;
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;
@ -291,18 +293,16 @@ int token;
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",
_("Conflict in state %d between rule %d and token %s resolved as %s.\n"),
state, LAruleno[LAno], tags[token], resolution);
}
void
conflict_log()
conflict_log (void)
{
register int i;
@ -325,7 +325,7 @@ conflict_log()
void
verbose_conflict_log()
verbose_conflict_log (void)
{
register int i;
@ -341,20 +341,20 @@ verbose_conflict_log()
src_total += src_count;
rrc_total += rrc_count;
fprintf(foutput, "State %d contains", i);
fprintf(foutput, _("State %d contains"), i);
if (src_count == 1)
fprintf(foutput, " 1 shift/reduce conflict");
fprintf(foutput, _(" 1 shift/reduce conflict"));
else if (src_count > 1)
fprintf(foutput, " %d shift/reduce conflicts", src_count);
fprintf(foutput, _(" %d shift/reduce conflicts"), src_count);
if (src_count > 0 && rrc_count > 0)
fprintf(foutput, " and");
fprintf(foutput, _(" and"));
if (rrc_count == 1)
fprintf(foutput, " 1 reduce/reduce conflict");
fprintf(foutput, _(" 1 reduce/reduce conflict"));
else if (rrc_count > 1)
fprintf(foutput, " %d reduce/reduce conflicts", rrc_count);
fprintf(foutput, _(" %d reduce/reduce conflicts"), rrc_count);
putc('.', foutput);
putc('\n', foutput);
@ -366,10 +366,8 @@ verbose_conflict_log()
void
total_conflicts()
total_conflicts (void)
{
extern int fixed_outfiles;
if (src_total == expected_conflicts && rrc_total == 0)
return;
@ -377,31 +375,31 @@ total_conflicts()
{
/* If invoked under the name `yacc', use the output format
specified by POSIX. */
fprintf(stderr, "conflicts: ");
fprintf(stderr, _("conflicts: "));
if (src_total > 0)
fprintf(stderr, " %d shift/reduce", src_total);
fprintf(stderr, _(" %d shift/reduce"), src_total);
if (src_total > 0 && rrc_total > 0)
fprintf(stderr, ",");
if (rrc_total > 0)
fprintf(stderr, " %d reduce/reduce", rrc_total);
fprintf(stderr, _(" %d reduce/reduce"), rrc_total);
putc('\n', stderr);
}
else
{
fprintf(stderr, "%s contains", infile);
fprintf(stderr, _("%s contains"), infile);
if (src_total == 1)
fprintf(stderr, " 1 shift/reduce conflict");
fprintf(stderr, _(" 1 shift/reduce conflict"));
else if (src_total > 1)
fprintf(stderr, " %d shift/reduce conflicts", src_total);
fprintf(stderr, _(" %d shift/reduce conflicts"), src_total);
if (src_total > 0 && rrc_total > 0)
fprintf(stderr, " and");
fprintf(stderr, _(" and"));
if (rrc_total == 1)
fprintf(stderr, " 1 reduce/reduce conflict");
fprintf(stderr, _(" 1 reduce/reduce conflict"));
else if (rrc_total > 1)
fprintf(stderr, " %d reduce/reduce conflicts", rrc_total);
fprintf(stderr, _(" %d reduce/reduce conflicts"), rrc_total);
putc('.', stderr);
putc('\n', stderr);
@ -410,8 +408,7 @@ total_conflicts()
void
count_sr_conflicts(state)
int state;
count_sr_conflicts (int state)
{
register int i;
register int k;
@ -478,8 +475,7 @@ int state;
void
count_rr_conflicts(state)
int state;
count_rr_conflicts (int state)
{
register int i;
register int j;
@ -525,8 +521,7 @@ int state;
void
print_reductions(state)
int state;
print_reductions (int state)
{
register int i;
register int j;
@ -541,7 +536,7 @@ int state;
register int m;
register int n;
register int default_LA;
register int default_rule;
register int default_rule = 0;
register int cmax;
register int count;
register shifts *shiftp;
@ -600,7 +595,7 @@ int state;
for (i = 0; i < ntokens; i++)
{
if (mask & *fp3)
fprintf(foutput, " %-4s\t[reduce using rule %d (%s)]\n",
fprintf(foutput, _(" %-4s\t[reduce using rule %d (%s)]\n"),
tags[i], default_rule, tags[rlhs[default_rule]]);
mask <<= 1;
@ -611,7 +606,7 @@ int state;
}
}
fprintf(foutput, " $default\treduce using rule %d (%s)\n\n",
fprintf(foutput, _(" $default\treduce using rule %d (%s)\n\n"),
default_rule, tags[rlhs[default_rule]]);
}
else if (n - m >= 1)
@ -697,7 +692,7 @@ int state;
if (j != default_LA)
{
rule = LAruleno[j];
fprintf(foutput, " %-4s\treduce using rule %d (%s)\n",
fprintf(foutput, _(" %-4s\treduce using rule %d (%s)\n"),
tags[i], rule, tags[rlhs[rule]]);
}
else defaulted = 1;
@ -709,12 +704,12 @@ int state;
if (defaulted)
{
rule = LAruleno[default_LA];
fprintf(foutput, " %-4s\treduce using rule %d (%s)\n",
fprintf(foutput, _(" %-4s\treduce using rule %d (%s)\n"),
tags[i], rule, tags[rlhs[rule]]);
defaulted = 0;
}
rule = LAruleno[j];
fprintf(foutput, " %-4s\t[reduce using rule %d (%s)]\n",
fprintf(foutput, _(" %-4s\t[reduce using rule %d (%s)]\n"),
tags[i], rule, tags[rlhs[rule]]);
}
}
@ -735,7 +730,7 @@ int state;
if (default_LA >= 0)
{
fprintf(foutput, " $default\treduce using rule %d (%s)\n",
fprintf(foutput, _(" $default\treduce using rule %d (%s)\n"),
default_rule, tags[rlhs[default_rule]]);
}
@ -745,7 +740,7 @@ int state;
void
finalize_conflicts()
finalize_conflicts (void)
{
FREE(conflicts);
FREE(shiftset);

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* set_derives finds, for each variable (nonterminal), which rules can derive it.
@ -25,15 +26,17 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
#include "system.h"
#include "new.h"
#include "alloc.h"
#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;
@ -82,7 +85,7 @@ set_derives()
}
void
free_derives()
free_derives (void)
{
FREE(derives[ntokens]);
FREE(derives + ntokens);
@ -92,18 +95,19 @@ free_derives()
#ifdef DEBUG
print_derives()
void
print_derives (void)
{
register int i;
register short *sp;
extern char **tags;
printf("\n\n\nDERIVES\n\n");
printf(_("\n\n\nDERIVES\n\n"));
for (i = ntokens; i < nsyms; i++)
{
printf("%s derives", tags[i]);
printf(_("%s derives"), tags[i]);
for (sp = derives[i]; *sp > 0; sp++)
{
printf(" %d", *sp);
@ -115,4 +119,3 @@ print_derives()
}
#endif

View File

@ -15,9 +15,12 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
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
@ -29,10 +32,23 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#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>
#include "system.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "files.h"
#include "new.h"
#include "alloc.h"
#include "gram.h"
FILE *finput = NULL;
@ -63,8 +79,13 @@ extern int noparserflag;
extern char *mktemp(); /* So the compiler won't complain */
extern char *getenv();
extern void perror();
FILE *tryopen(); /* This might be a good idea */
void done();
char *stringappend PARAMS((char *, int, char *));
void openfiles PARAMS((void));
void open_extra_files PARAMS((void));
FILE *tryopen PARAMS((char *, char *)); /* This might be a good idea */
int tryclose PARAMS((FILE *));
void done PARAMS((int));
extern char *program_name;
extern int verboseflag;
@ -72,11 +93,8 @@ extern int definesflag;
int fixed_outfiles = 0;
char*
stringappend(string1, end1, string2)
char *string1;
int end1;
char *string2;
char *
stringappend (char *string1, int end1, char *string2)
{
register char *ostring;
register char *cp, *cp1;
@ -93,7 +111,8 @@ char *string2;
*cp++ = *cp1++;
cp1 = string2;
while (*cp++ = *cp1++) ;
while ((*cp++ = *cp1++))
;
return ostring;
}
@ -102,10 +121,12 @@ char *string2;
/* JF this has been hacked to death. Nowaday it sets up the file names for
the output files, and opens the tmp files and the parser */
void
openfiles()
openfiles (void)
{
char *name_base;
#ifdef MSDOS
register char *cp;
#endif
char *filename;
int base_length;
int short_base_length;
@ -124,6 +145,24 @@ openfiles()
strlwr (infile);
#endif /* MSDOS */
#if (defined(_WIN32) && !defined(__CYGWIN32__))
tmp_base = getenv ("TEMP"); /* Windows95 defines this ... */
if (tmp_base == 0)
tmp_base = getenv ("Temp"); /* ... while NT prefers this */
if (tmp_base == 0)
tmp_base = "";
strlwr (infile);
#endif /* _WIN32 && !__CYGWIN32__ */
#if (defined(unix) || defined(__unix) || defined(__unix__))
{
char *tmp_ptr = getenv("TMPDIR");
if (tmp_ptr != 0)
tmp_base = stringappend (tmp_ptr, strlen (tmp_ptr), "/b.");
}
#endif /* unix || __unix || __unix__ */
tmp_len = strlen (tmp_base);
if (spec_outfile)
@ -254,13 +293,13 @@ openfiles()
fdefines = tryopen(tmpdefsfile, "w+");
}
#ifndef MSDOS
#if !(defined (MSDOS) || (defined(_WIN32) && !defined(__CYGWIN32__)))
if (! noparserflag)
unlink(actfile);
unlink(tmpattrsfile);
unlink(tmptabfile);
unlink(tmpdefsfile);
#endif
#endif /* MSDOS || (_WIN32 && !__CYGWIN32__) */
/* These are opened by `done' or `open_extra_files', if at all */
if (spec_outfile)
@ -288,14 +327,16 @@ openfiles()
This is done when %semantic_parser is seen in the declarations section. */
void
open_extra_files()
open_extra_files (void)
{
FILE *ftmp;
int c;
char *filename, *cp;
char *filename;
#ifdef MSDOS
char *cp;
#endif
if (fparser)
fclose(fparser);
tryclose(fparser);
if (! noparserflag)
{
@ -320,7 +361,7 @@ open_extra_files()
rewind(fattrs);
while((c=getc(fattrs))!=EOF) /* Thank god for buffering */
putc(c,ftmp);
fclose(fattrs);
tryclose(fattrs);
fattrs=ftmp;
fguard = tryopen(guardfile, "w");
@ -330,9 +371,7 @@ open_extra_files()
/* JF to make file opening easier. This func tries to open file
NAME with mode MODE, and prints an error message if it fails. */
FILE *
tryopen(name, mode)
char *name;
char *mode;
tryopen (char *name, char *mode)
{
FILE *ptr;
@ -346,27 +385,33 @@ char *mode;
return ptr;
}
void
done(k)
int k;
int
tryclose (FILE *ptr)
{
if (faction)
fclose(faction);
int result;
if (fattrs)
fclose(fattrs);
if (ptr == NULL)
return 0;
if (fguard)
fclose(fguard);
result = fclose (ptr);
if (result == EOF)
{
fprintf (stderr, "%s: ", program_name);
perror ("fclose");
done (2);
}
return result;
}
if (finput)
fclose(finput);
if (fparser)
fclose(fparser);
if (foutput)
fclose(foutput);
void
done (int k)
{
tryclose(faction);
tryclose(fattrs);
tryclose(fguard);
tryclose(finput);
tryclose(fparser);
tryclose(foutput);
/* JF write out the output file */
if (k == 0 && ftable)
@ -378,8 +423,8 @@ int k;
rewind(ftable);
while((c=getc(ftable)) != EOF)
putc(c,ftmp);
fclose(ftmp);
fclose(ftable);
tryclose(ftmp);
tryclose(ftable);
if (definesflag)
{
@ -388,8 +433,8 @@ int k;
rewind(fdefines);
while((c=getc(fdefines)) != EOF)
putc(c,ftmp);
fclose(ftmp);
fclose(fdefines);
tryclose(ftmp);
tryclose(fdefines);
}
}
@ -403,12 +448,12 @@ int k;
if (k==0) sys$exit(SS$_NORMAL);
sys$exit(SS$_ABORT);
#else
#ifdef MSDOS
#if (defined (MSDOS) || (defined(_WIN32) && !defined(__CYGWIN32__)))
if (actfile && ! noparserflag) unlink(actfile);
if (tmpattrsfile) unlink(tmpattrsfile);
if (tmptabfile) unlink(tmptabfile);
if (tmpdefsfile) unlink(tmpdefsfile);
#endif /* MSDOS */
#endif /* MSDOS || (_WIN32 && !__CYGWIN32__) */
exit(k);
#endif /* not VMS, or __VMS_POSIX */
}

View File

@ -15,12 +15,13 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* These two should be pathnames for opening the sample parser files.
When bison is installed, they should be absolute pathnames.
XPFILE1 and XPFILE2 normally come from the Makefile. */
XPFILE1 and XPFILE2 normally come from config.h. */
#define PFILE XPFILE /* Simple parser */
#define PFILE1 XPFILE1 /* Semantic parser */

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <stdio.h>
@ -34,10 +35,12 @@ char *spec_name_prefix; /* for -p. */
char *spec_file_prefix; /* for -b. */
extern int fixed_outfiles;/* for -y */
extern char *program_name;
extern char *version_string;
void usage PARAMS((FILE *));
void getargs PARAMS((int, char *[]));
extern void warns(); /* main.c */
extern char *program_name;
extern void warns PARAMS((char *, char *)); /* main.c */
struct option longopts[] =
{
@ -60,23 +63,21 @@ struct option longopts[] =
};
void
usage (stream)
FILE *stream;
usage (FILE *stream)
{
fprintf (stream, "\
fprintf (stream, _("\
Usage: %s [-dhklntvyV] [-b file-prefix] [-o outfile] [-p name-prefix]\n\
[--debug] [--defines] [--fixed-output-files] [--no-lines]\n\
[--verbose] [--version] [--help] [--yacc]\n\
[--no-parser] [--token-table]\n\
[--file-prefix=prefix] [--name-prefix=prefix]\n\
[--output=outfile] grammar-file\n",
[--output=outfile] grammar-file\n\n\
Report bugs to bug-bison@gnu.org\n"),
program_name);
}
void
getargs(argc, argv)
int argc;
char *argv[];
getargs (int argc, char *argv[])
{
register int c;
@ -106,7 +107,7 @@ getargs(argc, argv)
exit (0);
case 'V':
printf ("%s", version_string);
printf ("%s\n", VERSION_STRING);
exit (0);
case 'v':
@ -157,11 +158,11 @@ getargs(argc, argv)
if (optind == argc)
{
fprintf(stderr, "%s: no grammar file given\n", program_name);
fprintf(stderr, _("%s: no grammar file given\n"), program_name);
exit(1);
}
if (optind < argc - 1)
fprintf(stderr, "%s: extra arguments ignored after '%s'\n",
fprintf(stderr, _("%s: extra arguments ignored after '%s'\n"),
program_name, argv[optind]);
infile = argv[optind];

View File

@ -1,11 +1,14 @@
/* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 1996
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98
Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.
This program 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
@ -24,19 +27,19 @@
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
Ditto for AIX 3.2 and <stdlib.h>. */
#ifndef _NO_PROTO
#define _NO_PROTO
# define _NO_PROTO
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
# include <config.h>
#endif
#if !defined (__STDC__) || !__STDC__
#if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
#ifndef const
#define const
#endif
# ifndef const
# define const
# endif
#endif
#include <stdio.h>
@ -49,7 +52,15 @@
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
#define GETOPT_INTERFACE_VERSION 2
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
# include <gnu-versions.h>
# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
# define ELIDE_CODE
# endif
#endif
#ifndef ELIDE_CODE
/* This needs to come after some library #include
@ -57,19 +68,26 @@
#ifdef __GNU_LIBRARY__
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
#include <stdlib.h>
#include <unistd.h>
# include <stdlib.h>
# include <unistd.h>
#endif /* GNU C library. */
#ifdef VMS
# include <unixlib.h>
# if HAVE_STRING_H - 0
# include <string.h>
# endif
#endif
#ifndef _
/* This is for other GNU distributions with internationalized messages.
When compiling libc, the _ macro is predefined. */
#ifdef HAVE_LIBINTL_H
# include <libintl.h>
# define _(msgid) gettext (msgid)
#else
# define _(msgid) (msgid)
#endif
# ifdef HAVE_LIBINTL_H
# include <libintl.h>
# define _(msgid) gettext (msgid)
# else
# define _(msgid) (msgid)
# endif
#endif
/* This version of `getopt' appears to the caller like standard Unix `getopt'
@ -102,14 +120,20 @@ char *optarg = NULL;
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns EOF, this is the index of the first of the
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
/* XXX 1003.2 says this must be 1 before any call. */
int optind = 0;
/* 1003.2 says this must be 1 before any call. */
int optind = 1;
/* Formerly, initialization of getopt depended on optind==0, which
causes problems with re-calling getopt as programs generally don't
know that. */
int __getopt_initialized = 0;
/* The next char to be scanned in the option-element
in which the last option character we returned was found.
@ -158,7 +182,7 @@ int optopt = '?';
The special argument `--' forces an end of option-scanning regardless
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
`--' can cause `getopt' to return EOF with `optind' != ARGC. */
`--' can cause `getopt' to return -1 with `optind' != ARGC. */
static enum
{
@ -173,14 +197,22 @@ static char *posixly_correct;
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
in GCC. */
#include <string.h>
#define my_index strchr
# include <string.h>
# define my_index strchr
#else
# if HAVE_STRING_H
# include <string.h>
# else
# include <strings.h>
# endif
/* Avoid depending on library functions or files
whose names are inconsistent. */
char *getenv ();
#ifndef getenv
extern char *getenv ();
#endif
static char *
my_index (str, chr)
@ -201,11 +233,11 @@ my_index (str, chr)
#ifdef __GNUC__
/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
That was relevant to code that was here before. */
#if !defined (__STDC__) || !__STDC__
# if (!defined __STDC__ || !__STDC__) && !defined strlen
/* gcc with -traditional declares the built-in strlen to return int,
and has done so at least since version 2.4.5. -- rms. */
extern int strlen (const char *);
#endif /* not __STDC__ */
# endif /* not __STDC__ */
#endif /* __GNUC__ */
#endif /* not __GNU_LIBRARY__ */
@ -219,12 +251,46 @@ extern int strlen (const char *);
static int first_nonopt;
static int last_nonopt;
#ifdef _LIBC
/* Bash 2.0 gives us an environment variable containing flags
indicating ARGV elements that should not be considered arguments. */
static const char *nonoption_flags;
/* Defined in getopt_init.c */
extern char *__getopt_nonoption_flags;
static int nonoption_flags_max_len;
static int nonoption_flags_len;
static int original_argc;
static char *const *original_argv;
/* Make sure the environment variable bash 2.0 puts in the environment
is valid for the getopt call we must make sure that the ARGV passed
to getopt is that one passed to the process. */
static void
__attribute__ ((unused))
store_args_and_env (int argc, char *const *argv)
{
/* XXX This is no good solution. We should rather copy the args so
that we can compare them later. But we must not use malloc(3). */
original_argc = argc;
original_argv = argv;
}
# ifdef text_set_element
text_set_element (__libc_subinit, store_args_and_env);
# endif /* text_set_element */
# define SWAP_FLAGS(ch1, ch2) \
if (nonoption_flags_len > 0) \
{ \
char __tmp = __getopt_nonoption_flags[ch1]; \
__getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
__getopt_nonoption_flags[ch2] = __tmp; \
}
#else /* !_LIBC */
# define SWAP_FLAGS(ch1, ch2)
#endif /* _LIBC */
/* Exchange two adjacent subsequences of ARGV.
One subsequence is elements [first_nonopt,last_nonopt)
which contains all the non-options that have been skipped so far.
@ -234,7 +300,7 @@ static int nonoption_flags_len;
`first_nonopt' and `last_nonopt' are relocated so that they describe
the new indices of the non-options in ARGV after they are moved. */
#if defined (__STDC__) && __STDC__
#if defined __STDC__ && __STDC__
static void exchange (char **);
#endif
@ -252,6 +318,28 @@ exchange (argv)
It leaves the longer segment in the right place overall,
but it consists of two parts that need to be swapped next. */
#ifdef _LIBC
/* First make sure the handling of the `__getopt_nonoption_flags'
string can work normally. Our top argument must be in the range
of the string. */
if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
{
/* We must extend the array. The user plays games with us and
presents new arguments. */
char *new_str = malloc (top + 1);
if (new_str == NULL)
nonoption_flags_len = nonoption_flags_max_len = 0;
else
{
memset (__mempcpy (new_str, __getopt_nonoption_flags,
nonoption_flags_max_len),
'\0', top + 1 - nonoption_flags_max_len);
nonoption_flags_max_len = top + 1;
__getopt_nonoption_flags = new_str;
}
}
#endif
while (top > middle && middle > bottom)
{
if (top - middle > middle - bottom)
@ -266,6 +354,7 @@ exchange (argv)
tem = argv[bottom + i];
argv[bottom + i] = argv[top - (middle - bottom) + i];
argv[top - (middle - bottom) + i] = tem;
SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
}
/* Exclude the moved bottom segment from further swapping. */
top -= len;
@ -282,6 +371,7 @@ exchange (argv)
tem = argv[bottom + i];
argv[bottom + i] = argv[middle + i];
argv[middle + i] = tem;
SWAP_FLAGS (bottom + i, middle + i);
}
/* Exclude the moved top segment from further swapping. */
bottom += len;
@ -296,18 +386,20 @@ exchange (argv)
/* Initialize the internal data when the first call is made. */
#if defined (__STDC__) && __STDC__
static const char *_getopt_initialize (const char *);
#if defined __STDC__ && __STDC__
static const char *_getopt_initialize (int, char *const *, const char *);
#endif
static const char *
_getopt_initialize (optstring)
_getopt_initialize (argc, argv, optstring)
int argc;
char *const *argv;
const char *optstring;
{
/* Start processing options with ARGV-element 1 (since ARGV-element 0
is the program name); the sequence of previously skipped
non-option ARGV-elements is empty. */
first_nonopt = last_nonopt = optind = 1;
first_nonopt = last_nonopt = optind;
nextchar = NULL;
@ -330,20 +422,35 @@ _getopt_initialize (optstring)
else
ordering = PERMUTE;
if (posixly_correct == NULL)
#ifdef _LIBC
if (posixly_correct == NULL
&& argc == original_argc && argv == original_argv)
{
/* Bash 2.0 puts a special variable in the environment for each
command it runs, specifying which ARGV elements are the results of
file name wildcard expansion and therefore should not be
considered as options. */
char var[100];
sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ());
nonoption_flags = getenv (var);
if (nonoption_flags == NULL)
nonoption_flags_len = 0;
else
nonoption_flags_len = strlen (nonoption_flags);
if (nonoption_flags_max_len == 0)
{
if (__getopt_nonoption_flags == NULL
|| __getopt_nonoption_flags[0] == '\0')
nonoption_flags_max_len = -1;
else
{
const char *orig_str = __getopt_nonoption_flags;
int len = nonoption_flags_max_len = strlen (orig_str);
if (nonoption_flags_max_len < argc)
nonoption_flags_max_len = argc;
__getopt_nonoption_flags =
(char *) malloc (nonoption_flags_max_len);
if (__getopt_nonoption_flags == NULL)
nonoption_flags_max_len = -1;
else
memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
'\0', nonoption_flags_max_len - len);
}
}
nonoption_flags_len = nonoption_flags_max_len;
}
else
nonoption_flags_len = 0;
#endif
return optstring;
}
@ -361,7 +468,7 @@ _getopt_initialize (optstring)
updating `optind' and `nextchar' so that the next call to `getopt' can
resume the scan with the following option character or ARGV-element.
If there are no more option characters, `getopt' returns `EOF'.
If there are no more option characters, `getopt' returns -1.
Then `optind' is the index in ARGV of the first ARGV-element
that is not an option. (The ARGV-elements have been permuted
so that those that are not options now come last.)
@ -415,18 +522,25 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
{
optarg = NULL;
if (optind == 0)
if (optind == 0 || !__getopt_initialized)
{
optstring = _getopt_initialize (optstring);
optind = 1; /* Don't scan ARGV[0], the program name. */
if (optind == 0)
optind = 1; /* Don't scan ARGV[0], the program name. */
optstring = _getopt_initialize (argc, argv, optstring);
__getopt_initialized = 1;
}
/* Test whether ARGV[optind] points to a non-option argument.
Either it does not have option syntax, or there is an environment flag
from the shell indicating it is not an option. */
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
|| (optind < nonoption_flags_len \
&& nonoption_flags[optind] == '1'))
from the shell indicating it is not an option. The later information
is only used when the used in the GNU libc. */
#ifdef _LIBC
# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
|| (optind < nonoption_flags_len \
&& __getopt_nonoption_flags[optind] == '1'))
#else
# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
#endif
if (nextchar == NULL || *nextchar == '\0')
{
@ -484,7 +598,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
that we previously skipped, so the caller will digest them. */
if (first_nonopt != last_nonopt)
optind = first_nonopt;
return EOF;
return -1;
}
/* If we have come to a non-option and did not permute it,
@ -493,7 +607,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
if (NONOPTION_P)
{
if (ordering == REQUIRE_ORDER)
return EOF;
return -1;
optarg = argv[optind++];
return 1;
}
@ -529,7 +643,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
const struct option *pfound = NULL;
int exact = 0;
int ambig = 0;
int indfound;
int indfound = -1;
int option_index;
for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
@ -540,7 +654,8 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
for (p = longopts, option_index = 0; p->name; p++, option_index++)
if (!strncmp (p->name, nextchar, nameend - nextchar))
{
if (nameend - nextchar == strlen (p->name))
if ((unsigned int) (nameend - nextchar)
== (unsigned int) strlen (p->name))
{
/* Exact match found. */
pfound = p;
@ -676,6 +791,130 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
optopt = c;
return '?';
}
/* Convenience. Treat POSIX -W foo same as long option --foo */
if (temp[0] == 'W' && temp[1] == ';')
{
char *nameend;
const struct option *p;
const struct option *pfound = NULL;
int exact = 0;
int ambig = 0;
int indfound = 0;
int option_index;
/* This is an option that requires an argument. */
if (*nextchar != '\0')
{
optarg = nextchar;
/* If we end this ARGV-element by taking the rest as an arg,
we must advance to the next element now. */
optind++;
}
else if (optind == argc)
{
if (opterr)
{
/* 1003.2 specifies the format of this message. */
fprintf (stderr, _("%s: option requires an argument -- %c\n"),
argv[0], c);
}
optopt = c;
if (optstring[0] == ':')
c = ':';
else
c = '?';
return c;
}
else
/* We already incremented `optind' once;
increment it again when taking next ARGV-elt as argument. */
optarg = argv[optind++];
/* optarg is now the argument, see if it's in the
table of longopts. */
for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
/* Do nothing. */ ;
/* Test all long options for either exact match
or abbreviated matches. */
for (p = longopts, option_index = 0; p->name; p++, option_index++)
if (!strncmp (p->name, nextchar, nameend - nextchar))
{
if ((unsigned int) (nameend - nextchar) == strlen (p->name))
{
/* Exact match found. */
pfound = p;
indfound = option_index;
exact = 1;
break;
}
else if (pfound == NULL)
{
/* First nonexact match found. */
pfound = p;
indfound = option_index;
}
else
/* Second or later nonexact match found. */
ambig = 1;
}
if (ambig && !exact)
{
if (opterr)
fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
argv[0], argv[optind]);
nextchar += strlen (nextchar);
optind++;
return '?';
}
if (pfound != NULL)
{
option_index = indfound;
if (*nameend)
{
/* Don't test has_arg with >, because some C compilers don't
allow it to be used on enums. */
if (pfound->has_arg)
optarg = nameend + 1;
else
{
if (opterr)
fprintf (stderr, _("\
%s: option `-W %s' doesn't allow an argument\n"),
argv[0], pfound->name);
nextchar += strlen (nextchar);
return '?';
}
}
else if (pfound->has_arg == 1)
{
if (optind < argc)
optarg = argv[optind++];
else
{
if (opterr)
fprintf (stderr,
_("%s: option `%s' requires an argument\n"),
argv[0], argv[optind - 1]);
nextchar += strlen (nextchar);
return optstring[0] == ':' ? ':' : '?';
}
}
nextchar += strlen (nextchar);
if (longind != NULL)
*longind = option_index;
if (pfound->flag)
{
*(pfound->flag) = pfound->val;
return 0;
}
return pfound->val;
}
nextchar = NULL;
return 'W'; /* Let the application handle it. */
}
if (temp[1] == ':')
{
if (temp[2] == ':')
@ -738,7 +977,7 @@ getopt (argc, argv, optstring)
0);
}
#endif /* _LIBC or not __GNU_LIBRARY__. */
#endif /* Not ELIDE_CODE. */
#ifdef TEST
@ -758,7 +997,7 @@ main (argc, argv)
int this_option_optind = optind ? optind : 1;
c = getopt (argc, argv, "abc:d:0123456789");
if (c == EOF)
if (c == -1)
break;
switch (c)

View File

@ -1,5 +1,8 @@
/* Declarations for getopt.
Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@ -37,7 +40,7 @@ extern char *optarg;
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns EOF, this is the index of the first of the
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
@ -127,4 +130,4 @@ extern int _getopt_internal ();
}
#endif
#endif /* _GETOPT_H */
#endif /* getopt.h */

View File

@ -1,6 +1,9 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994
Free Software Foundation, Inc.
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@ -23,7 +26,7 @@
#include "getopt.h"
#if !defined (__STDC__) || !__STDC__
#if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
#ifndef const
@ -41,15 +44,21 @@
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
#define GETOPT_INTERFACE_VERSION 2
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
#include <gnu-versions.h>
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#define ELIDE_CODE
#endif
#endif
#ifndef ELIDE_CODE
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
#include <stdlib.h>
#else
char *getenv ();
#endif
#ifndef NULL
@ -84,7 +93,7 @@ getopt_long_only (argc, argv, options, long_options, opt_index)
}
#endif /* _LIBC or not __GNU_LIBRARY__. */
#endif /* Not ELIDE_CODE. */
#ifdef TEST
@ -115,7 +124,7 @@ main (argc, argv)
c = getopt_long (argc, argv, "abc:d:0123456789",
long_options, &option_index);
if (c == EOF)
if (c == -1)
break;
switch (c)

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* comments for these variables are in gram.h */
@ -53,6 +54,6 @@ int error_token_number;
when the file in question contains data definitions only. */
void
dummy()
dummy (void)
{
}

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* representation of the grammar rules:

View File

@ -1,15 +1,27 @@
#! /bin/sh
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5.
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
@ -106,6 +118,7 @@ if [ x"$dir_arg" != x ]; then
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Compute how to make the finite state machine deterministic;
@ -52,7 +53,7 @@ If LA[l, i] and LA[l, j] are both 1 for i != j, it is a conflict.
#include "machine.h"
#include "types.h"
#include "state.h"
#include "new.h"
#include "alloc.h"
#include "gram.h"
@ -73,24 +74,26 @@ short *goto_map;
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();
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();
extern void berror();
extern void toomany PARAMS((char *));
extern void berror PARAMS((char *));
static int infinity;
static int maxrhs;
@ -105,7 +108,7 @@ static int top;
void
lalr()
lalr (void)
{
tokensetsize = WORDSIZE(ntokens);
@ -124,7 +127,7 @@ lalr()
void
set_state_table()
set_state_table (void)
{
register core *sp;
@ -136,7 +139,7 @@ set_state_table()
void
set_accessing_symbol()
set_accessing_symbol (void)
{
register core *sp;
@ -148,7 +151,7 @@ set_accessing_symbol()
void
set_shift_table()
set_shift_table (void)
{
register shifts *sp;
@ -160,7 +163,7 @@ set_shift_table()
void
set_reduction_table()
set_reduction_table (void)
{
register reductions *rp;
@ -172,7 +175,7 @@ set_reduction_table()
void
set_maxrhs()
set_maxrhs (void)
{
register short *itemp;
register int length;
@ -198,7 +201,7 @@ set_maxrhs()
void
initialize_LA()
initialize_LA (void)
{
register int i;
register int j;
@ -256,7 +259,7 @@ initialize_LA()
{
if (!consistent[i])
{
if (rp = reduction_table[i])
if ((rp = reduction_table[i]))
for (j = 0; j < rp->nreds; j++)
*np++ = rp->rules[j];
}
@ -265,7 +268,7 @@ initialize_LA()
void
set_goto_map()
set_goto_map (void)
{
register shifts *sp;
register int i;
@ -288,7 +291,7 @@ set_goto_map()
if (ISTOKEN(symbol)) break;
if (ngotos == MAXSHORT)
toomany("gotos");
toomany(_("gotos"));
ngotos++;
goto_map[symbol]++;
@ -335,9 +338,7 @@ set_goto_map()
/* 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;
@ -366,7 +367,7 @@ int symbol;
void
initialize_F()
initialize_F (void)
{
register int i;
register int j;
@ -442,7 +443,7 @@ initialize_F()
void
build_relations()
build_relations (void)
{
register int i;
register int j;
@ -537,10 +538,7 @@ build_relations()
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;
@ -570,9 +568,7 @@ int gotono;
short **
transpose(R_arg, n)
short **R_arg;
int n;
transpose (short **R_arg, int n)
{
register short **new_R;
register short **temp_R;
@ -627,7 +623,7 @@ int n;
void
compute_FOLLOWS()
compute_FOLLOWS (void)
{
register int i;
@ -643,7 +639,7 @@ compute_FOLLOWS()
void
compute_lookaheads()
compute_lookaheads (void)
{
register int i;
register int n;
@ -686,8 +682,7 @@ compute_lookaheads()
void
digraph(relation)
short **relation;
digraph (short **relation)
{
register int i;
@ -713,8 +708,7 @@ short **relation;
void
traverse(i)
register int i;
traverse (register int i)
{
register unsigned *fp1;
register unsigned *fp2;

View File

@ -15,10 +15,11 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/*
/*
lex is the entry point. It is called from reader.c.
It returns one of the token-type codes defined in lex.h.
When an identifier is seen, the code IDENTIFIER is returned
@ -26,13 +27,12 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
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 */
#include "symtab.h"
#include "lex.h"
#include "new.h"
#include "alloc.h"
/* flags set by % directives */
extern int definesflag; /* for -d */
@ -50,19 +50,27 @@ extern char *spec_file_prefix; /* for -b */
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;
@ -72,7 +80,7 @@ static bucket *unlexed_symval; /* by the next call to lex */
void
init_lex()
init_lex (void)
{
maxtoken = 100;
token_buffer = NEW2 (maxtoken + 1, char);
@ -80,9 +88,8 @@ init_lex()
}
static char *
grow_token_buffer (p)
char *p;
char *
grow_token_buffer (char *p)
{
int offset = p - token_buffer;
maxtoken *= 2;
@ -92,7 +99,7 @@ grow_token_buffer (p)
int
skip_white_space()
skip_white_space (void)
{
register int c;
register int inside;
@ -107,9 +114,9 @@ skip_white_space()
{
case '/':
c = getc(finput);
if (c != '*' && c != '/')
if (c != '*' && c != '/')
{
warn("unexpected `/' found and ignored");
warn(_("unexpected `/' found and ignored"));
break;
}
cplus_comment = (c == '/');
@ -138,7 +145,7 @@ skip_white_space()
c = getc(finput);
}
else if (c == EOF)
fatal("unterminated comment");
fatal(_("unterminated comment"));
else
c = getc(finput);
}
@ -162,12 +169,11 @@ skip_white_space()
/* 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)
fatal("Unexpected end of file");
fatal(_("Unexpected end of file"));
return c;
}
@ -178,10 +184,7 @@ safegetc(f)
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;
@ -189,9 +192,9 @@ literalchar(pp, pcode, term)
int wasquote = 0;
c = safegetc(finput);
if (c == '\n')
if (c == '\n')
{
warn("unescaped newline in constant");
warn(_("unescaped newline in constant"));
ungetc(c, finput);
code = '?';
wasquote = 1;
@ -199,7 +202,7 @@ literalchar(pp, pcode, term)
else if (c != '\\')
{
code = c;
if (c == term)
if (c == term)
wasquote = 1;
}
else
@ -211,7 +214,7 @@ literalchar(pp, pcode, term)
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 = '\"';
@ -223,7 +226,7 @@ literalchar(pp, pcode, term)
code = (code * 8) + (c - '0');
if (code >= 256 || code < 0)
{
warni("octal value outside range 0...255: `\\%o'", code);
warni(_("octal value outside range 0...255: `\\%o'"), code);
code &= 0xFF;
break;
}
@ -243,11 +246,11 @@ literalchar(pp, pcode, term)
code *= 16, code += c - 'a' + 10;
else if (c >= 'A' && c <= 'F')
code *= 16, code += c - 'A' + 10;
else
else
break;
if (code >= 256 || code<0)
{
warni("hexadecimal value above 255: `\\x%x'", code);
warni(_("hexadecimal value above 255: `\\x%x'"), code);
code &= 0xFF;
break;
}
@ -257,7 +260,7 @@ literalchar(pp, pcode, term)
}
else
{
warni ("unknown escape sequence: `\\' followed by `%s'",
warns (_("unknown escape sequence: `\\' followed by `%s'"),
printable_version(c));
code = '?';
}
@ -268,11 +271,13 @@ literalchar(pp, pcode, term)
so that `\012' and `\n' can be interchangeable. */
p = *pp;
if (code >= 040 && code < 0177)
if (code == term && wasquote)
*p++ = code;
else if (code == '\\') {*p++ = '\\'; *p++ = '\\';}
else if (code == '\'') {*p++ = '\\'; *p++ = '\'';}
else if (code == '\"') {*p++ = '\\'; *p++ = '\"';}
else if (code >= 040 && code < 0177)
*p++ = code;
else if (code == '\t') {*p++ = '\\'; *p++ = 't';}
else if (code == '\n') {*p++ = '\\'; *p++ = 'n';}
else if (code == '\r') {*p++ = '\\'; *p++ = 'r';}
@ -293,8 +298,7 @@ literalchar(pp, pcode, term)
void
unlex(token)
int token;
unlex (int token)
{
unlexed = token;
unlexed_symval = symval;
@ -302,7 +306,7 @@ unlex(token)
int
lex()
lex (void)
{
register int c;
char *p;
@ -381,6 +385,7 @@ lex()
{
int code, discode;
char discard[10], *dp;
p = token_buffer;
*p++ = '\'';
literalchar(&p, &code, '\'');
@ -388,9 +393,13 @@ lex()
c = getc(finput);
if (c != '\'')
{
warn("use \"...\" for multi-character literal tokens");
dp = discard;
while (literalchar(&dp, &discode, '\'')) {}
warn(_("use \"...\" for multi-character literal tokens"));
while (1)
{
dp = discard;
if (! literalchar(&dp, &discode, '\''))
break;
}
}
*p++ = '\'';
*p = 0;
@ -463,10 +472,10 @@ lex()
while (c != '>')
{
if (c == EOF)
fatal("unterminated type name at end of file");
if (c == '\n')
fatal(_("unterminated type name at end of file"));
if (c == '\n')
{
warn("unterminated type name");
warn(_("unterminated type name"));
ungetc(c, finput);
break;
}
@ -479,7 +488,7 @@ lex()
}
*p = 0;
return (TYPENAME);
case '%':
return (parse_percent_token());
@ -489,13 +498,13 @@ lex()
}
}
/* the following table dictates the action taken for the various
/* the following table dictates the action taken for the various
% directives. A setflag value causes the named flag to be
set. A retval action returns the code.
*/
struct percent_table_struct {
char *name;
void *setflag;
void *setflag;
int retval;
} percent_table[] =
{
@ -537,8 +546,8 @@ struct percent_table_struct {
/* 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}
@ -548,7 +557,7 @@ struct percent_table_struct {
Assumes the % has already been read and discarded. */
int
parse_percent_token ()
parse_percent_token (void)
{
register int c;
register char *p;
@ -583,7 +592,7 @@ parse_percent_token ()
case '=':
return (PREC);
}
if (!isalpha(c))
if (!isalpha(c))
return (ILLEGAL);
p = token_buffer;

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#define ENDFILE 0

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef eta10
#define MAXSHORT 2147483647

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <stdio.h>
@ -24,6 +25,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
extern int lineno;
extern int verboseflag;
extern char *infile;
/* Nonzero means failure has been detected; don't write a parser file. */
int failure;
@ -31,20 +33,43 @@ 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, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
failure = 0;
lineno = 0;
getargs(argc, argv);
@ -86,6 +111,7 @@ main(argc, argv)
/* output the tables and the parser to ftable. In file output. */
output();
done(failure);
return failure;
}
/* functions to report errors which prevent a parser from being generated */
@ -95,8 +121,7 @@ main(argc, argv)
either C itself, or the corresponding \DDD code. */
char *
printable_version(c)
char c;
printable_version (int c)
{
static char buf[10];
if (c < ' ' || c >= '\177')
@ -113,27 +138,31 @@ printable_version(c)
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);
return buf;
}
static void
fatal_banner (void)
{
if (infile == 0)
fprintf(stderr, _("%s: fatal error: "), program_name);
else
fprintf(stderr, _("%s:%d: fatal error: "), infile, lineno);
}
/* Print the message S for a fatal error. */
void
fatal(s)
char *s;
fatal (char *s)
{
extern char *infile;
if (infile == 0)
fprintf(stderr, "fatal error: %s\n", s);
else
fprintf(stderr, "\"%s\", line %d: %s\n", infile, lineno, s);
done(1);
fatal_banner ();
fputs (s, stderr);
fputc ('\n', stderr);
done (1);
}
@ -141,98 +170,95 @@ fatal(s)
and incorporate string X1. */
void
fatals(fmt, x1)
char *fmt, *x1;
fatals (char *fmt, char *x1)
{
char buffer[200];
sprintf(buffer, fmt, x1);
fatal(buffer);
fatal_banner ();
fprintf (stderr, fmt, x1);
fputc ('\n', stderr);
done (1);
}
static void
warn_banner (void)
{
if (infile == 0)
fprintf(stderr, _("%s: "), program_name);
else
fprintf(stderr, _("%s:%d: "), infile, lineno);
failure = 1;
}
/* Print a warning message S. */
void
warn(s)
char *s;
warn (char *s)
{
extern char *infile;
if (infile == 0)
fprintf(stderr, "error: %s\n", s);
else
fprintf(stderr, "(\"%s\", line %d) error: %s\n",
infile, lineno, s);
failure = 1;
warn_banner ();
fputs (s, stderr);
fputc ('\n', stderr);
}
/* Print a warning message containing the string for the integer X1.
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);
warn(buffer);
warn_banner ();
fprintf (stderr, fmt, x1);
fputc ('\n', stderr);
}
/* Print a warning message containing the string 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);
warn(buffer);
warn_banner ();
fprintf (stderr, fmt, x1);
fputc ('\n', stderr);
}
/* Print a warning message containing the two strings X1 and X2.
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);
warn(buffer);
warn_banner ();
fprintf (stderr, fmt, x1, x2);
fputc ('\n', stderr);
}
/* Print a warning message containing the 3 strings X1, X2, X3.
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);
warn(buffer);
warn_banner ();
fprintf (stderr, fmt, x1, x2, x3);
fputc ('\n', stderr);
}
/* Print a message for the fatal occurence of more than MAXSHORT
instances of whatever is denoted by the string S. */
void
toomany(s)
char *s;
toomany (char *s)
{
char buffer[200];
sprintf(buffer, "limit of %d exceeded, too many %s", MAXSHORT, s);
fatal(buffer);
fatal_banner ();
fprintf (stderr, _("too many %s (max %d)"), s, MAXSHORT);
fputc ('\n', stderr);
done (1);
}
/* Abort for an internal error denoted by string S. */
void
berror(s)
char *s;
berror (char *s)
{
fprintf(stderr, "internal error, %s\n", s);
fprintf(stderr, _("%s: internal error: %s\n"), program_name, s);
abort();
}

View File

@ -4,9 +4,29 @@
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.10 1996/05/03 07:37:52 friedman Exp $
# $Id: mkinstalldirs,v 1.2 1999/04/11 00:23:56 bje Exp $
errstatus=0
dirmode=""
usage="\
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
# process command line arguments
while test $# -gt 0 ; do
case "${1}" in
-h | --help | --h* ) # -h for help
echo "${usage}" 1>&2; exit 0 ;;
-m ) # -m PERM arg
shift
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
dirmode="${1}"
shift ;;
-- ) shift; break ;; # stop option processing
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
* ) break ;; # first non-opt arg
esac
done
for file
do
@ -22,12 +42,23 @@ do
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp" 1>&2
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=""
chmod $dirmode "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
@ -37,4 +68,7 @@ done
exit $errstatus
# mkinstalldirs ends here
# Local Variables:
# mode:shell-script
# sh-indentation:3
# End:

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
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.
@ -25,14 +26,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "system.h"
#include "types.h"
#include "gram.h"
#include "new.h"
#include "alloc.h"
char *nullable;
void free_nullable PARAMS((void));
void set_nullable PARAMS((void));
void
set_nullable()
set_nullable (void)
{
register short *r;
register short *s1;
@ -49,7 +52,7 @@ set_nullable()
short *r1;
#ifdef TRACE
fprintf(stderr, "Entering set_nullable");
fprintf(stderr, _("Entering set_nullable"));
#endif
nullable = NEW2(nvars, char) - ntokens;
@ -130,7 +133,7 @@ set_nullable()
void
free_nullable()
free_nullable (void)
{
FREE(nullable + ntokens);
}

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* functions to output parsing data to various files. Entries are:
@ -105,7 +106,7 @@ YYNTBASE = ntokens.
#include <stdio.h>
#include "system.h"
#include "machine.h"
#include "new.h"
#include "alloc.h"
#include "files.h"
#include "gram.h"
#include "state.h"
@ -132,37 +133,40 @@ extern char *consistent;
extern short *goto_map;
extern short *from_state;
extern short *to_state;
extern int lineno;
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();
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();
extern void fatals();
extern char *int_to_string();
extern void reader_output_yylsp();
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;
@ -197,7 +201,7 @@ register YYLTYPE *yylsp;\n{\n switch (n)\n{"
void
output_headers()
output_headers (void)
{
if (semantic_parser)
fprintf(fguard, GUARDSTR, attrsfile);
@ -226,7 +230,7 @@ output_headers()
void
output_trailers()
output_trailers (void)
{
if (semantic_parser)
fprintf(fguard, "\n }\n}\n");
@ -243,7 +247,7 @@ output_trailers()
void
output()
output (void)
{
int c;
@ -286,7 +290,7 @@ output()
void
output_token_translations()
output_token_translations (void)
{
register int i, j;
/* register short *sp; JF unused */
@ -330,7 +334,7 @@ output_token_translations()
void
output_gram()
output_gram (void)
{
register int i;
register int j;
@ -395,7 +399,7 @@ output_gram()
void
output_stos()
output_stos (void)
{
register int i;
register int j;
@ -425,7 +429,7 @@ output_stos()
void
output_rule_data()
output_rule_data (void)
{
register int i;
register int j;
@ -600,7 +604,7 @@ output_rule_data()
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);
@ -612,7 +616,7 @@ output_defines()
/* compute and output yydefact, yydefgoto, yypact, yypgoto, yytable and yycheck. */
void
output_actions()
output_actions (void)
{
nvectors = nstates + nvars;
@ -649,7 +653,7 @@ output_actions()
is saved for putting into yytable later. */
void
token_actions()
token_actions (void)
{
register int i;
register int j;
@ -699,14 +703,13 @@ token_actions()
a token gets to handle it. */
int
action_row(state)
int state;
action_row (int state)
{
register int i;
register int j;
register int k;
register int m;
register int n;
register int m = 0;
register int n = 0;
register int count;
register int default_rule;
register int nreds;
@ -863,8 +866,7 @@ int state;
void
save_row(state)
int state;
save_row (int state)
{
register int i;
register int count;
@ -908,7 +910,7 @@ int state;
is saved for putting into yytable later. */
void
goto_actions()
goto_actions (void)
{
register int i;
register int j;
@ -947,8 +949,7 @@ goto_actions()
int
default_goto(symbol)
int symbol;
default_goto (int symbol)
{
register int i;
register int m;
@ -985,9 +986,7 @@ int symbol;
void
save_column(symbol, default_state)
int symbol;
int default_state;
save_column (int symbol, int default_state)
{
register int i;
register int m;
@ -1035,7 +1034,7 @@ int default_state;
the actions and gotos information into yytable. */
void
sort_actions()
sort_actions (void)
{
register int i;
register int j;
@ -1071,7 +1070,7 @@ sort_actions()
void
pack_table()
pack_table (void)
{
register int i;
register int place;
@ -1120,8 +1119,7 @@ pack_table()
int
matching_state(vector)
int vector;
matching_state (int vector)
{
register int i;
register int j;
@ -1161,14 +1159,13 @@ int vector;
int
pack_vector(vector)
int vector;
pack_vector (int vector)
{
register int i;
register int j;
register int k;
register int t;
register int loc;
register int loc = 0;
register int ok;
register short *from;
register short *to;
@ -1190,7 +1187,7 @@ int vector;
{
loc = j + from[k];
if (loc > MAXTABLE)
fatals("maximum table size (%s) exceeded", int_to_string(MAXTABLE));
fatals(_("maximum table size (%s) exceeded"), int_to_string(MAXTABLE));
if (table[loc] != 0)
ok = 0;
@ -1231,7 +1228,7 @@ int vector;
and the vectors whose elements index the portion starts */
void
output_base()
output_base (void)
{
register int i;
register int j;
@ -1282,7 +1279,7 @@ output_base()
void
output_table()
output_table (void)
{
register int i;
register int j;
@ -1314,7 +1311,7 @@ output_table()
void
output_check()
output_check (void)
{
register int i;
register int j;
@ -1348,7 +1345,7 @@ output_check()
/* copy the parser code into the ftable file at the end. */
void
output_parser()
output_parser (void)
{
register int c;
#ifdef DONTDEF
@ -1407,7 +1404,7 @@ output_parser()
/* 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.
@ -1418,6 +1415,7 @@ output_parser()
}
else
putc(c, ftable);
}
if (c == EOF)
break;
putc(c, ftable);
@ -1425,10 +1423,9 @@ output_parser()
}
void
output_program()
output_program (void)
{
register int c;
extern int lineno;
if (!nolinesflag)
fprintf(ftable, "#line %d \"%s\"\n", lineno, infile);
@ -1443,7 +1440,7 @@ output_program()
void
free_itemsets()
free_itemsets (void)
{
register core *cp,*cptmp;
@ -1457,7 +1454,7 @@ free_itemsets()
void
free_shifts()
free_shifts (void)
{
register shifts *sp,*sptmp;/* JF derefrenced freed ptr */
@ -1471,7 +1468,7 @@ free_shifts()
void
free_reductions()
free_reductions (void)
{
register reductions *rp,*rptmp;/* JF fixed freed ptr */

View File

@ -15,13 +15,14 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
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 "new.h"
#include "alloc.h"
#include "files.h"
#include "gram.h"
#include "state.h"
@ -39,18 +40,20 @@ extern char any_conflicts;
extern char *conflicts;
extern int final_state;
extern void conflict_log();
extern void verbose_conflict_log();
extern void print_reductions();
extern void conflict_log PARAMS((void));
extern void verbose_conflict_log PARAMS((void));
extern void print_reductions PARAMS((int));
void print_token();
void print_state();
void print_core();
void print_actions();
void print_grammar();
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)
{
@ -60,7 +63,7 @@ terse()
void
verbose()
verbose (void)
{
register int i;
@ -77,26 +80,23 @@ verbose()
void
print_token(extnum, token)
int extnum, token;
print_token (int extnum, int token)
{
fprintf(foutput, " type %d is %s\n", extnum, tags[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);
fprintf(foutput, _("\n\nstate %d\n\n"), state);
print_core(state);
print_actions(state);
}
void
print_core(state)
int state;
print_core (int state)
{
register int i;
register int k;
@ -133,7 +133,7 @@ int state;
sp++;
}
fprintf (foutput, " (rule %d)", rule);
fprintf (foutput, _(" (rule %d)"), rule);
putc('\n', foutput);
}
@ -142,8 +142,7 @@ int state;
void
print_actions(state)
int state;
print_actions (int state)
{
register int i;
register int k;
@ -161,9 +160,9 @@ int state;
if (!shiftp && !redp)
{
if (final_state == state)
fprintf(foutput, " $default\taccept\n");
fprintf(foutput, _(" $default\taccept\n"));
else
fprintf(foutput, " NO ACTIONS\n");
fprintf(foutput, _(" NO ACTIONS\n"));
return;
}
@ -179,9 +178,9 @@ int state;
/* The following line used to be turned off. */
if (ISVAR(symbol)) break;
if (symbol==0) /* I.e. strcmp(tags[symbol],"$")==0 */
fprintf(foutput, " $ \tgo to state %d\n", state1);
fprintf(foutput, _(" $ \tgo to state %d\n"), state1);
else
fprintf(foutput, " %-4s\tshift, and go to state %d\n",
fprintf(foutput, _(" %-4s\tshift, and go to state %d\n"),
tags[symbol], state1);
}
@ -204,7 +203,7 @@ int state;
{
if (! errp->errs[j]) continue;
symbol = errp->errs[j];
fprintf(foutput, " %-4s\terror (nonassociative)\n", tags[symbol]);
fprintf(foutput, _(" %-4s\terror (nonassociative)\n"), tags[symbol]);
}
if (j > 0)
@ -215,7 +214,7 @@ int state;
{
rule = redp->rules[0];
symbol = rlhs[rule];
fprintf(foutput, " $default\treduce using rule %d (%s)\n\n",
fprintf(foutput, _(" $default\treduce using rule %d (%s)\n\n"),
rule, tags[symbol]);
}
else if (redp)
@ -230,7 +229,7 @@ int state;
if (! shiftp->shifts[i]) continue;
state1 = shiftp->shifts[i];
symbol = accessing_symbol[state1];
fprintf(foutput, " %-4s\tgo to state %d\n", tags[symbol], state1);
fprintf(foutput, _(" %-4s\tgo to state %d\n"), tags[symbol], state1);
}
putc('\n', foutput);
@ -243,7 +242,7 @@ int state;
else
void
print_grammar()
print_grammar (void)
{
int i, j;
short* rule;
@ -251,23 +250,23 @@ print_grammar()
int column = 0;
/* rule # : LHS -> RHS */
fputs("\nGrammar\n", foutput);
fputs(_("\nGrammar\n"), foutput);
for (i = 1; i <= nrules; i++)
/* Don't print rules disabled in reduce_grammar_tables. */
if (rlhs[i] >= 0)
{
fprintf(foutput, "rule %-4d %s ->", i, tags[rlhs[i]]);
fprintf(foutput, _("rule %-4d %s ->"), i, tags[rlhs[i]]);
rule = &ritem[rrhs[i]];
if (*rule > 0)
while (*rule > 0)
fprintf(foutput, " %s", tags[*rule++]);
else
fputs (" /* empty */", foutput);
fputs (_(" /* empty */"), foutput);
putc('\n', foutput);
}
/* TERMINAL (type #) : rule #s terminal is on RHS */
fputs("\nTerminals, with rules where they appear\n\n", foutput);
fputs(_("\nTerminals, with rules where they appear\n\n"), foutput);
fprintf(foutput, "%s (-1)\n", tags[0]);
if (translations)
{
@ -315,7 +314,7 @@ print_grammar()
fprintf (foutput, "%s\n", buffer);
}
fputs("\nNonterminals, with rules where they appear\n\n", foutput);
fputs(_("\nNonterminals, with rules where they appear\n\n"), foutput);
for (i = ntokens; i <= nsyms - 1; i++)
{
int left_count = 0, right_count = 0;
@ -341,7 +340,7 @@ print_grammar()
if (left_count > 0)
{
END_TEST (50);
sprintf (buffer + strlen(buffer), " on left:");
sprintf (buffer + strlen(buffer), _(" on left:"));
for (j = 1; j <= nrules; j++)
{
@ -356,7 +355,7 @@ print_grammar()
if (left_count > 0)
sprintf (buffer + strlen(buffer), ",");
END_TEST (50);
sprintf (buffer + strlen(buffer), " on right:");
sprintf (buffer + strlen(buffer), _(" on right:"));
for (j = 1; j <= nrules; j++)
{
for (rule = &ritem[rrhs[j]]; *rule > 0; rule++)

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/*
@ -33,12 +34,13 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "files.h"
#include "gram.h"
#include "machine.h"
#include "new.h"
#include "alloc.h"
extern char **tags; /* reader.c */
extern int verboseflag; /* getargs.c */
static int statisticsflag; /* XXXXXXX */
extern int fixed_outfiles;
#ifndef TRUE
#define TRUE (1)
@ -61,21 +63,22 @@ static int nuseful_productions, nuseless_productions,
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 *));
bool
bits_equal (L, R, n)
BSet L;
BSet R;
int n;
bits_equal (BSet L, BSet R, int n)
{
int i;
@ -87,13 +90,12 @@ int n;
int
nbits (i)
unsigned i;
nbits (unsigned i)
{
int count = 0;
while (i != 0) {
i ^= (i & -i);
i ^= (i & ((unsigned) (- (int) i)));
++count;
}
return count;
@ -101,9 +103,7 @@ unsigned i;
int
bits_size (S, n)
BSet S;
int n;
bits_size (BSet S, int n)
{
int i, count = 0;
@ -113,7 +113,7 @@ int n;
}
void
reduce_grammar ()
reduce_grammar (void)
{
bool reduced;
@ -138,7 +138,7 @@ reduce_grammar ()
print_notices();
if (!BITISSET(N, start_symbol - ntokens))
fatals("Start symbol %s does not derive any sentence",
fatals(_("Start symbol %s does not derive any sentence"),
tags[start_symbol]);
reduce_grammar_tables();
@ -151,8 +151,8 @@ reduce_grammar ()
/**/ statisticsflag = FALSE; /* someday getopts should handle this */
if (statisticsflag == TRUE)
fprintf(stderr,
"reduced %s defines %d terminal%s, %d nonterminal%s\
, and %d production%s.\n", infile,
_("reduced %s defines %d terminal%s, %d nonterminal%s\
, and %d production%s.\n"), infile,
ntokens, (ntokens == 1 ? "" : "s"),
nvars, (nvars == 1 ? "" : "s"),
nrules, (nrules == 1 ? "" : "s"));
@ -169,14 +169,12 @@ reduce_grammar ()
/*
* 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;
static bool
useful_production (int i, BSet N0)
{
rule r;
short n;
@ -188,7 +186,7 @@ BSet 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;
}
@ -196,8 +194,8 @@ BSet N;
/* Remember that rules are 1-origin, symbols are 0-origin. */
static void
useless_nonterminals ()
static void
useless_nonterminals (void)
{
BSet Np, Ns;
int i, n;
@ -218,7 +216,7 @@ useless_nonterminals ()
* set being computed remains unchanged. Any nonterminals not in the
* set at that point are useless in that they will never be used in
* deriving a sentence of the language.
*
*
* This iteration doesn't use any special traversal over the
* productions. A set is kept of all productions for which all the
* nonterminals in the RHS are in useful. Only productions not in
@ -253,8 +251,8 @@ useless_nonterminals ()
N = Np;
}
static void
inaccessable_symbols ()
static void
inaccessable_symbols (void)
{
BSet Vp, Vs, Pp;
int i, n;
@ -270,13 +268,13 @@ inaccessable_symbols ()
* reachable symbols, add the production to the set of reachable
* productions, and add all of the nonterminals in the RHS of the
* production to the set of reachable symbols.
*
*
* Consider only the (partially) reduced grammar which has only
* nonterminals in N and productions in P.
*
*
* The result is the set P of productions in the reduced grammar, and
* the set V of symbols in the reduced grammar.
*
*
* Although this algorithm also computes the set of terminals which are
* reachable, no terminal will be deleted from the grammar. Some
* terminals might not be in the grammar but might be generated by
@ -302,7 +300,7 @@ inaccessable_symbols ()
Vp[i] = V[i];
for (i = 1; i <= nrules; i++)
{
if (!BITISSET(Pp, i) && BITISSET(P, i) &&
if (!BITISSET(Pp, i) && BITISSET(P, i) &&
BITISSET(V, rlhs[i]))
{
for (r = &ritem[rrhs[i]]; *r >= 0; r++)
@ -352,8 +350,8 @@ inaccessable_symbols ()
SETBIT(V1, rprecsym[i]);
}
static void
reduce_grammar_tables ()
static void
reduce_grammar_tables (void)
{
/* This is turned off because we would need to change the numbers
in the case statements in the actions file. */
@ -481,8 +479,8 @@ reduce_grammar_tables ()
}
}
static void
print_results ()
static void
print_results (void)
{
int i;
/* short j; JF unused */
@ -491,7 +489,7 @@ print_results ()
if (nuseless_nonterminals > 0)
{
fprintf(foutput, "Useless nonterminals:\n\n");
fprintf(foutput, _("Useless nonterminals:\n\n"));
for (i = ntokens; i < nsyms; i++)
if (!BITISSET(V, i))
fprintf(foutput, " %s\n", tags[i]);
@ -503,7 +501,7 @@ print_results ()
{
if (!b)
{
fprintf(foutput, "\n\nTerminals which are not used:\n\n");
fprintf(foutput, _("\n\nTerminals which are not used:\n\n"));
b = TRUE;
}
fprintf(foutput, " %s\n", tags[i]);
@ -512,7 +510,7 @@ print_results ()
if (nuseless_productions > 0)
{
fprintf(foutput, "\n\nUseless rules:\n\n");
fprintf(foutput, _("\n\nUseless rules:\n\n"));
for (i = 1; i <= nrules; i++)
{
if (!BITISSET(P, i))
@ -531,8 +529,8 @@ print_results ()
fprintf(foutput, "\n\n");
}
void
dump_grammar ()
void
dump_grammar (void)
{
int i;
rule r;
@ -540,23 +538,23 @@ dump_grammar ()
fprintf(foutput,
"ntokens = %d, nvars = %d, nsyms = %d, nrules = %d, nitems = %d\n\n",
ntokens, nvars, nsyms, nrules, nitems);
fprintf(foutput, "Variables\n---------\n\n");
fprintf(foutput, "Value Sprec Sassoc Tag\n");
fprintf(foutput, _("Variables\n---------\n\n"));
fprintf(foutput, _("Value Sprec Sassoc Tag\n"));
for (i = ntokens; i < nsyms; i++)
fprintf(foutput, "%5d %5d %5d %s\n",
i, sprec[i], sassoc[i], tags[i]);
fprintf(foutput, "\n\n");
fprintf(foutput, "Rules\n-----\n\n");
fprintf(foutput, _("Rules\n-----\n\n"));
for (i = 1; i <= nrules; i++)
{
fprintf(foutput, "%-5d(%5d%5d)%5d : (@%-5d)",
fprintf(foutput, "%-5d(%5d%5d)%5d : (@%-5d)",
i, rprec[i], rassoc[i], rlhs[i], rrhs[i]);
for (r = &ritem[rrhs[i]]; *r > 0; r++)
fprintf(foutput, "%5d", *r);
fprintf(foutput, " [%d]\n", -(*r));
}
fprintf(foutput, "\n\n");
fprintf(foutput, "Rules interpreted\n-----------------\n\n");
fprintf(foutput, _("Rules interpreted\n-----------------\n\n"));
for (i = 1; i <= nrules; i++)
{
fprintf(foutput, "%-5d %s :", i, tags[rlhs[i]]);
@ -568,28 +566,26 @@ dump_grammar ()
}
static void
print_notices ()
static void
print_notices (void)
{
extern int fixed_outfiles;
if (fixed_outfiles && nuseless_productions)
fprintf(stderr, "%d rules never reduced\n", nuseless_productions);
fprintf(stderr, _("%d rules never reduced\n"), nuseless_productions);
fprintf(stderr, "%s contains ", infile);
fprintf(stderr, _("%s contains "), infile);
if (nuseless_nonterminals > 0)
{
fprintf(stderr, "%d useless nonterminal%s",
fprintf(stderr, _("%d useless nonterminal%s"),
nuseless_nonterminals,
(nuseless_nonterminals == 1 ? "" : "s"));
}
if (nuseless_nonterminals > 0 && nuseless_productions > 0)
fprintf(stderr, " and ");
fprintf(stderr, _(" and "));
if (nuseless_productions > 0)
{
fprintf(stderr, "%d useless rule%s",
fprintf(stderr, _("%d useless rule%s"),
nuseless_productions,
(nuseless_productions == 1 ? "" : "s"));
}

3
contrib/bison/stamp-vti Normal file
View File

@ -0,0 +1,3 @@
@set UPDATED 14 January 1999
@set EDITION 1.28
@set VERSION 1.28

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* These type definitions are used to represent a nondeterministic

View File

@ -15,12 +15,13 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include "system.h"
#include "new.h"
#include "alloc.h"
#include "symtab.h"
#include "gram.h"
@ -29,11 +30,12 @@ bucket **symtab;
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;
@ -48,9 +50,8 @@ char *key;
char *
copys(s)
char *s;
static char *
copys (char *s)
{
register int i;
register char *cp;
@ -67,7 +68,7 @@ char *s;
void
tabinit()
tabinit (void)
{
/* register int i; JF unused */
@ -79,8 +80,7 @@ tabinit()
bucket *
getsym(key)
char *key;
getsym (char *key)
{
register int hashval;
register bucket *bp;
@ -127,7 +127,7 @@ char *key;
void
free_symtab()
free_symtab (void)
{
register int i;
register bucket *bp,*bptmp;/* JF don't use ptr after free */

View File

@ -15,8 +15,12 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define TABSIZE 1009
@ -53,4 +57,4 @@ typedef
extern bucket **symtab;
extern bucket *firstsymbol;
extern bucket *getsym();
extern bucket *getsym PARAMS((char *));

View File

@ -1,11 +1,28 @@
#ifndef BISON_SYSTEM_H
#define BISON_SYSTEM_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef MSDOS
#include <io.h>
#endif
#ifdef _MSC_VER
#include <stdlib.h>
#include <process.h>
#define getpid _getpid
#endif
#if defined(HAVE_STDLIB_H) || defined(MSDOS)
#include <stdlib.h>
#endif
#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
#if (defined(VMS) || defined(MSDOS)) && !defined(HAVE_STRING_H)
#define HAVE_STRING_H 1
#endif
@ -23,3 +40,32 @@
#include <strings.h>
/* memory.h and strings.h conflict on some systems. */
#endif /* not STDC_HEADERS and not HAVE_STRING_H */
#if defined(STDC_HEADERS) || defined(HAVE_CTYPE_H)
#include <ctype.h>
#endif
#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif
#ifndef HAVE_SETLOCALE
# define setlocale(Category, Locale)
#endif
#ifdef ENABLE_NLS
# include <libintl.h>
# define _(Text) gettext (Text)
#else
# undef bindtextdomain
# define bindtextdomain(Domain, Directory)
# undef textdomain
# define textdomain(Domain)
# define _(Text) Text
#endif
#define N_(Text) Text
#ifndef LOCALEDIR
#define LOCALEDIR "/usr/local/share/locale"
#endif
#endif /* BISON_SYSTEM_H */

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
typedef

View File

@ -0,0 +1,3 @@
@set UPDATED 14 January 1999
@set EDITION 1.28
@set VERSION 1.28

View File

@ -15,7 +15,8 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <ctype.h>

View File

@ -15,21 +15,22 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
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));
/* 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;
@ -87,9 +88,7 @@ int n;
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;